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>tags/n4.4
@@ -737,13 +737,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) | |||
@@ -774,11 +774,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; | |||
@@ -790,12 +790,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); | |||
@@ -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); | |||
@@ -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; | |||
@@ -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" | |||
@@ -482,7 +483,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) { | |||
@@ -515,7 +516,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) { | |||
@@ -529,7 +530,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; | |||
@@ -557,7 +558,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); | |||
@@ -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); | |||
@@ -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; | |||
@@ -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); | |||
@@ -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; | |||
@@ -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]; | |||
@@ -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__ | |||
@@ -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; | |||
@@ -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}}; | |||
@@ -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; | |||
@@ -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; | |||
@@ -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; | |||
@@ -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; | |||