From 42b47624f8e5c3742e06f10135ecc0ae34a29064 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 24 Jan 2013 16:57:21 +0100 Subject: demux_mkv: support V_UNCOMPRESSED video tracks Tested with a sample generated by: ffmpeg -i in.mkv -an -vcodec rawvideo out.mkv Also add proper dependencies for the Matroska Perl stuff in Makefile. --- Makefile | 10 ++++++++-- TOOLS/lib/Parse/Matroska/Definitions.pm | 1 + demux/demux_mkv.c | 11 ++++++++++- demux/matroska.h | 1 + 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ed29fb4cc6..1a3649f607 100644 --- a/Makefile +++ b/Makefile @@ -357,12 +357,18 @@ video/out/vo_vdpau.c: video/out/vdpau_template.c video/out/vdpau_template.c: TOOLS/vdpau_functions.pl ./$< > $@ +MKVLIB_DEPS = TOOLS/lib/Parse/Matroska.pm \ + TOOLS/lib/Parse/Matroska/Definitions.pm \ + TOOLS/lib/Parse/Matroska/Element.pm \ + TOOLS/lib/Parse/Matroska/Reader.pm \ + TOOLS/lib/Parse/Matroska/Utils.pm \ + demux/ebml.c demux/demux_mkv.c: demux/ebml_types.h -demux/ebml_types.h: TOOLS/matroska.pl +demux/ebml_types.h: TOOLS/matroska.pl $(MKVLIB_DEPS) ./$< --generate-header > $@ demux/ebml.c: demux/ebml_defs.c -demux/ebml_defs.c: TOOLS/matroska.pl +demux/ebml_defs.c: TOOLS/matroska.pl $(MKVLIB_DEPS) ./$< --generate-definitions > $@ video/out/vo_opengl.c: video/out/vo_opengl_shaders.h diff --git a/TOOLS/lib/Parse/Matroska/Definitions.pm b/TOOLS/lib/Parse/Matroska/Definitions.pm index 9b700a7d20..c52c2172b3 100644 --- a/TOOLS/lib/Parse/Matroska/Definitions.pm +++ b/TOOLS/lib/Parse/Matroska/Definitions.pm @@ -264,6 +264,7 @@ sub define_matroska { elem('DisplayHeight', '54ba', 'uint'), elem('DisplayUnit', '54b2', 'uint'), elem('FrameRate', '2383e3', 'float'), + elem('ColourSpace', '2eb524', 'binary'), }), elem('Audio', 'e1', { elem('SamplingFrequency', 'b5', 'float'), diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index da1dd13c6e..ff38e628ec 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -92,6 +92,7 @@ typedef struct mkv_track { uint32_t v_width, v_height, v_dwidth, v_dheight; double v_frate; + uint32_t colorspace; uint32_t a_formattag; uint32_t a_channels, a_bps; @@ -554,6 +555,12 @@ static void parse_trackvideo(struct demuxer *demuxer, struct mkv_track *track, mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Pixel height: %u\n", track->v_height); } + if (video->n_colour_space && video->colour_space.len == 4) { + uint8_t *d = (uint8_t *)&video->colour_space.start[0]; + track->colorspace = d[0] | (d[1] << 8) | (d[2] << 16) | (d[3] << 24); + mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Colorspace: %#x\n", + (unsigned int)track->colorspace); + } } /** @@ -1225,7 +1232,9 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track, // copy type1 and type2 info from rv properties memcpy(dst, src - 8, 8 + cnt); track->realmedia = 1; - + } else if (strcmp(track->codec_id, MKV_V_UNCOMPRESSED) == 0) { + // raw video, "like AVI" - this is a FourCC + bih->biCompression = track->colorspace; } else { const videocodec_info_t *vi = vinfo; while (vi->id && strcmp(vi->id, track->codec_id)) diff --git a/demux/matroska.h b/demux/matroska.h index 6d56008cb1..41ccfe2b26 100644 --- a/demux/matroska.h +++ b/demux/matroska.h @@ -73,6 +73,7 @@ #define MKV_V_THEORA "V_THEORA" #define MKV_V_VP8 "V_VP8" #define MKV_V_MJPEG "V_MJPEG" +#define MKV_V_UNCOMPRESSED "V_UNCOMPRESSED" #define MKV_S_TEXTASCII "S_TEXT/ASCII" #define MKV_S_TEXTUTF8 "S_TEXT/UTF8" -- cgit v1.2.3