summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMark Reid <mindmark@gmail.com>2014-10-24 17:31:24 -0700
committerMichael Niedermayer <michaelni@gmx.at>2014-10-25 23:15:04 +0200
commit90bf1e3046000def2142e06c9f084b7542256804 (patch)
treed81ac878ba2b88e8a0739667b4fb66d903b2b42b /libavformat
parenta6555f88aaf0730e64240136fb19d8effb3a0738 (diff)
libavformat/mxfdec: read source timecode from pulldown component
Reviewed-by: Tomas Härdin <tomas.hardin@codemill.se> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mxf.h1
-rw-r--r--libavformat/mxfdec.c31
2 files changed, 30 insertions, 2 deletions
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index 036c15ebac..5b95efa697 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -33,6 +33,7 @@ enum MXFMetadataSetType {
SourcePackage,
SourceClip,
TimecodeComponent,
+ PulldownComponent,
Sequence,
MultipleDescriptor,
Descriptor,
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 94fe7d4acd..9d7f2fffcd 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -129,6 +129,12 @@ typedef struct {
typedef struct {
UID uid;
enum MXFMetadataSetType type;
+ UID input_segment_ref;
+} MXFPulldownComponent;
+
+typedef struct {
+ UID uid;
+ enum MXFMetadataSetType type;
MXFSequence *sequence; /* mandatory, and only one */
UID sequence_ref;
int track_id;
@@ -693,6 +699,17 @@ static int mxf_read_timecode_component(void *arg, AVIOContext *pb, int tag, int
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)
{
MXFTrack *track = arg;
@@ -1413,6 +1430,7 @@ static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_t
MXFStructuralComponent *component = NULL;
MXFStructuralComponent *sourceclip = NULL;
MXFTimecodeComponent *mxf_tc = NULL;
+ MXFPulldownComponent *mxf_pulldown = NULL;
int i, j, k;
AVTimecode tc;
int flags;
@@ -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++) {
component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], TimecodeComponent);
- if (!component)
- continue;
+ if (!component){
+ /* 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;
flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;
@@ -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,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,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,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 },