summaryrefslogtreecommitdiff
path: root/libavformat/mxfdec.c
diff options
context:
space:
mode:
authorTomas Härdin <tomas.hardin@codemill.se>2010-06-30 07:55:05 +0000
committerTomas Härdin <tomas.hardin@codemill.se>2010-06-30 07:55:05 +0000
commit11fdc4d4fcd1eecd4912354ecbc2c6a8dc97635c (patch)
treec89214f676eddd47b71bd393f14054d1f48910e6 /libavformat/mxfdec.c
parent85b76ce9901120b7a2ed9ab607dff8daa43e1b0d (diff)
mxfdec: Improve parsing of the PixelLayout item
Originally committed as revision 23898 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mxfdec.c')
-rw-r--r--libavformat/mxfdec.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 168fd8d69f..cff843ea74 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -101,6 +101,7 @@ typedef struct {
int linked_track_id;
uint8_t *extradata;
int extradata_size;
+ enum PixelFormat pix_fmt;
} MXFDescriptor;
typedef struct {
@@ -520,25 +521,21 @@ static int mxf_read_index_table_segment(MXFIndexTableSegment *segment, ByteIOCon
static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor)
{
- int code;
+ int code, value, ofs = 0;
+ char layout[16] = {};
do {
code = get_byte(pb);
+ value = get_byte(pb);
dprintf(NULL, "pixel layout: code %#x\n", code);
- switch (code) {
- case 0x52: /* R */
- descriptor->bits_per_sample += get_byte(pb);
- break;
- case 0x47: /* G */
- descriptor->bits_per_sample += get_byte(pb);
- break;
- case 0x42: /* B */
- descriptor->bits_per_sample += get_byte(pb);
- break;
- default:
- get_byte(pb);
+
+ if (ofs < 16) {
+ layout[ofs++] = code;
+ layout[ofs++] = value;
}
} while (code != 0); /* SMPTE 377M E.2.46 */
+
+ ff_mxf_decode_pixel_layout(layout, &descriptor->pix_fmt);
}
static int mxf_read_generic_descriptor(MXFDescriptor *descriptor, ByteIOContext *pb, int tag, int size, UID uid)
@@ -801,7 +798,8 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
st->codec->codec_id = container_ul->id;
st->codec->width = descriptor->width;
st->codec->height = descriptor->height;
- st->codec->bits_per_coded_sample = descriptor->bits_per_sample; /* Uncompressed */
+ if (st->codec->codec_id == CODEC_ID_RAWVIDEO)
+ st->codec->pix_fmt = descriptor->pix_fmt;
st->need_parsing = AVSTREAM_PARSE_HEADERS;
} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
container_ul = mxf_get_codec_ul(mxf_essence_container_uls, essence_container_ul);