|
|
@ -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; |
|
|
|
|
|
|
|
|
|
|
|