X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Favcodec.h;h=64328c80ea783114be151e9fbddebcd73fc8934d;hb=2507b5dd674834be7261772996f47ae3b95cca69;hp=9eaa2c6ffb1309aab2b90b316665d927fe0da1b6;hpb=9b56d5c11488656254e9aed8d964ef2b7c2ff5e6;p=ffmpeg diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 9eaa2c6ffb1..64328c80ea7 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -699,11 +699,11 @@ typedef struct RcOverride{ * interlaced motion estimation */ #define AV_CODEC_FLAG_INTERLACED_ME (1 << 29) +#define AV_CODEC_FLAG_CLOSED_GOP (1 << 31) + /** * Allow non spec compliant speedup tricks. */ -#define AV_CODEC_FLAG_CLOSED_GOP (1 << 31) - #define AV_CODEC_FLAG2_FAST (1 << 0) /** * Skip bitstream encoding. @@ -1036,6 +1036,44 @@ typedef struct AVPanScan{ int16_t position[3][2]; }AVPanScan; +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { + /** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int max_bitrate; + /** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int min_bitrate; + /** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int avg_bitrate; + + /** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ + int buffer_size; + + /** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ + uint64_t vbv_delay; +} AVCPBProperties; + #if FF_API_QSCALE_TYPE #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 @@ -1129,6 +1167,19 @@ enum AVPacketSideDataType { * and FF_LAMBDA_MAX (bad). */ AV_PKT_DATA_QUALITY_FACTOR, + + /** + * This side data contains an integer value representing the stream index + * of a "fallback" track. A fallback track indicates an alternate + * track to use when the current track can not be decoded for some reason. + * e.g. no decoder available for codec. + */ + AV_PKT_DATA_FALLBACK_TRACK, + + /** + * This side data corresponds to the AVCPBProperties struct. + */ + AV_PKT_DATA_CPB_PROPERTIES, }; typedef struct AVPacketSideData { @@ -2364,13 +2415,19 @@ typedef struct AVCodecContext { */ int64_t timecode_frame_start; +#if FF_API_RTP_CALLBACK + /** + * @deprecated unused + */ /* The RTP callback: This function is called */ /* every time the encoder has a packet to send. */ /* It depends on the encoder if the data starts */ /* with a Start Code (it should). H.263 does. */ /* mb_nb contains the number of macroblocks */ /* encoded in the RTP payload. */ + attribute_deprecated void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); +#endif int rtp_payload_size; /* The size of the RTP payload: the coder will */ /* do its best to deliver a chunk with size */ @@ -2857,13 +2914,18 @@ typedef struct AVCodecContext { int error_rate; #endif +#if FF_API_VBV_DELAY /** * VBV delay coded in the last frame (in periods of a 27 MHz clock). * Used for compliant TS muxing. * - encoding: Set by libavcodec. * - decoding: unused. + * @deprecated this value is now exported as a part of + * AV_PKT_DATA_CPB_PROPERTIES packet side data */ + attribute_deprecated uint64_t vbv_delay; +#endif #if FF_API_SIDEDATA_ONLY_PKT /** @@ -2911,6 +2973,16 @@ typedef struct AVCodecContext { * - decoding: Set by libavcodec before calling get_format() */ enum AVPixelFormat sw_pix_fmt; + + /** + * Additional data associated with the entire coded stream. + * + * - decoding: unused + * - encoding: may be set by libavcodec after avcodec_open2(). + */ + AVPacketSideData *coded_side_data; + int nb_coded_side_data; + } AVCodecContext; /** @@ -3181,10 +3253,12 @@ typedef struct AVHWAccel { /** * four components are given, that's all. * the last component is alpha + * @deprecated Use the imgutils functions */ -attribute_deprecated typedef struct AVPicture { + attribute_deprecated uint8_t *data[AV_NUM_DATA_POINTERS]; + attribute_deprecated int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line } AVPicture; @@ -3425,6 +3499,40 @@ void avsubtitle_free(AVSubtitle *sub); * @{ */ +/** + * Allocate an AVPacket and set its fields to default values. The resulting + * struct must be freed using av_packet_free(). + * + * @return An AVPacket filled with default values or NULL on failure. + * + * @note this only allocates the AVPacket itself, not the data buffers. Those + * must be allocated through other means such as av_new_packet. + * + * @see av_new_packet + */ +AVPacket *av_packet_alloc(void); + +/** + * Create a new packet that references the same data as src. + * + * This is a shortcut for av_packet_alloc()+av_packet_ref(). + * + * @return newly created AVPacket on success, NULL on error. + * + * @see av_packet_alloc + * @see av_packet_ref + */ +AVPacket *av_packet_clone(AVPacket *src); + +/** + * Free the packet, if the packet is reference counted, it will be + * unreferenced first. + * + * @param packet packet to be freed. The pointer will be set to NULL. + * @note passing NULL is a no-op. + */ +void av_packet_free(AVPacket **pkt); + /** * Initialize optional fields of a packet with default values. * @@ -3506,6 +3614,22 @@ void av_free_packet(AVPacket *pkt); uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size); +/** + * Wrap an existing array as a packet side data. + * + * @param pkt packet + * @param type side information type + * @param data the side data array. It must be allocated with the av_malloc() + * family of functions. The ownership of the data is transferred to + * pkt. + * @param size side information size + * @return a non-negative number on success, a negative AVERROR code on + * failure. On failure, the packet is unchanged and the data remains + * owned by the caller. + */ +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + uint8_t *data, size_t size); + /** * Shrink the already allocated side data buffer * @@ -4554,6 +4678,17 @@ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); */ const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); +/** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + /** * @} */