[FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

Anshul anshul.ffmpeg at gmail.com
Wed Dec 3 22:21:33 CET 2014

On 12/04/2014 02:33 AM, Nicolas George wrote:
> Le tridi 13 frimaire, an CCXXIII, Anshul a écrit :
>> Thanks I was searching for this, even I asked for same on Irc.
>> Nicolas: The changes from your pair of patch,
>> 1) I removed c708 part (whole) since both are same, 708 just have some
>> extra feature then 608.
>>     In your first patch it was just registering c708, and I have not
>> used that patch.
> Ok, but is it correct? I mean: if the video that is being decoded contains
> c708 with the extra features used, then the output will not be valid 608,
> right? Or am I just writing nonsense?
It would be valid, c708 is backward compatible as far as
I have seen while working with ccextractor.
C708 is made in such a way that people dont have to throw there older TV
sets or device.
if any decoder is not able to decode c708 part, even then they can get
correct subtitle.
>> 2) you used i as the index of subcc, but I have used stream_idx
>> your code was lavfi->sink_stream_subcc_map[i] = !!use_subcc; 
>> I changed it to
>>  lavfi->sink_stream_subcc_map[stream_idx] = !!use_subcc; 
> That looks suspicious. Can you explain your change? Did you test it with
> filter graphs that contains several sinks?
Yes while doing that only I realized,  if we use "i" then cc must be in
first stream.
When I had multiple stream(with audio), then I was not able to map subcc
to my video stream.
using stream_idx , we are saying that if we can use  out0+subcc and
"i" logic fails when there is audio in 1st stream, there was no way i 
could get the subtitle
if my first stream is not the one where closed caption are present.

>> There were one more changes but that was  to get your patch in mainstream
>> like av_malloc_array instead av_malloc.
> Ok, seen it, this one looks good.
>> I have considered all your comments, but it would be better to check again.
> Will do, of course. But very busy week ahead. Just a few words below:
>> >From 09a199afa72eeb7b8be8527da7239f4abcc52dbe Mon Sep 17 00:00:00 2001
>> From: Nicolas George <george at nsup.org>
>> Date: Tue, 28 Oct 2014 14:41:15 +0530
>> Subject: [PATCH 1/2] allow to extract subcc
> The commit message was prefixed with "lavd/lavdi:". You should use "git am"
> to apply patches including commit message and such.
sorry for that
>> --- a/doc/indevs.texi
>> +++ b/doc/indevs.texi
>> @@ -494,6 +494,9 @@ number starting from 0 corresponding to the mapped input stream
>>  generated by the device.
>>  The first unlabelled output is automatically assigned to the "out0"
>>  label, but all the others need to be specified explicitly.
>> +The suffix "+subcc" can be appended to the output label to create an extra
>> +stream with the closed captions packets attached to that output
>> +(experimental).
> I have a local change adding "; only for CEA-708 for now" after
> experimental.
>>          if (!strcmp(inout->name, "out"))
>>              stream_idx = 0;
>> -        else if (sscanf(inout->name, "out%d\n", &stream_idx) != 1) {
>> +        else if (sscanf(inout->name, "out%d+subcc%n\n", &stream_idx, &use_subcc) != 1) {
>>              av_log(avctx,  AV_LOG_ERROR,
>>                     "Invalid outpad name '%s'\n", inout->name);
> Stefano requested a stricter parsing here, and I have it in my tree.
> I would do a quick git send-email, except I am pretty sure I messed up the
> rebase.
> I will be in touch when I can. Thanks for advancing this.
> Regards,
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
thanks for looking.

More information about the ffmpeg-devel mailing list