* Add support for reading tags from MP4 video files with recent lavf versions.
This commit is contained in:
parent
4d76528158
commit
0519359927
25
metadata.c
25
metadata.c
@ -795,7 +795,7 @@ GetVideoMetadata(const char * path, char * name)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
asprintf(&m.frequency, "%u", ctx->streams[audio_stream]->codec->sample_rate);
|
asprintf(&m.frequency, "%u", ctx->streams[audio_stream]->codec->sample_rate);
|
||||||
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
|
#if LIBAVCODEC_VERSION_INT < (52<<16)
|
||||||
asprintf(&m.bps, "%u", ctx->streams[audio_stream]->codec->bits_per_sample);
|
asprintf(&m.bps, "%u", ctx->streams[audio_stream]->codec->bits_per_sample);
|
||||||
#else
|
#else
|
||||||
asprintf(&m.bps, "%u", ctx->streams[audio_stream]->codec->bits_per_coded_sample);
|
asprintf(&m.bps, "%u", ctx->streams[audio_stream]->codec->bits_per_coded_sample);
|
||||||
@ -1439,6 +1439,29 @@ GetVideoMetadata(const char * path, char * name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(31<<8)+0)
|
||||||
|
else if( strcmp(ctx->iformat->name, "mov,mp4,m4a,3gp,3g2,mj2") == 0 )
|
||||||
|
{
|
||||||
|
if( ctx->metadata )
|
||||||
|
{
|
||||||
|
AVMetadataTag *tag = NULL;
|
||||||
|
|
||||||
|
//DEBUG DPRINTF(E_DEBUG, L_METADATA, "Metadata:\n");
|
||||||
|
while( (tag = av_metadata_get(ctx->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)) )
|
||||||
|
{
|
||||||
|
//DEBUG DPRINTF(E_DEBUG, L_METADATA, " %-16s: %s\n", tag->key, tag->value);
|
||||||
|
if( strcmp(tag->key, "title") == 0 )
|
||||||
|
m.title = strdup(trim(tag->value));
|
||||||
|
else if( strcmp(tag->key, "genre") == 0 )
|
||||||
|
m.genre = strdup(trim(tag->value));
|
||||||
|
else if( strcmp(tag->key, "artist") == 0 )
|
||||||
|
m.artist = strdup(trim(tag->value));
|
||||||
|
else if( strcmp(tag->key, "comment") == 0 )
|
||||||
|
m.comment = strdup(trim(tag->value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
video_no_dlna:
|
video_no_dlna:
|
||||||
av_close_input_file(ctx);
|
av_close_input_file(ctx);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user