You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/packet: deprecate av_init_packet()
Once removed, sizeof(AVPacket) will stop being a part of the public ABI. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -15,6 +15,11 @@ libavutil: 2017-10-21
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2021-03-xx - xxxxxxxxxx - lavc 58.133.100 - codec.h
|
||||||
|
Deprecated av_init_packet(). Once removed, sizeof(AVPacket) will
|
||||||
|
no longer be a part of the public ABI.
|
||||||
|
Deprecated AVPacketList.
|
||||||
|
|
||||||
2021-03-xx - xxxxxxxxxx - lavc 58.132.100 - codec.h
|
2021-03-xx - xxxxxxxxxx - lavc 58.132.100 - codec.h
|
||||||
Add AV_CODEC_CAP_OTHER_THREADS as a new name for
|
Add AV_CODEC_CAP_OTHER_THREADS as a new name for
|
||||||
AV_CODEC_CAP_AUTO_THREADS. AV_CODEC_CAP_AUTO_THREADS
|
AV_CODEC_CAP_AUTO_THREADS. AV_CODEC_CAP_AUTO_THREADS
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include "packet_internal.h"
|
#include "packet_internal.h"
|
||||||
|
|
||||||
|
#if FF_API_INIT_PACKET
|
||||||
void av_init_packet(AVPacket *pkt)
|
void av_init_packet(AVPacket *pkt)
|
||||||
{
|
{
|
||||||
pkt->pts = AV_NOPTS_VALUE;
|
pkt->pts = AV_NOPTS_VALUE;
|
||||||
@@ -49,6 +50,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
pkt->side_data = NULL;
|
pkt->side_data = NULL;
|
||||||
pkt->side_data_elems = 0;
|
pkt->side_data_elems = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void get_packet_defaults(AVPacket *pkt)
|
||||||
|
{
|
||||||
|
memset(pkt, 0, sizeof(*pkt));
|
||||||
|
|
||||||
|
pkt->pts = AV_NOPTS_VALUE;
|
||||||
|
pkt->dts = AV_NOPTS_VALUE;
|
||||||
|
pkt->pos = -1;
|
||||||
|
}
|
||||||
|
|
||||||
AVPacket *av_packet_alloc(void)
|
AVPacket *av_packet_alloc(void)
|
||||||
{
|
{
|
||||||
@@ -56,7 +67,7 @@ AVPacket *av_packet_alloc(void)
|
|||||||
if (!pkt)
|
if (!pkt)
|
||||||
return pkt;
|
return pkt;
|
||||||
|
|
||||||
av_init_packet(pkt);
|
get_packet_defaults(pkt);
|
||||||
|
|
||||||
return pkt;
|
return pkt;
|
||||||
}
|
}
|
||||||
@@ -92,7 +103,7 @@ int av_new_packet(AVPacket *pkt, int size)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
av_init_packet(pkt);
|
get_packet_defaults(pkt);
|
||||||
pkt->buf = buf;
|
pkt->buf = buf;
|
||||||
pkt->data = buf->data;
|
pkt->data = buf->data;
|
||||||
pkt->size = size;
|
pkt->size = size;
|
||||||
@@ -611,9 +622,7 @@ void av_packet_unref(AVPacket *pkt)
|
|||||||
{
|
{
|
||||||
av_packet_free_side_data(pkt);
|
av_packet_free_side_data(pkt);
|
||||||
av_buffer_unref(&pkt->buf);
|
av_buffer_unref(&pkt->buf);
|
||||||
av_init_packet(pkt);
|
get_packet_defaults(pkt);
|
||||||
pkt->data = NULL;
|
|
||||||
pkt->size = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int av_packet_ref(AVPacket *dst, const AVPacket *src)
|
int av_packet_ref(AVPacket *dst, const AVPacket *src)
|
||||||
@@ -668,9 +677,7 @@ AVPacket *av_packet_clone(const AVPacket *src)
|
|||||||
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
|
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
|
||||||
{
|
{
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
av_init_packet(src);
|
get_packet_defaults(src);
|
||||||
src->data = NULL;
|
|
||||||
src->size = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int av_packet_make_refcounted(AVPacket *pkt)
|
int av_packet_make_refcounted(AVPacket *pkt)
|
||||||
|
@@ -323,10 +323,6 @@ typedef struct AVPacketSideData {
|
|||||||
* packets, with no compressed data, containing only side data
|
* packets, with no compressed data, containing only side data
|
||||||
* (e.g. to update some stream parameters at the end of encoding).
|
* (e.g. to update some stream parameters at the end of encoding).
|
||||||
*
|
*
|
||||||
* AVPacket is one of the few structs in FFmpeg, whose size is a part of public
|
|
||||||
* ABI. Thus it may be allocated on stack and no new fields can be added to it
|
|
||||||
* without libavcodec and libavformat major bump.
|
|
||||||
*
|
|
||||||
* The semantics of data ownership depends on the buf field.
|
* The semantics of data ownership depends on the buf field.
|
||||||
* If it is set, the packet data is dynamically allocated and is
|
* If it is set, the packet data is dynamically allocated and is
|
||||||
* valid indefinitely until a call to av_packet_unref() reduces the
|
* valid indefinitely until a call to av_packet_unref() reduces the
|
||||||
@@ -338,6 +334,12 @@ typedef struct AVPacketSideData {
|
|||||||
* The side data is always allocated with av_malloc(), copied by
|
* The side data is always allocated with av_malloc(), copied by
|
||||||
* av_packet_ref() and freed by av_packet_unref().
|
* av_packet_ref() and freed by av_packet_unref().
|
||||||
*
|
*
|
||||||
|
* sizeof(AVPacket) being a part of the public ABI is deprecated. once
|
||||||
|
* av_init_packet() is removed, new packets will only be able to be allocated
|
||||||
|
* with av_packet_alloc(), and new fields may be added to the end of the struct
|
||||||
|
* with a minor bump.
|
||||||
|
*
|
||||||
|
* @see av_packet_alloc
|
||||||
* @see av_packet_ref
|
* @see av_packet_ref
|
||||||
* @see av_packet_unref
|
* @see av_packet_unref
|
||||||
*/
|
*/
|
||||||
@@ -397,10 +399,13 @@ typedef struct AVPacket {
|
|||||||
#endif
|
#endif
|
||||||
} AVPacket;
|
} AVPacket;
|
||||||
|
|
||||||
|
#if FF_API_INIT_PACKET
|
||||||
|
attribute_deprecated
|
||||||
typedef struct AVPacketList {
|
typedef struct AVPacketList {
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
struct AVPacketList *next;
|
struct AVPacketList *next;
|
||||||
} AVPacketList;
|
} AVPacketList;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
|
#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
|
||||||
#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
|
#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
|
||||||
@@ -464,6 +469,7 @@ AVPacket *av_packet_clone(const AVPacket *src);
|
|||||||
*/
|
*/
|
||||||
void av_packet_free(AVPacket **pkt);
|
void av_packet_free(AVPacket **pkt);
|
||||||
|
|
||||||
|
#if FF_API_INIT_PACKET
|
||||||
/**
|
/**
|
||||||
* Initialize optional fields of a packet with default values.
|
* Initialize optional fields of a packet with default values.
|
||||||
*
|
*
|
||||||
@@ -471,8 +477,16 @@ void av_packet_free(AVPacket **pkt);
|
|||||||
* initialized separately.
|
* initialized separately.
|
||||||
*
|
*
|
||||||
* @param pkt packet
|
* @param pkt packet
|
||||||
|
*
|
||||||
|
* @see av_packet_alloc
|
||||||
|
* @see av_packet_unref
|
||||||
|
*
|
||||||
|
* @deprecated This function is deprecated. Once it's removed,
|
||||||
|
sizeof(AVPacket) will not be a part of the ABI anymore.
|
||||||
*/
|
*/
|
||||||
|
attribute_deprecated
|
||||||
void av_init_packet(AVPacket *pkt);
|
void av_init_packet(AVPacket *pkt);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate the payload of a packet and initialize its fields with
|
* Allocate the payload of a packet and initialize its fields with
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "libavutil/version.h"
|
#include "libavutil/version.h"
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MAJOR 58
|
#define LIBAVCODEC_VERSION_MAJOR 58
|
||||||
#define LIBAVCODEC_VERSION_MINOR 132
|
#define LIBAVCODEC_VERSION_MINOR 133
|
||||||
#define LIBAVCODEC_VERSION_MICRO 100
|
#define LIBAVCODEC_VERSION_MICRO 100
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
@@ -165,5 +165,8 @@
|
|||||||
#ifndef FF_API_AUTO_THREADS
|
#ifndef FF_API_AUTO_THREADS
|
||||||
#define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60)
|
#define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_INIT_PACKET
|
||||||
|
#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* AVCODEC_VERSION_H */
|
#endif /* AVCODEC_VERSION_H */
|
||||||
|
@@ -954,7 +954,11 @@ typedef struct AVStream {
|
|||||||
* decoding: set by libavformat, must not be modified by the caller.
|
* decoding: set by libavformat, must not be modified by the caller.
|
||||||
* encoding: unused
|
* encoding: unused
|
||||||
*/
|
*/
|
||||||
|
#if FF_API_INIT_PACKET
|
||||||
AVPacket attached_pic;
|
AVPacket attached_pic;
|
||||||
|
#else
|
||||||
|
AVPacket *attached_pic;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of side data that applies to the whole stream (i.e. the
|
* An array of side data that applies to the whole stream (i.e. the
|
||||||
|
Reference in New Issue
Block a user