1
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 07:33:46 +01:00

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.
This commit is contained in:
wm4 2013-01-24 16:57:21 +01:00
parent dd96c11d5e
commit 42b47624f8
4 changed files with 20 additions and 3 deletions

View File

@ -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

View File

@ -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'),

View File

@ -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))

View File

@ -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"