summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-03-05 11:26:24 -0300
committerJames Almer <jamrial@gmail.com>2021-03-17 14:12:17 -0300
commitd422b2ed87ee7d3b3014cd3fac553e6aad7d4f14 (patch)
tree06b1f9e88cfab2675afd529468f47ab851f1bab3 /libavformat
parentf7db77bd8785d1715d3e7ed7e69bd1cc991f2d07 (diff)
avcodec/packet_internal: make avpriv_packet_list_* functions use an internal struct
The next pointer is kept at the end for backwards compatability until the major bump, when it should ideally be moved at the front. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/aiffenc.c4
-rw-r--r--libavformat/flacenc.c2
-rw-r--r--libavformat/internal.h14
-rw-r--r--libavformat/matroskadec.c4
-rw-r--r--libavformat/mp3enc.c2
-rw-r--r--libavformat/mux.c11
-rw-r--r--libavformat/mxfenc.c7
-rw-r--r--libavformat/ttaenc.c2
-rw-r--r--libavformat/utils.c14
9 files changed, 31 insertions, 29 deletions
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 088f347bbf..57f5c012f7 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 fa5f3d9c02..6e78a3e099 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 ce503e3473..803148f0c8 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 8573117694..d5940e763f 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;