History

lavc: introduce av_get_pcm_codec.

Nicolas George committed 14 years ago

Commit 9cbf17e1 parent 4217dfe4 files · +34 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +8 −0
  3. libavcodec/utils.c +21 −0
  4. libavcodec/version.h +2 −2
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2012-02-21 - xxxxxxx - lavc 54.4.100
17+ Add av_get_pcm_codec() function.
18+
1619 2012-02-16 - xxxxxxx - libswr 0.7.100
1720 Add swr_set_matrix() function.
1821
libavcodec/avcodec.h+8−0
@@ -4055,6 +4055,14 @@ void avcodec_default_free_buffers(AVCodecContext *s); · 4054 unmodified lines
40554055 */
40564056 int av_get_bits_per_sample(enum CodecID codec_id);
40574057
4058+/**
4059+ * Return the PCM codec associated with a sample format.
4060+ * @param be endianness, 0 for little, 1 for big,
4061+ * -1 (or anything else) for native
4062+ * @return CODEC_ID_PCM_* or CODEC_ID_NONE
4063+ */
4064+enum CodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
4065+
40584066 /* frame parsing */
40594067 typedef struct AVCodecParserContext {
40604068 void *priv_data;
libavcodec/utils.c+21−0
@@ -1902,6 +1902,27 @@ int av_get_bits_per_sample(enum CodecID codec_id){ · 1901 unmodified lines
19021902 }
19031903 }
19041904
1905+enum CodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be)
1906+{
1907+ static const enum CodecID map[AV_SAMPLE_FMT_NB][2] = {
1908+ [AV_SAMPLE_FMT_U8 ] = { CODEC_ID_PCM_U8, CODEC_ID_PCM_U8 },
1909+ [AV_SAMPLE_FMT_S16 ] = { CODEC_ID_PCM_S16LE, CODEC_ID_PCM_S16BE },
1910+ [AV_SAMPLE_FMT_S32 ] = { CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE },
1911+ [AV_SAMPLE_FMT_FLT ] = { CODEC_ID_PCM_F32LE, CODEC_ID_PCM_F32BE },
1912+ [AV_SAMPLE_FMT_DBL ] = { CODEC_ID_PCM_F64LE, CODEC_ID_PCM_F64BE },
1913+ [AV_SAMPLE_FMT_U8P ] = { CODEC_ID_PCM_U8, CODEC_ID_PCM_U8 },
1914+ [AV_SAMPLE_FMT_S16P] = { CODEC_ID_PCM_S16LE, CODEC_ID_PCM_S16BE },
1915+ [AV_SAMPLE_FMT_S32P] = { CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE },
1916+ [AV_SAMPLE_FMT_FLTP] = { CODEC_ID_PCM_F32LE, CODEC_ID_PCM_F32BE },
1917+ [AV_SAMPLE_FMT_DBLP] = { CODEC_ID_PCM_F64LE, CODEC_ID_PCM_F64BE },
1918+ };
1919+ if (fmt < 0 || fmt >= AV_SAMPLE_FMT_NB)
1920+ return CODEC_ID_NONE;
1921+ if (be < 0 || be > 1)
1922+ be = AV_NE(1, 0);
1923+ return map[fmt][be];
1924+}
1925+
19051926 #if !HAVE_THREADS
19061927 int ff_thread_init(AVCodecContext *s){
19071928 return -1;
libavcodec/version.h+2−2
@@ -21,8 +21,8 @@ · 20 unmodified lines
2121 #define AVCODEC_VERSION_H
2222
2323 #define LIBAVCODEC_VERSION_MAJOR 54
24−#define LIBAVCODEC_VERSION_MINOR 3
25−#define LIBAVCODEC_VERSION_MICRO 101
24+#define LIBAVCODEC_VERSION_MINOR 4
25+#define LIBAVCODEC_VERSION_MICRO 100
2626
2727 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
2828 LIBAVCODEC_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t