[FFmpeg-devel] [PATCH v2] libavformat/mpegts: demux DVB VBI data

Marton Balint cus at passwd.hu
Wed Dec 4 00:23:56 EET 2024



On Tue, 3 Dec 2024, Marton Balint wrote:

>
>
> On Sat, 30 Nov 2024, Scott Theisen wrote:
>
>>  DVB VBI data is defined in ETSI EN 301 775 and can include EBU teletext
>>  data
>>  as defined in ETSI EN 300 472.
>>
>>  ETSI EN 300 468 defines teletext_descriptor, VBI_data_descriptor, and
>>  VBI_teletext_descriptor, which has the same definition as, but different
>>  use
>>  from, teletext_descriptor.
>>  ---
>>  libavcodec/codec_desc.c | 6 ++++++
>>  libavcodec/codec_id.h   | 1 +
>>  libavformat/mpegts.c    | 3 +++
>>  libavformat/mpegts.h    | 2 ++
>>  4 files changed, 12 insertions(+)
>
> You should split this to two patches.
>
> Patch 1 should add the codec ID the codec_description and please also update 
> the assertion check in libavcodec/version.c.
>
> Patch 2 should add the support for demuxing in mpegts. I'd rather put the VBI 
> descriptors after the teletext descriptor in the list, so in case multiple 
> descriptors are present the detected codec should be teletext.

On second thought the order does not help, because the codec will be 
determined by the first descriptor...

Maybe when parsing the teletext descriptor it should override VBI codec to 
teletext, e.g.:

     case TELETEXT_DESCRIPTOR:
          if (codec_id == DVB_VBI)
                 codec_id = DVB_TELETEXT
          // fall-through
     case VBI_TELETEXT_DESCRIPTOR:
          ....

Regards,
Marton

>
> Otherwise looks good.
>
> Thanks,
> Marton
>
>>
>>  diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
>>  index bc9163bf98..ed500bf798 100644
>>  --- a/libavcodec/codec_desc.c
>>  +++ b/libavcodec/codec_desc.c
>> @@  -3634,6 +3634,12 @@ static const AVCodecDescriptor codec_descriptors[] 
>> @@  = {
>>          .long_name = NULL_IF_CONFIG_SMALL("ARIB STD-B24 caption"),
>>          .profiles  = NULL_IF_CONFIG_SMALL(ff_arib_caption_profiles),
>>      },
>>  +    {
>>  +        .id        = AV_CODEC_ID_DVB_VBI,
>>  +        .type      = AVMEDIA_TYPE_SUBTITLE,
>>  +        .name      = "dvb_vbi",
>>  +        .long_name = NULL_IF_CONFIG_SMALL("DVB VBI data"),
>>  +    },
>>
>>      /* other kind of codecs and pseudo-codecs */
>>      {
>>  diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
>>  index 6bfaa02601..0e9e83fddb 100644
>>  --- a/libavcodec/codec_id.h
>>  +++ b/libavcodec/codec_id.h
>> @@  -579,6 +579,7 @@ enum AVCodecID {
>>      AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
>>      AV_CODEC_ID_TTML,
>>      AV_CODEC_ID_ARIB_CAPTION,
>>  +    AV_CODEC_ID_DVB_VBI,
>>
>>      /* other specific kind of codecs (generally used for attachments) */
>>      AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,           ///< A dummy ID
>>      pointing at the start of various fake codecs.
>>  diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
>>  index 177e610e53..693c8c849d 100644
>>  --- a/libavformat/mpegts.c
>>  +++ b/libavformat/mpegts.c
>> @@  -891,6 +891,8 @@ static const StreamType DESC_types[] = {
>>      { 0x6a, AVMEDIA_TYPE_AUDIO,    AV_CODEC_ID_AC3          }, /* AC-3
>>      descriptor */
>>      { 0x7a, AVMEDIA_TYPE_AUDIO,    AV_CODEC_ID_EAC3         }, /* E-AC-3
>>      descriptor */
>>      { 0x7b, AVMEDIA_TYPE_AUDIO,    AV_CODEC_ID_DTS          },
>>  +    { VBI_DATA_DESCRIPTOR,     AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_VBI
>>  },
>>  +    { VBI_TELETEXT_DESCRIPTOR, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_VBI
>>  },
>>      { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT },
>>      { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /*
>>      subtitling descriptor */
>>      { 0 },
>> @@  -1888,6 +1890,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
>> @@  AVStream *st, int stream_type
>>              }
>>          }
>>          break;
>>  +    case VBI_TELETEXT_DESCRIPTOR:
>>      case 0x56: /* DVB teletext descriptor */
>>          {
>>              uint8_t *extradata = NULL;
>>  diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
>>  index d6dcf20947..bd9d402529 100644
>>  --- a/libavformat/mpegts.h
>>  +++ b/libavformat/mpegts.h
>> @@  -167,6 +167,8 @@
>>
>>  /* DVB descriptor tag values [0x40, 0x7F] from
>>     ETSI EN 300 468 Table 12: Possible locations of descriptors */
>>  +#define VBI_DATA_DESCRIPTOR          0x45
>>  +#define VBI_TELETEXT_DESCRIPTOR      0x46
>>  #define SERVICE_DESCRIPTOR           0x48
>>  #define STREAM_IDENTIFIER_DESCRIPTOR 0x52
>>  #define TELETEXT_DESCRIPTOR          0x56
>>  --
>>  2.43.0
>>
>>  _______________________________________________
>>  ffmpeg-devel mailing list
>>  ffmpeg-devel at ffmpeg.org
>>  https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>>  To unsubscribe, visit link above, or email
>>  ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list