summaryrefslogtreecommitdiffstats
path: root/demux/codec_tags.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-22 12:53:51 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-01-25 17:00:14 +0900
commit15a191f920fa46c56face1d1364402fbfb498c5c (patch)
tree42dbae5585a0f148dca48d6b8a85e7c623a03d70 /demux/codec_tags.c
parent899822c001eb9f0f46a9a25de3bd1dc03d45f724 (diff)
downloadmpv-15a191f920fa46c56face1d1364402fbfb498c5c.tar.bz2
mpv-15a191f920fa46c56face1d1364402fbfb498c5c.tar.xz
demux_mkv: support embedded coverart
The code could as well be in demux.c, but it's better to avoid accidental clashes with demux_lavf.c. FFmpeg provides no way yet to map a mime type to a codec, so do it manually. (It _can_ map a mime type to an "input format", but not a codec.) Fixes #1374.
Diffstat (limited to 'demux/codec_tags.c')
-rw-r--r--demux/codec_tags.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/demux/codec_tags.c b/demux/codec_tags.c
index 9af4035ed1..0ca6ce70da 100644
--- a/demux/codec_tags.c
+++ b/demux/codec_tags.c
@@ -421,3 +421,20 @@ void mp_set_pcm_codec(struct sh_stream *sh, bool sign, bool is_float, int bits,
mp_snprintf_cat(codec, sizeof(codec), is_be ? "be" : "le");
sh->codec = talloc_strdup(sh->audio, codec);
}
+
+static const char *const mimetype_to_codec[][2] = {
+ {"image/jpeg", "mjpeg"},
+ {"image/png", "png"},
+ {0}
+};
+
+const char *mp_map_mimetype_to_video_codec(const char *mimetype)
+{
+ if (mimetype) {
+ for (int n = 0; mimetype_to_codec[n][0]; n++) {
+ if (strcmp(mimetype_to_codec[n][0], mimetype) == 0)
+ return mimetype_to_codec[n][1];
+ }
+ }
+ return NULL;
+}