summaryrefslogtreecommitdiff
path: root/libavutil/samplefmt.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-06-06 01:14:50 +0200
committerJustin Ruggles <justin.ruggles@gmail.com>2011-06-07 13:06:41 -0400
commita6703faa157294efb75619f55c06d7ed5a0aa2bf (patch)
treeec47ec652746522f8c1454e75e0fac315026a54a /libavutil/samplefmt.c
parent2f37321abcbf9be5f58647b17155c0e257949c0d (diff)
downloadffmpeg-a6703faa157294efb75619f55c06d7ed5a0aa2bf.tar.gz
samplefmt: add av_get_bytes_per_sample()
Deprecate av_get_bits_per_sample_fmt(), which was a misnamed function. For the moment we don't have sample formats with a non-integer number of bytes, in that case we may need to create a new av_get_bits_per_sample() function. In the meanwhile we prefer to adopt this variant, since avoids divisions by 8 all over the place.
Diffstat (limited to 'libavutil/samplefmt.c')
-rw-r--r--libavutil/samplefmt.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
index 06b50d9bd9..5b0bfa0257 100644
--- a/libavutil/samplefmt.c
+++ b/libavutil/samplefmt.c
@@ -66,8 +66,16 @@ char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sam
return buf;
}
+int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
+{
+ return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ?
+ 0 : sample_fmt_info[sample_fmt].bits >> 3;
+}
+
+#if FF_API_GET_BITS_PER_SAMPLE_FMT
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;
}
+#endif