Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: softworkz <ffmpegagent@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Kieran Kunhya <kierank@obe.tv>, softworkz <softworkz@hotmail.com>,
	"Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH v4 3/6] avcodec/mpeg12dec: make mpeg_decode_user_data() accessible
Date: Sun, 26 Jun 2022 23:41:25 +0000
Message-ID: <320a8a535c619defc221b170448272373d367b98.1656286888.git.ffmpegagent@gmail.com> (raw)
In-Reply-To: <pull.31.v4.ffstaging.FFmpeg.1656286888.ffmpegagent@gmail.com>

From: softworkz <softworkz@hotmail.com>

Signed-off-by: softworkz <softworkz@hotmail.com>
---
 libavcodec/mpeg12.h    | 28 ++++++++++++++++++++++++++++
 libavcodec/mpeg12dec.c | 40 +++++-----------------------------------
 2 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index e0406b32d9..84a829cdd3 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -23,6 +23,7 @@
 #define AVCODEC_MPEG12_H
 
 #include "mpegvideo.h"
+#include "libavutil/stereo3d.h"
 
 /* Start codes. */
 #define SEQ_END_CODE            0x000001b7
@@ -34,6 +35,31 @@
 #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;
+    unsigned aspect_ratio_info;
+    AVRational save_aspect;
+    int save_width, save_height, save_progressive_seq;
+    int rc_buffer_size;
+    AVRational frame_rate_ext;  /* MPEG-2 specific framerate modificator */
+    unsigned frame_rate_index;
+    int sync;                   /* Did we reach a sync point like a GOP/SEQ/KEYFrame? */
+    int closed_gop;
+    int tmpgexs;
+    int first_slice;
+    int extradata_decoded;
+    int64_t timecode_frame_start;  /*< GOP timecode frame start number, in non drop frame format */
+} Mpeg1Context;
+
 void ff_mpeg12_common_init(MpegEncContext *s);
 
 void ff_mpeg1_clean_buffers(MpegEncContext *s);
@@ -45,4 +71,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 e9bde48f7a..11d2b58185 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -58,31 +58,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;
-    unsigned aspect_ratio_info;
-    AVRational save_aspect;
-    int save_width, save_height, save_progressive_seq;
-    int rc_buffer_size;
-    AVRational frame_rate_ext;  /* MPEG-2 specific framerate modificator */
-    unsigned frame_rate_index;
-    int sync;                   /* Did we reach a sync point like a GOP/SEQ/KEYFrame? */
-    int closed_gop;
-    int tmpgexs;
-    int first_slice;
-    int extradata_decoded;
-    int64_t timecode_frame_start;  /*< GOP timecode frame start number, in non drop frame format */
-} Mpeg1Context;
-
 #define MB_TYPE_ZERO_MV   0x20000000
 
 static const uint32_t ptype2mb_type[7] = {
@@ -2198,11 +2173,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)) {
@@ -2333,12 +2306,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;
@@ -2352,7 +2322,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 */
@@ -2398,7 +2368,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;
     }
 }
@@ -2590,7 +2560,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) {
-- 
ffmpeg-codebot

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

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

  parent reply	other threads:[~2022-06-26 23:42 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26  8:08 [FFmpeg-devel] [PATCH 0/6] Implement SEI parsing for QSV decoders ffmpegagent
2022-05-26  8:08 ` [FFmpeg-devel] [PATCH 1/6] avutil/frame: Add av_frame_copy_side_data() and av_frame_remove_all_side_data() softworkz
2022-05-27 14:35   ` Soft Works
2022-05-26  8:08 ` [FFmpeg-devel] [PATCH 2/6] avcodec/vpp_qsv: Copy side data from input to output frame softworkz
2022-05-31  9:19   ` Xiang, Haihao
2022-05-26  8:08 ` [FFmpeg-devel] [PATCH 3/6] avcodec/mpeg12dec: make mpeg_decode_user_data() accessible softworkz
2022-05-31  9:24   ` Xiang, Haihao
2022-05-26  8:08 ` [FFmpeg-devel] [PATCH 4/6] avcodec/hevcdec: make set_side_data() accessible softworkz
2022-05-31  9:38   ` Xiang, Haihao
2022-05-31 16:03     ` Soft Works
2022-05-31  9:40   ` Xiang, Haihao
2022-05-26  8:08 ` [FFmpeg-devel] [PATCH 5/6] avcodec/h264dec: make h264_export_frame_props() accessible softworkz
2022-05-26  8:08 ` [FFmpeg-devel] [PATCH 6/6] avcodec/qsvdec: Implement SEI parsing for QSV decoders softworkz
2022-06-01  5:15   ` Xiang, Haihao
2022-06-01  8:51     ` Soft Works
2022-06-01  9:06 ` [FFmpeg-devel] [PATCH v2 0/6] " ffmpegagent
2022-06-01  9:06   ` [FFmpeg-devel] [PATCH v2 1/6] avutil/frame: Add av_frame_copy_side_data() and av_frame_remove_all_side_data() softworkz
2022-06-01  9:06   ` [FFmpeg-devel] [PATCH v2 2/6] avcodec/vpp_qsv: Copy side data from input to output frame softworkz
2022-06-01  9:06   ` [FFmpeg-devel] [PATCH v2 3/6] avcodec/mpeg12dec: make mpeg_decode_user_data() accessible softworkz
2022-06-01  9:06   ` [FFmpeg-devel] [PATCH v2 4/6] avcodec/hevcdec: make set_side_data() accessible softworkz
2022-06-01  9:06   ` [FFmpeg-devel] [PATCH v2 5/6] avcodec/h264dec: make h264_export_frame_props() accessible softworkz
2022-06-01  9:06   ` [FFmpeg-devel] [PATCH v2 6/6] avcodec/qsvdec: Implement SEI parsing for QSV decoders softworkz
2022-06-01 17:20     ` Xiang, Haihao
2022-06-01 17:50       ` Soft Works
2022-06-01 18:01   ` [FFmpeg-devel] [PATCH v3 0/6] " ffmpegagent
2022-06-01 18:01     ` [FFmpeg-devel] [PATCH v3 1/6] avutil/frame: Add av_frame_copy_side_data() and av_frame_remove_all_side_data() softworkz
2022-06-24  7:01       ` Xiang, Haihao
2022-06-26 23:35         ` Soft Works
2022-06-01 18:01     ` [FFmpeg-devel] [PATCH v3 2/6] avcodec/vpp_qsv: Copy side data from input to output frame softworkz
2022-06-01 18:01     ` [FFmpeg-devel] [PATCH v3 3/6] avcodec/mpeg12dec: make mpeg_decode_user_data() accessible softworkz
2022-06-01 18:01     ` [FFmpeg-devel] [PATCH v3 4/6] avcodec/hevcdec: make set_side_data() accessible softworkz
2022-06-01 18:01     ` [FFmpeg-devel] [PATCH v3 5/6] avcodec/h264dec: make h264_export_frame_props() accessible softworkz
2022-06-01 18:01     ` [FFmpeg-devel] [PATCH v3 6/6] avcodec/qsvdec: Implement SEI parsing for QSV decoders softworkz
2022-06-26 23:41     ` [FFmpeg-devel] [PATCH v4 0/6] " ffmpegagent
2022-06-26 23:41       ` [FFmpeg-devel] [PATCH v4 1/6] avutil/frame: Add av_frame_copy_side_data() and av_frame_remove_all_side_data() softworkz
2022-06-26 23:41       ` [FFmpeg-devel] [PATCH v4 2/6] avcodec/vpp_qsv: Copy side data from input to output frame softworkz
2022-06-26 23:41       ` softworkz [this message]
2022-06-26 23:41       ` [FFmpeg-devel] [PATCH v4 4/6] avcodec/hevcdec: make set_side_data() accessible softworkz
2022-06-26 23:41       ` [FFmpeg-devel] [PATCH v4 5/6] avcodec/h264dec: make h264_export_frame_props() accessible softworkz
2022-06-26 23:41       ` [FFmpeg-devel] [PATCH v4 6/6] avcodec/qsvdec: Implement SEI parsing for QSV decoders softworkz
2022-06-28  4:16         ` Andreas Rheinhardt
2022-06-28  5:25           ` Soft Works
2022-06-27  4:18       ` [FFmpeg-devel] [PATCH v4 0/6] " Xiang, Haihao
2022-07-01 20:48       ` [FFmpeg-devel] [PATCH v5 " ffmpegagent
2022-07-01 20:48         ` [FFmpeg-devel] [PATCH v5 1/6] avutil/frame: Add av_frame_copy_side_data() and av_frame_remove_all_side_data() softworkz
2022-07-01 20:48         ` [FFmpeg-devel] [PATCH v5 2/6] avcodec/vpp_qsv: Copy side data from input to output frame softworkz
2022-07-01 20:48         ` [FFmpeg-devel] [PATCH v5 3/6] avcodec/mpeg12dec: make mpeg_decode_user_data() accessible softworkz
2022-07-01 20:48         ` [FFmpeg-devel] [PATCH v5 4/6] avcodec/hevcdec: make set_side_data() accessible softworkz
2022-07-01 20:48         ` [FFmpeg-devel] [PATCH v5 5/6] avcodec/h264dec: make h264_export_frame_props() accessible softworkz
2022-07-01 20:48         ` [FFmpeg-devel] [PATCH v5 6/6] avcodec/qsvdec: Implement SEI parsing for QSV decoders softworkz
2022-07-19  6:55         ` [FFmpeg-devel] [PATCH v5 0/6] " Xiang, Haihao
2022-07-21 21:06           ` Soft Works
2022-07-21 21:56           ` Andreas Rheinhardt
2022-10-21  7:42             ` Soft Works
2022-10-25  4:03         ` [FFmpeg-devel] [PATCH v6 0/3] " ffmpegagent
2022-10-25  4:03           ` [FFmpeg-devel] [PATCH v6 1/3] avcodec/hevcdec: factor out ff_hevc_set_set_to_frame softworkz
2022-10-25  4:03           ` [FFmpeg-devel] [PATCH v6 2/3] avcodec/h264dec: make h264_export_frame_props() accessible softworkz
2022-10-25  4:03           ` [FFmpeg-devel] [PATCH v6 3/3] avcodec/qsvdec: Implement SEI parsing for QSV decoders softworkz
2022-11-21  2:44             ` Xiang, Haihao
2022-11-21 15:58               ` Soft Works
2022-11-22  5:41                 ` Xiang, Haihao
2022-06-01 19:15 ` [FFmpeg-devel] [PATCH 0/6] " Kieran Kunhya
2022-06-01 19:46   ` Soft Works
2022-06-01 20:25     ` Kieran Kunhya
2022-06-01 21:24       ` Soft Works

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=320a8a535c619defc221b170448272373d367b98.1656286888.git.ffmpegagent@gmail.com \
    --to=ffmpegagent@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=haihao.xiang-at-intel.com@ffmpeg.org \
    --cc=kierank@obe.tv \
    --cc=softworkz@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git