diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-11-12 15:58:40 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-11-23 18:39:28 -0500 |
commit | 8889cc4f5b767b323901115a92318a024336e2a1 (patch) | |
tree | 504d4b6e562e10d90b48c80c3a01d9c0659e4313 /libavutil/samplefmt.c | |
parent | aa38cff2c6fdc1c0a7245f8a2aef5f6d4d2881d1 (diff) | |
download | ffmpeg-8889cc4f5b767b323901115a92318a024336e2a1.tar.gz |
libavutil: add planar sample formats and av_sample_fmt_is_planar()
Diffstat (limited to 'libavutil/samplefmt.c')
-rw-r--r-- | libavutil/samplefmt.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index 5b0bfa0257..6fc3b7e467 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -25,15 +25,21 @@ typedef struct SampleFmtInfo { const char *name; int bits; + int planar; } SampleFmtInfo; /** this table gives more information about formats */ static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB] = { - [AV_SAMPLE_FMT_U8] = { .name = "u8", .bits = 8 }, - [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16 }, - [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32 }, - [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 }, - [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64 }, + [AV_SAMPLE_FMT_U8] = { .name = "u8", .bits = 8, .planar = 0 }, + [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16, .planar = 0 }, + [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32, .planar = 0 }, + [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32, .planar = 0 }, + [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64, .planar = 0 }, + [AV_SAMPLE_FMT_U8P] = { .name = "u8p", .bits = 8, .planar = 1 }, + [AV_SAMPLE_FMT_S16P] = { .name = "s16p", .bits = 16, .planar = 1 }, + [AV_SAMPLE_FMT_S32P] = { .name = "s32p", .bits = 32, .planar = 1 }, + [AV_SAMPLE_FMT_FLTP] = { .name = "fltp", .bits = 32, .planar = 1 }, + [AV_SAMPLE_FMT_DBLP] = { .name = "dblp", .bits = 64, .planar = 1 }, }; const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt) @@ -79,3 +85,10 @@ int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt) 0 : sample_fmt_info[sample_fmt].bits; } #endif + +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt) +{ + if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB) + return 0; + return sample_fmt_info[sample_fmt].planar; +} |