mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-01-06 14:15:29 +01:00
lavfi: move ff_parse_{sample_rate,channel_layout}() to audio.[ch]
That is a more appropriate place for those functions.
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/eval.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "avfilter.h"
|
||||
@@ -937,43 +936,6 @@ int ff_default_query_formats(AVFilterContext *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* internal functions for parsing audio format arguments */
|
||||
|
||||
int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx)
|
||||
{
|
||||
char *tail;
|
||||
double srate = av_strtod(arg, &tail);
|
||||
if (*tail || srate < 1 || (int)srate != srate || srate > INT_MAX) {
|
||||
av_log(log_ctx, AV_LOG_ERROR, "Invalid sample rate '%s'\n", arg);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
*ret = srate;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_parse_channel_layout(AVChannelLayout *ret, int *nret, const char *arg,
|
||||
void *log_ctx)
|
||||
{
|
||||
AVChannelLayout chlayout = { 0 };
|
||||
int res;
|
||||
|
||||
res = av_channel_layout_from_string(&chlayout, arg);
|
||||
if (res < 0) {
|
||||
av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", arg);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (chlayout.order == AV_CHANNEL_ORDER_UNSPEC && !nret) {
|
||||
av_log(log_ctx, AV_LOG_ERROR, "Unknown channel layout '%s' is not supported.\n", arg);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
*ret = chlayout;
|
||||
if (nret)
|
||||
*nret = chlayout.nb_channels;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_list(void *log, const char *name, const AVFilterFormats *fmts)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
Reference in New Issue
Block a user