diff mbox series

[FFmpeg-devel,02/48] avcodec/packet_internal: make avpriv_packet_list_* functions use an internal struct

Message ID 20210305163339.63164-3-jamrial@gmail.com
State Accepted
Commit d422b2ed87ee7d3b3014cd3fac553e6aad7d4f14
Headers show
Series deprecate av_init_packet() and sizeof(AVPacket) as part of the ABI
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer March 5, 2021, 4:32 p.m. UTC
The next pointer is kept at the end for backwards compatibility until the
major bump, when it should be moved at the front.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/avpacket.c         | 18 +++++++++---------
 libavcodec/packet_internal.h  | 10 +++++++---
 libavdevice/decklink_common.h |  2 +-
 libavdevice/decklink_dec.cpp  |  9 +++++----
 libavdevice/dshow.c           | 10 +++++-----
 libavdevice/dshow_capture.h   |  3 ++-
 libavdevice/vfwcap.c          | 13 +++++++------
 libavformat/aiffenc.c         |  4 ++--
 libavformat/flacenc.c         |  2 +-
 libavformat/internal.h        | 14 +++++++-------
 libavformat/matroskadec.c     |  4 ++--
 libavformat/mp3enc.c          |  2 +-
 libavformat/mux.c             | 11 ++++++-----
 libavformat/mxfenc.c          |  7 ++++---
 libavformat/ttaenc.c          |  2 +-
 libavformat/utils.c           | 14 +++++++-------
 16 files changed, 67 insertions(+), 58 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index ae0cbfb9f9..8c75c75f7b 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -733,13 +733,13 @@  FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 }
 
-int avpriv_packet_list_put(AVPacketList **packet_buffer,
-                           AVPacketList **plast_pktl,
+int avpriv_packet_list_put(PacketList **packet_buffer,
+                           PacketList **plast_pktl,
                            AVPacket      *pkt,
                            int (*copy)(AVPacket *dst, const AVPacket *src),
                            int flags)
 {
-    AVPacketList *pktl = av_mallocz(sizeof(AVPacketList));
+    PacketList *pktl = av_mallocz(sizeof(PacketList));
     int ret;
 
     if (!pktl)
@@ -770,11 +770,11 @@  int avpriv_packet_list_put(AVPacketList **packet_buffer,
     return 0;
 }
 
-int avpriv_packet_list_get(AVPacketList **pkt_buffer,
-                           AVPacketList **pkt_buffer_end,
+int avpriv_packet_list_get(PacketList **pkt_buffer,
+                           PacketList **pkt_buffer_end,
                            AVPacket      *pkt)
 {
-    AVPacketList *pktl;
+    PacketList *pktl;
     if (!*pkt_buffer)
         return AVERROR(EAGAIN);
     pktl        = *pkt_buffer;
@@ -786,12 +786,12 @@  int avpriv_packet_list_get(AVPacketList **pkt_buffer,
     return 0;
 }
 
-void avpriv_packet_list_free(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end)
+void avpriv_packet_list_free(PacketList **pkt_buf, PacketList **pkt_buf_end)
 {
-    AVPacketList *tmp = *pkt_buf;
+    PacketList *tmp = *pkt_buf;
 
     while (tmp) {
-        AVPacketList *pktl = tmp;
+        PacketList *pktl = tmp;
         tmp = pktl->next;
         av_packet_unref(&pktl->pkt);
         av_freep(&pktl);
diff --git a/libavcodec/packet_internal.h b/libavcodec/packet_internal.h
index 832ddb4a61..b1d91f6347 100644
--- a/libavcodec/packet_internal.h
+++ b/libavcodec/packet_internal.h
@@ -23,6 +23,10 @@ 
 
 #include "packet.h"
 
+typedef struct PacketList {
+    AVPacket pkt;
+    struct PacketList *next;
+} PacketList;
 
 /**
  * Append an AVPacket to the list.
@@ -37,7 +41,7 @@ 
  * @return 0 on success, negative AVERROR value on failure. On failure,
            the packet and the list are unchanged.
  */
-int avpriv_packet_list_put(AVPacketList **head, AVPacketList **tail,
+int avpriv_packet_list_put(PacketList **head, PacketList **tail,
                            AVPacket *pkt,
                            int (*copy)(AVPacket *dst, const AVPacket *src),
                            int flags);
@@ -54,7 +58,7 @@  int avpriv_packet_list_put(AVPacketList **head, AVPacketList **tail,
  * @return 0 on success, and a packet is returned. AVERROR(EAGAIN) if
  *         the list was empty.
  */
-int avpriv_packet_list_get(AVPacketList **head, AVPacketList **tail,
+int avpriv_packet_list_get(PacketList **head, PacketList **tail,
                            AVPacket *pkt);
 
 /**
@@ -63,7 +67,7 @@  int avpriv_packet_list_get(AVPacketList **head, AVPacketList **tail,
  * @param head List head element
  * @param tail List tail element
  */
-void avpriv_packet_list_free(AVPacketList **head, AVPacketList **tail);
+void avpriv_packet_list_free(PacketList **head, PacketList **tail);
 
 int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type);
 
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index e49d9d54ad..6e032956a8 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -75,7 +75,7 @@  class decklink_output_callback;
 class decklink_input_callback;
 
 typedef struct AVPacketQueue {
-    AVPacketList *first_pkt, *last_pkt;
+    PacketList *first_pkt, *last_pkt;
     int nb_packets;
     unsigned long long size;
     int abort_request;
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 4f8103e614..5acb2e8fbb 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -35,6 +35,7 @@  extern "C" {
 
 extern "C" {
 #include "config.h"
+#include "libavcodec/packet_internal.h"
 #include "libavformat/avformat.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avutil.h"
@@ -481,7 +482,7 @@  static void avpacket_queue_init(AVFormatContext *avctx, AVPacketQueue *q)
 
 static void avpacket_queue_flush(AVPacketQueue *q)
 {
-    AVPacketList *pkt, *pkt1;
+    PacketList *pkt, *pkt1;
 
     pthread_mutex_lock(&q->mutex);
     for (pkt = q->first_pkt; pkt != NULL; pkt = pkt1) {
@@ -514,7 +515,7 @@  static unsigned long long avpacket_queue_size(AVPacketQueue *q)
 
 static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt)
 {
-    AVPacketList *pkt1;
+    PacketList *pkt1;
 
     // Drop Packet if queue size is > maximum queue size
     if (avpacket_queue_size(q) > (uint64_t)q->max_q_size) {
@@ -528,7 +529,7 @@  static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt)
         return -1;
     }
 
-    pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList));
+    pkt1 = (PacketList *)av_malloc(sizeof(PacketList));
     if (!pkt1) {
         av_packet_unref(pkt);
         return -1;
@@ -556,7 +557,7 @@  static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt)
 
 static int avpacket_queue_get(AVPacketQueue *q, AVPacket *pkt, int block)
 {
-    AVPacketList *pkt1;
+    PacketList *pkt1;
     int ret;
 
     pthread_mutex_lock(&q->mutex);
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index a16764d74c..73a9a48b20 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -58,7 +58,7 @@  static int
 dshow_read_close(AVFormatContext *s)
 {
     struct dshow_ctx *ctx = s->priv_data;
-    AVPacketList *pktl;
+    PacketList *pktl;
 
     if (ctx->control) {
         IMediaControl_Stop(ctx->control);
@@ -118,7 +118,7 @@  dshow_read_close(AVFormatContext *s)
 
     pktl = ctx->pktl;
     while (pktl) {
-        AVPacketList *next = pktl->next;
+        PacketList *next = pktl->next;
         av_packet_unref(&pktl->pkt);
         av_free(pktl);
         pktl = next;
@@ -162,7 +162,7 @@  callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, e
 {
     AVFormatContext *s = priv_data;
     struct dshow_ctx *ctx = s->priv_data;
-    AVPacketList **ppktl, *pktl_next;
+    PacketList **ppktl, *pktl_next;
 
 //    dump_videohdr(s, vdhdr);
 
@@ -171,7 +171,7 @@  callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, e
     if(shall_we_drop(s, index, devtype))
         goto fail;
 
-    pktl_next = av_mallocz(sizeof(AVPacketList));
+    pktl_next = av_mallocz(sizeof(PacketList));
     if(!pktl_next)
         goto fail;
 
@@ -1262,7 +1262,7 @@  static int dshow_check_event_queue(IMediaEvent *media_event)
 static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     struct dshow_ctx *ctx = s->priv_data;
-    AVPacketList *pktl = NULL;
+    PacketList *pktl = NULL;
 
     while (!ctx->eof && !pktl) {
         WaitForSingleObject(ctx->mutex, INFINITE);
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index 710b65cc85..06ded2ba96 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -34,6 +34,7 @@ 
 #include <dvdmedia.h>
 
 #include "libavcodec/internal.h"
+#include "libavcodec/packet_internal.h"
 
 /* EC_DEVICE_LOST is not defined in MinGW dshow headers. */
 #ifndef EC_DEVICE_LOST
@@ -320,7 +321,7 @@  struct dshow_ctx {
     HANDLE mutex;
     HANDLE event[2]; /* event[0] is set by DirectShow
                       * event[1] is set by callback() */
-    AVPacketList *pktl;
+    PacketList *pktl;
 
     int eof;
 
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index e2ab276c2e..b3ef5f3448 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -24,6 +24,7 @@ 
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 
+#include "libavcodec/packet_internal.h"
 #include "libavformat/internal.h"
 
 // windows.h must no be included before winsock2.h, and libavformat internal
@@ -44,7 +45,7 @@  struct vfw_ctx {
     HWND hwnd;
     HANDLE mutex;
     HANDLE event;
-    AVPacketList *pktl;
+    PacketList *pktl;
     unsigned int curbufsize;
     unsigned int frame_num;
     char *video_size;       /**< A string describing video size, set by a private option. */
@@ -178,7 +179,7 @@  static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr)
 {
     AVFormatContext *s;
     struct vfw_ctx *ctx;
-    AVPacketList **ppktl, *pktl_next;
+    PacketList **ppktl, *pktl_next;
 
     s = (AVFormatContext *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
     ctx = s->priv_data;
@@ -190,7 +191,7 @@  static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr)
 
     WaitForSingleObject(ctx->mutex, INFINITE);
 
-    pktl_next = av_mallocz(sizeof(AVPacketList));
+    pktl_next = av_mallocz(sizeof(PacketList));
     if(!pktl_next)
         goto fail;
 
@@ -219,7 +220,7 @@  fail:
 static int vfw_read_close(AVFormatContext *s)
 {
     struct vfw_ctx *ctx = s->priv_data;
-    AVPacketList *pktl;
+    PacketList *pktl;
 
     if(ctx->hwnd) {
         SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
@@ -233,7 +234,7 @@  static int vfw_read_close(AVFormatContext *s)
 
     pktl = ctx->pktl;
     while (pktl) {
-        AVPacketList *next = pktl->next;
+        PacketList *next = pktl->next;
         av_packet_unref(&pktl->pkt);
         av_free(pktl);
         pktl = next;
@@ -439,7 +440,7 @@  fail:
 static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     struct vfw_ctx *ctx = s->priv_data;
-    AVPacketList *pktl = NULL;
+    PacketList *pktl = NULL;
 
     while(!pktl) {
         WaitForSingleObject(ctx->mutex, INFINITE);
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 53a2f97e22..06e475cddb 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -37,7 +37,7 @@  typedef struct AIFFOutputContext {
     int64_t frames;
     int64_t ssnd;
     int audio_stream_idx;
-    AVPacketList *pict_list, *pict_list_end;
+    PacketList *pict_list, *pict_list_end;
     int write_id3v2;
     int id3v2_version;
 } AIFFOutputContext;
@@ -48,7 +48,7 @@  static int put_id3v2_tags(AVFormatContext *s, AIFFOutputContext *aiff)
     uint64_t pos, end, size;
     ID3v2EncContext id3v2 = { 0 };
     AVIOContext *pb = s->pb;
-    AVPacketList *pict_list = aiff->pict_list;
+    PacketList *pict_list = aiff->pict_list;
 
     if (!s->metadata && !s->nb_chapters && !aiff->pict_list)
         return 0;
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index 1c983486aa..ec9f4ab43e 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -39,7 +39,7 @@  typedef struct FlacMuxerContext {
     int audio_stream_idx;
     int waiting_pics;
     /* audio packets are queued here until we get all the attached pictures */
-    AVPacketList *queue, *queue_end;
+    PacketList *queue, *queue_end;
 
     /* updated streaminfo sent by the encoder at the end */
     uint8_t streaminfo[FLAC_STREAMINFO_SIZE];
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 0ffdc87b6a..e913d958fc 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -73,8 +73,8 @@  struct AVFormatInternal {
      * not decoded, for example to get the codec parameters in MPEG
      * streams.
      */
-    struct AVPacketList *packet_buffer;
-    struct AVPacketList *packet_buffer_end;
+    struct PacketList *packet_buffer;
+    struct PacketList *packet_buffer_end;
 
     /* av_seek_frame() support */
     int64_t data_offset; /**< offset of the first packet */
@@ -85,13 +85,13 @@  struct AVFormatInternal {
      * be identified, as parsing cannot be done without knowing the
      * codec.
      */
-    struct AVPacketList *raw_packet_buffer;
-    struct AVPacketList *raw_packet_buffer_end;
+    struct PacketList *raw_packet_buffer;
+    struct PacketList *raw_packet_buffer_end;
     /**
      * Packets split by the parser get queued here.
      */
-    struct AVPacketList *parse_queue;
-    struct AVPacketList *parse_queue_end;
+    struct PacketList *parse_queue;
+    struct PacketList *parse_queue_end;
     /**
      * Remaining size available for raw_packet_buffer, in bytes.
      */
@@ -347,7 +347,7 @@  struct AVStreamInternal {
     /**
      * last packet in packet_buffer for this stream when muxing.
      */
-    struct AVPacketList *last_in_packet_buffer;
+    struct PacketList *last_in_packet_buffer;
 };
 
 #ifdef __GNUC__
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 25eca5825e..9a65774464 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -382,8 +382,8 @@  typedef struct MatroskaDemuxContext {
     int64_t segment_start;
 
     /* the packet queue */
-    AVPacketList *queue;
-    AVPacketList *queue_end;
+    PacketList *queue;
+    PacketList *queue_end;
 
     int done;
 
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 4f91c4f1c3..e939eb752f 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -132,7 +132,7 @@  typedef struct MP3Context {
     int pics_to_write;
 
     /* audio packets are queued here until we get all the attached pictures */
-    AVPacketList *queue, *queue_end;
+    PacketList *queue, *queue_end;
 } MP3Context;
 
 static const uint8_t xing_offtbl[2][2] = {{32, 17}, {17, 9}};
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 062ba8d789..440113b149 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -22,6 +22,7 @@ 
 #include "avformat.h"
 #include "internal.h"
 #include "libavcodec/internal.h"
+#include "libavcodec/packet_internal.h"
 #include "libavutil/opt.h"
 #include "libavutil/dict.h"
 #include "libavutil/pixdesc.h"
@@ -830,11 +831,11 @@  int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
                              int (*compare)(AVFormatContext *, const AVPacket *, const AVPacket *))
 {
     int ret;
-    AVPacketList **next_point, *this_pktl;
+    PacketList **next_point, *this_pktl;
     AVStream *st = s->streams[pkt->stream_index];
     int chunked  = s->max_chunk_size || s->max_chunk_duration;
 
-    this_pktl    = av_malloc(sizeof(AVPacketList));
+    this_pktl    = av_malloc(sizeof(PacketList));
     if (!this_pktl) {
         av_packet_unref(pkt);
         return AVERROR(ENOMEM);
@@ -931,7 +932,7 @@  static int interleave_compare_dts(AVFormatContext *s, const AVPacket *next,
 int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
                                  AVPacket *pkt, int flush)
 {
-    AVPacketList *pktl;
+    PacketList *pktl;
     int stream_count = 0;
     int noninterleaved_count = 0;
     int i, ret;
@@ -968,7 +969,7 @@  int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
 
         for (i = 0; i < s->nb_streams; i++) {
             int64_t last_dts;
-            const AVPacketList *last = s->streams[i]->internal->last_in_packet_buffer;
+            const PacketList *last = s->streams[i]->internal->last_in_packet_buffer;
 
             if (!last)
                 continue;
@@ -1064,7 +1065,7 @@  int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset
 
 const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream)
 {
-    AVPacketList *pktl = s->internal->packet_buffer;
+    PacketList *pktl = s->internal->packet_buffer;
     while (pktl) {
         if (pktl->pkt.stream_index == stream) {
             return &pktl->pkt;
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 1c668998e2..7a16bf9155 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -53,6 +53,7 @@ 
 #include "libavcodec/h264_ps.h"
 #include "libavcodec/golomb.h"
 #include "libavcodec/internal.h"
+#include "libavcodec/packet_internal.h"
 #include "avformat.h"
 #include "avio_internal.h"
 #include "internal.h"
@@ -3104,9 +3105,9 @@  static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
         stream_count += !!s->streams[i]->internal->last_in_packet_buffer;
 
     if (stream_count && (s->nb_streams == stream_count || flush)) {
-        AVPacketList *pktl = s->internal->packet_buffer;
+        PacketList *pktl = s->internal->packet_buffer;
         if (s->nb_streams != stream_count) {
-            AVPacketList *last = NULL;
+            PacketList *last = NULL;
             // find last packet in edit unit
             while (pktl) {
                 if (!stream_count || pktl->pkt.stream_index == 0)
@@ -3120,7 +3121,7 @@  static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
             }
             // purge packet queue
             while (pktl) {
-                AVPacketList *next = pktl->next;
+                PacketList *next = pktl->next;
                 av_packet_unref(&pktl->pkt);
                 av_freep(&pktl);
                 pktl = next;
diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
index 92f5053d52..32eb269040 100644
--- a/libavformat/ttaenc.c
+++ b/libavformat/ttaenc.c
@@ -30,7 +30,7 @@ 
 
 typedef struct TTAMuxContext {
     AVIOContext *seek_table;
-    AVPacketList *queue, *queue_end;
+    PacketList *queue, *queue_end;
     uint32_t nb_samples;
     int frame_size;
     int last_frame;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 36164e0f0d..73b1a9b52c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -812,7 +812,7 @@  int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
     av_init_packet(pkt);
 
     for (;;) {
-        AVPacketList *pktl = s->internal->raw_packet_buffer;
+        PacketList *pktl = s->internal->raw_packet_buffer;
         const AVPacket *pkt1;
 
         if (pktl) {
@@ -1020,7 +1020,7 @@  static int has_decode_delay_been_guessed(AVStream *st)
         return st->internal->nb_decoded_frames >= 20;
 }
 
-static AVPacketList *get_next_pkt(AVFormatContext *s, AVStream *st, AVPacketList *pktl)
+static PacketList *get_next_pkt(AVFormatContext *s, AVStream *st, PacketList *pktl)
 {
     if (pktl->next)
         return pktl->next;
@@ -1076,7 +1076,7 @@  static int64_t select_from_pts_buffer(AVStream *st, int64_t *pts_buffer, int64_t
  * of the packets in a window.
  */
 static void update_dts_from_pts(AVFormatContext *s, int stream_index,
-                                AVPacketList *pkt_buffer)
+                                PacketList *pkt_buffer)
 {
     AVStream *st       = s->streams[stream_index];
     int delay          = st->internal->avctx->has_b_frames;
@@ -1105,8 +1105,8 @@  static void update_initial_timestamps(AVFormatContext *s, int stream_index,
                                       int64_t dts, int64_t pts, AVPacket *pkt)
 {
     AVStream *st       = s->streams[stream_index];
-    AVPacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;
-    AVPacketList *pktl_it;
+    PacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;
+    PacketList *pktl_it;
 
     uint64_t shift;
 
@@ -1157,7 +1157,7 @@  static void update_initial_timestamps(AVFormatContext *s, int stream_index,
 static void update_initial_durations(AVFormatContext *s, AVStream *st,
                                      int stream_index, int64_t duration)
 {
-    AVPacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;
+    PacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;
     int64_t cur_dts    = RELATIVE_TS_BASE;
 
     if (st->first_dts != AV_NOPTS_VALUE) {
@@ -1742,7 +1742,7 @@  int av_read_frame(AVFormatContext *s, AVPacket *pkt)
     }
 
     for (;;) {
-        AVPacketList *pktl = s->internal->packet_buffer;
+        PacketList *pktl = s->internal->packet_buffer;
 
         if (pktl) {
             AVPacket *next_pkt = &pktl->pkt;