Re: [FFmpeg-devel] [PATCH 1/2] avformat/mxf: support MCA audio information

2021-12-21 Thread Marc-Antoine ARNAUD
Le ven. 17 déc. 2021 à 19:12, Marton Balint  a écrit :

>
>
> On Fri, 17 Dec 2021, Marc-Antoine ARNAUD wrote:
>
> > Hi all,
> >
> > Can I have an update on this patch submission ?
> > Is something required to be done before it can be merged ?
>
> New channel layout API is on its way, which makes in-demuxer channel
> reordering uneeded. Therefore the reordering option should not be added
> as it is in this patch. I can rework the patch after the channel layout
> API is in. (should happen in a couple of weeks at most).
>
> Regards,
> Marton
>

So it will happen only after the release 5 of FFMpeg right ?

Is it possible to merge it, and we can rework it after the new API is
released ?
Patches are related to IMF (new format) patches, and if FFmpeg can accept
IMF without MCA support it will generate a lot of errors in audio mapping.
So even if it's not performant for now, is it possible to imagine to merge
patches and rework after ?

Thanks a lot,
Marc-Antoine



>
> >
> > Thanks you,
> > Marc-Antoine
> >
> >
> > Le ven. 3 déc. 2021 à 10:57, Marc-Antoine Arnaud
> >  a écrit :
> >>
> >> ---
> >>  doc/demuxers.texi |  10 ++
> >>  libavformat/mxf.h |   3 +
> >>  libavformat/mxfdec.c  | 335 +-
> >>  libavformat/version.h |   2 +-
> >>  4 files changed, 343 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> >> index cab8a7072c..23b6753602 100644
> >> --- a/doc/demuxers.texi
> >> +++ b/doc/demuxers.texi
> >> @@ -770,6 +770,16 @@ MJPEG stream. Turning this option on by setting it
> to 1 will result in a stricte
> >>  of the boundary value.
> >>  @end table
> >>
> >> +@section mxf
> >> +
> >> +MXF demuxer.
> >> +
> >> +@table @option
> >> +
> >> +@item -skip_audio_reordering @var{bool}
> >> +This option will disable the audio reordering based on Multi-Channel
> Audio (MCA) labelling (SMPTE ST-377-4).
> >> +@end table
> >> +
> >>  @section rawvideo
> >>
> >>  Raw video demuxer.
> >> diff --git a/libavformat/mxf.h b/libavformat/mxf.h
> >> index fe9c52732c..d53a16df51 100644
> >> --- a/libavformat/mxf.h
> >> +++ b/libavformat/mxf.h
> >> @@ -50,6 +50,9 @@ enum MXFMetadataSetType {
> >>  TaggedValue,
> >>  TapeDescriptor,
> >>  AVCSubDescriptor,
> >> +AudioChannelLabelSubDescriptor,
> >> +SoundfieldGroupLabelSubDescriptor,
> >> +GroupOfSoundfieldGroupsLabelSubDescriptor,
> >>  };
> >>
> >>  enum MXFFrameLayout {
> >> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> >> index af9d33f796..6e1da75542 100644
> >> --- a/libavformat/mxfdec.c
> >> +++ b/libavformat/mxfdec.c
> >> @@ -51,11 +51,14 @@
> >>  #include "libavutil/mastering_display_metadata.h"
> >>  #include "libavutil/mathematics.h"
> >>  #include "libavcodec/bytestream.h"
> >> +#include "libavcodec/internal.h"
> >> +#include "libavutil/channel_layout.h"
> >>  #include "libavutil/intreadwrite.h"
> >>  #include "libavutil/parseutils.h"
> >>  #include "libavutil/timecode.h"
> >>  #include "libavutil/opt.h"
> >>  #include "avformat.h"
> >> +#include "avlanguage.h"
> >>  #include "internal.h"
> >>  #include "mxf.h"
> >>
> >> @@ -177,6 +180,8 @@ typedef struct {
> >>  int body_sid;
> >>  MXFWrappingScheme wrapping;
> >>  int edit_units_per_packet; /* how many edit units to read at a
> time (PCM, ClipWrapped) */
> >> +int require_reordering;
> >> +int channel_ordering[FF_SANE_NB_CHANNELS];
> >>  } MXFTrack;
> >>
> >>  typedef struct MXFDescriptor {
> >> @@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
> >>  unsigned int vert_subsampling;
> >>  UID *file_descriptors_refs;
> >>  int file_descriptors_count;
> >> +UID *sub_descriptors_refs;
> >> +int sub_descriptors_count;
> >>  int linked_track_id;
> >>  uint8_t *extradata;
> >>  int extradata_size;
> >> @@ -217,6 +224,18 @@ typedef struct MXFDescriptor {
> >>  size_t coll_size;
> >>  } MXFDescriptor;
> >>
> >> +typedef struct MXFMCASubDescriptor {
&g

Re: [FFmpeg-devel] [PATCH 1/2] avformat/mxf: support MCA audio information

2021-12-17 Thread Marc-Antoine ARNAUD
Hi all,

Can I have an update on this patch submission ?
Is something required to be done before it can be merged ?

Thanks you,
Marc-Antoine


Le ven. 3 déc. 2021 à 10:57, Marc-Antoine Arnaud
 a écrit :
>
> ---
>  doc/demuxers.texi |  10 ++
>  libavformat/mxf.h |   3 +
>  libavformat/mxfdec.c  | 335 +-
>  libavformat/version.h |   2 +-
>  4 files changed, 343 insertions(+), 7 deletions(-)
>
> diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> index cab8a7072c..23b6753602 100644
> --- a/doc/demuxers.texi
> +++ b/doc/demuxers.texi
> @@ -770,6 +770,16 @@ MJPEG stream. Turning this option on by setting it to 1 
> will result in a stricte
>  of the boundary value.
>  @end table
>
> +@section mxf
> +
> +MXF demuxer.
> +
> +@table @option
> +
> +@item -skip_audio_reordering @var{bool}
> +This option will disable the audio reordering based on Multi-Channel Audio 
> (MCA) labelling (SMPTE ST-377-4).
> +@end table
> +
>  @section rawvideo
>
>  Raw video demuxer.
> diff --git a/libavformat/mxf.h b/libavformat/mxf.h
> index fe9c52732c..d53a16df51 100644
> --- a/libavformat/mxf.h
> +++ b/libavformat/mxf.h
> @@ -50,6 +50,9 @@ enum MXFMetadataSetType {
>  TaggedValue,
>  TapeDescriptor,
>  AVCSubDescriptor,
> +AudioChannelLabelSubDescriptor,
> +SoundfieldGroupLabelSubDescriptor,
> +GroupOfSoundfieldGroupsLabelSubDescriptor,
>  };
>
>  enum MXFFrameLayout {
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index af9d33f796..6e1da75542 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -51,11 +51,14 @@
>  #include "libavutil/mastering_display_metadata.h"
>  #include "libavutil/mathematics.h"
>  #include "libavcodec/bytestream.h"
> +#include "libavcodec/internal.h"
> +#include "libavutil/channel_layout.h"
>  #include "libavutil/intreadwrite.h"
>  #include "libavutil/parseutils.h"
>  #include "libavutil/timecode.h"
>  #include "libavutil/opt.h"
>  #include "avformat.h"
> +#include "avlanguage.h"
>  #include "internal.h"
>  #include "mxf.h"
>
> @@ -177,6 +180,8 @@ typedef struct {
>  int body_sid;
>  MXFWrappingScheme wrapping;
>  int edit_units_per_packet; /* how many edit units to read at a time 
> (PCM, ClipWrapped) */
> +int require_reordering;
> +int channel_ordering[FF_SANE_NB_CHANNELS];
>  } MXFTrack;
>
>  typedef struct MXFDescriptor {
> @@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
>  unsigned int vert_subsampling;
>  UID *file_descriptors_refs;
>  int file_descriptors_count;
> +UID *sub_descriptors_refs;
> +int sub_descriptors_count;
>  int linked_track_id;
>  uint8_t *extradata;
>  int extradata_size;
> @@ -217,6 +224,18 @@ typedef struct MXFDescriptor {
>  size_t coll_size;
>  } MXFDescriptor;
>
> +typedef struct MXFMCASubDescriptor {
> +MXFMetadataSet meta;
> +UID uid;
> +UID mca_link_id;
> +UID soundfield_group_link_id;
> +UID *group_of_soundfield_groups_link_id_refs;
> +int group_of_soundfield_groups_link_id_count;
> +UID mca_label_dictionary_id;
> +int mca_channel_id;
> +char *language;
> +} MXFMCASubDescriptor;
> +
>  typedef struct MXFIndexTableSegment {
>  MXFMetadataSet meta;
>  int edit_unit_byte_count;
> @@ -290,6 +309,7 @@ typedef struct MXFContext {
>  int nb_index_tables;
>  MXFIndexTable *index_tables;
>  int eia608_extract;
> +int skip_audio_reordering;
>  } MXFContext;
>
>  /* NOTE: klv_offset is not set (-1) for local keys */
> @@ -311,6 +331,7 @@ static const uint8_t mxf_system_item_key_cp[] 
>  = { 0x06,0x0e,0x2b,0x
>  static const uint8_t mxf_system_item_key_gc[]  = { 
> 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
>  static const uint8_t mxf_klv_key[] = { 
> 0x06,0x0e,0x2b,0x34 };
>  static const uint8_t mxf_apple_coll_prefix[]   = { 
> 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
> +
>  /* complete keys to match */
>  static const uint8_t mxf_crypto_source_container_ul[]  = { 
> 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00
>  };
>  static const uint8_t mxf_encrypted_triplet_key[]   = { 
> 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00
>  };
> @@ -323,6 +344,17 @@ static const uint8_t mxf_indirect_value_utf16be[]
>   = { 0x42,0x01,0x1

[FFmpeg-devel] [PATCH 2/2] avformat/mxf: add documentation for eia608_extract parameter

2021-12-03 Thread Marc-Antoine Arnaud
---
 doc/demuxers.texi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 23b6753602..587ce11c95 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -776,6 +776,9 @@ MXF demuxer.
 
 @table @option
 
+@item -eia608_extract @var{bool}
+Extract EIA-608 captions from SMPTE 436M track
+
 @item -skip_audio_reordering @var{bool}
 This option will disable the audio reordering based on Multi-Channel Audio 
(MCA) labelling (SMPTE ST-377-4).
 @end table
-- 
2.33.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avformat/mxf: support MCA audio information

2021-12-03 Thread Marc-Antoine Arnaud
---
 doc/demuxers.texi |  10 ++
 libavformat/mxf.h |   3 +
 libavformat/mxfdec.c  | 335 +-
 libavformat/version.h |   2 +-
 4 files changed, 343 insertions(+), 7 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index cab8a7072c..23b6753602 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -770,6 +770,16 @@ MJPEG stream. Turning this option on by setting it to 1 
will result in a stricte
 of the boundary value.
 @end table
 
+@section mxf
+
+MXF demuxer.
+
+@table @option
+
+@item -skip_audio_reordering @var{bool}
+This option will disable the audio reordering based on Multi-Channel Audio 
(MCA) labelling (SMPTE ST-377-4).
+@end table
+
 @section rawvideo
 
 Raw video demuxer.
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..d53a16df51 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,9 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+AudioChannelLabelSubDescriptor,
+SoundfieldGroupLabelSubDescriptor,
+GroupOfSoundfieldGroupsLabelSubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af9d33f796..6e1da75542 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,18 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID soundfield_group_link_id;
+UID *group_of_soundfield_groups_link_id_refs;
+int group_of_soundfield_groups_link_id_count;
+UID mca_label_dictionary_id;
+int mca_channel_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +309,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +331,7 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +344,17 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_group_of_soundfield_groups_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x04,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 

[FFmpeg-devel] [PATCH 2/2] avformat/mxf: add documentation for eia608_extract parameter

2021-11-25 Thread Marc-Antoine Arnaud
---
 doc/demuxers.texi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 23b6753602..587ce11c95 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -776,6 +776,9 @@ MXF demuxer.
 
 @table @option
 
+@item -eia608_extract @var{bool}
+Extract EIA-608 captions from SMPTE 436M track
+
 @item -skip_audio_reordering @var{bool}
 This option will disable the audio reordering based on Multi-Channel Audio 
(MCA) labelling (SMPTE ST-377-4).
 @end table
-- 
2.33.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avformat/mxf: support MCA audio information

2021-11-25 Thread Marc-Antoine Arnaud
---
 doc/demuxers.texi |  10 ++
 libavformat/mxf.h |   1 +
 libavformat/mxfdec.c  | 293 +-
 libavformat/version.h |   2 +-
 4 files changed, 299 insertions(+), 7 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index cab8a7072c..23b6753602 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -770,6 +770,16 @@ MJPEG stream. Turning this option on by setting it to 1 
will result in a stricte
 of the boundary value.
 @end table
 
+@section mxf
+
+MXF demuxer.
+
+@table @option
+
+@item -skip_audio_reordering @var{bool}
+This option will disable the audio reordering based on Multi-Channel Audio 
(MCA) labelling (SMPTE ST-377-4).
+@end table
+
 @section rawvideo
 
 Raw video demuxer.
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af9d33f796..58ba330475 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 

[FFmpeg-devel] [PATCH 2/2] avformat/mxf: add documentation for eia608_extract parameter

2021-11-23 Thread Marc-Antoine Arnaud
---
 doc/demuxers.texi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index fecfeadb47..06f666b5f1 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -776,6 +776,9 @@ MXF demuxer.
 
 @table @option
 
+@item -eia608_extract @var{bool}
+Extract EIA-608 captions from SMPTE 436M track
+
 @item -skip_audio_reordering @var{bool}
 This option will disable the audio reordering based on Multi-Channel Audio 
(MCA) labelling (SMPTE ST-377-4).
 @end table
-- 
2.33.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avformat/mxf: support MCA audio information

2021-11-23 Thread Marc-Antoine Arnaud
---
 doc/demuxers.texi |  10 ++
 libavformat/mxf.h |   1 +
 libavformat/mxfdec.c  | 293 +-
 libavformat/version.h |   2 +-
 4 files changed, 299 insertions(+), 7 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 1c9575b2e8..fecfeadb47 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -770,6 +770,16 @@ MJPEG stream. Turning this option on by setting it to 1 
will result in a stricte
 of the boundary value.
 @end table
 
+@section mxf
+
+MXF demuxer.
+
+@table @option
+
+@item -skip_audio_reordering @var{bool}
+This option will disable the audio reordering based on Multi-Channel Audio 
(MCA) labelling (SMPTE ST-377-4).
+@end table
+
 @section rawvideo
 
 Raw video demuxer.
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af9d33f796..58ba330475 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 

[FFmpeg-devel] [PATCH 2/2] avformat/mxf: add documentation for eia608_extract parameter

2021-11-10 Thread Marc-Antoine Arnaud
---
 doc/demuxers.texi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index fecfeadb47..06f666b5f1 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -776,6 +776,9 @@ MXF demuxer.
 
 @table @option
 
+@item -eia608_extract @var{bool}
+Extract EIA-608 captions from SMPTE 436M track
+
 @item -skip_audio_reordering @var{bool}
 This option will disable the audio reordering based on Multi-Channel Audio 
(MCA) labelling (SMPTE ST-377-4).
 @end table
-- 
2.33.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avformat/mxf: support MCA audio information

2021-11-10 Thread Marc-Antoine Arnaud
---
 doc/demuxers.texi |  10 ++
 libavformat/mxf.h |   1 +
 libavformat/mxfdec.c  | 284 +-
 libavformat/version.h |   2 +-
 4 files changed, 290 insertions(+), 7 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 1c9575b2e8..fecfeadb47 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -770,6 +770,16 @@ MJPEG stream. Turning this option on by setting it to 1 
will result in a stricte
 of the boundary value.
 @end table
 
+@section mxf
+
+MXF demuxer.
+
+@table @option
+
+@item -skip_audio_reordering @var{bool}
+This option will disable the audio reordering based on Multi-Channel Audio 
(MCA) labelling (SMPTE ST-377-4).
+@end table
+
 @section rawvideo
 
 Raw video demuxer.
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af9d33f796..194a887f75 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 

[FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information

2021-11-05 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 280 ++-
 2 files changed, 275 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af9d33f796..deee54991a 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +372,11 @@ static 

[FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information

2021-11-05 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 277 ++-
 2 files changed, 272 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af9d33f796..3ee07c9970 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +372,11 @@ static 

[FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information

2021-11-05 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 280 ++-
 2 files changed, 275 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af9d33f796..a5ea62934b 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +372,11 @@ static 

[FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information

2021-11-03 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 280 ++-
 2 files changed, 275 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c28549f6a9..db4491e25f 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +372,11 @@ static 

[FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information

2021-10-27 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 282 ++-
 2 files changed, 277 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c28549f6a9..08b196ab1f 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +372,11 @@ static 

[FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information

2021-10-18 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 283 ++-
 2 files changed, 278 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c28549f6a9..6676b865c1 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -51,11 +51,14 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +210,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +224,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -290,6 +306,7 @@ typedef struct MXFContext {
 int nb_index_tables;
 MXFIndexTable *index_tables;
 int eia608_extract;
+int skip_audio_reordering;
 } MXFContext;
 
 /* NOTE: klv_offset is not set (-1) for local keys */
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionary_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +372,11 @@ static 

[FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information

2021-10-11 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 276 ++-
 2 files changed, 271 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c28549f6a9..1bd7642416 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -45,17 +45,21 @@
  */
 
 #include 
+#include 
 
 #include "libavutil/aes.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +181,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+bool require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +211,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +225,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionnary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionnary_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +372,11 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor *)*ctx)->mastering);
 

[FFmpeg-devel] [PATCH 2/2] avformat/mxf: support MCA audio information

2021-09-17 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 277 ++-
 2 files changed, 272 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c28549f6a9..27893cda76 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -45,17 +45,21 @@
  */
 
 #include 
+#include 
 
 #include "libavutil/aes.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +181,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+bool require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +211,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +225,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionnary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionnary_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +372,11 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor *)*ctx)->mastering);
 

[FFmpeg-devel] [PATCH 1/2] avformat/mxf: rename sub_descriptors as file_descriptors

2021-09-17 Thread Marc-Antoine Arnaud
---
 libavformat/mxfdec.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 34cbd2cd77..c28549f6a9 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -203,8 +203,8 @@ typedef struct MXFDescriptor {
 unsigned int color_range;
 unsigned int horiz_subsampling;
 unsigned int vert_subsampling;
-UID *sub_descriptors_refs;
-int sub_descriptors_count;
+UID *file_descriptors_refs;
+int file_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -342,7 +342,7 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor *)*ctx)->extradata);
 av_freep(&((MXFDescriptor *)*ctx)->mastering);
 av_freep(&((MXFDescriptor *)*ctx)->coll);
-av_freep(&((MXFDescriptor *)*ctx)->sub_descriptors_refs);
+av_freep(&((MXFDescriptor *)*ctx)->file_descriptors_refs);
 break;
 case Sequence:
 av_freep(&((MXFSequence *)*ctx)->structural_components_refs);
@@ -1194,8 +1194,8 @@ static int mxf_read_generic_descriptor(void *arg, 
AVIOContext *pb, int tag, int
 
 switch(tag) {
 case 0x3F01:
-return mxf_read_strong_ref_array(pb, >sub_descriptors_refs,
- 
>sub_descriptors_count);
+return mxf_read_strong_ref_array(pb, 
>file_descriptors_refs,
+ 
>file_descriptors_count);
 case 0x3002: /* ContainerDuration */
 descriptor->duration = avio_rb64(pb);
 break;
@@ -2066,22 +2066,22 @@ static MXFPackage* 
mxf_resolve_source_package(MXFContext *mxf, UID package_ul, U
 
 static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, 
MXFDescriptor *descriptor, int track_id)
 {
-MXFDescriptor *sub_descriptor = NULL;
+MXFDescriptor *file_descriptor = NULL;
 int i;
 
 if (!descriptor)
 return NULL;
 
 if (descriptor->meta.type == MultipleDescriptor) {
-for (i = 0; i < descriptor->sub_descriptors_count; i++) {
-sub_descriptor = mxf_resolve_strong_ref(mxf, 
>sub_descriptors_refs[i], Descriptor);
+for (i = 0; i < descriptor->file_descriptors_count; i++) {
+file_descriptor = mxf_resolve_strong_ref(mxf, 
>file_descriptors_refs[i], Descriptor);
 
-if (!sub_descriptor) {
-av_log(mxf->fc, AV_LOG_ERROR, "could not resolve sub 
descriptor strong ref\n");
+if (!file_descriptor) {
+av_log(mxf->fc, AV_LOG_ERROR, "could not resolve file 
descriptor strong ref\n");
 continue;
 }
-if (sub_descriptor->linked_track_id == track_id) {
-return sub_descriptor;
+if (file_descriptor->linked_track_id == track_id) {
+return file_descriptor;
 }
 }
 } else if (descriptor->meta.type == Descriptor)
-- 
2.33.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] avformat/mxf: support MCA audio information

2021-09-15 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 280 ++-
 2 files changed, 275 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c28549f6a9..88f4b85bac 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -45,17 +45,21 @@
  */
 
 #include 
+#include 
 
 #include "libavutil/aes.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavcodec/internal.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +181,8 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+bool require_reordering;
+int channel_ordering[FF_SANE_NB_CHANNELS];
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +211,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +225,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionnary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -311,6 +328,10 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_mca_prefix[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +344,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionnary_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +373,11 @@ static void 

[FFmpeg-devel] [PATCH 1/2] avformat/mxf: rename sub_descriptors as file_descriptors

2021-09-15 Thread Marc-Antoine Arnaud
---
 libavformat/mxfdec.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 34cbd2cd77..c28549f6a9 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -203,8 +203,8 @@ typedef struct MXFDescriptor {
 unsigned int color_range;
 unsigned int horiz_subsampling;
 unsigned int vert_subsampling;
-UID *sub_descriptors_refs;
-int sub_descriptors_count;
+UID *file_descriptors_refs;
+int file_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -342,7 +342,7 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor *)*ctx)->extradata);
 av_freep(&((MXFDescriptor *)*ctx)->mastering);
 av_freep(&((MXFDescriptor *)*ctx)->coll);
-av_freep(&((MXFDescriptor *)*ctx)->sub_descriptors_refs);
+av_freep(&((MXFDescriptor *)*ctx)->file_descriptors_refs);
 break;
 case Sequence:
 av_freep(&((MXFSequence *)*ctx)->structural_components_refs);
@@ -1194,8 +1194,8 @@ static int mxf_read_generic_descriptor(void *arg, 
AVIOContext *pb, int tag, int
 
 switch(tag) {
 case 0x3F01:
-return mxf_read_strong_ref_array(pb, >sub_descriptors_refs,
- 
>sub_descriptors_count);
+return mxf_read_strong_ref_array(pb, 
>file_descriptors_refs,
+ 
>file_descriptors_count);
 case 0x3002: /* ContainerDuration */
 descriptor->duration = avio_rb64(pb);
 break;
@@ -2066,22 +2066,22 @@ static MXFPackage* 
mxf_resolve_source_package(MXFContext *mxf, UID package_ul, U
 
 static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, 
MXFDescriptor *descriptor, int track_id)
 {
-MXFDescriptor *sub_descriptor = NULL;
+MXFDescriptor *file_descriptor = NULL;
 int i;
 
 if (!descriptor)
 return NULL;
 
 if (descriptor->meta.type == MultipleDescriptor) {
-for (i = 0; i < descriptor->sub_descriptors_count; i++) {
-sub_descriptor = mxf_resolve_strong_ref(mxf, 
>sub_descriptors_refs[i], Descriptor);
+for (i = 0; i < descriptor->file_descriptors_count; i++) {
+file_descriptor = mxf_resolve_strong_ref(mxf, 
>file_descriptors_refs[i], Descriptor);
 
-if (!sub_descriptor) {
-av_log(mxf->fc, AV_LOG_ERROR, "could not resolve sub 
descriptor strong ref\n");
+if (!file_descriptor) {
+av_log(mxf->fc, AV_LOG_ERROR, "could not resolve file 
descriptor strong ref\n");
 continue;
 }
-if (sub_descriptor->linked_track_id == track_id) {
-return sub_descriptor;
+if (file_descriptor->linked_track_id == track_id) {
+return file_descriptor;
 }
 }
 } else if (descriptor->meta.type == Descriptor)
-- 
2.33.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avformat/mxf: rename sub_descriptors as file_descriptors

2021-09-02 Thread Marc-Antoine Arnaud
---
 libavformat/mxfdec.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 34cbd2cd77..c28549f6a9 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -203,8 +203,8 @@ typedef struct MXFDescriptor {
 unsigned int color_range;
 unsigned int horiz_subsampling;
 unsigned int vert_subsampling;
-UID *sub_descriptors_refs;
-int sub_descriptors_count;
+UID *file_descriptors_refs;
+int file_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -342,7 +342,7 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor *)*ctx)->extradata);
 av_freep(&((MXFDescriptor *)*ctx)->mastering);
 av_freep(&((MXFDescriptor *)*ctx)->coll);
-av_freep(&((MXFDescriptor *)*ctx)->sub_descriptors_refs);
+av_freep(&((MXFDescriptor *)*ctx)->file_descriptors_refs);
 break;
 case Sequence:
 av_freep(&((MXFSequence *)*ctx)->structural_components_refs);
@@ -1194,8 +1194,8 @@ static int mxf_read_generic_descriptor(void *arg, 
AVIOContext *pb, int tag, int
 
 switch(tag) {
 case 0x3F01:
-return mxf_read_strong_ref_array(pb, >sub_descriptors_refs,
- 
>sub_descriptors_count);
+return mxf_read_strong_ref_array(pb, 
>file_descriptors_refs,
+ 
>file_descriptors_count);
 case 0x3002: /* ContainerDuration */
 descriptor->duration = avio_rb64(pb);
 break;
@@ -2066,22 +2066,22 @@ static MXFPackage* 
mxf_resolve_source_package(MXFContext *mxf, UID package_ul, U
 
 static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, 
MXFDescriptor *descriptor, int track_id)
 {
-MXFDescriptor *sub_descriptor = NULL;
+MXFDescriptor *file_descriptor = NULL;
 int i;
 
 if (!descriptor)
 return NULL;
 
 if (descriptor->meta.type == MultipleDescriptor) {
-for (i = 0; i < descriptor->sub_descriptors_count; i++) {
-sub_descriptor = mxf_resolve_strong_ref(mxf, 
>sub_descriptors_refs[i], Descriptor);
+for (i = 0; i < descriptor->file_descriptors_count; i++) {
+file_descriptor = mxf_resolve_strong_ref(mxf, 
>file_descriptors_refs[i], Descriptor);
 
-if (!sub_descriptor) {
-av_log(mxf->fc, AV_LOG_ERROR, "could not resolve sub 
descriptor strong ref\n");
+if (!file_descriptor) {
+av_log(mxf->fc, AV_LOG_ERROR, "could not resolve file 
descriptor strong ref\n");
 continue;
 }
-if (sub_descriptor->linked_track_id == track_id) {
-return sub_descriptor;
+if (file_descriptor->linked_track_id == track_id) {
+return file_descriptor;
 }
 }
 } else if (descriptor->meta.type == Descriptor)
-- 
2.33.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] avformat/mxf: support MCA audio information

2021-08-24 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 283 ++-
 2 files changed, 278 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c28549f6a9..034adee413 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -45,17 +45,20 @@
  */
 
 #include 
+#include 
 
 #include "libavutil/aes.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,7 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int* channel_ordering;
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +209,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +223,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionnary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -311,6 +326,10 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_mca_prefix[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +342,15 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionnary_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+static const uint8_t mxf_sub_descriptor[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 
};
+
 static const uint8_t mxf_mastering_display_prefix[13]  = { 
FF_MXF_MasteringDisplay_PREFIX };
 static const uint8_t mxf_mastering_display_uls[4][16] = {
 FF_MXF_MasteringDisplayPrimaries,
@@ -343,6 +371,11 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor 

[FFmpeg-devel] [PATCH 1/2] avformat/mxf: rename sub_descriptors as file_descriptors

2021-08-24 Thread Marc-Antoine Arnaud
---
 libavformat/mxfdec.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 34cbd2cd77..c28549f6a9 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -203,8 +203,8 @@ typedef struct MXFDescriptor {
 unsigned int color_range;
 unsigned int horiz_subsampling;
 unsigned int vert_subsampling;
-UID *sub_descriptors_refs;
-int sub_descriptors_count;
+UID *file_descriptors_refs;
+int file_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -342,7 +342,7 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor *)*ctx)->extradata);
 av_freep(&((MXFDescriptor *)*ctx)->mastering);
 av_freep(&((MXFDescriptor *)*ctx)->coll);
-av_freep(&((MXFDescriptor *)*ctx)->sub_descriptors_refs);
+av_freep(&((MXFDescriptor *)*ctx)->file_descriptors_refs);
 break;
 case Sequence:
 av_freep(&((MXFSequence *)*ctx)->structural_components_refs);
@@ -1194,8 +1194,8 @@ static int mxf_read_generic_descriptor(void *arg, 
AVIOContext *pb, int tag, int
 
 switch(tag) {
 case 0x3F01:
-return mxf_read_strong_ref_array(pb, >sub_descriptors_refs,
- 
>sub_descriptors_count);
+return mxf_read_strong_ref_array(pb, 
>file_descriptors_refs,
+ 
>file_descriptors_count);
 case 0x3002: /* ContainerDuration */
 descriptor->duration = avio_rb64(pb);
 break;
@@ -2066,22 +2066,22 @@ static MXFPackage* 
mxf_resolve_source_package(MXFContext *mxf, UID package_ul, U
 
 static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, 
MXFDescriptor *descriptor, int track_id)
 {
-MXFDescriptor *sub_descriptor = NULL;
+MXFDescriptor *file_descriptor = NULL;
 int i;
 
 if (!descriptor)
 return NULL;
 
 if (descriptor->meta.type == MultipleDescriptor) {
-for (i = 0; i < descriptor->sub_descriptors_count; i++) {
-sub_descriptor = mxf_resolve_strong_ref(mxf, 
>sub_descriptors_refs[i], Descriptor);
+for (i = 0; i < descriptor->file_descriptors_count; i++) {
+file_descriptor = mxf_resolve_strong_ref(mxf, 
>file_descriptors_refs[i], Descriptor);
 
-if (!sub_descriptor) {
-av_log(mxf->fc, AV_LOG_ERROR, "could not resolve sub 
descriptor strong ref\n");
+if (!file_descriptor) {
+av_log(mxf->fc, AV_LOG_ERROR, "could not resolve file 
descriptor strong ref\n");
 continue;
 }
-if (sub_descriptor->linked_track_id == track_id) {
-return sub_descriptor;
+if (file_descriptor->linked_track_id == track_id) {
+return file_descriptor;
 }
 }
 } else if (descriptor->meta.type == Descriptor)
-- 
2.33.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] avformat/mxf: support MCA audio information

2021-08-16 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 363 ++-
 2 files changed, 358 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c28549f6a9..49fc6fbec1 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -45,12 +45,14 @@
  */
 
 #include 
+#include 
 
 #include "libavutil/aes.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
@@ -177,6 +179,7 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int* channel_ordering;
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -205,6 +208,8 @@ typedef struct MXFDescriptor {
 unsigned int vert_subsampling;
 UID *file_descriptors_refs;
 int file_descriptors_count;
+UID *sub_descriptors_refs;
+int sub_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -217,6 +222,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionnary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -311,6 +325,10 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_mca_prefix[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +341,59 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionnary_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+// Soundfield Groups
+static const uint8_t mxf_soundfield_group_51[] 
  = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02,0x01,0x00,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_71ds[]   
  = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02,0x02,0x00,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_71sds[]  
  = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02,0x03,0x00,0x00,0x00,0x00 
};
+static const uint8_t 

[FFmpeg-devel] [PATCH 1/2] avformat/mxf: rename sub_descriptors as file_descriptors

2021-08-16 Thread Marc-Antoine Arnaud
---
 libavformat/mxfdec.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 34cbd2cd77..c28549f6a9 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -203,8 +203,8 @@ typedef struct MXFDescriptor {
 unsigned int color_range;
 unsigned int horiz_subsampling;
 unsigned int vert_subsampling;
-UID *sub_descriptors_refs;
-int sub_descriptors_count;
+UID *file_descriptors_refs;
+int file_descriptors_count;
 int linked_track_id;
 uint8_t *extradata;
 int extradata_size;
@@ -342,7 +342,7 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int 
freectx)
 av_freep(&((MXFDescriptor *)*ctx)->extradata);
 av_freep(&((MXFDescriptor *)*ctx)->mastering);
 av_freep(&((MXFDescriptor *)*ctx)->coll);
-av_freep(&((MXFDescriptor *)*ctx)->sub_descriptors_refs);
+av_freep(&((MXFDescriptor *)*ctx)->file_descriptors_refs);
 break;
 case Sequence:
 av_freep(&((MXFSequence *)*ctx)->structural_components_refs);
@@ -1194,8 +1194,8 @@ static int mxf_read_generic_descriptor(void *arg, 
AVIOContext *pb, int tag, int
 
 switch(tag) {
 case 0x3F01:
-return mxf_read_strong_ref_array(pb, >sub_descriptors_refs,
- 
>sub_descriptors_count);
+return mxf_read_strong_ref_array(pb, 
>file_descriptors_refs,
+ 
>file_descriptors_count);
 case 0x3002: /* ContainerDuration */
 descriptor->duration = avio_rb64(pb);
 break;
@@ -2066,22 +2066,22 @@ static MXFPackage* 
mxf_resolve_source_package(MXFContext *mxf, UID package_ul, U
 
 static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, 
MXFDescriptor *descriptor, int track_id)
 {
-MXFDescriptor *sub_descriptor = NULL;
+MXFDescriptor *file_descriptor = NULL;
 int i;
 
 if (!descriptor)
 return NULL;
 
 if (descriptor->meta.type == MultipleDescriptor) {
-for (i = 0; i < descriptor->sub_descriptors_count; i++) {
-sub_descriptor = mxf_resolve_strong_ref(mxf, 
>sub_descriptors_refs[i], Descriptor);
+for (i = 0; i < descriptor->file_descriptors_count; i++) {
+file_descriptor = mxf_resolve_strong_ref(mxf, 
>file_descriptors_refs[i], Descriptor);
 
-if (!sub_descriptor) {
-av_log(mxf->fc, AV_LOG_ERROR, "could not resolve sub 
descriptor strong ref\n");
+if (!file_descriptor) {
+av_log(mxf->fc, AV_LOG_ERROR, "could not resolve file 
descriptor strong ref\n");
 continue;
 }
-if (sub_descriptor->linked_track_id == track_id) {
-return sub_descriptor;
+if (file_descriptor->linked_track_id == track_id) {
+return file_descriptor;
 }
 }
 } else if (descriptor->meta.type == Descriptor)
-- 
2.32.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information

2021-08-12 Thread Marc-Antoine Arnaud
---
 libavformat/mxf.h|   1 +
 libavformat/mxfdec.c | 356 ++-
 2 files changed, 351 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
 TaggedValue,
 TapeDescriptor,
 AVCSubDescriptor,
+MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 34cbd2cd77..544895cd64 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -45,12 +45,14 @@
  */
 
 #include 
+#include 
 
 #include "libavutil/aes.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
@@ -177,6 +179,7 @@ typedef struct {
 int body_sid;
 MXFWrappingScheme wrapping;
 int edit_units_per_packet; /* how many edit units to read at a time (PCM, 
ClipWrapped) */
+int* channel_ordering;
 } MXFTrack;
 
 typedef struct MXFDescriptor {
@@ -217,6 +220,15 @@ typedef struct MXFDescriptor {
 size_t coll_size;
 } MXFDescriptor;
 
+typedef struct MXFMCASubDescriptor {
+MXFMetadataSet meta;
+UID uid;
+UID mca_link_id;
+UID mca_group_link_id;
+UID mca_label_dictionnary_id;
+char *language;
+} MXFMCASubDescriptor;
+
 typedef struct MXFIndexTableSegment {
 MXFMetadataSet meta;
 int edit_unit_byte_count;
@@ -311,6 +323,10 @@ static const uint8_t mxf_system_item_key_cp[]  
= { 0x06,0x0e,0x2b,0x
 static const uint8_t mxf_system_item_key_gc[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 };
 static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
 static const uint8_t mxf_apple_coll_prefix[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 };
+static const uint8_t mxf_mca_prefix[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01 };
+static const uint8_t mxf_audio_channel[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 };
+static const uint8_t mxf_soundfield_group[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 };
+
 /* complete keys to match */
 static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
 static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
@@ -323,6 +339,59 @@ static const uint8_t mxf_indirect_value_utf16be[]  
= { 0x42,0x01,0x10,0x
 static const uint8_t mxf_apple_coll_max_cll[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 
};
 static const uint8_t mxf_apple_coll_max_fall[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 
};
 
+static const uint8_t mxf_mca_label_dictionnary_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_symbol[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_tag_name[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_link_id[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_link_id[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 
};
+static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 
};
+
+// Soundfield Groups
+static const uint8_t mxf_soundfield_group_51[] 
  = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02,0x01,0x00,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_71ds[]   
  = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02,0x02,0x00,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_71sds[]  
  = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02,0x03,0x00,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_61[] 
  = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02,0x04,0x00,0x00,0x00,0x00 
};
+static const uint8_t mxf_soundfield_group_10_monoral[] 
  = { 

Re: [FFmpeg-devel] [PATCH] avfilter/avf_aphasemeter: Add out-of-phase and mono detection

2019-05-09 Thread Marc-Antoine ARNAUD
Few remarks:
- For performances you have to align your data in the structure
AudioPhaseMeterContext: don't mix float, float array and bool. Put bool at
the end to align memory access.
- Use complete name and it's not a setter: set_meta, name it add_metadata.
- use inline functions for these functions: get_index, get_duration,
add_metadata.
- define contant in capitalised: pi becomes PI
- I think get_duration function can be defined as a macro.

Best,
Marc-Antoine



Le jeu. 9 mai 2019 à 10:35, Romane Lafon  a écrit :

> This patch extends aphasemeter filter to display metadata for out-of-phase
> or mono sequences of stereo streams.
> Displays start, end and duration as for silencedetect filter.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] prores_ks: use CodecContext for color information if specified

2018-10-15 Thread Marc-Antoine ARNAUD
Hi Martin,

For my point of view, the AVFrame contains the colorspace for each frame,
which can be different (maybe not volunteer..).
The colorspace in AVCodecContext is the "pre-computed" colorspace, used to
generate the output file, as header/footer of wrappers can require
colorspace informations (like in MXF, MOV, etc.).

So for me, the AVCodecContext is required and needed to be pre-processed to
wrote the header, and no AVFrame are processed at this stage.
The AVFrame colorspace is required to maybe change graph properties in
real-time (like a colorspace conversion can be set to convert the output
from different colorspace inputs).

So both are differents, but on my point of view, regarding comments, I
purpose:
- AVCodecContext will overwrite the output colorspace (if present)
- AVFrame can be use in video encoder to setup frame headers packets (like
in Mpeg2, H.264, H.265, ProRes etc.) if no AVCodecContext is configured.
- a warning needs to be logged if:
- AVCodecContext colorspace don't match to the AVFrame colorspace

Remark: colorspace mean here variables for colorspace, color primaries and
color transfer.

So maybe for that, as Paul mentionned, it may require to patch that at an
upper level than encoder to be sure all works similary. But I don't know
where to be honest.

Marc-Antoine

Le sam. 13 oct. 2018 à 14:03, Martin Vignali  a
écrit :

> Le mer. 10 oct. 2018 à 17:13, Marc-Antoine ARNAUD <
> arnaud.marcanto...@gmail.com> a écrit :
>
> > I have updated the patch with our discussion.
> > It took information only from the codec context.
> >
> > Marc-Antoine
> >
> > Hello,
>
> If i correctly understand (which is not sure :-) :
>
> the colorspace for AVCodecContext, is when all frame use the same
> colorspace
>
> The colorspace in AVFrame, manage the case where colorspace can not be the
> same inside each frame.
> and this info is use inside filtering graph.
>
> If this is correct, then prores encoder need to use AVFrame colorspace for
> each frame
> and if the colorspace information is wrong, or if user need to set another
> one, a filter need to be use to edit the frame (set colorspace information
> or convert from one colorspace to another frame by frame)
> (Or if just the colorspace metadata inside the compress prores frame need
> to be fix,  a bsf can be write to edit frame colorspace properties for
> prores frame)
>
> Another way can be to add an option to the prores encoder, to take
> colorspace information from CodecContext or from Frame.
>
>
> But if other people think your way is better,
> i will change my patch for prores_aw, in order to use the same way to set
> colorspace for each prores frame.
>
> P.S. : Seems like png at least also use AVFrame information instead of
> AVCodecContext
>
> Martin
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] prores_ks: use CodecContext for color information if specified

2018-10-10 Thread Marc-Antoine ARNAUD
I have updated the patch with our discussion.
It took information only from the codec context.

Marc-Antoine

Le mer. 10 oct. 2018 à 11:36, Paul B Mahol  a écrit :

> On 10/10/18, Marc-Antoine ARNAUD  wrote:
> > For me it's the only codec who use picture colorspace as source.
> > All others uses only the CodecContext.
> > I don't know the exact reason, but I suppose it can be easiest to manage
> > output colorspace during merge of video, as a video can have only one
> > "static" video colorspace.
> >
> > So for me it made sense to keep that patch. Maybe with removing the
> `else`
> > to don't take colorspace from pictures as other codecs can do.
>
> That seems reasonable. What other people think?
>
> >
> > Marc-Antoine
> >
> > Le ven. 5 oct. 2018 `a 10:15, Paul B Mahol  a ecrit :
> >
> >> On 10/5/18, Marc-Antoine ARNAUD  wrote:
> >> > In our case we have some files with bad colorspaces (in HD but with
> >> > bt601
> >> > colorspace).
> >> > So we use -colorspace, -color_trc, -color_primaries to force the
> output
> >> > colorspace.
> >> >
> >> > We keep compatibility with "old command line", we get source
> colorspace
> >> if
> >> > nothing is mentionned.
> >> > It work like that for Mpeg2video codec, so we expect to have the same
> >> here.
> >>
> >> Correct patch should be one that changes frame properties, otherwise
> >> every encoder that uses these properties needs to be updated with extra
> >> lines to maintain.
> >>
> >> >
> >> > Marc-Antoine
> >> >
> >> >
> >> > Le jeu. 4 oct. 2018 `a 18:36, Paul B Mahol  a
> ecrit :
> >> >
> >> >> On 10/4/18, Marc-Antoine ARNAUD 
> wrote:
> >> >> >
> >> >> >
> >> >>
> >> >> Why?
> >> >>
> >> >> IIRC this patch is not needed.
> >> >> ___
> >> >> ffmpeg-devel mailing list
> >> >> ffmpeg-devel@ffmpeg.org
> >> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >> >>
> >> > ___
> >> > ffmpeg-devel mailing list
> >> > ffmpeg-devel@ffmpeg.org
> >> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >> >
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>
> >
> >
> > --
> > *Marc-Antoine*
> > |e:arnaud.marcanto...@gmail.com
> > |tel: 06-84-71-84-45 <06%2084%2071%2084%2045>
> > | ohloh: http://bit.ly/1iwtlsU
> > [image: LinkedIn]
> > <
> http://s.wisestamp.com/links?url=https%3A%2F%2Fwww.linkedin.com%2Fpub%2Fmarc-antoine-arnaud%2Fb%2F7b8%2F2a3=YXJuYXVkLm1hcmNhbnRvaW5lQGdtYWlsLmNvbQ%3D%3D
> >
> > [image:
> > Google Plus]
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


0001-prores_ks-use-CodecContext-for-color-information.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avcodec/prores aw improvment

2018-10-10 Thread Marc-Antoine ARNAUD
Great patches ;-)
I have submit a patch too, regarding colospace in prores:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-October/235034.html
You have also in your patch 2, the same purpose (take colorspace from
picture), do you have any objection to take it from the CodecContext as it
works like that in others codecs ?

Thanks,

Le lun. 8 oct. 2018 à 20:32, Carl Eugen Hoyos  a écrit :

> 2018-10-08 16:12 GMT+02:00, Martin Vignali :
>
> > Resend previous patch (from July)
>
> I didn't test but the patchset looks very useful to me, thank you!
>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


-- 
*Marc-Antoine*
|e:arnaud.marcanto...@gmail.com
|tel: 06-84-71-84-45
| ohloh: http://bit.ly/1iwtlsU
[image: LinkedIn]

[image:
Google Plus]
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] prores_ks: use CodecContext for color information if specified

2018-10-10 Thread Marc-Antoine ARNAUD
For me it's the only codec who use picture colorspace as source.
All others uses only the CodecContext.
I don't know the exact reason, but I suppose it can be easiest to manage
output colorspace during merge of video, as a video can have only one
"static" video colorspace.

So for me it made sense to keep that patch. Maybe with removing the `else`
to don't take colorspace from pictures as other codecs can do.

Marc-Antoine

Le ven. 5 oct. 2018 à 10:15, Paul B Mahol  a écrit :

> On 10/5/18, Marc-Antoine ARNAUD  wrote:
> > In our case we have some files with bad colorspaces (in HD but with bt601
> > colorspace).
> > So we use -colorspace, -color_trc, -color_primaries to force the output
> > colorspace.
> >
> > We keep compatibility with "old command line", we get source colorspace
> if
> > nothing is mentionned.
> > It work like that for Mpeg2video codec, so we expect to have the same
> here.
>
> Correct patch should be one that changes frame properties, otherwise
> every encoder that uses these properties needs to be updated with extra
> lines to maintain.
>
> >
> > Marc-Antoine
> >
> >
> > Le jeu. 4 oct. 2018 `a 18:36, Paul B Mahol  a ecrit :
> >
> >> On 10/4/18, Marc-Antoine ARNAUD  wrote:
> >> >
> >> >
> >>
> >> Why?
> >>
> >> IIRC this patch is not needed.
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


-- 
*Marc-Antoine*
|e:arnaud.marcanto...@gmail.com
|tel: 06-84-71-84-45
| ohloh: http://bit.ly/1iwtlsU
[image: LinkedIn]
<http://s.wisestamp.com/links?url=https%3A%2F%2Fwww.linkedin.com%2Fpub%2Fmarc-antoine-arnaud%2Fb%2F7b8%2F2a3=YXJuYXVkLm1hcmNhbnRvaW5lQGdtYWlsLmNvbQ%3D%3D>
[image:
Google Plus]
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] prores_ks: use CodecContext for color information if specified

2018-10-05 Thread Marc-Antoine ARNAUD
In our case we have some files with bad colorspaces (in HD but with bt601
colorspace).
So we use -colorspace, -color_trc, -color_primaries to force the output
colorspace.

We keep compatibility with "old command line", we get source colorspace if
nothing is mentionned.
It work like that for Mpeg2video codec, so we expect to have the same here.

Marc-Antoine


Le jeu. 4 oct. 2018 à 18:36, Paul B Mahol  a écrit :

> On 10/4/18, Marc-Antoine ARNAUD  wrote:
> >
> >
>
> Why?
>
> IIRC this patch is not needed.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] prores_ks: use CodecContext for color information if specified

2018-10-04 Thread Marc-Antoine ARNAUD



0001-prores_ks-use-CodecContext-for-color-information-if-.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2018-01-03 Thread Marc-Antoine ARNAUD
Sorry, I have upgrade and re-generate patches.


Le mer. 3 janv. 2018 à 23:47, Moritz Barsnick <barsn...@gmx.net> a écrit :

> On Wed, Jan 03, 2018 at 12:51:06 +0000, Marc-Antoine ARNAUD wrote:
> >  Changelog   |   10 +
> >  MAINTAINERS |9 +-
> >  Makefile|9 +-
> >  compat/cuda/dynlink_loader.h|   18 +-
> >  compat/nvenc/nvEncodeAPI.h  |2 +-
> >  compat/tms470/math.h|   30 -
> >  compat/w32dlfcn.h   |1 +
> >  compat/windows/makedef  |   41 +-
> >  configure   |  649 ++-
> >  doc/APIchanges  |3 +
> >  doc/codecs.texi |8 -
> >  doc/encoders.texi   |2 +
> >  doc/ffmpeg.texi |4 +-
> >  doc/filters.texi|   73 +-
> >  doc/general.texi|5 +
> >  doc/indevs.texi |2 +
> >  doc/libav-merge.txt |1 +
> >  doc/muxers.texi |   72 +-
> >  doc/protocols.texi  |9 +
> >  ffbuild/common.mak  |3 +-
> >  ffbuild/library.mak |   14 +-
> >  fftools/cmdutils.h  |1 +
> >  fftools/ffmpeg.c|   56 +-
> >  fftools/ffmpeg.h|1 +
> >  fftools/ffmpeg_filter.c |1 +
> >  fftools/ffmpeg_opt.c|   27 +-
> >  fftools/ffplay.c|  102 +-
> >  fftools/ffprobe.c   |2 +-
> >  libavcodec/Makefile |   24 +-
> >  libavcodec/aacdec_fixed.c   |2 +-
> >  libavcodec/aacenc.c |   87 +-
> >  libavcodec/aacenc.h |  286 +-
> >  libavcodec/aacenctab.h  |   13 +-
> >  libavcodec/aacpsdsp_template.c  |8 +-
> >  libavcodec/aacsbr_fixed.c   |1 +
> >  libavcodec/aarch64/mpegaudiodsp_neon.S  |4 +-
> >  libavcodec/ac3tab.h |3 +-
>
> No, this looks totally wrong. You didn't provide a patch of your
> commit, but a diff against a very much old version of the tree.
>
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


0002-avfilter-slice-processing-for-geq.patch
Description: Binary data


0003-avfilter-rename-variables-in-geq.patch
Description: Binary data


0001-avfilter-reorder-variable-definition-in-geq.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-30 Thread Marc-Antoine ARNAUD
Le jeu. 30 nov. 2017 à 01:51, Michael Niedermayer <mich...@niedermayer.cc>
a écrit :

> On Wed, Nov 29, 2017 at 11:28:40AM +0000, Marc-Antoine ARNAUD wrote:
> > Le mer. 22 nov. 2017 à 17:54, Michael Niedermayer <mich...@niedermayer.cc
> >
> > a écrit :
> >
> > > On Wed, Nov 22, 2017 at 10:24:30AM +, Marc-Antoine ARNAUD wrote:
> > > > New patch version which fixe the last remark.
> > > >
> > > >
> > > > Le ven. 10 nov. 2017 à 00:47, Michael Niedermayer
> <mich...@niedermayer.cc
> > > >
> > > > a écrit :
> > > >
> > > > > On Thu, Nov 09, 2017 at 10:22:23AM +, Marc-Antoine ARNAUD
> wrote:
> > > > > > Please find the merged patch in attachement.
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > > Le mer. 8 nov. 2017 à 17:12, Paul B Mahol <one...@gmail.com> a
> > > écrit :
> > > > > >
> > > > > > > On 11/8/17, Marc-Antoine ARNAUD <arnaud.marcanto...@gmail.com>
> > > wrote:
> > > > > > > > This patch will fix the stride issue.
> > > > > > > > Is it valid for you ?
> > > > > > > >
> > > > > > > > Does it required to merge these 2 patches ? (and remove
> base64
> > > > > encoding
> > > > > > > on
> > > > > > > > the first one)
> > > > > > >
> > > > > > > Please merge those two patches, base64 encoding should not be
> > > needed
> > > > > > > (it helps to faster review patches if they are not encoded).
> > > > > > > _______
> > > > > > > ffmpeg-devel mailing list
> > > > > > > ffmpeg-devel@ffmpeg.org
> > > > > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > > > > >
> > > > >
> > > > > >  vf_geq.c |  124
> > > > > +--
> > > > > >  1 file changed, 90 insertions(+), 34 deletions(-)
> > > > > > b41a90fffb5ddef553661007a38659c602f7ce56
> > > > > 0001-avfilter-slice-processing-for-geq.patch
> > > > > > From ac2a6322fa96835e02a24c31f014fb360e26561f Mon Sep 17 00:00:00
> > > 2001
> > > > > > From: Marc-Antoine Arnaud <arnaud.marcanto...@gmail.com>
> > > > > > Date: Thu, 9 Nov 2017 11:19:43 +0100
> > > > > > Subject: [PATCH] avfilter: slice processing for geq
> > > > > > Content-Type: text/x-patch; charset="utf-8"
> > > > >
> > > > > crashes:
> > > > > ./ffmpeg_g -f lavfi -i
> > > > >
> > >
> 'nullsrc=s=200x200,format=yuv444p16,geq=X*Y/10:sin(X/10)*255:cos(Y/10)*255'
> > > > > -vframes 5 -y blah.avi
> > > > >
> > > > > ==24616== Thread 7:
> > > > > ==24616== Invalid write of size 2
> > > > > ==24616==at 0x4F3AAF: slice_geq_filter (vf_geq.c:289)
> > > > > ==24616==by 0x48E4C9: worker_func (pthread.c:50)
> > > > > ==24616==by 0x11DB932: run_jobs (slicethread.c:61)
> > > > > ==24616==by 0x11DBA04: thread_worker (slicethread.c:85)
> > > > > ==24616==by 0xC45D183: start_thread (pthread_create.c:312)
> > > > > ==24616==by 0xC770FFC: clone (clone.S:111)
> > > > > ==24616==  Address 0x1177143e is 93,214 bytes inside a block of
> size
> > > > > 93,215 alloc'd
> > > > > ==24616==at 0x4C2A6C5: memalign (vg_replace_malloc.c:727)
> > > > > ==24616==by 0x4C2A760: posix_memalign (vg_replace_malloc.c:876)
> > > > > ==24616==by 0x11B0C43: av_malloc (mem.c:87)
> > > > > ==24616==by 0x11987CC: av_buffer_alloc (buffer.c:72)
> > > > > ==24616==by 0x1198831: av_buffer_allocz (buffer.c:85)
> > > > > ==24616==by 0x1198F29: pool_alloc_buffer (buffer.c:312)
> > > > > ==24616==by 0x1199057: av_buffer_pool_get (buffer.c:349)
> > > > > ==24616==by 0x489D6D: ff_frame_pool_get (framepool.c:222)
> > > > > ==24616==by 0x58F6EB: ff_default_get_video_buffer (video.c:89)
> > > > > ==24616==by 0x58F768: ff_get_video_buffer (video.c:102)
> > > > > ==24616==by 0x4F3BF3: geq_filter_frame (vf_geq.c:312)
&

Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-29 Thread Marc-Antoine ARNAUD
Le mer. 22 nov. 2017 à 17:54, Michael Niedermayer <mich...@niedermayer.cc>
a écrit :

> On Wed, Nov 22, 2017 at 10:24:30AM +0000, Marc-Antoine ARNAUD wrote:
> > New patch version which fixe the last remark.
> >
> >
> > Le ven. 10 nov. 2017 à 00:47, Michael Niedermayer <mich...@niedermayer.cc
> >
> > a écrit :
> >
> > > On Thu, Nov 09, 2017 at 10:22:23AM +, Marc-Antoine ARNAUD wrote:
> > > > Please find the merged patch in attachement.
> > > >
> > > > Thanks
> > > >
> > > > Le mer. 8 nov. 2017 à 17:12, Paul B Mahol <one...@gmail.com> a
> écrit :
> > > >
> > > > > On 11/8/17, Marc-Antoine ARNAUD <arnaud.marcanto...@gmail.com>
> wrote:
> > > > > > This patch will fix the stride issue.
> > > > > > Is it valid for you ?
> > > > > >
> > > > > > Does it required to merge these 2 patches ? (and remove base64
> > > encoding
> > > > > on
> > > > > > the first one)
> > > > >
> > > > > Please merge those two patches, base64 encoding should not be
> needed
> > > > > (it helps to faster review patches if they are not encoded).
> > > > > ___
> > > > > ffmpeg-devel mailing list
> > > > > ffmpeg-devel@ffmpeg.org
> > > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > > >
> > >
> > > >  vf_geq.c |  124
> > > +--
> > > >  1 file changed, 90 insertions(+), 34 deletions(-)
> > > > b41a90fffb5ddef553661007a38659c602f7ce56
> > > 0001-avfilter-slice-processing-for-geq.patch
> > > > From ac2a6322fa96835e02a24c31f014fb360e26561f Mon Sep 17 00:00:00
> 2001
> > > > From: Marc-Antoine Arnaud <arnaud.marcanto...@gmail.com>
> > > > Date: Thu, 9 Nov 2017 11:19:43 +0100
> > > > Subject: [PATCH] avfilter: slice processing for geq
> > > > Content-Type: text/x-patch; charset="utf-8"
> > >
> > > crashes:
> > > ./ffmpeg_g -f lavfi -i
> > >
> 'nullsrc=s=200x200,format=yuv444p16,geq=X*Y/10:sin(X/10)*255:cos(Y/10)*255'
> > > -vframes 5 -y blah.avi
> > >
> > > ==24616== Thread 7:
> > > ==24616== Invalid write of size 2
> > > ==24616==at 0x4F3AAF: slice_geq_filter (vf_geq.c:289)
> > > ==24616==by 0x48E4C9: worker_func (pthread.c:50)
> > > ==24616==by 0x11DB932: run_jobs (slicethread.c:61)
> > > ==24616==by 0x11DBA04: thread_worker (slicethread.c:85)
> > > ==24616==by 0xC45D183: start_thread (pthread_create.c:312)
> > > ==24616==by 0xC770FFC: clone (clone.S:111)
> > > ==24616==  Address 0x1177143e is 93,214 bytes inside a block of size
> > > 93,215 alloc'd
> > > ==24616==at 0x4C2A6C5: memalign (vg_replace_malloc.c:727)
> > > ==24616==by 0x4C2A760: posix_memalign (vg_replace_malloc.c:876)
> > > ==24616==by 0x11B0C43: av_malloc (mem.c:87)
> > > ==24616==by 0x11987CC: av_buffer_alloc (buffer.c:72)
> > > ==24616==by 0x1198831: av_buffer_allocz (buffer.c:85)
> > > ==24616==by 0x1198F29: pool_alloc_buffer (buffer.c:312)
> > > ==24616==by 0x1199057: av_buffer_pool_get (buffer.c:349)
> > > ==24616==by 0x489D6D: ff_frame_pool_get (framepool.c:222)
> > > ==24616==by 0x58F6EB: ff_default_get_video_buffer (video.c:89)
> > > ==24616==by 0x58F768: ff_get_video_buffer (video.c:102)
> > > ==24616==by 0x4F3BF3: geq_filter_frame (vf_geq.c:312)
> > > ==24616==by 0x472FD0: ff_filter_frame_framed (avfilter.c:1104)
> > > ==24616==by 0x473800: ff_filter_frame_to_filter (avfilter.c:1252)
> > > ==24616==by 0x4739F8: ff_filter_activate_default (avfilter.c:1301)
> > > ==24616==by 0x473C12: ff_filter_activate (avfilter.c:1462)
> > > ==24616==by 0x478A4F: ff_filter_graph_run_once
> (avfiltergraph.c:1456)
> > > ==24616==by 0x478C72: get_frame_internal (buffersink.c:110)
> > > ==24616==by 0x478CCF: av_buffersink_get_frame_flags
> (buffersink.c:121)
> > > ==24616==by 0x441808: lavfi_read_packet (lavfi.c:410)
> > > ==24616==by 0x7AC315: ff_read_packet (utils.c:822)
> > > ==24616==
> > > --24616-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11
> (SIGSEGV)
> > > - exiting
> > > --24616-- si_code=80;  Faulting address: 0x0;  sp: 0x40a075db0
> > >
>

Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-22 Thread Marc-Antoine ARNAUD
It made sense, but this commit don't touch this part of the code.
It can made more sense to add an another path to "prevent bad memory
allocation in geq filter". What do you think ?

Regards,

Le mer. 22 nov. 2017 à 15:19, Derek Buitenhuis <derek.buitenh...@gmail.com>
a écrit :

> On 11/22/2017 10:24 AM, Marc-Antoine ARNAUD wrote:
> > New patch version which fixe the last remark.
>
> [...]
>
> > +char depth_string[8];
> > +snprintf(depth_string, sizeof(depth_string), "%d",
> (1<depth) - 1);
> > +geq->expr_str[A] = av_strdup(depth_string);
>
> Missing return value check for av_strdup.
>
> - Derek
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-22 Thread Marc-Antoine ARNAUD
New patch version which fixe the last remark.


Le ven. 10 nov. 2017 à 00:47, Michael Niedermayer <mich...@niedermayer.cc>
a écrit :

> On Thu, Nov 09, 2017 at 10:22:23AM +0000, Marc-Antoine ARNAUD wrote:
> > Please find the merged patch in attachement.
> >
> > Thanks
> >
> > Le mer. 8 nov. 2017 à 17:12, Paul B Mahol <one...@gmail.com> a écrit :
> >
> > > On 11/8/17, Marc-Antoine ARNAUD <arnaud.marcanto...@gmail.com> wrote:
> > > > This patch will fix the stride issue.
> > > > Is it valid for you ?
> > > >
> > > > Does it required to merge these 2 patches ? (and remove base64
> encoding
> > > on
> > > > the first one)
> > >
> > > Please merge those two patches, base64 encoding should not be needed
> > > (it helps to faster review patches if they are not encoded).
> > > ___
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
>
> >  vf_geq.c |  124
> +--
> >  1 file changed, 90 insertions(+), 34 deletions(-)
> > b41a90fffb5ddef553661007a38659c602f7ce56
> 0001-avfilter-slice-processing-for-geq.patch
> > From ac2a6322fa96835e02a24c31f014fb360e26561f Mon Sep 17 00:00:00 2001
> > From: Marc-Antoine Arnaud <arnaud.marcanto...@gmail.com>
> > Date: Thu, 9 Nov 2017 11:19:43 +0100
> > Subject: [PATCH] avfilter: slice processing for geq
> > Content-Type: text/x-patch; charset="utf-8"
>
> crashes:
> ./ffmpeg_g -f lavfi -i
> 'nullsrc=s=200x200,format=yuv444p16,geq=X*Y/10:sin(X/10)*255:cos(Y/10)*255'
> -vframes 5 -y blah.avi
>
> ==24616== Thread 7:
> ==24616== Invalid write of size 2
> ==24616==at 0x4F3AAF: slice_geq_filter (vf_geq.c:289)
> ==24616==by 0x48E4C9: worker_func (pthread.c:50)
> ==24616==by 0x11DB932: run_jobs (slicethread.c:61)
> ==24616==by 0x11DBA04: thread_worker (slicethread.c:85)
> ==24616==by 0xC45D183: start_thread (pthread_create.c:312)
> ==24616==by 0xC770FFC: clone (clone.S:111)
> ==24616==  Address 0x1177143e is 93,214 bytes inside a block of size
> 93,215 alloc'd
> ==24616==at 0x4C2A6C5: memalign (vg_replace_malloc.c:727)
> ==24616==by 0x4C2A760: posix_memalign (vg_replace_malloc.c:876)
> ==24616==by 0x11B0C43: av_malloc (mem.c:87)
> ==24616==by 0x11987CC: av_buffer_alloc (buffer.c:72)
> ==24616==by 0x1198831: av_buffer_allocz (buffer.c:85)
> ==24616==by 0x1198F29: pool_alloc_buffer (buffer.c:312)
> ==24616==by 0x1199057: av_buffer_pool_get (buffer.c:349)
> ==24616==by 0x489D6D: ff_frame_pool_get (framepool.c:222)
> ==24616==by 0x58F6EB: ff_default_get_video_buffer (video.c:89)
> ==24616==by 0x58F768: ff_get_video_buffer (video.c:102)
> ==24616==by 0x4F3BF3: geq_filter_frame (vf_geq.c:312)
> ==24616==by 0x472FD0: ff_filter_frame_framed (avfilter.c:1104)
> ==24616==by 0x473800: ff_filter_frame_to_filter (avfilter.c:1252)
> ==24616==by 0x4739F8: ff_filter_activate_default (avfilter.c:1301)
> ==24616==by 0x473C12: ff_filter_activate (avfilter.c:1462)
> ==24616==by 0x478A4F: ff_filter_graph_run_once (avfiltergraph.c:1456)
> ==24616==by 0x478C72: get_frame_internal (buffersink.c:110)
> ==24616==by 0x478CCF: av_buffersink_get_frame_flags (buffersink.c:121)
> ==24616==by 0x441808: lavfi_read_packet (lavfi.c:410)
> ==24616==by 0x7AC315: ff_read_packet (utils.c:822)
> ==24616==
> --24616-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV)
> - exiting
> --24616-- si_code=80;  Faulting address: 0x0;  sp: 0x40a075db0
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> While the State exists there can be no freedom; when there is freedom there
> will be no State. -- Vladimir Lenin
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


0001-avfilter-slice-processing-for-geq.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-09 Thread Marc-Antoine ARNAUD
Please find the merged patch in attachement.

Thanks

Le mer. 8 nov. 2017 à 17:12, Paul B Mahol <one...@gmail.com> a écrit :

> On 11/8/17, Marc-Antoine ARNAUD <arnaud.marcanto...@gmail.com> wrote:
> > This patch will fix the stride issue.
> > Is it valid for you ?
> >
> > Does it required to merge these 2 patches ? (and remove base64 encoding
> on
> > the first one)
>
> Please merge those two patches, base64 encoding should not be needed
> (it helps to faster review patches if they are not encoded).
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


0001-avfilter-slice-processing-for-geq.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-08 Thread Marc-Antoine ARNAUD
This patch will fix the stride issue.
Is it valid for you ?

Does it required to merge these 2 patches ? (and remove base64 encoding on
the first one)

Thx
Marc-Antoine

Le ven. 3 nov. 2017 à 03:13, Michael Niedermayer <mich...@niedermayer.cc> a
écrit :

> On Thu, Nov 02, 2017 at 02:04:33PM +0000, Marc-Antoine ARNAUD wrote:
> >
>
> >  vf_geq.c |  126
> ---
> >  1 file changed, 89 insertions(+), 37 deletions(-)
> > b0379f3d7f1d9660e209fe491f48fd7f70113615
> 0001-avfilter-slice-processing-for-geq.patch
> > From c4bdf956e7f8b91b03f16bdf80b30058a117aae2 Mon Sep 17 00:00:00 2001
> > From: Marc-Antoine Arnaud <arnaud.marcanto...@gmail.com>
> > Date: Thu, 2 Nov 2017 12:25:46 +0100
> > Subject: [PATCH] avfilter: slice processing for geq
>
> > Content-Type: text/x-patch; charset="utf-8"
> > Content-Transfer-Encoding: base64
>
> hmm
>
>
> >
> > ---
> >  libavfilter/vf_geq.c | 126
> ---
> >  1 file changed, 89 insertions(+), 37 deletions(-)
>
> breaks:
> ./ffplay  matrixbench_mpeg2.mpg  -vf 'geq=b=b(X\,Y)-r(X\,Y)'
>
> looks like possibly something related to strides
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Its not that you shouldnt use gotos but rather that you should write
> readable code and code with gotos often but not always is less readable
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


0001-avfilter-fix-stride-for-g_eq.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter: slice processing for geq

2017-11-02 Thread Marc-Antoine ARNAUD



0001-avfilter-slice-processing-for-geq.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] set bitrate from rc_max_rate for duration estimation will fix ticket #3678

2014-08-21 Thread Marc-Antoine ARNAUD
I have analysed a little more of code, and in fact the duration was not
present in the MXF.
It's for this reason who we pass in the estimation based on the bitrate.
You can see here the selection of the method:
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/utils.c#L2458

About the max bitrate, I agreed how it can't work every time but in major
cases it can be ok because we target the max_bitrate value during the
encoding.


can I send a patch with these modifactions:

if (st-codec-bit_rate  0) {
if (INT_MAX - st-codec-bit_rate  bit_rate) {
bit_rate = 0;
break;
}
bit_rate += st-codec-bit_rate;
}
*else *if (st-codec-rc_max_rate  0) {
   if (INT_MAX - st-codec-rc_max_rate  bit_rate) {
 bit_rate = 0;
 break;
   }
   bit_rate += st-codec-rc_max_rate;
   *show_warning = 1;*
}

It can increase the bitrate, but also display the warning message.
This solution can display the minimum duration of the stream.

-- 
  *Marc-Antoine*
 | e: arnaud.marcanto...@gmail.com
| tel: 06-84-71-84-45
| ohloh: http://bit.ly/1iwtlsU
  [image: LinkedIn]
http://s.wisestamp.com/links?url=https%3A%2F%2Fwww.linkedin.com%2Fpub%2Fmarc-antoine-arnaud%2Fb%2F7b8%2F2a3sn=YXJuYXVkLm1hcmNhbnRvaW5lQGdtYWlsLmNvbQ%3D%3D
[image:
Google Plus]
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] set bitrate from rc_max_rate for duration estimation will fix ticket #3678

2014-08-20 Thread Marc-Antoine ARNAUD
Hi Carl,

Yes I test with the attached file.
The case is when the input video stream is in Mpeg2, the bitrate of the
stream was setup in rc_max_rate, not in bitrate
[https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/mpeg12dec.c#L1284].

For the remark you mean I can add an else if (st-codec-rc_max_rate  0)
{ ?
I'm agree with that, it was better.

I don't know also if I need to set the show_warning to true, because it can
be a longer duration if the real bitrate was not exactly equal to the
rc_max_rate.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] set bitrate from rc_max_rate for duration estimation will fix ticket #3678

2014-08-20 Thread Marc-Antoine ARNAUD
Hi Michael,


I agreed how we can take the information in the wrapper if it's present. In
MXF case it can be done. But in other formats, this information is not
necessary present ...
The other possibility is to set the duration to -1 to disable print when we
can't known exactly the duration.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel