[FFmpeg-devel] [PATCH 2/2] avformat/mxfenc: Add use_itu601_color_siting option

Michael Niedermayer michaelni at gmx.at
Fri May 22 14:27:36 CEST 2015


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 doc/muxers.texi      |   12 ++++++++++++
 libavformat/mxfenc.c |   12 ++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index ddd7c7a..174164a 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -770,6 +770,18 @@ ffmpeg -i file.mpg -c copy \
      -y out.ts
 @end example
 
+ at section mxf, mxf_opatom, mxf_d10
+
+MXF muxer.
+
+ at subsection Options
+
+ at table @option
+ at item -use_itu601_color_siting @var{0/1}
+Forces the deprecated ITU 601 color siting value to be used for streams that
+otherwise would use co siting.
+ at end table
+
 @section null
 
 Null muxer.
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 644ca56..0b820c1 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -317,6 +317,7 @@ typedef struct MXFContext {
     int channel_count;
     uint32_t tagged_value_count;
     AVRational audio_edit_rate;
+    int use_itu601_color_siting;
 } MXFContext;
 
 static const uint8_t uuid_base[]            = { 0xAD,0xAB,0x44,0x24,0x2f,0x25,0x4d,0xc7,0x92,0xff,0x29,0xbd };
@@ -2056,6 +2057,10 @@ static int mxf_write_header(AVFormatContext *s)
             case AVCHROMA_LOC_CENTER:  sc->color_siting = 3; break;
             }
 
+            if (sc->color_siting == 0 && mxf->use_itu601_color_siting>0) {
+                sc->color_siting = 4;
+            }
+
             mxf->timecode_base = (tbc.den + tbc.num/2) / tbc.num;
             spf = ff_mxf_get_samples_per_frame(s, tbc);
             if (!spf) {
@@ -2615,7 +2620,12 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int
                                mxf_interleave_get_packet, mxf_compare_timestamps);
 }
 
+#define COMMON_OPTIONS \
+    { "use_itu601_color_siting", "Force deprecated itu601 color siting", \
+      offsetof(MXFContext, use_itu601_color_siting), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, AV_OPT_FLAG_ENCODING_PARAM} \
+
 static const AVOption mxf_options[] = {
+    COMMON_OPTIONS,
     { NULL },
 };
 
@@ -2627,6 +2637,7 @@ static const AVClass mxf_muxer_class = {
 };
 
 static const AVOption d10_options[] = {
+    COMMON_OPTIONS,
     { "d10_channelcount", "Force/set channelcount in generic sound essence descriptor",
       offsetof(MXFContext, channel_count), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 8, AV_OPT_FLAG_ENCODING_PARAM},
     { NULL },
@@ -2640,6 +2651,7 @@ static const AVClass mxf_d10_muxer_class = {
 };
 
 static const AVOption opatom_options[] = {
+    COMMON_OPTIONS,
     { "mxf_audio_edit_rate", "Audio edit rate for timecode",
         offsetof(MXFContext, audio_edit_rate), AV_OPT_TYPE_RATIONAL, {.dbl=25}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
     { NULL },
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list