* qatar/master: lavf: simplify is_intra_only() by using codec descriptors. lavc: add an intra-only codec property. lavc: add codec descriptors. lavc: fix mixing CODEC_ID/AV_CODEC_ID in C++ code. dict: move struct AVDictionary definition to dict.c dict: add av_dict_count() Conflicts: doc/APIchanges libavcodec/old_codec_ids.h libavformat/utils.c libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n1.0
| @@ -70,8 +70,15 @@ API changes, most recent first: | |||||
| 2012-03-26 - a67d9cf - lavfi 2.66.100 | 2012-03-26 - a67d9cf - lavfi 2.66.100 | ||||
| Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. | Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. | ||||
| 2012-08-08 - xxxxxxx - lavu 51.38 - dict.h | |||||
| Add av_dict_count(). | |||||
| 2012-08-xx - xxxxxxx - lavc 54.25 - avcodec.h | 2012-08-xx - xxxxxxx - lavc 54.25 - avcodec.h | ||||
| Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*. | Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*. | ||||
| To provide backwards compatibility, CodecID is now #defined as AVCodecID. | |||||
| Note that this can break user code that includes avcodec.h and uses the | |||||
| 'CodecID' identifier. Such code should either #undef CodecID or stop using the | |||||
| CodecID name. | |||||
| 2012-08-03 - xxxxxxx - lavu 51.37.1 - cpu.h | 2012-08-03 - xxxxxxx - lavu 51.37.1 - cpu.h | ||||
| lsws 2.1.1 - swscale.h | lsws 2.1.1 - swscale.h | ||||
| @@ -18,6 +18,7 @@ OBJS = allcodecs.o \ | |||||
| avpacket.o \ | avpacket.o \ | ||||
| bitstream.o \ | bitstream.o \ | ||||
| bitstream_filter.o \ | bitstream_filter.o \ | ||||
| codec_desc.o \ | |||||
| dsputil.o \ | dsputil.o \ | ||||
| faanidct.o \ | faanidct.o \ | ||||
| fmtconvert.o \ | fmtconvert.o \ | ||||
| @@ -787,6 +788,7 @@ SKIPHEADERS += %_tablegen.h \ | |||||
| aac_tablegen_decl.h \ | aac_tablegen_decl.h \ | ||||
| codec_names.h \ | codec_names.h \ | ||||
| fft-internal.h \ | fft-internal.h \ | ||||
| old_codec_ids.h \ | |||||
| tableprint.h \ | tableprint.h \ | ||||
| $(ARCH)/vp56_arith.h \ | $(ARCH)/vp56_arith.h \ | ||||
| @@ -77,9 +77,6 @@ | |||||
| * @{ | * @{ | ||||
| */ | */ | ||||
| #if FF_API_CODEC_ID | |||||
| #include "old_codec_ids.h" | |||||
| #endif | |||||
| /** | /** | ||||
| * Identify the syntax and semantics of the bitstream. | * Identify the syntax and semantics of the bitstream. | ||||
| @@ -459,8 +456,46 @@ enum AVCodecID { | |||||
| AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems | AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems | ||||
| * stream (only used by libavformat) */ | * stream (only used by libavformat) */ | ||||
| AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. | AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. | ||||
| #if FF_API_CODEC_ID | |||||
| #include "old_codec_ids.h" | |||||
| #endif | |||||
| }; | }; | ||||
| #if FF_API_CODEC_ID | |||||
| #define CodecID AVCodecID | |||||
| #endif | |||||
| /** | |||||
| * This struct describes the properties of a single codec described by an | |||||
| * AVCodecID. | |||||
| * @see avcodec_get_descriptor() | |||||
| */ | |||||
| typedef struct AVCodecDescriptor { | |||||
| enum AVCodecID id; | |||||
| enum AVMediaType type; | |||||
| /** | |||||
| * Name of the codec described by this descriptor. It is non-empty and | |||||
| * unique for each codec descriptor. It should contain alphanumeric | |||||
| * characters and '_' only. | |||||
| */ | |||||
| const char *name; | |||||
| /** | |||||
| * A more descriptive name for this codec. May be NULL. | |||||
| */ | |||||
| const char *long_name; | |||||
| /** | |||||
| * Codec properties, a combination of AV_CODEC_PROP_* flags. | |||||
| */ | |||||
| int props; | |||||
| } AVCodecDescriptor; | |||||
| /** | |||||
| * Codec uses only intra compression. | |||||
| * Video codecs only. | |||||
| */ | |||||
| #define AV_CODEC_PROP_INTRA_ONLY (1 << 0) | |||||
| #if FF_API_OLD_DECODE_AUDIO | #if FF_API_OLD_DECODE_AUDIO | ||||
| /* in bytes */ | /* in bytes */ | ||||
| #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio | #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio | ||||
| @@ -4793,6 +4828,20 @@ int av_codec_is_encoder(AVCodec *codec); | |||||
| */ | */ | ||||
| int av_codec_is_decoder(AVCodec *codec); | int av_codec_is_decoder(AVCodec *codec); | ||||
| /** | |||||
| * @return descriptor for given codec ID or NULL if no descriptor exists. | |||||
| */ | |||||
| const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id); | |||||
| /** | |||||
| * Iterate over all codec descriptors known to libavcodec. | |||||
| * | |||||
| * @param prev previous descriptor. NULL to get the first descriptor. | |||||
| * | |||||
| * @return next descriptor or NULL after the last descriptor | |||||
| */ | |||||
| const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); | |||||
| /** | /** | ||||
| * @} | * @} | ||||
| */ | */ | ||||
| @@ -19,7 +19,6 @@ | |||||
| #ifndef AVCODEC_OLD_CODEC_IDS_H | #ifndef AVCODEC_OLD_CODEC_IDS_H | ||||
| #define AVCODEC_OLD_CODEC_IDS_H | #define AVCODEC_OLD_CODEC_IDS_H | ||||
| #include "libavutil/attributes.h" | |||||
| #include "libavutil/common.h" | #include "libavutil/common.h" | ||||
| /* | /* | ||||
| @@ -30,8 +29,7 @@ | |||||
| * Do not add new items to this list. Use the AVCodecID enum instead. | * Do not add new items to this list. Use the AVCodecID enum instead. | ||||
| */ | */ | ||||
| enum CodecID { | |||||
| CODEC_ID_NONE, | |||||
| CODEC_ID_NONE = AV_CODEC_ID_NONE, | |||||
| /* video codecs */ | /* video codecs */ | ||||
| CODEC_ID_MPEG1VIDEO, | CODEC_ID_MPEG1VIDEO, | ||||
| @@ -395,6 +393,5 @@ enum CodecID { | |||||
| CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems | CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems | ||||
| * stream (only used by libavformat) */ | * stream (only used by libavformat) */ | ||||
| CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. | CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. | ||||
| } attribute_deprecated; | |||||
| #endif /* AVCODEC_OLD_CODEC_IDS_H */ | #endif /* AVCODEC_OLD_CODEC_IDS_H */ | ||||
| @@ -318,7 +318,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data | |||||
| duration = asf->duration + PREROLL_TIME * 10000; | duration = asf->duration + PREROLL_TIME * 10000; | ||||
| has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; | has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; | ||||
| metadata_count = s->metadata ? s->metadata->count : 0; | |||||
| metadata_count = av_dict_count(s->metadata); | |||||
| bit_rate = 0; | bit_rate = 0; | ||||
| for(n=0;n<s->nb_streams;n++) { | for(n=0;n<s->nb_streams;n++) { | ||||
| @@ -1157,7 +1157,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, | |||||
| // presentation_delayed, delay, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts)); | // presentation_delayed, delay, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts)); | ||||
| /* update flags */ | /* update flags */ | ||||
| if(is_intra_only(st->codec)) | |||||
| if (is_intra_only(st->codec)) | |||||
| pkt->flags |= AV_PKT_FLAG_KEY; | pkt->flags |= AV_PKT_FLAG_KEY; | ||||
| if (pc) | if (pc) | ||||
| pkt->convergence_duration = pc->convergence_duration; | pkt->convergence_duration = pc->convergence_duration; | ||||
| @@ -3802,7 +3802,7 @@ static void print_fps(double d, const char *postfix){ | |||||
| static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) | static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) | ||||
| { | { | ||||
| if(m && !(m->count == 1 && av_dict_get(m, "language", NULL, 0))){ | |||||
| if(m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))){ | |||||
| AVDictionaryEntry *tag=NULL; | AVDictionaryEntry *tag=NULL; | ||||
| av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent); | av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent); | ||||
| @@ -23,6 +23,16 @@ | |||||
| #include "internal.h" | #include "internal.h" | ||||
| #include "mem.h" | #include "mem.h" | ||||
| struct AVDictionary { | |||||
| int count; | |||||
| AVDictionaryEntry *elems; | |||||
| }; | |||||
| int av_dict_count(const AVDictionary *m) | |||||
| { | |||||
| return m ? m->count : 0; | |||||
| } | |||||
| AVDictionaryEntry * | AVDictionaryEntry * | ||||
| av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags) | av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags) | ||||
| { | { | ||||
| @@ -92,6 +92,14 @@ typedef struct AVDictionary AVDictionary; | |||||
| AVDictionaryEntry * | AVDictionaryEntry * | ||||
| av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); | av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); | ||||
| /** | |||||
| * Get number of entries in dictionary. | |||||
| * | |||||
| * @param m dictionary | |||||
| * @return number of entries in dictionary | |||||
| */ | |||||
| int av_dict_count(const AVDictionary *m); | |||||
| /** | /** | ||||
| * Set the given entry in *pm, overwriting an existing entry. | * Set the given entry in *pm, overwriting an existing entry. | ||||
| * | * | ||||
| @@ -40,11 +40,6 @@ | |||||
| #include "cpu.h" | #include "cpu.h" | ||||
| #include "dict.h" | #include "dict.h" | ||||
| struct AVDictionary { | |||||
| int count; | |||||
| AVDictionaryEntry *elems; | |||||
| }; | |||||
| #ifndef attribute_align_arg | #ifndef attribute_align_arg | ||||
| #if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2) | #if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2) | ||||
| # define attribute_align_arg __attribute__((force_align_arg_pointer)) | # define attribute_align_arg __attribute__((force_align_arg_pointer)) | ||||
| @@ -39,7 +39,7 @@ | |||||
| */ | */ | ||||
| #define LIBAVUTIL_VERSION_MAJOR 51 | #define LIBAVUTIL_VERSION_MAJOR 51 | ||||
| #define LIBAVUTIL_VERSION_MINOR 67 | |||||
| #define LIBAVUTIL_VERSION_MINOR 68 | |||||
| #define LIBAVUTIL_VERSION_MICRO 100 | #define LIBAVUTIL_VERSION_MICRO 100 | ||||
| #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | ||||