mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 05:22:23 +00:00
audio/fmt-conversion.c: remove unknown audio format messages
Same deal as with video/fmt-conversion.c.
This commit is contained in:
parent
1974c9b49d
commit
60c06fec1e
@ -137,7 +137,10 @@ static int setup_format(struct dec_audio *da)
|
|||||||
|
|
||||||
// Note: invalid parameters are rejected by dec_audio.c
|
// Note: invalid parameters are rejected by dec_audio.c
|
||||||
|
|
||||||
mp_audio_set_format(&da->decoded, af_from_avformat(lavc_context->sample_fmt));
|
int fmt = lavc_context->sample_fmt;
|
||||||
|
mp_audio_set_format(&da->decoded, af_from_avformat(fmt));
|
||||||
|
if (!da->decoded.format)
|
||||||
|
MP_FATAL(da, "unsupported lavc format %s", av_get_sample_fmt_name(fmt));
|
||||||
|
|
||||||
da->decoded.rate = lavc_context->sample_rate;
|
da->decoded.rate = lavc_context->sample_rate;
|
||||||
if (!da->decoded.rate && sh_audio->wf) {
|
if (!da->decoded.rate && sh_audio->wf) {
|
||||||
|
@ -195,6 +195,9 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||||||
mp_chmap_from_channels(&out_cm, l_out->channels);
|
mp_chmap_from_channels(&out_cm, l_out->channels);
|
||||||
mp_audio_set_channels(out, &out_cm);
|
mp_audio_set_channels(out, &out_cm);
|
||||||
|
|
||||||
|
if (!mp_audio_config_valid(out))
|
||||||
|
return AF_ERROR;
|
||||||
|
|
||||||
p->timebase_out = l_out->time_base;
|
p->timebase_out = l_out->time_base;
|
||||||
|
|
||||||
// Blatantly incorrect; we don't know what the filters do.
|
// Blatantly incorrect; we don't know what the filters do.
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common/msg.h"
|
|
||||||
#include <libavutil/avutil.h>
|
#include <libavutil/avutil.h>
|
||||||
#include <libavutil/samplefmt.h>
|
#include <libavutil/samplefmt.h>
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
@ -43,24 +42,18 @@ static const struct {
|
|||||||
|
|
||||||
enum AVSampleFormat af_to_avformat(int fmt)
|
enum AVSampleFormat af_to_avformat(int fmt)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; audio_conversion_map[i].fmt; i++) {
|
||||||
for (i = 0; audio_conversion_map[i].fmt; i++)
|
|
||||||
if (audio_conversion_map[i].fmt == fmt)
|
if (audio_conversion_map[i].fmt == fmt)
|
||||||
break;
|
return audio_conversion_map[i].sample_fmt;
|
||||||
return audio_conversion_map[i].sample_fmt;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int af_from_avformat(enum AVSampleFormat sample_fmt)
|
int af_from_avformat(enum AVSampleFormat sample_fmt)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; audio_conversion_map[i].fmt; i++) {
|
||||||
for (i = 0; audio_conversion_map[i].fmt; i++)
|
|
||||||
if (audio_conversion_map[i].sample_fmt == sample_fmt)
|
if (audio_conversion_map[i].sample_fmt == sample_fmt)
|
||||||
break;
|
return audio_conversion_map[i].fmt;
|
||||||
int fmt = audio_conversion_map[i].fmt;
|
|
||||||
if (!fmt) {
|
|
||||||
const char *fmtname = av_get_sample_fmt_name(sample_fmt);
|
|
||||||
mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported AVSampleFormat %s (%d)\n",
|
|
||||||
fmtname ? fmtname : "INVALID", sample_fmt);
|
|
||||||
}
|
}
|
||||||
return fmt;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,11 @@ static void select_format(struct ao *ao, AVCodec *codec)
|
|||||||
++sampleformat)
|
++sampleformat)
|
||||||
{
|
{
|
||||||
int fmt = af_from_avformat(*sampleformat);
|
int fmt = af_from_avformat(*sampleformat);
|
||||||
|
if (!fmt) {
|
||||||
|
MP_WARN(ao, "unsupported lavc format %s",
|
||||||
|
av_get_sample_fmt_name(*sampleformat));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int score = af_format_conversion_score(fmt, ao->format);
|
int score = af_format_conversion_score(fmt, ao->format);
|
||||||
if (score > best_score) {
|
if (score > best_score) {
|
||||||
best_score = score;
|
best_score = score;
|
||||||
|
Loading…
Reference in New Issue
Block a user