diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-11-02 22:20:49 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-11-02 22:20:49 +0000 |
commit | 6f84cd127947394e53a6621e9ed077517df5a6d2 (patch) | |
tree | 3693859eec8e3bdadf4a9a9f162aae56173e628e | |
parent | d63e456a2abcc8c23962f2b8828004c6a35ca1fe (diff) | |
download | ffmpeg-6f84cd127947394e53a6621e9ed077517df5a6d2.tar.gz |
Add av_get_bits_per_sample_fmt() to libavcore/samplefmt.h and
deprecate av_get_bits_per_sample_format().
Originally committed as revision 25654 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | doc/APIchanges | 4 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 10 | ||||
-rw-r--r-- | libavcodec/utils.c | 16 | ||||
-rw-r--r-- | libavcore/avcore.h | 2 | ||||
-rw-r--r-- | libavcore/samplefmt.c | 6 | ||||
-rw-r--r-- | libavcore/samplefmt.h | 9 |
6 files changed, 28 insertions, 19 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index 88a288273b..81bd819ba6 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,10 @@ libavutil: 2009-03-08 API changes, most recent first: +2010-11-02 - r25654 - lavcore 0.12.0 - av_get_bits_per_sample_fmt() + Add av_get_bits_per_sample_fmt() to libavcore/samplefmt.h and + deprecate av_get_bits_per_sample_format(). + 2010-11-02 - r25653 - lavcore 0.11.0 - samplefmt.h Add sample format functions in libavcore/samplefmt.h: av_get_sample_fmt_name(), diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index af5088eaf5..6405455618 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -33,7 +33,7 @@ #define LIBAVCODEC_VERSION_MAJOR 52 #define LIBAVCODEC_VERSION_MINOR 94 -#define LIBAVCODEC_VERSION_MICRO 2 +#define LIBAVCODEC_VERSION_MICRO 3 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ @@ -3739,13 +3739,13 @@ char av_get_pict_type_char(int pict_type); */ int av_get_bits_per_sample(enum CodecID codec_id); +#if FF_API_OLD_SAMPLE_FMT /** - * Return sample format bits per sample. - * - * @param[in] sample_fmt the sample format - * @return Number of bits per sample or zero if unknown for the given sample format. + * @deprecated Use av_get_bits_per_sample_fmt() instead. */ +attribute_deprecated int av_get_bits_per_sample_format(enum SampleFormat sample_fmt); +#endif /* frame parsing */ typedef struct AVCodecParserContext { diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ffd34eee14..8169b374b5 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1064,21 +1064,11 @@ int av_get_bits_per_sample(enum CodecID codec_id){ } } +#if FF_API_OLD_SAMPLE_FMT int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) { - switch (sample_fmt) { - case SAMPLE_FMT_U8: - return 8; - case SAMPLE_FMT_S16: - return 16; - case SAMPLE_FMT_S32: - case SAMPLE_FMT_FLT: - return 32; - case SAMPLE_FMT_DBL: - return 64; - default: - return 0; - } + return av_get_bits_per_sample_fmt(sample_fmt); } +#endif #if !HAVE_THREADS int avcodec_thread_init(AVCodecContext *s, int thread_count){ diff --git a/libavcore/avcore.h b/libavcore/avcore.h index dd1cd75f02..b2bb810628 100644 --- a/libavcore/avcore.h +++ b/libavcore/avcore.h @@ -27,7 +27,7 @@ #include "libavutil/avutil.h" #define LIBAVCORE_VERSION_MAJOR 0 -#define LIBAVCORE_VERSION_MINOR 11 +#define LIBAVCORE_VERSION_MINOR 12 #define LIBAVCORE_VERSION_MICRO 0 #define LIBAVCORE_VERSION_INT AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \ diff --git a/libavcore/samplefmt.c b/libavcore/samplefmt.c index 49ab8296f7..532acd9507 100644 --- a/libavcore/samplefmt.c +++ b/libavcore/samplefmt.c @@ -62,3 +62,9 @@ char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sam return buf; } + +int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt) +{ + return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ? + 0 : sample_fmt_info[sample_fmt].bits; +} diff --git a/libavcore/samplefmt.h b/libavcore/samplefmt.h index 482bb48471..8779a6f8f3 100644 --- a/libavcore/samplefmt.h +++ b/libavcore/samplefmt.h @@ -58,4 +58,13 @@ enum AVSampleFormat av_get_sample_fmt(const char *name); */ char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); +/** + * Return sample format bits per sample. + * + * @param sample_fmt the sample format + * @return number of bits per sample or zero if unknown for the given + * sample format + */ +int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); + #endif /* AVCORE_SAMPLEFMT_H */ |