mirror of https://git.ffmpeg.org/ffmpeg.git
lavfi: consistently use int for sample_rate in AVFilterLink and AVFilterBufferRefAudioProps
Also consistent with AVCodecContext.sample_rate. Simplify/avoid pointless type checks and conversions. Breaks audio API/ABI.
This commit is contained in:
parent
2c0317419b
commit
4381bddc9f
|
@ -125,9 +125,9 @@ static inline void log_input_change(void *ctx, AVFilterLink *link, AVFilterBuffe
|
||||||
-1, ref->audio->channel_layout);
|
-1, ref->audio->channel_layout);
|
||||||
av_log(ctx, AV_LOG_INFO,
|
av_log(ctx, AV_LOG_INFO,
|
||||||
"Audio input format changed: "
|
"Audio input format changed: "
|
||||||
"%s:%s:%"PRId64" -> %s:%s:%u, normalizing\n",
|
"%s:%s:%d -> %s:%s:%d, normalizing\n",
|
||||||
av_get_sample_fmt_name(link->format),
|
av_get_sample_fmt_name(link->format),
|
||||||
old_layout_str, link->sample_rate,
|
old_layout_str, (int)link->sample_rate,
|
||||||
av_get_sample_fmt_name(ref->format),
|
av_get_sample_fmt_name(ref->format),
|
||||||
new_layout_str, ref->audio->sample_rate);
|
new_layout_str, ref->audio->sample_rate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -374,8 +374,8 @@ static void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
|
||||||
av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
|
av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
|
||||||
|
|
||||||
av_dlog(ctx,
|
av_dlog(ctx,
|
||||||
"link[%p r:%"PRId64" cl:%s fmt:%-16s %-16s->%-16s]%s",
|
"link[%p r:%d cl:%s fmt:%-16s %-16s->%-16s]%s",
|
||||||
link, link->sample_rate, buf,
|
link, (int)link->sample_rate, buf,
|
||||||
av_get_sample_fmt_name(link->format),
|
av_get_sample_fmt_name(link->format),
|
||||||
link->src ? link->src->filter->name : "",
|
link->src ? link->src->filter->name : "",
|
||||||
link->dst ? link->dst->filter->name : "",
|
link->dst ? link->dst->filter->name : "",
|
||||||
|
|
|
@ -106,7 +106,7 @@ typedef struct AVFilterBuffer {
|
||||||
typedef struct AVFilterBufferRefAudioProps {
|
typedef struct AVFilterBufferRefAudioProps {
|
||||||
int64_t channel_layout; ///< channel layout of audio buffer
|
int64_t channel_layout; ///< channel layout of audio buffer
|
||||||
int nb_samples; ///< number of audio samples per channel
|
int nb_samples; ///< number of audio samples per channel
|
||||||
uint32_t sample_rate; ///< audio buffer sample rate
|
int sample_rate; ///< audio buffer sample rate
|
||||||
int planar; ///< audio buffer - planar or packed
|
int planar; ///< audio buffer - planar or packed
|
||||||
} AVFilterBufferRefAudioProps;
|
} AVFilterBufferRefAudioProps;
|
||||||
|
|
||||||
|
@ -623,7 +623,11 @@ struct AVFilterLink {
|
||||||
AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
|
AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
|
||||||
/* These parameters apply only to audio */
|
/* These parameters apply only to audio */
|
||||||
int64_t channel_layout; ///< channel layout of current buffer (see libavutil/audioconvert.h)
|
int64_t channel_layout; ///< channel layout of current buffer (see libavutil/audioconvert.h)
|
||||||
|
#if LIBAVFILTER_VERSION_MAJOR < 3
|
||||||
int64_t sample_rate; ///< samples per second
|
int64_t sample_rate; ///< samples per second
|
||||||
|
#else
|
||||||
|
int sample_rate; ///< samples per second
|
||||||
|
#endif
|
||||||
int planar; ///< agreed upon packing mode of audio buffers. true if planar.
|
int planar; ///< agreed upon packing mode of audio buffers. true if planar.
|
||||||
|
|
||||||
int format; ///< agreed upon media format
|
int format; ///< agreed upon media format
|
||||||
|
|
|
@ -266,11 +266,11 @@ int ff_parse_sample_format(int *ret, const char *arg, void *log_ctx)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_parse_sample_rate(unsigned *ret, const char *arg, void *log_ctx)
|
int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx)
|
||||||
{
|
{
|
||||||
char *tail;
|
char *tail;
|
||||||
double srate = av_strtod(arg, &tail);
|
double srate = av_strtod(arg, &tail);
|
||||||
if (*tail || srate < 1 || (int)srate != srate) {
|
if (*tail || srate < 1 || (int)srate != srate || srate > INT_MAX) {
|
||||||
av_log(log_ctx, AV_LOG_ERROR, "Invalid sample rate '%s'\n", arg);
|
av_log(log_ctx, AV_LOG_ERROR, "Invalid sample rate '%s'\n", arg);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ int ff_parse_pixel_format(enum PixelFormat *ret, const char *arg, void *log_ctx)
|
||||||
* @param log_ctx log context
|
* @param log_ctx log context
|
||||||
* @return 0 in case of success, a negative AVERROR code on error
|
* @return 0 in case of success, a negative AVERROR code on error
|
||||||
*/
|
*/
|
||||||
int ff_parse_sample_rate(unsigned *ret, const char *arg, void *log_ctx);
|
int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a sample format name or a corresponding integer representation.
|
* Parse a sample format name or a corresponding integer representation.
|
||||||
|
|
Loading…
Reference in New Issue