summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-02-16 14:59:55 +0100
committerNicolas George <nicolas.george@normalesup.org>2012-02-22 11:37:32 +0100
commit9cbf17e9af80cb450042ebaf5e28692044b574cf (patch)
treee68e5a8380ef589db67b3502f598fef441fb7236
parent4217dfe87bde4fe676291e98f6cda79f9df3baf2 (diff)
downloadffmpeg-streaming-9cbf17e9af80cb450042ebaf5e28692044b574cf.zip
ffmpeg-streaming-9cbf17e9af80cb450042ebaf5e28692044b574cf.tar.gz
lavc: introduce av_get_pcm_codec.
-rw-r--r--doc/APIchanges3
-rw-r--r--libavcodec/avcodec.h8
-rw-r--r--libavcodec/utils.c21
-rw-r--r--libavcodec/version.h4
4 files changed, 34 insertions, 2 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index 9c2bc97..6c24501 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2011-04-18
API changes, most recent first:
+2012-02-21 - xxxxxxx - lavc 54.4.100
+ Add av_get_pcm_codec() function.
+
2012-02-16 - xxxxxxx - libswr 0.7.100
Add swr_set_matrix() function.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4051bd8..8f75665 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4055,6 +4055,14 @@ void avcodec_default_free_buffers(AVCodecContext *s);
*/
int av_get_bits_per_sample(enum CodecID codec_id);
+/**
+ * Return the PCM codec associated with a sample format.
+ * @param be endianness, 0 for little, 1 for big,
+ * -1 (or anything else) for native
+ * @return CODEC_ID_PCM_* or CODEC_ID_NONE
+ */
+enum CodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
+
/* frame parsing */
typedef struct AVCodecParserContext {
void *priv_data;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 755186d..7a4e01c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1902,6 +1902,27 @@ int av_get_bits_per_sample(enum CodecID codec_id){
}
}
+enum CodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be)
+{
+ static const enum CodecID map[AV_SAMPLE_FMT_NB][2] = {
+ [AV_SAMPLE_FMT_U8 ] = { CODEC_ID_PCM_U8, CODEC_ID_PCM_U8 },
+ [AV_SAMPLE_FMT_S16 ] = { CODEC_ID_PCM_S16LE, CODEC_ID_PCM_S16BE },
+ [AV_SAMPLE_FMT_S32 ] = { CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE },
+ [AV_SAMPLE_FMT_FLT ] = { CODEC_ID_PCM_F32LE, CODEC_ID_PCM_F32BE },
+ [AV_SAMPLE_FMT_DBL ] = { CODEC_ID_PCM_F64LE, CODEC_ID_PCM_F64BE },
+ [AV_SAMPLE_FMT_U8P ] = { CODEC_ID_PCM_U8, CODEC_ID_PCM_U8 },
+ [AV_SAMPLE_FMT_S16P] = { CODEC_ID_PCM_S16LE, CODEC_ID_PCM_S16BE },
+ [AV_SAMPLE_FMT_S32P] = { CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE },
+ [AV_SAMPLE_FMT_FLTP] = { CODEC_ID_PCM_F32LE, CODEC_ID_PCM_F32BE },
+ [AV_SAMPLE_FMT_DBLP] = { CODEC_ID_PCM_F64LE, CODEC_ID_PCM_F64BE },
+ };
+ if (fmt < 0 || fmt >= AV_SAMPLE_FMT_NB)
+ return CODEC_ID_NONE;
+ if (be < 0 || be > 1)
+ be = AV_NE(1, 0);
+ return map[fmt][be];
+}
+
#if !HAVE_THREADS
int ff_thread_init(AVCodecContext *s){
return -1;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index db4fbea..ca0efb4 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -21,8 +21,8 @@
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 54
-#define LIBAVCODEC_VERSION_MINOR 3
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR 4
+#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
OpenPOWER on IntegriCloud