Package com.xuggle.xuggler

Examples of com.xuggle.xuggler.IMediaData


              }
             
              // if there is an item, dispatch it
              if (null != delayedItem)
              {
                IMediaData item = delayedItem.getItem();
               
                try
                {
                  do
                  {
                    // this is the story of goldilocks testing the the media
                   
                    long now = getMediaTime();
                    long delta = delayedItem.getTimeStamp() - now;
                   
                    // if the media is too new and unripe, goldilocks sleeps
                    // for a bit
                   
                    if (delta >= mEarlyWindow)
                    {
                      //debug("delta: " + delta);
                      try
                      {
                        //sleep(MILLISECONDS.convert(delta - mEarlyWindow, TIME_UNIT));
                        sleep(MILLISECONDS.convert(delta / 3, TIME_UNIT));
                      }
                      catch (InterruptedException e)
                      {
                        // interrupt and return
                        Thread.currentThread().interrupt();
                        return;
                      }
                    }
                    else
                    {
                      // if the media is old and moldy, goldilocks says
                      // "ick" and drops the media on the floor
                     
                      if (delta < -mLateWindow)
                      {
                        debug(
                          "@%5d DROP queue[%2d]: %s[%5d] delta: %d",
                          MILLISECONDS.convert(now, TIME_UNIT),
                          mQueue.size(),
                          (item instanceof IVideoPicture ? "IMAGE"
                            : "sound"), MILLISECONDS.convert(delayedItem
                              .getTimeStamp(), TIME_UNIT), MILLISECONDS.convert(
                                delta, TIME_UNIT));
                      }
                     
                      // if the media is just right, goldilocks dispaches it
                      // for presentiation becuse she's a badass bitch
                     
                      else
                      {
                        dispatch(item, delayedItem.getTimeStamp());
                       
                        // debug("%5d show [%2d]: %s[%5d] delta: %d",
                        // MILLISECONDS.convert(getPresentationTime(), TIME_UNIT),
                        // size(),
                        // (delayedItem.getItem() instanceof BufferedImage
                        // ? "IMAGE"
                        // : "sound"),
                        // MILLISECONDS.convert(delayedItem.getTimeStamp(),
                        // TIME_UNIT),
                        // MILLISECONDS.convert(delta, TIME_UNIT));
                      }
                     
                      // and the moral of the story is don't mess with goldilocks
                     
                      break;
                    }
                  }
                  while (!mDone);
                }
                finally
                {
                  if (item != null)
                    item.delete();
                }
              }
            }
          }
          finally
View Full Code Here


      public void update(IMediaData mediaData)
      {
        synchronized(mMediaLock)
        {
          IMediaData oldMedia = mMediaData;
          mMediaData = mediaData.copyReference();
          if (oldMedia != null)
            oldMedia.delete();
        }
        repaint();
      }
View Full Code Here

      public void update(IMediaData mediaData)
      {
        synchronized(mMediaLock)
        {
          IMediaData oldMedia = mMediaData;
          mMediaData = mediaData.copyReference();
          if (oldMedia != null)
            oldMedia.delete();
        }
        repaint();
      }
View Full Code Here

              }
             
              // if there is an item, dispatch it
              if (null != delayedItem)
              {
                IMediaData item = delayedItem.getItem();
               
                try
                {
                  do
                  {
                    // this is the story of goldilocks testing the the media
                   
                    long now = getMediaTime();
                    long delta = delayedItem.getTimeStamp() - now;
                   
                    // if the media is too new and unripe, goldilocks sleeps
                    // for a bit
                   
                    if (delta >= mEarlyWindow)
                    {
                      //debug("delta: " + delta);
                      try
                      {
                        //sleep(MILLISECONDS.convert(delta - mEarlyWindow, TIME_UNIT));
                        sleep(MILLISECONDS.convert(delta / 3, TIME_UNIT));
                      }
                      catch (InterruptedException e)
                      {
                        // interrupt and return
                        Thread.currentThread().interrupt();
                        return;
                      }
                    }
                    else
                    {
                      // if the media is old and moldy, goldilocks says
                      // "ick" and drops the media on the floor
                     
                      if (delta < -mLateWindow)
                      {
                        debug(
                          "@%5d DROP queue[%2d]: %s[%5d] delta: %d",
                          MILLISECONDS.convert(now, TIME_UNIT),
                          mQueue.size(),
                          (item instanceof IVideoPicture ? "IMAGE"
                            : "sound"), MILLISECONDS.convert(delayedItem
                              .getTimeStamp(), TIME_UNIT), MILLISECONDS.convert(
                                delta, TIME_UNIT));
                      }
                     
                      // if the media is just right, goldilocks dispaches it
                      // for presentiation becuse she's a badass bitch
                     
                      else
                      {
                        dispatch(item, delayedItem.getTimeStamp());
                       
                        // debug("%5d show [%2d]: %s[%5d] delta: %d",
                        // MILLISECONDS.convert(getPresentationTime(), TIME_UNIT),
                        // size(),
                        // (delayedItem.getItem() instanceof BufferedImage
                        // ? "IMAGE"
                        // : "sound"),
                        // MILLISECONDS.convert(delayedItem.getTimeStamp(),
                        // TIME_UNIT),
                        // MILLISECONDS.convert(delta, TIME_UNIT));
                      }
                     
                      // and the moral of the story is don't mess with goldilocks
                     
                      break;
                    }
                  }
                  while (!mDone);
                }
                finally
                {
                  if (item != null)
                    item.delete();
                }
              }
            }
          }
          finally
View Full Code Here

TOP

Related Classes of com.xuggle.xuggler.IMediaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.