Adding new decoder

This forum is about all development around libVLC.
Ares19851110
Blank Cone
Blank Cone
Posts: 38
Joined: 26 Oct 2011 08:19

Adding new decoder

Postby Ares19851110 » 30 Aug 2013 03:32

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!

diman23
Blank Cone
Blank Cone
Posts: 14
Joined: 23 Aug 2013 00:26
VLC version: 2.0.0
Operating System: win7 / linux
Location: Germany

Re: Adding new decoder

Postby diman23 » 30 Aug 2013 16:35

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/

Rémi Denis-Courmont
Developer
Developer
Posts: 15231
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Adding new decoder

Postby Rémi Denis-Courmont » 30 Aug 2013 17:57

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.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Ares19851110
Blank Cone
Blank Cone
Posts: 38
Joined: 26 Oct 2011 08:19

Re: Adding new decoder

Postby Ares19851110 » 31 Aug 2013 04:28

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!

Rémi Denis-Courmont
Developer
Developer
Posts: 15231
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Adding new decoder

Postby Rémi Denis-Courmont » 31 Aug 2013 12:21

The best reference is the existing source code, I think.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

diman23
Blank Cone
Blank Cone
Posts: 14
Joined: 23 Aug 2013 00:26
VLC version: 2.0.0
Operating System: win7 / linux
Location: Germany

Re: Adding new decoder

Postby diman23 » 02 Sep 2013 11:03

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 ;)

Ares19851110
Blank Cone
Blank Cone
Posts: 38
Joined: 26 Oct 2011 08:19

Re: Adding new decoder

Postby Ares19851110 » 17 Sep 2013 07:44

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!

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Adding new decoder

Postby Jean-Baptiste Kempf » 17 Sep 2013 14:43

look at configure.ac
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 6 guests