diff mbox

[FFmpeg-devel,1/2] avformat/mxfdec: use first valid sourceclip found if material track has multiple components

Message ID 20160918211135.59228-1-mindmark@gmail.com
State Accepted
Headers show

Commit Message

Mark Reid Sept. 18, 2016, 9:11 p.m. UTC
hi,
This patch fixes a issue with mxf footage having multiple
components on a material track.

here is a link to the sample footage for the second patches fate test
https://dl.dropboxusercontent.com/u/170952/fate/mxf/multiple_components.mxf

---
 libavformat/mxfdec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--
2.9.2

Comments

Michael Niedermayer Sept. 19, 2016, 12:33 a.m. UTC | #1
On Sun, Sep 18, 2016 at 02:11:34PM -0700, Mark Reid wrote:
> hi,
> This patch fixes a issue with mxf footage having multiple
> components on a material track.
> 

> here is a link to the sample footage for the second patches fate test
> https://dl.dropboxusercontent.com/u/170952/fate/mxf/multiple_components.mxf

file uploaded

thx

[...]
Michael Niedermayer Sept. 20, 2016, 11:46 p.m. UTC | #2
On Sun, Sep 18, 2016 at 02:11:34PM -0700, Mark Reid wrote:
> hi,
> This patch fixes a issue with mxf footage having multiple
> components on a material track.
> 
> here is a link to the sample footage for the second patches fate test
> https://dl.dropboxusercontent.com/u/170952/fate/mxf/multiple_components.mxf
> 
> ---
>  libavformat/mxfdec.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

patchset applied

thx

[...]
diff mbox

Patch

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 0b16463..1939761 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1888,7 +1888,11 @@  static int mxf_parse_structural_metadata(MXFContext *mxf)
             }
         }

-        /* TODO: handle multiple source clips */
+        /* TODO: handle multiple source clips, only finds first valid source clip */
+        if(material_track->sequence->structural_components_count > 1)
+            av_log(mxf->fc, AV_LOG_WARNING, "material track %d: has %d components\n",
+                       material_track->track_id, material_track->sequence->structural_components_count);
+
         for (j = 0; j < material_track->sequence->structural_components_count; j++) {
             component = mxf_resolve_sourceclip(mxf, &material_track->sequence->structural_components_refs[j]);
             if (!component)
@@ -1914,6 +1918,8 @@  static int mxf_parse_structural_metadata(MXFContext *mxf)
                 av_log(mxf->fc, AV_LOG_ERROR, "material track %d: no corresponding source track found\n", material_track->track_id);
                 break;
             }
+            if(source_track && component)
+                break;
         }
         if (!source_track || !component || !source_package)
             continue;