summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorgreg <greg@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-08-11 23:26:42 +0000
committergreg <greg@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-08-11 23:26:42 +0000
commit14df605236c9fefe7ebc1342435bc791ea9c3fd6 (patch)
treeca51946452314c7617aa40b6565d03355a33330c /libmpdemux
parente9db7e8b4f38806bbdad104d48231e3b19dc42ce (diff)
downloadmpv-14df605236c9fefe7ebc1342435bc791ea9c3fd6.tar.bz2
mpv-14df605236c9fefe7ebc1342435bc791ea9c3fd6.tar.xz
Use new libavformat metadata API.
Patch by Anton Khirnov <wyskas@gmail.com>. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29497 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_lavf.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 800e7eb3f2..886df7a1bf 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -422,6 +422,7 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
AVFormatContext *avfc;
AVFormatParameters ap;
const AVOption *opt;
+ AVMetadataTag *t = NULL;
lavf_priv_t *priv= demuxer->priv;
int i;
char mp_filename[256]="mp:";
@@ -477,20 +478,17 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
return NULL;
}
- if(avfc->title [0]) demux_info_add(demuxer, "title" , avfc->title );
- if(avfc->author [0]) demux_info_add(demuxer, "author" , avfc->author );
- if(avfc->copyright[0]) demux_info_add(demuxer, "copyright", avfc->copyright);
- if(avfc->comment [0]) demux_info_add(demuxer, "comments" , avfc->comment );
- if(avfc->album [0]) demux_info_add(demuxer, "album" , avfc->album );
-// if(avfc->year ) demux_info_add(demuxer, "year" , avfc->year );
-// if(avfc->track ) demux_info_add(demuxer, "track" , avfc->track );
- if(avfc->genre [0]) demux_info_add(demuxer, "genre" , avfc->genre );
+ /* Add metadata. */
+ av_metadata_conv(avfc, NULL, avfc->iformat->metadata_conv);
+ while((t = av_metadata_get(avfc->metadata, "", t, AV_METADATA_IGNORE_SUFFIX)))
+ demux_info_add(demuxer, t->key, t->value);
for(i=0; i < avfc->nb_chapters; i++) {
AVChapter *c = avfc->chapters[i];
uint64_t start = av_rescale_q(c->start, c->time_base, (AVRational){1,1000});
uint64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,1000});
- demuxer_add_chapter(demuxer, c->title, start, end);
+ t = av_metadata_get(c->metadata, "title", NULL, 0);
+ demuxer_add_chapter(demuxer, t ? t->value : NULL, start, end);
}
if(avfc->nb_programs) {
@@ -512,7 +510,8 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
p = start;
do {
AVProgram *program = avfc->programs[p];
- mp_msg(MSGT_HEADER,MSGL_INFO,"LAVF: Program %d %s\n", program->id, (program->name ? program->name : ""));
+ t = av_metadata_get(program->metadata, "title", NULL, 0);
+ mp_msg(MSGT_HEADER,MSGL_INFO,"LAVF: Program %d %s\n", program->id, t ? t->value : "");
for(i=0; i<program->nb_stream_indexes; i++)
handle_stream(demuxer, avfc, program->stream_index[i]);
if(!priv->cur_program && (demuxer->video->sh || demuxer->audio->sh))