Page 1 of 1
Adding new decoder
Posted: 30 Aug 2013 03:32
by Ares19851110
We want to add a new decoder to VLC. We have two plans:
1. add new decoder to FFmpeg, then VLC load FFmpeg to decode with new decoder;
2. add new decoder to VLC (like theora decoder), then VLC load new decoder to decode directly.
Which one is better? And which one is less work?
If using plan 1, we have some questions:
When we compiling VLC, we download the dependence package, it concludes FFmpeg library. But only .h and .a file are in the library. There are no source code. We don't know which verison of FFmpeg VLC used. How do we get the source code of FFmpeg which VLC used?
If using plan 2, how do we add new decoder to VLC? As a decoder module like theora?
Thank you!
Re: Adding new decoder
Posted: 30 Aug 2013 16:35
by diman23
If you want to use your own decoder library I would write my own VLC plugin. (if the library is coded properly then writing a new plugin 4 VLC is not a big deal)
you can write in tree or out of tree. Just look in the code how other decoders are implemented.
and of course
https://wiki.videolan.org/Developers_Corner/
Re: Adding new decoder
Posted: 30 Aug 2013 17:57
by Rémi Denis-Courmont
If you already have a stand-alone library to decode, then adding a VLC plugin is easier. To add an FFmpeg codec, you would need to include your library code into FFmpeg and use the FFmpeg decoding infrastructure where appropriate (e.g. DCT, motion compensation, ...).
That being said, FFmpeg or libav have the advantage that your codec becomes available not only to VLC but many other applications, and you may be able to leverage some assembler optimizations already built-in.
Re: Adding new decoder
Posted: 31 Aug 2013 04:28
by Ares19851110
Thank you for your advice.
I decide to add a VLC plugin. Can you tell me how to add a plugin to VLC or give me some references?
Thank you!
Re: Adding new decoder
Posted: 31 Aug 2013 12:21
by Rémi Denis-Courmont
The best reference is the existing source code, I think.
Re: Adding new decoder
Posted: 02 Sep 2013 11:03
by diman23
read
https://wiki.videolan.org/Hacker_Guide/Decoder/
and look at other decoders source code.
Try to implement a simple "hello world" decoder first.
in your open function you need to analyse the es_format_t decoder_t::fmt_in
look at
http://www.videolan.org/developers/vlc/ ... 6385fdd17d
(e.g. in p_extra you can find parameter sets, set by demuxer )
don't forget to set the pf_decode_video or audio
in your decode function you recieve block_t (coded data with pts and dts) this is the point where your actual processing starts.
you decode data and put it to picture_t (return of your decode function)
I hope I could help you a little bit.
Have fun
Re: Adding new decoder
Posted: 17 Sep 2013 07:44
by Ares19851110
Thank you for Rémi Denis and diman23.
Now I have a third party decoding library. I put the .a library under /contrib/i686-w64-mingw32/lib/ and put .h file under /contrib/i686-w64-mingw32/include/.
I don't know how to link this new library. Which configuration should I modify?
Thank you!
Re: Adding new decoder
Posted: 17 Sep 2013 14:43
by Jean-Baptiste Kempf
look at configure.ac