X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Fframe.h;h=ff2540a20f4c4cb2fb7dfdd2232350785b454448;hb=ef6a9e5e311f09fa8032974fa4d0c1e166a959bb;hp=e2a292980f46d2189ed75e76652064f27f16afb0;hpb=4241e44a3c0193d182d3d614e7b4977c00c0225c;p=ffmpeg diff --git a/libavutil/frame.h b/libavutil/frame.h index e2a292980f4..ff2540a20f4 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -142,30 +142,51 @@ enum AVFrameSideDataType { */ AV_FRAME_DATA_ICC_PROFILE, -#if FF_API_FRAME_QP /** - * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA. - * The contents of this side data are undocumented and internal; use - * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a - * meaningful way instead. + * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t + * where the first uint32_t describes how many (1-3) of the other timecodes are used. + * The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum() + * function in libavutil/timecode.h. */ - AV_FRAME_DATA_QP_TABLE_PROPERTIES, + AV_FRAME_DATA_S12M_TIMECODE, /** - * Raw QP table data. Its format is described by - * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and - * av_frame_get_qp_table() to access this instead. + * HDR dynamic metadata associated with a video frame. The payload is + * an AVDynamicHDRPlus type and contains information for color + * volume transform - application 4 of SMPTE 2094-40:2016 standard. */ - AV_FRAME_DATA_QP_TABLE_DATA, -#endif + AV_FRAME_DATA_DYNAMIC_HDR_PLUS, /** - * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t - * where the first uint32_t describes how many (1-3) of the other timecodes are used. - * The timecode format is described in the av_timecode_get_smpte_from_framenum() - * function in libavutil/timecode.c. + * Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of + * array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size. */ - AV_FRAME_DATA_S12M_TIMECODE, + AV_FRAME_DATA_REGIONS_OF_INTEREST, + + /** + * Encoding parameters for a video frame, as described by AVVideoEncParams. + */ + AV_FRAME_DATA_VIDEO_ENC_PARAMS, + + /** + * User data unregistered metadata associated with a video frame. + * This is the H.26[45] UDU SEI message, and shouldn't be used for any other purpose + * The data is stored as uint8_t in AVFrameSideData.data which is 16 bytes of + * uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of user_data_payload_byte. + */ + AV_FRAME_DATA_SEI_UNREGISTERED, + + /** + * Film grain parameters for a frame, described by AVFilmGrainParams. + * Must be present for every frame which should have film grain applied. + */ + AV_FRAME_DATA_FILM_GRAIN_PARAMS, + + /** + * Bounding boxes for object detection and classification, + * as described by AVDetectionBBoxHeader. + */ + AV_FRAME_DATA_DETECTION_BBOXES, }; enum AVActiveFormatDescription { @@ -188,11 +209,67 @@ enum AVActiveFormatDescription { typedef struct AVFrameSideData { enum AVFrameSideDataType type; uint8_t *data; - int size; + size_t size; AVDictionary *metadata; AVBufferRef *buf; } AVFrameSideData; +/** + * Structure describing a single Region Of Interest. + * + * When multiple regions are defined in a single side-data block, they + * should be ordered from most to least important - some encoders are only + * capable of supporting a limited number of distinct regions, so will have + * to truncate the list. + * + * When overlapping regions are defined, the first region containing a given + * area of the frame applies. + */ +typedef struct AVRegionOfInterest { + /** + * Must be set to the size of this data structure (that is, + * sizeof(AVRegionOfInterest)). + */ + uint32_t self_size; + /** + * Distance in pixels from the top edge of the frame to the top and + * bottom edges and from the left edge of the frame to the left and + * right edges of the rectangle defining this region of interest. + * + * The constraints on a region are encoder dependent, so the region + * actually affected may be slightly larger for alignment or other + * reasons. + */ + int top; + int bottom; + int left; + int right; + /** + * Quantisation offset. + * + * Must be in the range -1 to +1. A value of zero indicates no quality + * change. A negative value asks for better quality (less quantisation), + * while a positive value asks for worse quality (greater quantisation). + * + * The range is calibrated so that the extreme values indicate the + * largest possible offset - if the rest of the frame is encoded with the + * worst possible quality, an offset of -1 indicates that this region + * should be encoded with the best possible quality anyway. Intermediate + * values are then interpolated in some codec-dependent way. + * + * For example, in 10-bit H.264 the quantisation parameter varies between + * -12 and 51. A typical qoffset value of -1/10 therefore indicates that + * this region should be encoded with a QP around one-tenth of the full + * range better than the rest of the frame. So, if most of the frame + * were to be encoded with a QP of around 30, this region would get a QP + * of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3). + * An extreme value of -1 would indicate that this region should be + * encoded with the best possible quality regardless of the treatment of + * the rest of the frame - that is, should be encoded at a QP of -12. + */ + AVRational qoffset; +} AVRegionOfInterest; + /** * This structure describes decoded (raw) audio or video data. * @@ -318,15 +395,6 @@ typedef struct AVFrame { */ int64_t pts; -#if FF_API_PKT_PTS - /** - * PTS copied from the AVPacket that was decoded to produce this frame. - * @deprecated use the pts field instead - */ - attribute_deprecated - int64_t pkt_pts; -#endif - /** * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) * This is also the Presentation time of this AVFrame calculated from @@ -353,14 +421,6 @@ typedef struct AVFrame { */ void *opaque; -#if FF_API_ERROR_FRAME - /** - * @deprecated unused - */ - attribute_deprecated - uint64_t error[AV_NUM_DATA_POINTERS]; -#endif - /** * When decoding, this signals how much the picture must be delayed. * extra_delay = repeat_pict / (2*fps) @@ -389,7 +449,6 @@ typedef struct AVFrame { * that time, * the decoder reorders values as needed and sets AVFrame.reordered_opaque * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque - * @deprecated in favor of pkt_pts */ int64_t reordered_opaque; @@ -522,6 +581,8 @@ typedef struct AVFrame { int decode_error_flags; #define FF_DECODE_ERROR_INVALID_BITSTREAM 1 #define FF_DECODE_ERROR_MISSING_REFERENCE 2 +#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4 +#define FF_DECODE_ERROR_DECODE_SLICES 8 /** * number of audio channels, only used for audio. @@ -539,24 +600,6 @@ typedef struct AVFrame { */ int pkt_size; -#if FF_API_FRAME_QP - /** - * QP table - */ - attribute_deprecated - int8_t *qscale_table; - /** - * QP store stride - */ - attribute_deprecated - int qstride; - - attribute_deprecated - int qscale_type; - - attribute_deprecated - AVBufferRef *qp_table_buf; -#endif /** * For hwaccel-format frames, this should be a reference to the * AVHWFramesContext describing the frame. @@ -604,69 +647,16 @@ typedef struct AVFrame { AVBufferRef *private_ref; } AVFrame; -#if FF_API_FRAME_GET_SET -/** - * Accessors for some AVFrame fields. These used to be provided for ABI - * compatibility, and do not need to be used anymore. - */ -attribute_deprecated -int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); -attribute_deprecated -void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_duration (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_duration (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_pkt_pos (const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_pos (AVFrame *frame, int64_t val); -attribute_deprecated -int64_t av_frame_get_channel_layout (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channel_layout (AVFrame *frame, int64_t val); -attribute_deprecated -int av_frame_get_channels (const AVFrame *frame); -attribute_deprecated -void av_frame_set_channels (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_sample_rate (const AVFrame *frame); -attribute_deprecated -void av_frame_set_sample_rate (AVFrame *frame, int val); -attribute_deprecated -AVDictionary *av_frame_get_metadata (const AVFrame *frame); -attribute_deprecated -void av_frame_set_metadata (AVFrame *frame, AVDictionary *val); -attribute_deprecated -int av_frame_get_decode_error_flags (const AVFrame *frame); -attribute_deprecated -void av_frame_set_decode_error_flags (AVFrame *frame, int val); -attribute_deprecated -int av_frame_get_pkt_size(const AVFrame *frame); -attribute_deprecated -void av_frame_set_pkt_size(AVFrame *frame, int val); -#if FF_API_FRAME_QP -attribute_deprecated -int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); -attribute_deprecated -int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); -#endif -attribute_deprecated -enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); -attribute_deprecated -void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); -attribute_deprecated -enum AVColorRange av_frame_get_color_range(const AVFrame *frame); -attribute_deprecated -void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val); -#endif +#if FF_API_COLORSPACE_NAME /** * Get the name of a colorspace. * @return a static string identifying the colorspace; can be NULL. + * @deprecated use av_color_space_name() */ +attribute_deprecated const char *av_get_colorspace_name(enum AVColorSpace val); - +#endif /** * Allocate an AVFrame and set its fields to default values. The resulting * struct must be freed using av_frame_free(). @@ -824,7 +814,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); */ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, - int size); + size_t size); /** * Add a new side data to a frame from an existing AVBufferRef @@ -850,8 +840,7 @@ AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type); /** - * If side data of the supplied type exists in the frame, free it and remove it - * from the frame. + * Remove and free all side data instances of the given type. */ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);