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@passwd.hu>
This commit is contained in:
Marton Balint 2019-08-02 23:51:57 +02:00
parent 9de40bf624
commit a4d984ad33

View File

@ -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;