mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
lavc: Drop deprecated destruct_packet related functions
Deprecated in 10/2012.
This commit is contained in:
parent
dc70c19476
commit
01bcc2d5c2
@ -1209,12 +1209,7 @@ typedef struct AVPacket {
|
|||||||
* Equals next_pts - this_pts in presentation order.
|
* Equals next_pts - this_pts in presentation order.
|
||||||
*/
|
*/
|
||||||
int duration;
|
int duration;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
attribute_deprecated
|
|
||||||
void (*destruct)(struct AVPacket *);
|
|
||||||
attribute_deprecated
|
|
||||||
void *priv;
|
|
||||||
#endif
|
|
||||||
int64_t pos; ///< byte position in stream, -1 if unknown
|
int64_t pos; ///< byte position in stream, -1 if unknown
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3576,15 +3571,6 @@ void avsubtitle_free(AVSubtitle *sub);
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
/**
|
|
||||||
* Default packet destructor.
|
|
||||||
* @deprecated use the AVBuffer API instead
|
|
||||||
*/
|
|
||||||
attribute_deprecated
|
|
||||||
void av_destruct_packet(AVPacket *pkt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize optional fields of a packet with default values.
|
* Initialize optional fields of a packet with default values.
|
||||||
*
|
*
|
||||||
|
@ -27,22 +27,6 @@
|
|||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
|
|
||||||
void av_destruct_packet(AVPacket *pkt)
|
|
||||||
{
|
|
||||||
av_free(pkt->data);
|
|
||||||
pkt->data = NULL;
|
|
||||||
pkt->size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* a dummy destruct callback for the callers that assume AVPacket.destruct ==
|
|
||||||
* NULL => static data */
|
|
||||||
static void dummy_destruct_packet(AVPacket *pkt)
|
|
||||||
{
|
|
||||||
av_assert0(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void av_init_packet(AVPacket *pkt)
|
void av_init_packet(AVPacket *pkt)
|
||||||
{
|
{
|
||||||
@ -53,11 +37,6 @@ void av_init_packet(AVPacket *pkt)
|
|||||||
pkt->convergence_duration = 0;
|
pkt->convergence_duration = 0;
|
||||||
pkt->flags = 0;
|
pkt->flags = 0;
|
||||||
pkt->stream_index = 0;
|
pkt->stream_index = 0;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = NULL;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
pkt->buf = NULL;
|
pkt->buf = NULL;
|
||||||
pkt->side_data = NULL;
|
pkt->side_data = NULL;
|
||||||
pkt->side_data_elems = 0;
|
pkt->side_data_elems = 0;
|
||||||
@ -89,11 +68,6 @@ int av_new_packet(AVPacket *pkt, int size)
|
|||||||
pkt->buf = buf;
|
pkt->buf = buf;
|
||||||
pkt->data = buf->data;
|
pkt->data = buf->data;
|
||||||
pkt->size = size;
|
pkt->size = size;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = dummy_destruct_packet;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -126,11 +100,6 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
|
|||||||
if (!pkt->buf)
|
if (!pkt->buf)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
memcpy(pkt->buf->data, pkt->data, FFMIN(pkt->size, pkt->size + grow_by));
|
memcpy(pkt->buf->data, pkt->data, FFMIN(pkt->size, pkt->size + grow_by));
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = dummy_destruct_packet;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
pkt->data = pkt->buf->data;
|
pkt->data = pkt->buf->data;
|
||||||
pkt->size += grow_by;
|
pkt->size += grow_by;
|
||||||
@ -151,11 +120,6 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
|
|||||||
|
|
||||||
pkt->data = data;
|
pkt->data = data;
|
||||||
pkt->size = size;
|
pkt->size = size;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = dummy_destruct_packet;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -191,23 +155,12 @@ int av_dup_packet(AVPacket *pkt)
|
|||||||
{
|
{
|
||||||
AVPacket tmp_pkt;
|
AVPacket tmp_pkt;
|
||||||
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
if (!pkt->buf && pkt->data) {
|
||||||
if (!pkt->buf && pkt->data
|
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
&& !pkt->destruct
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
tmp_pkt = *pkt;
|
tmp_pkt = *pkt;
|
||||||
|
|
||||||
pkt->data = NULL;
|
pkt->data = NULL;
|
||||||
pkt->side_data = NULL;
|
pkt->side_data = NULL;
|
||||||
DUP_DATA(pkt->data, tmp_pkt.data, pkt->size, 1, ALLOC_BUF);
|
DUP_DATA(pkt->data, tmp_pkt.data, pkt->size, 1, ALLOC_BUF);
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = dummy_destruct_packet;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pkt->side_data_elems) {
|
if (pkt->side_data_elems) {
|
||||||
int i;
|
int i;
|
||||||
@ -243,15 +196,8 @@ void av_packet_free_side_data(AVPacket *pkt)
|
|||||||
void av_free_packet(AVPacket *pkt)
|
void av_free_packet(AVPacket *pkt)
|
||||||
{
|
{
|
||||||
if (pkt) {
|
if (pkt) {
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
if (pkt->buf)
|
if (pkt->buf)
|
||||||
av_buffer_unref(&pkt->buf);
|
av_buffer_unref(&pkt->buf);
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
else if (pkt->destruct)
|
|
||||||
pkt->destruct(pkt);
|
|
||||||
pkt->destruct = NULL;
|
|
||||||
#endif
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->data = NULL;
|
pkt->data = NULL;
|
||||||
pkt->size = 0;
|
pkt->size = 0;
|
||||||
|
|
||||||
|
@ -1329,21 +1329,11 @@ int ff_alloc_packet(AVPacket *avpkt, int size)
|
|||||||
|
|
||||||
if (avpkt->data) {
|
if (avpkt->data) {
|
||||||
AVBufferRef *buf = avpkt->buf;
|
AVBufferRef *buf = avpkt->buf;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
void *destruct = avpkt->destruct;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (avpkt->size < size)
|
if (avpkt->size < size)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
av_init_packet(avpkt);
|
av_init_packet(avpkt);
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
avpkt->destruct = destruct;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
avpkt->buf = buf;
|
avpkt->buf = buf;
|
||||||
avpkt->size = size;
|
avpkt->size = size;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -51,9 +51,6 @@
|
|||||||
#ifndef FF_API_DEINTERLACE
|
#ifndef FF_API_DEINTERLACE
|
||||||
#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 57)
|
#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 57)
|
||||||
#endif
|
#endif
|
||||||
#ifndef FF_API_DESTRUCT_PACKET
|
|
||||||
#define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 57)
|
|
||||||
#endif
|
|
||||||
#ifndef FF_API_GET_BUFFER
|
#ifndef FF_API_GET_BUFFER
|
||||||
#define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 57)
|
#define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 57)
|
||||||
#endif
|
#endif
|
||||||
|
@ -421,13 +421,6 @@ static int mmap_init(AVFormatContext *ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
static void dummy_release_buffer(AVPacket *pkt)
|
|
||||||
{
|
|
||||||
av_assert0(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void mmap_release_buffer(void *opaque, uint8_t *data)
|
static void mmap_release_buffer(void *opaque, uint8_t *data)
|
||||||
{
|
{
|
||||||
struct v4l2_buffer buf = { 0 };
|
struct v4l2_buffer buf = { 0 };
|
||||||
@ -524,11 +517,6 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt)
|
|||||||
|
|
||||||
pkt->data = s->buf_start[buf.index];
|
pkt->data = s->buf_start[buf.index];
|
||||||
pkt->size = buf.bytesused;
|
pkt->size = buf.bytesused;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = dummy_release_buffer;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
buf_descriptor = av_malloc(sizeof(struct buff_data));
|
buf_descriptor = av_malloc(sizeof(struct buff_data));
|
||||||
if (!buf_descriptor) {
|
if (!buf_descriptor) {
|
||||||
|
@ -1095,9 +1095,6 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
AVIContext *avi = s->priv_data;
|
AVIContext *avi = s->priv_data;
|
||||||
AVIOContext *pb = s->pb;
|
AVIOContext *pb = s->pb;
|
||||||
int err;
|
int err;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
void *dstr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
|
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
|
||||||
int size = avpriv_dv_get_packet(avi->dv_demux, pkt);
|
int size = avpriv_dv_get_packet(avi->dv_demux, pkt);
|
||||||
@ -1213,18 +1210,8 @@ resync:
|
|||||||
|
|
||||||
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
|
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
|
||||||
AVBufferRef *avbuf = pkt->buf;
|
AVBufferRef *avbuf = pkt->buf;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
dstr = pkt->destruct;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
size = avpriv_dv_produce_packet(avi->dv_demux, pkt,
|
size = avpriv_dv_produce_packet(avi->dv_demux, pkt,
|
||||||
pkt->data, pkt->size);
|
pkt->data, pkt->size);
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = dstr;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
pkt->buf = avbuf;
|
pkt->buf = avbuf;
|
||||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
|
@ -413,11 +413,6 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
|
|||||||
if (!this_pktl)
|
if (!this_pktl)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
this_pktl->pkt = *pkt;
|
this_pktl->pkt = *pkt;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = NULL; // do not free original but only the copy
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
pkt->buf = NULL;
|
pkt->buf = NULL;
|
||||||
pkt->side_data = NULL;
|
pkt->side_data = NULL;
|
||||||
pkt->side_data_elems = 0;
|
pkt->side_data_elems = 0;
|
||||||
|
@ -169,11 +169,6 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
|
|
||||||
pkt->pts = pkt->dts = mxg->dts;
|
pkt->pts = pkt->dts = mxg->dts;
|
||||||
pkt->stream_index = 0;
|
pkt->stream_index = 0;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = NULL;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
pkt->buf = NULL;
|
pkt->buf = NULL;
|
||||||
pkt->size = mxg->buffer_ptr - mxg->soi_ptr;
|
pkt->size = mxg->buffer_ptr - mxg->soi_ptr;
|
||||||
pkt->data = mxg->soi_ptr;
|
pkt->data = mxg->soi_ptr;
|
||||||
@ -212,11 +207,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
/* time (GMT) of first sample in usec since 1970, little-endian */
|
/* time (GMT) of first sample in usec since 1970, little-endian */
|
||||||
pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8);
|
pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8);
|
||||||
pkt->stream_index = 1;
|
pkt->stream_index = 1;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = NULL;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
pkt->buf = NULL;
|
pkt->buf = NULL;
|
||||||
pkt->size = size - 14;
|
pkt->size = size - 14;
|
||||||
pkt->data = startmarker_ptr + 16;
|
pkt->data = startmarker_ptr + 16;
|
||||||
|
@ -203,11 +203,6 @@ static int str_read_packet(AVFormatContext *s,
|
|||||||
pkt->data= NULL;
|
pkt->data= NULL;
|
||||||
pkt->size= -1;
|
pkt->size= -1;
|
||||||
pkt->buf = NULL;
|
pkt->buf = NULL;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
pkt->destruct = NULL;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,11 +687,6 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
|
|||||||
vst->pkt.data= NULL;
|
vst->pkt.data= NULL;
|
||||||
vst->pkt.size= 0;
|
vst->pkt.size= 0;
|
||||||
vst->pkt.buf = NULL;
|
vst->pkt.buf = NULL;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
vst->pkt.destruct = NULL;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
if(vst->slices != vst->cur_slice) //FIXME find out how to set slices correct from the begin
|
if(vst->slices != vst->cur_slice) //FIXME find out how to set slices correct from the begin
|
||||||
memmove(pkt->data + 1 + 8*vst->cur_slice, pkt->data + 1 + 8*vst->slices,
|
memmove(pkt->data + 1 + 8*vst->cur_slice, pkt->data + 1 + 8*vst->slices,
|
||||||
vst->videobufpos - 1 - 8*vst->slices);
|
vst->videobufpos - 1 - 8*vst->slices);
|
||||||
|
@ -828,12 +828,6 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
|
|||||||
if (out_pkt.data == pkt->data && out_pkt.size == pkt->size) {
|
if (out_pkt.data == pkt->data && out_pkt.size == pkt->size) {
|
||||||
out_pkt.buf = pkt->buf;
|
out_pkt.buf = pkt->buf;
|
||||||
pkt->buf = NULL;
|
pkt->buf = NULL;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
out_pkt.destruct = pkt->destruct;
|
|
||||||
pkt->destruct = NULL;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if ((ret = av_dup_packet(&out_pkt)) < 0)
|
if ((ret = av_dup_packet(&out_pkt)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -127,11 +127,6 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
*pkt = yop->video_packet;
|
*pkt = yop->video_packet;
|
||||||
yop->video_packet.data = NULL;
|
yop->video_packet.data = NULL;
|
||||||
yop->video_packet.buf = NULL;
|
yop->video_packet.buf = NULL;
|
||||||
#if FF_API_DESTRUCT_PACKET
|
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
yop->video_packet.destruct = NULL;
|
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
yop->video_packet.size = 0;
|
yop->video_packet.size = 0;
|
||||||
pkt->data[0] = yop->odd_frame;
|
pkt->data[0] = yop->odd_frame;
|
||||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||||
|
Loading…
Reference in New Issue
Block a user