X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavcodec%2Favcodec.h;h=d6a4e4d429d14610dc677ea6dc0b65c710a7c192;hb=4e13e50432bd1c1a89f626f8196b55a0302c8f19;hp=742a2a39cbf35c9338ff9e86291a9fdf4ab939e9;hpb=a2318326f13f0e86c6d7222ec15659d2fa7d666f;p=ffmpeg diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 742a2a39cbf..d6a4e4d429d 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -264,6 +264,7 @@ enum AVCodecID { AV_CODEC_ID_TSCC2, AV_CODEC_ID_MTS2, AV_CODEC_ID_CLLC, + AV_CODEC_ID_MSS2, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -404,6 +405,8 @@ enum AVCodecID { AV_CODEC_ID_RALF, AV_CODEC_ID_IAC, AV_CODEC_ID_ILBC, + AV_CODEC_ID_OPUS, + AV_CODEC_ID_COMFORT_NOISE, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -988,7 +991,7 @@ typedef struct AVFrame { * extended_data must be used by the decoder in order to access all * channels. * - * encoding: unused + * encoding: set by user * decoding: set by AVCodecContext.get_buffer() */ uint8_t **extended_data; @@ -1009,7 +1012,7 @@ typedef struct AVFrame { /** * format of the frame, -1 if unknown or unset - * Values correspond to enum PixelFormat for video frames, + * Values correspond to enum AVPixelFormat for video frames, * enum AVSampleFormat for audio) * - encoding: unused * - decoding: Read by user. @@ -1440,22 +1443,25 @@ typedef struct AVCodecContext { int ticks_per_frame; /** - * Encoder delay. + * Codec delay. * * Video: * Number of frames the decoded output will be delayed relative to the * encoded input. * * Audio: - * Number of "priming" samples added to the beginning of the stream - * during encoding. The decoded output will be delayed by this many - * samples relative to the input to the encoder. Note that this field is - * purely informational and does not directly affect the pts output by - * the encoder, which should always be based on the actual presentation - * time, including any delay. + * For encoding, this is the number of "priming" samples added to the + * beginning of the stream. The decoded output will be delayed by this + * many samples relative to the input to the encoder. Note that this + * field is purely informational and does not directly affect the pts + * output by the encoder, which should always be based on the actual + * presentation time, including any delay. + * For decoding, this is the number of samples the decoder needs to + * output before the decoder's output is valid. When seeking, you should + * start decoding this many samples prior to your desired seek point. * * - encoding: Set by libavcodec. - * - decoding: unused + * - decoding: Set by libavcodec. */ int delay; @@ -1487,13 +1493,13 @@ typedef struct AVCodecContext { int gop_size; /** - * Pixel format, see PIX_FMT_xxx. + * Pixel format, see AV_PIX_FMT_xxx. * May be set by the demuxer if known from headers. * May be overriden by the decoder if it knows better. * - encoding: Set by user. * - decoding: Set by user if known, overridden by libavcodec if known */ - enum PixelFormat pix_fmt; + enum AVPixelFormat pix_fmt; /** * Motion estimation algorithm used for video coding. @@ -1540,7 +1546,7 @@ typedef struct AVCodecContext { * - encoding: unused * - decoding: Set by user, if not set the native format will be chosen. */ - enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt); + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); /** * maximum number of B-frames between non-B-frames @@ -2076,7 +2082,13 @@ typedef struct AVCodecContext { /* The following data should not be initialized. */ /** - * Samples per packet, initialized when calling 'init'. + * Number of samples per channel in an audio frame. + * + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame + * except the last must contain exactly frame_size samples per channel. + * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the + * frame size is not restricted. + * - decoding: may be set by some decoders to indicate constant frame size */ int frame_size; @@ -2615,8 +2627,12 @@ typedef struct AVCodecContext { #define FF_IDCT_INT 1 #define FF_IDCT_SIMPLE 2 #define FF_IDCT_SIMPLEMMX 3 +#if FF_API_LIBMPEG2 #define FF_IDCT_LIBMPEG2MMX 4 +#endif +#if FF_API_MMI #define FF_IDCT_MMI 5 +#endif #define FF_IDCT_ARM 7 #define FF_IDCT_ALTIVEC 8 #define FF_IDCT_SH4 9 @@ -2900,6 +2916,8 @@ typedef struct AVProfile { typedef struct AVCodecDefault AVCodecDefault; +struct AVSubtitle; + /** * AVCodec. */ @@ -2924,7 +2942,7 @@ typedef struct AVCodec { */ int capabilities; const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} - const enum PixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 + const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 @@ -2972,7 +2990,8 @@ typedef struct AVCodec { void (*init_static_data)(struct AVCodec *codec); int (*init)(AVCodecContext *); - int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, + const struct AVSubtitle *sub); /** * Encode data to an AVPacket. * @@ -3024,7 +3043,7 @@ typedef struct AVHWAccel { * * Only hardware accelerated formats are supported here. */ - enum PixelFormat pix_fmt; + enum AVPixelFormat pix_fmt; /** * Hardware accelerated codec capabilities. @@ -3253,7 +3272,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); /** * Allocate an AVFrame and set its fields to default values. The resulting - * struct can be deallocated by simply calling av_free(). + * struct must be freed using avcodec_free_frame(). * * @return An AVFrame filled with default values or NULL on failure. * @see avcodec_get_frame_defaults @@ -3263,9 +3282,21 @@ AVFrame *avcodec_alloc_frame(void); /** * Set the fields of the given AVFrame to default values. * - * @param pic The AVFrame of which the fields should be set to default values. + * @param frame The AVFrame of which the fields should be set to default values. + */ +void avcodec_get_frame_defaults(AVFrame *frame); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. + * + * @param frame frame to be freed. The pointer will be set to NULL. + * + * @warning this function does NOT free the data buffers themselves + * (it does not know how, since they might have been allocated with + * a custom get_buffer()). */ -void avcodec_get_frame_defaults(AVFrame *pic); +void avcodec_free_frame(AVFrame **frame); /** * Initialize the AVCodecContext to use the given AVCodec. Prior to using this @@ -3332,11 +3363,6 @@ void avsubtitle_free(AVSubtitle *sub); * @{ */ -/** - * @deprecated use NULL instead - */ -attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt); - /** * Default packet destructor. */ @@ -4007,9 +4033,11 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, * @} */ +#if FF_API_AVCODEC_RESAMPLE /** * @defgroup lavc_resample Audio resampling * @ingroup libavc + * @deprecated use libavresample instead * * @{ */ @@ -4034,6 +4062,7 @@ typedef struct ReSampleContext ReSampleContext; * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate * @return allocated ReSampleContext, NULL if error occurred */ +attribute_deprecated ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, @@ -4041,6 +4070,7 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int filter_length, int log2_phase_count, int linear, double cutoff); +attribute_deprecated int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); /** @@ -4049,6 +4079,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl * @param s a non-NULL pointer to a resample context previously * created with av_audio_resample_init() */ +attribute_deprecated void audio_resample_close(ReSampleContext *s); @@ -4061,6 +4092,7 @@ void audio_resample_close(ReSampleContext *s); between the 2 closest, if 0 the closest will be used * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate */ +attribute_deprecated struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); /** @@ -4072,6 +4104,7 @@ struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. * @return the number of samples written in dst or -1 if an error occurred */ +attribute_deprecated int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); @@ -4087,12 +4120,15 @@ int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consum * note, due to rounding the actual compensation might be slightly different, * especially if the compensation_distance is large and the in_rate used during init is small */ +attribute_deprecated void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); +attribute_deprecated void av_resample_close(struct AVResampleContext *c); /** * @} */ +#endif /** * @addtogroup lavc_picture @@ -4110,7 +4146,7 @@ void av_resample_close(struct AVResampleContext *c); * @param height the height of the picture * @return zero if successful, a negative value if not */ -int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height); +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); /** * Free a picture previously allocated by avpicture_alloc(). @@ -4142,7 +4178,7 @@ void avpicture_free(AVPicture *picture); * @return size of the image data in bytes */ int avpicture_fill(AVPicture *picture, uint8_t *ptr, - enum PixelFormat pix_fmt, int width, int height); + enum AVPixelFormat pix_fmt, int width, int height); /** * Copy pixel data from an AVPicture into a buffer. @@ -4159,7 +4195,8 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr, * @param[in] dest_size The size of 'dest'. * @return The number of bytes written to dest, or a negative value (error code) on error. */ -int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height, +int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, + int width, int height, unsigned char *dest, int dest_size); /** @@ -4174,29 +4211,29 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, * @param height the height of the image * @return Image data size in bytes or -1 on error (e.g. too large dimensions). */ -int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height); +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); /** * deinterlace - if not supported return -1 */ int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, - enum PixelFormat pix_fmt, int width, int height); + enum AVPixelFormat pix_fmt, int width, int height); /** * Copy image src to dst. Wraps av_picture_data_copy() above. */ void av_picture_copy(AVPicture *dst, const AVPicture *src, - enum PixelFormat pix_fmt, int width, int height); + enum AVPixelFormat pix_fmt, int width, int height); /** * Crop image top and left side. */ int av_picture_crop(AVPicture *dst, const AVPicture *src, - enum PixelFormat pix_fmt, int top_band, int left_band); + enum AVPixelFormat pix_fmt, int top_band, int left_band); /** * Pad image. */ -int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt, +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color); /** @@ -4219,14 +4256,14 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, * @{ */ -void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift); +void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); /** * Return a value representing the fourCC code associated to the * pixel format pix_fmt, or 0 if no associated fourCC code can be * found. */ -unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt); +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ #define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ @@ -4252,7 +4289,7 @@ unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt); * @param[in] has_alpha Whether the source pixel format alpha channel is used. * @return Combination of flags informing you what kind of losses will occur. */ -int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt, +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, int has_alpha); #if FF_API_FIND_BEST_PIX_FMT @@ -4269,8 +4306,8 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_ * pix_fmt_mask parameter. * * @code - * src_pix_fmt = PIX_FMT_YUV420P; - * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24); + * src_pix_fmt = AV_PIX_FMT_YUV420P; + * pix_fmt_mask = (1 << AV_PIX_FMT_YUV422P) || (1 << AV_PIX_FMT_RGB24); * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss); * @endcode * @@ -4281,7 +4318,7 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_ * @return The best pixel format to convert to or -1 if none was found. */ attribute_deprecated -enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt, +enum AVPixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); #endif /* FF_API_FIND_BEST_PIX_FMT */ @@ -4296,17 +4333,17 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma * pix_fmt_list parameter. * * - * @param[in] pix_fmt_list PIX_FMT_NONE terminated array of pixel formats to choose from + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from * @param[in] src_pix_fmt source pixel format * @param[in] has_alpha Whether the source pixel format alpha channel is used. * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. * @return The best pixel format to convert to or -1 if none was found. */ -enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat *pix_fmt_list, - enum PixelFormat src_pix_fmt, - int has_alpha, int *loss_ptr); +enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list, + enum AVPixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); -enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); /** * @}