[vlc-devel] wirting a codec to vlc using ffmpeg library

Steve Lhomme robux4 at gmail.com
Sat Jul 15 07:59:09 CEST 2017


On Fri, Jul 14, 2017 at 7:16 PM, Dafna Hirschfeld <dafna3 at gmail.com> wrote:
> Hi,
> I am not a vlc developer and have no past experience with the source code.
> I have a video decoder code that has a constructor and a function that
> receive an encoded frame and returns a decoded frame of yuv 420p format. I
> have a tester that runs my decoder on ubuntu and produces a raw video file
> using the decoder.
> I want to add my decoder as a vlc plugin. I looked at the code of
> modules/codec/avcodec/video.c and  modules/codec/avcodec/avcodec.c files in
> version 2.2.3.
> I have few questions and really appreciate some help:
> 1. In my execution the p_context->thread_count is equal 4. I think for a
> start to use only one thread in my decoder . I see also that locks are
> acquired before some calls to av such as avcodec_close. I wanted to ask if I
> also need to acquire locks in my codec even if it uses only one thread.

If you do your own decoder module (which you seem to do) you will most
likely use only one thread. Unless you do all the multithread/queuing
of frames yourself. So you don't need locks and such.

> Maybe there are other vlc threads that might use the ffmpeg library?

libavcodec has its own thread. It decodes frames in them and can
request new frames to write from various threads. That's mainly what
needs protection in VLC from libavcodec calls.

> 2. I noticed that video.c and libmpeg2.c are  the only codecs that calls
> decoder_LinkPicture, I could not understand what does this call do and if I
> also have to call it ?

It doesn't exist in the vlc 3.0 codebase.

> 3. I see that the variable p_sys->b_has_b_frames is only set and not used.
> Is there any reason for it?

I could not find this variable in the current code. You might want to
use the cleaner 3.0 code base ?

> Thanks a lot
> Dafna
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

More information about the vlc-devel mailing list