Rename `av_init_packet`, `av_shrink_packet`, `av_grow_packet` and
`av_new_packet` to use the `av_packet_` namespace.
---
avconv.c | 12 ++++-----
avplay.c | 6 ++---
avprobe.c | 2 +-
doc/examples/avcodec.c | 8 +++---
doc/examples/output.c | 4 +--
doc/examples/transcode_aac.c | 2 +-
libavcodec/aliaspixenc.c | 2 +-
libavcodec/asvenc.c | 2 +-
libavcodec/avcodec.h | 58 ++++++++++++++++++++++++++++++++++++-----
libavcodec/avpacket.c | 29 ++++++++++++++++++---
libavcodec/hapenc.c | 2 +-
libavcodec/huffyuvenc.c | 2 +-
libavcodec/internal.h | 2 +-
libavcodec/lclenc.c | 2 +-
libavcodec/libopusenc.c | 2 +-
libavcodec/libtwolame.c | 2 +-
libavcodec/libwavpackenc.c | 2 +-
libavcodec/libxvid.c | 2 +-
libavcodec/mmaldec.c | 2 +-
libavcodec/mpegvideo_enc.c | 2 +-
libavcodec/pngenc.c | 2 +-
libavcodec/proresenc.c | 2 +-
libavcodec/qsvenc.c | 2 +-
libavcodec/sp5xdec.c | 2 +-
libavcodec/svq1enc.c | 2 +-
libavcodec/tdsc.c | 2 +-
libavcodec/tiffenc.c | 2 +-
libavcodec/utils.c | 10 +++----
libavcodec/webp.c | 2 +-
libavdevice/alsa_dec.c | 2 +-
libavdevice/bktr.c | 2 +-
libavdevice/fbdev.c | 2 +-
libavdevice/jack.c | 2 +-
libavdevice/libcdio.c | 2 +-
libavdevice/libdc1394.c | 2 +-
libavdevice/oss_dec.c | 2 +-
libavdevice/pulse.c | 2 +-
libavdevice/sndio_dec.c | 2 +-
libavdevice/v4l2.c | 4 +--
libavdevice/vfwcap.c | 2 +-
libavdevice/x11grab.c | 2 +-
libavdevice/xcbgrab.c | 2 +-
libavformat/4xm.c | 2 +-
libavformat/amr.c | 2 +-
libavformat/ape.c | 2 +-
libavformat/asfdec.c | 14 +++++-----
libavformat/assdec.c | 2 +-
libavformat/audiointerleave.c | 2 +-
libavformat/avienc.c | 2 +-
libavformat/aviobuf.c | 6 ++---
libavformat/avisynth.c | 4 +--
libavformat/avs.c | 2 +-
libavformat/bethsoftvid.c | 2 +-
libavformat/bmv.c | 4 +--
libavformat/c93.c | 2 +-
libavformat/cdxl.c | 4 +--
libavformat/dsicin.c | 4 +--
libavformat/dss.c | 4 +--
libavformat/dv.c | 4 +--
libavformat/dxa.c | 4 +--
libavformat/flac_picture.c | 2 +-
libavformat/flic.c | 4 +--
libavformat/g723_1.c | 2 +-
libavformat/hls.c | 2 +-
libavformat/hnm.c | 2 +-
libavformat/id3v2.c | 2 +-
libavformat/idroqdec.c | 2 +-
libavformat/ilbc.c | 2 +-
libavformat/img2dec.c | 2 +-
libavformat/ingenientdec.c | 2 +-
libavformat/ipmovie.c | 2 +-
libavformat/jvdec.c | 2 +-
libavformat/lxfdec.c | 2 +-
libavformat/matroskadec.c | 10 +++----
libavformat/matroskaenc.c | 2 +-
libavformat/mm.c | 2 +-
libavformat/mmf.c | 2 +-
libavformat/movenchint.c | 2 +-
libavformat/mpc.c | 2 +-
libavformat/mpegts.c | 4 +--
libavformat/mpegtsenc.c | 2 +-
libavformat/mux.c | 4 +--
libavformat/mxfdec.c | 4 +--
libavformat/mxfenc.c | 2 +-
libavformat/nutdec.c | 2 +-
libavformat/nuv.c | 4 +--
libavformat/oggdec.c | 2 +-
libavformat/paf.c | 4 +--
libavformat/psxstr.c | 4 +--
libavformat/rawdec.c | 2 +-
libavformat/rmdec.c | 8 +++---
libavformat/rtpdec.c | 4 +--
libavformat/rtpdec_ac3.c | 2 +-
libavformat/rtpdec_amr.c | 2 +-
libavformat/rtpdec_h263.c | 2 +-
libavformat/rtpdec_h264.c | 6 ++---
libavformat/rtpdec_hevc.c | 2 +-
libavformat/rtpdec_latm.c | 2 +-
libavformat/rtpdec_mpa_robust.c | 4 +--
libavformat/rtpdec_mpeg12.c | 2 +-
libavformat/rtpdec_mpeg4.c | 6 ++---
libavformat/rtpdec_qcelp.c | 6 ++---
libavformat/rtpdec_qdm2.c | 2 +-
libavformat/rtpdec_qt.c | 6 ++---
libavformat/rtpdec_xiph.c | 4 +--
libavformat/rtpenc_mpegts.c | 2 +-
libavformat/segafilm.c | 2 +-
libavformat/sierravmd.c | 2 +-
libavformat/siff.c | 2 +-
libavformat/smacker.c | 4 +--
libavformat/spdifdec.c | 2 +-
libavformat/srtdec.c | 2 +-
libavformat/swfdec.c | 2 +-
libavformat/tiertexseq.c | 2 +-
libavformat/utils.c | 10 +++----
libavformat/vqf.c | 2 +-
libavformat/wc3movie.c | 2 +-
libavformat/westwood_aud.c | 2 +-
libavformat/westwood_vqa.c | 2 +-
libavformat/wvdec.c | 4 +--
libavformat/xmv.c | 2 +-
libavformat/yop.c | 4 +--
tools/pktdumper.c | 2 +-
123 files changed, 260 insertions(+), 195 deletions(-)
diff --git a/avconv.c b/avconv.c
index 34f3d42..2b40e47 100644
--- a/avconv.c
+++ b/avconv.c
@@ -356,7 +356,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream
*ost,
AVPacket pkt;
int got_packet = 0;
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
pkt.data = NULL;
pkt.size = 0;
@@ -431,7 +431,7 @@ static void do_subtitle_out(AVFormatContext *s,
exit_program(1);
}
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
pkt.data = subtitle_out;
pkt.size = subtitle_out_size;
pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
@@ -481,7 +481,7 @@ static void do_video_out(AVFormatContext *s,
if (!ost->frame_number)
ost->first_pts = in_picture->pts;
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
pkt.data = NULL;
pkt.size = 0;
@@ -960,7 +960,7 @@ static void flush_encoders(void)
if (encode) {
AVPacket pkt;
int got_packet;
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
pkt.data = NULL;
pkt.size = 0;
@@ -1011,7 +1011,7 @@ static void do_streamcopy(InputStream *ist, OutputStream
*ost, const AVPacket *p
int64_t ost_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q,
ost->st->time_base);
AVPacket opkt;
- av_init_packet(&opkt);
+ av_packet_init(&opkt);
if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) &&
!ost->copy_initial_nonkeyframes)
@@ -1313,7 +1313,7 @@ static void process_input_packet(InputStream *ist, const
AVPacket *pkt, int no_e
if (!pkt) {
/* EOF handling */
- av_init_packet(&avpkt);
+ av_packet_init(&avpkt);
avpkt.data = NULL;
avpkt.size = 0;
goto handle_eof;
diff --git a/avplay.c b/avplay.c
index f934c3d..aab3a07 100644
--- a/avplay.c
+++ b/avplay.c
@@ -2465,7 +2465,7 @@ static int decode_thread(void *arg)
}
if (eof) {
if (is->video_stream >= 0) {
- av_init_packet(pkt);
+ av_packet_init(pkt);
pkt->data = NULL;
pkt->size = 0;
pkt->stream_index = is->video_stream;
@@ -2473,7 +2473,7 @@ static int decode_thread(void *arg)
}
if (is->audio_stream >= 0 &&
(is->audio_st->codec->codec->capabilities &
AV_CODEC_CAP_DELAY)) {
- av_init_packet(pkt);
+ av_packet_init(pkt);
pkt->data = NULL;
pkt->size = 0;
pkt->stream_index = is->audio_stream;
@@ -3053,7 +3053,7 @@ int main(int argc, char **argv)
SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
- av_init_packet(&flush_pkt);
+ av_packet_init(&flush_pkt);
flush_pkt.data = (uint8_t *)&flush_pkt;
cur_stream = stream_open(input_filename, file_iformat);
diff --git a/avprobe.c b/avprobe.c
index a83fa68..fd759bd 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -587,7 +587,7 @@ static void show_packets(AVFormatContext *fmt_ctx)
{
AVPacket pkt;
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
probe_array_header("packets", 0);
while (!av_read_frame(fmt_ctx, &pkt))
show_packet(fmt_ctx, &pkt);
diff --git a/doc/examples/avcodec.c b/doc/examples/avcodec.c
index df0af4b..76430fa 100644
--- a/doc/examples/avcodec.c
+++ b/doc/examples/avcodec.c
@@ -187,7 +187,7 @@ static void audio_encode_example(const char *filename)
t = 0;
tincr = 2 * M_PI * 440.0 / c->sample_rate;
for(i=0;i<200;i++) {
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
@@ -230,7 +230,7 @@ static void audio_decode_example(const char *outfilename,
const char *filename)
AVPacket avpkt;
AVFrame *decoded_frame = NULL;
- av_init_packet(&avpkt);
+ av_packet_init(&avpkt);
printf("Audio decoding\n");
@@ -370,7 +370,7 @@ static void video_encode_example(const char *filename)
/* encode 1 second of video */
for(i=0;i<25;i++) {
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
@@ -463,7 +463,7 @@ static void video_decode_example(const char *outfilename,
const char *filename)
char buf[1024];
AVPacket avpkt;
- av_init_packet(&avpkt);
+ av_packet_init(&avpkt);
/* set end of buffer to 0 (this ensures that no overreading happens for
damaged mpeg streams) */
memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);
diff --git a/doc/examples/output.c b/doc/examples/output.c
index c883429..f4c0843 100644
--- a/doc/examples/output.c
+++ b/doc/examples/output.c
@@ -223,7 +223,7 @@ static int encode_audio_frame(AVFormatContext *oc,
OutputStream *ost,
AVPacket pkt = { 0 }; // data and size must be 0;
int got_packet;
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
avcodec_encode_audio2(ost->st->codec, &pkt, frame, &got_packet);
if (got_packet) {
@@ -498,7 +498,7 @@ static int write_video_frame(AVFormatContext *oc,
OutputStream *ost)
frame = get_video_frame(ost);
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
/* encode the image */
ret = avcodec_encode_video2(c, &pkt, frame, &got_packet);
diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 3eebfb9..360081f 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -212,7 +212,7 @@ cleanup:
/** Initialize one data packet for reading or writing. */
static void init_packet(AVPacket *packet)
{
- av_init_packet(packet);
+ av_packet_init(packet);
/** Set the packet data and size so that it is recognized as being empty.
*/
packet->data = NULL;
packet->size = 0;
diff --git a/libavcodec/aliaspixenc.c b/libavcodec/aliaspixenc.c
index 63016af..0a43755 100644
--- a/libavcodec/aliaspixenc.c
+++ b/libavcodec/aliaspixenc.c
@@ -103,7 +103,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
/* Total length */
- av_shrink_packet(pkt, buf - pkt->data);
+ av_packet_shrink(pkt, buf - pkt->data);
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c
index ac7c317..894c865 100644
--- a/libavcodec/asvenc.c
+++ b/libavcodec/asvenc.c
@@ -222,7 +222,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket
*pkt,
int mb_x, mb_y;
if (!pkt->data &&
- (ret = av_new_packet(pkt, a->mb_height * a->mb_width * MAX_MB_SIZE +
+ (ret = av_packet_new(pkt, a->mb_height * a->mb_width * MAX_MB_SIZE +
AV_INPUT_BUFFER_MIN_SIZE)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index a370e3e..91ba23f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3420,7 +3420,7 @@ void avsubtitle_free(AVSubtitle *sub);
*
* @param pkt packet
*/
-void av_init_packet(AVPacket *pkt);
+void av_packet_init(AVPacket *pkt);
/**
* Allocate the payload of a packet and initialize its fields with
@@ -3430,7 +3430,7 @@ void av_init_packet(AVPacket *pkt);
* @param size wanted payload size
* @return 0 if OK, AVERROR_xxx otherwise
*/
-int av_new_packet(AVPacket *pkt, int size);
+int av_packet_new(AVPacket *pkt, int size);
/**
* Reduce packet size, correctly zeroing padding
@@ -3438,7 +3438,7 @@ int av_new_packet(AVPacket *pkt, int size);
* @param pkt packet
* @param size new size
*/
-void av_shrink_packet(AVPacket *pkt, int size);
+void av_packet_shrink(AVPacket *pkt, int size);
/**
* Increase packet size, correctly zeroing padding
@@ -3446,7 +3446,7 @@ void av_shrink_packet(AVPacket *pkt, int size);
* @param pkt packet
* @param grow_by number of bytes by which to increase the size of the packet
*/
-int av_grow_packet(AVPacket *pkt, int grow_by);
+int av_packet_grow(AVPacket *pkt, int grow_by);
/**
* Initialize a reference-counted packet from av_malloc()ed data.
@@ -3465,6 +3465,50 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data,
int size);
#if FF_API_AVPACKET_OLD_API
/**
+ * Initialize optional fields of a packet with default values.
+ *
+ * Note, this does not touch the data and size members, which have to be
+ * initialized separately.
+ *
+ * @param pkt packet
+ * @deprecated Use av_packet_init
+ */
+attribute_deprecated
+void av_init_packet(AVPacket *pkt);
+
+/**
+ * Allocate the payload of a packet and initialize its fields with
+ * default values.
+ *
+ * @param pkt packet
+ * @param size wanted payload size
+ * @return 0 if OK, AVERROR_xxx otherwise
+ * @deprecated Use av_packet_new
+ */
+attribute_deprecated
+int av_new_packet(AVPacket *pkt, int size);
+
+/**
+ * Reduce packet size, correctly zeroing padding
+ *
+ * @param pkt packet
+ * @param size new size
+ * @deprecated Use av_packet_shrink
+ */
+attribute_deprecated
+void av_shrink_packet(AVPacket *pkt, int size);
+
+/**
+ * Increase packet size, correctly zeroing padding
+ *
+ * @param pkt packet
+ * @param grow_by number of bytes by which to increase the size of the packet
+ * @deprecated Use av_packet_grow
+ */
+attribute_deprecated
+int av_grow_packet(AVPacket *pkt, int grow_by);
+
+/**
* @warning This is a hack - the packet memory allocation stuff is broken. The
* packet is allocated if it was not really allocated.
*
@@ -3743,7 +3787,7 @@ int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame
*frame,
* decoder. The caller may not write to it.
*
* @param[in] avpkt The input AVpacket containing the input buffer.
- * You can create such packet with av_init_packet() and by then
setting
+ * You can create such packet with av_packet_init() and by then
setting
* data and size, some decoders might in addition need other fields
like
* flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
* fields possible.
@@ -4061,7 +4105,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name);
* avpkt->data and avpkt->size prior to calling the
* function, but if the size of the user-provided data is not
* large enough, encoding will fail. All other AVPacket fields
- * will be reset by the encoder using av_init_packet(). If
+ * will be reset by the encoder using av_packet_init(). If
* avpkt->data is NULL, the encoder will allocate it.
* The encoder will set avpkt->size to the size of the
* output packet.
@@ -4101,7 +4145,7 @@ int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket
*avpkt,
* avpkt->data and avpkt->size prior to calling the
* function, but if the size of the user-provided data is not
* large enough, encoding will fail. All other AVPacket fields
- * will be reset by the encoder using av_init_packet(). If
+ * will be reset by the encoder using av_packet_init(). If
* avpkt->data is NULL, the encoder will allocate it.
* The encoder will set avpkt->size to the size of the
* output packet. The returned data (if any) belongs to the
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index cec5bf8..59a6adf 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -28,7 +28,7 @@
#include "libavutil/mem.h"
#include "avcodec.h"
-void av_init_packet(AVPacket *pkt)
+void av_packet_init(AVPacket *pkt)
{
pkt->pts = AV_NOPTS_VALUE;
pkt->dts = AV_NOPTS_VALUE;
@@ -61,7 +61,7 @@ static int packet_alloc(AVBufferRef **buf, int size)
return 0;
}
-int av_new_packet(AVPacket *pkt, int size)
+int av_packet_new(AVPacket *pkt, int size)
{
AVBufferRef *buf = NULL;
int ret = packet_alloc(&buf, size);
@@ -76,7 +76,7 @@ int av_new_packet(AVPacket *pkt, int size)
return 0;
}
-void av_shrink_packet(AVPacket *pkt, int size)
+void av_packet_shrink(AVPacket *pkt, int size)
{
if (pkt->size <= size)
return;
@@ -84,7 +84,7 @@ void av_shrink_packet(AVPacket *pkt, int size)
memset(pkt->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
}
-int av_grow_packet(AVPacket *pkt, int grow_by)
+int av_packet_grow(AVPacket *pkt, int grow_by)
{
int new_size;
av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
@@ -130,6 +130,27 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int
size)
#if FF_API_AVPACKET_OLD_API
FF_DISABLE_DEPRECATION_WARNINGS
+
+void av_init_packet(AVPacket *pkt)
+{
+ av_packet_init(pkt);
+}
+
+int av_new_packet(AVPacket *pkt, int size)
+{
+ return av_packet_new(pkt, size);
+}
+
+void av_shrink_packet(AVPacket *pkt, int size)
+{
+ av_packet_shrink(pkt, size);
+}
+
+int av_grow_packet(AVPacket *pkt, int grow_by)
+{
+ return av_packet_grow(pkt, grow_by);
+}
+
#define ALLOC_MALLOC(data, size) data = av_malloc(size)
#define ALLOC_BUF(data, size) \
do { \
diff --git a/libavcodec/hapenc.c b/libavcodec/hapenc.c
index 4a31447..f2c400b 100644
--- a/libavcodec/hapenc.c
+++ b/libavcodec/hapenc.c
@@ -211,7 +211,7 @@ static int hap_encode(AVCodecContext *avctx, AVPacket *pkt,
/* Write header at the start. */
hap_write_frame_header(ctx, pkt->data, final_data_size + header_length);
- av_shrink_packet(pkt, final_data_size + header_length);
+ av_packet_shrink(pkt, final_data_size + header_length);
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index c18b38c..00266e9 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -453,7 +453,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket
*pkt,
int i, j, size = 0, ret;
if (!pkt->data &&
- (ret = av_new_packet(pkt, width * height * 3 * 4 +
AV_INPUT_BUFFER_MIN_SIZE)) < 0) {
+ (ret = av_packet_new(pkt, width * height * 3 * 4 +
AV_INPUT_BUFFER_MIN_SIZE)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error allocating output packet.\n");
return ret;
}
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 500511d..6ac241f 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -177,7 +177,7 @@ int avpriv_unlock_avformat(void);
* to ensure it is large enough.
* If avpkt->data is NULL, a new buffer is allocated.
* avpkt->size is set to the specified size.
- * All other AVPacket fields will be reset with
av_init_packet().
+ * All other AVPacket fields will be reset with
av_packet_init().
* @param size the minimum required packet size
* @return 0 on success, negative error code on failure
*/
diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c
index a73f6d6..5fccdf6 100644
--- a/libavcodec/lclenc.c
+++ b/libavcodec/lclenc.c
@@ -80,7 +80,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int max_size = deflateBound(&c->zstream, avctx->width * avctx->height * 3);
if (!pkt->data &&
- (ret = av_new_packet(pkt, max_size)) < 0) {
+ (ret = av_packet_new(pkt, max_size)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error allocating packet of size
%d.\n", max_size);
return ret;
}
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 08f0f28..4da31bb 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -347,7 +347,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket
*avpkt,
return ff_opus_error_to_averror(ret);
}
- av_shrink_packet(avpkt, ret);
+ av_packet_shrink(avpkt, ret);
ff_af_queue_remove(&opus->afq, opus->opts.packet_size,
&avpkt->pts, &avpkt->duration);
diff --git a/libavcodec/libtwolame.c b/libavcodec/libtwolame.c
index 714c30a..ddfab92 100644
--- a/libavcodec/libtwolame.c
+++ b/libavcodec/libtwolame.c
@@ -159,7 +159,7 @@ static int twolame_encode_frame(AVCodecContext *avctx,
AVPacket *avpkt,
if (avpkt->pts != AV_NOPTS_VALUE)
s->next_pts = avpkt->pts + avpkt->duration;
- av_shrink_packet(avpkt, ret);
+ av_packet_shrink(avpkt, ret);
*got_packet_ptr = 1;
return 0;
}
diff --git a/libavcodec/libwavpackenc.c b/libavcodec/libwavpackenc.c
index 1455d91..4238f54 100644
--- a/libavcodec/libwavpackenc.c
+++ b/libavcodec/libwavpackenc.c
@@ -94,7 +94,7 @@ static int encode_callback(void *id, void *data, int32_t
count)
}
s->pkt->size += count;
} else {
- ret = av_grow_packet(s->pkt, count);
+ ret = av_packet_grow(s->pkt, count);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error allocating output packet.\n");
return 0;
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index e747374..0303c39 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -692,7 +692,7 @@ static int xvid_encode_frame(AVCodecContext *avctx,
AVPacket *pkt,
xvid_enc_stats_t xvid_enc_stats = { 0 };
if (!user_packet &&
- (ret = av_new_packet(pkt, mb_width * mb_height * MAX_MB_BYTES +
AV_INPUT_BUFFER_MIN_SIZE)) < 0) {
+ (ret = av_packet_new(pkt, mb_width * mb_height * MAX_MB_BYTES +
AV_INPUT_BUFFER_MIN_SIZE)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
}
diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index 15b887c..e01d544 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -727,7 +727,7 @@ static int ffmmal_decode(AVCodecContext *avctx, void *data,
int *got_frame,
if (avctx->extradata_size && !ctx->extradata_sent) {
AVPacket pkt = {0};
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
pkt.data = avctx->extradata;
pkt.size = avctx->extradata_size;
ctx->extradata_sent = 1;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 9e9c6b6..7b85595 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1130,7 +1130,7 @@ static int encode_frame(AVCodecContext *c, AVFrame *frame)
AVPacket pkt = { 0 };
int ret, got_output;
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
if (ret < 0)
return ret;
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 6ab4b7f..e7443f3 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -299,7 +299,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket
*pkt,
((enc_row_size + IOBUF_SIZE - 1) /
IOBUF_SIZE) * 12)
+ AV_INPUT_BUFFER_MIN_SIZE;
if (!pkt->data &&
- (ret = av_new_packet(pkt, max_packet_size)) < 0) {
+ (ret = av_packet_new(pkt, max_packet_size)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate output packet of size
%d.\n",
max_packet_size);
return ret;
diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c
index 0564b12..db25199 100644
--- a/libavcodec/proresenc.c
+++ b/libavcodec/proresenc.c
@@ -1046,7 +1046,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
ctx->warn = 1;
}
- ret = av_grow_packet(pkt, delta);
+ ret = av_packet_grow(pkt, delta);
if (ret < 0)
return ret;
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index d6a731f..52eaef9 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -387,7 +387,7 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q,
}
}
- ret = av_new_packet(&new_pkt, q->packet_size);
+ ret = av_packet_new(&new_pkt, q->packet_size);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error allocating the output packet\n");
return ret;
diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c
index 7f57b63..a633dbd 100644
--- a/libavcodec/sp5xdec.c
+++ b/libavcodec/sp5xdec.c
@@ -84,7 +84,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
recoded[j++] = 0xFF;
recoded[j++] = 0xD9;
- av_init_packet(&avpkt_recoded);
+ av_packet_init(&avpkt_recoded);
avpkt_recoded.data = recoded;
avpkt_recoded.size = j;
i = ff_mjpeg_decode_frame(avctx, data, got_frame, &avpkt_recoded);
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index a869c24..8c6289e 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -585,7 +585,7 @@ static int svq1_encode_frame(AVCodecContext *avctx,
AVPacket *pkt,
uint8_t *sd;
if (!pkt->data &&
- (ret = av_new_packet(pkt, s->y_block_width * s->y_block_height *
+ (ret = av_packet_new(pkt, s->y_block_width * s->y_block_height *
MAX_MB_BYTES * 3 + AV_INPUT_BUFFER_MIN_SIZE)) <
0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
diff --git a/libavcodec/tdsc.c b/libavcodec/tdsc.c
index 9e1ef2d..74bc42b 100644
--- a/libavcodec/tdsc.c
+++ b/libavcodec/tdsc.c
@@ -347,7 +347,7 @@ static int tdsc_decode_jpeg_tile(AVCodecContext *avctx, int
tile_size,
int ret;
/* Prepare a packet and send to the MJPEG decoder */
- av_init_packet(&jpkt);
+ av_packet_init(&jpkt);
jpkt.data = ctx->tilebuffer;
jpkt.size = tile_size;
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 7c23ee2..048d659 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -312,7 +312,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket
*pkt,
avctx->height * 4 + AV_INPUT_BUFFER_MIN_SIZE;
if (!pkt->data &&
- (ret = av_new_packet(pkt, packet_size)) < 0) {
+ (ret = av_packet_new(pkt, packet_size)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
}
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index bb90d80..30a014d 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1138,12 +1138,12 @@ int ff_alloc_packet(AVPacket *avpkt, int size)
if (avpkt->size < size)
return AVERROR(EINVAL);
- av_init_packet(avpkt);
+ av_packet_init(avpkt);
avpkt->buf = buf;
avpkt->size = size;
return 0;
} else {
- return av_new_packet(avpkt, size);
+ return av_packet_new(avpkt, size);
}
}
@@ -1200,7 +1200,7 @@ int attribute_align_arg
avcodec_encode_audio2(AVCodecContext *avctx,
if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) && !frame) {
av_packet_unref(avpkt);
- av_init_packet(avpkt);
+ av_packet_init(avpkt);
return 0;
}
@@ -1276,7 +1276,7 @@ int attribute_align_arg
avcodec_encode_audio2(AVCodecContext *avctx,
if (ret < 0 || !*got_packet_ptr) {
av_packet_unref(avpkt);
- av_init_packet(avpkt);
+ av_packet_init(avpkt);
goto end;
}
@@ -1307,7 +1307,7 @@ int attribute_align_arg
avcodec_encode_video2(AVCodecContext *avctx,
if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) && !frame) {
av_packet_unref(avpkt);
- av_init_packet(avpkt);
+ av_packet_init(avpkt);
avpkt->size = 0;
return 0;
}
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index c475744..bb3e385 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1314,7 +1314,7 @@ static int vp8_lossy_decode_frame(AVCodecContext *avctx,
AVFrame *p,
return AVERROR_PATCHWELCOME;
}
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
pkt.data = data_start;
pkt.size = data_size;
diff --git a/libavdevice/alsa_dec.c b/libavdevice/alsa_dec.c
index e7819ec..1290577 100644
--- a/libavdevice/alsa_dec.c
+++ b/libavdevice/alsa_dec.c
@@ -122,7 +122,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket
*pkt)
snd_htimestamp_t timestamp;
snd_pcm_uframes_t ts_delay;
- if (av_new_packet(pkt, s->period_size) < 0) {
+ if (av_packet_new(pkt, s->period_size) < 0) {
return AVERROR(EIO);
}
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 8042c38..c27c104 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -245,7 +245,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket
*pkt)
{
VideoData *s = s1->priv_data;
- if (av_new_packet(pkt, video_buf_size) < 0)
+ if (av_packet_new(pkt, video_buf_size) < 0)
return AVERROR(EIO);
bktr_getframe(s->per_frame);
diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c
index bdbc83f..1c0ab68 100644
--- a/libavdevice/fbdev.c
+++ b/libavdevice/fbdev.c
@@ -213,7 +213,7 @@ static int fbdev_read_packet(AVFormatContext *avctx,
AVPacket *pkt)
/* compute the time of the next frame */
fbdev->time_frame += INT64_C(1000000) / av_q2d(fbdev->framerate_q);
- if ((ret = av_new_packet(pkt, fbdev->frame_size)) < 0)
+ if ((ret = av_packet_new(pkt, fbdev->frame_size)) < 0)
return ret;
/* refresh fbdev->varinfo, visible data position may change at each call */
diff --git a/libavdevice/jack.c b/libavdevice/jack.c
index 24c23e8..f010966 100644
--- a/libavdevice/jack.c
+++ b/libavdevice/jack.c
@@ -138,7 +138,7 @@ static int supply_new_packets(JackData *self,
AVFormatContext *context)
* packets FIFO buffer with as many packets as possible. process_callback()
* can't do this by itself, because it can't allocate memory in realtime.
*/
while (av_fifo_space(self->new_pkts) >= sizeof(pkt)) {
- if ((test = av_new_packet(&pkt, pkt_size)) < 0) {
+ if ((test = av_packet_new(&pkt, pkt_size)) < 0) {
av_log(context, AV_LOG_ERROR, "Could not create packet of size
%d\n", pkt_size);
return test;
}
diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c
index 06ddb4a..51246e6 100644
--- a/libavdevice/libcdio.c
+++ b/libavdevice/libcdio.c
@@ -136,7 +136,7 @@ static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
err = NULL;
}
- if ((ret = av_new_packet(pkt, CDIO_CD_FRAMESIZE_RAW)) < 0)
+ if ((ret = av_packet_new(pkt, CDIO_CD_FRAMESIZE_RAW)) < 0)
return ret;
memcpy(pkt->data, buf, CDIO_CD_FRAMESIZE_RAW);
return 0;
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
index 20696f5..21d3c6a 100644
--- a/libavdevice/libdc1394.c
+++ b/libavdevice/libdc1394.c
@@ -178,7 +178,7 @@ static inline int dc1394_read_common(AVFormatContext *c,
vst->codec->pix_fmt = fmt->pix_fmt;
/* packet init */
- av_init_packet(&dc1394->packet);
+ av_packet_init(&dc1394->packet);
dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width,
fmt->height);
dc1394->packet.stream_index = vst->index;
dc1394->packet.flags |= AV_PKT_FLAG_KEY;
diff --git a/libavdevice/oss_dec.c b/libavdevice/oss_dec.c
index 24d3571..b312755 100644
--- a/libavdevice/oss_dec.c
+++ b/libavdevice/oss_dec.c
@@ -77,7 +77,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket
*pkt)
int64_t cur_time;
struct audio_buf_info abufi;
- if ((ret=av_new_packet(pkt, s->frame_size)) < 0)
+ if ((ret=av_packet_new(pkt, s->frame_size)) < 0)
return ret;
ret = read(s->fd, pkt->data, pkt->size);
diff --git a/libavdevice/pulse.c b/libavdevice/pulse.c
index 0e8bd09..30aa73a 100644
--- a/libavdevice/pulse.c
+++ b/libavdevice/pulse.c
@@ -126,7 +126,7 @@ static int pulse_read_packet(AVFormatContext *s, AVPacket
*pkt)
int res;
pa_usec_t latency;
- if (av_new_packet(pkt, pd->frame_size) < 0) {
+ if (av_packet_new(pkt, pd->frame_size) < 0) {
return AVERROR(ENOMEM);
}
diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c
index 5d40a7a..806f515 100644
--- a/libavdevice/sndio_dec.c
+++ b/libavdevice/sndio_dec.c
@@ -62,7 +62,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket
*pkt)
int64_t bdelay, cur_time;
int ret;
- if ((ret = av_new_packet(pkt, s->buffer_size)) < 0)
+ if ((ret = av_packet_new(pkt, s->buffer_size)) < 0)
return ret;
ret = sio_read(s->hdl, pkt->data, pkt->size);
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 9125fca..6e9a38b 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -497,7 +497,7 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket
*pkt)
/* Image is at s->buff_start[buf.index] */
if (avpriv_atomic_int_get(&s->buffers_queued) == FFMAX(s->buffers / 8, 1))
{
/* when we start getting low on queued buffers, fall back on copying
data */
- res = av_new_packet(pkt, buf.bytesused);
+ res = av_packet_new(pkt, buf.bytesused);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "Error allocating a packet.\n");
return res;
@@ -861,7 +861,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
int res;
- av_init_packet(pkt);
+ av_packet_init(pkt);
if ((res = mmap_read_frame(s1, pkt)) < 0) {
return res;
}
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index cc73e82..ccc2c6e 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -193,7 +193,7 @@ static LRESULT CALLBACK videostream_cb(HWND hwnd,
LPVIDEOHDR vdhdr)
if(!pktl_next)
goto fail;
- if(av_new_packet(&pktl_next->pkt, vdhdr->dwBytesUsed) < 0) {
+ if(av_packet_new(&pktl_next->pkt, vdhdr->dwBytesUsed) < 0) {
av_free(pktl_next);
goto fail;
}
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index b2721ae..7a3028d 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -510,7 +510,7 @@ static int x11grab_read_packet(AVFormatContext *s1,
AVPacket *pkt)
nanosleep(&ts, NULL);
}
- av_init_packet(pkt);
+ av_packet_init(pkt);
pkt->data = image->data;
pkt->size = s->frame_size;
pkt->pts = curtime;
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 356518a..8ccda97 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -171,7 +171,7 @@ static int xcbgrab_frame(AVFormatContext *s, AVPacket *pkt)
data = xcb_get_image_data(img);
length = xcb_get_image_data_length(img);
- ret = av_new_packet(pkt, length);
+ ret = av_packet_new(pkt, length);
if (!ret)
memcpy(pkt->data, data, length);
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 530863f..81d0200 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -299,7 +299,7 @@ static int fourxm_read_packet(AVFormatContext *s,
case cfr2_TAG:
/* allocate 8 more bytes than 'size' to account for fourcc
* and size */
- if (size + 8 < size || av_new_packet(pkt, size + 8))
+ if (size + 8 < size || av_packet_new(pkt, size + 8))
return AVERROR(EIO);
pkt->stream_index = fourxm->video_stream_index;
pkt->pts = fourxm->video_pts;
diff --git a/libavformat/amr.c b/libavformat/amr.c
index b57a568..fba99fe 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -135,7 +135,7 @@ static int amr_read_packet(AVFormatContext *s, AVPacket
*pkt)
assert(0);
}
- if (!size || av_new_packet(pkt, size))
+ if (!size || av_packet_new(pkt, size))
return AVERROR(EIO);
/* Both AMR formats have 50 frames per second */
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 09a756d..3c968c2 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -407,7 +407,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket *
pkt)
return AVERROR(EIO);
}
- if (av_new_packet(pkt, ape->frames[ape->currentframe].size + extra_size)
< 0)
+ if (av_packet_new(pkt, ape->frames[ape->currentframe].size + extra_size)
< 0)
return AVERROR(ENOMEM);
AV_WL32(pkt->data , nblocks);
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 35c5185..a26ba90 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -775,7 +775,7 @@ static int asf_read_stream_properties(AVFormatContext *s,
const GUIDParseTable *
asf_st->index = st->index;
asf_st->indexed = 0;
st->id = flags & ASF_STREAM_NUM;
- av_init_packet(&asf_st->pkt.avpkt);
+ av_packet_init(&asf_st->pkt.avpkt);
asf_st->pkt.data_size = 0;
avio_skip(pb, 4); // skip reserved field
@@ -1129,7 +1129,7 @@ static void reset_packet(ASFPacket *asf_pkt)
asf_pkt->dts = 0;
asf_pkt->duration = 0;
av_packet_unref(&asf_pkt->avpkt);
- av_init_packet(&asf_pkt->avpkt);
+ av_packet_init(&asf_pkt->avpkt);
}
static int asf_read_replicated_data(AVFormatContext *s, ASFPacket *asf_pkt)
@@ -1142,7 +1142,7 @@ static int asf_read_replicated_data(AVFormatContext *s,
ASFPacket *asf_pkt)
asf_pkt->data_size = asf_pkt->size_left = avio_rl32(pb); // read media
object size
if (asf_pkt->data_size <= 0)
return AVERROR_INVALIDDATA;
- if ((ret = av_new_packet(&asf_pkt->avpkt, asf_pkt->data_size)) < 0)
+ if ((ret = av_packet_new(&asf_pkt->avpkt, asf_pkt->data_size)) < 0)
return ret;
} else
avio_skip(pb, 4); // reading of media object size is already done
@@ -1218,7 +1218,7 @@ static int asf_read_single_payload(AVFormatContext *s,
AVPacket *pkt,
asf_pkt->data_size = asf_pkt->size_left = avio_rl32(pb); // read media
object size
if (asf_pkt->data_size <= 0)
return AVERROR_EOF;
- if ((ret = av_new_packet(&asf_pkt->avpkt, asf_pkt->data_size)) < 0)
+ if ((ret = av_packet_new(&asf_pkt->avpkt, asf_pkt->data_size)) < 0)
return ret;
} else
avio_skip(pb, 4); // skip media object size
@@ -1371,7 +1371,7 @@ static int asf_deinterleave(AVFormatContext *s, ASFPacket
*asf_pkt, int st_num)
int pos = 0, j, l, ret;
- if ((ret = av_new_packet(&pkt, asf_pkt->data_size)) < 0)
+ if ((ret = av_packet_new(&pkt, asf_pkt->data_size)) < 0)
return ret;
while (asf_pkt->data_size >= asf_st->span * pkt_len + pos) {
@@ -1522,7 +1522,7 @@ static void reset_packet_state(AVFormatContext *s)
pkt->dts = 0;
pkt->duration = 0;
av_packet_unref(&pkt->avpkt);
- av_init_packet(&pkt->avpkt);
+ av_packet_init(&pkt->avpkt);
}
}
@@ -1560,7 +1560,7 @@ static int64_t asf_read_timestamp(AVFormatContext *s, int
stream_index,
int i, ret, st_found;
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
pkt_offset = avio_tell(s->pb);
if ((ret = asf_read_packet(s, &pkt)) < 0) {
dts = AV_NOPTS_VALUE;
diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index f9f1bdf..73e1470 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -159,7 +159,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
p = ass->event[ass->event_index];
end = strchr(p, '\n');
- ret = av_new_packet(pkt, end ? end - p + 1 : strlen(p));
+ ret = av_packet_new(pkt, end ? end - p + 1 : strlen(p));
if (ret < 0)
return ret;
pkt->flags |= AV_PKT_FLAG_KEY;
diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c
index fd07893..cfe0bc0 100644
--- a/libavformat/audiointerleave.c
+++ b/libavformat/audiointerleave.c
@@ -80,7 +80,7 @@ static int interleave_new_audio_packet(AVFormatContext *s,
AVPacket *pkt,
if (!size || (!flush && size == av_fifo_size(aic->fifo)))
return 0;
- ret = av_new_packet(pkt, size);
+ ret = av_packet_new(pkt, size);
if (ret < 0)
return ret;
av_fifo_generic_read(aic->fifo, pkt->data, size, NULL);
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 9c2936a..a56d695 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -519,7 +519,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket
*pkt)
pkt->dts > avist->packet_count) {
AVPacket empty_packet;
- av_init_packet(&empty_packet);
+ av_packet_init(&empty_packet);
empty_packet.size = 0;
empty_packet.data = NULL;
empty_packet.stream_index = stream_index;
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 6541f69..01a3b8a 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1074,13 +1074,13 @@ static int append_packet_chunked(AVIOContext *s,
AVPacket *pkt, int size)
}
read_size = FFMIN(size, chunk_size);
- ret = av_grow_packet(pkt, read_size);
+ ret = av_packet_grow(pkt, read_size);
if (ret < 0)
break;
ret = avio_read(s, pkt->data + prev_size, read_size);
if (ret != read_size) {
- av_shrink_packet(pkt, prev_size + FFMAX(ret, 0));
+ av_packet_shrink(pkt, prev_size + FFMAX(ret, 0));
break;
}
@@ -1095,7 +1095,7 @@ static int append_packet_chunked(AVIOContext *s, AVPacket
*pkt, int size)
int avio_get_packet(AVIOContext *s, AVPacket *pkt, int size)
{
- av_init_packet(pkt);
+ av_packet_init(pkt);
pkt->data = NULL;
pkt->size = 0;
pkt->pos = avio_tell(s);
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 1a6a73f..b37c517 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -493,7 +493,7 @@ static int avisynth_read_packet_video(AVFormatContext *s,
AVPacket *pkt,
if (!pkt->size)
return AVERROR_UNKNOWN;
- if (av_new_packet(pkt, pkt->size) < 0)
+ if (av_packet_new(pkt, pkt->size) < 0)
return AVERROR(ENOMEM);
pkt->pts = n;
@@ -590,7 +590,7 @@ static int avisynth_read_packet_audio(AVFormatContext *s,
AVPacket *pkt,
if (!pkt->size)
return AVERROR_UNKNOWN;
- if (av_new_packet(pkt, pkt->size) < 0)
+ if (av_packet_new(pkt, pkt->size) < 0)
return AVERROR(ENOMEM);
pkt->pts = n;
diff --git a/libavformat/avs.c b/libavformat/avs.c
index 74721b6..6817d98 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -90,7 +90,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
AvsFormat *avs = s->priv_data;
int ret;
- ret = av_new_packet(pkt, size + palette_size);
+ ret = av_packet_new(pkt, size + palette_size);
if (ret < 0)
return ret;
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 401acd4..f94dda2 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -174,7 +174,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext
*pb, AVPacket *pkt,
} while(code);
// copy data into packet
- if ((ret = av_new_packet(pkt, vidbuf_nbytes)) < 0)
+ if ((ret = av_packet_new(pkt, vidbuf_nbytes)) < 0)
goto fail;
memcpy(pkt->data, vidbuf_start, vidbuf_nbytes);
diff --git a/libavformat/bmv.c b/libavformat/bmv.c
index b5572af..a2d45fe 100644
--- a/libavformat/bmv.c
+++ b/libavformat/bmv.c
@@ -96,7 +96,7 @@ static int bmv_read_packet(AVFormatContext *s, AVPacket *pkt)
audio_size, c->size);
return AVERROR_INVALIDDATA;
}
- if (av_new_packet(pkt, audio_size) < 0)
+ if (av_packet_new(pkt, audio_size) < 0)
return AVERROR(ENOMEM);
memcpy(pkt->data, c->packet + 1, pkt->size);
pkt->stream_index = 1;
@@ -108,7 +108,7 @@ static int bmv_read_packet(AVFormatContext *s, AVPacket
*pkt)
} else
break;
}
- if (av_new_packet(pkt, c->size + 1) < 0)
+ if (av_packet_new(pkt, c->size + 1) < 0)
return AVERROR(ENOMEM);
pkt->stream_index = 0;
c->get_next = 1;
diff --git a/libavformat/c93.c b/libavformat/c93.c
index 3ae99fc..211e3c2 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -150,7 +150,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
c93->frame_offsets[c93->current_frame], SEEK_SET);
datasize = avio_rl16(pb); /* video frame size */
- ret = av_new_packet(pkt, datasize + 768 + 1);
+ ret = av_packet_new(pkt, datasize + 768 + 1);
if (ret < 0)
return ret;
pkt->data[0] = 0;
diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
index d6e8b29..1fababc 100644
--- a/libavformat/cdxl.c
+++ b/libavformat/cdxl.c
@@ -141,7 +141,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket
*pkt)
avpriv_set_pts_info(st, 64, 1, cdxl->sample_rate);
}
- if (av_new_packet(pkt, video_size + CDXL_HEADER_SIZE) < 0)
+ if (av_packet_new(pkt, video_size + CDXL_HEADER_SIZE) < 0)
return AVERROR(ENOMEM);
memcpy(pkt->data, cdxl->header, CDXL_HEADER_SIZE);
ret = avio_read(pb, pkt->data + CDXL_HEADER_SIZE, video_size);
@@ -149,7 +149,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket
*pkt)
av_packet_unref(pkt);
return ret;
}
- av_shrink_packet(pkt, CDXL_HEADER_SIZE + ret);
+ av_packet_shrink(pkt, CDXL_HEADER_SIZE + ret);
pkt->stream_index = cdxl->video_stream_index;
pkt->flags |= AV_PKT_FLAG_KEY;
pkt->pos = pos;
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index bf2adb3..441abae 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -183,7 +183,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket
*pkt)
/* palette and video packet */
pkt_size = (palette_type + 3) * hdr->pal_colors_count +
hdr->video_frame_size;
- ret = av_new_packet(pkt, 4 + pkt_size);
+ ret = av_packet_new(pkt, 4 + pkt_size);
if (ret < 0)
return ret;
@@ -201,7 +201,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket
*pkt)
return ret;
}
if (ret < pkt_size)
- av_shrink_packet(pkt, 4 + ret);
+ av_packet_shrink(pkt, 4 + ret);
/* sound buffer will be processed on next read_packet() call */
cin->audio_buffer_size = hdr->audio_frame_size;
diff --git a/libavformat/dss.c b/libavformat/dss.c
index e9610dd..071e1cc 100644
--- a/libavformat/dss.c
+++ b/libavformat/dss.c
@@ -224,7 +224,7 @@ static int dss_sp_read_packet(AVFormatContext *s, AVPacket
*pkt)
ctx->counter -= read_size;
- ret = av_new_packet(pkt, DSS_FRAME_SIZE);
+ ret = av_packet_new(pkt, DSS_FRAME_SIZE);
if (ret < 0)
return ret;
@@ -278,7 +278,7 @@ static int dss_723_1_read_packet(AVFormatContext *s,
AVPacket *pkt)
ctx->counter -= size;
- ret = av_new_packet(pkt, size);
+ ret = av_packet_new(pkt, size);
if (ret < 0)
return ret;
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 1ba8698..19ae75e 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -248,7 +248,7 @@ static int dv_extract_audio_info(DVDemuxContext *c, uint8_t
*frame)
c->ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
c->ast[i]->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
- av_init_packet(&c->audio_pkt[i]);
+ av_packet_init(&c->audio_pkt[i]);
c->audio_pkt[i].size = 0;
c->audio_pkt[i].data = c->audio_buf[i];
c->audio_pkt[i].stream_index = c->ast[i]->index;
@@ -379,7 +379,7 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket
*pkt,
/* Now it's time to return video packet */
size = dv_extract_video_info(c, buf);
- av_init_packet(pkt);
+ av_packet_init(pkt);
pkt->data = buf;
pkt->size = size;
pkt->flags |= AV_PKT_FLAG_KEY;
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index ad0ea8c..8b96476 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -174,7 +174,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket
*pkt)
avio_read(s->pb, buf, 4);
switch(AV_RL32(buf)){
case MKTAG('N', 'U', 'L', 'L'):
- if(av_new_packet(pkt, 4 + pal_size) < 0)
+ if(av_packet_new(pkt, 4 + pal_size) < 0)
return AVERROR(ENOMEM);
pkt->stream_index = 0;
if(pal_size) memcpy(pkt->data, pal, pal_size);
@@ -196,7 +196,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket
*pkt)
size);
return -1;
}
- if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
+ if(av_packet_new(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
return AVERROR(ENOMEM);
memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
ret = avio_read(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size,
size);
diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
index a6b5537..edcdf7b 100644
--- a/libavformat/flac_picture.c
+++ b/libavformat/flac_picture.c
@@ -123,7 +123,7 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf,
int buf_size)
goto fail;
}
- av_init_packet(&st->attached_pic);
+ av_packet_init(&st->attached_pic);
st->attached_pic.buf = data;
st->attached_pic.data = data->data;
st->attached_pic.size = len;
diff --git a/libavformat/flic.c b/libavformat/flic.c
index 277e12b..6d01e89 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -217,7 +217,7 @@ static int flic_read_packet(AVFormatContext *s,
magic = AV_RL16(&preamble[4]);
if (((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2))
&& size > FLIC_PREAMBLE_SIZE) {
- if (av_new_packet(pkt, size)) {
+ if (av_packet_new(pkt, size)) {
ret = AVERROR(EIO);
break;
}
@@ -233,7 +233,7 @@ static int flic_read_packet(AVFormatContext *s,
}
packet_read = 1;
} else if (magic == FLIC_TFTD_CHUNK_AUDIO) {
- if (av_new_packet(pkt, size)) {
+ if (av_packet_new(pkt, size)) {
ret = AVERROR(EIO);
break;
}
diff --git a/libavformat/g723_1.c b/libavformat/g723_1.c
index 716fbb9..0ee24fc 100644
--- a/libavformat/g723_1.c
+++ b/libavformat/g723_1.c
@@ -59,7 +59,7 @@ static int g723_1_read_packet(AVFormatContext *s, AVPacket
*pkt)
byte = avio_r8(s->pb);
size = frame_size[byte & 3];
- ret = av_new_packet(pkt, size);
+ ret = av_packet_new(pkt, size);
if (ret < 0)
return ret;
diff --git a/libavformat/hls.c b/libavformat/hls.c
index dc3ab87..3767f55 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -149,7 +149,7 @@ static void free_variant_list(HLSContext *c)
*/
static void reset_packet(AVPacket *pkt)
{
- av_init_packet(pkt);
+ av_packet_init(pkt);
pkt->data = NULL;
}
diff --git a/libavformat/hnm.c b/libavformat/hnm.c
index 56d5e74..d00e4c7 100644
--- a/libavformat/hnm.c
+++ b/libavformat/hnm.c
@@ -73,7 +73,7 @@ static int hnm_read_header(AVFormatContext *s)
/* default context members */
hnm->pts = 0;
- av_init_packet(&hnm->vpkt);
+ av_packet_init(&hnm->vpkt);
hnm->vpkt.data = NULL;
hnm->vpkt.size = 0;
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index d63d5a1..b85b734 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -769,7 +769,7 @@ int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta
**extra_meta)
av_dict_set(&st->metadata, "comment", apic->type, 0);
- av_init_packet(&st->attached_pic);
+ av_packet_init(&st->attached_pic);
st->attached_pic.buf = apic->buf;
st->attached_pic.data = apic->buf->data;
st->attached_pic.size = apic->buf->size -
AV_INPUT_BUFFER_PADDING_SIZE;
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index d2ab32b..e83f815 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -199,7 +199,7 @@ static int roq_read_packet(AVFormatContext *s,
}
/* load up the packet */
- if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE))
+ if (av_packet_new(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE))
return AVERROR(EIO);
/* copy over preamble */
memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE);
diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c
index 5ed8899..4e6f855 100644
--- a/libavformat/ilbc.c
+++ b/libavformat/ilbc.c
@@ -105,7 +105,7 @@ static int ilbc_read_packet(AVFormatContext *s,
AVCodecContext *enc = s->streams[0]->codec;
int ret;
- if ((ret = av_new_packet(pkt, enc->block_align)) < 0)
+ if ((ret = av_packet_new(pkt, enc->block_align)) < 0)
return ret;
pkt->stream_index = 0;
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index eb25087..ba2c9e3 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -262,7 +262,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket
*pkt)
size[0] = 4096;
}
- res = av_new_packet(pkt, size[0] + size[1] + size[2]);
+ res = av_packet_new(pkt, size[0] + size[1] + size[2]);
if (res < 0)
return res;
pkt->stream_index = 0;
diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c
index 2bb70e7..ec067dc 100644
--- a/libavformat/ingenientdec.c
+++ b/libavformat/ingenientdec.c
@@ -44,7 +44,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket
*pkt)
av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d,
unk1=%d unk2=%d\n",
size, w, h, unk1, unk2);
- if (av_new_packet(pkt, size) < 0)
+ if (av_packet_new(pkt, size) < 0)
return AVERROR(ENOMEM);
pkt->pos = avio_tell(s->pb);
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index f7e4856..4e385c4 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -156,7 +156,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext
*pb,
/* send both the decode map and the video data together */
- if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size))
+ if (av_packet_new(pkt, s->decode_map_chunk_size + s->video_chunk_size))
return CHUNK_NOMEM;
if (s->has_palette) {
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 40f3454..69fea59 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -186,7 +186,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
if (jvf->video_size || jvf->palette_size) {
int ret;
int size = jvf->video_size + jvf->palette_size;
- if (av_new_packet(pkt, size + JV_PREAMBLE_SIZE))
+ if (av_packet_new(pkt, size + JV_PREAMBLE_SIZE))
return AVERROR(ENOMEM);
AV_WL32(pkt->data, jvf->video_size);
diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
index 2bbf033..b404f94 100644
--- a/libavformat/lxfdec.c
+++ b/libavformat/lxfdec.c
@@ -311,7 +311,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket
*pkt)
return AVERROR_INVALIDDATA;
}
- if ((ret2 = av_new_packet(pkt, ret)) < 0)
+ if ((ret2 = av_packet_new(pkt, ret)) < 0)
return ret2;
if ((ret2 = avio_read(pb, pkt->data, ret)) != ret) {
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8296a41..a840482 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1221,7 +1221,7 @@ static void matroska_fix_ass_packet(MatroskaDemuxContext
*matroska,
static int matroska_merge_packets(AVPacket *out, AVPacket *in)
{
int old_size = out->size;
- int ret = av_grow_packet(out, in->size);
+ int ret = av_packet_grow(out, in->size);
if (ret < 0)
return ret;
@@ -1912,8 +1912,8 @@ static int matroska_read_header(AVFormatContext *s)
st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- av_init_packet(&st->attached_pic);
- if ((res = av_new_packet(&st->attached_pic,
attachments[j].bin.size)) < 0)
+ av_packet_init(&st->attached_pic);
+ if ((res = av_packet_new(&st->attached_pic,
attachments[j].bin.size)) < 0)
return res;
memcpy(st->attached_pic.data, attachments[j].bin.data,
attachments[j].bin.size);
st->attached_pic.stream_index = st->index;
@@ -2172,7 +2172,7 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext
*matroska,
if (!pkt)
return AVERROR(ENOMEM);
- ret = av_new_packet(pkt, a);
+ ret = av_packet_new(pkt, a);
if (ret < 0) {
av_free(pkt);
return ret;
@@ -2310,7 +2310,7 @@ static int matroska_parse_frame(MatroskaDemuxContext
*matroska,
return AVERROR(ENOMEM);
}
/* XXX: prevent data copy... */
- if (av_new_packet(pkt, pkt_size + offset) < 0) {
+ if (av_packet_new(pkt, pkt_size + offset) < 0) {
av_free(pkt);
av_freep(&pkt_data);
return AVERROR(ENOMEM);
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index baffd54..3f85730 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1221,7 +1221,7 @@ static int mkv_write_header(AVFormatContext *s)
put_ebml_void(pb, mkv->reserve_cues_space);
}
- av_init_packet(&mkv->cur_audio_pkt);
+ av_packet_init(&mkv->cur_audio_pkt);
mkv->cur_audio_pkt.size = 0;
avio_flush(pb);
diff --git a/libavformat/mm.c b/libavformat/mm.c
index a21fa65..1f9e16c 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -161,7 +161,7 @@ static int read_packet(AVFormatContext *s,
case MM_TYPE_INTRA_HHV :
case MM_TYPE_INTER_HHV :
/* output preamble + data */
- if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE))
+ if (av_packet_new(pkt, length + MM_PREAMBLE_SIZE))
return AVERROR(ENOMEM);
memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE);
if (avio_read(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 2150bd5..2d06b7c 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -286,7 +286,7 @@ static int mmf_read_packet(AVFormatContext *s, AVPacket
*pkt)
if (!size)
return AVERROR(EIO);
- if (av_new_packet(pkt, size))
+ if (av_packet_new(pkt, size))
return AVERROR(EIO);
pkt->stream_index = 0;
diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c
index 73498e4..09f3c01 100644
--- a/libavformat/movenchint.c
+++ b/libavformat/movenchint.c
@@ -436,7 +436,7 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket
*pkt,
/* Open a buffer for writing the hint */
if ((ret = avio_open_dyn_buf(&hintbuf)) < 0)
goto done;
- av_init_packet(&hint_pkt);
+ av_packet_init(&hint_pkt);
count = write_hint_packets(hintbuf, buf, size, trk, &hint_pkt.dts);
av_freep(&buf);
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index e92cab6..e8fd57a 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -153,7 +153,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket
*pkt)
}
c->curbits = (curbits + size2) & 0x1F;
- if ((ret = av_new_packet(pkt, size)) < 0)
+ if ((ret = av_packet_new(pkt, size)) < 0)
return ret;
pkt->data[0] = curbits;
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 01af597..ea3950d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -699,7 +699,7 @@ static int mpegts_set_stream_info(AVStream *st, PESContext
*pes,
static void new_pes_packet(PESContext *pes, AVPacket *pkt)
{
- av_init_packet(pkt);
+ av_packet_init(pkt);
pkt->buf = pes->buffer;
pkt->data = pes->buffer->data;
@@ -2157,7 +2157,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
AVPacket *pkt)
uint8_t pcr_buf[12];
const uint8_t *data;
- if (av_new_packet(pkt, TS_PACKET_SIZE) < 0)
+ if (av_packet_new(pkt, TS_PACKET_SIZE) < 0)
return AVERROR(ENOMEM);
ret = read_packet(s, pkt->data, ts->raw_packet_size, &data);
pkt->pos = avio_tell(s->pb);
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 2522b72..8b4307b 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1101,7 +1101,7 @@ static int mpegts_write_packet_internal(AVFormatContext
*s, AVPacket *pkt)
return AVERROR_INVALIDDATA;
}
- av_init_packet(&pkt2);
+ av_packet_init(&pkt2);
pkt2.data = pkt->data;
pkt2.size = pkt->size;
diff --git a/libavformat/mux.c b/libavformat/mux.c
index bdcc38c..3307b84 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -522,7 +522,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s,
AVPacket *out,
av_freep(&pktl);
return 1;
} else {
- av_init_packet(out);
+ av_packet_init(out);
return 0;
}
}
@@ -577,7 +577,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket
*pkt)
int ret = interleave_packet(s, &opkt, pkt, flush);
if (pkt) {
memset(pkt, 0, sizeof(*pkt));
- av_init_packet(pkt);
+ av_packet_init(pkt);
pkt = NULL;
}
if (ret <= 0) //FIXME cleanup needed for ret<0 ?
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index ad49364..42576eb 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -330,7 +330,7 @@ static int mxf_get_d10_aes3_packet(AVIOContext *pb,
AVStream *st, AVPacket *pkt,
}
buf_ptr += 32 - st->codec->channels*4; // always 8 channels stored
SMPTE 331M
}
- av_shrink_packet(pkt, data_ptr - pkt->data);
+ av_packet_shrink(pkt, data_ptr - pkt->data);
return 0;
}
@@ -391,7 +391,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket
*pkt, KLVPacket *klv
if (mxf->aesc)
av_aes_crypt(mxf->aesc, &pkt->data[plaintext_size],
&pkt->data[plaintext_size], size >> 4, ivec, 1);
- av_shrink_packet(pkt, orig_size);
+ av_packet_shrink(pkt, orig_size);
pkt->stream_index = index;
avio_skip(pb, end - avio_tell(pb));
return 0;
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 0f4155a..7addb76 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1880,7 +1880,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s,
AVPacket *out, AVPacket
return 1;
} else {
out:
- av_init_packet(out);
+ av_packet_init(out);
return 0;
}
}
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index bf1ab7b..89ef43f 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -880,7 +880,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int
frame_code)
return 1;
}
- ret = av_new_packet(pkt, size + nut->header_len[header_idx]);
+ ret = av_packet_new(pkt, size + nut->header_len[header_idx]);
if (ret < 0)
return ret;
memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 961572d..92ad9d1 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -264,7 +264,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt)
avio_skip(pb, size);
break;
}
- ret = av_new_packet(pkt, copyhdrsize + size);
+ ret = av_packet_new(pkt, copyhdrsize + size);
if (ret < 0)
return ret;
// HACK: we have no idea if it is a keyframe,
@@ -280,7 +280,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
}
if (ret < size)
- av_shrink_packet(pkt, copyhdrsize + ret);
+ av_packet_shrink(pkt, copyhdrsize + ret);
return 0;
case NUV_AUDIO:
if (ctx->a_id < 0) {
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 15526ff..13844db 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -642,7 +642,7 @@ retry:
os->keyframe_seek = 0;
//Alloc a pkt
- ret = av_new_packet(pkt, psize);
+ ret = av_packet_new(pkt, psize);
if (ret < 0)
return ret;
pkt->stream_index = idx;
diff --git a/libavformat/paf.c b/libavformat/paf.c
index 9ee4cd8..71f75d9 100644
--- a/libavformat/paf.c
+++ b/libavformat/paf.c
@@ -202,7 +202,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR_EOF;
if (p->got_audio) {
- if (av_new_packet(pkt, p->audio_size) < 0)
+ if (av_packet_new(pkt, p->audio_size) < 0)
return AVERROR(ENOMEM);
memcpy(pkt->data, p->temp_audio_frame, p->audio_size);
@@ -243,7 +243,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
size = p->video_size - p->frames_offset_table[p->current_frame];
- if (av_new_packet(pkt, size) < 0)
+ if (av_packet_new(pkt, size) < 0)
return AVERROR(ENOMEM);
pkt->stream_index = 0;
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index e1371c0..008baf0 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -185,7 +185,7 @@ static int str_read_packet(AVFormatContext *s,
if(pkt->data)
av_log(s, AV_LOG_ERROR, "missmatching sector_count\n");
av_packet_unref(pkt);
- if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE))
+ if (av_packet_new(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE))
return AVERROR(EIO);
pkt->pos= avio_tell(pb) - RAW_CD_SECTOR_SIZE;
@@ -238,7 +238,7 @@ static int str_read_packet(AVFormatContext *s,
st->start_time = 0;
}
pkt = ret_pkt;
- if (av_new_packet(pkt, 2304))
+ if (av_packet_new(pkt, 2304))
return AVERROR(EIO);
memcpy(pkt->data,sector+24,2304);
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 5f2a398..a222ed6 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -37,7 +37,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket
*pkt)
size = RAW_PACKET_SIZE;
- if (av_new_packet(pkt, size) < 0)
+ if (av_packet_new(pkt, size) < 0)
return AVERROR(ENOMEM);
pkt->pos= avio_tell(s->pb);
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 1c1e045..33268fb 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -249,7 +249,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s,
AVIOContext *pb,
ast->audio_framesize * sub_packet_h > (unsigned)INT_MAX ||
ast->audio_framesize * sub_packet_h < st->codec->block_align)
return AVERROR_INVALIDDATA;
- if (av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h)
< 0)
+ if (av_packet_new(&ast->pkt, ast->audio_framesize * sub_packet_h)
< 0)
return AVERROR(ENOMEM);
}
switch (ast->deint_id) {
@@ -645,7 +645,7 @@ static int rm_assemble_video_frame(AVFormatContext *s,
AVIOContext *pb,
if(rm->remaining_len < len)
return -1;
rm->remaining_len -= len;
- if(av_new_packet(pkt, len + 9) < 0)
+ if(av_packet_new(pkt, len + 9) < 0)
return AVERROR(EIO);
pkt->data[0] = 0;
AV_WL32(pkt->data + 1, 1);
@@ -660,7 +660,7 @@ static int rm_assemble_video_frame(AVFormatContext *s,
AVIOContext *pb,
vst->slices = ((hdr & 0x3F) << 1) + 1;
vst->videobufsize = len2 + 8*vst->slices + 1;
av_packet_unref(&vst->pkt); //FIXME this should be output.
- if(av_new_packet(&vst->pkt, vst->videobufsize) < 0)
+ if(av_packet_new(&vst->pkt, vst->videobufsize) < 0)
return AVERROR(ENOMEM);
vst->videobufpos = 8*vst->slices + 1;
vst->cur_slice = 0;
@@ -817,7 +817,7 @@ ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
ast->deint_id == DEINT_ID_VBRS)
avio_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt -
rm->audio_pkt_cnt]);
else {
- int ret = av_new_packet(pkt, st->codec->block_align);
+ int ret = av_packet_new(pkt, st->codec->block_align);
if (ret < 0)
return ret;
memcpy(pkt->data, ast->pkt.data + st->codec->block_align * //FIXME
avoid this
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 823e03c..69069df 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -657,7 +657,7 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s,
AVPacket *pkt,
s->st, pkt, ×tamp, buf, len, seq,
flags);
} else if (st) {
- if ((rv = av_new_packet(pkt, len)) < 0)
+ if ((rv = av_packet_new(pkt, len)) < 0)
return rv;
memcpy(pkt->data, buf, len);
pkt->stream_index = st->index;
@@ -892,7 +892,7 @@ int ff_parse_fmtp(AVFormatContext *s,
int ff_rtp_finalize_packet(AVPacket *pkt, AVIOContext **dyn_buf, int
stream_idx)
{
int ret;
- av_init_packet(pkt);
+ av_packet_init(pkt);
pkt->size = avio_close_dyn_buf(*dyn_buf, &pkt->data);
pkt->stream_index = stream_idx;
diff --git a/libavformat/rtpdec_ac3.c b/libavformat/rtpdec_ac3.c
index e519b28..96b3218 100644
--- a/libavformat/rtpdec_ac3.c
+++ b/libavformat/rtpdec_ac3.c
@@ -62,7 +62,7 @@ static int ac3_handle_packet(AVFormatContext *ctx,
PayloadContext *data,
av_log(ctx, AV_LOG_ERROR, "Invalid AC3 packet data\n");
return AVERROR_INVALIDDATA;
}
- if (av_new_packet(pkt, len)) {
+ if (av_packet_new(pkt, len)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
return AVERROR(ENOMEM);
}
diff --git a/libavformat/rtpdec_amr.c b/libavformat/rtpdec_amr.c
index b6a8c29..658a6e7 100644
--- a/libavformat/rtpdec_amr.c
+++ b/libavformat/rtpdec_amr.c
@@ -93,7 +93,7 @@ static int amr_handle_packet(AVFormatContext *ctx,
PayloadContext *data,
speech_data = buf + 1 + frames;
/* Everything except the codec mode request byte should be output. */
- if (av_new_packet(pkt, len - 1)) {
+ if (av_packet_new(pkt, len - 1)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
return AVERROR(ENOMEM);
}
diff --git a/libavformat/rtpdec_h263.c b/libavformat/rtpdec_h263.c
index 710cfd2..7cda54e 100644
--- a/libavformat/rtpdec_h263.c
+++ b/libavformat/rtpdec_h263.c
@@ -73,7 +73,7 @@ int ff_h263_handle_packet(AVFormatContext *ctx,
PayloadContext *data,
return AVERROR_INVALIDDATA;
}
- if (av_new_packet(pkt, len + startcode)) {
+ if (av_packet_new(pkt, len + startcode)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
return AVERROR(ENOMEM);
}
diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index e8543ee..d068add 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -248,7 +248,7 @@ int ff_h264_handle_aggregated_packet(AVFormatContext *ctx,
AVPacket *pkt,
if (pass == 0) {
/* now we know the total size of the packet (with the
* start sequences added) */
- if ((ret = av_new_packet(pkt, total_length)) < 0)
+ if ((ret = av_packet_new(pkt, total_length)) < 0)
return ret;
dst = pkt->data;
}
@@ -266,7 +266,7 @@ int ff_h264_handle_frag_packet(AVPacket *pkt, const uint8_t
*buf, int len,
int pos = 0;
if (start_bit)
tot_len += sizeof(start_sequence) + nal_header_len;
- if ((ret = av_new_packet(pkt, tot_len)) < 0)
+ if ((ret = av_packet_new(pkt, tot_len)) < 0)
return ret;
if (start_bit) {
memcpy(pkt->data + pos, start_sequence, sizeof(start_sequence));
@@ -328,7 +328,7 @@ static int h264_handle_packet(AVFormatContext *ctx,
PayloadContext *data,
switch (type) {
case 0: // undefined, but pass them through
case 1:
- if ((result = av_new_packet(pkt, len + sizeof(start_sequence))) < 0)
+ if ((result = av_packet_new(pkt, len + sizeof(start_sequence))) < 0)
return result;
memcpy(pkt->data, start_sequence, sizeof(start_sequence));
memcpy(pkt->data + sizeof(start_sequence), buf, len);
diff --git a/libavformat/rtpdec_hevc.c b/libavformat/rtpdec_hevc.c
index dee9043..7d24a39 100644
--- a/libavformat/rtpdec_hevc.c
+++ b/libavformat/rtpdec_hevc.c
@@ -246,7 +246,7 @@ static int hevc_handle_packet(AVFormatContext *ctx,
PayloadContext *rtp_hevc_ctx
/* single NAL unit packet */
default:
/* create A/V packet */
- if ((res = av_new_packet(pkt, sizeof(start_sequence) + len)) < 0)
+ if ((res = av_packet_new(pkt, sizeof(start_sequence) + len)) < 0)
return res;
/* A/V packet: copy start sequence */
memcpy(pkt->data, start_sequence, sizeof(start_sequence));
diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c
index d22cc1d..8e27fe9 100644
--- a/libavformat/rtpdec_latm.c
+++ b/libavformat/rtpdec_latm.c
@@ -81,7 +81,7 @@ static int latm_parse_packet(AVFormatContext *ctx,
PayloadContext *data,
return AVERROR(EIO);
}
- if ((ret = av_new_packet(pkt, cur_len)) < 0)
+ if ((ret = av_packet_new(pkt, cur_len)) < 0)
return ret;
memcpy(pkt->data, data->buf + data->pos, cur_len);
data->pos += cur_len;
diff --git a/libavformat/rtpdec_mpa_robust.c b/libavformat/rtpdec_mpa_robust.c
index a65e139..d503d90 100644
--- a/libavformat/rtpdec_mpa_robust.c
+++ b/libavformat/rtpdec_mpa_robust.c
@@ -90,7 +90,7 @@ static int mpa_robust_parse_packet(AVFormatContext *ctx,
PayloadContext *data,
return AVERROR_INVALIDDATA;
}
- if (av_new_packet(pkt, adu_size)) {
+ if (av_packet_new(pkt, adu_size)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
return AVERROR(ENOMEM);
}
@@ -120,7 +120,7 @@ static int mpa_robust_parse_packet(AVFormatContext *ctx,
PayloadContext *data,
if (!continuation && adu_size <= len) {
/* One or more complete frames */
- if (av_new_packet(pkt, adu_size)) {
+ if (av_packet_new(pkt, adu_size)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
return AVERROR(ENOMEM);
}
diff --git a/libavformat/rtpdec_mpeg12.c b/libavformat/rtpdec_mpeg12.c
index 2b884be..3076d15 100644
--- a/libavformat/rtpdec_mpeg12.c
+++ b/libavformat/rtpdec_mpeg12.c
@@ -41,7 +41,7 @@ static int mpeg_parse_packet(AVFormatContext *ctx,
PayloadContext *data,
buf += 4;
len -= 4;
}
- if (av_new_packet(pkt, len) < 0)
+ if (av_packet_new(pkt, len) < 0)
return AVERROR(ENOMEM);
memcpy(pkt->data, buf, len);
pkt->stream_index = st->index;
diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c
index a8c9943..333fb4c 100644
--- a/libavformat/rtpdec_mpeg4.c
+++ b/libavformat/rtpdec_mpeg4.c
@@ -176,7 +176,7 @@ static int aac_parse_packet(AVFormatContext *ctx,
PayloadContext *data,
av_log(ctx, AV_LOG_ERROR, "Invalid AU size\n");
return AVERROR_INVALIDDATA;
}
- if ((ret = av_new_packet(pkt,
data->au_headers[data->cur_au_index].size)) < 0) {
+ if ((ret = av_packet_new(pkt,
data->au_headers[data->cur_au_index].size)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
return ret;
}
@@ -235,7 +235,7 @@ static int aac_parse_packet(AVFormatContext *ctx,
PayloadContext *data,
}
data->buf_pos = 0;
- ret = av_new_packet(pkt, data->buf_size);
+ ret = av_packet_new(pkt, data->buf_size);
if (ret < 0) {
av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
return ret;
@@ -251,7 +251,7 @@ static int aac_parse_packet(AVFormatContext *ctx,
PayloadContext *data,
av_log(ctx, AV_LOG_ERROR, "First AU larger than packet size\n");
return AVERROR_INVALIDDATA;
}
- if ((ret = av_new_packet(pkt, data->au_headers[0].size)) < 0) {
+ if ((ret = av_packet_new(pkt, data->au_headers[0].size)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
return ret;
}
diff --git a/libavformat/rtpdec_qcelp.c b/libavformat/rtpdec_qcelp.c
index d5322d6..cd8cda9 100644
--- a/libavformat/rtpdec_qcelp.c
+++ b/libavformat/rtpdec_qcelp.c
@@ -125,7 +125,7 @@ static int store_packet(AVFormatContext *ctx,
PayloadContext *data,
if (len - 1 - frame_size > sizeof(data->group[0].data))
return AVERROR_INVALIDDATA;
- if ((ret = av_new_packet(pkt, frame_size)) < 0)
+ if ((ret = av_packet_new(pkt, frame_size)) < 0)
return ret;
memcpy(pkt->data, &buf[1], frame_size);
pkt->stream_index = st->index;
@@ -165,7 +165,7 @@ static int return_stored_frame(AVFormatContext *ctx,
PayloadContext *data,
if (ip->size == 0) {
/* No stored data for this interleave block, output an empty packet */
- if ((ret = av_new_packet(pkt, 1)) < 0)
+ if ((ret = av_packet_new(pkt, 1)) < 0)
return ret;
pkt->data[0] = 0; // Blank - could also be 14, Erasure
} else {
@@ -177,7 +177,7 @@ static int return_stored_frame(AVFormatContext *ctx,
PayloadContext *data,
if (ip->pos + frame_size > ip->size)
return AVERROR_INVALIDDATA;
- if ((ret = av_new_packet(pkt, frame_size)) < 0)
+ if ((ret = av_packet_new(pkt, frame_size)) < 0)
return ret;
memcpy(pkt->data, &ip->data[ip->pos], frame_size);
diff --git a/libavformat/rtpdec_qdm2.c b/libavformat/rtpdec_qdm2.c
index 16dd489..c4e5095 100644
--- a/libavformat/rtpdec_qdm2.c
+++ b/libavformat/rtpdec_qdm2.c
@@ -195,7 +195,7 @@ static int qdm2_restore_block(PayloadContext *qdm, AVStream
*st, AVPacket *pkt)
break;
assert(n < 0x80);
- if ((res = av_new_packet(pkt, qdm->block_size)) < 0)
+ if ((res = av_packet_new(pkt, qdm->block_size)) < 0)
return res;
memset(pkt->data, 0, pkt->size);
pkt->stream_index = st->index;
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index f87e8af..5e6d35d 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -53,7 +53,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s,
PayloadContext *qt,
if (qt->remaining) {
int num = qt->pkt.size / qt->bytes_per_frame;
- if (av_new_packet(pkt, qt->bytes_per_frame))
+ if (av_packet_new(pkt, qt->bytes_per_frame))
return AVERROR(ENOMEM);
pkt->stream_index = st->index;
pkt->flags = qt->pkt.flags;
@@ -180,7 +180,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s,
PayloadContext *qt,
}
} else {
av_freep(&qt->pkt.data);
- av_init_packet(&qt->pkt);
+ av_packet_init(&qt->pkt);
qt->pkt.data = av_realloc(NULL, alen +
AV_INPUT_BUFFER_PADDING_SIZE);
if (!qt->pkt.data)
return AVERROR(ENOMEM);
@@ -208,7 +208,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s,
PayloadContext *qt,
alen % qt->bytes_per_frame != 0)
return AVERROR_INVALIDDATA; /* wrongly padded */
qt->remaining = (alen / qt->bytes_per_frame) - 1;
- if (av_new_packet(pkt, qt->bytes_per_frame))
+ if (av_packet_new(pkt, qt->bytes_per_frame))
return AVERROR(ENOMEM);
memcpy(pkt->data, buf + avio_tell(&pb), qt->bytes_per_frame);
pkt->flags = keyframe ? AV_PKT_FLAG_KEY : 0;
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index c79cfeb..24559dc 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -77,7 +77,7 @@ static int xiph_handle_packet(AVFormatContext *ctx,
PayloadContext *data,
av_log(ctx, AV_LOG_ERROR, "Not enough data to return\n");
return AVERROR_INVALIDDATA;
}
- if (av_new_packet(pkt, pkt_len)) {
+ if (av_packet_new(pkt, pkt_len)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
return AVERROR(ENOMEM);
}
@@ -124,7 +124,7 @@ static int xiph_handle_packet(AVFormatContext *ctx,
PayloadContext *data,
len -= 6;
if (fragmented == 0) {
- if (av_new_packet(pkt, pkt_len)) {
+ if (av_packet_new(pkt, pkt_len)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
return AVERROR(ENOMEM);
}
diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c
index 585d1ad..ae78f0b 100644
--- a/libavformat/rtpenc_mpegts.c
+++ b/libavformat/rtpenc_mpegts.c
@@ -125,7 +125,7 @@ static int rtp_mpegts_write_packet(AVFormatContext *s,
AVPacket *pkt)
av_free(buf);
return 0;
}
- av_init_packet(&local_pkt);
+ av_packet_init(&local_pkt);
local_pkt.data = buf;
local_pkt.size = size;
local_pkt.stream_index = 0;
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 76a1ec2..87dcd5d 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -271,7 +271,7 @@ static int film_read_packet(AVFormatContext *s,
if ((sample->stream == film->video_stream_index) &&
(film->video_type == AV_CODEC_ID_CINEPAK)) {
pkt->pos= avio_tell(pb);
- if (av_new_packet(pkt, sample->sample_size))
+ if (av_packet_new(pkt, sample->sample_size))
return AVERROR(ENOMEM);
avio_read(pb, pkt->data, sample->sample_size);
} else {
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index 9be07cb..ca4b237 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -260,7 +260,7 @@ static int vmd_read_packet(AVFormatContext *s,
/* position the stream (will probably be there already) */
avio_seek(pb, frame->frame_offset, SEEK_SET);
- if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
+ if (av_packet_new(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
return AVERROR(ENOMEM);
pkt->pos= avio_tell(pb);
memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
diff --git a/libavformat/siff.c b/libavformat/siff.c
index 3f9840e..cb4e0cc 100644
--- a/libavformat/siff.c
+++ b/libavformat/siff.c
@@ -206,7 +206,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket
*pkt)
if (!c->curstrm) {
size = c->pktsize - c->sndsize;
- if (av_new_packet(pkt, size) < 0)
+ if (av_packet_new(pkt, size) < 0)
return AVERROR(ENOMEM);
AV_WL16(pkt->data, c->flags);
if (c->gmcsize)
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index b1d8e95..bc08e51 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -333,7 +333,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket
*pkt)
}
if (frame_size < 0 || frame_size >= INT_MAX/2)
return AVERROR_INVALIDDATA;
- if (av_new_packet(pkt, frame_size + 769))
+ if (av_packet_new(pkt, frame_size + 769))
return AVERROR(ENOMEM);
if(smk->frm_size[smk->cur_frame] & 1)
palchange |= 2;
@@ -350,7 +350,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket
*pkt)
} else {
if (smk->stream_id[smk->curstream] < 0)
return AVERROR_INVALIDDATA;
- if (av_new_packet(pkt, smk->buf_sizes[smk->curstream]))
+ if (av_packet_new(pkt, smk->buf_sizes[smk->curstream]))
return AVERROR(ENOMEM);
memcpy(pkt->data, smk->bufs[smk->curstream],
smk->buf_sizes[smk->curstream]);
pkt->size = smk->buf_sizes[smk->curstream];
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index a28adf8..aa0a5b8 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -181,7 +181,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket
*pkt)
if (pkt_size_bits % 16)
avpriv_request_sample(s, "Packet not ending at a 16-bit boundary");
- ret = av_new_packet(pkt, FFALIGN(pkt_size_bits, 16) >> 3);
+ ret = av_packet_new(pkt, FFALIGN(pkt_size_bits, 16) >> 3);
if (ret)
return ret;
diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 9db5133..8f0b744 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -83,7 +83,7 @@ static int srt_read_packet(AVFormatContext *s, AVPacket *pkt)
ptr += ff_get_line(s->pb, ptr, sizeof(buffer)+buffer-ptr);
} while (!is_eol(*ptr2) && !s->pb->eof_reached &&
ptr-buffer<sizeof(buffer)-1);
- if (buffer[0] && !(res = av_new_packet(pkt, ptr-buffer))) {
+ if (buffer[0] && !(res = av_packet_new(pkt, ptr-buffer))) {
memcpy(pkt->data, buffer, pkt->size);
pkt->flags |= AV_PKT_FLAG_KEY;
pkt->pos = pos;
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index 4dd41c2..edb3ac8 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -218,7 +218,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket
*pkt)
len -= 2;
if (len < 4)
goto skip;
- if ((res = av_new_packet(pkt, len)) < 0)
+ if ((res = av_packet_new(pkt, len)) < 0)
return res;
avio_read(pb, pkt->data, 4);
if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c
index b5e2c94..886a2c2 100644
--- a/libavformat/tiertexseq.c
+++ b/libavformat/tiertexseq.c
@@ -254,7 +254,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket
*pkt)
/* video packet */
if (seq->current_pal_data_size + seq->current_video_data_size != 0) {
- if (av_new_packet(pkt, 1 + seq->current_pal_data_size +
seq->current_video_data_size))
+ if (av_packet_new(pkt, 1 + seq->current_pal_data_size +
seq->current_video_data_size))
return AVERROR(ENOMEM);
pkt->data[0] = 0;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 629edd6..5615b12 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -348,7 +348,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->data = NULL;
pkt->size = 0;
- av_init_packet(pkt);
+ av_packet_init(pkt);
ret = s->iformat->read_packet(s, pkt);
if (ret < 0) {
if (!pktl || ret == AVERROR(EAGAIN))
@@ -719,7 +719,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
int stream_index)
int ret = 0, got_output = 0;
if (!pkt) {
- av_init_packet(&flush_pkt);
+ av_packet_init(&flush_pkt);
pkt = &flush_pkt;
got_output = 1;
}
@@ -727,7 +727,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
int stream_index)
while (size > 0 || (pkt == &flush_pkt && got_output)) {
int len;
- av_init_packet(&out_pkt);
+ av_packet_init(&out_pkt);
len = av_parser_parse2(st->parser, st->codec,
&out_pkt.data, &out_pkt.size, data, size,
pkt->pts, pkt->dts, pkt->pos);
@@ -823,7 +823,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket
*pkt)
int ret = 0, i, got_packet = 0;
AVDictionary *metadata = NULL;
- av_init_packet(pkt);
+ av_packet_init(pkt);
while (!got_packet && !s->internal->parse_queue) {
AVStream *st;
@@ -2092,7 +2092,7 @@ int avformat_find_stream_info(AVFormatContext *ic,
AVDictionary **options)
/* EOF or error*/
AVPacket empty_pkt = { 0 };
int err = 0;
- av_init_packet(&empty_pkt);
+ av_packet_init(&empty_pkt);
/* We could not have all the codec parameters before EOF. */
ret = -1;
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index baff8fc..851953e 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -231,7 +231,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket
*pkt)
int ret;
int size = (c->frame_bit_len - c->remaining_bits + 7)>>3;
- if (av_new_packet(pkt, size+2) < 0)
+ if (av_packet_new(pkt, size+2) < 0)
return AVERROR(EIO);
pkt->pos = avio_tell(s->pb);
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 210f6c4..03788b4 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -99,7 +99,7 @@ static int wc3_read_header(AVFormatContext *s)
wc3->height = WC3_DEFAULT_HEIGHT;
wc3->pts = 0;
wc3->video_stream_index = wc3->audio_stream_index = 0;
- av_init_packet(&wc3->vpkt);
+ av_packet_init(&wc3->vpkt);
wc3->vpkt.data = NULL; wc3->vpkt.size = 0;
/* skip the first 3 32-bit numbers */
diff --git a/libavformat/westwood_aud.c b/libavformat/westwood_aud.c
index 805a5c1..1a7e67c 100644
--- a/libavformat/westwood_aud.c
+++ b/libavformat/westwood_aud.c
@@ -153,7 +153,7 @@ static int wsaud_read_packet(AVFormatContext *s,
Specifically, this is needed to signal when a packet should be
decoding as raw 8-bit pcm or variable-size ADPCM. */
int out_size = AV_RL16(&preamble[2]);
- if ((ret = av_new_packet(pkt, chunk_size + 4)))
+ if ((ret = av_packet_new(pkt, chunk_size + 4)))
return ret;
if ((ret = avio_read(pb, &pkt->data[4], chunk_size)) != chunk_size)
return ret < 0 ? ret : AVERROR(EIO);
diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c
index 4323914..6ec66d9 100644
--- a/libavformat/westwood_vqa.c
+++ b/libavformat/westwood_vqa.c
@@ -180,7 +180,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
if ((chunk_type == SND0_TAG) || (chunk_type == SND1_TAG) ||
(chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
- if (av_new_packet(pkt, chunk_size))
+ if (av_packet_new(pkt, chunk_size))
return AVERROR(EIO);
ret = avio_read(pb, pkt->data, chunk_size);
if (ret != chunk_size) {
diff --git a/libavformat/wvdec.c b/libavformat/wvdec.c
index e9a2a62..e6c4ecb 100644
--- a/libavformat/wvdec.c
+++ b/libavformat/wvdec.c
@@ -264,7 +264,7 @@ static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
pos = wc->pos;
- if (av_new_packet(pkt, wc->header.blocksize + WV_HEADER_SIZE) < 0)
+ if (av_packet_new(pkt, wc->header.blocksize + WV_HEADER_SIZE) < 0)
return AVERROR(ENOMEM);
memcpy(pkt->data, wc->block_header, WV_HEADER_SIZE);
ret = avio_read(s->pb, pkt->data + WV_HEADER_SIZE, wc->header.blocksize);
@@ -279,7 +279,7 @@ static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
off = pkt->size;
- if ((ret = av_grow_packet(pkt, WV_HEADER_SIZE + wc->header.blocksize))
< 0) {
+ if ((ret = av_packet_grow(pkt, WV_HEADER_SIZE + wc->header.blocksize))
< 0) {
av_packet_unref(pkt);
return ret;
}
diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index 0eeb729..d09d322 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -504,7 +504,7 @@ static int xmv_fetch_video_packet(AVFormatContext *s,
return AVERROR(EIO);
/* Create the packet */
- result = av_new_packet(pkt, frame_size);
+ result = av_packet_new(pkt, frame_size);
if (result)
return result;
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 089c3f1..daeb545 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -133,7 +133,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket
*pkt)
yop->odd_frame ^= 1;
return pkt->size;
}
- ret = av_new_packet(&yop->video_packet,
+ ret = av_packet_new(&yop->video_packet,
yop->frame_size - yop->audio_block_length);
if (ret < 0)
return ret;
@@ -162,7 +162,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket
*pkt)
if (ret < 0)
goto err_out;
else if (ret < actual_video_data_size)
- av_shrink_packet(&yop->video_packet, yop->palette_size + ret);
+ av_packet_shrink(&yop->video_packet, yop->palette_size + ret);
// Arbitrarily return the audio data first
return yop->audio_block_length;
diff --git a/tools/pktdumper.c b/tools/pktdumper.c
index d71a6b5..3bdc9ee 100644
--- a/tools/pktdumper.c
+++ b/tools/pktdumper.c
@@ -104,7 +104,7 @@ int main(int argc, char **argv)
return 1;
}
- av_init_packet(&pkt);
+ av_packet_init(&pkt);
while ((err = av_read_frame(fctx, &pkt)) >= 0) {
int fd;
--
2.5.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel