How to develop a new unsupported fourcc decoder

This forum is about all development around libVLC.
bharmel
New Cone
New Cone
Posts: 7
Joined: 05 Sep 2013 16:29

How to develop a new unsupported fourcc decoder

Postby bharmel » 05 Sep 2013 17:00

Hi,

I'm discovering out of tree Vlc plugin development and it is great !
I have written a demux plugin which can split my proprietary AudioVideo (AV) ip stream.
This ip stream contains 2 elementary streams:
- One video MJPEG stream
- One text metatdata stream.

My demux creates these 2 objects with:
es_format_Init(&pSys_X->VideoFormat_X,VIDEO_ES,0);
pSys_X->VideoFormat_X.i_codec=VLC_CODEC_MJPG;
pSys_X->pEsVideo_X=es_out_Add(pDemux_X->out,&pSys_X->VideoFormat_X);
and:
CodecFourCC_X=VLC_FOURCC('k','t','c','1'); //In-house format, not supported by vlc
es_format_Init(&pSys_X->TcFormat_X,SPU_ES,CodecFourCC_X);
pSys_X->pEsTc_X=es_out_Add(pDemux_X->out,&pSys_X->TcFormat_X);

When the demux receive our proprietary AV ip stream it outputs blocks with the corresponding data with:
block_t *pBlock_X;

Video:
es_out_Control(_pDemux_X->out,ES_OUT_SET_PCR,pBlock_X->i_pts);
es_out_Send(_pDemux_X->out,pSys_X->pEsVideo_X,pBlock_X);
Text:
es_out_Send(_pDemux_X->out,pSys_X->pEsTc_X,pBlock_X);

All the different payload are correcty setuped in the pBlock_X structure

So far so good, everything seems ok. :P

My questions are:
- Which king of module do I need to create to consume the text stream which is produced by es_out_Send(_pDemux_X->out,pSys_X->pEsTc_X,pBlock_X) ? (I don't want to use standard Vlc module because I need to make extra work on the text payload)
- How Vlc makes the link between my new codec fourcc code and the module which can handle its processing ? (In my case CodecFourCC_X=VLC_FOURCC('k','t','c','1'); //In-house format, not supported by vlc)
- By looking in Vlc source it seems that the association between codec fourcc code and codec module is stored in a static array. Is that right ?
- Is there any documentation or examples of a module which produce a custom elementary stream and another module which consume it ? !! these modules should produce and process out of the shelf unsupported data type (no MJPEG or MP3 but a 'new' unsupported format)
- If I just want to display my text metadata stream as a "marquee", is it possible to consume the text stream using a standard vlc module (!!! text data can chand up to 60 times per seconds !!)

Thank you very much for your time and help

Best regards

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

Re: How to develop a new unsupported fourcc decoder

Postby Rémi Denis-Courmont » 05 Sep 2013 17:43

You need to write a decoder plugin and match the i_fourcc in the input format.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

bharmel
New Cone
New Cone
Posts: 7
Joined: 05 Sep 2013 16:29

Re: How to develop a new unsupported fourcc decoder

Postby bharmel » 06 Sep 2013 12:32

Hi,

thank you for your reply. I start to develop a decoder:
#define MODULE_STRING "KatTcCodec"
vlc_module_begin ()
set_description( N_("KatTc decoder") )
set_capability( "decoder", 0 )
set_callbacks( KATTCCODEC_Open, KATTCCODEC_Close )
set_category(CAT_INPUT)
set_subcategory(SUBCAT_INPUT_SCODEC)
vlc_module_end ()

int KATTCCODEC_Open(vlc_object_t *_pThis_X)
{
int Rts_i=VLC_ERR_INVALIDPARAM;
decoder_t *pDecoder_X=NULL;

if (_pThis_X)
{
pDecoder_X=(decoder_t *)_pThis_X;
msg_Dbg(pDecoder_X,"KATTCCODEC_Open(%X) Codec 0x%08X",_pThis_X,pDecoder_X->fmt_out.i_codec);
...


When i start my vlc based application, I can see the video but no metadata.

If I look to the Vlc log file I cannot see the message which is displayed in my KATTCCODEC_Open function (msg_Dbg(pDecoder_X,"KATTCCODEC_Open(%X) Codec 0x%08X",_pThis_X,pDecoder_X->fmt_out.i_codec);)
and no vlc log about foreign fourcc code or codec lookup....

The libvlc engine does not seem to look for a decoder for my special fourcc code and I have checked that this one is really present in the output stream (by using the Vlc media player interface Tools->Media Information->Codec)

????

bharmel
New Cone
New Cone
Posts: 7
Joined: 05 Sep 2013 16:29

Re: How to develop a new unsupported fourcc decoder

Postby bharmel » 06 Sep 2013 16:33

Hi,

When I try to activate my elementary stream with fourcc code ktc1 I got this error message on my screen:

No suitable decoder module:
VLC does not support the audio or video format "ktc1". Unfortunately there is no way for you to fix this.

==> Vlc seems to say that it is not possible....

Is a normal/true/.... ????

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: How to develop a new unsupported fourcc decoder

Postby diman23 » 07 Sep 2013 03:41

==> Vlc seems to say that it is not possible....
everything is possible :)
are you implementing on windows or linux?
out of tree right?
did you check if your decoder appear in plugin list? (could VLC load your dll/so)

I saw that you set score to 0. set_capability( "decoder", 0 ). did you enable your module with --codec?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 24 guests