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
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162012-02-21 - xxxxxxx - lavc 54.4.100
17 Add av_get_pcm_codec() function.
18
162012-02-16 - xxxxxxx - libswr 0.7.100192012-02-16 - xxxxxxx - libswr 0.7.100
17 Add swr_set_matrix() function.20 Add swr_set_matrix() function.
18 21
libavcodec/avcodec.h+8−0
@@ -4055,6 +4055,14 @@ void avcodec_default_free_buffers(AVCodecContext *s); · 4054 unmodified lines
4055 */4055 */
4056int av_get_bits_per_sample(enum CodecID codec_id);4056int av_get_bits_per_sample(enum CodecID codec_id);
4057 4057
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 */
4064enum CodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
4065
4058/* frame parsing */4066/* frame parsing */
4059typedef struct AVCodecParserContext {4067typedef struct AVCodecParserContext {
4060 void *priv_data;4068 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
1902 }1902 }
1903}1903}
1904 1904
1905enum 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
1905#if !HAVE_THREADS1926#if !HAVE_THREADS
1906int ff_thread_init(AVCodecContext *s){1927int ff_thread_init(AVCodecContext *s){
1907 return -1;1928 return -1;
libavcodec/version.h+2−2
@@ -21,8 +21,8 @@ · 20 unmodified lines
21#define AVCODEC_VERSION_H21#define AVCODEC_VERSION_H
22 22
23#define LIBAVCODEC_VERSION_MAJOR 5423#define LIBAVCODEC_VERSION_MAJOR 54
24#define LIBAVCODEC_VERSION_MINOR 324#define LIBAVCODEC_VERSION_MINOR 4
25#define LIBAVCODEC_VERSION_MICRO 10125#define LIBAVCODEC_VERSION_MICRO 100
26 26
27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
28 LIBAVCODEC_VERSION_MINOR, \28 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