net.sf.fmj.ffmpeg_java
Class PullDataSourceCallbackURLProtocolHandler

java.lang.Object
  extended by net.sf.fmj.ffmpeg_java.PullDataSourceCallbackURLProtocolHandler
All Implemented Interfaces:
net.sf.ffmpeg_java.custom_protocol.CallbackURLProtocolHandler

public class PullDataSourceCallbackURLProtocolHandler
extends java.lang.Object
implements net.sf.ffmpeg_java.custom_protocol.CallbackURLProtocolHandler

Implements CallbackURLProtocolHandler by using a PullSourceStream. Because seeking functions have to be implemented, either the source has to be Cloneable, or the streams provided by the source have to be Seekable. Otherwise, seeking will fail, and ffmpeg does not really check for seek failures, it mostly just assumes they will work. This was written with an eye on ffmpeg's http.c, which shows that when a seek is needed, they simply open a new stream. http.c is not of course used when this is used, it just shows what kind of behavior is expected from a URLProtocol.

Author:
Ken Larson

Field Summary
static boolean TRACE
           
 
Fields inherited from interface net.sf.ffmpeg_java.custom_protocol.CallbackURLProtocolHandler
SEEK_CUR, SEEK_END, SEEK_SET
 
Constructor Summary
PullDataSourceCallbackURLProtocolHandler(PullDataSource source)
           
 
Method Summary
 int close(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h)
           
 int open(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h, java.lang.String filename, int flags)
           
 int read(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h, com.sun.jna.Pointer buf, int size)
           
 long seek(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h, long pos, int whence)
           
 int write(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h, com.sun.jna.Pointer buf, int size)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRACE

public static final boolean TRACE
See Also:
Constant Field Values
Constructor Detail

PullDataSourceCallbackURLProtocolHandler

public PullDataSourceCallbackURLProtocolHandler(PullDataSource source)
Method Detail

open

public int open(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h,
                java.lang.String filename,
                int flags)
Specified by:
open in interface net.sf.ffmpeg_java.custom_protocol.CallbackURLProtocolHandler

read

public int read(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h,
                com.sun.jna.Pointer buf,
                int size)
Specified by:
read in interface net.sf.ffmpeg_java.custom_protocol.CallbackURLProtocolHandler

write

public int write(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h,
                 com.sun.jna.Pointer buf,
                 int size)
Specified by:
write in interface net.sf.ffmpeg_java.custom_protocol.CallbackURLProtocolHandler

seek

public long seek(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h,
                 long pos,
                 int whence)
Specified by:
seek in interface net.sf.ffmpeg_java.custom_protocol.CallbackURLProtocolHandler

close

public int close(net.sf.ffmpeg_java.AVFormatLibrary.URLContext h)
Specified by:
close in interface net.sf.ffmpeg_java.custom_protocol.CallbackURLProtocolHandler