aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-11-02 22:08:02 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-11-02 22:08:02 +0000
commitd63e456a2abcc8c23962f2b8828004c6a35ca1fe (patch)
tree06ff602fe7de05832fe92a70011319326585a763 /libavcodec
parent262d1c5d2206467809fd81d841d09ad70cc8ba13 (diff)
downloadffmpeg-d63e456a2abcc8c23962f2b8828004c6a35ca1fe.tar.gz
Implement functions:
av_get_sample_fmt_name() av_get_sample_fmt() av_get_sample_fmt_string() in libavcore, and deprecate the corresponding libavcodec/audioconvert.h functions: avcodec_get_sample_fmt_name() avcodec_get_sample_fmt() avcodec_sample_fmt_string() Originally committed as revision 25653 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/audioconvert.c36
-rw-r--r--libavcodec/audioconvert.h19
-rw-r--r--libavcodec/avcodec.h2
3 files changed, 15 insertions, 42 deletions
diff --git a/libavcodec/audioconvert.c b/libavcodec/audioconvert.c
index c6dc1b1c2a..4e4063fab5 100644
--- a/libavcodec/audioconvert.c
+++ b/libavcodec/audioconvert.c
@@ -27,50 +27,26 @@
#include "libavutil/avstring.h"
#include "libavutil/libm.h"
+#include "libavcore/samplefmt.h"
#include "avcodec.h"
#include "audioconvert.h"
-typedef struct SampleFmtInfo {
- const char *name;
- int bits;
-} SampleFmtInfo;
-
-/** this table gives more information about formats */
-static const SampleFmtInfo sample_fmt_info[SAMPLE_FMT_NB] = {
- [SAMPLE_FMT_U8] = { .name = "u8", .bits = 8 },
- [SAMPLE_FMT_S16] = { .name = "s16", .bits = 16 },
- [SAMPLE_FMT_S32] = { .name = "s32", .bits = 32 },
- [SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 },
- [SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64 },
-};
-
+#if FF_API_OLD_SAMPLE_FMT
const char *avcodec_get_sample_fmt_name(int sample_fmt)
{
- if (sample_fmt < 0 || sample_fmt >= SAMPLE_FMT_NB)
- return NULL;
- return sample_fmt_info[sample_fmt].name;
+ return av_get_sample_fmt_name(sample_fmt);
}
enum SampleFormat avcodec_get_sample_fmt(const char* name)
{
- int i;
-
- for (i=0; i < SAMPLE_FMT_NB; i++)
- if (!strcmp(sample_fmt_info[i].name, name))
- return i;
- return SAMPLE_FMT_NONE;
+ return av_get_sample_fmt(name);
}
void avcodec_sample_fmt_string (char *buf, int buf_size, int sample_fmt)
{
- /* print header */
- if (sample_fmt < 0)
- snprintf (buf, buf_size, "name " " depth");
- else if (sample_fmt < SAMPLE_FMT_NB) {
- SampleFmtInfo info= sample_fmt_info[sample_fmt];
- snprintf (buf, buf_size, "%-6s" " %2d ", info.name, info.bits);
- }
+ av_get_sample_fmt_string(buf, buf_size, sample_fmt);
}
+#endif
static const char* const channel_names[]={
"FL", "FR", "FC", "LFE", "BL", "BR", "FLC", "FRC",
diff --git a/libavcodec/audioconvert.h b/libavcodec/audioconvert.h
index 349065edc2..e7d262bae5 100644
--- a/libavcodec/audioconvert.h
+++ b/libavcodec/audioconvert.h
@@ -32,28 +32,25 @@
#include "libavutil/cpu.h"
#include "avcodec.h"
-
+#if FF_API_OLD_SAMPLE_FMT
/**
- * Generate string corresponding to the sample format with
- * number sample_fmt, or a header if sample_fmt is negative.
- *
- * @param[in] buf the buffer where to write the string
- * @param[in] buf_size the size of buf
- * @param[in] sample_fmt the number of the sample format to print the corresponding info string, or
- * a negative value to print the corresponding header.
- * Meaningful values for obtaining a sample format info vary from 0 to SAMPLE_FMT_NB -1.
+ * @deprecated Use av_get_sample_fmt_string() instead.
*/
+attribute_deprecated
void avcodec_sample_fmt_string(char *buf, int buf_size, int sample_fmt);
/**
- * @return NULL on error
+ * @deprecated Use av_get_sample_fmt_name() instead.
*/
+attribute_deprecated
const char *avcodec_get_sample_fmt_name(int sample_fmt);
/**
- * @return SAMPLE_FMT_NONE on error
+ * @deprecated Use av_get_sample_fmt() instead.
*/
+attribute_deprecated
enum SampleFormat avcodec_get_sample_fmt(const char* name);
+#endif
/**
* @return NULL on error
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 571e8271b7..af5088eaf5 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -33,7 +33,7 @@
#define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 94
-#define LIBAVCODEC_VERSION_MICRO 1
+#define LIBAVCODEC_VERSION_MICRO 2
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \