diff options
author | Max Kellermann <max@duempel.org> | 2012-02-03 09:00:19 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-02-03 09:09:18 +0100 |
commit | 6357496d17a4fbcf8280ba721b5235567137eafc (patch) | |
tree | 7f0691d7a90f8a4ca100cbf77c9ff51e157cfd70 /src/decoder/ffmpeg_decoder_plugin.c | |
parent | 001e2a604b396d613671132300972b41567e0262 (diff) | |
download | mpd-6357496d17a4fbcf8280ba721b5235567137eafc.tar.gz mpd-6357496d17a4fbcf8280ba721b5235567137eafc.tar.xz mpd-6357496d17a4fbcf8280ba721b5235567137eafc.zip |
decoder/ffmpeg: merge code to _copy_dictionary()
Eliminate some duplicate code.
Diffstat (limited to '')
-rw-r--r-- | src/decoder/ffmpeg_decoder_plugin.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c index 5d7f33bd7..947241599 100644 --- a/src/decoder/ffmpeg_decoder_plugin.c +++ b/src/decoder/ffmpeg_decoder_plugin.c @@ -623,6 +623,13 @@ ffmpeg_copy_metadata(struct tag *tag, AVDictionary *m, tag_add_item(tag, tag_map.type, mt->value); } +static void +ffmpeg_copy_dictionary(struct tag *tag, AVDictionary *dict) +{ + for (unsigned i = 0; i < G_N_ELEMENTS(ffmpeg_tag_maps); i++) + ffmpeg_copy_metadata(tag, dict, ffmpeg_tag_maps[i]); +} + #endif //no tag reading in ffmpeg, check if playable @@ -671,12 +678,10 @@ ffmpeg_stream_tag(struct input_stream *is) av_metadata_conv(f, NULL, f->iformat->metadata_conv); #endif - for (unsigned i = 0; i < sizeof(ffmpeg_tag_maps)/sizeof(ffmpeg_tag_map); i++) { - int idx = ffmpeg_find_audio_stream(f); - ffmpeg_copy_metadata(tag, f->metadata, ffmpeg_tag_maps[i]); - if (idx >= 0) - ffmpeg_copy_metadata(tag, f->streams[idx]->metadata, ffmpeg_tag_maps[i]); - } + ffmpeg_copy_dictionary(tag, f->metadata); + int idx = ffmpeg_find_audio_stream(f); + if (idx >= 0) + ffmpeg_copy_dictionary(tag, f->streams[idx]->metadata); #else if (f->author[0]) tag_add_item(tag, TAG_ARTIST, f->author); |