[PATCH] Allow provider name and service name to be set in mpegts muxer
Georgi Chorbadzhiyski
gf
Thu Jan 20 08:26:40 CET 2011
With this patch mpegts muxer uses provider_name and service_name (in
addition to title) metadata to set service_provider_name and service_name
fields in SDT.
Example usage:
ffmpeg -i file.ts -f mpegts -acodec copy -vcodec copy -f mpegts -metadata provider_name="Some provider" -metadata service_name="Some Channel" "udp://239.0.70.2:5000?pkt_size=1316&ttl=1"
---
libavformat/avformat.h | 2 ++
libavformat/mpegtsenc.c | 10 +++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index b484649..1f4e0bc 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -163,6 +163,8 @@ struct AVFormatContext;
* publisher -- name of the label/publisher.
* title -- name of the work.
* track -- number of this work in the set, can be in form current/total.
+ * provider_name-- Set service_provider_name when using mpegts muxer.
+ * service_name -- Set service_name when using mpegts muxer.
*/
#define AV_METADATA_MATCH_CASE 1
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index bfd21db..bd50750 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -391,18 +391,22 @@ static int mpegts_write_header(AVFormatContext *s)
MpegTSWriteStream *ts_st;
MpegTSService *service;
AVStream *st, *pcr_st = NULL;
- AVMetadataTag *title;
+ AVMetadataTag *title, *provider;
int i, j;
const char *service_name;
+ const char *provider_name;
int *pids;
ts->tsid = DEFAULT_TSID;
ts->onid = DEFAULT_ONID;
/* allocate a single DVB service */
title = av_metadata_get(s->metadata, "title", NULL, 0);
+ if (!title)
+ title = av_metadata_get(s->metadata, "service_name", NULL, 0);
service_name = title ? title->value : DEFAULT_SERVICE_NAME;
- service = mpegts_add_service(ts, DEFAULT_SID,
- DEFAULT_PROVIDER_NAME, service_name);
+ provider = av_metadata_get(s->metadata, "provider_name", NULL, 0);
+ provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME;
+ service = mpegts_add_service(ts, DEFAULT_SID, provider_name, service_name);
service->pmt.write_packet = section_write_packet;
service->pmt.opaque = s;
service->pmt.cc = 15;
--
1.7.3.4
--=_ns-24465-1295508746-0001-2--
More information about the ffmpeg-devel
mailing list