mirror of
https://github.com/mpv-player/mpv
synced 2024-12-26 09:02:38 +00:00
various: add some missing error checks
This commit is contained in:
parent
9456b2f6e9
commit
4449f38c17
@ -165,6 +165,9 @@ static bool build_image_converter(struct mp_autoconvert *c, struct mp_log *log,
|
||||
}
|
||||
|
||||
struct mp_filter *conv = mp_filter_create(f, &convert_filter);
|
||||
if (!conv)
|
||||
return false;
|
||||
|
||||
mp_filter_add_pin(conv, MP_PIN_IN, "in");
|
||||
mp_filter_add_pin(conv, MP_PIN_OUT, "out");
|
||||
|
||||
|
@ -430,10 +430,12 @@ static bool reinit_decoder(struct priv *p)
|
||||
}
|
||||
}
|
||||
|
||||
if (!driver)
|
||||
return false;
|
||||
|
||||
if (!list) {
|
||||
struct mp_decoder_list *full = talloc_zero(NULL, struct mp_decoder_list);
|
||||
if (driver)
|
||||
driver->add_decoders(full);
|
||||
driver->add_decoders(full);
|
||||
const char *codec = p->codec->codec;
|
||||
if (codec && strcmp(codec, "null") == 0)
|
||||
codec = fallback;
|
||||
@ -1232,6 +1234,8 @@ struct mp_decoder_wrapper *mp_decoder_wrapper_create(struct mp_filter *parent,
|
||||
|
||||
p->decf = mp_filter_create(p->dec_root_filter ? p->dec_root_filter : public_f,
|
||||
&decf_filter);
|
||||
if (!p->decf)
|
||||
goto error;
|
||||
p->decf->priv = p;
|
||||
p->decf->log = public_f->log = p->log;
|
||||
mp_filter_add_pin(p->decf, MP_PIN_OUT, "out");
|
||||
|
@ -334,6 +334,8 @@ static bool reorder_planes(struct mp_aframe *mpa, int *reorder,
|
||||
|
||||
int num_planes = mp_aframe_get_planes(mpa);
|
||||
uint8_t **planes = mp_aframe_get_data_rw(mpa);
|
||||
if (num_planes && !planes)
|
||||
return false;
|
||||
uint8_t *old_planes[MP_NUM_CHANNELS];
|
||||
assert(num_planes <= MP_NUM_CHANNELS);
|
||||
for (int n = 0; n < num_planes; n++)
|
||||
|
@ -290,7 +290,7 @@ static void print_stream(struct MPContext *mpctx, struct track *t)
|
||||
APPEND(b, " %dHz", s->codec->samplerate);
|
||||
}
|
||||
APPEND(b, ")");
|
||||
if (s->hls_bitrate > 0)
|
||||
if (s && s->hls_bitrate > 0)
|
||||
APPEND(b, " (%d kbps)", (s->hls_bitrate + 500) / 1000);
|
||||
if (t->is_external)
|
||||
APPEND(b, " (external)");
|
||||
|
@ -583,6 +583,8 @@ static int archive_entry_open(stream_t *stream)
|
||||
|
||||
char *base = talloc_strdup(p, stream->path);
|
||||
char *name = strchr(base, '|');
|
||||
if (!name)
|
||||
return STREAM_ERROR;
|
||||
*name++ = '\0';
|
||||
if (name[0] == '/')
|
||||
name += 1;
|
||||
|
@ -1702,6 +1702,7 @@ static void reinit_scaler(struct gl_video *p, struct scaler *scaler,
|
||||
double scale_factor,
|
||||
int sizes[])
|
||||
{
|
||||
assert(conf);
|
||||
if (scaler_conf_eq(scaler->conf, *conf) &&
|
||||
scaler->scale_factor == scale_factor &&
|
||||
scaler->initialized)
|
||||
@ -1709,13 +1710,13 @@ static void reinit_scaler(struct gl_video *p, struct scaler *scaler,
|
||||
|
||||
uninit_scaler(p, scaler);
|
||||
|
||||
if (conf && scaler->index == SCALER_DSCALE && (!conf->kernel.name ||
|
||||
if (scaler->index == SCALER_DSCALE && (!conf->kernel.name ||
|
||||
!conf->kernel.name[0]))
|
||||
{
|
||||
conf = &p->opts.scaler[SCALER_SCALE];
|
||||
}
|
||||
|
||||
if (conf && scaler->index == SCALER_CSCALE && (!conf->kernel.name ||
|
||||
if (scaler->index == SCALER_CSCALE && (!conf->kernel.name ||
|
||||
!conf->kernel.name[0]))
|
||||
{
|
||||
conf = &p->opts.scaler[SCALER_SCALE];
|
||||
|
@ -1946,6 +1946,9 @@ static void update_hook_opts(struct priv *p, char **opts, const char *shaderpath
|
||||
break;
|
||||
}
|
||||
|
||||
if (!opt.type)
|
||||
goto next_hook;
|
||||
|
||||
opt.type->parse(p->log, &opt, k, v, hp->data);
|
||||
goto next_hook;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user