diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-17 01:40:45 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-17 02:37:30 +0100 |
commit | 67f5650a78de2567c58dbd7545434cc6d3ef9b7e (patch) | |
tree | 34b08ed769cd7a1f071bf9ff4eca1348481c0bf1 /libavcodec/avcodec.h | |
parent | 905c4dc2b0d564e1b9b6bc6eeca0b8915b81cd8c (diff) | |
parent | 9e12002f114d7e0b0ef69519518cdc0391e5e198 (diff) | |
download | ffmpeg-67f5650a78de2567c58dbd7545434cc6d3ef9b7e.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
rv34: add NEON rv34_idct_add
rv34: 1-pass inter MB reconstruction
add SMJPEG muxer
avformat: split out common SMJPEG code
pictordec: Use bytestream2 functions
avconv: use avcodec_encode_audio2()
pcmenc: use AVCodec.encode2()
avcodec: bump minor version and add APIChanges for the new audio encoding API
avcodec: Add avcodec_encode_audio2() as replacement for avcodec_encode_audio()
avcodec: add a public function, avcodec_fill_audio_frame().
rv34: Intra 16x16 handling
rv34: Inter/intra MB code split
Conflicts:
Changelog
libavcodec/avcodec.h
libavcodec/pictordec.c
libavcodec/utils.c
libavcodec/version.h
libavcodec/x86/rv34dsp.asm
libavformat/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r-- | libavcodec/avcodec.h | 92 |
1 files changed, 90 insertions, 2 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 4e55e0e12b..e690c81e12 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -761,6 +761,11 @@ typedef struct RcOverride{ * Encoders: * The encoder needs to be fed with NULL data at the end of encoding until the * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. */ #define CODEC_CAP_DELAY 0x0020 /** @@ -816,6 +821,10 @@ typedef struct RcOverride{ */ #define CODEC_CAP_AUTO_THREADS 0x8000 /** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000 +/** * Codec is lossless. */ #define CODEC_CAP_LOSSLESS 0x80000000 @@ -3314,6 +3323,19 @@ typedef struct AVCodec { * Initialize codec static data, called from avcodec_register(). */ void (*init_static_data)(struct AVCodec *codec); + + /** + * Encode data to an AVPacket. + * + * @param avctx codec context + * @param avpkt output AVPacket (may contain a user-provided buffer) + * @param[in] frame AVFrame containing the raw data to be encoded + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a + * non-empty packet was returned in avpkt. + * @return 0 on success, negative error code on failure + */ + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, + int *got_packet_ptr); } AVCodec; /** @@ -4331,9 +4353,12 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, */ void avsubtitle_free(AVSubtitle *sub); +#if FF_API_OLD_ENCODE_AUDIO /** * Encode an audio frame from samples into buf. * + * @deprecated Use avcodec_encode_audio2 instead. + * * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user * will know how much space is needed because it depends on the value passed @@ -4353,8 +4378,71 @@ void avsubtitle_free(AVSubtitle *sub); * @return On error a negative value is returned, on success zero or the number * of bytes used to encode the data read from the input buffer. */ -int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const short *samples); +int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, + uint8_t *buf, int buf_size, + const short *samples); +#endif + +/** + * Encode a frame of audio. + * + * Takes input samples from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay, split, and combine input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * 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 + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. + * @param[in] frame AVFrame containing the raw audio data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * There are 2 codec capabilities that affect the allowed + * values of frame->nb_samples. + * If CODEC_CAP_SMALL_LAST_FRAME is set, then only the final + * frame may be smaller than avctx->frame_size, and all other + * frames must be equal to avctx->frame_size. + * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * can have any number of samples. + * If neither is set, frame->nb_samples must be equal to + * avctx->frame_size for all frames. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +/** + * Fill audio frame data and linesize. + * AVFrame extended_data channel pointers are allocated if necessary for + * planar audio. + * + * @param frame the AVFrame + * frame->nb_samples must be set prior to calling the + * function. This function fills in frame->data, + * frame->extended_data, frame->linesize[0]. + * @param nb_channels channel count + * @param sample_fmt sample format + * @param buf buffer to use for frame data + * @param buf_size size of buffer + * @param align plane size sample alignment + * @return 0 on success, negative error code on failure + */ +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, + enum AVSampleFormat sample_fmt, const uint8_t *buf, + int buf_size, int align); /** * Encode a video frame from pict into buf. |