comparison avcodec.h @ 11560:8a4984c5cacc libavcodec

Define AVMediaType enum, and use it instead of enum CodecType, which is deprecated and will be dropped at the next major bump.
author stefano
date Tue, 30 Mar 2010 23:30:55 +0000
parents 444f4b594fdb
children dcf8221ed29f
comparison
equal deleted inserted replaced
11559:444f4b594fdb 11560:8a4984c5cacc
28 28
29 #include <errno.h> 29 #include <errno.h>
30 #include "libavutil/avutil.h" 30 #include "libavutil/avutil.h"
31 31
32 #define LIBAVCODEC_VERSION_MAJOR 52 32 #define LIBAVCODEC_VERSION_MAJOR 52
33 #define LIBAVCODEC_VERSION_MINOR 63 33 #define LIBAVCODEC_VERSION_MINOR 64
34 #define LIBAVCODEC_VERSION_MICRO 0 34 #define LIBAVCODEC_VERSION_MICRO 0
35 35
36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ 36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
37 LIBAVCODEC_VERSION_MINOR, \ 37 LIBAVCODEC_VERSION_MINOR, \
38 LIBAVCODEC_VERSION_MICRO) 38 LIBAVCODEC_VERSION_MICRO)
353 353
354 CODEC_ID_MPEG2TS= 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS 354 CODEC_ID_MPEG2TS= 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
355 * stream (only used by libavformat) */ 355 * stream (only used by libavformat) */
356 }; 356 };
357 357
358 enum CodecType { 358 enum AVMediaType {
359 CODEC_TYPE_UNKNOWN = -1, 359 AVMEDIA_TYPE_UNKNOWN = -1,
360 CODEC_TYPE_VIDEO, 360 AVMEDIA_TYPE_VIDEO,
361 CODEC_TYPE_AUDIO, 361 AVMEDIA_TYPE_AUDIO,
362 CODEC_TYPE_DATA, 362 AVMEDIA_TYPE_DATA,
363 CODEC_TYPE_SUBTITLE, 363 AVMEDIA_TYPE_SUBTITLE,
364 CODEC_TYPE_ATTACHMENT, 364 AVMEDIA_TYPE_ATTACHMENT,
365 CODEC_TYPE_NB 365 AVMEDIA_TYPE_NB
366 }; 366 };
367
368 #if LIBAVCODEC_VERSION_MAJOR < 53
369 #define CodecType AVMediaType
370
371 #define CODEC_TYPE_UNKNOWN AVMEDIA_TYPE_UNKNOWN
372 #define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO
373 #define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO
374 #define CODEC_TYPE_DATA AVMEDIA_TYPE_DATA
375 #define CODEC_TYPE_SUBTITLE AVMEDIA_TYPE_SUBTITLE
376 #define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT
377 #define CODEC_TYPE_NB AVMEDIA_TYPE_NB
378 #endif
367 379
368 /** 380 /**
369 * all in native-endian format 381 * all in native-endian format
370 */ 382 */
371 enum SampleFormat { 383 enum SampleFormat {
1275 * - decoding: Set by user. 1287 * - decoding: Set by user.
1276 */ 1288 */
1277 void *opaque; 1289 void *opaque;
1278 1290
1279 char codec_name[32]; 1291 char codec_name[32];
1280 enum CodecType codec_type; /* see CODEC_TYPE_xxx */ 1292 enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
1281 enum CodecID codec_id; /* see CODEC_ID_xxx */ 1293 enum CodecID codec_id; /* see CODEC_ID_xxx */
1282 1294
1283 /** 1295 /**
1284 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). 1296 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
1285 * This is used to work around some encoder bugs. 1297 * This is used to work around some encoder bugs.
2655 * The name is globally unique among encoders and among decoders (but an 2667 * The name is globally unique among encoders and among decoders (but an
2656 * encoder and a decoder can share the same name). 2668 * encoder and a decoder can share the same name).
2657 * This is the primary way to find a codec from the user perspective. 2669 * This is the primary way to find a codec from the user perspective.
2658 */ 2670 */
2659 const char *name; 2671 const char *name;
2660 enum CodecType type; 2672 enum AVMediaType type;
2661 enum CodecID id; 2673 enum CodecID id;
2662 int priv_data_size; 2674 int priv_data_size;
2663 int (*init)(AVCodecContext *); 2675 int (*init)(AVCodecContext *);
2664 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); 2676 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
2665 int (*close)(AVCodecContext *); 2677 int (*close)(AVCodecContext *);
2699 const char *name; 2711 const char *name;
2700 2712
2701 /** 2713 /**
2702 * Type of codec implemented by the hardware accelerator. 2714 * Type of codec implemented by the hardware accelerator.
2703 * 2715 *
2704 * See CODEC_TYPE_xxx 2716 * See AVMEDIA_TYPE_xxx
2705 */ 2717 */
2706 enum CodecType type; 2718 enum AVMediaType type;
2707 2719
2708 /** 2720 /**
2709 * Codec implemented by the hardware accelerator. 2721 * Codec implemented by the hardware accelerator.
2710 * 2722 *
2711 * See CODEC_ID_xxx 2723 * See CODEC_ID_xxx
3239 */ 3251 */
3240 void avcodec_get_context_defaults(AVCodecContext *s); 3252 void avcodec_get_context_defaults(AVCodecContext *s);
3241 3253
3242 /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! 3254 /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
3243 * we WILL change its arguments and name a few times! */ 3255 * we WILL change its arguments and name a few times! */
3244 void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType); 3256 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
3245 3257
3246 /** 3258 /**
3247 * Allocates an AVCodecContext and sets its fields to default values. The 3259 * Allocates an AVCodecContext and sets its fields to default values. The
3248 * resulting struct can be deallocated by simply calling av_free(). 3260 * resulting struct can be deallocated by simply calling av_free().
3249 * 3261 *
3252 */ 3264 */
3253 AVCodecContext *avcodec_alloc_context(void); 3265 AVCodecContext *avcodec_alloc_context(void);
3254 3266
3255 /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! 3267 /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
3256 * we WILL change its arguments and name a few times! */ 3268 * we WILL change its arguments and name a few times! */
3257 AVCodecContext *avcodec_alloc_context2(enum CodecType); 3269 AVCodecContext *avcodec_alloc_context2(enum AVMediaType);
3258 3270
3259 /** 3271 /**
3260 * Sets the fields of the given AVFrame to default values. 3272 * Sets the fields of the given AVFrame to default values.
3261 * 3273 *
3262 * @param pic The AVFrame of which the fields should be set to default values. 3274 * @param pic The AVFrame of which the fields should be set to default values.