Commit 90bf1e30 authored by Mark Reid's avatar Mark Reid Committed by Michael Niedermayer

libavformat/mxfdec: read source timecode from pulldown component

Reviewed-by: 's avatarTomas Härdin <tomas.hardin@codemill.se>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent a6555f88
...@@ -33,6 +33,7 @@ enum MXFMetadataSetType { ...@@ -33,6 +33,7 @@ enum MXFMetadataSetType {
SourcePackage, SourcePackage,
SourceClip, SourceClip,
TimecodeComponent, TimecodeComponent,
PulldownComponent,
Sequence, Sequence,
MultipleDescriptor, MultipleDescriptor,
Descriptor, Descriptor,
......
...@@ -126,6 +126,12 @@ typedef struct { ...@@ -126,6 +126,12 @@ typedef struct {
AVTimecode tc; AVTimecode tc;
} MXFTimecodeComponent; } MXFTimecodeComponent;
typedef struct {
UID uid;
enum MXFMetadataSetType type;
UID input_segment_ref;
} MXFPulldownComponent;
typedef struct { typedef struct {
UID uid; UID uid;
enum MXFMetadataSetType type; enum MXFMetadataSetType type;
...@@ -693,6 +699,17 @@ static int mxf_read_timecode_component(void *arg, AVIOContext *pb, int tag, int ...@@ -693,6 +699,17 @@ static int mxf_read_timecode_component(void *arg, AVIOContext *pb, int tag, int
return 0; return 0;
} }
static int mxf_read_pulldown_component(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFPulldownComponent *mxf_pulldown = arg;
switch(tag) {
case 0x0d01:
avio_read(pb, mxf_pulldown->input_segment_ref, 16);
break;
}
return 0;
}
static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{ {
MXFTrack *track = arg; MXFTrack *track = arg;
...@@ -1413,6 +1430,7 @@ static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t ...@@ -1413,6 +1430,7 @@ static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t
MXFStructuralComponent *component = NULL; MXFStructuralComponent *component = NULL;
MXFStructuralComponent *sourceclip = NULL; MXFStructuralComponent *sourceclip = NULL;
MXFTimecodeComponent *mxf_tc = NULL; MXFTimecodeComponent *mxf_tc = NULL;
MXFPulldownComponent *mxf_pulldown = NULL;
int i, j, k; int i, j, k;
AVTimecode tc; AVTimecode tc;
int flags; int flags;
...@@ -1456,8 +1474,16 @@ static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t ...@@ -1456,8 +1474,16 @@ static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t
for (k = 0; k < physical_track->sequence->structural_components_count; k++) { for (k = 0; k < physical_track->sequence->structural_components_count; k++) {
component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], TimecodeComponent); component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], TimecodeComponent);
if (!component) if (!component){
continue; /* timcode component may be located on a pulldown component */
component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], PulldownComponent);
if (!component)
continue;
mxf_pulldown = (MXFPulldownComponent*)component;
component = mxf_resolve_strong_ref(mxf, &mxf_pulldown->input_segment_ref, TimecodeComponent);
if (!component)
continue;
}
mxf_tc = (MXFTimecodeComponent*)component; mxf_tc = (MXFTimecodeComponent*)component;
flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0; flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;
...@@ -1944,6 +1970,7 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = { ...@@ -1944,6 +1970,7 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
{ { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3A,0x00 }, mxf_read_track, sizeof(MXFTrack), Track }, /* Static Track */ { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3A,0x00 }, mxf_read_track, sizeof(MXFTrack), Track }, /* Static Track */
{ { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3B,0x00 }, mxf_read_track, sizeof(MXFTrack), Track }, /* Generic Track */ { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3B,0x00 }, mxf_read_track, sizeof(MXFTrack), Track }, /* Generic Track */
{ { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x14,0x00 }, mxf_read_timecode_component, sizeof(MXFTimecodeComponent), TimecodeComponent }, { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x14,0x00 }, mxf_read_timecode_component, sizeof(MXFTimecodeComponent), TimecodeComponent },
{ { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x0c,0x00 }, mxf_read_pulldown_component, sizeof(MXFPulldownComponent), PulldownComponent },
{ { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x04,0x01,0x02,0x02,0x00,0x00 }, mxf_read_cryptographic_context, sizeof(MXFCryptoContext), CryptoContext }, { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x04,0x01,0x02,0x02,0x00,0x00 }, mxf_read_cryptographic_context, sizeof(MXFCryptoContext), CryptoContext },
{ { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x10,0x01,0x00 }, mxf_read_index_table_segment, sizeof(MXFIndexTableSegment), IndexTableSegment }, { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x10,0x01,0x00 }, mxf_read_index_table_segment, sizeof(MXFIndexTableSegment), IndexTableSegment },
{ { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, NULL, 0, AnyType }, { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, NULL, 0, AnyType },
......
103403355e6dec356c7342ee2d034691 *./tests/data/lavf/lavf.mxf dbc4ced82ef1c2fa4df3571b4f994a22 *./tests/data/lavf/lavf.mxf
525369 ./tests/data/lavf/lavf.mxf 525369 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1 ./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1
f61e4c8481610f30b2f5e2279e254f6b *./tests/data/lavf/lavf.mxf fe4294023cd990938f042c7855405f63 *./tests/data/lavf/lavf.mxf
560697 ./tests/data/lavf/lavf.mxf 560697 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0x11a6178e ./tests/data/lavf/lavf.mxf CRC=0x11a6178e
a586dad4ff94136be460afb02ff6101e *./tests/data/lavf/lavf.mxf ef0c741e17bf7963fc51adcb6bab8ec8 *./tests/data/lavf/lavf.mxf
525369 ./tests/data/lavf/lavf.mxf 525369 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1 ./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1
838b732d832dcf40b0eb9944bc6d8f55 *./tests/data/lavf/lavf.mxf_d10 87e0903ef7ea55b1a032b9d878588683 *./tests/data/lavf/lavf.mxf_d10
5330989 ./tests/data/lavf/lavf.mxf_d10 5330989 ./tests/data/lavf/lavf.mxf_d10
./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488 ./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment