com.xuggle.mediatool
Interface IMediaListener

Package class diagram package IMediaListener
All Known Subinterfaces:
IMediaDebugListener, IMediaTool, IMediaViewer, IMediaWriter
All Known Implementing Classes:
DecodeAndCaptureFrames, DecodeAndPlayAudioAndVideo, MediaListenerAdapter, MediaToolAdapter

public interface IMediaListener

Called by IMediaGenerator in response to defined events.

You can use objects that implement this interface to listen to events generated by an IMediaGenerator object. To do that, create your IMediaListener object and attach it to an IMediaGenerator by calling IMediaGenerator.addListener(IMediaListener).

These methods block the calling IMediaGenerator while they process so try to return quickly. If you have long running actions to perform, use a separate thread.


Method Summary
 void onAddStream(IAddStreamEvent event)
          Called after an stream is added to an IMediaGenerator.
 void onAudioSamples(IAudioSamplesEvent event)
          Called after audio samples have been decoded or encoded by an IMediaGenerator
 void onClose(ICloseEvent event)
          Called after an IMediaGenerator is closed.
 void onCloseCoder(ICloseCoderEvent event)
          Called after an decoder or encoder is closed by the IMediaCoder .
 void onFlush(IFlushEvent event)
          Called after a IMediaWriter has flushed its buffers.
 void onOpen(IOpenEvent event)
          Called after an IMediaGenerator is opened.
 void onOpenCoder(IOpenCoderEvent event)
          Called after a decoder or encoder is opened by a IMediaCoder
 void onReadPacket(IReadPacketEvent event)
          Called after a IPacket has been read by a IMediaReader.
 void onVideoPicture(IVideoPictureEvent event)
          Called after a video picture has been decoded by a IMediaReader or encoded by a IMediaWriter.
 void onWriteHeader(IWriteHeaderEvent event)
          Called after a IMediaWriter writes the header.
 void onWritePacket(IWritePacketEvent event)
          Called after a IPacket has been written by a IMediaWriter.
 void onWriteTrailer(IWriteTrailerEvent event)
          Called after a IMediaWriter writes the trailer.
 

Method Detail

onVideoPicture

void onVideoPicture(IVideoPictureEvent event)
Called after a video picture has been decoded by a IMediaReader or encoded by a IMediaWriter.

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.

onAudioSamples

void onAudioSamples(IAudioSamplesEvent event)
Called after audio samples have been decoded or encoded by an IMediaGenerator

Parameters:
event - An event containing the IAudioSamples for this event. The IAudioSamples in this event 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 IAudioSamples.copyReference() to get your own reference to the data.

onOpen

void onOpen(IOpenEvent event)
Called after an IMediaGenerator is opened.

Parameters:
event - A OpenEvent

onClose

void onClose(ICloseEvent event)
Called after an IMediaGenerator is closed.

Parameters:
event - A CloseEvent

onAddStream

void onAddStream(IAddStreamEvent event)
Called after an stream is added to an IMediaGenerator. This occurs when a new stream is added (if writing) or encountered by the IMediaCoder (if reading). If the stream is not already been opened, then onOpenCoder(IOpenCoderEvent) will be called at some later point.

Parameters:
event - A AddStreamEvent event

onOpenCoder

void onOpenCoder(IOpenCoderEvent event)
Called after a decoder or encoder is opened by a IMediaCoder

Parameters:
event - A OpenCoderEvent

onCloseCoder

void onCloseCoder(ICloseCoderEvent event)
Called after an decoder or encoder is closed by the IMediaCoder .

Parameters:
event - A CloseCoderEvent

onReadPacket

void onReadPacket(IReadPacketEvent event)
Called after a IPacket has been read by a IMediaReader.

Parameters:
event - A ReadPacketEvent. This IPacket in this event is only valid for the duration of this call. If you need to use the data after this call has returned, you must either copy the data in this call, or use IPacket.copyReference() to create a new object with a reference you can own.

onWritePacket

void onWritePacket(IWritePacketEvent event)
Called after a IPacket has been written by a IMediaWriter.

Parameters:
event - A WritePacketEvent. The IPacket in this event is only valid for the duration of this call. If you need to use the data after this call has returned, you must either copy the data in this call, or use IPacket.copyReference() to create a new object with a reference you can own.

onWriteHeader

void onWriteHeader(IWriteHeaderEvent event)
Called after a IMediaWriter writes the header.

Parameters:
event - A WriteHeaderEvent

onFlush

void onFlush(IFlushEvent event)
Called after a IMediaWriter has flushed its buffers.

Parameters:
event - A FlushEvent

onWriteTrailer

void onWriteTrailer(IWriteTrailerEvent event)
Called after a IMediaWriter writes the trailer.

Parameters:
event - A WriteTrailerEvent


Copyright © 2008, 2010 Xuggle