diff mbox series

[FFmpeg-devel,1/5] avcodec/mpeg12dec: make mpeg_decode_user_data() accessible

Message ID DM8P223MB03657A778551168863E862C4BA669@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,1/5] avcodec/mpeg12dec: make mpeg_decode_user_data() accessible
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Soft Works Nov. 29, 2021, 6:51 p.m. UTC
Signed-off-by: softworkz <softworkz@hotmail.com>
---
 libavcodec/mpeg12.h    | 25 +++++++++++++++++++++++++
 libavcodec/mpeg12dec.c | 36 +++++-------------------------------
 2 files changed, 30 insertions(+), 31 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index fb2b37e7c8..630afa4072 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -24,6 +24,7 @@ 
 
 #include "mpeg12vlc.h"
 #include "mpegvideo.h"
+#include "libavutil/stereo3d.h"
 
 /* Start codes. */
 #define SEQ_END_CODE            0x000001b7
@@ -35,6 +36,28 @@ 
 #define EXT_START_CODE          0x000001b5
 #define USER_START_CODE         0x000001b2
 
+typedef struct Mpeg1Context {
+    MpegEncContext mpeg_enc_ctx;
+    int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
+    int repeat_field;           /* true if we must repeat the field */
+    AVPanScan pan_scan;         /* some temporary storage for the panscan */
+    AVStereo3D stereo3d;
+    int has_stereo3d;
+    AVBufferRef *a53_buf_ref;
+    uint8_t afd;
+    int has_afd;
+    int slice_count;
+    AVRational save_aspect;
+    int save_width, save_height, save_progressive_seq;
+    int rc_buffer_size;
+    AVRational frame_rate_ext;  /* MPEG-2 specific framerate modificator */
+    int sync;                   /* Did we reach a sync point like a GOP/SEQ/KEYFrame? */
+    int tmpgexs;
+    int first_slice;
+    int extradata_decoded;
+} Mpeg1Context;
+
+
 void ff_mpeg12_common_init(MpegEncContext *s);
 
 #define INIT_2D_VLC_RL(rl, static_size, flags)\
@@ -84,4 +107,6 @@  void ff_mpeg12_find_best_frame_rate(AVRational frame_rate,
                                     int *code, int *ext_n, int *ext_d,
                                     int nonstandard);
 
+void ff_mpeg_decode_user_data(AVCodecContext *avctx, Mpeg1Context *s1, const uint8_t *p, int buf_size);
+
 #endif /* AVCODEC_MPEG12_H */
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 09b2902bca..09f2535a6a 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -53,27 +53,6 @@ 
 
 #define A53_MAX_CC_COUNT 2000
 
-typedef struct Mpeg1Context {
-    MpegEncContext mpeg_enc_ctx;
-    int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
-    int repeat_field;           /* true if we must repeat the field */
-    AVPanScan pan_scan;         /* some temporary storage for the panscan */
-    AVStereo3D stereo3d;
-    int has_stereo3d;
-    AVBufferRef *a53_buf_ref;
-    uint8_t afd;
-    int has_afd;
-    int slice_count;
-    AVRational save_aspect;
-    int save_width, save_height, save_progressive_seq;
-    int rc_buffer_size;
-    AVRational frame_rate_ext;  /* MPEG-2 specific framerate modificator */
-    int sync;                   /* Did we reach a sync point like a GOP/SEQ/KEYFrame? */
-    int tmpgexs;
-    int first_slice;
-    int extradata_decoded;
-} Mpeg1Context;
-
 #define MB_TYPE_ZERO_MV   0x20000000
 
 static const uint32_t ptype2mb_type[7] = {
@@ -2232,11 +2211,9 @@  static int vcr2_init_sequence(AVCodecContext *avctx)
     return 0;
 }
 
-static int mpeg_decode_a53_cc(AVCodecContext *avctx,
+static int mpeg_decode_a53_cc(AVCodecContext *avctx, Mpeg1Context *s1,
                               const uint8_t *p, int buf_size)
 {
-    Mpeg1Context *s1 = avctx->priv_data;
-
     if (buf_size >= 6 &&
         p[0] == 'G' && p[1] == 'A' && p[2] == '9' && p[3] == '4' &&
         p[4] == 3 && (p[5] & 0x40)) {
@@ -2367,12 +2344,9 @@  static int mpeg_decode_a53_cc(AVCodecContext *avctx,
     return 0;
 }
 
-static void mpeg_decode_user_data(AVCodecContext *avctx,
-                                  const uint8_t *p, int buf_size)
+void ff_mpeg_decode_user_data(AVCodecContext *avctx, Mpeg1Context *s1, const uint8_t *p, int buf_size)
 {
-    Mpeg1Context *s = avctx->priv_data;
     const uint8_t *buf_end = p + buf_size;
-    Mpeg1Context *s1 = avctx->priv_data;
 
 #if 0
     int i;
@@ -2386,7 +2360,7 @@  static void mpeg_decode_user_data(AVCodecContext *avctx,
         int i;
         for(i=0; i<20; i++)
             if (!memcmp(p+i, "\0TMPGEXS\0", 9)){
-                s->tmpgexs= 1;
+                s1->tmpgexs= 1;
             }
     }
     /* we parse the DTG active format information */
@@ -2432,7 +2406,7 @@  static void mpeg_decode_user_data(AVCodecContext *avctx,
                 break;
             }
         }
-    } else if (mpeg_decode_a53_cc(avctx, p, buf_size)) {
+    } else if (mpeg_decode_a53_cc(avctx, s1, p, buf_size)) {
         return;
     }
 }
@@ -2624,7 +2598,7 @@  static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
             }
             break;
         case USER_START_CODE:
-            mpeg_decode_user_data(avctx, buf_ptr, input_size);
+            ff_mpeg_decode_user_data(avctx, s, buf_ptr, input_size);
             break;
         case GOP_START_CODE:
             if (last_code == 0) {