[FFmpeg-devel] [PATCH] Add optional NIT table generation

Marton Balint cus at passwd.hu
Wed May 12 21:18:01 EEST 2021



On Wed, 12 May 2021, Ubaldo Porcheddu wrote:

> Hi Marton,
>
>>> +    }
>>> +
>>> +    //private data
>>> +    desc_len += 6 + 2;
>>> +    *q++ = 0x5F;
>>> +    *q++ = 4;
>>> +    *q++ = 0x00;
>>> +    *q++ = 0x00;
>>> +    put16(&q, 40);
>> 
>> What are these?
>
> I didn't find any official document about it but this seems to be the way 
> many national (FR,IT,UK) broadcasters are writing the virtual channel private 
> data header and the one recognized by many popular tv on the market.

But this looks like a separate descriptor from the virtual channels 
(logical_channel_descriptor).

logical_channel_descriptor() is documented for example here:
https://forums.mediaspy.org/uploads/short-url/2wA2rGhOkh2yjlbcWMtcQizBv8L.pdf

So you should use the terminology that is used in the document above.

>
>>> +    ts->nit_period = av_rescale(ts->nit_period_us, PCR_TIME_BASE,
>> AV_TIME_BASE);
>>>
>>>     if (ts->mux_rate == 1)
>>>         av_log(s, AV_LOG_VERBOSE, "muxrate VBR, ");
>>> @@ -1154,12 +1237,14 @@ static int mpegts_init(AVFormatContext *s)
>>>            "sdt every %"PRId64" ms, pat/pmt every %"PRId64" ms\n",
>>>            av_rescale(ts->sdt_period, 1000, PCR_TIME_BASE),
>>>            av_rescale(ts->pat_period, 1000, PCR_TIME_BASE));
>>> +    if (ts->nit_enable > 0)
>>> +        av_log(s, AV_LOG_VERBOSE, "nit every %"PRId64" ms\n",
>> av_rescale(ts->nit_period, 1000, PCR_TIME_BASE));
>> 
>> Maybe you should continue the last log line which already describes
>> the
>> interval of various tables, and not start a new line.
>
> The idea is to have the NIT emission optional so I don't know if is a good 
> idea to stat its periodical transmission on the same line, when disabled?

I meant something like:

av_log(s, AV_LOG_VERBOSE,
        "sdt every %"PRId64" ms, pat/pmt every %"PRId64" ms",
        av_rescale(ts->sdt_period, 1000, PCR_TIME_BASE),
        av_rescale(ts->pat_period, 1000, PCR_TIME_BASE));
if (nit_enabled)
      av_log(s, AV_LOG_VERBOSE, ", nit every %"PRId64" ms")
av_log(s, AV_LOG_VERBOSE, "\n")

>
>>> +    { "nit_enable", "Enable NIT transmission",
>>> +      OFFSET(nit_enable), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC
>> },
>> 
>> As I wrote earlier, instead of a separate option, you should introduce
>> a
>> new flag in mpegts_flags.
>
> ok almost ready also with this
>
>> Also docs/muxers.texi update is missing for the new feature.
>
> is there any guide on what an how to add it? :)

No guide, but should be straightforward based on the existing 
documentation of the mpegts muxer.

Regards,
Marton


More information about the ffmpeg-devel mailing list