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.
This commit is contained in:
parent
2f37321abc
commit
a6703faa15
@ -13,6 +13,10 @@ libavutil: 2011-04-18
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2011-06-07 - xxxxxxx - lavu 51.4.0 - av_get_bytes_per_sample()
|
||||||
|
Add av_get_bytes_per_sample() in libavutil/samplefmt.h.
|
||||||
|
Deprecate av_get_bits_per_sample_fmt().
|
||||||
|
|
||||||
2011-06-xx - xxxxxxx - lavu 51.3.0 - opt.h
|
2011-06-xx - xxxxxxx - lavu 51.3.0 - opt.h
|
||||||
Add av_opt_free convenience function.
|
Add av_opt_free convenience function.
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
|
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_MAJOR 51
|
#define LIBAVUTIL_VERSION_MAJOR 51
|
||||||
#define LIBAVUTIL_VERSION_MINOR 3
|
#define LIBAVUTIL_VERSION_MINOR 4
|
||||||
#define LIBAVUTIL_VERSION_MICRO 0
|
#define LIBAVUTIL_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||||
@ -57,6 +57,9 @@
|
|||||||
* Those FF_API_* defines are not part of public API.
|
* Those FF_API_* defines are not part of public API.
|
||||||
* They may change, break or disappear at any time.
|
* They may change, break or disappear at any time.
|
||||||
*/
|
*/
|
||||||
|
#ifndef FF_API_GET_BITS_PER_SAMPLE_FMT
|
||||||
|
#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 52)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the LIBAVUTIL_VERSION_INT constant.
|
* Return the LIBAVUTIL_VERSION_INT constant.
|
||||||
|
@ -66,8 +66,16 @@ char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sam
|
|||||||
return buf;
|
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)
|
int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt)
|
||||||
{
|
{
|
||||||
return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ?
|
return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ?
|
||||||
0 : sample_fmt_info[sample_fmt].bits;
|
0 : sample_fmt_info[sample_fmt].bits;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#ifndef AVUTIL_SAMPLEFMT_H
|
#ifndef AVUTIL_SAMPLEFMT_H
|
||||||
#define AVUTIL_SAMPLEFMT_H
|
#define AVUTIL_SAMPLEFMT_H
|
||||||
|
|
||||||
|
#include "avutil.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* all in native-endian format
|
* all in native-endian format
|
||||||
*/
|
*/
|
||||||
@ -58,13 +60,21 @@ enum AVSampleFormat av_get_sample_fmt(const char *name);
|
|||||||
*/
|
*/
|
||||||
char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
|
char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
|
||||||
|
|
||||||
|
#if FF_API_GET_BITS_PER_SAMPLE_FMT
|
||||||
/**
|
/**
|
||||||
* Return sample format bits per sample.
|
* @deprecated Use av_get_bytes_per_sample() instead.
|
||||||
|
*/
|
||||||
|
attribute_deprecated
|
||||||
|
int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return number of bytes per sample.
|
||||||
*
|
*
|
||||||
* @param sample_fmt the sample format
|
* @param sample_fmt the sample format
|
||||||
* @return number of bits per sample or zero if unknown for the given
|
* @return number of bytes per sample or zero if unknown for the given
|
||||||
* sample format
|
* sample format
|
||||||
*/
|
*/
|
||||||
int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt);
|
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
|
||||||
|
|
||||||
#endif /* AVUTIL_SAMPLEFMT_H */
|
#endif /* AVUTIL_SAMPLEFMT_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user