diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2009-02-18 00:00:38 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2009-02-18 00:00:38 +0000 |
commit | 4b358c3e60bfeb3d1d0912c49480b53d10277264 (patch) | |
tree | ccfb19dfb8be544dc0b8580ae737bec4cdcae076 /libavformat | |
parent | 3d17b948fd53e43591396f6c10b8e93e7da02dd2 (diff) | |
download | ffmpeg-4b358c3e60bfeb3d1d0912c49480b53d10277264.tar.gz |
use new metadata API in mpegts muxer
Originally committed as revision 17406 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mpegtsenc.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index ea78721de0..3c34fbf116 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -216,6 +216,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) for(i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MpegTSWriteStream *ts_st = st->priv_data; + AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL,0); switch(st->codec->codec_id) { case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: @@ -252,21 +253,19 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) /* write optional descriptors here */ switch(st->codec->codec_type) { case CODEC_TYPE_AUDIO: - if (strlen(st->language) == 3) { + if (lang && strlen(lang->value) == 3) { *q++ = 0x0a; /* ISO 639 language descriptor */ *q++ = 4; - *q++ = st->language[0]; - *q++ = st->language[1]; - *q++ = st->language[2]; + *q++ = lang->value[0]; + *q++ = lang->value[1]; + *q++ = lang->value[2]; *q++ = 0; /* undefined type */ } break; case CODEC_TYPE_SUBTITLE: { const char *language; - language = st->language; - if (strlen(language) != 3) - language = "eng"; + language = lang && strlen(lang->value)==3 ? lang->value : "eng"; *q++ = 0x59; *q++ = 8; *q++ = language[0]; @@ -383,6 +382,7 @@ static int mpegts_write_header(AVFormatContext *s) MpegTSWriteStream *ts_st; MpegTSService *service; AVStream *st; + AVMetadataTag *title; int i, total_bit_rate; const char *service_name; uint64_t sdt_size, pat_pmt_size, pos; @@ -390,9 +390,8 @@ static int mpegts_write_header(AVFormatContext *s) ts->tsid = DEFAULT_TSID; ts->onid = DEFAULT_ONID; /* allocate a single DVB service */ - service_name = s->title; - if (service_name[0] == '\0') - service_name = DEFAULT_SERVICE_NAME; + 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); service->pmt.write_packet = section_write_packet; |