aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice
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 /libavdevice
parentf7db77bd8785d1715d3e7ed7e69bd1cc991f2d07 (diff)
downloadffmpeg-d422b2ed87ee7d3b3014cd3fac553e6aad7d4f14.tar.gz
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 'libavdevice')
-rw-r--r--libavdevice/decklink_common.h2
-rw-r--r--libavdevice/decklink_dec.cpp9
-rw-r--r--libavdevice/dshow.c10
-rw-r--r--libavdevice/dshow_capture.h3
-rw-r--r--libavdevice/vfwcap.c13
5 files changed, 20 insertions, 17 deletions
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 0262b2f16a..77091e737b 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"
@@ -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);
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);