com.xuggle.mediatool
Class MediaToolAdapter

Package class diagram package MediaToolAdapter
java.lang.Object
  extended by com.xuggle.mediatool.AMediaGeneratorMixin
      extended by com.xuggle.mediatool.AMediaToolMixin
          extended by com.xuggle.mediatool.MediaToolAdapter
All Implemented Interfaces:
IMediaGenerator, IMediaListener, IMediaTool

public class MediaToolAdapter
extends AMediaToolMixin
implements IMediaTool

An implementation of IMediaTool that forwards all IMediaListener events to listeners registered with addListener(IMediaListener).

Forwards every call on the IMediaListener interface methods to all listeners added on the IMediaGenerator interface, and declares its support of the IMediaTool interface.

This can be useful if you want to implement your own IMediaTool, want help implementing the IMediaListener call backs, and want your parent class to declare support for the IMediaTool interface.


Constructor Summary
MediaToolAdapter()
           
 
Method Summary
 boolean addListener(IMediaListener listener)
          Adds this listener to a thread-safe set.
 Collection<IMediaListener> getListeners()
          Get a read-only collection of added IMediaListener objects.
 void onAddStream(IAddStreamEvent event)
          Calls IMediaListener.onAddStream(IAddStreamEvent) on all registered listeners.
 void onAudioSamples(IAudioSamplesEvent event)
          Calls IMediaListener.onAudioSamples(IAudioSamplesEvent) on all registered listeners.
 void onClose(ICloseEvent event)
          Calls IMediaListener.onClose(ICloseEvent) on all registered listeners.
 void onCloseCoder(ICloseCoderEvent event)
          Calls IMediaListener.onCloseCoder(ICloseCoderEvent) on all registered listeners.
 void onFlush(IFlushEvent event)
          Calls IMediaListener.onFlush(IFlushEvent) on all registered listeners.
 void onOpen(IOpenEvent event)
          Calls IMediaListener.onOpen(IOpenEvent) on all registered listeners.
 void onOpenCoder(IOpenCoderEvent event)
          Calls IMediaListener.onOpenCoder(IOpenCoderEvent) on all registered listeners.
 void onReadPacket(IReadPacketEvent event)
          Calls IMediaListener.onReadPacket(IReadPacketEvent) on all registered listeners.
 void onVideoPicture(IVideoPictureEvent event)
          Calls IMediaListener.onVideoPicture(IVideoPictureEvent) on all registered listeners.
 void onWriteHeader(IWriteHeaderEvent event)
          Calls IMediaListener.onWriteHeader(IWriteHeaderEvent) on all registered listeners.
 void onWritePacket(IWritePacketEvent event)
          Calls IMediaListener.onWritePacket(IWritePacketEvent) on all registered listeners.
 void onWriteTrailer(IWriteTrailerEvent event)
          Calls IMediaListener.onWriteTrailer(IWriteTrailerEvent) on all registered listeners.
 boolean removeListener(IMediaListener listener)
          Remove this listener from the thread-safe set of IMediaListener objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MediaToolAdapter

public MediaToolAdapter()
Method Detail

addListener

public boolean addListener(IMediaListener listener)
Adds this listener to a thread-safe set.

Specified by:
addListener in interface IMediaGenerator
Overrides:
addListener in class AMediaGeneratorMixin
Parameters:
listener - the listener to add
Returns:
true if the set was modified when adding this call.

getListeners

public Collection<IMediaListener> getListeners()
Get a read-only collection of added IMediaListener objects.

Specified by:
getListeners in interface IMediaGenerator
Overrides:
getListeners in class AMediaGeneratorMixin
Returns:
a read-only collection of IMediaListener objects.

removeListener

public boolean removeListener(IMediaListener listener)
Remove this listener from the thread-safe set of IMediaListener objects.

Specified by:
removeListener in interface IMediaGenerator
Overrides:
removeListener in class AMediaGeneratorMixin
Parameters:
listener - the listener to remove
Returns:
true if the set was modified by this call.

onAddStream

public void onAddStream(IAddStreamEvent event)
Calls IMediaListener.onAddStream(IAddStreamEvent) on all registered listeners.

Specified by:
onAddStream in interface IMediaListener
Overrides:
onAddStream in class AMediaToolMixin
Parameters:
event - A AddStreamEvent event

onAudioSamples

public void onAudioSamples(IAudioSamplesEvent event)
Calls IMediaListener.onAudioSamples(IAudioSamplesEvent) on all registered listeners.

Specified by:
onAudioSamples in interface IMediaListener
Overrides:
onAudioSamples in class AMediaToolMixin
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.

onClose

public void onClose(ICloseEvent event)
Calls IMediaListener.onClose(ICloseEvent) on all registered listeners.

Specified by:
onClose in interface IMediaListener
Overrides:
onClose in class AMediaToolMixin
Parameters:
event - A CloseEvent

onCloseCoder

public void onCloseCoder(ICloseCoderEvent event)
Calls IMediaListener.onCloseCoder(ICloseCoderEvent) on all registered listeners.

Specified by:
onCloseCoder in interface IMediaListener
Overrides:
onCloseCoder in class AMediaToolMixin
Parameters:
event - A CloseCoderEvent

onFlush

public void onFlush(IFlushEvent event)
Calls IMediaListener.onFlush(IFlushEvent) on all registered listeners.

Specified by:
onFlush in interface IMediaListener
Overrides:
onFlush in class AMediaToolMixin
Parameters:
event - A FlushEvent

onOpen

public void onOpen(IOpenEvent event)
Calls IMediaListener.onOpen(IOpenEvent) on all registered listeners.

Specified by:
onOpen in interface IMediaListener
Overrides:
onOpen in class AMediaToolMixin
Parameters:
event - A OpenEvent

onOpenCoder

public void onOpenCoder(IOpenCoderEvent event)
Calls IMediaListener.onOpenCoder(IOpenCoderEvent) on all registered listeners.

Specified by:
onOpenCoder in interface IMediaListener
Overrides:
onOpenCoder in class AMediaToolMixin
Parameters:
event - A OpenCoderEvent

onReadPacket

public void onReadPacket(IReadPacketEvent event)
Calls IMediaListener.onReadPacket(IReadPacketEvent) on all registered listeners.

Specified by:
onReadPacket in interface IMediaListener
Overrides:
onReadPacket in class AMediaToolMixin
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.

onVideoPicture

public void onVideoPicture(IVideoPictureEvent event)
Calls IMediaListener.onVideoPicture(IVideoPictureEvent) on all registered listeners.

Specified by:
onVideoPicture in interface IMediaListener
Overrides:
onVideoPicture in class AMediaToolMixin
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.

onWriteHeader

public void onWriteHeader(IWriteHeaderEvent event)
Calls IMediaListener.onWriteHeader(IWriteHeaderEvent) on all registered listeners.

Specified by:
onWriteHeader in interface IMediaListener
Overrides:
onWriteHeader in class AMediaToolMixin
Parameters:
event - A WriteHeaderEvent

onWritePacket

public void onWritePacket(IWritePacketEvent event)
Calls IMediaListener.onWritePacket(IWritePacketEvent) on all registered listeners.

Specified by:
onWritePacket in interface IMediaListener
Overrides:
onWritePacket in class AMediaToolMixin
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.

onWriteTrailer

public void onWriteTrailer(IWriteTrailerEvent event)
Calls IMediaListener.onWriteTrailer(IWriteTrailerEvent) on all registered listeners.

Specified by:
onWriteTrailer in interface IMediaListener
Overrides:
onWriteTrailer in class AMediaToolMixin
Parameters:
event - A WriteTrailerEvent


Copyright © 2008, 2010 Xuggle