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

Georgi Chorbadzhiyski gf
Fri Oct 22 09:15:35 CEST 2010


Around 10/22/10 10:09, Tomas H?rdin scribbled:
> On Thu, 2010-10-21 at 17:48 +0300, Georgi Chorbadzhiyski wrote:
>> 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;
>>
> 
> Looks like it would work, but wouldn't we want to use AVOption for this?
> That way the user can list the available options.
> 
> I say this because I had in mind adding an option for overriding
> DEFAULT_PMT_START_PID (and possibly DEFAULT_START_PID).

I just continued using av_metadata because that is what was used, but you
are right that AVOption will be better. When I tried to name my channels
I looked in ffmpeg -help and since there was nothing there I went to the
source file. Not ideal situation even with this patch.

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



More information about the ffmpeg-devel mailing list