[MPlayer-dev-eng] Video plugin layer

Fredrik Kuivinen freku045 at student.liu.se
Sun Mar 24 13:52:10 CET 2002


Hi

I have implemented a video plugin layer very similiar to the audio plugin layer.
It basically consists of a new libvo driver called plugin which takes care of
setting up plugins, parsing -vop (new option) and forwarding calls to the real
libvo driver.

-vop is basically the same thing as -aop but for video.

I have also implemented a crop plugin which can serve as a sample plugin. I have
tried to comment it in the non-obvious places.

Example usage:
(only with mplayer for now, mencoder support is trivial to add (at least I think
it is).)

mplayer -vop crop:0:50:300:400 foo.mpg 
# Cut out rectangle with upper-left corner at (0, 50), width 300 and height 400


mplayer -vop crop:10:10:100:100,crop:10:10:50:50
# First cut out rectangle with upper-left corner at (10, 10), width 100 and
# height 100 then cut out rectangle with upper-left corner at (10, 10), width
# 50 and height 50 from the first rectangle. Result is the same as -vop
# crop:20:20:50:50 meaningless example? yes :) 

Comments? Should I commit this?

/ Fredrik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: video_plugin.h
Type: text/x-chdr
Size: 1591 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20020324/32341fba/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: video_plugin_internal.h
Type: text/x-chdr
Size: 990 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20020324/32341fba/attachment-0001.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vo_plugin.c
Type: text/x-csrc
Size: 8881 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20020324/32341fba/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pl_crop.c
Type: text/x-csrc
Size: 6782 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20020324/32341fba/attachment-0001.c>
-------------- next part --------------
Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.140
diff -u -3 -p -b -r1.140 cfg-mplayer.h
--- cfg-mplayer.h	20 Mar 2002 15:37:36 -0000	1.140
+++ cfg-mplayer.h	24 Mar 2002 12:34:38 -0000
@@ -114,6 +114,8 @@ struct config ao_plugin_conf[]={
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 
+extern char** vo_plugin_args;
+
 extern int sws_flags;
 extern int readPPOpt(void *conf, char *arg);
 extern int readNPPOpt(void *conf, char *arg);
@@ -143,6 +145,7 @@ static config_t mplayer_opts[]={
 	{"vo", &video_driver, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{"ao", &audio_driver, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{"aop", ao_plugin_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+    {"vop", &vo_plugin_args, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
 //	{"dsp", &dsp, CONF_TYPE_STRING, CONF_NOCFG, 0, 0, NULL},
 	{"dsp", "Use -ao oss:dsp_path!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
         {"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.446
diff -u -3 -p -b -r1.446 mplayer.c
--- mplayer.c	23 Mar 2002 22:50:25 -0000	1.446
+++ mplayer.c	24 Mar 2002 12:34:38 -0000
@@ -35,6 +35,7 @@
 
 #include "libvo/video_out.h"
 extern void* mDisplay; // Display* mDisplay;
+#include "libvo/video_plugin.h"
 
 #include "libvo/font_load.h"
 #include "libvo/sub.h"
@@ -866,6 +867,10 @@ play_dvd:
     mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_InvalidVOdriver,video_driver?video_driver:"?");
     exit_player(MSGTR_Exit_error);
   }
+
+  if(vo_plugin_args)
+      video_out = init_vo_plugins(video_out);
+
 // check audio_out driver name:
     if (audio_driver)
 	if ((i = strcspn(audio_driver, ":")) > 0)
Index: libvo/Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/Makefile,v
retrieving revision 1.30
diff -u -3 -p -b -r1.30 Makefile
--- libvo/Makefile	9 Feb 2002 01:30:35 -0000	1.30
+++ libvo/Makefile	24 Mar 2002 12:34:39 -0000
@@ -3,7 +3,7 @@ include config.mak
 
 LIBNAME = libvo.a
 
-SRCS=aspect.c aclib.c osd.c font_load.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_mpegpes.c x11_common.c vo_yuv4mpeg.c $(OPTIONAL_SRCS) img_format.c sub.c
+SRCS=aspect.c aclib.c osd.c font_load.c video_out.c vo_null.c vo_pgm.c vo_md5.c vo_mpegpes.c x11_common.c vo_yuv4mpeg.c $(OPTIONAL_SRCS) img_format.c sub.c vo_plugin.c pl_crop.c
 OBJS=$(SRCS:.c=.o)
 
 ifeq ($(VIDIX),yes)
Index: libvo/video_out.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.c,v
retrieving revision 1.46
diff -u -3 -p -b -r1.46 video_out.c
--- libvo/video_out.c	24 Mar 2002 00:44:54 -0000	1.46
+++ libvo/video_out.c	24 Mar 2002 12:34:39 -0000
@@ -105,6 +105,7 @@ extern vo_functions_t video_out_directfb
 #ifdef CONFIG_VIDIX
 extern vo_functions_t video_out_xvidix;
 #endif
+extern vo_functions_t video_out_plugin;
 
 vo_functions_t* video_out_drivers[] =
 {
@@ -177,5 +178,6 @@ vo_functions_t* video_out_drivers[] =
 #if defined(CONFIG_VIDIX) && defined(HAVE_X11) 
 	&video_out_xvidix,
 #endif
+    &video_out_plugin,    
         NULL
 };
Index: libvo/video_out.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.h,v
retrieving revision 1.28
diff -u -3 -p -b -r1.28 video_out.h
--- libvo/video_out.h	24 Mar 2002 00:32:13 -0000	1.28
+++ libvo/video_out.h	24 Mar 2002 12:34:39 -0000
@@ -43,6 +43,8 @@
 #define VOCTRL_GET_FRAME_NUM  11
 #define VOCTRL_SET_FRAME_NUM  12
 
+#define VOCTRL_PLUGIN_SET_NEXT 13
+
 #define VO_TRUE		1
 #define VO_FALSE	0
 #define VO_ERROR	-1


More information about the MPlayer-dev-eng mailing list