matroskadec: properly decode color space in an endian neutral way

This commit is contained in:
Aurelien Jacobs 2011-06-14 02:00:06 +02:00
parent 5fec3a2539
commit fdb5e02901
1 changed files with 4 additions and 3 deletions

View File

@ -112,7 +112,7 @@ typedef struct {
uint64_t display_height;
uint64_t pixel_width;
uint64_t pixel_height;
uint64_t fourcc;
EbmlBin color_space;
uint64_t stereo_mode;
} MatroskaTrackVideo;
@ -302,7 +302,7 @@ static EbmlSyntax matroska_track_video[] = {
{ MATROSKA_ID_VIDEODISPLAYHEIGHT, EBML_UINT, 0, offsetof(MatroskaTrackVideo,display_height) },
{ MATROSKA_ID_VIDEOPIXELWIDTH, EBML_UINT, 0, offsetof(MatroskaTrackVideo,pixel_width) },
{ MATROSKA_ID_VIDEOPIXELHEIGHT, EBML_UINT, 0, offsetof(MatroskaTrackVideo,pixel_height) },
{ MATROSKA_ID_VIDEOCOLORSPACE, EBML_UINT, 0, offsetof(MatroskaTrackVideo,fourcc) },
{ MATROSKA_ID_VIDEOCOLORSPACE, EBML_BIN, 0, offsetof(MatroskaTrackVideo,color_space) },
{ MATROSKA_ID_VIDEOSTEREOMODE, EBML_UINT, 0, offsetof(MatroskaTrackVideo,stereo_mode) },
{ MATROSKA_ID_VIDEOPIXELCROPB, EBML_NONE },
{ MATROSKA_ID_VIDEOPIXELCROPT, EBML_NONE },
@ -1303,7 +1303,8 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
track->video.display_width = track->video.pixel_width;
if (!track->video.display_height)
track->video.display_height = track->video.pixel_height;
fourcc = track->video.fourcc;
if (track->video.color_space.size == 4)
fourcc = AV_RL32(track->video.color_space.data);
} else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
if (!track->audio.out_samplerate)
track->audio.out_samplerate = track->audio.samplerate;