[FFmpeg-devel] [PATCH] mxfdec.c: fixed frame wrapping detection for MXFGCP1FrameWrappedPicture essence container

Tomas Härdin tjoppen at acc.umu.se
Mon Jul 12 14:01:06 EEST 2021


sön 2021-07-11 klockan 09:47 -0700 skrev pal at sandflow.com:
> From: Pierre-Anthony Lemieux <pal at sandflow.com>
> 
> Signed-off-by: Pierre-Anthony Lemieux <pal at sandflow.com>
> ---
> 
> Notes:
>     For JPEG 2000 essence, the MXF input format module currently uses the value of byte 14 of the essence container UL to determines whether the J2K essence is clip- (byte 14 is 0x02)
>     or frame-wrapped (byte 14 is 0x01). This approach does work when the essence container UL is equal to MXFGCP1FrameWrappedPicture, in which case the essence is always frame-wrapped.
> 
>  libavformat/mxf.h    | 3 ++-
>  libavformat/mxfdec.c | 4 ++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/mxf.h b/libavformat/mxf.h
> index b1b1fedac7..ca510f5a2f 100644
> --- a/libavformat/mxf.h
> +++ b/libavformat/mxf.h
> @@ -75,7 +75,8 @@ typedef enum {
>      NormalWrap = 0,
>      D10D11Wrap,
>      RawAWrap,
> -    RawVWrap
> +    RawVWrap,
> +    AlwaysFrameWrap
>  } MXFWrappingIndicatorType;
>  
>  typedef struct MXFLocalTagPair {
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index 3bf480a3a6..7024d2ea7d 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -1413,6 +1413,7 @@ static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMe
>  
>  static const MXFCodecUL mxf_picture_essence_container_uls[] = {
>      // video essence container uls
> +    { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c,0x06,0x00 }, 15,   AV_CODEC_ID_JPEG2000, NULL, 16, AlwaysFrameWrap }, /*  MXF-GC P1 Frame-Wrapped JPEG 2000 */
>      { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c,0x01,0x00 }, 14,   AV_CODEC_ID_JPEG2000, NULL, 14 },
>      { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x02,0x0d,0x01,0x03,0x01,0x02,0x10,0x60,0x01 }, 14,       AV_CODEC_ID_H264, NULL, 15 }, /* H.264 */
>      { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x02,0x0d,0x01,0x03,0x01,0x02,0x11,0x01,0x00 }, 14,      AV_CODEC_ID_DNXHD, NULL, 14 }, /* VC-3 */
> @@ -1497,6 +1498,9 @@ static MXFWrappingScheme mxf_get_wrapping_kind(UID *essence_container_ul)
>              if (val == 0x02)
>                  val = 0x01;
>              break;
> +        case AlwaysFrameWrap:
> +            val = 0x01;
> +            break;

Looks OK. Still passes FATE.

/Tomas



More information about the ffmpeg-devel mailing list