de.humatic.dsj
Class DSSampleBuffer

java.lang.Object
  extended by de.humatic.dsj.SampleBuffer
      extended by de.humatic.dsj.DSSampleBuffer

public class DSSampleBuffer
extends SampleBuffer

DSSampleBuffer objects are delivered by the SampleAccessFilter, see DSFiltergraph.insertSampleAccessFilter(...)..


Field Summary
static int COLLECT_EQUAL_TIMES
          Special timestamp handling flags.
static int DIRECT_ACCESS
          Flag for gaining direct access to the filter's NIO buffer, see getByteBuffer().
static int IGNORE_EQUAL_TIMES
          Special timestamp handling flags.
static int NO_DATA_COPY
           
static int THREAD_DS
          Thread related flags, see DSFiltergraph.insertSampleAccessFilter()
static int THREAD_SWING
          Thread related flags, see DSFiltergraph.insertSampleAccessFilter()
 
Fields inherited from class de.humatic.dsj.SampleBuffer
SF_CODECSPECIFIC, SF_DISCONTINUITY, SF_EOS, SF_FLUSH, SF_FRAMEREORDERED, SF_KEYFRAME, SF_NOSTAMP, SF_PREROLL
 
Method Summary
 java.nio.ByteBuffer getByteBuffer()
          Returns the ByteBuffer used for data exchange with the dll.
 DSFilter getFilter()
           
 long getFilterID()
          Returns the originating SampleAccessFilter's native memory pointer.
 DSMediaType getMediaType()
           
 byte[] getSample()
          Returns a pointer to the actual sample data or null when set up with DIRECT_ACCESS flag.
 int getSampleLength()
          Returns the sample's length in bytes (Before data has been received this will initially return calculated sample size).
 int getSampleTime()
          Millisecond time of the sample.
 void lock(boolean locked)
          Grabs or releases a lock object used to synchronize clientside read and dll-side write access to this SampleBuffer's nio buffer.
 JSampleBuffer persist()
          Copies the current sample from the ByteBuffer - where it will be overwritten - into a JSampleBuffer.
 
Methods inherited from class de.humatic.dsj.SampleBuffer
getDeltaTime, getSampleFlags, getSequenceNumber, getUserData, setDeltaTime, setSampleLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IGNORE_EQUAL_TIMES

public static final int IGNORE_EQUAL_TIMES
Special timestamp handling flags.

See Also:
Constant Field Values

COLLECT_EQUAL_TIMES

public static final int COLLECT_EQUAL_TIMES
Special timestamp handling flags.

See Also:
Constant Field Values

DIRECT_ACCESS

public static final int DIRECT_ACCESS
Flag for gaining direct access to the filter's NIO buffer, see getByteBuffer().

See Also:
Constant Field Values

THREAD_DS

public static final int THREAD_DS
Thread related flags, see DSFiltergraph.insertSampleAccessFilter()

See Also:
Constant Field Values

THREAD_SWING

public static final int THREAD_SWING
Thread related flags, see DSFiltergraph.insertSampleAccessFilter()

See Also:
Constant Field Values

NO_DATA_COPY

public static final int NO_DATA_COPY
See Also:
Constant Field Values
Method Detail

getMediaType

public DSMediaType getMediaType()
Overrides:
getMediaType in class SampleBuffer

getSample

public byte[] getSample()
Returns a pointer to the actual sample data or null when set up with DIRECT_ACCESS flag. This is reused memory that may be larger than the current sample's data. Use getSampleLength() to learn how much of the data is valid for the current sample.

Overrides:
getSample in class SampleBuffer

getSampleLength

public int getSampleLength()
Returns the sample's length in bytes (Before data has been received this will initially return calculated sample size).

Overrides:
getSampleLength in class SampleBuffer

getSampleTime

public int getSampleTime()
Description copied from class: SampleBuffer
Millisecond time of the sample.

Overrides:
getSampleTime in class SampleBuffer

getFilterID

public long getFilterID()
Returns the originating SampleAccessFilter's native memory pointer.


getFilter

public DSFilter getFilter()

persist

public JSampleBuffer persist()
Copies the current sample from the ByteBuffer - where it will be overwritten - into a JSampleBuffer.


getByteBuffer

public java.nio.ByteBuffer getByteBuffer()
Returns the ByteBuffer used for data exchange with the dll. Access to this is only given when the DIRECT_ACCESS flag has been set when calling DSFiltergraph.insertSampleAccessFilter(..). With that flag set dsj will not update the SampleBuffer's data field and switch off internal synchronization. Application code will still receive SAMPLE_BUFFER_FILLED callbacks and can continue to read sample length and time from the SampleBuffer, but will use the nio buffer for data sharing. DSSampleBuffer lock(..) should be used to synchronize clientside read and dll-side write access to the buffer.


lock

public void lock(boolean locked)
Grabs or releases a lock object used to synchronize clientside read and dll-side write access to this SampleBuffer's nio buffer. Application code only uses this when directly working with nio. See getByteBuffer().