com.xuggle.mediatool.demos
Class DecodeAndCaptureFrames

Package class diagram package DecodeAndCaptureFrames
java.lang.Object
  extended by com.xuggle.mediatool.AMediaListenerMixin
      extended by com.xuggle.mediatool.MediaListenerAdapter
          extended by com.xuggle.mediatool.demos.DecodeAndCaptureFrames
All Implemented Interfaces:
IMediaListener

public class DecodeAndCaptureFrames
extends MediaListenerAdapter

Using IMediaReader, takes a media container, finds the first video stream, decodes that stream, and then writes video frames out to a PNG image file every 5 seconds, based on the video presentation timestamps.


Field Summary
static long MICRO_SECONDS_BETWEEN_FRAMES
          The number of micro-seconds between frames.
static double SECONDS_BETWEEN_FRAMES
          The number of seconds between frames.
 
Constructor Summary
DecodeAndCaptureFrames(String filename)
          Construct a DecodeAndCaptureFrames which reads and captures frames from a video file.
 
Method Summary
static void main(String[] args)
          Takes a media container (file) as the first argument, opens it and writes some of it's video frames to PNG image files in the temporary directory.
 void onVideoPicture(IVideoPictureEvent event)
          Called after a video frame has been decoded from a media stream.
 
Methods inherited from class com.xuggle.mediatool.MediaListenerAdapter
onAddStream, onAudioSamples, onClose, onCloseCoder, onFlush, onOpen, onOpenCoder, onReadPacket, onWriteHeader, onWritePacket, onWriteTrailer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECONDS_BETWEEN_FRAMES

public static final double SECONDS_BETWEEN_FRAMES
The number of seconds between frames.

See Also:
Constant Field Values

MICRO_SECONDS_BETWEEN_FRAMES

public static final long MICRO_SECONDS_BETWEEN_FRAMES
The number of micro-seconds between frames.

Constructor Detail

DecodeAndCaptureFrames

public DecodeAndCaptureFrames(String filename)
Construct a DecodeAndCaptureFrames which reads and captures frames from a video file.

Parameters:
filename - the name of the media file to read
Method Detail

main

public static void main(String[] args)
Takes a media container (file) as the first argument, opens it and writes some of it's video frames to PNG image files in the temporary directory.

Parameters:
args - must contain one string which represents a filename

onVideoPicture

public void onVideoPicture(IVideoPictureEvent event)
Called after a video frame has been decoded from a media stream. Optionally a BufferedImage version of the frame may be passed if the calling IMediaReader instance was configured to create BufferedImages. This method blocks, so return quickly.

Specified by:
onVideoPicture in interface IMediaListener
Overrides:
onVideoPicture in class MediaListenerAdapter
Parameters:
event - An event containing either an IVideoPicture, a BufferedImage, or both. The IVideoPicture is only valid for the duration of this callback. If you need to access it after you return, you must either copy the data into your own buffers, or call IVideoPicture.copyReference() to get your own reference to the data.


Copyright © 2008, 2010 Xuggle