[FFmpeg-cvslog] avformat/mpegtsenc: use increasing numbers in default service names

Marton Balint git at videolan.org
Thu Aug 15 00:28:00 EEST 2019


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Fri Aug  2 23:51:57 2019 +0200| [a4d984ad33190500ce146e2d91610e0b2741bbbf] | committer: Marton Balint

avformat/mpegtsenc: use increasing numbers in default service names

Maybe we should use service ID instead of increasing numbers?

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a4d984ad33190500ce146e2d91610e0b2741bbbf
---

 libavformat/mpegtsenc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 68af45d8b5..f4c1bb4717 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -218,7 +218,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
 /* mpegts writer */
 
 #define DEFAULT_PROVIDER_NAME   "FFmpeg"
-#define DEFAULT_SERVICE_NAME    "Service01"
+#define DEFAULT_SERVICE_NAME    "Service"
 
 /* we retransmit the SI info at this rate */
 #define SDT_RETRANS_TIME 500
@@ -749,13 +749,15 @@ static MpegTSService *mpegts_add_service(AVFormatContext *s, int sid,
     MpegTSWrite *ts = s->priv_data;
     MpegTSService *service;
     AVDictionaryEntry *title, *provider;
+    char default_service_name[32];
     const char *service_name;
     const char *provider_name;
 
     title = av_dict_get(metadata, "service_name", NULL, 0);
     if (!title)
         title = av_dict_get(metadata, "title", NULL, 0);
-    service_name  = title ? title->value : DEFAULT_SERVICE_NAME;
+    snprintf(default_service_name, sizeof(default_service_name), "%s%02d", DEFAULT_SERVICE_NAME, ts->nb_services + 1);
+    service_name  = title ? title->value : default_service_name;
     provider      = av_dict_get(metadata, "service_provider", NULL, 0);
     provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME;
 



More information about the ffmpeg-cvslog mailing list