#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)
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;
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);
#include "packet.h"
+typedef struct PacketList {
+ AVPacket pkt;
+ struct PacketList *next;
+} PacketList;
/**
* Append an AVPacket to the list.
* @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);
* @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);
/**
* @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);
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;
extern "C" {
#include "config.h"
+#include "libavcodec/packet_internal.h"
#include "libavformat/avformat.h"
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
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) {
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) {
return -1;
}
- pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList));
+ pkt1 = (PacketList *)av_malloc(sizeof(PacketList));
if (!pkt1) {
av_packet_unref(pkt);
return -1;
static int avpacket_queue_get(AVPacketQueue *q, AVPacket *pkt, int block)
{
- AVPacketList *pkt1;
+ PacketList *pkt1;
int ret;
pthread_mutex_lock(&q->mutex);
dshow_read_close(AVFormatContext *s)
{
struct dshow_ctx *ctx = s->priv_data;
- AVPacketList *pktl;
+ PacketList *pktl;
if (ctx->control) {
IMediaControl_Stop(ctx->control);
pktl = ctx->pktl;
while (pktl) {
- AVPacketList *next = pktl->next;
+ PacketList *next = pktl->next;
av_packet_unref(&pktl->pkt);
av_free(pktl);
pktl = next;
{
AVFormatContext *s = priv_data;
struct dshow_ctx *ctx = s->priv_data;
- AVPacketList **ppktl, *pktl_next;
+ PacketList **ppktl, *pktl_next;
// dump_videohdr(s, vdhdr);
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;
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);
#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
HANDLE mutex;
HANDLE event[2]; /* event[0] is set by DirectShow
* event[1] is set by callback() */
- AVPacketList *pktl;
+ PacketList *pktl;
int eof;
#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
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. */
{
AVFormatContext *s;
struct vfw_ctx *ctx;
- AVPacketList **ppktl, *pktl_next;
+ PacketList **ppktl, *pktl_next;
s = (AVFormatContext *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
ctx = s->priv_data;
WaitForSingleObject(ctx->mutex, INFINITE);
- pktl_next = av_mallocz(sizeof(AVPacketList));
+ pktl_next = av_mallocz(sizeof(PacketList));
if(!pktl_next)
goto 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);
pktl = ctx->pktl;
while (pktl) {
- AVPacketList *next = pktl->next;
+ PacketList *next = pktl->next;
av_packet_unref(&pktl->pkt);
av_free(pktl);
pktl = next;
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);
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;
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;
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];
* 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 */
* 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.
*/
/**
* last packet in packet_buffer for this stream when muxing.
*/
- struct AVPacketList *last_in_packet_buffer;
+ struct PacketList *last_in_packet_buffer;
};
#ifdef __GNUC__
int64_t segment_start;
/* the packet queue */
- AVPacketList *queue;
- AVPacketList *queue_end;
+ PacketList *queue;
+ PacketList *queue_end;
int done;
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}};
#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"
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);
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;
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;
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;
#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"
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)
}
// purge packet queue
while (pktl) {
- AVPacketList *next = pktl->next;
+ PacketList *next = pktl->next;
av_packet_unref(&pktl->pkt);
av_freep(&pktl);
pktl = next;
typedef struct TTAMuxContext {
AVIOContext *seek_table;
- AVPacketList *queue, *queue_end;
+ PacketList *queue, *queue_end;
uint32_t nb_samples;
int frame_size;
int last_frame;
av_init_packet(pkt);
for (;;) {
- AVPacketList *pktl = s->internal->raw_packet_buffer;
+ PacketList *pktl = s->internal->raw_packet_buffer;
const AVPacket *pkt1;
if (pktl) {
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;
* 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;
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;
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) {
}
for (;;) {
- AVPacketList *pktl = s->internal->packet_buffer;
+ PacketList *pktl = s->internal->packet_buffer;
if (pktl) {
AVPacket *next_pkt = &pktl->pkt;