Commit 4b358c3e authored by Aurelien Jacobs's avatar Aurelien Jacobs

use new metadata API in mpegts muxer

Originally committed as revision 17406 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 3d17b948
...@@ -216,6 +216,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) ...@@ -216,6 +216,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
for(i = 0; i < s->nb_streams; i++) { for(i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i]; AVStream *st = s->streams[i];
MpegTSWriteStream *ts_st = st->priv_data; MpegTSWriteStream *ts_st = st->priv_data;
AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL,0);
switch(st->codec->codec_id) { switch(st->codec->codec_id) {
case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO: case CODEC_ID_MPEG2VIDEO:
...@@ -252,21 +253,19 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) ...@@ -252,21 +253,19 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
/* write optional descriptors here */ /* write optional descriptors here */
switch(st->codec->codec_type) { switch(st->codec->codec_type) {
case CODEC_TYPE_AUDIO: case CODEC_TYPE_AUDIO:
if (strlen(st->language) == 3) { if (lang && strlen(lang->value) == 3) {
*q++ = 0x0a; /* ISO 639 language descriptor */ *q++ = 0x0a; /* ISO 639 language descriptor */
*q++ = 4; *q++ = 4;
*q++ = st->language[0]; *q++ = lang->value[0];
*q++ = st->language[1]; *q++ = lang->value[1];
*q++ = st->language[2]; *q++ = lang->value[2];
*q++ = 0; /* undefined type */ *q++ = 0; /* undefined type */
} }
break; break;
case CODEC_TYPE_SUBTITLE: case CODEC_TYPE_SUBTITLE:
{ {
const char *language; const char *language;
language = st->language; language = lang && strlen(lang->value)==3 ? lang->value : "eng";
if (strlen(language) != 3)
language = "eng";
*q++ = 0x59; *q++ = 0x59;
*q++ = 8; *q++ = 8;
*q++ = language[0]; *q++ = language[0];
...@@ -383,6 +382,7 @@ static int mpegts_write_header(AVFormatContext *s) ...@@ -383,6 +382,7 @@ static int mpegts_write_header(AVFormatContext *s)
MpegTSWriteStream *ts_st; MpegTSWriteStream *ts_st;
MpegTSService *service; MpegTSService *service;
AVStream *st; AVStream *st;
AVMetadataTag *title;
int i, total_bit_rate; int i, total_bit_rate;
const char *service_name; const char *service_name;
uint64_t sdt_size, pat_pmt_size, pos; uint64_t sdt_size, pat_pmt_size, pos;
...@@ -390,9 +390,8 @@ static int mpegts_write_header(AVFormatContext *s) ...@@ -390,9 +390,8 @@ static int mpegts_write_header(AVFormatContext *s)
ts->tsid = DEFAULT_TSID; ts->tsid = DEFAULT_TSID;
ts->onid = DEFAULT_ONID; ts->onid = DEFAULT_ONID;
/* allocate a single DVB service */ /* allocate a single DVB service */
service_name = s->title; title = av_metadata_get(s->metadata, "title", NULL, 0);
if (service_name[0] == '\0') service_name = title ? title->value : DEFAULT_SERVICE_NAME;
service_name = DEFAULT_SERVICE_NAME;
service = mpegts_add_service(ts, DEFAULT_SID, service = mpegts_add_service(ts, DEFAULT_SID,
DEFAULT_PROVIDER_NAME, service_name); DEFAULT_PROVIDER_NAME, service_name);
service->pmt.write_packet = section_write_packet; service->pmt.write_packet = section_write_packet;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment