[FFmpeg-devel] [PATCH] avcodec/cbs_misc: remove anonymous union for gcc4.4 compat

Aman Gupta ffmpeg at tmm1.net
Sat Sep 14 01:48:09 EEST 2019


From: Aman Gupta <aman at tmm1.net>

Signed-off-by: Aman Gupta <aman at tmm1.net>
---
 libavcodec/cbs_misc.c                 | 14 +++++++-------
 libavcodec/cbs_misc.h                 |  4 ++--
 libavcodec/cbs_misc_syntax_template.c |  8 ++++----
 libavcodec/h264_metadata_bsf.c        |  4 ++--
 libavcodec/mpeg2_metadata_bsf.c       |  2 +-
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavcodec/cbs_misc.c b/libavcodec/cbs_misc.c
index d0ced562f5..09324949f6 100644
--- a/libavcodec/cbs_misc.c
+++ b/libavcodec/cbs_misc.c
@@ -150,10 +150,10 @@ int ff_cbs_read_a53_cc_side_data(CodedBitstreamContext *ctx,
     *data = (A53UserData) {
         .user_identifier = A53_USER_IDENTIFIER_ATSC,
 
-        .atsc = {
+        .u = { .atsc = {
             .user_data_type_code = A53_USER_DATA_TYPE_CODE_CC_DATA,
 
-            .cc_data = {
+            .u = { .cc_data = {
                 .process_em_data_flag = 0,
                 .process_cc_data_flag = 1,
                 .additional_data_flag = 0,
@@ -161,10 +161,10 @@ int ff_cbs_read_a53_cc_side_data(CodedBitstreamContext *ctx,
                 .em_data = 0,
 
                 .cc_count = cc_count,
-            },
-        },
+            } },
+        } },
     };
-    cc = &data->atsc.cc_data;
+    cc = &data->u.atsc.u.cc_data;
 
     err = init_get_bits(&gbc, side_data, 8 * side_data_size);
     if (err < 0)
@@ -190,10 +190,10 @@ int ff_cbs_write_a53_cc_side_data(CodedBitstreamContext *ctx,
     int err, i;
 
     if (data->user_identifier != A53_USER_IDENTIFIER_ATSC ||
-        data->atsc.user_data_type_code != A53_USER_DATA_TYPE_CODE_CC_DATA)
+        data->u.atsc.user_data_type_code != A53_USER_DATA_TYPE_CODE_CC_DATA)
         return AVERROR(EINVAL);
 
-    cc = &data->atsc.cc_data;
+    cc = &data->u.atsc.u.cc_data;
 
     err = av_reallocp(side_data, *side_data_size + 3 * cc->cc_count);
     if (err < 0)
diff --git a/libavcodec/cbs_misc.h b/libavcodec/cbs_misc.h
index 0d7ab2c8e7..b434ab86cc 100644
--- a/libavcodec/cbs_misc.h
+++ b/libavcodec/cbs_misc.h
@@ -70,7 +70,7 @@ typedef struct A53ATSCUserData {
     union {
         CEA708CCData cc_data;
         A53BarData bar_data;
-    };
+    } u;
 } A53ATSCUserData;
 
 typedef struct A53AFDData {
@@ -83,7 +83,7 @@ typedef struct A53UserData {
     union {
         A53ATSCUserData atsc;
         A53AFDData afd;
-    };
+    } u;
 } A53UserData;
 
 
diff --git a/libavcodec/cbs_misc_syntax_template.c b/libavcodec/cbs_misc_syntax_template.c
index 7b98c7cc85..60ece42aef 100644
--- a/libavcodec/cbs_misc_syntax_template.c
+++ b/libavcodec/cbs_misc_syntax_template.c
@@ -99,9 +99,9 @@ static int FUNC(a53_atsc_user_data)(CodedBitstreamContext *ctx, RWContext *rw,
 
     switch (current->user_data_type_code) {
     case A53_USER_DATA_TYPE_CODE_CC_DATA:
-        return FUNC(cea708_cc_data)(ctx, rw, &current->cc_data);
+        return FUNC(cea708_cc_data)(ctx, rw, &current->u.cc_data);
     case A53_USER_DATA_TYPE_CODE_BAR_DATA:
-        return FUNC(a53_bar_data)(ctx, rw, &current->bar_data);
+        return FUNC(a53_bar_data)(ctx, rw, &current->u.bar_data);
     default:
         av_log(ctx->log_ctx, AV_LOG_WARNING,
                "Unknown ATSC user data found: type code %#02x.\n",
@@ -137,9 +137,9 @@ static int FUNC(a53_user_data)(CodedBitstreamContext *ctx, RWContext *rw,
 
     switch (current->user_identifier) {
     case A53_USER_IDENTIFIER_ATSC:
-        return FUNC(a53_atsc_user_data)(ctx, rw, &current->atsc);
+        return FUNC(a53_atsc_user_data)(ctx, rw, &current->u.atsc);
     case A53_USER_IDENTIFIER_AFD:
-        return FUNC(a53_afd_data)(ctx, rw, &current->afd);
+        return FUNC(a53_afd_data)(ctx, rw, &current->u.afd);
     default:
         av_log(ctx->log_ctx, AV_LOG_WARNING,
                "Unknown registered user data found: identifier %#08x.\n",
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index 65c7b7b55e..7c890508dd 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -579,7 +579,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
                 };
                 H264RawSEIUserDataRegistered *udr =
                     &payload.payload.user_data_registered;
-                size_t size = 9 + 3 * a53_ud.atsc.cc_data.cc_count;
+                size_t size = 9 + 3 * a53_ud.u.atsc.u.cc_data.cc_count;
 
                 udr->data_ref = av_buffer_alloc(2 + size);
                 if (!udr->data_ref) {
@@ -639,7 +639,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
                     continue;
                 }
                 if (a53_ud.user_identifier != A53_USER_IDENTIFIER_ATSC ||
-                    a53_ud.atsc.user_data_type_code !=
+                    a53_ud.u.atsc.user_data_type_code !=
                         A53_USER_DATA_TYPE_CODE_CC_DATA) {
                     // Valid but something else (e.g. AFD).
                     continue;
diff --git a/libavcodec/mpeg2_metadata_bsf.c b/libavcodec/mpeg2_metadata_bsf.c
index e82758d2eb..92db608c4a 100644
--- a/libavcodec/mpeg2_metadata_bsf.c
+++ b/libavcodec/mpeg2_metadata_bsf.c
@@ -219,7 +219,7 @@ static int mpeg2_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
                 continue;
             }
             if (a53_ud.user_identifier != A53_USER_IDENTIFIER_ATSC ||
-                a53_ud.atsc.user_data_type_code !=
+                a53_ud.u.atsc.user_data_type_code !=
                     A53_USER_DATA_TYPE_CODE_CC_DATA) {
                 // Valid but something else (e.g. AFD).
                 continue;
-- 
2.20.1



More information about the ffmpeg-devel mailing list