On Wed, May 4, 2016 at 3:46 PM, Thierry Foucu <tfo...@gmail.com> wrote:
> > > On Wed, May 4, 2016 at 1:58 PM, Derek Buitenhuis < > derek.buitenh...@gmail.com> wrote: > >> On 5/4/2016 9:52 PM, wm4 wrote: >> > This was never allowed and was never public API. Use custom I/O instead >> > (creating an avio context with your own read/write callbacks). >> >> > Can i ask why it cannot be part of the public API? > It was really practical just to register new prefix, specially, when you > have to create X number of them. > I think this should be a feature. We allow to register filter, codec, > muxer/demuxer, why not URL > > > >> Yes, I was thinking something akin to: >> >> int my_open(...) >> { >> if (filename_has_prefix("myownproto://")) { >> ctx->opaque = myOwnContext; >> return my_own_open(...); >> } >> return avio_open(...); >> } >> >> int my_read(...) >> { >> if (ctx->opaque != NULL) >> return my_own_code(...); >> >> return avio_read(...); >> } >> >> Maybe this should be documented somewhere concretely as a Way To Do >> Things. >> > > Do you have an example how to do it? How to register my_open, my_read, > my_seek ? > > here is why I think it is nice to be able to register your own protocol: You can create a new binary, using ffmpeg.c as main core, but register your own protocol, so, you have the same command line as ffmpeg, but with your protocol in it For example, i can have something like this: #include "myprotocol.h" #define main ffmpeg_main #include "libavformat/url.h" #include "ffmpeg.c" #undef main int main(int argc, char **argv) { ffurl_register_protocol(&protocol_1); ffurl_register_protocol(&protocol_2); return ffmpeg_main(argc, argv); } With this binary, i will have the same command line as ffmpeg, but will also support any protocol i want. How can we do that without this function? >> - Derek >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel