Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autocrop and vf-metadata improvements #752

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
vf-metadata: fix handling of NULL metadata
lavfi would segfault due to a NULL dereference if it was asked for its
metadata and none had been allocated (oops). This happens for libav
which has no concept of filter metadata.
  • Loading branch information
kevmitch committed Apr 28, 2014
commit b7d640f6bee0d6b60631c5142f49cbe4c9931797
19 changes: 11 additions & 8 deletions player/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,19 +950,22 @@ static int mp_property_vf_metadata(m_option_t *prop, int action, void *arg,
char *rem;
m_property_split_path(ka->key, &key, &rem);
struct mp_tags vf_metadata;
if (vf_control_by_label(vf, VFCTRL_GET_METADATA, &vf_metadata, key)
== CONTROL_UNKNOWN)
return M_PROPERTY_UNKNOWN;

if (strlen(rem)) {
switch (vf_control_by_label(vf, VFCTRL_GET_METADATA, &vf_metadata, key)) {
case CONTROL_NA:
return M_PROPERTY_UNAVAILABLE;
case CONTROL_UNKNOWN:
return M_PROPERTY_UNKNOWN;
case CONTROL_OK:
if (strlen(rem)) {
struct m_property_action_arg next_ka = *ka;
next_ka.key = rem;
return tag_property(prop, M_PROPERTY_KEY_ACTION, &next_ka,
&vf_metadata);
} else {
} else {
return tag_property(prop, ka->action, ka->arg, &vf_metadata);
}
return M_PROPERTY_OK;
}
return M_PROPERTY_OK;
}
}
}
return M_PROPERTY_NOT_IMPLEMENTED;
Expand Down
7 changes: 5 additions & 2 deletions video/filter/vf_lavfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,13 @@ static int control(vf_instance_t *vf, int request, void *data)
case VFCTRL_SEEK_RESET:
reset(vf);
return CONTROL_OK;
case VFCTRL_GET_METADATA:{
case VFCTRL_GET_METADATA:
if (vf->priv && vf->priv->metadata) {
*(struct mp_tags*) data = *vf->priv->metadata;
return CONTROL_OK;
}
} else {
return CONTROL_NA;
}
}
return CONTROL_UNKNOWN;
}
Expand Down