[FFmpeg-devel] [PATCH] Set provider_name in SDT if metadata exists

Georgi Chorbadzhiyski gf
Thu Oct 21 16:48:22 CEST 2010


With this patch mpegts muxer uses provider_name metadata to set
provider name field in SDT instead of always using the default one

 libavformat/mpegtsenc.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 2d1fd40..cdbfb0f 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -391,9 +391,10 @@ 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;
@@ -401,8 +402,9 @@ static int mpegts_write_header(AVFormatContext *s)
     /* allocate a single DVB service */
     title = av_metadata_get(s->metadata, "title", 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;

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/



More information about the ffmpeg-devel mailing list