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.
| ... | ... |
@@ -13,6 +13,10 @@ libavutil: 2011-04-18 |
| 13 | 13 |
|
| 14 | 14 |
API changes, most recent first: |
| 15 | 15 |
|
| 16 |
+2011-06-07 - xxxxxxx - lavu 51.4.0 - av_get_bytes_per_sample() |
|
| 17 |
+ Add av_get_bytes_per_sample() in libavutil/samplefmt.h. |
|
| 18 |
+ Deprecate av_get_bits_per_sample_fmt(). |
|
| 19 |
+ |
|
| 16 | 20 |
2011-06-xx - xxxxxxx - lavu 51.3.0 - opt.h |
| 17 | 21 |
Add av_opt_free convenience function. |
| 18 | 22 |
|
| ... | ... |
@@ -40,7 +40,7 @@ |
| 40 | 40 |
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) |
| 41 | 41 |
|
| 42 | 42 |
#define LIBAVUTIL_VERSION_MAJOR 51 |
| 43 |
-#define LIBAVUTIL_VERSION_MINOR 3 |
|
| 43 |
+#define LIBAVUTIL_VERSION_MINOR 4 |
|
| 44 | 44 |
#define LIBAVUTIL_VERSION_MICRO 0 |
| 45 | 45 |
|
| 46 | 46 |
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| ... | ... |
@@ -57,6 +57,9 @@ |
| 57 | 57 |
* Those FF_API_* defines are not part of public API. |
| 58 | 58 |
* They may change, break or disappear at any time. |
| 59 | 59 |
*/ |
| 60 |
+#ifndef FF_API_GET_BITS_PER_SAMPLE_FMT |
|
| 61 |
+#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 52) |
|
| 62 |
+#endif |
|
| 60 | 63 |
|
| 61 | 64 |
/** |
| 62 | 65 |
* Return the LIBAVUTIL_VERSION_INT constant. |
| ... | ... |
@@ -66,8 +66,16 @@ char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sam |
| 66 | 66 |
return buf; |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
+int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt) |
|
| 70 |
+{
|
|
| 71 |
+ return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ? |
|
| 72 |
+ 0 : sample_fmt_info[sample_fmt].bits >> 3; |
|
| 73 |
+} |
|
| 74 |
+ |
|
| 75 |
+#if FF_API_GET_BITS_PER_SAMPLE_FMT |
|
| 69 | 76 |
int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt) |
| 70 | 77 |
{
|
| 71 | 78 |
return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ? |
| 72 | 79 |
0 : sample_fmt_info[sample_fmt].bits; |
| 73 | 80 |
} |
| 81 |
+#endif |
| ... | ... |
@@ -19,6 +19,8 @@ |
| 19 | 19 |
#ifndef AVUTIL_SAMPLEFMT_H |
| 20 | 20 |
#define AVUTIL_SAMPLEFMT_H |
| 21 | 21 |
|
| 22 |
+#include "avutil.h" |
|
| 23 |
+ |
|
| 22 | 24 |
/** |
| 23 | 25 |
* all in native-endian format |
| 24 | 26 |
*/ |
| ... | ... |
@@ -58,13 +60,21 @@ enum AVSampleFormat av_get_sample_fmt(const char *name); |
| 58 | 58 |
*/ |
| 59 | 59 |
char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); |
| 60 | 60 |
|
| 61 |
+#if FF_API_GET_BITS_PER_SAMPLE_FMT |
|
| 62 |
+/** |
|
| 63 |
+ * @deprecated Use av_get_bytes_per_sample() instead. |
|
| 64 |
+ */ |
|
| 65 |
+attribute_deprecated |
|
| 66 |
+int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); |
|
| 67 |
+#endif |
|
| 68 |
+ |
|
| 61 | 69 |
/** |
| 62 |
- * Return sample format bits per sample. |
|
| 70 |
+ * Return number of bytes per sample. |
|
| 63 | 71 |
* |
| 64 | 72 |
* @param sample_fmt the sample format |
| 65 |
- * @return number of bits per sample or zero if unknown for the given |
|
| 73 |
+ * @return number of bytes per sample or zero if unknown for the given |
|
| 66 | 74 |
* sample format |
| 67 | 75 |
*/ |
| 68 |
-int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); |
|
| 76 |
+int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); |
|
| 69 | 77 |
|
| 70 | 78 |
#endif /* AVUTIL_SAMPLEFMT_H */ |