comparison avcodec.h @ 12024:fdafbcef52f5 libavcodec

Fix grammar errors in documentation
author mru
date Wed, 30 Jun 2010 15:38:06 +0000
parents f2007d7c3f1d
children 2d730a4acc77
comparison
equal deleted inserted replaced
12023:c7455450364d 12024:fdafbcef52f5
46 #define AV_NOPTS_VALUE INT64_C(0x8000000000000000) 46 #define AV_NOPTS_VALUE INT64_C(0x8000000000000000)
47 #define AV_TIME_BASE 1000000 47 #define AV_TIME_BASE 1000000
48 #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} 48 #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
49 49
50 /** 50 /**
51 * Identifies the syntax and semantics of the bitstream. 51 * Identifie the syntax and semantics of the bitstream.
52 * The principle is roughly: 52 * The principle is roughly:
53 * Two decoders with the same ID can decode the same streams. 53 * Two decoders with the same ID can decode the same streams.
54 * Two encoders with the same ID can encode compatible streams. 54 * Two encoders with the same ID can encode compatible streams.
55 * There may be slight deviations from the principle due to implementation 55 * There may be slight deviations from the principle due to implementation
56 * details. 56 * details.
2949 */ 2949 */
2950 attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels, 2950 attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels,
2951 int output_rate, int input_rate); 2951 int output_rate, int input_rate);
2952 #endif 2952 #endif
2953 /** 2953 /**
2954 * Initializes audio resampling context 2954 * Initialize audio resampling context
2955 * 2955 *
2956 * @param output_channels number of output channels 2956 * @param output_channels number of output channels
2957 * @param input_channels number of input channels 2957 * @param input_channels number of input channels
2958 * @param output_rate output sample rate 2958 * @param output_rate output sample rate
2959 * @param input_rate input sample rate 2959 * @param input_rate input sample rate
2976 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); 2976 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
2977 void audio_resample_close(ReSampleContext *s); 2977 void audio_resample_close(ReSampleContext *s);
2978 2978
2979 2979
2980 /** 2980 /**
2981 * Initializes an audio resampler. 2981 * Initialize an audio resampler.
2982 * Note, if either rate is not an integer then simply scale both rates up so they are. 2982 * Note, if either rate is not an integer then simply scale both rates up so they are.
2983 * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq 2983 * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
2984 * @param log2_phase_count log2 of the number of entries in the polyphase filterbank 2984 * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
2985 * @param linear If 1 then the used FIR filter will be linearly interpolated 2985 * @param linear If 1 then the used FIR filter will be linearly interpolated
2986 between the 2 closest, if 0 the closest will be used 2986 between the 2 closest, if 0 the closest will be used
2999 */ 2999 */
3000 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); 3000 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
3001 3001
3002 3002
3003 /** 3003 /**
3004 * Compensates samplerate/timestamp drift. The compensation is done by changing 3004 * Compensate samplerate/timestamp drift. The compensation is done by changing
3005 * the resampler parameters, so no audible clicks or similar distortions occur 3005 * the resampler parameters, so no audible clicks or similar distortions occur
3006 * @param compensation_distance distance in output samples over which the compensation should be performed 3006 * @param compensation_distance distance in output samples over which the compensation should be performed
3007 * @param sample_delta number of output samples which should be output less 3007 * @param sample_delta number of output samples which should be output less
3008 * 3008 *
3009 * example: av_resample_compensate(c, 10, 500) 3009 * example: av_resample_compensate(c, 10, 500)
3072 const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt); 3072 const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
3073 void avcodec_set_dimensions(AVCodecContext *s, int width, int height); 3073 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
3074 3074
3075 #if LIBAVCODEC_VERSION_MAJOR < 53 3075 #if LIBAVCODEC_VERSION_MAJOR < 53
3076 /** 3076 /**
3077 * Returns the pixel format corresponding to the name name. 3077 * Return the pixel format corresponding to the name name.
3078 * 3078 *
3079 * If there is no pixel format with name name, then looks for a 3079 * If there is no pixel format with name name, then look for a
3080 * pixel format with the name corresponding to the native endian 3080 * pixel format with the name corresponding to the native endian
3081 * format of name. 3081 * format of name.
3082 * For example in a little-endian system, first looks for "gray16", 3082 * For example in a little-endian system, first look for "gray16",
3083 * then for "gray16le". 3083 * then for "gray16le".
3084 * 3084 *
3085 * Finally if no pixel format has been found, returns PIX_FMT_NONE. 3085 * Finally if no pixel format has been found, return PIX_FMT_NONE.
3086 * 3086 *
3087 * @deprecated Deprecated in favor of av_get_pix_fmt(). 3087 * @deprecated Deprecated in favor of av_get_pix_fmt().
3088 */ 3088 */
3089 attribute_deprecated enum PixelFormat avcodec_get_pix_fmt(const char* name); 3089 attribute_deprecated enum PixelFormat avcodec_get_pix_fmt(const char* name);
3090 #endif 3090 #endif
3091 3091
3092 /** 3092 /**
3093 * Returns a value representing the fourCC code associated to the 3093 * Return a value representing the fourCC code associated to the
3094 * pixel format pix_fmt, or 0 if no associated fourCC code can be 3094 * pixel format pix_fmt, or 0 if no associated fourCC code can be
3095 * found. 3095 * found.
3096 */ 3096 */
3097 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt); 3097 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt);
3098 3098
3099 /** 3099 /**
3100 * Puts a string representing the codec tag codec_tag in buf. 3100 * Put a string representing the codec tag codec_tag in buf.
3101 * 3101 *
3102 * @param buf_size size in bytes of buf 3102 * @param buf_size size in bytes of buf
3103 * @return the length of the string that would have been generated if 3103 * @return the length of the string that would have been generated if
3104 * enough space had been available, excluding the trailing null 3104 * enough space had been available, excluding the trailing null
3105 */ 3105 */
3111 #define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ 3111 #define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
3112 #define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ 3112 #define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
3113 #define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ 3113 #define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
3114 3114
3115 /** 3115 /**
3116 * Computes what kind of losses will occur when converting from one specific 3116 * Compute what kind of losses will occur when converting from one specific
3117 * pixel format to another. 3117 * pixel format to another.
3118 * When converting from one pixel format to another, information loss may occur. 3118 * When converting from one pixel format to another, information loss may occur.
3119 * For example, when converting from RGB24 to GRAY, the color information will 3119 * For example, when converting from RGB24 to GRAY, the color information will
3120 * be lost. Similarly, other losses occur when converting from some formats to 3120 * be lost. Similarly, other losses occur when converting from some formats to
3121 * other formats. These losses can involve loss of chroma, but also loss of 3121 * other formats. These losses can involve loss of chroma, but also loss of
3131 */ 3131 */
3132 int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt, 3132 int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
3133 int has_alpha); 3133 int has_alpha);
3134 3134
3135 /** 3135 /**
3136 * Finds the best pixel format to convert to given a certain source pixel 3136 * Find the best pixel format to convert to given a certain source pixel
3137 * format. When converting from one pixel format to another, information loss 3137 * format. When converting from one pixel format to another, information loss
3138 * may occur. For example, when converting from RGB24 to GRAY, the color 3138 * may occur. For example, when converting from RGB24 to GRAY, the color
3139 * information will be lost. Similarly, other losses occur when converting from 3139 * information will be lost. Similarly, other losses occur when converting from
3140 * some formats to other formats. avcodec_find_best_pix_fmt() searches which of 3140 * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
3141 * the given pixel formats should be used to suffer the least amount of loss. 3141 * the given pixel formats should be used to suffer the least amount of loss.
3193 * or NULL if c is the last one. 3193 * or NULL if c is the last one.
3194 */ 3194 */
3195 AVCodec *av_codec_next(AVCodec *c); 3195 AVCodec *av_codec_next(AVCodec *c);
3196 3196
3197 /** 3197 /**
3198 * Returns the LIBAVCODEC_VERSION_INT constant. 3198 * Return the LIBAVCODEC_VERSION_INT constant.
3199 */ 3199 */
3200 unsigned avcodec_version(void); 3200 unsigned avcodec_version(void);
3201 3201
3202 /** 3202 /**
3203 * Returns the libavcodec build-time configuration. 3203 * Return the libavcodec build-time configuration.
3204 */ 3204 */
3205 const char *avcodec_configuration(void); 3205 const char *avcodec_configuration(void);
3206 3206
3207 /** 3207 /**
3208 * Returns the libavcodec license. 3208 * Return the libavcodec license.
3209 */ 3209 */
3210 const char *avcodec_license(void); 3210 const char *avcodec_license(void);
3211 3211
3212 /** 3212 /**
3213 * Initializes libavcodec. 3213 * Initialize libavcodec.
3214 * 3214 *
3215 * @warning This function must be called before any other libavcodec 3215 * @warning This function must be called before any other libavcodec
3216 * function. 3216 * function.
3217 */ 3217 */
3218 void avcodec_init(void); 3218 void avcodec_init(void);
3230 * @see avcodec_init() 3230 * @see avcodec_init()
3231 */ 3231 */
3232 void avcodec_register(AVCodec *codec); 3232 void avcodec_register(AVCodec *codec);
3233 3233
3234 /** 3234 /**
3235 * Finds a registered encoder with a matching codec ID. 3235 * Find a registered encoder with a matching codec ID.
3236 * 3236 *
3237 * @param id CodecID of the requested encoder 3237 * @param id CodecID of the requested encoder
3238 * @return An encoder if one was found, NULL otherwise. 3238 * @return An encoder if one was found, NULL otherwise.
3239 */ 3239 */
3240 AVCodec *avcodec_find_encoder(enum CodecID id); 3240 AVCodec *avcodec_find_encoder(enum CodecID id);
3241 3241
3242 /** 3242 /**
3243 * Finds a registered encoder with the specified name. 3243 * Find a registered encoder with the specified name.
3244 * 3244 *
3245 * @param name name of the requested encoder 3245 * @param name name of the requested encoder
3246 * @return An encoder if one was found, NULL otherwise. 3246 * @return An encoder if one was found, NULL otherwise.
3247 */ 3247 */
3248 AVCodec *avcodec_find_encoder_by_name(const char *name); 3248 AVCodec *avcodec_find_encoder_by_name(const char *name);
3249 3249
3250 /** 3250 /**
3251 * Finds a registered decoder with a matching codec ID. 3251 * Find a registered decoder with a matching codec ID.
3252 * 3252 *
3253 * @param id CodecID of the requested decoder 3253 * @param id CodecID of the requested decoder
3254 * @return A decoder if one was found, NULL otherwise. 3254 * @return A decoder if one was found, NULL otherwise.
3255 */ 3255 */
3256 AVCodec *avcodec_find_decoder(enum CodecID id); 3256 AVCodec *avcodec_find_decoder(enum CodecID id);
3257 3257
3258 /** 3258 /**
3259 * Finds a registered decoder with the specified name. 3259 * Find a registered decoder with the specified name.
3260 * 3260 *
3261 * @param name name of the requested decoder 3261 * @param name name of the requested decoder
3262 * @return A decoder if one was found, NULL otherwise. 3262 * @return A decoder if one was found, NULL otherwise.
3263 */ 3263 */
3264 AVCodec *avcodec_find_decoder_by_name(const char *name); 3264 AVCodec *avcodec_find_decoder_by_name(const char *name);
3265 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); 3265 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
3266 3266
3267 /** 3267 /**
3268 * Sets the fields of the given AVCodecContext to default values. 3268 * Set the fields of the given AVCodecContext to default values.
3269 * 3269 *
3270 * @param s The AVCodecContext of which the fields should be set to default values. 3270 * @param s The AVCodecContext of which the fields should be set to default values.
3271 */ 3271 */
3272 void avcodec_get_context_defaults(AVCodecContext *s); 3272 void avcodec_get_context_defaults(AVCodecContext *s);
3273 3273
3274 /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! 3274 /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
3275 * we WILL change its arguments and name a few times! */ 3275 * we WILL change its arguments and name a few times! */
3276 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType); 3276 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
3277 3277
3278 /** 3278 /**
3279 * Allocates an AVCodecContext and sets its fields to default values. The 3279 * Allocate an AVCodecContext and set its fields to default values. The
3280 * resulting struct can be deallocated by simply calling av_free(). 3280 * resulting struct can be deallocated by simply calling av_free().
3281 * 3281 *
3282 * @return An AVCodecContext filled with default values or NULL on failure. 3282 * @return An AVCodecContext filled with default values or NULL on failure.
3283 * @see avcodec_get_context_defaults 3283 * @see avcodec_get_context_defaults
3284 */ 3284 */
3300 * @return AVERROR() on error (e.g. memory allocation error), 0 on success 3300 * @return AVERROR() on error (e.g. memory allocation error), 0 on success
3301 */ 3301 */
3302 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); 3302 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
3303 3303
3304 /** 3304 /**
3305 * Sets the fields of the given AVFrame to default values. 3305 * Set the fields of the given AVFrame to default values.
3306 * 3306 *
3307 * @param pic The AVFrame of which the fields should be set to default values. 3307 * @param pic The AVFrame of which the fields should be set to default values.
3308 */ 3308 */
3309 void avcodec_get_frame_defaults(AVFrame *pic); 3309 void avcodec_get_frame_defaults(AVFrame *pic);
3310 3310
3311 /** 3311 /**
3312 * Allocates an AVFrame and sets its fields to default values. The resulting 3312 * Allocate an AVFrame and set its fields to default values. The resulting
3313 * struct can be deallocated by simply calling av_free(). 3313 * struct can be deallocated by simply calling av_free().
3314 * 3314 *
3315 * @return An AVFrame filled with default values or NULL on failure. 3315 * @return An AVFrame filled with default values or NULL on failure.
3316 * @see avcodec_get_frame_defaults 3316 * @see avcodec_get_frame_defaults
3317 */ 3317 */
3320 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); 3320 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
3321 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); 3321 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
3322 int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); 3322 int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
3323 3323
3324 /** 3324 /**
3325 * Returns the amount of padding in pixels which the get_buffer callback must 3325 * Return the amount of padding in pixels which the get_buffer callback must
3326 * provide around the edge of the image for codecs which do not have the 3326 * provide around the edge of the image for codecs which do not have the
3327 * CODEC_FLAG_EMU_EDGE flag. 3327 * CODEC_FLAG_EMU_EDGE flag.
3328 * 3328 *
3329 * @return Required padding in pixels. 3329 * @return Required padding in pixels.
3330 */ 3330 */
3331 unsigned avcodec_get_edge_width(void); 3331 unsigned avcodec_get_edge_width(void);
3332 /** 3332 /**
3333 * Modifies width and height values so that they will result in a memory 3333 * Modify width and height values so that they will result in a memory
3334 * buffer that is acceptable for the codec if you do not use any horizontal 3334 * buffer that is acceptable for the codec if you do not use any horizontal
3335 * padding. 3335 * padding.
3336 * 3336 *
3337 * May only be used if a codec with CODEC_CAP_DR1 has been opened. 3337 * May only be used if a codec with CODEC_CAP_DR1 has been opened.
3338 * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased 3338 * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
3339 * according to avcodec_get_edge_width() before. 3339 * according to avcodec_get_edge_width() before.
3340 */ 3340 */
3341 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); 3341 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
3342 /** 3342 /**
3343 * Modifies width and height values so that they will result in a memory 3343 * Modify width and height values so that they will result in a memory
3344 * buffer that is acceptable for the codec if you also ensure that all 3344 * buffer that is acceptable for the codec if you also ensure that all
3345 * line sizes are a multiple of the respective linesize_align[i]. 3345 * line sizes are a multiple of the respective linesize_align[i].
3346 * 3346 *
3347 * May only be used if a codec with CODEC_CAP_DR1 has been opened. 3347 * May only be used if a codec with CODEC_CAP_DR1 has been opened.
3348 * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased 3348 * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
3350 */ 3350 */
3351 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, 3351 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
3352 int linesize_align[4]); 3352 int linesize_align[4]);
3353 3353
3354 /** 3354 /**
3355 * Checks if the given dimension of a picture is valid, meaning that all 3355 * Check if the given dimension of a picture is valid, meaning that all
3356 * bytes of the picture can be addressed with a signed int. 3356 * bytes of the picture can be addressed with a signed int.
3357 * 3357 *
3358 * @param[in] w Width of the picture. 3358 * @param[in] w Width of the picture.
3359 * @param[in] h Height of the picture. 3359 * @param[in] h Height of the picture.
3360 * @return Zero if valid, a negative value if invalid. 3360 * @return Zero if valid, a negative value if invalid.
3367 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); 3367 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
3368 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); 3368 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
3369 //FIXME func typedef 3369 //FIXME func typedef
3370 3370
3371 /** 3371 /**
3372 * Initializes the AVCodecContext to use the given AVCodec. Prior to using this 3372 * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
3373 * function the context has to be allocated. 3373 * function the context has to be allocated.
3374 * 3374 *
3375 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), 3375 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
3376 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for 3376 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
3377 * retrieving a codec. 3377 * retrieving a codec.
3397 */ 3397 */
3398 int avcodec_open(AVCodecContext *avctx, AVCodec *codec); 3398 int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
3399 3399
3400 #if LIBAVCODEC_VERSION_MAJOR < 53 3400 #if LIBAVCODEC_VERSION_MAJOR < 53
3401 /** 3401 /**
3402 * Decodes an audio frame from buf into samples. 3402 * Decode an audio frame from buf into samples.
3403 * Wrapper function which calls avcodec_decode_audio3. 3403 * Wrapper function which calls avcodec_decode_audio3.
3404 * 3404 *
3405 * @deprecated Use avcodec_decode_audio3 instead. 3405 * @deprecated Use avcodec_decode_audio3 instead.
3406 * @param avctx the codec context 3406 * @param avctx the codec context
3407 * @param[out] samples the output buffer 3407 * @param[out] samples the output buffer
3415 int *frame_size_ptr, 3415 int *frame_size_ptr,
3416 const uint8_t *buf, int buf_size); 3416 const uint8_t *buf, int buf_size);
3417 #endif 3417 #endif
3418 3418
3419 /** 3419 /**
3420 * Decodes the audio frame of size avpkt->size from avpkt->data into samples. 3420 * Decode the audio frame of size avpkt->size from avpkt->data into samples.
3421 * Some decoders may support multiple frames in a single AVPacket, such 3421 * Some decoders may support multiple frames in a single AVPacket, such
3422 * decoders would then just decode the first frame. In this case, 3422 * decoders would then just decode the first frame. In this case,
3423 * avcodec_decode_audio3 has to be called again with an AVPacket that contains 3423 * avcodec_decode_audio3 has to be called again with an AVPacket that contains
3424 * the remaining data in order to decode the second frame etc. 3424 * the remaining data in order to decode the second frame etc.
3425 * If no frame 3425 * If no frame
3459 int *frame_size_ptr, 3459 int *frame_size_ptr,
3460 AVPacket *avpkt); 3460 AVPacket *avpkt);
3461 3461
3462 #if LIBAVCODEC_VERSION_MAJOR < 53 3462 #if LIBAVCODEC_VERSION_MAJOR < 53
3463 /** 3463 /**
3464 * Decodes a video frame from buf into picture. 3464 * Decode a video frame from buf into picture.
3465 * Wrapper function which calls avcodec_decode_video2. 3465 * Wrapper function which calls avcodec_decode_video2.
3466 * 3466 *
3467 * @deprecated Use avcodec_decode_video2 instead. 3467 * @deprecated Use avcodec_decode_video2 instead.
3468 * @param avctx the codec context 3468 * @param avctx the codec context
3469 * @param[out] picture The AVFrame in which the decoded video frame will be stored. 3469 * @param[out] picture The AVFrame in which the decoded video frame will be stored.
3477 int *got_picture_ptr, 3477 int *got_picture_ptr,
3478 const uint8_t *buf, int buf_size); 3478 const uint8_t *buf, int buf_size);
3479 #endif 3479 #endif
3480 3480
3481 /** 3481 /**
3482 * Decodes the video frame of size avpkt->size from avpkt->data into picture. 3482 * Decode the video frame of size avpkt->size from avpkt->data into picture.
3483 * Some decoders may support multiple frames in a single AVPacket, such 3483 * Some decoders may support multiple frames in a single AVPacket, such
3484 * decoders would then just decode the first frame. 3484 * decoders would then just decode the first frame.
3485 * 3485 *
3486 * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than 3486 * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
3487 * the actual read bytes because some optimized bitstream readers read 32 or 64 3487 * the actual read bytes because some optimized bitstream readers read 32 or 64
3530 int *got_sub_ptr, 3530 int *got_sub_ptr,
3531 const uint8_t *buf, int buf_size); 3531 const uint8_t *buf, int buf_size);
3532 #endif 3532 #endif
3533 3533
3534 /** 3534 /**
3535 * Decodes a subtitle message. 3535 * Decode a subtitle message.
3536 * Returns a negative value on error, otherwise returns the number of bytes used. 3536 * Return a negative value on error, otherwise returns the number of bytes used.
3537 * If no subtitle could be decompressed, got_sub_ptr is zero. 3537 * If no subtitle could be decompressed, got_sub_ptr is zero.
3538 * Otherwise, the subtitle is stored in *sub. 3538 * Otherwise, the subtitle is stored in *sub.
3539 * 3539 *
3540 * @param avctx the codec context 3540 * @param avctx the codec context
3541 * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored. 3541 * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored.
3548 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, 3548 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
3549 int *data_size_ptr, 3549 int *data_size_ptr,
3550 uint8_t *buf, int buf_size); 3550 uint8_t *buf, int buf_size);
3551 3551
3552 /** 3552 /**
3553 * Encodes an audio frame from samples into buf. 3553 * Encode an audio frame from samples into buf.
3554 * 3554 *
3555 * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. 3555 * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.
3556 * However, for PCM audio the user will know how much space is needed 3556 * However, for PCM audio the user will know how much space is needed
3557 * because it depends on the value passed in buf_size as described 3557 * because it depends on the value passed in buf_size as described
3558 * below. In that case a lower value can be used. 3558 * below. In that case a lower value can be used.
3570 */ 3570 */
3571 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, 3571 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
3572 const short *samples); 3572 const short *samples);
3573 3573
3574 /** 3574 /**
3575 * Encodes a video frame from pict into buf. 3575 * Encode a video frame from pict into buf.
3576 * The input picture should be 3576 * The input picture should be
3577 * stored using a specific format, namely avctx.pix_fmt. 3577 * stored using a specific format, namely avctx.pix_fmt.
3578 * 3578 *
3579 * @param avctx the codec context 3579 * @param avctx the codec context
3580 * @param[out] buf the output buffer for the bitstream of encoded frame 3580 * @param[out] buf the output buffer for the bitstream of encoded frame
3610 void avcodec_default_free_buffers(AVCodecContext *s); 3610 void avcodec_default_free_buffers(AVCodecContext *s);
3611 3611
3612 /* misc useful functions */ 3612 /* misc useful functions */
3613 3613
3614 /** 3614 /**
3615 * Returns a single letter to describe the given picture type pict_type. 3615 * Return a single letter to describe the given picture type pict_type.
3616 * 3616 *
3617 * @param[in] pict_type the picture type 3617 * @param[in] pict_type the picture type
3618 * @return A single character representing the picture type. 3618 * @return A single character representing the picture type.
3619 */ 3619 */
3620 char av_get_pict_type_char(int pict_type); 3620 char av_get_pict_type_char(int pict_type);
3621 3621
3622 /** 3622 /**
3623 * Returns codec bits per sample. 3623 * Return codec bits per sample.
3624 * 3624 *
3625 * @param[in] codec_id the codec 3625 * @param[in] codec_id the codec
3626 * @return Number of bits per sample or zero if unknown for the given codec. 3626 * @return Number of bits per sample or zero if unknown for the given codec.
3627 */ 3627 */
3628 int av_get_bits_per_sample(enum CodecID codec_id); 3628 int av_get_bits_per_sample(enum CodecID codec_id);
3629 3629
3630 /** 3630 /**
3631 * Returns sample format bits per sample. 3631 * Return sample format bits per sample.
3632 * 3632 *
3633 * @param[in] sample_fmt the sample format 3633 * @param[in] sample_fmt the sample format
3634 * @return Number of bits per sample or zero if unknown for the given sample format. 3634 * @return Number of bits per sample or zero if unknown for the given sample format.
3635 */ 3635 */
3636 int av_get_bits_per_sample_format(enum SampleFormat sample_fmt); 3636 int av_get_bits_per_sample_format(enum SampleFormat sample_fmt);
3859 AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); 3859 AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
3860 3860
3861 /* memory */ 3861 /* memory */
3862 3862
3863 /** 3863 /**
3864 * Reallocates the given block if it is not large enough, otherwise it 3864 * Reallocate the given block if it is not large enough, otherwise do nothing.
3865 * does nothing.
3866 * 3865 *
3867 * @see av_realloc 3866 * @see av_realloc
3868 */ 3867 */
3869 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); 3868 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
3870 3869
3871 /** 3870 /**
3872 * Allocates a buffer, reusing the given one if large enough. 3871 * Allocate a buffer, reusing the given one if large enough.
3873 * 3872 *
3874 * Contrary to av_fast_realloc the current buffer contents might not be 3873 * Contrary to av_fast_realloc the current buffer contents might not be
3875 * preserved and on error the old buffer is freed, thus no special 3874 * preserved and on error the old buffer is freed, thus no special
3876 * handling to avoid memleaks is necessary. 3875 * handling to avoid memleaks is necessary.
3877 * 3876 *
3899 */ 3898 */
3900 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt, 3899 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt,
3901 int padtop, int padbottom, int padleft, int padright, int *color); 3900 int padtop, int padbottom, int padleft, int padright, int *color);
3902 3901
3903 /** 3902 /**
3904 * Encodes extradata length to a buffer. Used by xiph codecs. 3903 * Encode extradata length to a buffer. Used by xiph codecs.
3905 * 3904 *
3906 * @param s buffer to write to; must be at least (v/255+1) bytes long 3905 * @param s buffer to write to; must be at least (v/255+1) bytes long
3907 * @param v size of extradata in bytes 3906 * @param v size of extradata in bytes
3908 * @return number of bytes written to the buffer. 3907 * @return number of bytes written to the buffer.
3909 */ 3908 */
3910 unsigned int av_xiphlacing(unsigned char *s, unsigned int v); 3909 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
3911 3910
3912 /** 3911 /**
3913 * Parses str and put in width_ptr and height_ptr the detected values. 3912 * Parse str and put in width_ptr and height_ptr the detected values.
3914 * 3913 *
3915 * @return 0 in case of a successful parsing, a negative value otherwise 3914 * @return 0 in case of a successful parsing, a negative value otherwise
3916 * @param[in] str the string to parse: it has to be a string in the format 3915 * @param[in] str the string to parse: it has to be a string in the format
3917 * <width>x<height> or a valid video frame size abbreviation. 3916 * <width>x<height> or a valid video frame size abbreviation.
3918 * @param[in,out] width_ptr pointer to the variable which will contain the detected 3917 * @param[in,out] width_ptr pointer to the variable which will contain the detected
3921 * frame height value 3920 * frame height value
3922 */ 3921 */
3923 int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str); 3922 int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
3924 3923
3925 /** 3924 /**
3926 * Parses str and put in frame_rate the detected values. 3925 * Parse str and store the detected values in *frame_rate.
3927 * 3926 *
3928 * @return 0 in case of a successful parsing, a negative value otherwise 3927 * @return 0 in case of a successful parsing, a negative value otherwise
3929 * @param[in] str the string to parse: it has to be a string in the format 3928 * @param[in] str the string to parse: it has to be a string in the format
3930 * <frame_rate_num>/<frame_rate_den>, a float number or a valid video rate abbreviation 3929 * <frame_rate_num>/<frame_rate_den>, a float number or a valid video rate abbreviation
3931 * @param[in,out] frame_rate pointer to the AVRational which will contain the detected 3930 * @param[in,out] frame_rate pointer to the AVRational which will contain the detected
3946 * mailing list. 3945 * mailing list.
3947 */ 3946 */
3948 void av_log_missing_feature(void *avc, const char *feature, int want_sample); 3947 void av_log_missing_feature(void *avc, const char *feature, int want_sample);
3949 3948
3950 /** 3949 /**
3951 * Logs a generic warning message asking for a sample. This function is 3950 * Log a generic warning message asking for a sample. This function is
3952 * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) 3951 * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
3953 * only, and would normally not be used by applications. 3952 * only, and would normally not be used by applications.
3954 * @param[in] avc a pointer to an arbitrary struct of which the first field is 3953 * @param[in] avc a pointer to an arbitrary struct of which the first field is
3955 * a pointer to an AVClass struct 3954 * a pointer to an AVClass struct
3956 * @param[in] msg string containing an optional message, or NULL if no message 3955 * @param[in] msg string containing an optional message, or NULL if no message
3957 */ 3956 */
3958 void av_log_ask_for_sample(void *avc, const char *msg); 3957 void av_log_ask_for_sample(void *avc, const char *msg);
3959 3958
3960 /** 3959 /**
3961 * Registers the hardware accelerator hwaccel. 3960 * Register the hardware accelerator hwaccel.
3962 */ 3961 */
3963 void av_register_hwaccel(AVHWAccel *hwaccel); 3962 void av_register_hwaccel(AVHWAccel *hwaccel);
3964 3963
3965 /** 3964 /**
3966 * If hwaccel is NULL, returns the first registered hardware accelerator, 3965 * If hwaccel is NULL, returns the first registered hardware accelerator,