summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmpcodecs/vf.c24
-rw-r--r--libmpcodecs/vf.h4
-rw-r--r--libmpcodecs/vf_ass.c6
-rw-r--r--mplayer.c8
4 files changed, 36 insertions, 6 deletions
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index d753d3d68a..c6f23eb382 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -420,7 +420,11 @@ static int vf_default_query_format(struct vf_instance* vf, unsigned int fmt){
return vf_next_query_format(vf,fmt);
}
-vf_instance_t* vf_open_plugin(struct MPOpts *opts, const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args){
+struct vf_instance *vf_open_plugin_noerr(struct MPOpts *opts,
+ const vf_info_t * const *filter_list,
+ vf_instance_t *next, const char *name,
+ char **args, int *retcode)
+{
vf_instance_t* vf;
int i;
for(i=0;;i++){
@@ -453,12 +457,26 @@ vf_instance_t* vf_open_plugin(struct MPOpts *opts, const vf_info_t* const* filte
args = (char**)args[1];
else
args = NULL;
- if(vf->info->open(vf,(char*)args)>0) return vf; // Success!
+ *retcode = vf->info->open(vf,(char*)args);
+ if (*retcode > 0)
+ return vf;
free(vf);
- mp_tmsg(MSGT_VFILTER,MSGL_ERR,"Couldn't open video filter '%s'.\n",name);
return NULL;
}
+struct vf_instance *vf_open_plugin(struct MPOpts *opts,
+ const vf_info_t * const *filter_list,
+ vf_instance_t *next, const char *name,
+ char **args)
+{
+ struct vf_instance *vf = vf_open_plugin_noerr(opts, filter_list, next,
+ name, args, &(int){0});
+ if (!vf)
+ mp_tmsg(MSGT_VFILTER, MSGL_ERR, "Couldn't open video filter '%s'.\n",
+ name);
+ return vf;
+}
+
vf_instance_t* vf_open_filter(struct MPOpts *opts, vf_instance_t* next, const char *name, char **args){
if(args && strcmp(args[0],"_oldargs_")) {
int i,l = 0;
diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h
index f9dbb8b4fb..1af0ecca4f 100644
--- a/libmpcodecs/vf.h
+++ b/libmpcodecs/vf.h
@@ -107,6 +107,10 @@ void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h);
mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h);
vf_instance_t* vf_open_plugin(struct MPOpts *opts, const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args);
+struct vf_instance *vf_open_plugin_noerr(struct MPOpts *opts,
+ const vf_info_t * const *filter_list,
+ vf_instance_t *next, const char *name,
+ char **args, int *retcode);
vf_instance_t* vf_open_filter(struct MPOpts *opts, vf_instance_t* next, const char *name, char **args);
vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args);
vf_instance_t* vf_open_encoder(struct MPOpts *opts, vf_instance_t* next, const char *name, char *args);
diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c
index 5ea2f8b10d..9076ed099e 100644
--- a/libmpcodecs/vf_ass.c
+++ b/libmpcodecs/vf_ass.c
@@ -388,10 +388,12 @@ static int open(vf_instance_t *vf, char* args)
vf->priv->outfmt = vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12);
if (vf->priv->outfmt)
flags = vf_next_query_format(vf, vf->priv->outfmt);
- if (!vf->priv->outfmt || (vf->priv->auto_insert && flags&VFCAP_EOSD))
- {
+ if (!vf->priv->outfmt) {
uninit(vf);
return 0;
+ } else if (vf->priv->auto_insert && flags&VFCAP_EOSD) {
+ uninit(vf);
+ return -1;
}
if (vf->priv->auto_insert)
diff --git a/mplayer.c b/mplayer.c
index 90317dcbc1..02341713d7 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2229,9 +2229,15 @@ int reinit_video_chain(struct MPContext *mpctx)
extern vf_info_t vf_info_ass;
const vf_info_t* libass_vfs[] = {&vf_info_ass, NULL};
char* vf_arg[] = {"auto", "1", NULL};
- vf_instance_t* vf_ass = vf_open_plugin(opts, libass_vfs,sh_video->vfilter,"ass",vf_arg);
+ int retcode = 0;
+ struct vf_instance *vf_ass = vf_open_plugin_noerr(opts, libass_vfs,
+ sh_video->vfilter,
+ "ass", vf_arg,
+ &retcode);
if (vf_ass)
sh_video->vfilter = vf_ass;
+ else if (retcode == -1) // vf_ass open() returns -1 if there's VO EOSD
+ mp_msg(MSGT_CPLAYER, MSGL_V, "[ass] vf_ass not needed\n");
else
mp_msg(MSGT_CPLAYER,MSGL_ERR, "ASS: cannot add video filter\n");
}