[FFmpeg-devel] [PATCH] libavformat/mpegtsenc: allow to set service_type in sdt
Clément Bœsch
u at pkh.me
Sun Feb 1 10:43:27 CET 2015
On Sun, Feb 01, 2015 at 04:19:22AM +0200, dhead666 wrote:
> ---
>
> @TimothyGu thanks for all your help, I hope this is now fine.
>
> doc/muxers.texi | 3 +++
> libavformat/mpegtsenc.c | 6 +++++-
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 7ca6409..2a9ebfa 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -690,6 +690,9 @@ Set the transport_stream_id (default 0x0001). This identifies a
> transponder in DVB.
> @item -mpegts_service_id @var{number}
> Set the service_id (default 0x0001) also known as program in DVB.
> + at item -mpegts_service_type @var{number}
> +Set the program service_type (default 0x01 - TV). For the list of valid
> +values see ETSI 300 468.
> @item -mpegts_pmt_start_pid @var{number}
> Set the first PID for PMT (default 0x1000, max 0x1f00).
> @item -mpegts_start_pid @var{number}
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 8d0da0b..46234b5 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -76,6 +76,7 @@ typedef struct MpegTSWrite {
> int transport_stream_id;
> int original_network_id;
> int service_id;
> + int service_type;
>
> int pmt_start_pid;
> int start_pid;
> @@ -521,7 +522,7 @@ static void mpegts_write_sdt(AVFormatContext *s)
> *q++ = 0x48;
> desc_len_ptr = q;
> q++;
> - *q++ = 0x01; /* digital television service */
> + *q++ = ts->service_type;
> putstr8(&q, service->provider_name);
> putstr8(&q, service->name);
> desc_len_ptr[0] = q - desc_len_ptr - 1;
> @@ -1434,6 +1435,9 @@ static const AVOption options[] = {
> { "mpegts_service_id", "Set service_id field.",
> offsetof(MpegTSWrite, service_id), AV_OPT_TYPE_INT,
> { .i64 = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM },
> + { "mpegts_service_type", "Set service_type field.",
> + offsetof(MpegTSWrite, service_type), AV_OPT_TYPE_INT,
> + { .i64 = 0x01 }, 0x01, 0xff, AV_OPT_FLAG_ENCODING_PARAM },
Can't you define a few AV_OPT_TYPE_CONST for the defined values in the
specs instead?
So we can -mpeg_service_type digital_television for example.
[...]
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150201/0def3e54/attachment.asc>
More information about the ffmpeg-devel
mailing list