Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
lavf/mxfdec: parse all widths/heights and update codecpar accordingly
- Loading branch information
Showing
with
30 additions
and
6 deletions.
-
+30
−6
libavformat/mxfdec.c
|
|
@@ -170,8 +170,14 @@ typedef struct MXFDescriptor { |
|
|
UID codec_ul; |
|
|
AVRational sample_rate; |
|
|
AVRational aspect_ratio; |
|
|
int width; |
|
|
int height; /* Field height, not frame height */ |
|
|
uint32_t stored_width; |
|
|
uint32_t stored_height; /* Field height, not frame height in case of interlaced content */ |
|
|
uint32_t sampled_width; |
|
|
uint32_t sampled_height; /*Field height, not frame height in case of interlaced content */ |
|
|
uint32_t display_width; |
|
|
uint32_t display_height; /*Field height, not frame height in case of interlaced content */ |
|
|
int32_t display_x_offset; |
|
|
int32_t display_y_offset; |
|
|
int frame_layout; /* See MXFFrameLayout enum */ |
|
|
#define MXF_TFF 1 |
|
|
#define MXF_BFF 2 |
|
|
@@ -988,10 +994,28 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int |
|
|
avio_read(pb, descriptor->essence_codec_ul, 16); |
|
|
break; |
|
|
case 0x3203: |
|
|
descriptor->width = avio_rb32(pb); |
|
|
descriptor->stored_width = avio_rb32(pb); |
|
|
break; |
|
|
case 0x3202: |
|
|
descriptor->height = avio_rb32(pb); |
|
|
descriptor->stored_height = avio_rb32(pb); |
|
|
break; |
|
|
case 0x3205: |
|
|
descriptor->sampled_width = avio_rb32(pb); |
|
|
break; |
|
|
case 0x3204: |
|
|
descriptor->sampled_height = avio_rb32(pb); |
|
|
break; |
|
|
case 0x3209: |
|
|
descriptor->display_width = avio_rb32(pb); |
|
|
break; |
|
|
case 0x3208: |
|
|
descriptor->display_height = avio_rb32(pb); |
|
|
break; |
|
|
case 0x320A: |
|
|
descriptor->display_x_offset = avio_rb32(pb); |
|
|
break; |
|
|
case 0x320B: |
|
|
descriptor->display_y_offset = avio_rb32(pb); |
|
|
break; |
|
|
case 0x320C: |
|
|
descriptor->frame_layout = avio_r8(pb); |
|
|
@@ -2027,8 +2051,8 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) |
|
|
container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul); |
|
|
if (st->codecpar->codec_id == AV_CODEC_ID_NONE) |
|
|
st->codecpar->codec_id = container_ul->id; |
|
|
st->codecpar->width = descriptor->width; |
|
|
st->codecpar->height = descriptor->height; /* Field height, not frame height */ |
|
|
st->codecpar->width = descriptor->display_width ? descriptor->display_width : descriptor->sampled_width ? descriptor->sampled_width : descriptor->stored_width; |
|
|
st->codecpar->height = descriptor->display_height ? descriptor->display_height : descriptor->sampled_height ? descriptor->sampled_height : descriptor->stored_height; /* Field height, not frame height */ |
|
|
switch (descriptor->frame_layout) { |
|
|
case FullFrame: |
|
|
st->codecpar->field_order = AV_FIELD_PROGRESSIVE; |
|
|
|