From: Sam Hocevar Date: Wed, 31 Jul 2002 20:56:53 +0000 (+0000) Subject: * ALL: new module API. Makes a few things a lot simpler, and we gain X-Git-Tag: 0.5.0~1165 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=976dfc3eb46069ea3b920dec899e0c13ccf17c96;p=vlc * ALL: new module API. Makes a few things a lot simpler, and we gain about 2000 lines of code. I could not test everything on every architecture, so please report any module breakage (especially on BeOS, OSX and QNX). --- diff --git a/BUGS b/BUGS index b98e49aaae..0f2a20f9e8 100644 --- a/BUGS +++ b/BUGS @@ -1,4 +1,4 @@ -List of known vlc bugs $Id: BUGS,v 1.14 2002/06/01 12:31:57 sam Exp $ +List of known vlc bugs $Id: BUGS,v 1.15 2002/07/31 20:56:50 sam Exp $ Please try to keep this file up to date. Also, grep for FIXME in the source files for more and more bugs to fix. @@ -16,6 +16,9 @@ Input: * DVD raw device support doesn't seem to work. + * Going to title 0 with the dvdold or dvdread plugins segfaults (tested + with Nausicaa). + Decoders: @@ -36,6 +39,10 @@ Video output: * On-the-fly resizing when using a chroma transformation doesn't work for all plugins. Currently it is only implemented for x11 and SDL. + * --filter clone gives a slanted picture on axe.mpeg + * --filter transform barfs on rambo.avi + + Chroma transformations: * Most chroma transformation modules completely ignore margins. diff --git a/Makefile b/Makefile index 0eeb38a249..ea4b1f7a85 100644 --- a/Makefile +++ b/Makefile @@ -357,7 +357,7 @@ plugins-uninstall: builtins-install: mkdir -p $(DESTDIR)$(libdir)/vlc ifneq (,$(BUILTINS)) - $(INSTALL) $(BUILTINS:%=plugins/%.a) $(DESTDIR)$(libdir)/vlc + $(INSTALL) -m 644 $(BUILTINS:%=plugins/%.a) $(DESTDIR)$(libdir)/vlc endif builtins-uninstall: @@ -564,9 +564,7 @@ src/misc/modules_builtin.h: Makefile.opts Makefile Makefile.config @rm -f $@ && cp $@.in $@ ifneq (,$(BUILTINS)) @for i in $(BUILTINS) ; do \ - echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \ - echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \ - echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \ + echo "int vlc_entry__"$$i"( module_t* );" >>$@; \ done @echo "" >> $@ ; endif @@ -621,10 +619,6 @@ ifeq ($(SYS),beos) mimeset -f $@ endif -# here are the rules for a dynamic link of libvlc: -#vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) lib/libvlc.so $(BUILTIN_OBJ) -# $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS) $(builtins_LDFLAGS) -L./lib -lvlc - # # Main library target # @@ -633,6 +627,10 @@ lib/libvlc.a: Makefile.opts Makefile.dep Makefile $(LIBVLC_OBJ) ar rc $@ $(LIBVLC_OBJ) $(RANLIB) $@ +# +# DO NOT DISTRIBUTE SHARED VERSIONS OF LIBVLC UNTIL THE ABI IS STABLE +# OR BURN IN HELL -- Sam +# #lib/libvlc.so: Makefile.opts Makefile.dep Makefile $(LIBVLC_OBJ) # $(CC) -shared $(LIBVLC_OBJ) $(LDFLAGS) $(vlc_LDFLAGS) -o $@ diff --git a/configure b/configure index 4da31aa1ee..41f55d5f79 100755 --- a/configure +++ b/configure @@ -1527,7 +1527,7 @@ else int main() { /* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x = {0,0}; +typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; @@ -1602,7 +1602,7 @@ for ac_kw in inline __inline__ __inline; do #include "confdefs.h" int main() { -} int $ac_kw foo() { +} $ac_kw foo() { ; return 0; } EOF if { (eval echo configure:1609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then @@ -1708,7 +1708,7 @@ else #include "confdefs.h" #include int main() { -void *p = alloca(2 * sizeof(int)); +char *p = alloca(2 * sizeof(int)); ; return 0; } EOF if { (eval echo configure:1715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then @@ -2061,15 +2061,12 @@ else #include #include #include -#include -#include - -#ifdef HAVE_UNISTD_H -# include -#endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include +# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -2124,7 +2121,7 @@ main() /* * First, make a file with some known garbage in it. */ - data = (char*)malloc(pagesize); + data = malloc(pagesize); if (!data) exit(1); for (i = 0; i < pagesize; ++i) @@ -2145,7 +2142,7 @@ main() fd = open("conftestmmap", O_RDWR); if (fd < 0) exit(1); - data2 = (char*)malloc(2 * pagesize); + data2 = malloc(2 * pagesize); if (!data2) exit(1); data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); @@ -2163,7 +2160,7 @@ main() */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; - data3 = (char*)malloc(pagesize); + data3 = malloc(pagesize); if (!data3) exit(1); if (read(fd, data3, pagesize) != pagesize) @@ -2177,7 +2174,7 @@ main() } EOF -if { (eval echo configure:2181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -2201,12 +2198,12 @@ fi echo $ac_n "checking whether we are using the GNU C Library 2.1 or newer""... $ac_c" 1>&6 -echo "configure:2205: checking whether we are using the GNU C Library 2.1 or newer" >&5 +echo "configure:2202: checking whether we are using the GNU C Library 2.1 or newer" >&5 if eval "test \"`echo '$''{'ac_cv_gnu_library_2_1'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2242,17 +2239,17 @@ stdlib.h string.h unistd.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2246: checking for $ac_hdr" >&5 +echo "configure:2243: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2256: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2253: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2283,12 +2280,12 @@ getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ strdup strtoul tsearch __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2287: checking for $ac_func" >&5 +echo "configure:2284: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2351,7 +2348,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:2355: checking for iconv" >&5 +echo "configure:2352: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2359,7 +2356,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext < #include @@ -2369,7 +2366,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:2373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -2381,7 +2378,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext < #include @@ -2391,7 +2388,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:2395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -2412,13 +2409,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:2416: checking for iconv declaration" >&5 +echo "configure:2413: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2437,7 +2434,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else @@ -2466,19 +2463,19 @@ EOF echo $ac_n "checking for nl_langinfo and CODESET""... $ac_c" 1>&6 -echo "configure:2470: checking for nl_langinfo and CODESET" >&5 +echo "configure:2467: checking for nl_langinfo and CODESET" >&5 if eval "test \"`echo '$''{'am_cv_langinfo_codeset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char* cs = nl_langinfo(CODESET); ; return 0; } EOF -if { (eval echo configure:2482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_langinfo_codeset=yes else @@ -2501,19 +2498,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:2505: checking for LC_MESSAGES" >&5 +echo "configure:2502: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:2517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -2534,7 +2531,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:2538: checking whether NLS is requested" >&5 +echo "configure:2535: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -2556,7 +2553,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:2560: checking whether included gettext is requested" >&5 +echo "configure:2557: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -2576,17 +2573,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:2580: checking for libintl.h" >&5 +echo "configure:2577: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2590: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2587: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2603,12 +2600,12 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for GNU gettext in libc""... $ac_c" 1>&6 -echo "configure:2607: checking for GNU gettext in libc" >&5 +echo "configure:2604: checking for GNU gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < extern int _nl_msg_cat_cntr; @@ -2617,7 +2614,7 @@ bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:2621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gnugettext1_libc=yes else @@ -2633,14 +2630,14 @@ echo "$ac_t""$gt_cv_func_gnugettext1_libc" 1>&6 if test "$gt_cv_func_gnugettext1_libc" != "yes"; then echo $ac_n "checking for GNU gettext in libintl""... $ac_c" 1>&6 -echo "configure:2637: checking for GNU gettext in libintl" >&5 +echo "configure:2634: checking for GNU gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -lintl $LIBICONV" cat > conftest.$ac_ext < extern int _nl_msg_cat_cntr; @@ -2649,7 +2646,7 @@ bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gnugettext1_libintl=yes else @@ -2682,12 +2679,12 @@ EOF for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2686: checking for $ac_func" >&5 +echo "configure:2683: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2739,7 +2736,7 @@ done # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2743: checking for $ac_word" >&5 +echo "configure:2740: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2773,7 +2770,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2777: checking for $ac_word" >&5 +echo "configure:2774: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2810,7 +2807,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2814: checking for $ac_word" >&5 +echo "configure:2811: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2860,7 +2857,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2864: checking for $ac_word" >&5 +echo "configure:2861: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2894,7 +2891,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2898: checking for $ac_word" >&5 +echo "configure:2895: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2930,7 +2927,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2934: checking for $ac_word" >&5 +echo "configure:2931: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3001,7 +2998,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3005: checking for $ac_word" >&5 +echo "configure:3002: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_INTLBISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3034,7 +3031,7 @@ done ac_verc_fail=yes else echo $ac_n "checking version of bison""... $ac_c" 1>&6 -echo "configure:3038: checking version of bison" >&5 +echo "configure:3035: checking version of bison" >&5 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -3081,7 +3078,7 @@ echo "configure:3038: checking version of bison" >&5 LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:3085: checking for catalogs to be installed" >&5 +echo "configure:3082: checking for catalogs to be installed" >&5 NEW_LINGUAS= for presentlang in $ALL_LINGUAS; do useit=no @@ -3133,7 +3130,7 @@ echo "configure:3085: checking for catalogs to be installed" >&5 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:3137: checking for a BSD compatible install" >&5 +echo "configure:3134: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3215,7 +3212,7 @@ case "x${target_os}" in # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3219: checking for $ac_word" >&5 +echo "configure:3216: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3247,7 +3244,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3251: checking for $ac_word" >&5 +echo "configure:3248: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3292,6 +3289,9 @@ fi x11_LDFLAGS="${x11_LDFLAGS} -lsocket" xvideo_LDFLAGS="${xvideo_LDFLAGS} -lsocket" ;; + xsolaris*) + SYS=solaris + ;; xbeos) SYS=beos save_CFLAGS="${save_CFLAGS} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CFLAGS="${save_CFLAGS}" @@ -9199,7 +9199,7 @@ EOF VLC_SYMBOL="`echo ${VERSION} | tr .- __`" cat >> confdefs.h <> confdefs.h < then we need to update download.html + what do we still have ? + the mail, freshmeat, the videolan.org news + cvs tag + regression tests + bwaahahahahahAHAHAHA + mouhahaha + + -- #videolan +% diff --git a/include/ac3_downmix.h b/include/ac3_downmix.h index cd16b96dd8..80737951cd 100644 --- a/include/ac3_downmix.h +++ b/include/ac3_downmix.h @@ -2,7 +2,7 @@ * ac3_downmix.h : AC3 downmix types ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_downmix.h,v 1.5 2002/07/20 18:01:41 sam Exp $ + * $Id: ac3_downmix.h,v 1.6 2002/07/31 20:56:50 sam Exp $ * * Authors: Michel Kaempf * Renaud Dartus @@ -31,6 +31,8 @@ struct dm_par_t struct downmix_t { + VLC_COMMON_MEMBERS + /* Module used and shortcuts */ module_t * p_module; void (*pf_downmix_3f_2r_to_2ch)(float *, dm_par_t * dm_par); diff --git a/include/ac3_imdct.h b/include/ac3_imdct.h index 4b5a7dc201..e6e101c859 100644 --- a/include/ac3_imdct.h +++ b/include/ac3_imdct.h @@ -2,7 +2,7 @@ * ac3_imdct.h : AC3 IMDCT types ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_imdct.h,v 1.9 2002/07/20 18:01:41 sam Exp $ + * $Id: ac3_imdct.h,v 1.10 2002/07/31 20:56:50 sam Exp $ * * Authors: Michel Kaempf * Renaud Dartus @@ -32,6 +32,8 @@ struct complex_t struct imdct_t { + VLC_COMMON_MEMBERS + complex_t * buf; void * buf_orig; /* pointer before memalign */ diff --git a/include/audio_output.h b/include/audio_output.h index f216e99d0d..690053a7ac 100644 --- a/include/audio_output.h +++ b/include/audio_output.h @@ -2,7 +2,7 @@ * audio_output.h : audio output thread interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: audio_output.h,v 1.49 2002/07/20 18:01:41 sam Exp $ + * $Id: audio_output.h,v 1.50 2002/07/31 20:56:50 sam Exp $ * * Authors: Michel Kaempf * Cyril Deguet @@ -120,11 +120,9 @@ struct aout_thread_t /* Plugin used and shortcuts to access its capabilities */ module_t * p_module; - int ( *pf_open ) ( aout_thread_t * ); int ( *pf_setformat ) ( aout_thread_t * ); int ( *pf_getbufinfo ) ( aout_thread_t * , int ); void ( *pf_play ) ( aout_thread_t * , byte_t *, int ); - void ( *pf_close ) ( aout_thread_t * ); void * buffer; /* The s32 buffer is used to mix all the audio fifos together before @@ -185,7 +183,7 @@ struct aout_thread_t aout_thread_t * aout_CreateThread ( vlc_object_t *, int, int ); void aout_DestroyThread ( aout_thread_t * ); -#define aout_CreateFifo(a,b,c,d,e,f) __aout_CreateFifo(CAST_TO_VLC_OBJECT(a),b,c,d,e,f) +#define aout_CreateFifo(a,b,c,d,e,f) __aout_CreateFifo(VLC_OBJECT(a),b,c,d,e,f) VLC_EXPORT( aout_fifo_t *, __aout_CreateFifo, ( vlc_object_t *, int, int, int, int, void * ) ); VLC_EXPORT( void, aout_DestroyFifo, ( aout_fifo_t *p_fifo ) ); void aout_FreeFifo ( aout_fifo_t *p_fifo ); diff --git a/include/configuration.h b/include/configuration.h index 0bd352a0b9..fffdf70595 100644 --- a/include/configuration.h +++ b/include/configuration.h @@ -4,7 +4,7 @@ * It includes functions allowing to declare, get or set configuration options. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: configuration.h,v 1.16 2002/07/20 18:01:41 sam Exp $ + * $Id: configuration.h,v 1.17 2002/07/31 20:56:50 sam Exp $ * * Authors: Gildas Bazin * @@ -49,6 +49,7 @@ struct module_config_t { int i_type; /* Configuration type */ + char *psz_type; /* Configuration subtype */ char *psz_name; /* Option name */ char i_short; /* Optional short option name */ char *psz_text; /* Short comment on the configuration option */ @@ -89,16 +90,16 @@ VLC_EXPORT( void, config_Duplicate, ( module_t *, module_config_t * ) ); VLC_EXPORT( void, config_SetCallbacks, ( module_config_t *, module_config_t * ) ); VLC_EXPORT( void, config_UnsetCallbacks, ( module_config_t * ) ); -#define config_GetInt(a,b) __config_GetInt(CAST_TO_VLC_OBJECT(a),b) -#define config_PutInt(a,b,c) __config_PutInt(CAST_TO_VLC_OBJECT(a),b,c) -#define config_GetFloat(a,b) __config_GetFloat(CAST_TO_VLC_OBJECT(a),b) -#define config_PutFloat(a,b,c) __config_PutFloat(CAST_TO_VLC_OBJECT(a),b,c) -#define config_GetPsz(a,b) __config_GetPsz(CAST_TO_VLC_OBJECT(a),b) -#define config_PutPsz(a,b,c) __config_PutPsz(CAST_TO_VLC_OBJECT(a),b,c) +#define config_GetInt(a,b) __config_GetInt(VLC_OBJECT(a),b) +#define config_PutInt(a,b,c) __config_PutInt(VLC_OBJECT(a),b,c) +#define config_GetFloat(a,b) __config_GetFloat(VLC_OBJECT(a),b) +#define config_PutFloat(a,b,c) __config_PutFloat(VLC_OBJECT(a),b,c) +#define config_GetPsz(a,b) __config_GetPsz(VLC_OBJECT(a),b) +#define config_PutPsz(a,b,c) __config_PutPsz(VLC_OBJECT(a),b,c) -#define config_LoadCmdLine(a,b,c,d) __config_LoadCmdLine(CAST_TO_VLC_OBJECT(a),b,c,d) -#define config_LoadConfigFile(a,b) __config_LoadConfigFile(CAST_TO_VLC_OBJECT(a),b) -#define config_SaveConfigFile(a,b) __config_SaveConfigFile(CAST_TO_VLC_OBJECT(a),b) +#define config_LoadCmdLine(a,b,c,d) __config_LoadCmdLine(VLC_OBJECT(a),b,c,d) +#define config_LoadConfigFile(a,b) __config_LoadConfigFile(VLC_OBJECT(a),b) +#define config_SaveConfigFile(a,b) __config_SaveConfigFile(VLC_OBJECT(a),b) /***************************************************************************** * Macros used to build the configuration structure. @@ -113,61 +114,43 @@ VLC_EXPORT( void, config_UnsetCallbacks, ( module_config_t * ) ); * allow for a more user friendly interface. *****************************************************************************/ -#define MODULE_CONFIG_START \ - static module_config_t p_config[] = { -#define MODULE_CONFIG_STOP \ - { CONFIG_HINT_END, NULL, '\0' } }; - -#define ADD_CATEGORY_HINT( text, longtext ) \ - { CONFIG_HINT_CATEGORY, NULL, '\0', text, longtext }, -#define ADD_SUBCATEGORY_HINT( text, longtext ) \ - { CONFIG_HINT_SUBCATEGORY, NULL, '\0', text, longtext }, -#define END_SUBCATEGORY_HINT \ - { CONFIG_HINT_SUBCATEGORY_END, NULL, '\0' }, -#define ADD_USAGE_HINT( text ) \ - { CONFIG_HINT_USAGE, NULL, '\0', text }, - -#define ADD_STRING( name, psz_value, p_callback, text, longtext ) \ - { CONFIG_ITEM_STRING, name, '\0', text, longtext, psz_value, 0, 0, \ - p_callback }, -#define ADD_STRING_FROM_LIST( name, psz_value, ppsz_list, p_callback, text, \ +#define add_category_hint( text, longtext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_HINT_CATEGORY, NULL, NULL, '\0', text, longtext }; i_config++ +#define add_subcategory_hint( text, longtext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_HINT_SUBCATEGORY, NULL, NULL, '\0', text, longtext }; i_config++ +#define end_subcategory_hint \ + p_config[ i_config ] = (module_config_t){ CONFIG_HINT_SUBCATEGORY_END, NULL, NULL, '\0' }; i_config++ +#define add_usage_hint( text ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_HINT_USAGE, NULL, NULL, '\0', text }; i_config++ + +#define add_string( name, psz_value, p_callback, text, longtext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_STRING, NULL, name, '\0', text, longtext, psz_value, 0, 0, p_callback }; i_config++ +#define add_string_from_list( name, psz_value, ppsz_list, p_callback, text, \ longtext ) \ - { CONFIG_ITEM_STRING, name, '\0', text, longtext, psz_value, 0, 0, \ - p_callback, ppsz_list }, -#define ADD_FILE( name, psz_value, p_callback, text, longtext ) \ - { CONFIG_ITEM_FILE, name, '\0', text, longtext, psz_value, 0, 0, \ - p_callback }, -#define ADD_MODULE( name, i_caps, psz_value, p_callback, text, longtext ) \ - { CONFIG_ITEM_MODULE, name, '\0', text, longtext, psz_value, i_caps, 0, \ - p_callback }, -#define ADD_INTEGER( name, i_value, p_callback, text, longtext ) \ - { CONFIG_ITEM_INTEGER, name, '\0', text, longtext, NULL, i_value, 0, \ - p_callback }, -#define ADD_FLOAT( name, f_value, p_callback, text, longtext ) \ - { CONFIG_ITEM_FLOAT, name, '\0', text, longtext, NULL, 0, f_value, \ - p_callback }, -#define ADD_BOOL( name, b_value, p_callback, text, longtext ) \ - { CONFIG_ITEM_BOOL, name, '\0', text, longtext, NULL, b_value, 0, \ - p_callback }, + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_STRING, NULL, name, '\0', text, longtext, psz_value, 0, 0, p_callback, ppsz_list }; i_config++ +#define add_file( name, psz_value, p_callback, text, longtext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_FILE, NULL, name, '\0', text, longtext, psz_value, 0, 0, p_callback }; i_config++ +#define add_module( name, psz_caps, psz_value, p_callback, text, longtext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_MODULE, psz_caps, name, '\0', text, longtext, psz_value, 0, 0, p_callback }; i_config++ +#define add_integer( name, i_value, p_callback, text, longtext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_INTEGER, NULL, name, '\0', text, longtext, NULL, i_value, 0, p_callback }; i_config++ +#define add_float( name, f_value, p_callback, text, longtext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_FLOAT, NULL, name, '\0', text, longtext, NULL, 0, f_value, p_callback }; i_config++ +#define add_bool( name, b_value, p_callback, text, longtext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_BOOL, NULL, name, '\0', text, longtext, NULL, b_value, 0, p_callback }; i_config++ /* These should be seldom used. They were added just to provide easy shortcuts * for the command line interface */ -#define ADD_STRING_WITH_SHORT( name, ch, psz_value, p_callback, text, ltext ) \ - { CONFIG_ITEM_STRING, name, ch, text, ltext, psz_value, 0, 0, \ - p_callback }, -#define ADD_FILE_WITH_SHORT( name, ch, psz_value, p_callback, text, ltext ) \ - { CONFIG_ITEM_FILE, name, ch, text, ltext, psz_value, 0, 0, \ - p_callback }, -#define ADD_MODULE_WITH_SHORT( name, ch, i_capability, psz_value, p_callback, \ +#define add_string_with_short( name, ch, psz_value, p_callback, text, ltext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_STRING, NULL, name, ch, text, ltext, psz_value, 0, 0, p_callback }; i_config++ +#define add_file_with_short( name, ch, psz_value, p_callback, text, ltext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_FILE, NULL, name, ch, text, ltext, psz_value, 0, 0, p_callback }; i_config++ +#define add_module_with_short( name, ch, psz_caps, psz_value, p_callback, \ text, ltext) \ - { CONFIG_ITEM_MODULE, name, ch, text, ltext, psz_value, i_capability, 0, \ - p_callback }, -#define ADD_INTEGER_WITH_SHORT( name, ch, i_value, p_callback, text, ltext ) \ - { CONFIG_ITEM_INTEGER, name, ch, text, ltext, NULL, i_value, 0, \ - p_callback }, -#define ADD_FLOAT_WITH_SHORT( name, ch, f_value, p_callback, text, ltext ) \ - { CONFIG_ITEM_FLOAT, name, ch, text, ltext, NULL, 0, f_value, \ - p_callback }, -#define ADD_BOOL_WITH_SHORT( name, ch, b_value, p_callback, text, ltext ) \ - { CONFIG_ITEM_BOOL, name, ch, text, ltext, NULL, b_value, 0, \ - p_callback }, + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_MODULE, psz_caps, name, ch, text, ltext, psz_value, 0, 0, p_callback }; i_config++ +#define add_integer_with_short( name, ch, i_value, p_callback, text, ltext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_INTEGER, NULL, name, ch, text, ltext, NULL, i_value, 0, p_callback }; i_config++ +#define add_float_with_short( name, ch, f_value, p_callback, text, ltext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_FLOAT, NULL, name, ch, text, ltext, NULL, 0, f_value, p_callback }; i_config++ +#define add_bool_with_short( name, ch, b_value, p_callback, text, ltext ) \ + p_config[ i_config ] = (module_config_t){ CONFIG_ITEM_BOOL, NULL, name, ch, text, ltext, NULL, b_value, 0, p_callback }; i_config++ diff --git a/include/input_ext-dec.h b/include/input_ext-dec.h index a75a224319..f5cdcd025f 100644 --- a/include/input_ext-dec.h +++ b/include/input_ext-dec.h @@ -2,7 +2,7 @@ * input_ext-dec.h: structures exported to the VideoLAN decoders ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: input_ext-dec.h,v 1.64 2002/07/23 00:39:16 sam Exp $ + * $Id: input_ext-dec.h,v 1.65 2002/07/31 20:56:50 sam Exp $ * * Authors: Christophe Massiot * Michel Kaempf @@ -118,6 +118,10 @@ struct decoder_fifo_t vlc_fourcc_t i_fourcc; void * p_demux_data; stream_ctrl_t * p_stream_ctrl; + + /* Module properties */ + module_t * p_module; + int ( * pf_run ) ( decoder_fifo_t * ); }; /***************************************************************************** diff --git a/include/input_ext-intf.h b/include/input_ext-intf.h index d2253f52cd..f2d5b87f83 100644 --- a/include/input_ext-intf.h +++ b/include/input_ext-intf.h @@ -4,7 +4,7 @@ * control the pace of reading. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_ext-intf.h,v 1.72 2002/07/23 00:39:16 sam Exp $ + * $Id: input_ext-intf.h,v 1.73 2002/07/31 20:56:50 sam Exp $ * * Authors: Christophe Massiot * @@ -65,13 +65,9 @@ struct es_descriptor_t /* Decoder information */ decoder_fifo_t * p_decoder_fifo; - vlc_thread_t thread_id; /* ID of the decoder */ count_t c_packets; /* total packets read */ count_t c_invalid_packets; /* invalid packets read */ - - /* Module properties */ - module_t * p_module; }; /* Special PID values - note that the PID is only on 13 bits, and that values @@ -274,9 +270,7 @@ struct input_thread_t vlc_bool_t b_eof; /* Access module */ - module_t * p_access_module; - int (* pf_open ) ( input_thread_t * ); - void (* pf_close )( input_thread_t * ); + module_t * p_access; ssize_t (* pf_read ) ( input_thread_t *, byte_t *, size_t ); int (* pf_set_program )( input_thread_t *, pgrm_descriptor_t * ); int (* pf_set_area )( input_thread_t *, input_area_t * ); @@ -285,9 +279,7 @@ struct input_thread_t size_t i_mtu; /* Demux module */ - module_t * p_demux_module; - int (* pf_init ) ( input_thread_t * ); - void (* pf_end ) ( input_thread_t * ); + module_t * p_demux; int (* pf_demux ) ( input_thread_t * ); int (* pf_rewind ) ( input_thread_t * ); /* NULL if we don't support going * @@ -347,19 +339,19 @@ struct input_thread_t /***************************************************************************** * Prototypes *****************************************************************************/ -#define input_CreateThread(a,b,c) __input_CreateThread(CAST_TO_VLC_OBJECT(a),b,c) +#define input_CreateThread(a,b,c) __input_CreateThread(VLC_OBJECT(a),b,c) input_thread_t * __input_CreateThread ( vlc_object_t *, playlist_item_t *, int * ); void input_StopThread ( input_thread_t * ); void input_DestroyThread ( input_thread_t * ); -#define input_SetStatus(a,b) __input_SetStatus(CAST_TO_VLC_OBJECT(a),b) +#define input_SetStatus(a,b) __input_SetStatus(VLC_OBJECT(a),b) VLC_EXPORT( void, __input_SetStatus, ( vlc_object_t *, int ) ); -#define input_Seek(a,b,c) __input_Seek(CAST_TO_VLC_OBJECT(a),b,c) +#define input_Seek(a,b,c) __input_Seek(VLC_OBJECT(a),b,c) VLC_EXPORT( void, __input_Seek, ( vlc_object_t *, off_t, int ) ); -#define input_Tell(a,b) __input_Tell(CAST_TO_VLC_OBJECT(a),b) +#define input_Tell(a,b) __input_Tell(VLC_OBJECT(a),b) VLC_EXPORT( void, __input_Tell, ( vlc_object_t *, stream_position_t * ) ); VLC_EXPORT( void, input_DumpStream, ( input_thread_t * ) ); @@ -370,6 +362,5 @@ VLC_EXPORT( int, input_ChangeProgram, ( input_thread_t *, u16 ) ); int input_ToggleGrayscale( input_thread_t * ); int input_ToggleMute ( input_thread_t * ); -int input_SetSMP ( input_thread_t *, int ); #endif /* "input_ext-intf.h" */ diff --git a/include/input_ext-plugins.h b/include/input_ext-plugins.h index bfed58778a..3bf087b597 100644 --- a/include/input_ext-plugins.h +++ b/include/input_ext-plugins.h @@ -3,7 +3,7 @@ * but exported to plug-ins ***************************************************************************** * Copyright (C) 1999-2002 VideoLAN - * $Id: input_ext-plugins.h,v 1.32 2002/07/21 19:26:13 sigmunau Exp $ + * $Id: input_ext-plugins.h,v 1.33 2002/07/31 20:56:50 sam Exp $ * * Authors: Christophe Massiot * @@ -79,7 +79,7 @@ int input_DelInfo( input_thread_t * p_input ); /* no need to export this */ /***************************************************************************** * Prototypes from input_ext-plugins.h (buffers management) *****************************************************************************/ -#define input_BuffersInit(a) __input_BuffersInit(CAST_TO_VLC_OBJECT(a)) +#define input_BuffersInit(a) __input_BuffersInit(VLC_OBJECT(a)) void * __input_BuffersInit( vlc_object_t * ); VLC_EXPORT( void, input_BuffersEnd, ( input_thread_t *, input_buffers_t * ) ); @@ -282,8 +282,10 @@ struct input_socket_t /***************************************************************************** * Prototypes *****************************************************************************/ -VLC_EXPORT( void, input_FDClose, ( input_thread_t * ) ); -VLC_EXPORT( void, input_FDNetworkClose, ( input_thread_t * ) ); +VLC_EXPORT( void, __input_FDClose, ( vlc_object_t * ) ); +#define input_FDClose(a) __input_FDClose(VLC_OBJECT(a)) +VLC_EXPORT( void, __input_FDNetworkClose, ( vlc_object_t * ) ); +#define input_FDNetworkClose(a) __input_FDNetworkClose(VLC_OBJECT(a)) VLC_EXPORT( ssize_t, input_FDRead, ( input_thread_t *, byte_t *, size_t ) ); VLC_EXPORT( ssize_t, input_FDNetworkRead, ( input_thread_t *, byte_t *, size_t ) ); VLC_EXPORT( void, input_FDSeek, ( input_thread_t *, off_t ) ); diff --git a/include/interface.h b/include/interface.h index 15097570fe..20d64ac960 100644 --- a/include/interface.h +++ b/include/interface.h @@ -4,7 +4,7 @@ * interface, such as message output. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: interface.h,v 1.32 2002/07/20 18:01:41 sam Exp $ + * $Id: interface.h,v 1.33 2002/07/31 20:56:50 sam Exp $ * * Authors: Vincent Seguin * @@ -40,23 +40,20 @@ struct intf_thread_t intf_console_t * p_console; /* console */ intf_sys_t * p_sys; /* system interface */ - /* Plugin used and shortcuts to access its capabilities */ + /* Interface module */ module_t * p_module; - int ( *pf_open ) ( intf_thread_t * ); - void ( *pf_close ) ( intf_thread_t * ); void ( *pf_run ) ( intf_thread_t * ); /* XXX: new message passing stuff will go here */ vlc_mutex_t change_lock; vlc_bool_t b_menu_change; vlc_bool_t b_menu; - }; /***************************************************************************** * Prototypes *****************************************************************************/ -#define intf_Create(a) __intf_Create(CAST_TO_VLC_OBJECT(a)) +#define intf_Create(a) __intf_Create(VLC_OBJECT(a)) VLC_EXPORT( intf_thread_t *, __intf_Create, ( vlc_object_t * ) ); VLC_EXPORT( vlc_error_t, intf_RunThread, ( intf_thread_t * ) ); VLC_EXPORT( void, intf_StopThread, ( intf_thread_t * ) ); diff --git a/include/intf_eject.h b/include/intf_eject.h index d9c625e6c4..115ef4c0b4 100644 --- a/include/intf_eject.h +++ b/include/intf_eject.h @@ -2,7 +2,7 @@ * intf_eject.h: CD/DVD-ROM ejection handling functions ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: intf_eject.h,v 1.4 2002/06/01 18:04:48 sam Exp $ + * $Id: intf_eject.h,v 1.5 2002/07/31 20:56:50 sam Exp $ * * Author: Julien Blache * @@ -21,6 +21,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -#define intf_Eject(a,b) __intf_Eject(CAST_TO_VLC_OBJECT(a),b) +#define intf_Eject(a,b) __intf_Eject(VLC_OBJECT(a),b) VLC_EXPORT( int, __intf_Eject, ( vlc_object_t *, const char * ) ); diff --git a/include/main.h b/include/main.h index 24e0bd8828..0145358b3a 100644 --- a/include/main.h +++ b/include/main.h @@ -3,7 +3,7 @@ * Declaration and extern access to global program object. ***************************************************************************** * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN - * $Id: main.h,v 1.41 2002/07/29 19:05:47 gbazin Exp $ + * $Id: main.h,v 1.42 2002/07/31 20:56:50 sam Exp $ * * Authors: Vincent Seguin * @@ -44,7 +44,7 @@ struct vlc_t char ** ppsz_argv; /* command line arguments */ char * psz_homedir; /* user's home directory */ - u32 i_cpu_capabilities; /* CPU extensions */ + u32 i_cpu; /* CPU extensions */ /* Generic settings */ vlc_bool_t b_quiet; /* be quiet ? */ @@ -58,7 +58,7 @@ struct vlc_t void* ( *pf_memset ) ( void *, int, size_t ); /* FIXME: unimplemented */ /* The module bank */ - module_bank_t module_bank; + module_bank_t * p_module_bank; /* The message bank */ msg_bank_t msg_bank; diff --git a/include/modules.h b/include/modules.h index de07bc6c7e..6de57cff53 100644 --- a/include/modules.h +++ b/include/modules.h @@ -2,7 +2,7 @@ * modules.h : Module management functions. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules.h,v 1.58 2002/07/23 00:39:16 sam Exp $ + * $Id: modules.h,v 1.59 2002/07/31 20:56:50 sam Exp $ * * Authors: Samuel Hocevar * @@ -36,53 +36,6 @@ typedef int module_handle_t; typedef void * module_handle_t; #endif -/***************************************************************************** - * Module capabilities. - *****************************************************************************/ -#define MODULE_CAPABILITY_MAIN 0 /* Main */ -#define MODULE_CAPABILITY_INTF 1 /* Interface */ -#define MODULE_CAPABILITY_ACCESS 2 /* Input */ -#define MODULE_CAPABILITY_DEMUX 3 /* Input */ -#define MODULE_CAPABILITY_NETWORK 4 /* Network */ -#define MODULE_CAPABILITY_DECODER 5 /* Audio or video decoder */ -#define MODULE_CAPABILITY_MOTION 6 /* Motion compensation */ -#define MODULE_CAPABILITY_IDCT 7 /* IDCT transformation */ -#define MODULE_CAPABILITY_AOUT 8 /* Audio output */ -#define MODULE_CAPABILITY_AOUT_FILTER 9 /* Audio output filter */ -#define MODULE_CAPABILITY_VOUT 10 /* Video output */ -#define MODULE_CAPABILITY_VOUT_FILTER 11 /* Video output filter */ -#define MODULE_CAPABILITY_CHROMA 12 /* colorspace conversion */ -#define MODULE_CAPABILITY_IMDCT 13 /* IMDCT transformation */ -#define MODULE_CAPABILITY_DOWNMIX 14 /* AC3 downmix */ -#define MODULE_CAPABILITY_MEMCPY 15 /* memcpy */ -#define MODULE_CAPABILITY_MAX 16 /* Total number of capabilities */ - -#define DECLARE_MODULE_CAPABILITY_TABLE \ - static const char *ppsz_capabilities[] = \ - { \ - "main", \ - "interface", \ - "access", \ - "demux", \ - "network", \ - "decoder", \ - "motion", \ - "iDCT", \ - "audio output", \ - "audio output filter", \ - "video output", \ - "video output filter", \ - "chroma transformation", \ - "iMDCT", \ - "downmix", \ - "memcpy", \ - "unknown" \ - } - -#define MODULE_CAPABILITY( i_capa ) \ - ppsz_capabilities[ ((i_capa) > MODULE_CAPABILITY_MAX) ? \ - MODULE_CAPABILITY_MAX : (i_capa) ] - /***************************************************************************** * module_bank_t: the module bank ***************************************************************************** @@ -90,11 +43,14 @@ typedef void * module_handle_t; *****************************************************************************/ struct module_bank_t { + VLC_COMMON_MEMBERS + module_t * first; /* First module in the bank */ int i_count; /* Number of allocated modules */ vlc_mutex_t lock; /* Global lock -- you can't imagine how awful * it is to design thread-safe linked lists */ + module_symbols_t symbols; }; /***************************************************************************** @@ -113,14 +69,18 @@ struct module_t * Variables set by the module to tell us what it can do */ char *psz_program; /* Program name which will activate the module */ + char *pp_shortcuts[ MODULE_SHORTCUT_MAX ]; /* Shortcuts to the module */ - u32 i_capabilities; /* Capability list */ - int pi_score[ MODULE_CAPABILITY_MAX ]; /* Score for each capability */ + char *psz_capability; /* Capability */ + int i_score; /* Score for each capability */ + u32 i_cpu; /* Required CPU capabilities */ - u32 i_cpu_capabilities; /* Required CPU capabilities */ + vlc_bool_t b_submodule; /* Is this a submodule? */ - module_functions_t *p_functions; /* Capability functions */ + /* Callbacks */ + int ( * pf_activate ) ( vlc_object_t * ); + void ( * pf_deactivate ) ( vlc_object_t * ); /* * Variables set by the module to store its config options @@ -132,24 +92,11 @@ struct module_t /* * Variables used internally by the module manager */ - vlc_bool_t b_builtin; /* Set to true if the module is built in */ - - union - { - struct - { - module_handle_t handle; /* Unique handle */ - char * psz_filename; /* Module filename */ + /* Plugin-specific stuff */ + module_handle_t handle; /* Unique handle */ + char * psz_filename; /* Module filename */ - } plugin; - - struct - { - int ( *pf_deactivate ) ( module_t * ); - - } builtin; - - } is; + vlc_bool_t b_builtin; /* Set to true if the module is built in */ int i_usage; /* Reference counter */ int i_unused_delay; /* Delay until module is unloaded */ @@ -163,178 +110,26 @@ struct module_t module_symbols_t *p_symbols; }; -/***************************************************************************** - * Module functions description structure - *****************************************************************************/ -typedef struct function_list_t -{ - union - { - /* Interface plugin */ - struct - { - int ( * pf_open ) ( intf_thread_t * ); - void ( * pf_close )( intf_thread_t * ); - void ( * pf_run ) ( intf_thread_t * ); - } intf; - - /* Access plugin */ - struct - { - int ( * pf_open ) ( input_thread_t * ); - void ( * pf_close ) ( input_thread_t * ); - ssize_t ( * pf_read ) ( input_thread_t *, byte_t *, size_t ); - void ( * pf_seek ) ( input_thread_t *, off_t ); - int ( * pf_set_program ) ( input_thread_t *, pgrm_descriptor_t * ); - int ( * pf_set_area ) ( input_thread_t *, input_area_t * ); - } access; - - /* Demux plugin */ - struct - { - int ( * pf_init ) ( input_thread_t * ); - void ( * pf_end ) ( input_thread_t * ); - int ( * pf_demux ) ( input_thread_t * ); - int ( * pf_rewind ) ( input_thread_t * ); - } demux; - - /* Network plugin */ - struct - { - int ( * pf_open ) ( vlc_object_t *, network_socket_t * ); - } network; - - /* Audio output plugin */ - struct - { - int ( * pf_open ) ( aout_thread_t * ); - int ( * pf_setformat ) ( aout_thread_t * ); - int ( * pf_getbufinfo ) ( aout_thread_t *, int ); - void ( * pf_play ) ( aout_thread_t *, byte_t *, int ); - void ( * pf_close ) ( aout_thread_t * ); - } aout; - - /* Video output plugin */ - struct - { - int ( * pf_create ) ( vout_thread_t * ); - int ( * pf_init ) ( vout_thread_t * ); - void ( * pf_end ) ( vout_thread_t * ); - void ( * pf_destroy ) ( vout_thread_t * ); - int ( * pf_manage ) ( vout_thread_t * ); - void ( * pf_render ) ( vout_thread_t *, picture_t * ); - void ( * pf_display ) ( vout_thread_t *, picture_t * ); - } vout; - - /* Motion compensation plugin */ - struct - { - void ( * ppppf_motion[2][2][4] ) ( yuv_data_t *, yuv_data_t *, - int, int ); - } motion; - - /* IDCT plugin */ - struct - { - void ( * pf_idct_init ) ( void ** ); - void ( * pf_sparse_idct_add )( dctelem_t *, yuv_data_t *, int, - void *, int ); - void ( * pf_idct_add ) ( dctelem_t *, yuv_data_t *, int, - void *, int ); - void ( * pf_sparse_idct_copy )( dctelem_t *, yuv_data_t *, int, - void *, int ); - void ( * pf_idct_copy ) ( dctelem_t *, yuv_data_t *, int, - void *, int ); - void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] ); - } idct; - - /* Chroma transformation plugin */ - struct - { - int ( * pf_init ) ( vout_thread_t * ); - void ( * pf_end ) ( vout_thread_t * ); - } chroma; - - /* IMDCT plugin */ - struct - { - void ( * pf_imdct_init ) ( imdct_t * ); - void ( * pf_imdct_256 ) ( imdct_t *, float [], float [] ); - void ( * pf_imdct_256_nol )( imdct_t *, float [], float [] ); - void ( * pf_imdct_512 ) ( imdct_t *, float [], float [] ); - void ( * pf_imdct_512_nol )( imdct_t *, float [], float [] ); -// void ( * pf_fft_64p ) ( complex_t * ); - - } imdct; - - /* AC3 downmix plugin */ - struct - { - void ( * pf_downmix_3f_2r_to_2ch ) ( float *, dm_par_t * ); - void ( * pf_downmix_3f_1r_to_2ch ) ( float *, dm_par_t * ); - void ( * pf_downmix_2f_2r_to_2ch ) ( float *, dm_par_t * ); - void ( * pf_downmix_2f_1r_to_2ch ) ( float *, dm_par_t * ); - void ( * pf_downmix_3f_0r_to_2ch ) ( float *, dm_par_t * ); - void ( * pf_stream_sample_2ch_to_s16 ) ( s16 *, float *, float * ); - void ( * pf_stream_sample_1ch_to_s16 ) ( s16 *, float * ); - - } downmix; - - /* Decoder plugins */ - struct - { - int ( * pf_probe)( vlc_fourcc_t * p_es ); - int ( * pf_run ) ( decoder_fifo_t * p_fifo ); - } dec; - - /* memcpy plugins */ - struct - { - void* ( * pf_memcpy ) ( void *, const void *, size_t ); - void* ( * pf_memset ) ( void *, int, size_t ); - } memcpy; - - } functions; - -} function_list_t; - -struct module_functions_t -{ - /* XXX: The order here has to be the same as above for the #defines */ - function_list_t intf; - function_list_t access; - function_list_t demux; - function_list_t network; - function_list_t dec; - function_list_t motion; - function_list_t idct; - function_list_t aout; - function_list_t vout; - function_list_t chroma; - function_list_t imdct; - function_list_t downmix; - function_list_t memcpy; -}; - /***************************************************************************** * Exported functions. *****************************************************************************/ -#define module_InitBank(a) __module_InitBank(CAST_TO_VLC_OBJECT(a)) +#define module_InitBank(a) __module_InitBank(VLC_OBJECT(a)) void __module_InitBank ( vlc_object_t * ); -#define module_LoadMain(a) __module_LoadMain(CAST_TO_VLC_OBJECT(a)) +#define module_LoadMain(a) __module_LoadMain(VLC_OBJECT(a)) void __module_LoadMain ( vlc_object_t * ); -#define module_LoadBuiltins(a) __module_LoadBuiltins(CAST_TO_VLC_OBJECT(a)) +#define module_LoadBuiltins(a) __module_LoadBuiltins(VLC_OBJECT(a)) void __module_LoadBuiltins ( vlc_object_t * ); -#define module_LoadPlugins(a) __module_LoadPlugins(CAST_TO_VLC_OBJECT(a)) +#define module_LoadPlugins(a) __module_LoadPlugins(VLC_OBJECT(a)) void __module_LoadPlugins ( vlc_object_t * ); -#define module_EndBank(a) __module_EndBank(CAST_TO_VLC_OBJECT(a)) +#define module_EndBank(a) __module_EndBank(VLC_OBJECT(a)) void __module_EndBank ( vlc_object_t * ); -#define module_ResetBank(a) __module_ResetBank(CAST_TO_VLC_OBJECT(a)) +#define module_ResetBank(a) __module_ResetBank(VLC_OBJECT(a)) void __module_ResetBank ( vlc_object_t * ); -#define module_ManageBank(a) __module_ManageBank(CAST_TO_VLC_OBJECT(a)) +#define module_ManageBank(a) __module_ManageBank(VLC_OBJECT(a)) void __module_ManageBank ( vlc_object_t * ); -#define module_Need(a,b,c,d) __module_Need(CAST_TO_VLC_OBJECT(a),b,c,d) -VLC_EXPORT( module_t *, __module_Need, ( vlc_object_t *, int, const char *, void * ) ); -VLC_EXPORT( void, module_Unneed, ( module_t * ) ); +#define module_Need(a,b,c) __module_Need(VLC_OBJECT(a),b,c) +VLC_EXPORT( module_t *, __module_Need, ( vlc_object_t *, const char *, const char * ) ); +#define module_Unneed(a,b) __module_Unneed(VLC_OBJECT(a),b) +VLC_EXPORT( void, __module_Unneed, ( vlc_object_t *, module_t * ) ); diff --git a/include/modules_inner.h b/include/modules_inner.h index 043d4426ff..0bfbe4389e 100644 --- a/include/modules_inner.h +++ b/include/modules_inner.h @@ -2,7 +2,7 @@ * modules_inner.h : Macros used from within a module. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules_inner.h,v 1.23 2002/06/01 12:31:57 sam Exp $ + * $Id: modules_inner.h,v 1.24 2002/07/31 20:56:50 sam Exp $ * * Authors: Samuel Hocevar * @@ -48,22 +48,28 @@ #define UGLY_KLUDGE( z ) #z /* And I need to do _this_ to change « foo bar » to « module_foo_bar » ! */ #define CONCATENATE( y, z ) CRUDE_HACK( y, z ) -#define CRUDE_HACK( y, z ) y##__MODULE_##z +#define CRUDE_HACK( y, z ) y##__##z /* If the module is built-in, then we need to define foo_InitModule instead * of InitModule. Same for Activate- and DeactivateModule. */ #if defined( __BUILTIN__ ) -# define _M( function ) CONCATENATE( function, MODULE_NAME ) +# define E_( function ) CONCATENATE( function, MODULE_NAME ) # define __VLC_SYMBOL( symbol ) CONCATENATE( symbol, MODULE_NAME ) # define DECLARE_SYMBOLS ; # define STORE_SYMBOLS ; #elif defined( __PLUGIN__ ) -# define _M( function ) function +# define E_( function ) function # define __VLC_SYMBOL( symbol ) CONCATENATE( symbol, MODULE_SYMBOL ) # define DECLARE_SYMBOLS module_symbols_t* p_symbols; # define STORE_SYMBOLS p_symbols = p_module->p_symbols; #endif +#if defined( __cplusplus ) +# define EXTERN_SYMBOL extern "C" +#else +# define EXTERN_SYMBOL +#endif + #define MODULE_STRING STRINGIFY( MODULE_NAME ) /* @@ -72,86 +78,112 @@ * instance the module name, its shortcuts, its capabilities... we also create * a copy of its config because the module can be unloaded at any time. */ -#define MODULE_INIT_START \ +#define vlc_module_begin( ) \ DECLARE_SYMBOLS; \ - int __VLC_SYMBOL( InitModule ) ( module_t *p_module ) \ + EXTERN_SYMBOL int __VLC_SYMBOL(vlc_entry) ( module_t *p_module ) \ { \ - int i_shortcut = 1; \ + int i_shortcut = 1, i_config = 0; \ + module_config_t p_config[ 100 ]; \ STORE_SYMBOLS; \ + p_module->b_submodule = VLC_FALSE; \ p_module->psz_object_name = MODULE_STRING; \ p_module->psz_longname = MODULE_STRING; \ - p_module->psz_program = NULL; \ p_module->pp_shortcuts[ 0 ] = MODULE_STRING; \ - p_module->i_capabilities = 0; \ - p_module->i_cpu_capabilities = 0; \ - do { + p_module->i_cpu = 0; \ + p_module->psz_program = NULL; \ + p_module->psz_capability = ""; \ + p_module->i_score = 1; \ + p_module->pf_activate = NULL; \ + p_module->pf_deactivate = NULL; \ + do \ + { \ + module_t *p_submodule = p_module /* the ; gets added */ -#define MODULE_INIT_STOP \ +#define vlc_module_end( ) \ + p_submodule->pp_shortcuts[ i_shortcut ] = NULL; \ } while( 0 ); \ - p_module->pp_shortcuts[ i_shortcut ] = NULL; \ + p_config[ i_config ] = \ + (module_config_t){ CONFIG_HINT_END, NULL, NULL, '\0' }; \ config_Duplicate( p_module, p_config ); \ if( p_module->p_config == NULL ) \ { \ -/*//X intf_Err( p_module, "InitModule can't duplicate p_config" );*/ \ return -1; \ } \ - return 0; \ - } - -#define ADD_CAPABILITY( cap, score ) \ - p_module->i_capabilities |= 1 << MODULE_CAPABILITY_##cap; \ - p_module->pi_score[ MODULE_CAPABILITY_##cap ] = score; - -#define ADD_REQUIREMENT( cap ) \ - p_module->i_cpu_capabilities |= CPU_CAPABILITY_##cap; - -#define ADD_PROGRAM( program ) \ - p_module->psz_program = program; - -#define ADD_SHORTCUT( shortcut ) \ - p_module->pp_shortcuts[ i_shortcut ] = shortcut; \ - i_shortcut++; - -#define SET_DESCRIPTION( desc ) \ - p_module->psz_longname = desc; + return 0 && i_shortcut; \ + } \ + int __VLC_SYMBOL(vlc_entry) ( module_t * ) /* the ; gets added */ + + +#define add_submodule( ) \ + p_submodule->pp_shortcuts[ i_shortcut ] = NULL; \ + p_submodule = vlc_object_create( p_module, VLC_OBJECT_MODULE ); \ + vlc_object_attach( p_submodule, p_module ); \ + p_submodule->b_submodule = VLC_TRUE; \ + /* Nuahahaha! Heritage! Polymorphism! Ugliness!! */ \ + for( i_shortcut = 0; p_module->pp_shortcuts[ i_shortcut ]; i_shortcut++ ) \ + { \ + p_submodule->pp_shortcuts[ i_shortcut ] = \ + p_module->pp_shortcuts[ i_shortcut ]; \ + } \ + p_submodule->psz_object_name = p_module->psz_object_name; \ + p_submodule->psz_program = p_module->psz_program; \ + p_submodule->psz_capability = p_module->psz_capability; \ + p_submodule->i_score = p_module->i_score; \ + p_submodule->i_cpu = p_module->i_cpu; \ + p_submodule->pf_activate = NULL; \ + p_submodule->pf_deactivate = NULL + +#define add_requirement( cap ) \ + p_module->i_cpu |= CPU_CAPABILITY_##cap + +#define add_shortcut( shortcut ) \ + p_submodule->pp_shortcuts[ i_shortcut ] = shortcut; \ + i_shortcut++ + +#define set_description( desc ) \ + p_module->psz_longname = desc + +#define set_capability( cap, score ) \ + p_submodule->psz_capability = cap; \ + p_submodule->i_score = score + +#define set_program( program ) \ + p_submodule->psz_program = program + +#define set_callbacks( activate, deactivate ) \ + p_submodule->pf_activate = activate; \ + p_submodule->pf_deactivate = deactivate /* - * ActivateModule: this function is called before functions can be accessed, + * module_activate: this function is called before functions can be accessed, * we do allocation tasks here, and maybe additional stuff such as large * table allocation. Once ActivateModule is called we are almost sure the * module will be used. */ -#define MODULE_ACTIVATE_START \ - int __VLC_SYMBOL( ActivateModule ) ( module_t *p_module ) \ +#define module_activate( prototype ) \ + __module_activate( prototype ); \ + int __VLC_SYMBOL( module_activate ) ( module_t *p_module ) \ { \ STORE_SYMBOLS; \ - p_module->p_functions = \ - ( module_functions_t * )malloc( sizeof( module_functions_t ) ); \ - if( p_module->p_functions == NULL ) \ - { \ - return( -1 ); \ - } \ config_SetCallbacks( p_module->p_config, p_config ); \ - do { - -#define MODULE_ACTIVATE_STOP \ - } while( 0 ); \ - return 0; \ - } + return __module_activate( p_module ); \ + } \ + \ + static int __module_activate( prototype ) /* * DeactivateModule: this function is called after we are finished with the * module. Everything that has been done in ActivateModule needs to be undone * here. */ -#define MODULE_DEACTIVATE_START \ - int __VLC_SYMBOL( DeactivateModule )( module_t *p_module ) \ +#define module_deactivate( prototype ) \ + __module_deactivate( prototype ); \ + int __VLC_SYMBOL( module_deactivate )( module_t *p_module ) \ { \ - free( p_module->p_functions ); \ - do { - -#define MODULE_DEACTIVATE_STOP \ - } while( 0 ); \ + int i_ret = __module_deactivate( p_module ); \ config_UnsetCallbacks( p_module->p_config ); \ - return 0; \ - } + return i_ret; \ + } \ + \ + static int __module_deactivate( prototype ) + diff --git a/include/netutils.h b/include/netutils.h index 7c88dddfde..2d47af293e 100644 --- a/include/netutils.h +++ b/include/netutils.h @@ -4,7 +4,7 @@ * modules. ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: netutils.h,v 1.21 2002/06/01 18:04:48 sam Exp $ + * $Id: netutils.h,v 1.22 2002/07/31 20:56:50 sam Exp $ * * Authors: Vincent Seguin * Henri Fallon @@ -33,8 +33,8 @@ struct sockaddr_in; int network_BuildAddr ( struct sockaddr_in *, char *, int ); -#define network_ChannelJoin(a,b) __network_ChannelJoin(CAST_TO_VLC_OBJECT(a),b) -#define network_ChannelCreate(a) __network_ChannelCreate(CAST_TO_VLC_OBJECT(a)) +#define network_ChannelJoin(a,b) __network_ChannelJoin(VLC_OBJECT(a),b) +#define network_ChannelCreate(a) __network_ChannelCreate(VLC_OBJECT(a)) VLC_EXPORT( int, __network_ChannelJoin, ( vlc_object_t *, int ) ); VLC_EXPORT( int, __network_ChannelCreate, ( vlc_object_t * ) ); diff --git a/include/stream_control.h b/include/stream_control.h index 095efa9010..ccf2f82e73 100644 --- a/include/stream_control.h +++ b/include/stream_control.h @@ -4,7 +4,7 @@ * of the reading. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: stream_control.h,v 1.9 2002/07/20 18:01:41 sam Exp $ + * $Id: stream_control.h,v 1.10 2002/07/31 20:56:50 sam Exp $ * * Authors: Christophe Massiot * @@ -43,8 +43,6 @@ struct stream_ctrl_t vlc_bool_t b_mute; vlc_bool_t b_grayscale; /* use color or grayscale */ - int i_smp; /* number of symmetrical threads to launch - * to decode the video | 0 == disabled */ }; /* Possible status : */ diff --git a/include/video_output.h b/include/video_output.h index 4675daa4b1..7759ce890d 100644 --- a/include/video_output.h +++ b/include/video_output.h @@ -5,7 +5,7 @@ * thread, and destroy a previously opened video output thread. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_output.h,v 1.81 2002/07/20 18:01:41 sam Exp $ + * $Id: video_output.h,v 1.82 2002/07/31 20:56:50 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -47,8 +47,6 @@ typedef struct vout_chroma_t /* Plugin used and shortcuts to access its capabilities */ module_t * p_module; - int ( * pf_init ) ( vout_thread_t * ); - void ( * pf_end ) ( vout_thread_t * ); } vout_chroma_t; @@ -102,10 +100,8 @@ struct vout_thread_t /* Plugin used and shortcuts to access its capabilities */ module_t * p_module; - int ( *pf_create ) ( vout_thread_t * ); int ( *pf_init ) ( vout_thread_t * ); void ( *pf_end ) ( vout_thread_t * ); - void ( *pf_destroy ) ( vout_thread_t * ); int ( *pf_manage ) ( vout_thread_t * ); void ( *pf_render ) ( vout_thread_t *, picture_t * ); void ( *pf_display ) ( vout_thread_t *, picture_t * ); @@ -170,7 +166,7 @@ struct vout_thread_t /***************************************************************************** * Prototypes *****************************************************************************/ -#define vout_CreateThread(a,b,c,d,e) __vout_CreateThread(CAST_TO_VLC_OBJECT(a),b,c,d,e) +#define vout_CreateThread(a,b,c,d,e) __vout_CreateThread(VLC_OBJECT(a),b,c,d,e) VLC_EXPORT( vout_thread_t *, __vout_CreateThread, ( vlc_object_t *, int, int, u32, int ) ); VLC_EXPORT( void, vout_DestroyThread, ( vout_thread_t * ) ); diff --git a/include/vlc_common.h b/include/vlc_common.h index 72dfa211c6..a9be580df8 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -3,7 +3,7 @@ * Collection of useful common types and macros definitions ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: vlc_common.h,v 1.12 2002/07/23 00:39:16 sam Exp $ + * $Id: vlc_common.h,v 1.13 2002/07/31 20:56:50 sam Exp $ * * Authors: Samuel Hocevar * Vincent Seguin @@ -254,6 +254,9 @@ VLC_DECLARE_STRUCT(input_info_category_t) vlc_object_t ** pp_children; /* our children */ \ volatile int i_children; \ \ + /* Private data */ \ + void * p_private; \ + \ /* Just a reminder so that people don't cast garbage */ \ int be_sure_to_add_VLC_COMMON_MEMBERS_to_struct; \ @@ -263,8 +266,8 @@ struct vlc_object_t VLC_COMMON_MEMBERS }; -/* CAST_TO_VLC_OBJECT: attempt at doing a clever cast */ -#define CAST_TO_VLC_OBJECT( x ) \ +/* VLC_OBJECT: attempt at doing a clever cast */ +#define VLC_OBJECT( x ) \ ((vlc_object_t *)(x))+0*(x)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct /***************************************************************************** diff --git a/include/vlc_cpu.h b/include/vlc_cpu.h index 792938e978..218cfbbe3d 100644 --- a/include/vlc_cpu.h +++ b/include/vlc_cpu.h @@ -2,7 +2,7 @@ * cpu.h: CPU type detection ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: vlc_cpu.h,v 1.2 2002/06/01 18:04:48 sam Exp $ + * $Id: vlc_cpu.h,v 1.3 2002/07/31 20:56:50 sam Exp $ * * Authors: Samuel Hocevar * @@ -21,6 +21,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -#define CPUCapabilities(a) __CPUCapabilities(CAST_TO_VLC_OBJECT(a)) +#define CPUCapabilities(a) __CPUCapabilities(VLC_OBJECT(a)) u32 __CPUCapabilities( vlc_object_t * ); diff --git a/include/vlc_messages.h b/include/vlc_messages.h index 1a6b537ff9..319f6e6545 100644 --- a/include/vlc_messages.h +++ b/include/vlc_messages.h @@ -4,7 +4,7 @@ * interface, such as message output. ***************************************************************************** * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN - * $Id: vlc_messages.h,v 1.4 2002/07/20 18:01:42 sam Exp $ + * $Id: vlc_messages.h,v 1.5 2002/07/31 20:56:50 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -61,6 +61,8 @@ struct msg_bank_t { /* Message queue lock */ vlc_mutex_t lock; + vlc_bool_t b_configured; + vlc_bool_t b_overflow; /* Message queue */ msg_item_t msg[VLC_MSG_QSIZE]; /* message queue */ @@ -98,19 +100,19 @@ VLC_EXPORT( void, __msg_Dbg, ( void *, const char *, ... ) ); #ifdef HAVE_VARIADIC_MACROS # define msg_Info( p_this, psz_format, args... ) \ - __msg_Generic( CAST_TO_VLC_OBJECT(p_this), VLC_MSG_INFO, MODULE_STRING, \ + __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_INFO, MODULE_STRING, \ psz_format, ## args ) # define msg_Err( p_this, psz_format, args... ) \ - __msg_Generic( CAST_TO_VLC_OBJECT(p_this), VLC_MSG_ERR, MODULE_STRING, \ + __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_ERR, MODULE_STRING, \ psz_format, ## args ) # define msg_Warn( p_this, psz_format, args... ) \ - __msg_Generic( CAST_TO_VLC_OBJECT(p_this), VLC_MSG_WARN, MODULE_STRING, \ + __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_WARN, MODULE_STRING, \ psz_format, ## args ) # define msg_Dbg( p_this, psz_format, args... ) \ - __msg_Generic( CAST_TO_VLC_OBJECT(p_this), VLC_MSG_DBG, MODULE_STRING, \ + __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_DBG, MODULE_STRING, \ psz_format, ## args ) #else /* HAVE_VARIADIC_MACROS */ @@ -122,15 +124,15 @@ VLC_EXPORT( void, __msg_Dbg, ( void *, const char *, ... ) ); #endif /* HAVE_VARIADIC_MACROS */ -#define msg_Create(a) __msg_Create(CAST_TO_VLC_OBJECT(a)) -#define msg_Flush(a) __msg_Flush(CAST_TO_VLC_OBJECT(a)) -#define msg_Destroy(a) __msg_Destroy(CAST_TO_VLC_OBJECT(a)) +#define msg_Create(a) __msg_Create(VLC_OBJECT(a)) +#define msg_Flush(a) __msg_Flush(VLC_OBJECT(a)) +#define msg_Destroy(a) __msg_Destroy(VLC_OBJECT(a)) void __msg_Create ( vlc_object_t * ); void __msg_Flush ( vlc_object_t * ); void __msg_Destroy ( vlc_object_t * ); -#define msg_Subscribe(a) __msg_Subscribe(CAST_TO_VLC_OBJECT(a)) -#define msg_Unsubscribe(a,b) __msg_Unsubscribe(CAST_TO_VLC_OBJECT(a),b) +#define msg_Subscribe(a) __msg_Subscribe(VLC_OBJECT(a)) +#define msg_Unsubscribe(a,b) __msg_Unsubscribe(VLC_OBJECT(a),b) VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t * ) ); VLC_EXPORT( void, __msg_Unsubscribe, ( vlc_object_t *, msg_subscription_t * ) ); diff --git a/include/vlc_objects.h b/include/vlc_objects.h index 8e1a5ed429..63c36046be 100644 --- a/include/vlc_objects.h +++ b/include/vlc_objects.h @@ -2,7 +2,7 @@ * vlc_objects.h: vlc_object_t definition. ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: vlc_objects.h,v 1.4 2002/06/07 14:59:40 sam Exp $ + * $Id: vlc_objects.h,v 1.5 2002/07/31 20:56:50 sam Exp $ * * Authors: Samuel Hocevar * @@ -31,7 +31,7 @@ #define VLC_OBJECT_DECODER (-7) #define VLC_OBJECT_VOUT (-8) #define VLC_OBJECT_AOUT (-9) -#define VLC_OBJECT_PRIVATE (-666) +#define VLC_OBJECT_GENERIC (-666) /* Object search mode */ #define FIND_PARENT 0x0001 @@ -40,6 +40,9 @@ #define FIND_STRICT 0x0010 +/* Object cast */ + + /***************************************************************************** * Prototypes *****************************************************************************/ @@ -58,35 +61,35 @@ VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) ); VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) ); #define vlc_object_create(a,b) \ - __vlc_object_create( CAST_TO_VLC_OBJECT(a), b ) + __vlc_object_create( VLC_OBJECT(a), b ) #define vlc_object_destroy(a) do { \ - __vlc_object_destroy( CAST_TO_VLC_OBJECT(a) ); \ + __vlc_object_destroy( VLC_OBJECT(a) ); \ (a) = NULL; } while(0) #define vlc_object_find(a,b,c) \ - __vlc_object_find( CAST_TO_VLC_OBJECT(a),b,c) + __vlc_object_find( VLC_OBJECT(a),b,c) #define vlc_object_yield(a) \ - __vlc_object_yield( CAST_TO_VLC_OBJECT(a) ) + __vlc_object_yield( VLC_OBJECT(a) ) #define vlc_object_release(a) \ - __vlc_object_release( CAST_TO_VLC_OBJECT(a) ) + __vlc_object_release( VLC_OBJECT(a) ) #define vlc_object_detach(a,b) \ - __vlc_object_detach( CAST_TO_VLC_OBJECT(a), CAST_TO_VLC_OBJECT(b) ) + __vlc_object_detach( VLC_OBJECT(a), VLC_OBJECT(b) ) #define vlc_object_detach_all(a) \ - __vlc_object_detach_all( CAST_TO_VLC_OBJECT(a) ) + __vlc_object_detach_all( VLC_OBJECT(a) ) #define vlc_object_attach(a,b) \ - __vlc_object_attach( CAST_TO_VLC_OBJECT(a), CAST_TO_VLC_OBJECT(b) ) + __vlc_object_attach( VLC_OBJECT(a), VLC_OBJECT(b) ) #if 0 #define vlc_object_setchild(a,b) \ - __vlc_object_setchild( CAST_TO_VLC_OBJECT(a), CAST_TO_VLC_OBJECT(b) ) + __vlc_object_setchild( VLC_OBJECT(a), VLC_OBJECT(b) ) #endif #define vlc_dumpstructure(a) \ - __vlc_dumpstructure( CAST_TO_VLC_OBJECT(a) ) + __vlc_dumpstructure( VLC_OBJECT(a) ) diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h index a906bd9fb9..69ebec8f72 100644 --- a/include/vlc_playlist.h +++ b/include/vlc_playlist.h @@ -2,7 +2,7 @@ * vlc_playlist.h : Playlist functions ***************************************************************************** * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN - * $Id: vlc_playlist.h,v 1.3 2002/07/20 18:01:42 sam Exp $ + * $Id: vlc_playlist.h,v 1.4 2002/07/31 20:56:50 sam Exp $ * * Authors: Samuel Hocevar * @@ -54,7 +54,7 @@ struct playlist_t /***************************************************************************** * Prototypes *****************************************************************************/ -#define playlist_Create(a) __playlist_Create(CAST_TO_VLC_OBJECT(a)) +#define playlist_Create(a) __playlist_Create(VLC_OBJECT(a)) playlist_t * __playlist_Create ( vlc_object_t * ); void playlist_Destroy ( playlist_t * ); diff --git a/include/vlc_symbols.h b/include/vlc_symbols.h index 977e8797f1..fa2f94bc08 100644 --- a/include/vlc_symbols.h +++ b/include/vlc_symbols.h @@ -3,8 +3,8 @@ struct module_symbols_t { aout_fifo_t * (* __aout_CreateFifo_inner) ( vlc_object_t *, int, int, int, int, void * ) ; - char * (* config_GetHomeDir_inner) ( void ) ; char * (* __config_GetPsz_inner) (vlc_object_t *, const char *) ; + char * (* config_GetHomeDir_inner) ( void ) ; char * (* input_OffsetToTime_inner) ( input_thread_t *, char *, off_t ) ; char * (* mstrtime_inner) ( char *psz_buffer, mtime_t date ) ; const char * (* DecodeLanguage_inner) ( u16 ) ; @@ -24,7 +24,16 @@ struct module_symbols_t int (* __config_LoadCmdLine_inner) ( vlc_object_t *, int *, char *[], vlc_bool_t ) ; int (* __config_LoadConfigFile_inner) ( vlc_object_t *, const char * ) ; int (* __config_SaveConfigFile_inner) ( vlc_object_t *, const char * ) ; - intf_thread_t * (* __intf_Create_inner) ( vlc_object_t * ) ; + int (* __intf_Eject_inner) ( vlc_object_t *, const char * ) ; + int (* __network_ChannelCreate_inner) ( vlc_object_t * ) ; + int (* __network_ChannelJoin_inner) ( vlc_object_t *, int ) ; + int (* __vlc_cond_destroy_inner) ( char *, int, vlc_cond_t * ) ; + int (* __vlc_cond_init_inner) ( vlc_object_t *, vlc_cond_t * ) ; + int (* __vlc_mutex_destroy_inner) ( char *, int, vlc_mutex_t * ) ; + int (* __vlc_mutex_init_inner) ( vlc_object_t *, vlc_mutex_t * ) ; + int (* __vlc_thread_create_inner) ( vlc_object_t *, char *, int, char *, void * ( * ) ( void * ), vlc_bool_t ) ; + int (* __vlc_threads_end_inner) ( vlc_object_t * ) ; + int (* __vlc_threads_init_inner) ( vlc_object_t * ) ; int (* input_AccessInit_inner) ( input_thread_t * ) ; int (* input_AddInfo_inner) ( input_info_category_t *, char *, char *, ... ) ; int (* input_ChangeArea_inner) ( input_thread_t *, input_area_t * ) ; @@ -35,21 +44,12 @@ struct module_symbols_t int (* input_SetProgram_inner) ( input_thread_t *, pgrm_descriptor_t * ) ; int (* input_ToggleES_inner) ( input_thread_t *, es_descriptor_t *, vlc_bool_t ) ; int (* input_UnselectES_inner) ( input_thread_t *, es_descriptor_t * ) ; - int (* __intf_Eject_inner) ( vlc_object_t *, const char * ) ; - int (* __network_ChannelCreate_inner) ( vlc_object_t * ) ; - int (* __network_ChannelJoin_inner) ( vlc_object_t *, int ) ; int (* playlist_Add_inner) ( playlist_t *, const char *, int, int ) ; int (* playlist_Delete_inner) ( playlist_t *, int ) ; - int (* __vlc_cond_destroy_inner) ( char *, int, vlc_cond_t * ) ; - int (* __vlc_cond_init_inner) ( vlc_object_t *, vlc_cond_t * ) ; - int (* __vlc_mutex_destroy_inner) ( char *, int, vlc_mutex_t * ) ; - int (* __vlc_mutex_init_inner) ( vlc_object_t *, vlc_mutex_t * ) ; - int (* __vlc_thread_create_inner) ( vlc_object_t *, char *, int, char *, void * ( * ) ( void * ), vlc_bool_t ) ; - int (* __vlc_threads_end_inner) ( vlc_object_t * ) ; - int (* __vlc_threads_init_inner) ( vlc_object_t * ) ; int (* vout_ChromaCmp_inner) ( u32, u32 ) ; + intf_thread_t * (* __intf_Create_inner) ( vlc_object_t * ) ; module_config_t * (* config_FindConfig_inner) ( vlc_object_t *, const char *psz_name ) ; - module_t * (* __module_Need_inner) ( vlc_object_t *, int, const char *, void * ) ; + module_t * (* __module_Need_inner) ( vlc_object_t *, const char *, const char * ) ; msg_subscription_t* (* __msg_Subscribe_inner) ( vlc_object_t * ) ; mtime_t (* input_ClockGetTS_inner) ( input_thread_t *, pgrm_descriptor_t *, mtime_t ) ; mtime_t (* mdate_inner) ( void ) ; @@ -69,17 +69,39 @@ struct module_symbols_t u32 (* UnalignedShowBits_inner) ( bit_stream_t *, unsigned int ) ; vlc_bool_t (* NextDataPacket_inner) ( decoder_fifo_t *, data_packet_t ** ) ; vlc_error_t (* intf_RunThread_inner) ( intf_thread_t * ) ; - void (* aout_DestroyFifo_inner) ( aout_fifo_t *p_fifo ) ; void (* BitstreamNextDataPacket_inner) ( bit_stream_t * ) ; - void (* config_Duplicate_inner) ( module_t *, module_config_t * ) ; + void (* CurrentPTS_inner) ( bit_stream_t *, mtime_t *, mtime_t * ) ; + void (* DecoderError_inner) ( decoder_fifo_t * p_fifo ) ; + void (* InitBitstream_inner) ( bit_stream_t *, decoder_fifo_t *, void ( * )( bit_stream_t *, vlc_bool_t ), void * p_callback_arg ) ; + void (* UnalignedRemoveBits_inner) ( bit_stream_t * ) ; void (* __config_PutFloat_inner) (vlc_object_t *, const char *, float) ; void (* __config_PutInt_inner) (vlc_object_t *, const char *, int) ; void (* __config_PutPsz_inner) (vlc_object_t *, const char *, const char *) ; + void (* __input_FDClose_inner) ( vlc_object_t * ) ; + void (* __input_FDNetworkClose_inner) ( vlc_object_t * ) ; + void (* __input_Seek_inner) ( vlc_object_t *, off_t, int ) ; + void (* __input_SetStatus_inner) ( vlc_object_t *, int ) ; + void (* __input_Tell_inner) ( vlc_object_t *, stream_position_t * ) ; + void (* __module_Unneed_inner) ( vlc_object_t *, module_t * ) ; + void (* __msg_Dbg_inner) ( void *, const char *, ... ) ; + void (* __msg_Err_inner) ( void *, const char *, ... ) ; + void (* __msg_Generic_inner) ( vlc_object_t *, int, const char *, const char *, ... ) ; + void (* __msg_Info_inner) ( void *, const char *, ... ) ; + void (* __msg_Unsubscribe_inner) ( vlc_object_t *, msg_subscription_t * ) ; + void (* __msg_Warn_inner) ( void *, const char *, ... ) ; + void (* __vlc_dumpstructure_inner) ( vlc_object_t * ) ; + void (* __vlc_object_attach_inner) ( vlc_object_t *, vlc_object_t * ) ; + void (* __vlc_object_destroy_inner) ( vlc_object_t * ) ; + void (* __vlc_object_detach_all_inner) ( vlc_object_t * ) ; + void (* __vlc_object_detach_inner) ( vlc_object_t *, vlc_object_t * ) ; + void (* __vlc_object_release_inner) ( vlc_object_t * ) ; + void (* __vlc_object_yield_inner) ( vlc_object_t * ) ; + void (* __vlc_thread_join_inner) ( vlc_object_t *, char *, int ) ; + void (* __vlc_thread_ready_inner) ( vlc_object_t * ) ; + void (* aout_DestroyFifo_inner) ( aout_fifo_t *p_fifo ) ; + void (* config_Duplicate_inner) ( module_t *, module_config_t * ) ; void (* config_SetCallbacks_inner) ( module_config_t *, module_config_t * ) ; void (* config_UnsetCallbacks_inner) ( module_config_t * ) ; - void (* CurrentPTS_inner) ( bit_stream_t *, mtime_t *, mtime_t * ) ; - void (* DecoderError_inner) ( decoder_fifo_t * p_fifo ) ; - void (* InitBitstream_inner) ( bit_stream_t *, decoder_fifo_t *, void ( * )( bit_stream_t *, vlc_bool_t ), void * p_callback_arg ) ; void (* input_AccessEnd_inner) ( input_thread_t * ) ; void (* input_AccessReinit_inner) ( input_thread_t * ) ; void (* input_BuffersEnd_inner) ( input_thread_t *, input_buffers_t * ) ; @@ -87,46 +109,22 @@ struct module_symbols_t void (* input_DecodePES_inner) ( decoder_fifo_t *, pes_packet_t * ) ; void (* input_DelArea_inner) ( input_thread_t *, input_area_t * ) ; void (* input_DelES_inner) ( input_thread_t *, es_descriptor_t * ) ; - void (* input_DeletePacket_inner) ( input_buffers_t *, data_packet_t * ) ; - void (* input_DeletePES_inner) ( input_buffers_t *, pes_packet_t * ) ; void (* input_DelProgram_inner) ( input_thread_t *, pgrm_descriptor_t * ) ; + void (* input_DeletePES_inner) ( input_buffers_t *, pes_packet_t * ) ; + void (* input_DeletePacket_inner) ( input_buffers_t *, data_packet_t * ) ; void (* input_DemuxPS_inner) ( input_thread_t *, data_packet_t * ) ; void (* input_DemuxTS_inner) ( input_thread_t *, data_packet_t *, void(*) ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t ) ) ; void (* input_DumpStream_inner) ( input_thread_t * ) ; void (* input_EndStream_inner) ( input_thread_t * ) ; - void (* input_FDClose_inner) ( input_thread_t * ) ; - void (* input_FDNetworkClose_inner) ( input_thread_t * ) ; void (* input_FDSeek_inner) ( input_thread_t *, off_t ) ; void (* input_GatherPES_inner) ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t, vlc_bool_t ) ; void (* input_ParsePES_inner) ( input_thread_t *, es_descriptor_t * ) ; void (* input_ReleaseBuffer_inner) ( input_buffers_t *, data_buffer_t * ) ; - void (* __input_Seek_inner) ( vlc_object_t *, off_t, int ) ; - void (* __input_SetStatus_inner) ( vlc_object_t *, int ) ; - void (* __input_Tell_inner) ( vlc_object_t *, stream_position_t * ) ; void (* intf_Destroy_inner) ( intf_thread_t * ) ; void (* intf_StopThread_inner) ( intf_thread_t * ) ; - void (* module_Unneed_inner) ( module_t * ) ; - void (* __msg_Dbg_inner) ( void *, const char *, ... ) ; - void (* __msg_Err_inner) ( void *, const char *, ... ) ; - void (* __msg_Generic_inner) ( vlc_object_t *, int, const char *, const char *, ... ) ; - void (* __msg_Info_inner) ( void *, const char *, ... ) ; - void (* __msg_Unsubscribe_inner) ( vlc_object_t *, msg_subscription_t * ) ; - void (* __msg_Warn_inner) ( void *, const char *, ... ) ; void (* msleep_inner) ( mtime_t delay ) ; void (* mwait_inner) ( mtime_t date ) ; void (* playlist_Command_inner) ( playlist_t *, int, int ) ; - void (* UnalignedRemoveBits_inner) ( bit_stream_t * ) ; - void (* __vlc_dumpstructure_inner) ( vlc_object_t * ) ; - void (* __vlc_object_attach_inner) ( vlc_object_t *, vlc_object_t * ) ; - void * (* __vlc_object_create_inner) ( vlc_object_t *, int ) ; - void (* __vlc_object_destroy_inner) ( vlc_object_t * ) ; - void (* __vlc_object_detach_all_inner) ( vlc_object_t * ) ; - void (* __vlc_object_detach_inner) ( vlc_object_t *, vlc_object_t * ) ; - void * (* __vlc_object_find_inner) ( vlc_object_t *, int, int ) ; - void (* __vlc_object_release_inner) ( vlc_object_t * ) ; - void (* __vlc_object_yield_inner) ( vlc_object_t * ) ; - void (* __vlc_thread_join_inner) ( vlc_object_t *, char *, int ) ; - void (* __vlc_thread_ready_inner) ( vlc_object_t * ) ; void (* vout_AllocatePicture_inner) ( vout_thread_t *, picture_t *, int, int, u32 ) ; void (* vout_DatePicture_inner) ( vout_thread_t *, picture_t *, mtime_t ) ; void (* vout_DestroyPicture_inner) ( vout_thread_t *, picture_t * ) ; @@ -137,17 +135,26 @@ struct module_symbols_t void (* vout_LinkPicture_inner) ( vout_thread_t *, picture_t * ) ; void (* vout_PlacePicture_inner) ( vout_thread_t *, int, int, int *, int *, int *, int * ) ; void (* vout_UnlinkPicture_inner) ( vout_thread_t *, picture_t * ) ; + void * (* __vlc_object_create_inner) ( vlc_object_t *, int ) ; + void * (* __vlc_object_find_inner) ( vlc_object_t *, int, int ) ; vout_thread_t * (* __vout_CreateThread_inner) ( vlc_object_t *, int, int, u32, int ) ; }; #ifdef __PLUGIN__ -# define __aout_CreateFifo p_symbols->__aout_CreateFifo_inner -# define aout_DestroyFifo p_symbols->aout_DestroyFifo_inner # define BitstreamNextDataPacket p_symbols->BitstreamNextDataPacket_inner -# define config_Duplicate p_symbols->config_Duplicate_inner -# define config_FindConfig p_symbols->config_FindConfig_inner +# define CurrentPTS p_symbols->CurrentPTS_inner +# define DecodeLanguage p_symbols->DecodeLanguage_inner +# define DecoderError p_symbols->DecoderError_inner +# define GetLang_1 p_symbols->GetLang_1_inner +# define GetLang_2B p_symbols->GetLang_2B_inner +# define GetLang_2T p_symbols->GetLang_2T_inner +# define InitBitstream p_symbols->InitBitstream_inner +# define NextDataPacket p_symbols->NextDataPacket_inner +# define UnalignedGetBits p_symbols->UnalignedGetBits_inner +# define UnalignedRemoveBits p_symbols->UnalignedRemoveBits_inner +# define UnalignedShowBits p_symbols->UnalignedShowBits_inner +# define __aout_CreateFifo p_symbols->__aout_CreateFifo_inner # define __config_GetFloat p_symbols->__config_GetFloat_inner -# define config_GetHomeDir p_symbols->config_GetHomeDir_inner # define __config_GetInt p_symbols->__config_GetInt_inner # define __config_GetPsz p_symbols->__config_GetPsz_inner # define __config_LoadCmdLine p_symbols->__config_LoadCmdLine_inner @@ -156,15 +163,49 @@ struct module_symbols_t # define __config_PutInt p_symbols->__config_PutInt_inner # define __config_PutPsz p_symbols->__config_PutPsz_inner # define __config_SaveConfigFile p_symbols->__config_SaveConfigFile_inner +# define __input_FDClose p_symbols->__input_FDClose_inner +# define __input_FDNetworkClose p_symbols->__input_FDNetworkClose_inner +# define __input_Seek p_symbols->__input_Seek_inner +# define __input_SetStatus p_symbols->__input_SetStatus_inner +# define __input_Tell p_symbols->__input_Tell_inner +# define __intf_Create p_symbols->__intf_Create_inner +# define __intf_Eject p_symbols->__intf_Eject_inner +# define __module_Need p_symbols->__module_Need_inner +# define __module_Unneed p_symbols->__module_Unneed_inner +# define __msg_Dbg p_symbols->__msg_Dbg_inner +# define __msg_Err p_symbols->__msg_Err_inner +# define __msg_Generic p_symbols->__msg_Generic_inner +# define __msg_Info p_symbols->__msg_Info_inner +# define __msg_Subscribe p_symbols->__msg_Subscribe_inner +# define __msg_Unsubscribe p_symbols->__msg_Unsubscribe_inner +# define __msg_Warn p_symbols->__msg_Warn_inner +# define __network_ChannelCreate p_symbols->__network_ChannelCreate_inner +# define __network_ChannelJoin p_symbols->__network_ChannelJoin_inner +# define __vlc_cond_destroy p_symbols->__vlc_cond_destroy_inner +# define __vlc_cond_init p_symbols->__vlc_cond_init_inner +# define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner +# define __vlc_mutex_destroy p_symbols->__vlc_mutex_destroy_inner +# define __vlc_mutex_init p_symbols->__vlc_mutex_init_inner +# define __vlc_object_attach p_symbols->__vlc_object_attach_inner +# define __vlc_object_create p_symbols->__vlc_object_create_inner +# define __vlc_object_destroy p_symbols->__vlc_object_destroy_inner +# define __vlc_object_detach p_symbols->__vlc_object_detach_inner +# define __vlc_object_detach_all p_symbols->__vlc_object_detach_all_inner +# define __vlc_object_find p_symbols->__vlc_object_find_inner +# define __vlc_object_release p_symbols->__vlc_object_release_inner +# define __vlc_object_yield p_symbols->__vlc_object_yield_inner +# define __vlc_thread_create p_symbols->__vlc_thread_create_inner +# define __vlc_thread_join p_symbols->__vlc_thread_join_inner +# define __vlc_thread_ready p_symbols->__vlc_thread_ready_inner +# define __vlc_threads_end p_symbols->__vlc_threads_end_inner +# define __vlc_threads_init p_symbols->__vlc_threads_init_inner +# define __vout_CreateThread p_symbols->__vout_CreateThread_inner +# define aout_DestroyFifo p_symbols->aout_DestroyFifo_inner +# define config_Duplicate p_symbols->config_Duplicate_inner +# define config_FindConfig p_symbols->config_FindConfig_inner +# define config_GetHomeDir p_symbols->config_GetHomeDir_inner # define config_SetCallbacks p_symbols->config_SetCallbacks_inner # define config_UnsetCallbacks p_symbols->config_UnsetCallbacks_inner -# define CurrentPTS p_symbols->CurrentPTS_inner -# define DecodeLanguage p_symbols->DecodeLanguage_inner -# define DecoderError p_symbols->DecoderError_inner -# define GetLang_1 p_symbols->GetLang_1_inner -# define GetLang_2B p_symbols->GetLang_2B_inner -# define GetLang_2T p_symbols->GetLang_2T_inner -# define InitBitstream p_symbols->InitBitstream_inner # define input_AccessEnd p_symbols->input_AccessEnd_inner # define input_AccessInit p_symbols->input_AccessInit_inner # define input_AccessReinit p_symbols->input_AccessReinit_inner @@ -181,15 +222,13 @@ struct module_symbols_t # define input_DecodePES p_symbols->input_DecodePES_inner # define input_DelArea p_symbols->input_DelArea_inner # define input_DelES p_symbols->input_DelES_inner -# define input_DeletePacket p_symbols->input_DeletePacket_inner -# define input_DeletePES p_symbols->input_DeletePES_inner # define input_DelProgram p_symbols->input_DelProgram_inner +# define input_DeletePES p_symbols->input_DeletePES_inner +# define input_DeletePacket p_symbols->input_DeletePacket_inner # define input_DemuxPS p_symbols->input_DemuxPS_inner # define input_DemuxTS p_symbols->input_DemuxTS_inner # define input_DumpStream p_symbols->input_DumpStream_inner # define input_EndStream p_symbols->input_EndStream_inner -# define input_FDClose p_symbols->input_FDClose_inner -# define input_FDNetworkClose p_symbols->input_FDNetworkClose_inner # define input_FDNetworkRead p_symbols->input_FDNetworkRead_inner # define input_FDRead p_symbols->input_FDRead_inner # define input_FDSeek p_symbols->input_FDSeek_inner @@ -200,8 +239,8 @@ struct module_symbols_t # define input_InfoCategory p_symbols->input_InfoCategory_inner # define input_InitStream p_symbols->input_InitStream_inner # define input_NewBuffer p_symbols->input_NewBuffer_inner -# define input_NewPacket p_symbols->input_NewPacket_inner # define input_NewPES p_symbols->input_NewPES_inner +# define input_NewPacket p_symbols->input_NewPacket_inner # define input_OffsetToTime p_symbols->input_OffsetToTime_inner # define input_ParsePES p_symbols->input_ParsePES_inner # define input_ParsePS p_symbols->input_ParsePS_inner @@ -209,65 +248,26 @@ struct module_symbols_t # define input_ReadPS p_symbols->input_ReadPS_inner # define input_ReadTS p_symbols->input_ReadTS_inner # define input_ReleaseBuffer p_symbols->input_ReleaseBuffer_inner -# define __input_Seek p_symbols->__input_Seek_inner # define input_SelectES p_symbols->input_SelectES_inner # define input_SetProgram p_symbols->input_SetProgram_inner -# define __input_SetStatus p_symbols->__input_SetStatus_inner # define input_ShareBuffer p_symbols->input_ShareBuffer_inner # define input_SplitBuffer p_symbols->input_SplitBuffer_inner -# define __input_Tell p_symbols->__input_Tell_inner # define input_ToggleES p_symbols->input_ToggleES_inner # define input_UnselectES p_symbols->input_UnselectES_inner -# define __intf_Create p_symbols->__intf_Create_inner # define intf_Destroy p_symbols->intf_Destroy_inner -# define __intf_Eject p_symbols->__intf_Eject_inner # define intf_RunThread p_symbols->intf_RunThread_inner # define intf_StopThread p_symbols->intf_StopThread_inner # define mdate p_symbols->mdate_inner -# define __module_Need p_symbols->__module_Need_inner -# define module_Unneed p_symbols->module_Unneed_inner -# define __msg_Dbg p_symbols->__msg_Dbg_inner -# define __msg_Err p_symbols->__msg_Err_inner -# define __msg_Generic p_symbols->__msg_Generic_inner -# define __msg_Info p_symbols->__msg_Info_inner -# define __msg_Subscribe p_symbols->__msg_Subscribe_inner -# define __msg_Unsubscribe p_symbols->__msg_Unsubscribe_inner -# define __msg_Warn p_symbols->__msg_Warn_inner # define msleep p_symbols->msleep_inner # define mstrtime p_symbols->mstrtime_inner # define mwait p_symbols->mwait_inner -# define __network_ChannelCreate p_symbols->__network_ChannelCreate_inner -# define __network_ChannelJoin p_symbols->__network_ChannelJoin_inner -# define NextDataPacket p_symbols->NextDataPacket_inner # define playlist_Add p_symbols->playlist_Add_inner # define playlist_Command p_symbols->playlist_Command_inner # define playlist_Delete p_symbols->playlist_Delete_inner -# define UnalignedGetBits p_symbols->UnalignedGetBits_inner -# define UnalignedRemoveBits p_symbols->UnalignedRemoveBits_inner -# define UnalignedShowBits p_symbols->UnalignedShowBits_inner -# define __vlc_cond_destroy p_symbols->__vlc_cond_destroy_inner -# define __vlc_cond_init p_symbols->__vlc_cond_init_inner -# define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner -# define __vlc_mutex_destroy p_symbols->__vlc_mutex_destroy_inner -# define __vlc_mutex_init p_symbols->__vlc_mutex_init_inner -# define __vlc_object_attach p_symbols->__vlc_object_attach_inner -# define __vlc_object_create p_symbols->__vlc_object_create_inner -# define __vlc_object_destroy p_symbols->__vlc_object_destroy_inner -# define __vlc_object_detach_all p_symbols->__vlc_object_detach_all_inner -# define __vlc_object_detach p_symbols->__vlc_object_detach_inner -# define __vlc_object_find p_symbols->__vlc_object_find_inner -# define __vlc_object_release p_symbols->__vlc_object_release_inner -# define __vlc_object_yield p_symbols->__vlc_object_yield_inner -# define __vlc_thread_create p_symbols->__vlc_thread_create_inner -# define __vlc_thread_join p_symbols->__vlc_thread_join_inner -# define __vlc_thread_ready p_symbols->__vlc_thread_ready_inner -# define __vlc_threads_end p_symbols->__vlc_threads_end_inner -# define __vlc_threads_init p_symbols->__vlc_threads_init_inner # define vout_AllocatePicture p_symbols->vout_AllocatePicture_inner # define vout_ChromaCmp p_symbols->vout_ChromaCmp_inner # define vout_CreatePicture p_symbols->vout_CreatePicture_inner # define vout_CreateSubPicture p_symbols->vout_CreateSubPicture_inner -# define __vout_CreateThread p_symbols->__vout_CreateThread_inner # define vout_DatePicture p_symbols->vout_DatePicture_inner # define vout_DestroyPicture p_symbols->vout_DestroyPicture_inner # define vout_DestroySubPicture p_symbols->vout_DestroySubPicture_inner diff --git a/include/vlc_threads.h b/include/vlc_threads.h index 31f8733843..8a24b4a854 100644 --- a/include/vlc_threads.h +++ b/include/vlc_threads.h @@ -3,7 +3,7 @@ * This header provides a portable threads implementation. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vlc_threads.h,v 1.7 2002/07/30 07:56:40 gbazin Exp $ + * $Id: vlc_threads.h,v 1.8 2002/07/31 20:56:50 sam Exp $ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -191,19 +191,19 @@ VLC_EXPORT( void, __vlc_thread_join, ( vlc_object_t *, char *, int ) ); * vlc_threads_init: initialize threads system *****************************************************************************/ #define vlc_threads_init( P_THIS ) \ - __vlc_threads_init( CAST_TO_VLC_OBJECT(P_THIS) ) + __vlc_threads_init( VLC_OBJECT(P_THIS) ) /***************************************************************************** * vlc_threads_end: deinitialize threads system *****************************************************************************/ #define vlc_threads_end( P_THIS ) \ - __vlc_threads_end( CAST_TO_VLC_OBJECT(P_THIS) ) + __vlc_threads_end( VLC_OBJECT(P_THIS) ) /***************************************************************************** * vlc_mutex_init: initialize a mutex *****************************************************************************/ #define vlc_mutex_init( P_THIS, P_MUTEX ) \ - __vlc_mutex_init( CAST_TO_VLC_OBJECT(P_THIS), P_MUTEX ) + __vlc_mutex_init( VLC_OBJECT(P_THIS), P_MUTEX ) /***************************************************************************** * vlc_mutex_lock: lock a mutex @@ -344,7 +344,7 @@ static inline int __vlc_mutex_unlock( char * psz_file, int i_line, * vlc_cond_init: initialize a condition *****************************************************************************/ #define vlc_cond_init( P_THIS, P_COND ) \ - __vlc_cond_init( CAST_TO_VLC_OBJECT(P_THIS), P_COND ) + __vlc_cond_init( VLC_OBJECT(P_THIS), P_COND ) /***************************************************************************** * vlc_cond_signal: start a thread on condition completion @@ -731,21 +731,21 @@ static inline int __vlc_cond_wait( char * psz_file, int i_line, * vlc_thread_create: create a thread *****************************************************************************/ # define vlc_thread_create( P_THIS, PSZ_NAME, FUNC, WAIT ) \ - __vlc_thread_create( CAST_TO_VLC_OBJECT(P_THIS), __FILE__, __LINE__, PSZ_NAME, (void * ( * ) ( void * ))FUNC, WAIT ) + __vlc_thread_create( VLC_OBJECT(P_THIS), __FILE__, __LINE__, PSZ_NAME, (void * ( * ) ( void * ))FUNC, WAIT ) /***************************************************************************** * vlc_thread_ready: tell the parent thread we were successfully spawned *****************************************************************************/ # define vlc_thread_ready( P_THIS ) \ - __vlc_thread_ready( CAST_TO_VLC_OBJECT(P_THIS) ) + __vlc_thread_ready( VLC_OBJECT(P_THIS) ) /***************************************************************************** * vlc_thread_join: wait until a thread exits *****************************************************************************/ #ifdef DEBUG # define vlc_thread_join( P_THIS ) \ - __vlc_thread_join( CAST_TO_VLC_OBJECT(P_THIS), __FILE__, __LINE__ ) + __vlc_thread_join( VLC_OBJECT(P_THIS), __FILE__, __LINE__ ) #else # define vlc_thread_join( P_THIS ) \ - __vlc_thread_join( CAST_TO_VLC_OBJECT(P_THIS), "(unknown)", 0 ) + __vlc_thread_join( VLC_OBJECT(P_THIS), "(unknown)", 0 ) #endif diff --git a/plugins/a52/a52.c b/plugins/a52/a52.c index b08c430ddd..36eca49666 100644 --- a/plugins/a52/a52.c +++ b/plugins/a52/a52.c @@ -4,7 +4,7 @@ * (http://liba52.sf.net/). ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: a52.c,v 1.21 2002/07/23 00:39:16 sam Exp $ + * $Id: a52.c,v 1.22 2002/07/31 20:56:50 sam Exp $ * * Authors: Gildas Bazin * @@ -63,8 +63,8 @@ static vlc_bool_t b_liba52_initialized = 0; /***************************************************************************** * Local prototypes *****************************************************************************/ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); static int DecodeFrame ( a52_adec_thread_t * ); static int InitThread ( a52_adec_thread_t * ); static void EndThread ( a52_adec_thread_t * ); @@ -74,16 +74,7 @@ static void float2s16_2 ( float *, int16_t * ); static inline int16_t convert ( int32_t ); /***************************************************************************** - * Capabilities - *****************************************************************************/ -void _M( adec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} - -/***************************************************************************** - * Build configuration structure. + * Module descriptor *****************************************************************************/ #define DYNRNG_TEXT N_("A/52 dynamic range compression") #define DYNRNG_LONGTEXT N_( \ @@ -93,38 +84,37 @@ void _M( adec_getfunctions )( function_list_t * p_function_list ) "compression the playback will be more adapted to a movie theater or a " \ "listening room.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_BOOL ( "a52-dynrng", 1, NULL, DYNRNG_TEXT, DYNRNG_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("a52 ATSC A/52 aka AC-3 audio decoder module") ) - ADD_CAPABILITY( DECODER, 60 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( adec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_bool( "a52-dynrng", 1, NULL, DYNRNG_TEXT, DYNRNG_LONGTEXT ); + set_description( _("a52 ATSC A/52 aka AC-3 audio decoder module") ); + set_capability( "decoder", 60 ); + set_callbacks( OpenDecoder, NULL ); +vlc_module_end(); /***************************************************************************** - * decoder_Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able * to choose. *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) +static int OpenDecoder( vlc_object_t *p_this ) { - return *pi_type == VLC_FOURCC('a','5','2',' ') ? 0 : -1; + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + + if( p_fifo->i_fourcc != VLC_FOURCC('a','5','2',' ') ) + { + return VLC_EGENERIC; + } + + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; } /***************************************************************************** - * decoder_Run: this function is called just after the thread is created + * RunDecoder: this function is called just after the thread is created *****************************************************************************/ -static int decoder_Run ( decoder_fifo_t *p_fifo ) +static int RunDecoder( decoder_fifo_t *p_fifo ) { a52_adec_thread_t *p_a52_adec; diff --git a/plugins/a52_system/a52_system.c b/plugins/a52_system/a52_system.c index a0b18220d4..9cbe2ed07a 100644 --- a/plugins/a52_system/a52_system.c +++ b/plugins/a52_system/a52_system.c @@ -2,7 +2,7 @@ * a52_system.c : A52 input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: a52_system.c,v 1.2 2002/07/23 00:39:16 sam Exp $ + * $Id: a52_system.c,v 1.3 2002/07/31 20:56:50 sam Exp $ * * Authors: Arnaud de Bossoreille de Ribou * @@ -42,54 +42,25 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ); -static int Demux ( struct input_thread_s * ); -static int Init ( struct input_thread_s * ); -static void End ( struct input_thread_s * ); - - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("A52 input") ) - ADD_CAPABILITY( DEMUX, 150 ) - ADD_SHORTCUT( "a52sys" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->demux ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +static int Init ( vlc_object_t * ); +static int Demux ( input_thread_t * ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.demux - input.pf_init = Init; - input.pf_end = End; - input.pf_demux = Demux; - input.pf_rewind = NULL; -#undef input -} - -/* - * Data reading functions - */ +vlc_module_begin(); + set_description( "A52 demuxer" ); + set_capability( "demux", 150 ); + set_callbacks( Init, NULL ); + add_shortcut( "a52sys" ); +vlc_module_end(); /***************************************************************************** * Init: initializes ES structures *****************************************************************************/ -static int Init( input_thread_t * p_input ) +static int Init( vlc_object_t * p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; es_descriptor_t * p_es; byte_t * p_peek; @@ -100,6 +71,9 @@ static int Init( input_thread_t * p_input ) p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE; } + p_input->pf_demux = Demux; + p_input->pf_rewind = NULL; + /* Have a peep at the show. */ if( input_Peek( p_input, &p_peek, 2 ) < 2 ) { @@ -141,13 +115,6 @@ static int Init( input_thread_t * p_input ) return( 0 ); } -/***************************************************************************** - * End: frees unused data - *****************************************************************************/ -static void End( input_thread_t * p_input ) -{ -} - /***************************************************************************** * Demux: reads and demuxes data packets ***************************************************************************** diff --git a/plugins/aa/aa.c b/plugins/aa/aa.c index 79bcf77461..ec8d2a8cce 100644 --- a/plugins/aa/aa.c +++ b/plugins/aa/aa.c @@ -2,7 +2,7 @@ * vout_aa.c: Aa video output display method for testing purposes ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: aa.c,v 1.8 2002/07/23 00:39:16 sam Exp $ + * $Id: aa.c,v 1.9 2002/07/31 20:56:50 sam Exp $ * * Authors: Sigmund Augdal * @@ -35,31 +35,28 @@ #include /***************************************************************************** - * Capabilities defined in the other files. - *****************************************************************************/ -static void vout_getfunctions ( function_list_t * p_function_list ); - -/***************************************************************************** - * Build configuration tree. + * Local prototypes *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - - -MODULE_INIT_START - SET_DESCRIPTION( _("ASCII-art video output module") ) - ADD_CAPABILITY( VOUT, 10 ) - ADD_SHORTCUT( "aalib" ) -MODULE_INIT_STOP +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Render ( vout_thread_t *, picture_t * ); +static void Display ( vout_thread_t *, picture_t * ); -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - +static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * ); -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +/***************************************************************************** + * Module descriptor + *****************************************************************************/ +vlc_module_begin(); + set_description( _("ASCII-art video output module") ); + set_capability( "video output", 10 ); + add_shortcut( "aalib" ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: aa video output method descriptor @@ -76,40 +73,14 @@ struct vout_sys_t }; /***************************************************************************** - * Local prototypes - *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); - -static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates aa video thread output method + * Create: allocates aa video thread output method ***************************************************************************** * This function allocates and initializes a aa vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) @@ -127,6 +98,12 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = Render; + p_vout->pf_display = Display; + p_vout->p_sys->i_width = aa_imgwidth(p_vout->p_sys->aa_context); p_vout->p_sys->i_height = aa_imgheight(p_vout->p_sys->aa_context); aa_autoinitkbd( p_vout->p_sys->aa_context, 0 ); @@ -136,9 +113,9 @@ static int vout_Create( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize aa video thread output method + * Init: initialize aa video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic = NULL; @@ -185,31 +162,33 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate aa video thread output method + * End: terminate aa video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { ; } /***************************************************************************** - * vout_Destroy: destroy aa video thread output method + * Destroy: destroy aa video thread output method ***************************************************************************** * Terminate an output method created by AaCreateOutputMethod *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +static void Destroy( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + aa_close( p_vout->p_sys->aa_context ); free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle aa events + * Manage: handle aa events ***************************************************************************** * This function should be called regularly by video output thread. It manages * console events. It returns a non null value on error. *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) +static int Manage( vout_thread_t *p_vout ) { int event, x, y, b; event = aa_getevent( p_vout->p_sys->aa_context, 0 ); @@ -241,9 +220,9 @@ static int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Render: render previously calculated output + * Render: render previously calculated output *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) +static void Render( vout_thread_t *p_vout, picture_t *p_pic ) { aa_fastrender( p_vout->p_sys->aa_context, 0, 0, aa_imgwidth( p_vout->p_sys->aa_context ), @@ -251,9 +230,9 @@ static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) } /***************************************************************************** - * vout_Display: displays previously rendered output + * Display: displays previously rendered output *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void Display( vout_thread_t *p_vout, picture_t *p_pic ) { /* No need to do anything, the fake direct buffers stay as they are */ int i_width, i_height, i_x, i_y; diff --git a/plugins/ac3_adec/ac3_adec.c b/plugins/ac3_adec/ac3_adec.c index 8f403fc6bc..81417c6a66 100644 --- a/plugins/ac3_adec/ac3_adec.c +++ b/plugins/ac3_adec/ac3_adec.c @@ -2,7 +2,7 @@ * ac3_adec.c: ac3 decoder module main file ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ac3_adec.c,v 1.34 2002/07/23 00:39:16 sam Exp $ + * $Id: ac3_adec.c,v 1.35 2002/07/31 20:56:50 sam Exp $ * * Authors: Michel Lespinasse * @@ -44,67 +44,51 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); static int InitThread ( ac3dec_t * p_adec ); static void EndThread ( ac3dec_t * p_adec ); static void BitstreamCallback ( bit_stream_t *p_bit_stream, vlc_bool_t b_new_pes ); /***************************************************************************** - * Capabilities + * Module descriptor *****************************************************************************/ -void _M( adec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_module ( "ac3-downmix", "downmix", NULL, NULL, + N_("AC3 downmix module"), NULL ); + add_module ( "ac3-imdct", "imdct", NULL, NULL, + N_("AC3 IMDCT module"), NULL ); + set_description( _("software AC3 decoder") ); + set_capability( "decoder", 50 ); + set_callbacks( OpenDecoder, NULL ); + add_shortcut( "ac3" ); +vlc_module_end(); /***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -/* Variable containing the AC3 downmix method */ -#define DOWNMIX_METHOD_VAR "ac3-downmix" -/* Variable containing the AC3 IMDCT method */ -#define IMDCT_METHOD_VAR "ac3-imdct" - -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL) -ADD_MODULE ( DOWNMIX_METHOD_VAR, MODULE_CAPABILITY_DOWNMIX, NULL, NULL, - N_("AC3 downmix module"), NULL ) -ADD_MODULE ( IMDCT_METHOD_VAR, MODULE_CAPABILITY_IMDCT, NULL, NULL, - N_("AC3 IMDCT module"), NULL ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("software AC3 decoder") ) - ADD_CAPABILITY( DECODER, 50 ) - ADD_SHORTCUT( "ac3" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( adec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - - -/***************************************************************************** - * decoder_Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able * to chose. *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) +static int OpenDecoder( vlc_object_t *p_this ) { - return *pi_type == VLC_FOURCC('a','5','2',' ') ? 0 : -1; + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + + if( p_fifo->i_fourcc != VLC_FOURCC('a','5','2',' ') ) + { + return VLC_EGENERIC; + } + + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; } /***************************************************************************** - * decoder_Run: this function is called just after the thread is created + * RunDecoder: this function is called just after the thread is created *****************************************************************************/ -static int decoder_Run ( decoder_fifo_t * p_fifo ) +static int RunDecoder( decoder_fifo_t *p_fifo ) { ac3dec_t * p_ac3dec; void * p_orig; /* pointer before memalign */ @@ -246,57 +230,43 @@ static int InitThread( ac3dec_t * p_ac3dec ) /* * Choose the best downmix module */ -#define DOWNMIX p_ac3dec->downmix - psz_name = config_GetPsz( p_ac3dec->p_fifo, DOWNMIX_METHOD_VAR ); - DOWNMIX.p_module = module_Need( p_ac3dec->p_fifo, - MODULE_CAPABILITY_DOWNMIX, psz_name, NULL ); + p_ac3dec->p_downmix = vlc_object_create( p_ac3dec->p_fifo, + sizeof( downmix_t ) ); + p_ac3dec->p_downmix->psz_object_name = "downmix"; + + psz_name = config_GetPsz( p_ac3dec->p_downmix, "ac3-downmix" ); + p_ac3dec->p_downmix->p_module = + module_Need( p_ac3dec->p_downmix, "downmix", psz_name ); if( psz_name ) free( psz_name ); - if( DOWNMIX.p_module == NULL ) + if( p_ac3dec->p_downmix->p_module == NULL ) { msg_Err( p_ac3dec->p_fifo, "no suitable downmix module" ); + vlc_object_destroy( p_ac3dec->p_downmix ); return( -1 ); } -#define F DOWNMIX.p_module->p_functions->downmix.functions.downmix - DOWNMIX.pf_downmix_3f_2r_to_2ch = F.pf_downmix_3f_2r_to_2ch; - DOWNMIX.pf_downmix_2f_2r_to_2ch = F.pf_downmix_2f_2r_to_2ch; - DOWNMIX.pf_downmix_3f_1r_to_2ch = F.pf_downmix_3f_1r_to_2ch; - DOWNMIX.pf_downmix_2f_1r_to_2ch = F.pf_downmix_2f_1r_to_2ch; - DOWNMIX.pf_downmix_3f_0r_to_2ch = F.pf_downmix_3f_0r_to_2ch; - DOWNMIX.pf_stream_sample_2ch_to_s16 = F.pf_stream_sample_2ch_to_s16; - DOWNMIX.pf_stream_sample_1ch_to_s16 = F.pf_stream_sample_1ch_to_s16; -#undef F -#undef DOWNMIX - /* * Choose the best IMDCT module */ - p_ac3dec->imdct = vlc_memalign( &p_ac3dec->imdct_orig, - 16, sizeof(imdct_t) ); + p_ac3dec->p_imdct = vlc_object_create( p_ac3dec->p_fifo, + sizeof( imdct_t ) ); -#define IMDCT p_ac3dec->imdct - psz_name = config_GetPsz( p_ac3dec->p_fifo, IMDCT_METHOD_VAR ); - IMDCT->p_module = module_Need( p_ac3dec->p_fifo, - MODULE_CAPABILITY_IMDCT, psz_name, NULL ); +#define IMDCT p_ac3dec->p_imdct + psz_name = config_GetPsz( p_ac3dec->p_fifo, "ac3-imdct" ); + p_ac3dec->p_imdct->p_module = + module_Need( p_ac3dec->p_imdct, "imdct", psz_name ); if( psz_name ) free( psz_name ); - if( IMDCT->p_module == NULL ) + if( p_ac3dec->p_imdct->p_module == NULL ) { msg_Err( p_ac3dec->p_fifo, "no suitable IMDCT module" ); - module_Unneed( p_ac3dec->downmix.p_module ); - free( p_ac3dec->imdct_orig ); + vlc_object_destroy( p_ac3dec->p_imdct ); + module_Unneed( p_ac3dec->p_downmix, p_ac3dec->p_downmix->p_module ); + vlc_object_destroy( p_ac3dec->p_downmix ); return( -1 ); } -#define F IMDCT->p_module->p_functions->imdct.functions.imdct - IMDCT->pf_imdct_init = F.pf_imdct_init; - IMDCT->pf_imdct_256 = F.pf_imdct_256; - IMDCT->pf_imdct_256_nol = F.pf_imdct_256_nol; - IMDCT->pf_imdct_512 = F.pf_imdct_512; - IMDCT->pf_imdct_512_nol = F.pf_imdct_512_nol; -#undef F - /* Initialize the ac3 decoder structures */ p_ac3dec->samples = vlc_memalign( &p_ac3dec->samples_orig, 16, 6 * 256 * sizeof(float) ); @@ -333,7 +303,7 @@ static int InitThread( ac3dec_t * p_ac3dec ) 16, 64 * sizeof(complex_t) ); #undef IMDCT - _M( ac3_init )( p_ac3dec ); + E_( ac3_init )( p_ac3dec ); /* * Initialize the output properties @@ -366,7 +336,7 @@ static void EndThread (ac3dec_t * p_ac3dec) } /* Free allocated structures */ -#define IMDCT p_ac3dec->imdct +#define IMDCT p_ac3dec->p_imdct free( IMDCT->w_1_orig ); free( IMDCT->w_64_orig ); free( IMDCT->w_32_orig ); @@ -387,8 +357,11 @@ static void EndThread (ac3dec_t * p_ac3dec) free( p_ac3dec->samples_orig ); /* Unlock the modules */ - module_Unneed( p_ac3dec->downmix.p_module ); - module_Unneed( p_ac3dec->imdct->p_module ); + module_Unneed( p_ac3dec->p_downmix, p_ac3dec->p_downmix->p_module ); + vlc_object_destroy( p_ac3dec->p_downmix ); + + module_Unneed( p_ac3dec->p_imdct, p_ac3dec->p_imdct->p_module ); + vlc_object_destroy( p_ac3dec->p_imdct ); /* Free what's left of the decoder */ free( p_ac3dec->imdct_orig ); diff --git a/plugins/ac3_adec/ac3_adec.h b/plugins/ac3_adec/ac3_adec.h index 9bdbfab822..4b13fc45e3 100644 --- a/plugins/ac3_adec/ac3_adec.h +++ b/plugins/ac3_adec/ac3_adec.h @@ -2,7 +2,7 @@ * ac3_adec.h : ac3 decoder interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_adec.h,v 1.4 2002/06/01 12:31:58 sam Exp $ + * $Id: ac3_adec.h,v 1.5 2002/07/31 20:56:50 sam Exp $ * * Authors: Michel Kaempf * Renaud Dartus @@ -40,7 +40,7 @@ typedef struct ac3_sync_info_s { /**** ac3 decoder API - functions publically provided by the ac3 decoder ****/ -int _M( ac3_init )(ac3dec_t * p_ac3dec); +int E_( ac3_init )(ac3dec_t * p_ac3dec); int ac3_sync_frame (ac3dec_t * p_ac3dec, ac3_sync_info_t * p_sync_info); int ac3_decode_frame (ac3dec_t * p_ac3dec, s16 * buffer); @@ -394,7 +394,7 @@ struct ac3dec_s bit_allocate_t bit_allocate; mantissa_t mantissa; - downmix_t downmix; + downmix_t * p_downmix; /* * Output properties @@ -403,7 +403,7 @@ struct ac3dec_s float * samples; void * samples_orig; /* pointer before memalign */ - imdct_t * imdct; + imdct_t * p_imdct; void * imdct_orig; /* pointer before memalign */ }; diff --git a/plugins/ac3_adec/ac3_decoder.c b/plugins/ac3_adec/ac3_decoder.c index 38f0ddfb3b..58c69d07b2 100644 --- a/plugins/ac3_adec/ac3_decoder.c +++ b/plugins/ac3_adec/ac3_decoder.c @@ -2,7 +2,7 @@ * ac3_decoder.c: core ac3 decoder ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ac3_decoder.c,v 1.8 2002/06/01 12:31:58 sam Exp $ + * $Id: ac3_decoder.c,v 1.9 2002/07/31 20:56:50 sam Exp $ * * Authors: Michel Kaempf * Michel Lespinasse @@ -40,10 +40,10 @@ static const float cmixlev_lut[4] = { 0.707, 0.595, 0.500, 0.707 }; static const float smixlev_lut[4] = { 0.707, 0.500, 0.0 , 0.500 }; -int _M( ac3_init )(ac3dec_t * p_ac3dec) +int E_( ac3_init )(ac3dec_t * p_ac3dec) { p_ac3dec->mantissa.lfsr_state = 1; /* dither_gen initialization */ - _M( imdct_init )(p_ac3dec->imdct) ; + E_( imdct_init )(p_ac3dec->p_imdct) ; return 0; } diff --git a/plugins/ac3_adec/ac3_decoder.h b/plugins/ac3_adec/ac3_decoder.h index a21ab06e82..bfa1e50e7c 100644 --- a/plugins/ac3_adec/ac3_decoder.h +++ b/plugins/ac3_adec/ac3_decoder.h @@ -2,7 +2,7 @@ * ac3_decoder.h : ac3 decoder interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_decoder.h,v 1.4 2002/04/23 23:44:36 fenrir Exp $ + * $Id: ac3_decoder.h,v 1.5 2002/07/31 20:56:50 sam Exp $ * * Authors: Michel Kaempf * Renaud Dartus @@ -35,7 +35,7 @@ typedef struct ac3_sync_info_s { /**** ac3 decoder API - functions publically provided by the ac3 decoder ****/ -int _M( ac3_init )(ac3dec_t * p_ac3dec); +int E_( ac3_init )(ac3dec_t * p_ac3dec); int ac3_sync_frame (ac3dec_t * p_ac3dec, ac3_sync_info_t * p_sync_info); int ac3_decode_frame (ac3dec_t * p_ac3dec, s16 * buffer); diff --git a/plugins/ac3_adec/ac3_imdct.c b/plugins/ac3_adec/ac3_imdct.c index 72af766ff5..be486c7c5c 100644 --- a/plugins/ac3_adec/ac3_imdct.c +++ b/plugins/ac3_adec/ac3_imdct.c @@ -2,7 +2,7 @@ * ac3_imdct.c: ac3 DCT ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ac3_imdct.c,v 1.9 2002/06/01 12:31:58 sam Exp $ + * $Id: ac3_imdct.c,v 1.10 2002/07/31 20:56:50 sam Exp $ * * Authors: Michel Kaempf * Aaron Holtzman @@ -42,7 +42,7 @@ # define M_PI 3.14159265358979323846 #endif -void _M( imdct_init )(imdct_t * p_imdct) +void E_( imdct_init )(imdct_t * p_imdct) { int i; float scale = 181.019; @@ -69,11 +69,11 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) /* test if dm in frequency is doable */ if (!(doable = p_ac3dec->audblk.blksw[0])) { - do_imdct = p_ac3dec->imdct->pf_imdct_512; + do_imdct = p_ac3dec->p_imdct->pf_imdct_512; } else { - do_imdct = p_ac3dec->imdct->pf_imdct_256; + do_imdct = p_ac3dec->p_imdct->pf_imdct_256; } /* downmix in the frequency domain if all the channels @@ -93,19 +93,19 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) switch(p_ac3dec->bsi.acmod) { case 7: /* 3/2 */ - p_ac3dec->downmix.pf_downmix_3f_2r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); + p_ac3dec->p_downmix->pf_downmix_3f_2r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); break; case 6: /* 2/2 */ - p_ac3dec->downmix.pf_downmix_2f_2r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); + p_ac3dec->p_downmix->pf_downmix_2f_2r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); break; case 5: /* 3/1 */ - p_ac3dec->downmix.pf_downmix_3f_1r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); + p_ac3dec->p_downmix->pf_downmix_3f_1r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); break; case 4: /* 2/1 */ - p_ac3dec->downmix.pf_downmix_2f_1r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); + p_ac3dec->p_downmix->pf_downmix_2f_1r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); break; case 3: /* 3/0 */ - p_ac3dec->downmix.pf_downmix_3f_0r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); + p_ac3dec->p_downmix->pf_downmix_3f_0r_to_2ch (p_ac3dec->samples, &p_ac3dec->dm_par); break; case 2: break; @@ -114,17 +114,17 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) center = p_ac3dec->samples; // else if (p_ac3dec->bsi.acmod == 0) // center = samples[ac3_config.dual_mono_ch_sel]; - do_imdct(p_ac3dec->imdct, center, p_ac3dec->imdct->delay); /* no downmix*/ + do_imdct(p_ac3dec->p_imdct, center, p_ac3dec->p_imdct->delay); /* no downmix*/ - p_ac3dec->downmix.pf_stream_sample_1ch_to_s16 (buffer, center); + p_ac3dec->p_downmix->pf_stream_sample_1ch_to_s16 (buffer, center); return; break; } - do_imdct (p_ac3dec->imdct, p_ac3dec->samples, p_ac3dec->imdct->delay); - do_imdct (p_ac3dec->imdct, p_ac3dec->samples+256, p_ac3dec->imdct->delay+256); - p_ac3dec->downmix.pf_stream_sample_2ch_to_s16(buffer, p_ac3dec->samples, p_ac3dec->samples+256); + do_imdct (p_ac3dec->p_imdct, p_ac3dec->samples, p_ac3dec->p_imdct->delay); + do_imdct (p_ac3dec->p_imdct, p_ac3dec->samples+256, p_ac3dec->p_imdct->delay+256); + p_ac3dec->p_downmix->pf_stream_sample_2ch_to_s16(buffer, p_ac3dec->samples, p_ac3dec->samples+256); } else { /* imdct and then downmix @@ -135,13 +135,13 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) if (p_ac3dec->audblk.blksw[i]) { /* There is only a C function */ - p_ac3dec->imdct->pf_imdct_256_nol( p_ac3dec->imdct, - p_ac3dec->samples+256*i, p_ac3dec->imdct->delay1+256*i ); + p_ac3dec->p_imdct->pf_imdct_256_nol( p_ac3dec->p_imdct, + p_ac3dec->samples+256*i, p_ac3dec->p_imdct->delay1+256*i ); } else { - p_ac3dec->imdct->pf_imdct_512_nol( p_ac3dec->imdct, - p_ac3dec->samples+256*i, p_ac3dec->imdct->delay1+256*i ); + p_ac3dec->p_imdct->pf_imdct_512_nol( p_ac3dec->p_imdct, + p_ac3dec->samples+256*i, p_ac3dec->p_imdct->delay1+256*i ); } } @@ -154,13 +154,13 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) right = p_ac3dec->samples+2*256; left_sur = p_ac3dec->samples+3*256; right_sur = p_ac3dec->samples+4*256; - delay_left = p_ac3dec->imdct->delay; - delay_right = p_ac3dec->imdct->delay+256; - delay1_left = p_ac3dec->imdct->delay1; - delay1_center = p_ac3dec->imdct->delay1+256; - delay1_right = p_ac3dec->imdct->delay1+2*256; - delay1_sl = p_ac3dec->imdct->delay1+3*256; - delay1_sr = p_ac3dec->imdct->delay1+4*256; + delay_left = p_ac3dec->p_imdct->delay; + delay_right = p_ac3dec->p_imdct->delay+256; + delay1_left = p_ac3dec->p_imdct->delay1; + delay1_center = p_ac3dec->p_imdct->delay1+256; + delay1_right = p_ac3dec->p_imdct->delay1+2*256; + delay1_sl = p_ac3dec->p_imdct->delay1+3*256; + delay1_sr = p_ac3dec->p_imdct->delay1+4*256; for (i = 0; i < 256; i++) { left_tmp = p_ac3dec->dm_par.unit * *left++ + p_ac3dec->dm_par.clev * *center + p_ac3dec->dm_par.slev * *left_sur++; @@ -176,12 +176,12 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) right = p_ac3dec->samples+256; left_sur = p_ac3dec->samples+2*256; right_sur = p_ac3dec->samples+3*256; - delay_left = p_ac3dec->imdct->delay; - delay_right = p_ac3dec->imdct->delay+256; - delay1_left = p_ac3dec->imdct->delay1; - delay1_right = p_ac3dec->imdct->delay1+256; - delay1_sl = p_ac3dec->imdct->delay1+2*256; - delay1_sr = p_ac3dec->imdct->delay1+3*256; + delay_left = p_ac3dec->p_imdct->delay; + delay_right = p_ac3dec->p_imdct->delay+256; + delay1_left = p_ac3dec->p_imdct->delay1; + delay1_right = p_ac3dec->p_imdct->delay1+256; + delay1_sl = p_ac3dec->p_imdct->delay1+2*256; + delay1_sr = p_ac3dec->p_imdct->delay1+3*256; for (i = 0; i < 256; i++) { left_tmp = p_ac3dec->dm_par.unit * *left++ + p_ac3dec->dm_par.slev * *left_sur++; @@ -197,12 +197,12 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) center = p_ac3dec->samples+256; right = p_ac3dec->samples+2*256; right_sur = p_ac3dec->samples+3*256; - delay_left = p_ac3dec->imdct->delay; - delay_right = p_ac3dec->imdct->delay+256; - delay1_left = p_ac3dec->imdct->delay1; - delay1_center = p_ac3dec->imdct->delay1+256; - delay1_right = p_ac3dec->imdct->delay1+2*256; - delay1_sl = p_ac3dec->imdct->delay1+3*256; + delay_left = p_ac3dec->p_imdct->delay; + delay_right = p_ac3dec->p_imdct->delay+256; + delay1_left = p_ac3dec->p_imdct->delay1; + delay1_center = p_ac3dec->p_imdct->delay1+256; + delay1_right = p_ac3dec->p_imdct->delay1+2*256; + delay1_sl = p_ac3dec->p_imdct->delay1+3*256; for (i = 0; i < 256; i++) { left_tmp = p_ac3dec->dm_par.unit * *left++ + p_ac3dec->dm_par.clev * *center - p_ac3dec->dm_par.slev * *right_sur; @@ -217,11 +217,11 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) left = p_ac3dec->samples; right = p_ac3dec->samples+256; right_sur = p_ac3dec->samples+2*256; - delay_left = p_ac3dec->imdct->delay; - delay_right = p_ac3dec->imdct->delay+256; - delay1_left = p_ac3dec->imdct->delay1; - delay1_right = p_ac3dec->imdct->delay1+256; - delay1_sl = p_ac3dec->imdct->delay1+2*256; + delay_left = p_ac3dec->p_imdct->delay; + delay_right = p_ac3dec->p_imdct->delay+256; + delay1_left = p_ac3dec->p_imdct->delay1; + delay1_right = p_ac3dec->p_imdct->delay1+256; + delay1_sl = p_ac3dec->p_imdct->delay1+2*256; for (i = 0; i < 256; i++) { left_tmp = p_ac3dec->dm_par.unit * *left++ - p_ac3dec->dm_par.slev * *right_sur; @@ -236,11 +236,11 @@ void imdct (ac3dec_t * p_ac3dec, s16 * buffer) left = p_ac3dec->samples; center = p_ac3dec->samples+256; right = p_ac3dec->samples+2*256; - delay_left = p_ac3dec->imdct->delay; - delay_right = p_ac3dec->imdct->delay+256; - delay1_left = p_ac3dec->imdct->delay1; - delay1_center = p_ac3dec->imdct->delay1+256; - delay1_right = p_ac3dec->imdct->delay1+2*256; + delay_left = p_ac3dec->p_imdct->delay; + delay_right = p_ac3dec->p_imdct->delay+256; + delay1_left = p_ac3dec->p_imdct->delay1; + delay1_center = p_ac3dec->p_imdct->delay1+256; + delay1_right = p_ac3dec->p_imdct->delay1+2*256; for (i = 0; i < 256; i++) { left_tmp = p_ac3dec->dm_par.unit * *left++ + p_ac3dec->dm_par.clev * *center; diff --git a/plugins/ac3_adec/ac3_internal.h b/plugins/ac3_adec/ac3_internal.h index e6923ec24b..163d770f1d 100644 --- a/plugins/ac3_adec/ac3_internal.h +++ b/plugins/ac3_adec/ac3_internal.h @@ -2,7 +2,7 @@ * ac3_internals.h: needed by the ac3 decoder ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: ac3_internal.h,v 1.2 2002/04/23 23:44:36 fenrir Exp $ + * $Id: ac3_internal.h,v 1.3 2002/07/31 20:56:50 sam Exp $ * * Authors: Michel Lespinasse * @@ -40,7 +40,7 @@ void bit_allocate (ac3dec_t *); int exponent_unpack (ac3dec_t *); /* ac3_imdct.c */ -void _M( imdct_init )(imdct_t * p_imdct); +void E_( imdct_init )(imdct_t * p_imdct); void imdct (ac3dec_t * p_ac3dec, s16 * buffer); /* ac3_mantissa.c */ diff --git a/plugins/ac3_spdif/ac3_spdif.c b/plugins/ac3_spdif/ac3_spdif.c index 79791b562c..58ba79656d 100644 --- a/plugins/ac3_spdif/ac3_spdif.c +++ b/plugins/ac3_spdif/ac3_spdif.c @@ -2,7 +2,7 @@ * ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: ac3_spdif.c,v 1.31 2002/07/23 00:39:16 sam Exp $ + * $Id: ac3_spdif.c,v 1.32 2002/07/31 20:56:50 sam Exp $ * * Authors: Stéphane Borel * Juha Yrjola @@ -42,10 +42,11 @@ #include "ac3_spdif.h" /**************************************************************************** - * Local Prototypes + * Local prototypes ****************************************************************************/ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); + static int InitThread ( ac3_spdif_thread_t * ); static void EndThread ( ac3_spdif_thread_t * ); static void BitstreamCallback ( bit_stream_t *, vlc_bool_t ); @@ -98,52 +99,41 @@ static const frame_size_t p_frame_size_code[64] = }; /***************************************************************************** - * Capabilities + * Module descriptor *****************************************************************************/ -void _M( adec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("SPDIF pass-through AC3 decoder") ) - ADD_CAPABILITY( DECODER, 0 ) - ADD_SHORTCUT( "pass_through" ) - ADD_SHORTCUT( "pass" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( adec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("SPDIF pass-through AC3 decoder") ); + set_capability( "decoder", 0 ); + set_callbacks( OpenDecoder, NULL ); + add_shortcut( "pass_through" ); + add_shortcut( "pass" ); +vlc_module_end(); /***************************************************************************** - * decoder_Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able * to chose. *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) -{ - return( *pi_type == VLC_FOURCC('a','5','2',' ') ) ? 0 : -1; -} +static int OpenDecoder( vlc_object_t *p_this ) +{ + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + if( p_fifo->i_fourcc != VLC_FOURCC('a','5','2',' ') ) + { + return VLC_EGENERIC; + } + + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; +} /**************************************************************************** - * decoder_Run: the whole thing + * RunDecoder: the whole thing **************************************************************************** * This function is called just after the thread is launched. ****************************************************************************/ -static int decoder_Run( decoder_fifo_t * p_fifo ) +static int RunDecoder( decoder_fifo_t *p_fifo ) { ac3_spdif_thread_t * p_spdif; mtime_t i_frame_time; diff --git a/plugins/access/file.c b/plugins/access/file.c index 9f6a32c128..f09b09f907 100644 --- a/plugins/access/file.c +++ b/plugins/access/file.c @@ -2,7 +2,7 @@ * file.c: file input (file: access plug-in) ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: file.c,v 1.7 2002/06/01 12:31:58 sam Exp $ + * $Id: file.c,v 1.8 2002/07/31 20:56:50 sam Exp $ * * Authors: Christophe Massiot * @@ -41,51 +41,11 @@ #endif /***************************************************************************** - * Local prototypes + * Open: open the file *****************************************************************************/ -static void input_getfunctions( function_list_t * ); -static int FileOpen ( input_thread_t * ); - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Standard filesystem file reading") ) - ADD_CAPABILITY( ACCESS, 50 ) - ADD_SHORTCUT( "stream" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->access ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.access - input.pf_open = FileOpen; - input.pf_read = input_FDRead; - input.pf_close = input_FDClose; - input.pf_set_program = input_SetProgram; - input.pf_set_area = NULL; - input.pf_seek = input_FDSeek; -#undef input -} - -/***************************************************************************** - * FileOpen: open the file - *****************************************************************************/ -static int FileOpen( input_thread_t * p_input ) +static int Open( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; char * psz_name = p_input->psz_name; int i_stat; struct stat stat_info; @@ -103,6 +63,11 @@ static int FileOpen( input_thread_t * p_input ) return( -1 ); } + p_input->pf_read = input_FDRead; + p_input->pf_set_program = input_SetProgram; + p_input->pf_set_area = NULL; + p_input->pf_seek = input_FDSeek; + vlc_mutex_lock( &p_input->stream.stream_lock ); if( *p_input->psz_access && !strncmp( p_input->psz_access, "stream", 7 ) ) @@ -173,3 +138,14 @@ static int FileOpen( input_thread_t * p_input ) return( 0 ); } + +/***************************************************************************** + * Module descriptor + *****************************************************************************/ +vlc_module_begin(); + set_description( _("Standard filesystem file reading") ); + set_capability( "access", 50 ); + add_shortcut( "stream" ); + set_callbacks( Open, __input_FDClose ); +vlc_module_end(); + diff --git a/plugins/access/http.c b/plugins/access/http.c index 22be5381f6..4fcce9b6d0 100644 --- a/plugins/access/http.c +++ b/plugins/access/http.c @@ -2,7 +2,7 @@ * http.c: HTTP access plug-in ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: http.c,v 1.18 2002/07/25 21:53:53 sigmunau Exp $ + * $Id: http.c,v 1.19 2002/07/31 20:56:50 sam Exp $ * * Authors: Christophe Massiot * @@ -55,47 +55,22 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void input_getfunctions( function_list_t * ); -static int HTTPOpen ( input_thread_t * ); -static void HTTPClose ( input_thread_t * ); -static int HTTPSetProgram ( input_thread_t *, pgrm_descriptor_t * ); -static void HTTPSeek ( input_thread_t *, off_t ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("HTTP access plug-in") ) - ADD_CAPABILITY( ACCESS, 0 ) - ADD_SHORTCUT( "http4" ) - ADD_SHORTCUT( "http6" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->access ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +static int SetProgram ( input_thread_t *, pgrm_descriptor_t * ); +static void Seek ( input_thread_t *, off_t ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.access - input.pf_open = HTTPOpen; - input.pf_read = input_FDNetworkRead; - input.pf_close = HTTPClose; - input.pf_set_program = HTTPSetProgram; - input.pf_set_area = NULL; - input.pf_seek = HTTPSeek; -#undef input -} +vlc_module_begin(); + set_description( _("HTTP access module") ); + set_capability( "access", 0 ); + add_shortcut( "http4" ); + add_shortcut( "http6" ); + set_callbacks( Open, Close ); +vlc_module_end(); /***************************************************************************** * _input_socket_t: private access plug-in data, modified to add private @@ -124,14 +99,13 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell ) char * psz_return_alpha; /* Find an appropriate network module */ - p_network = module_Need( p_input, MODULE_CAPABILITY_NETWORK, - p_access_data->psz_network, - &p_access_data->socket_desc ); + p_input->p_private = (void*) &p_access_data->socket_desc; + p_network = module_Need( p_input, "network", p_access_data->psz_network ); if( p_network == NULL ) { return( -1 ); } - module_Unneed( p_network ); + module_Unneed( p_input, p_network ); p_access_data->_socket.i_handle = p_access_data->socket_desc.i_handle; @@ -166,7 +140,9 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell ) /* Prepare the input thread for reading. */ p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE; - /* FIXME: we shouldn't have to do that ! */ + + /* FIXME: we shouldn't have to do that ! It's UGLY but mandatory because + * input_FillBuffer assumes p_input->pf_read exists */ p_input->pf_read = input_FDNetworkRead; while( !input_FillBuffer( p_input ) ) @@ -270,10 +246,11 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell ) } /***************************************************************************** - * HTTPOpen: parse URL and open the remote file at the beginning + * Open: parse URL and open the remote file at the beginning *****************************************************************************/ -static int HTTPOpen( input_thread_t * p_input ) +static int Open( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; _input_socket_t * p_access_data; char * psz_name = strdup(p_input->psz_name); char * psz_parser = psz_name; @@ -459,6 +436,11 @@ static int HTTPOpen( input_thread_t * p_input ) msg_Dbg( p_input, "opening server=%s port=%d path=%s", psz_server_addr, i_server_port, psz_path ); + p_input->pf_read = input_FDNetworkRead; + p_input->pf_set_program = SetProgram; + p_input->pf_set_area = NULL; + p_input->pf_seek = Seek; + vlc_mutex_lock( &p_input->stream.stream_lock ); p_input->stream.b_pace_control = 1; p_input->stream.b_seekable = 1; @@ -484,10 +466,11 @@ static int HTTPOpen( input_thread_t * p_input ) } /***************************************************************************** - * HTTPClose: free unused data structures + * Close: free unused data structures *****************************************************************************/ -static void HTTPClose( input_thread_t * p_input ) +static void Close( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; _input_socket_t * p_access_data = (_input_socket_t *)p_input->p_access_data; @@ -496,18 +479,18 @@ static void HTTPClose( input_thread_t * p_input ) } /***************************************************************************** - * HTTPSetProgram: do nothing + * SetProgram: do nothing *****************************************************************************/ -static int HTTPSetProgram( input_thread_t * p_input, - pgrm_descriptor_t * p_program ) +static int SetProgram( input_thread_t * p_input, + pgrm_descriptor_t * p_program ) { return( 0 ); } /***************************************************************************** - * HTTPSeek: close and re-open a connection at the right place + * Seek: close and re-open a connection at the right place *****************************************************************************/ -static void HTTPSeek( input_thread_t * p_input, off_t i_pos ) +static void Seek( input_thread_t * p_input, off_t i_pos ) { _input_socket_t * p_access_data = p_input->p_access_data; close( p_access_data->_socket.i_handle ); diff --git a/plugins/access/udp.c b/plugins/access/udp.c index e5a50bceb7..279e4ee450 100644 --- a/plugins/access/udp.c +++ b/plugins/access/udp.c @@ -2,7 +2,7 @@ * udp.c: raw UDP access plug-in ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: udp.c,v 1.11 2002/06/01 12:31:58 sam Exp $ + * $Id: udp.c,v 1.12 2002/07/31 20:56:50 sam Exp $ * * Authors: Christophe Massiot * @@ -45,51 +45,26 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void input_getfunctions( function_list_t * ); -static int UDPOpen ( input_thread_t * ); +static int Open ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Raw UDP access plug-in") ) - ADD_CAPABILITY( ACCESS, 0 ) - ADD_SHORTCUT( "udpstream" ) - ADD_SHORTCUT( "udp4" ) - ADD_SHORTCUT( "udp6" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->access ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("raw UDP access module") ); + set_capability( "access", 0 ); + add_shortcut( "udpstream" ); + add_shortcut( "udp4" ); + add_shortcut( "udp6" ); + set_callbacks( Open, __input_FDNetworkClose ); +vlc_module_end(); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Open: open the socket *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.access - input.pf_open = UDPOpen; - input.pf_read = input_FDNetworkRead; - input.pf_close = input_FDNetworkClose; - input.pf_set_program = input_SetProgram; - input.pf_set_area = NULL; - input.pf_seek = NULL; -#undef input -} - -/***************************************************************************** - * UDPOpen: open the socket - *****************************************************************************/ -static int UDPOpen( input_thread_t * p_input ) +static int Open( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; input_socket_t * p_access_data; module_t * p_network; char * psz_network = ""; @@ -217,6 +192,11 @@ static int UDPOpen( input_thread_t * p_input ) } } + p_input->pf_read = input_FDNetworkRead; + p_input->pf_set_program = input_SetProgram; + p_input->pf_set_area = NULL; + p_input->pf_seek = NULL; + vlc_mutex_lock( &p_input->stream.stream_lock ); p_input->stream.b_pace_control = 0; p_input->stream.b_seekable = 0; @@ -248,14 +228,14 @@ static int UDPOpen( input_thread_t * p_input ) socket_desc.i_server_port = i_server_port; /* Find an appropriate network module */ - p_network = module_Need( p_input, MODULE_CAPABILITY_NETWORK, - psz_network, &socket_desc ); + p_input->p_private = (void*) &socket_desc; + p_network = module_Need( p_input, "network", psz_network ); free(psz_name); if( p_network == NULL ) { return( -1 ); } - module_Unneed( p_network ); + module_Unneed( p_input, p_network ); p_access_data = p_input->p_access_data = malloc( sizeof(input_socket_t) ); if( p_access_data == NULL ) diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index 5d01c03e2a..7f0b82ca88 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -2,7 +2,7 @@ * alsa.c : alsa plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: alsa.c,v 1.20 2002/07/20 18:01:42 sam Exp $ + * $Id: alsa.c,v 1.21 2002/07/31 20:56:50 sam Exp $ * * Authors: Henri Fallon - Original Author * Jeffrey Baker - Port to ALSA 1.0 API @@ -36,35 +36,27 @@ #include /***************************************************************************** - * Capabilities defined in the other files. + * Local prototypes *****************************************************************************/ -static void aout_getfunctions( function_list_t * p_function_list ); -static int aout_Open ( aout_thread_t * ); -static int aout_SetFormat ( aout_thread_t * ); -static void aout_HandleXrun ( aout_thread_t *); -static int aout_GetBufInfo ( aout_thread_t *, int i_buffer_limit ); -static void aout_Play ( aout_thread_t *, byte_t *buffer, int i_size ); -static void aout_Close ( aout_thread_t * ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); + +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); + +static void HandleXrun ( aout_thread_t *); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START - ADD_CATEGORY_HINT( N_("Device"), NULL ) - ADD_STRING( "alsa-device", NULL, NULL, N_("Name"), NULL ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("ALSA audio module") ) - ADD_CAPABILITY( AOUT, 50 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - aout_getfunctions( &p_module->p_functions->aout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Device"), NULL ); + add_string( "alsa-device", NULL, NULL, N_("Name"), NULL ); + set_description( _("ALSA audio module") ); + set_capability( "audio output", 50 ); + set_callbacks( Open, Close ); +vlc_module_end(); /***************************************************************************** * Preamble @@ -95,25 +87,14 @@ struct aout_sys_t }; /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void aout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} - -/***************************************************************************** - * aout_Open : creates a handle and opens an alsa device + * Open: create a handle and open an alsa device ***************************************************************************** * This function opens an alsa device, through the alsa API *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) +static int Open( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; + /* Allows user to choose which ALSA device to use */ char psz_alsadev[128]; char *psz_device, *psz_userdev; @@ -127,6 +108,10 @@ static int aout_Open( aout_thread_t *p_aout ) return -1; } + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + /* Read in ALSA device preferences from configuration */ psz_userdev = config_GetPsz( p_aout, "alsa-device" ); @@ -179,12 +164,12 @@ static int aout_Open( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_SetFormat : sets the alsa output format + * SetFormat : sets the alsa output format ***************************************************************************** * This function prepares the device, sets the rate, format, the mode * ( "play as soon as you have data" ), and buffer information. *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { int i_rv; int i_format; @@ -317,12 +302,12 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_HandleXrun : reprepare the output + * HandleXrun : reprepare the output ***************************************************************************** * When buffer gets empty, the driver goes in "Xrun" state, where it needs * to be reprepared before playing again *****************************************************************************/ -static void aout_HandleXrun(aout_thread_t *p_aout) +static void HandleXrun(aout_thread_t *p_aout) { int i_rv; @@ -339,14 +324,14 @@ static void aout_HandleXrun(aout_thread_t *p_aout) /***************************************************************************** - * aout_BufInfo: buffer status query + * BufInfo: buffer status query ***************************************************************************** * This function returns the number of used byte in the queue. * It also deals with errors : indeed if the device comes to run out * of data to play, it switches to the "underrun" status. It has to * be flushed and re-prepared *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { snd_pcm_status_t *p_status; int i_alsa_get_status_returns; @@ -366,7 +351,7 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) switch( snd_pcm_status_get_state( p_status ) ) { case SND_PCM_STATE_XRUN : - aout_HandleXrun( p_aout ); + HandleXrun( p_aout ); break; case SND_PCM_STATE_OPEN: @@ -384,11 +369,11 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) } /***************************************************************************** - * aout_Play : plays a sample + * Play : plays a sample ***************************************************************************** * Plays a sample using the snd_pcm_writei function from the alsa API *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { snd_pcm_uframes_t tot_frames; snd_pcm_uframes_t frames_left; @@ -415,10 +400,11 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } /***************************************************************************** - * aout_Close : close the Alsa device + * Close: close the Alsa device *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +static void Close( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; int i_close_returns; i_close_returns = snd_pcm_close( p_aout->p_sys->p_alsa_handle ); diff --git a/plugins/arts/arts.c b/plugins/arts/arts.c index 42eba24b3a..80e12b4c65 100644 --- a/plugins/arts/arts.c +++ b/plugins/arts/arts.c @@ -46,51 +46,30 @@ struct aout_sys_t }; /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void aout_getfunctions ( function_list_t * ); -static int aout_Open ( aout_thread_t * ); -static int aout_SetFormat ( aout_thread_t * ); -static int aout_GetBufInfo ( aout_thread_t *, int ); -static void aout_Play ( aout_thread_t *, byte_t *, int ); -static void aout_Close ( aout_thread_t * ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("aRts audio module") ) - ADD_CAPABILITY( AOUT, 50 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - aout_getfunctions( &p_module->p_functions->aout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void aout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} +vlc_module_begin(); + set_description( _("aRts audio module") ); + set_capability( "audio output", 50 ); + set_callbacks( Open, Close ); +vlc_module_end(); /***************************************************************************** - * aout_Open: initialize arts connection to server + * Open: initialize arts connection to server *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) +static int Open( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; int i_err = 0; /* Allocate structure */ @@ -110,6 +89,10 @@ static int aout_Open( aout_thread_t *p_aout ) return(-1); } + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + p_aout->p_sys->stream = arts_play_stream( p_aout->i_rate, 16, p_aout->i_channels, "vlc" ); @@ -117,9 +100,9 @@ static int aout_Open( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_SetFormat: set the output format + * SetFormat: set the output format *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { /*Not ready*/ /* p_aout->i_latency = esd_get_latency(i_fd);*/ @@ -131,20 +114,20 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_GetBufInfo: buffer status query + * GetBufInfo: buffer status query *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { /* arbitrary value that should be changed */ return( i_buffer_limit ); } /***************************************************************************** - * aout_Play: play a sound samples buffer + * Play: play a sound samples buffer ***************************************************************************** * This function writes a buffer of i_length bytes in the socket *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { int i_err = arts_write( p_aout->p_sys->stream, buffer, i_size ); @@ -155,10 +138,12 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } /***************************************************************************** - * aout_Close: close the Esound socket + * Close: close the Esound socket *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +static void Close( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; + arts_close_stream( p_aout->p_sys->stream ); free( p_aout->p_sys ); } diff --git a/plugins/avi/avi.c b/plugins/avi/avi.c index ca91d6a646..ed5bd7ee39 100644 --- a/plugins/avi/avi.c +++ b/plugins/avi/avi.c @@ -2,7 +2,7 @@ * avi.c : AVI file Stream input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: avi.c,v 1.32 2002/07/23 00:39:16 sam Exp $ + * $Id: avi.c,v 1.33 2002/07/31 20:56:50 sam Exp $ * Authors: Laurent Aimar * * This program is free software; you can redistribute it and/or modify @@ -39,43 +39,20 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void input_getfunctions( function_list_t * ); -static int AVIDemux ( input_thread_t * ); -static int AVIInit ( input_thread_t * ); -static void AVIEnd ( input_thread_t * ); +static int AVIInit ( vlc_object_t * ); +static void __AVIEnd ( vlc_object_t * ); +static int AVIDemux ( input_thread_t * ); -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( "RIFF-AVI Stream input" ) - ADD_CAPABILITY( DEMUX, 150 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->demux ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +#define AVIEnd(a) __AVIEnd(VLC_OBJECT(a)) /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.demux - input.pf_init = AVIInit; - input.pf_end = AVIEnd; - input.pf_demux = AVIDemux; - input.pf_rewind = NULL; -#undef input -} - +vlc_module_begin(); + set_description( "RIFF-AVI demuxer" ); + set_capability( "demux", 150 ); + set_callbacks( AVIInit, __AVIEnd ); +vlc_module_end(); /***************************************************************************** * Some usefull functions to manipulate memory @@ -544,8 +521,9 @@ static void __AVI_UpdateIndexOffset( input_thread_t *p_input ) /***************************************************************************** * AVIEnd: frees unused data *****************************************************************************/ -static void AVIEnd( input_thread_t *p_input ) +static void __AVIEnd ( vlc_object_t * p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; int i; demux_data_avi_file_t *p_avi_demux; p_avi_demux = (demux_data_avi_file_t*)p_input->p_demux_data ; @@ -580,8 +558,9 @@ static void AVIEnd( input_thread_t *p_input ) /***************************************************************************** * AVIInit: check file and initializes AVI structures *****************************************************************************/ -static int AVIInit( input_thread_t *p_input ) -{ +static int AVIInit( vlc_object_t * p_this ) +{ + input_thread_t * p_input = (input_thread_t *)p_this; riffchunk_t *p_riff,*p_hdrl,*p_movi; riffchunk_t *p_avih; riffchunk_t *p_strl,*p_strh,*p_strf; @@ -589,6 +568,8 @@ static int AVIInit( input_thread_t *p_input ) es_descriptor_t *p_es = NULL; /* for not warning */ int i; + p_input->pf_demux = AVIDemux; + if( !( p_input->p_demux_data = p_avi_demux = malloc( sizeof(demux_data_avi_file_t) ) ) ) { @@ -1039,7 +1020,7 @@ static int __AVI_SeekAndGetChunk( input_thread_t *p_input, AVIStreamInfo_t *p_info ) { pes_packet_t *p_pes; - int i_length; + int i_length, i_ret; i_length = __MIN( p_info->p_index[p_info->i_idxposc].i_length - p_info->i_idxposb, @@ -1049,10 +1030,9 @@ static int __AVI_SeekAndGetChunk( input_thread_t *p_input, (off_t)p_info->p_index[p_info->i_idxposc].i_pos + p_info->i_idxposb + 8); - if( __AVI_GetDataInPES( p_input, - &p_pes, - i_length , - 0) != i_length ) + i_ret = __AVI_GetDataInPES( p_input, &p_pes, i_length , 0); + + if( i_ret != i_length ) { return( 0 ); } @@ -1532,6 +1512,7 @@ static pes_packet_t *AVI_ReadStreamBytesInPES( input_thread_t *p_input, { return( NULL ); } +fprintf(stderr, "blah ibyte %i\n", i_byte); if( !( p_data = input_NewPacket( p_input->p_method_data, i_byte ) ) ) { input_DeletePES( p_input->p_method_data, p_pes ); diff --git a/plugins/beos/aout_beos.cpp b/plugins/beos/aout_beos.cpp index 3fdfa9d811..26e9f240f8 100644 --- a/plugins/beos/aout_beos.cpp +++ b/plugins/beos/aout_beos.cpp @@ -2,7 +2,7 @@ * aout_beos.cpp: BeOS audio output ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: aout_beos.cpp,v 1.25 2002/07/20 18:01:42 sam Exp $ + * $Id: aout_beos.cpp,v 1.26 2002/07/31 20:56:50 sam Exp $ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -37,11 +37,8 @@ #include #include -extern "C" -{ #include #include -} /***************************************************************************** * aout_sys_t: BeOS audio output method descriptor @@ -58,37 +55,20 @@ struct aout_sys_t int i_buffer_pos; }; -extern "C" -{ - /***************************************************************************** * Local prototypes. *****************************************************************************/ -static int aout_Open ( aout_thread_t *p_aout ); -static int aout_SetFormat ( aout_thread_t *p_aout ); -static int aout_GetBufInfo ( aout_thread_t *p_aout, int i_buffer_info ); -static void aout_Play ( aout_thread_t *p_aout, - byte_t *buffer, int i_size ); -static void aout_Close ( aout_thread_t *p_aout ); +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * OpenAudio: opens a BPushGameSound *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} +int E_(OpenAudio) ( vlc_object_t *p_this ) +{ + aout_thread_t * p_aout = (aout_thread_t *)p_this; -/***************************************************************************** - * aout_Open: opens a BPushGameSound - *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) -{ /* Allocate structure */ p_aout->p_sys = (aout_sys_t*) malloc( sizeof( aout_sys_t ) ); if( p_aout->p_sys == NULL ) @@ -114,6 +94,10 @@ static int aout_Open( aout_thread_t *p_aout ) p_aout->p_sys->p_format->buffer_size = 4*8192; p_aout->p_sys->i_buffer_pos = 0; + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + /* Allocate BPushGameSound */ p_aout->p_sys->p_sound = new BPushGameSound( 8192, p_aout->p_sys->p_format, @@ -143,17 +127,17 @@ static int aout_Open( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_SetFormat: sets the dsp output format + * SetFormat: sets the dsp output format *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { return( 0 ); } /***************************************************************************** - * aout_GetBufInfo: buffer status query + * GetBufInfo: buffer status query *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { /* Each value is 4 bytes long (stereo signed 16 bits) */ int i_hard_pos = 4 * p_aout->p_sys->p_sound->CurrentPosition(); @@ -168,11 +152,11 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) } /***************************************************************************** - * aout_Play: plays a sound samples buffer + * Play: plays a sound samples buffer ***************************************************************************** * This function writes a buffer of i_length bytes in the dsp *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { int i_newbuf_pos; @@ -202,10 +186,12 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } /***************************************************************************** - * aout_Close: closes the dsp audio device + * CloseAudio: closes the dsp audio device *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) -{ +void E_(CloseAudio) ( vlc_object_t *p_this ) +{ + aout_thread_t * p_aout = (aout_thread_t *)p_this; + p_aout->p_sys->p_sound->UnlockCyclic(); p_aout->p_sys->p_sound->StopPlaying( ); delete p_aout->p_sys->p_sound; @@ -213,5 +199,3 @@ static void aout_Close( aout_thread_t *p_aout ) free( p_aout->p_sys ); } -} /* extern "C" */ - diff --git a/plugins/beos/beos.cpp b/plugins/beos/beos.cpp index f983b30ae5..af0387d807 100644 --- a/plugins/beos/beos.cpp +++ b/plugins/beos/beos.cpp @@ -2,7 +2,7 @@ * beos.cpp : BeOS plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: beos.cpp,v 1.19 2002/06/01 12:31:58 sam Exp $ + * $Id: beos.cpp,v 1.20 2002/07/31 20:56:50 sam Exp $ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -30,35 +30,31 @@ #include -extern "C" -{ /***************************************************************************** - * Capabilities defined in the other files. + * External prototypes *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ); -void _M( vout_getfunctions )( function_list_t * p_function_list ); -void _M( intf_getfunctions )( function_list_t * p_function_list ); +int E_(OpenIntf) ( vlc_object_t * ); +void E_(CloseIntf) ( vlc_object_t * ); -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("BeOS standard API module") ) - ADD_CAPABILITY( INTF, 100 ) - ADD_CAPABILITY( VOUT, 100 ) - ADD_CAPABILITY( AOUT, 100 ) -MODULE_INIT_STOP +int E_(OpenAudio) ( vlc_object_t * ); +void E_(CloseAudio) ( vlc_object_t * ); -MODULE_ACTIVATE_START - _M( aout_getfunctions )( &p_module->p_functions->aout ); - _M( vout_getfunctions )( &p_module->p_functions->vout ); - _M( intf_getfunctions )( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP +int E_(OpenVideo) ( vlc_object_t * ); +void E_(CloseVideo) ( vlc_object_t * ); -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +/***************************************************************************** + * Module descriptor + *****************************************************************************/ +vlc_module_begin(); + set_description( _("BeOS standard API module") ); + add_submodule(); + set_capability( "interface", 100 ); + set_callbacks( E_(OpenIntf), E_(CloseIntf) ); + add_submodule(); + set_capability( "video output", 100 ); + set_callbacks( E_(OpenVideo), E_(CloseVideo) ); + add_submodule(); + set_capability( "audio output", 100 ); + set_callbacks( E_(OpenAudio), E_(CloseAudio) ); +vlc_module_end(); -} /* extern "C" */ diff --git a/plugins/beos/intf_beos.cpp b/plugins/beos/intf_beos.cpp index 5d729a43ca..9e7c5ca4e4 100644 --- a/plugins/beos/intf_beos.cpp +++ b/plugins/beos/intf_beos.cpp @@ -2,7 +2,7 @@ * intf_beos.cpp: beos interface ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: intf_beos.cpp,v 1.43 2002/07/23 12:42:17 tcastley Exp $ + * $Id: intf_beos.cpp,v 1.44 2002/07/31 20:56:50 sam Exp $ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -38,32 +38,17 @@ #include "intf_vlc_wrapper.h" #include "InterfaceWindow.h" -extern "C" -{ - -/***************************************************************************** - * Local prototypes. - *****************************************************************************/ -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); - /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Local prototype *****************************************************************************/ -void _M( intf_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} +static void Run ( intf_thread_t *p_intf ); /***************************************************************************** - * intf_Open: initialize interface + * OpenIntf: initialize interface *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ +int E_(OpenIntf) ( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t*) p_this; BScreen *screen; screen = new BScreen(); BRect rect = screen->Frame(); @@ -83,6 +68,7 @@ static int intf_Open( intf_thread_t *p_intf ) // p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); p_intf->p_sys->p_input = NULL; + p_intf->pf_run = Run; /* Create the interface window */ p_intf->p_sys->p_window = @@ -99,10 +85,12 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy dummy interface + * CloseIntf: destroy interface *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) +void E_(CloseIntf) ( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t*) p_this; + if( p_intf->p_sys->p_input ) { vlc_object_release( p_intf->p_sys->p_input ); @@ -120,9 +108,9 @@ static void intf_Close( intf_thread_t *p_intf ) /***************************************************************************** - * intf_Run: event loop + * Run: event loop *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { while( !p_intf->b_die ) { @@ -153,5 +141,3 @@ static void intf_Run( intf_thread_t *p_intf ) } -} /* extern "C" */ - diff --git a/plugins/beos/vout_beos.cpp b/plugins/beos/vout_beos.cpp index 3902254d80..bb7724fb26 100644 --- a/plugins/beos/vout_beos.cpp +++ b/plugins/beos/vout_beos.cpp @@ -2,7 +2,7 @@ * vout_beos.cpp: beos video output display method ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: vout_beos.cpp,v 1.64 2002/07/28 01:46:26 tcastley Exp $ + * $Id: vout_beos.cpp,v 1.65 2002/07/31 20:56:50 sam Exp $ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -460,46 +460,26 @@ void VLCView::Draw(BRect updateRect) FillRect(updateRect); } - -extern "C" -{ - /***************************************************************************** * Local prototypes *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Display ( vout_thread_t *, picture_t * ); static int BeosOpenDisplay ( vout_thread_t *p_vout ); static void BeosCloseDisplay( vout_thread_t *p_vout ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( vout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_display = vout_Display; - p_function_list->functions.vout.pf_render = vout_Render; -} - -/***************************************************************************** - * vout_Create: allocates BeOS video thread output method + * OpenVideo: allocates BeOS video thread output method ***************************************************************************** * This function allocates and initializes a BeOS vout method. *****************************************************************************/ -int vout_Create( vout_thread_t *p_vout ) +int E_(OpenVideo) ( vlc_object_t *p_this ) { + vout_thread_t * p_vout = (vout_thread_t *)p_this; + /* Allocate structure */ p_vout->p_sys = (vout_sys_t*) malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) @@ -511,13 +491,19 @@ int vout_Create( vout_thread_t *p_vout ) p_vout->p_sys->i_height = p_vout->render.i_height; p_vout->p_sys->source_chroma = p_vout->render.i_chroma; + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = NULL; + p_vout->pf_render = NULL; + p_vout->pf_display = Display; + return( 0 ); } /***************************************************************************** - * vout_Init: initialize BeOS video thread output method + * Init: initialize BeOS video thread output method *****************************************************************************/ -int vout_Init( vout_thread_t *p_vout ) +int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -583,50 +569,32 @@ int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate BeOS video thread output method + * End: terminate BeOS video thread output method *****************************************************************************/ -void vout_End( vout_thread_t *p_vout ) +void End( vout_thread_t *p_vout ) { BeosCloseDisplay( p_vout ); } /***************************************************************************** - * vout_Destroy: destroy BeOS video thread output method + * CloseVideo: destroy BeOS video thread output method ***************************************************************************** * Terminate an output method created by DummyCreateOutputMethod *****************************************************************************/ -void vout_Destroy( vout_thread_t *p_vout ) +void E_(CloseVideo) ( vlc_object_t *p_this ) { - free( p_vout->p_sys ); -} + vout_thread_t * p_vout = (vout_thread_t *)p_this; -/***************************************************************************** - * vout_Manage: handle BeOS events - ***************************************************************************** - * This function should be called regularly by video output thread. It manages - * console events. It returns a non null value on error. - *****************************************************************************/ -int vout_Manage( vout_thread_t *p_vout ) -{ - - return( 0 ); -} - -/***************************************************************************** - * vout_Render: render previously calculated output - *****************************************************************************/ -void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; + free( p_vout->p_sys ); } /***************************************************************************** - * vout_Display: displays previously rendered output + * Display: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to BeOS image, waits until * it is displayed and switch the two rendering buffers, preparing next frame. *****************************************************************************/ -void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +void Display( vout_thread_t *p_vout, picture_t *p_pic ) { VideoWindow * p_win = p_vout->p_sys->p_window; @@ -683,6 +651,3 @@ static void BeosCloseDisplay( vout_thread_t *p_vout ) p_win = NULL; } - - -} /* extern "C" */ diff --git a/plugins/chroma/i420_rgb.c b/plugins/chroma/i420_rgb.c index 573b861577..f6676eb83c 100644 --- a/plugins/chroma/i420_rgb.c +++ b/plugins/chroma/i420_rgb.c @@ -2,7 +2,7 @@ * i420_rgb.c : YUV to bitmap RGB conversion module for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: i420_rgb.c,v 1.10 2002/07/23 00:39:16 sam Exp $ + * $Id: i420_rgb.c,v 1.11 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -40,10 +40,8 @@ /***************************************************************************** * Local and extern prototypes. *****************************************************************************/ -static void chroma_getfunctions ( function_list_t * p_function_list ); - -static int chroma_Init ( vout_thread_t * ); -static void chroma_End ( vout_thread_t * ); +static int Activate ( vlc_object_t * ); +static void Deactivate ( vlc_object_t * ); #if defined (MODULE_NAME_IS_chroma_i420_rgb) static void SetGammaTable ( int *pi_table, double f_gamma ); @@ -52,48 +50,30 @@ static void Set8bppPalette ( vout_thread_t *, u8 * ); #endif /***************************************************************************** - * Build configuration tree. + * Module descriptor. *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START +vlc_module_begin(); #if defined (MODULE_NAME_IS_chroma_i420_rgb) - SET_DESCRIPTION( _("I420,IYUV,YV12 to " - "RGB,RV15,RV16,RV24,RV32 conversions") ) - ADD_CAPABILITY( CHROMA, 80 ) + set_description( _("I420,IYUV,YV12 to " + "RGB,RV15,RV16,RV24,RV32 conversions") ); + set_capability( "chroma", 80 ); #elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx) - SET_DESCRIPTION( _( "MMX I420,IYUV,YV12 to " - "RV15,RV16,RV24,RV32 conversions") ) - ADD_CAPABILITY( CHROMA, 100 ) - ADD_REQUIREMENT( MMX ) + set_description( _( "MMX I420,IYUV,YV12 to " + "RV15,RV16,RV24,RV32 conversions") ); + set_capability( "chroma", 100 ); + add_requirement( MMX ); #endif -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - chroma_getfunctions( &p_module->p_functions->chroma ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void chroma_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.chroma.pf_init = chroma_Init; - p_function_list->functions.chroma.pf_end = chroma_End; -} + set_callbacks( Activate, Deactivate ); +vlc_module_end(); /***************************************************************************** - * chroma_Init: allocate a chroma function + * Activate: allocate a chroma function ***************************************************************************** * This function allocates and initializes a chroma function *****************************************************************************/ -static int chroma_Init( vout_thread_t *p_vout ) +static int Activate( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; #if defined (MODULE_NAME_IS_chroma_i420_rgb) size_t i_tables_size; #endif @@ -112,20 +92,20 @@ static int chroma_Init( vout_thread_t *p_vout ) { #if defined (MODULE_NAME_IS_chroma_i420_rgb) case VLC_FOURCC('R','G','B','2'): - p_vout->chroma.pf_convert = _M( I420_RGB8 ); + p_vout->chroma.pf_convert = E_(I420_RGB8); break; #endif case VLC_FOURCC('R','V','1','5'): - p_vout->chroma.pf_convert = _M( I420_RGB15 ); + p_vout->chroma.pf_convert = E_(I420_RGB15); break; case VLC_FOURCC('R','V','1','6'): - p_vout->chroma.pf_convert = _M( I420_RGB16 ); + p_vout->chroma.pf_convert = E_(I420_RGB16); break; case VLC_FOURCC('R','V','2','4'): case VLC_FOURCC('R','V','3','2'): - p_vout->chroma.pf_convert = _M( I420_RGB32 ); + p_vout->chroma.pf_convert = E_(I420_RGB32); break; default: @@ -214,12 +194,14 @@ static int chroma_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * chroma_End: free the chroma function + * Deactivate: free the chroma function ***************************************************************************** * This function frees the previously allocated chroma function *****************************************************************************/ -static void chroma_End( vout_thread_t *p_vout ) +static void Deactivate( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + #if defined (MODULE_NAME_IS_chroma_i420_rgb) free( p_vout->chroma.p_sys->p_base ); #endif diff --git a/plugins/chroma/i420_rgb.h b/plugins/chroma/i420_rgb.h index ed99d368b5..dacf1b4833 100644 --- a/plugins/chroma/i420_rgb.h +++ b/plugins/chroma/i420_rgb.h @@ -2,7 +2,7 @@ * i420_rgb.h : YUV to bitmap RGB conversion module for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: i420_rgb.h,v 1.7 2002/07/20 18:01:42 sam Exp $ + * $Id: i420_rgb.h,v 1.8 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -45,11 +45,11 @@ struct chroma_sys_t * Prototypes *****************************************************************************/ #ifdef MODULE_NAME_IS_chroma_i420_rgb -void _M( I420_RGB8 ) ( vout_thread_t *, picture_t *, picture_t * ); +void E_(I420_RGB8) ( vout_thread_t *, picture_t *, picture_t * ); #endif -void _M( I420_RGB15 )( vout_thread_t *, picture_t *, picture_t * ); -void _M( I420_RGB16 )( vout_thread_t *, picture_t *, picture_t * ); -void _M( I420_RGB32 )( vout_thread_t *, picture_t *, picture_t * ); +void E_(I420_RGB15)( vout_thread_t *, picture_t *, picture_t * ); +void E_(I420_RGB16)( vout_thread_t *, picture_t *, picture_t * ); +void E_(I420_RGB32)( vout_thread_t *, picture_t *, picture_t * ); /***************************************************************************** * CONVERT_*_PIXEL: pixel conversion macros diff --git a/plugins/chroma/i420_rgb16.c b/plugins/chroma/i420_rgb16.c index b56087c322..972a54185c 100644 --- a/plugins/chroma/i420_rgb16.c +++ b/plugins/chroma/i420_rgb16.c @@ -2,7 +2,7 @@ * i420_rgb16.c : YUV to bitmap RGB conversion module for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: i420_rgb16.c,v 1.9 2002/07/23 00:39:16 sam Exp $ + * $Id: i420_rgb16.c,v 1.10 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -50,8 +50,8 @@ static void SetOffset( int, int, int, int, vlc_bool_t *, int *, int * ); * - input: 2 lines (2 Y lines, 1 U/V line) * - output: 1 line *****************************************************************************/ -void _M( I420_RGB15 )( vout_thread_t *p_vout, picture_t *p_src, - picture_t *p_dest ) +void E_(I420_RGB15)( vout_thread_t *p_vout, picture_t *p_src, + picture_t *p_dest ) { /* We got this one from the old arguments */ u16 *p_pic = (u16*)p_dest->p->p_pixels; @@ -178,8 +178,8 @@ void _M( I420_RGB15 )( vout_thread_t *p_vout, picture_t *p_src, * - input: 2 lines (2 Y lines, 1 U/V line) * - output: 1 line *****************************************************************************/ -void _M( I420_RGB16 )( vout_thread_t *p_vout, picture_t *p_src, - picture_t *p_dest ) +void E_(I420_RGB16)( vout_thread_t *p_vout, picture_t *p_src, + picture_t *p_dest ) { /* We got this one from the old arguments */ u16 *p_pic = (u16*)p_dest->p->p_pixels; @@ -306,8 +306,8 @@ void _M( I420_RGB16 )( vout_thread_t *p_vout, picture_t *p_src, * - input: 2 lines (2 Y lines, 1 U/V line) * - output: 1 line *****************************************************************************/ -void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src, - picture_t *p_dest ) +void E_(I420_RGB32)( vout_thread_t *p_vout, picture_t *p_src, + picture_t *p_dest ) { /* We got this one from the old arguments */ u32 *p_pic = (u32*)p_dest->p->p_pixels; diff --git a/plugins/chroma/i420_rgb8.c b/plugins/chroma/i420_rgb8.c index cb6ce37867..4a292ef1c1 100644 --- a/plugins/chroma/i420_rgb8.c +++ b/plugins/chroma/i420_rgb8.c @@ -2,7 +2,7 @@ * i420_rgb8.c : YUV to bitmap RGB conversion module for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: i420_rgb8.c,v 1.7 2002/07/23 00:39:16 sam Exp $ + * $Id: i420_rgb8.c,v 1.8 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -39,8 +39,7 @@ static void SetOffset( int, int, int, int, vlc_bool_t *, int *, int * ); /***************************************************************************** * I420_RGB8: color YUV 4:2:0 to RGB 8 bpp *****************************************************************************/ -void _M( I420_RGB8 )( vout_thread_t *p_vout, picture_t *p_src, - picture_t *p_dest ) +void E_(I420_RGB8)( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest ) { /* We got this one from the old arguments */ u8 *p_pic = (u8*)p_dest->p->p_pixels; diff --git a/plugins/chroma/i420_ymga.c b/plugins/chroma/i420_ymga.c index 69fd4f40b4..67f6d7e720 100644 --- a/plugins/chroma/i420_ymga.c +++ b/plugins/chroma/i420_ymga.c @@ -2,7 +2,7 @@ * i420_ymga.c : YUV to YUV conversion module for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: i420_ymga.c,v 1.7 2002/07/23 00:39:16 sam Exp $ + * $Id: i420_ymga.c,v 1.8 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -37,54 +37,33 @@ /***************************************************************************** * Local and extern prototypes. *****************************************************************************/ -static void chroma_getfunctions ( function_list_t * p_function_list ); - -static int chroma_Init ( vout_thread_t *p_vout ); -static void chroma_End ( vout_thread_t *p_vout ); - -static void I420_YMGA ( vout_thread_t *, picture_t *, picture_t * ); +static int Activate ( vlc_object_t * ); +static void I420_YMGA ( vout_thread_t *, picture_t *, picture_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START +vlc_module_begin(); #if defined (MODULE_NAME_IS_chroma_i420_ymga) - SET_DESCRIPTION( _("conversions from " SRC_FOURCC " to " DEST_FOURCC) ) - ADD_CAPABILITY( CHROMA, 80 ) + set_description( _("conversions from " SRC_FOURCC " to " DEST_FOURCC) ); + set_capability( "chroma", 80 ); #elif defined (MODULE_NAME_IS_chroma_i420_ymga_mmx) - SET_DESCRIPTION( _("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ) - ADD_CAPABILITY( CHROMA, 100 ) - ADD_REQUIREMENT( MMX ) + set_description( _("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ); + set_capability( "chroma", 100 ); + add_requirement( MMX ); #endif -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - chroma_getfunctions( &p_module->p_functions->chroma ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + set_callbacks( Activate, NULL ); +vlc_module_end(); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void chroma_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.chroma.pf_init = chroma_Init; - p_function_list->functions.chroma.pf_end = chroma_End; -} - -/***************************************************************************** - * chroma_Init: allocate a chroma function + * Activate: allocate a chroma function ***************************************************************************** * This function allocates and initializes a chroma function *****************************************************************************/ -static int chroma_Init( vout_thread_t *p_vout ) +static int Activate( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 ) { return -1; @@ -113,16 +92,6 @@ static int chroma_Init( vout_thread_t *p_vout ) return 0; } -/***************************************************************************** - * chroma_End: free the chroma function - ***************************************************************************** - * This function frees the previously allocated chroma function - *****************************************************************************/ -static void chroma_End( vout_thread_t *p_vout ) -{ - ; -} - /* Following functions are local */ /***************************************************************************** diff --git a/plugins/chroma/i420_yuy2.c b/plugins/chroma/i420_yuy2.c index 6447750acd..34c3fbb37d 100644 --- a/plugins/chroma/i420_yuy2.c +++ b/plugins/chroma/i420_yuy2.c @@ -2,7 +2,7 @@ * i420_yuy2.c : YUV to YUV conversion module for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: i420_yuy2.c,v 1.10 2002/07/23 00:39:16 sam Exp $ + * $Id: i420_yuy2.c,v 1.11 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -44,10 +44,7 @@ /***************************************************************************** * Local and extern prototypes. *****************************************************************************/ -static void chroma_getfunctions ( function_list_t * p_function_list ); - -static int chroma_Init ( vout_thread_t *p_vout ); -static void chroma_End ( vout_thread_t *p_vout ); +static int Activate ( vlc_object_t * ); static void I420_YUY2 ( vout_thread_t *, picture_t *, picture_t * ); static void I420_YVYU ( vout_thread_t *, picture_t *, picture_t * ); @@ -64,49 +61,32 @@ static unsigned long long i_80w; #endif /***************************************************************************** - * Build configuration tree. + * Module descriptor. *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START +vlc_module_begin(); #if defined (MODULE_NAME_IS_chroma_i420_yuy2) - SET_DESCRIPTION( _("conversions from " SRC_FOURCC " to " DEST_FOURCC) ) - ADD_CAPABILITY( CHROMA, 80 ) + set_description( _("conversions from " SRC_FOURCC " to " DEST_FOURCC) ); + set_capability( "chroma", 80 ); #elif defined (MODULE_NAME_IS_chroma_i420_yuy2_mmx) - SET_DESCRIPTION( _("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ) - ADD_CAPABILITY( CHROMA, 100 ) - ADD_REQUIREMENT( MMX ) + set_description( _("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ); + set_capability( "chroma", 100 ); + add_requirement( MMX ); /* Initialize MMX-specific constants */ i_00ffw = 0x00ff00ff00ff00ff; i_80w = 0x0000000080808080; #endif -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - chroma_getfunctions( &p_module->p_functions->chroma ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void chroma_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.chroma.pf_init = chroma_Init; - p_function_list->functions.chroma.pf_end = chroma_End; -} + set_callbacks( Activate, NULL ); +vlc_module_end(); /***************************************************************************** - * chroma_Init: allocate a chroma function + * Activate: allocate a chroma function ***************************************************************************** * This function allocates and initializes a chroma function *****************************************************************************/ -static int chroma_Init( vout_thread_t *p_vout ) +static int Activate( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 ) { return -1; @@ -160,16 +140,6 @@ static int chroma_Init( vout_thread_t *p_vout ) return 0; } -/***************************************************************************** - * chroma_End: free the chroma function - ***************************************************************************** - * This function frees the previously allocated chroma function - *****************************************************************************/ -static void chroma_End( vout_thread_t *p_vout ) -{ - ; -} - /* Following functions are local */ /***************************************************************************** diff --git a/plugins/chroma/i422_yuy2.c b/plugins/chroma/i422_yuy2.c index 4e69291634..3daac62971 100644 --- a/plugins/chroma/i422_yuy2.c +++ b/plugins/chroma/i422_yuy2.c @@ -2,7 +2,7 @@ * i422_yuy2.c : YUV to YUV conversion module for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: i422_yuy2.c,v 1.7 2002/07/23 00:39:16 sam Exp $ + * $Id: i422_yuy2.c,v 1.8 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -43,10 +43,7 @@ /***************************************************************************** * Local and extern prototypes. *****************************************************************************/ -static void chroma_getfunctions ( function_list_t * p_function_list ); - -static int chroma_Init ( vout_thread_t *p_vout ); -static void chroma_End ( vout_thread_t *p_vout ); +static int Activate ( vlc_object_t * ); static void I422_YUY2 ( vout_thread_t *, picture_t *, picture_t * ); static void I422_YVYU ( vout_thread_t *, picture_t *, picture_t * ); @@ -58,46 +55,29 @@ static void I422_Y211 ( vout_thread_t *, picture_t *, picture_t * ); #endif /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START +vlc_module_begin(); #if defined (MODULE_NAME_IS_chroma_i422_yuy2) - SET_DESCRIPTION( _("conversions from " SRC_FOURCC " to " DEST_FOURCC) ) - ADD_CAPABILITY( CHROMA, 80 ) + set_description( _("conversions from " SRC_FOURCC " to " DEST_FOURCC) ); + set_capability( "chroma", 80 ); #elif defined (MODULE_NAME_IS_chroma_i422_yuy2_mmx) - SET_DESCRIPTION( _("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ) - ADD_CAPABILITY( CHROMA, 100 ) - ADD_REQUIREMENT( MMX ) + set_description( _("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) ); + set_capability( "chroma", 100 ); + add_requirement( MMX ); #endif -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - chroma_getfunctions( &p_module->p_functions->chroma ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void chroma_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.chroma.pf_init = chroma_Init; - p_function_list->functions.chroma.pf_end = chroma_End; -} + set_callbacks( Activate, NULL ); +vlc_module_end(); /***************************************************************************** - * chroma_Init: allocate a chroma function + * Activate: allocate a chroma function ***************************************************************************** * This function allocates and initializes a chroma function *****************************************************************************/ -static int chroma_Init( vout_thread_t *p_vout ) +static int Activate( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 ) { return -1; @@ -149,16 +129,6 @@ static int chroma_Init( vout_thread_t *p_vout ) return 0; } -/***************************************************************************** - * chroma_End: free the chroma function - ***************************************************************************** - * This function frees the previously allocated chroma function - *****************************************************************************/ -static void chroma_End( vout_thread_t *p_vout ) -{ - ; -} - /* Following functions are local */ /***************************************************************************** diff --git a/plugins/cinepak/cinepak.c b/plugins/cinepak/cinepak.c index d15fc3aff5..2ae8349763 100644 --- a/plugins/cinepak/cinepak.c +++ b/plugins/cinepak/cinepak.c @@ -2,7 +2,7 @@ * cinepak.c: cinepak video decoder ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: cinepak.c,v 1.4 2002/07/23 17:19:02 fenrir Exp $ + * $Id: cinepak.c,v 1.5 2002/07/31 20:56:51 sam Exp $ * * Authors: Laurent Aimar * @@ -45,68 +45,50 @@ #include "vdec_ext-plugins.h" #include "cinepak.h" -/* +/***************************************************************************** * Local prototypes - */ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); + *****************************************************************************/ +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); static int InitThread ( videodec_thread_t * ); static void EndThread ( videodec_thread_t * ); static void DecodeThread ( videodec_thread_t * ); - -/***************************************************************************** - * Capabilities - *****************************************************************************/ -void _M( vdec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} - /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ - -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( "Cinepak Video Decoder" ) - ADD_CAPABILITY( DECODER, 70 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( vdec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - +vlc_module_begin(); + set_description( "Cinepak video decoder" ); + set_capability( "decoder", 70 ); + set_callbacks( OpenDecoder, NULL ); +vlc_module_end(); /***************************************************************************** - * decoder_Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able * to chose. *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) +static int OpenDecoder( vlc_object_t *p_this ) { - switch( *pi_type ) + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + + switch( p_fifo->i_fourcc ) { - case( VLC_FOURCC('c','v','i','d') ): - case( VLC_FOURCC('C','V','I','D') ): - return( 0); - default: - return( -1 ); + case VLC_FOURCC('c','v','i','d'): + case VLC_FOURCC('C','V','I','D'): + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; } + + return VLC_EGENERIC; } /***************************************************************************** - * decoder_Run: this function is called just after the thread is created + * RunDecoder: this function is called just after the thread is created *****************************************************************************/ -static int decoder_Run ( decoder_fifo_t * p_fifo ) -{ +static int RunDecoder( decoder_fifo_t *p_fifo ) +{ videodec_thread_t *p_vdec; int b_error; diff --git a/plugins/directx/aout_directx.c b/plugins/directx/aout_directx.c index c0b2838700..4d5a6dd951 100644 --- a/plugins/directx/aout_directx.c +++ b/plugins/directx/aout_directx.c @@ -2,7 +2,7 @@ * aout_directx.c: Windows DirectX audio output method ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: aout_directx.c,v 1.25 2002/07/20 18:01:42 sam Exp $ + * $Id: aout_directx.c,v 1.26 2002/07/31 20:56:51 sam Exp $ * * Authors: Gildas Bazin * @@ -93,11 +93,9 @@ struct aout_sys_t /***************************************************************************** * Local prototypes. *****************************************************************************/ -static int aout_Open ( aout_thread_t * ); -static int aout_SetFormat ( aout_thread_t * ); -static int aout_GetBufInfo ( aout_thread_t *, int ); -static void aout_Play ( aout_thread_t *, byte_t *, int ); -static void aout_Close ( aout_thread_t * ); +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); /* local functions */ static int DirectxCreateSecondaryBuffer ( aout_thread_t * ); @@ -106,29 +104,17 @@ static int DirectxInitDSound ( aout_thread_t * ); static void DirectSoundThread ( notification_thread_t * ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} - -/***************************************************************************** - * aout_Open: open the audio device + * OpenAudio: open the audio device ***************************************************************************** * This function opens and setups Direct Sound. *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) +int E_(OpenAudio) ( vlc_object_t *p_this ) { + aout_thread_t * p_aout = (aout_thread_t *)p_this; HRESULT dsresult; DSBUFFERDESC dsbuffer_desc; - msg_Dbg( p_aout, "aout_Open" ); + msg_Dbg( p_aout, "Open" ); /* Allocate structure */ p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); @@ -148,6 +134,9 @@ static int aout_Open( aout_thread_t *p_aout ) p_aout->p_sys->l_data_played_from_beginning = 0; vlc_mutex_init( p_aout, &p_aout->p_sys->buffer_lock ); + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; /* Initialise DirectSound */ if( DirectxInitDSound( p_aout ) ) @@ -201,19 +190,19 @@ static int aout_Open( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_SetFormat: reset the audio device and sets its format + * SetFormat: reset the audio device and sets its format ***************************************************************************** * This functions set a new audio format. * For this we need to close the current secondary buffer and create another * one with the desired format. *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { HRESULT dsresult; WAVEFORMATEX *p_waveformat; unsigned long i_size_struct; - msg_Dbg( p_aout, "aout_SetFormat" ); + msg_Dbg( p_aout, "SetFormat" ); /* Set the format of Direct Sound primary buffer */ @@ -272,19 +261,19 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_GetBufInfo: buffer status query + * GetBufInfo: buffer status query ***************************************************************************** * returns the number of bytes in the audio buffer that have not yet been * sent to the sound device. *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { long l_play_position, l_notused, l_result; HRESULT dsresult; if( p_aout->p_sys->b_buffer_underflown ) { - msg_Warn( p_aout, "aout_GetBufInfo underflow" ); + msg_Warn( p_aout, "GetBufInfo underflow" ); return( i_buffer_limit ); } @@ -292,7 +281,7 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) &l_play_position, &l_notused); if( dsresult != DS_OK ) { - msg_Warn( p_aout, "aout_GetBufInfo cannot get current pos" ); + msg_Warn( p_aout, "GetBufInfo cannot get current pos" ); return( i_buffer_limit ); } @@ -302,18 +291,18 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) + p_aout->p_sys->l_write_position); #if 0 - msg_Dbg( p_aout, "aout_GetBufInfo: %i", i_result); + msg_Dbg( p_aout, "GetBufInfo: %i", i_result); #endif return l_result; } /***************************************************************************** - * aout_Play: play a sound buffer + * Play: play a sound buffer ***************************************************************************** * This function writes a buffer of i_length bytes * Don't forget that DirectSound buffers are circular buffers. *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { VOID *p_write_position, *p_start_buffer; long l_bytes1, l_bytes2, l_play_position; @@ -336,7 +325,7 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) p_aout->p_sys->l_write_position = 0; } - msg_Warn( p_aout, "aout_Play underflow" ); + msg_Warn( p_aout, "Play underflow" ); /* reinitialise the underflow detection counters */ p_aout->p_sys->b_buffer_underflown = 0; p_aout->p_sys->l_data_written_from_beginning = 0; @@ -382,7 +371,7 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } if( dsresult != DS_OK ) { - msg_Warn( p_aout, "aout_Play cannot lock buffer" ); + msg_Warn( p_aout, "Play cannot lock buffer" ); vlc_mutex_unlock( &p_aout->p_sys->buffer_lock ); return; } @@ -420,19 +409,20 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } if( dsresult != DS_OK ) { - msg_Warn( p_aout, "aout_Play cannot play buffer" ); + msg_Warn( p_aout, "Play cannot play buffer" ); return; } } /***************************************************************************** - * aout_Close: close the audio device + * CloseAudio: close the audio device *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +void E_(CloseAudio) ( vlc_object_t *p_this ) { + aout_thread_t * p_aout = (aout_thread_t *)p_this; - msg_Dbg( p_aout, "aout_Close" ); + msg_Dbg( p_aout, "Close" ); /* kill the position notification thread, if any */ vlc_object_detach_all( p_aout->p_sys->p_notif ); @@ -742,7 +732,7 @@ static void DirectSoundThread( notification_thread_t *p_notif ) } if( dsresult != DS_OK ) { - msg_Warn( p_notif, "aout_Play cannot lock buffer" ); + msg_Warn( p_notif, "Play cannot lock buffer" ); vlc_mutex_unlock( &p_aout->p_sys->buffer_lock ); return; } diff --git a/plugins/directx/directx.c b/plugins/directx/directx.c index 76284e0d1a..f2c68e8102 100644 --- a/plugins/directx/directx.c +++ b/plugins/directx/directx.c @@ -2,7 +2,7 @@ * directx.c : Windows DirectX plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: directx.c,v 1.11 2002/06/01 12:31:58 sam Exp $ + * $Id: directx.c,v 1.12 2002/07/31 20:56:51 sam Exp $ * * Authors: Gildas Bazin * @@ -30,13 +30,16 @@ #include /***************************************************************************** - * Capabilities defined in the other files. + * External prototypes *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ); -void _M( vout_getfunctions )( function_list_t * p_function_list ); +int E_(OpenVideo) ( vlc_object_t * ); +void E_(CloseVideo) ( vlc_object_t * ); + +int E_(OpenAudio) ( vlc_object_t * ); +void E_(CloseAudio) ( vlc_object_t * ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ #define HW_YUV_TEXT N_("use hardware YUV->RGB conversions") #define HW_YUV_LONGTEXT N_( \ @@ -49,27 +52,24 @@ void _M( vout_getfunctions )( function_list_t * p_function_list ); "more hardware acceleration (like rescaling or YUV->RGB conversions). " \ "This option doesn't have any effect when using overlays." ) -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Video"), NULL ) -ADD_BOOL ( "directx-hw-yuv", 1, NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT ) -ADD_BOOL ( "directx-use-sysmem", 0, NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("DirectX extension module") ) - ADD_CAPABILITY( AOUT, 150 ) - ADD_CAPABILITY( VOUT, 150 ) -MODULE_INIT_STOP +vlc_module_begin(); + add_category_hint( N_("Video"), NULL ); + add_bool( "directx-hw-yuv", 1, NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT ); + add_bool( "directx-use-sysmem", 0, NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT ); + set_description( _("DirectX extension module") ) + add_submodule(); + set_capability( "video output", 150 ); + set_callbacks( E_(OpenVideo), E_(CloseVideo) ); + add_submodule(); + set_capability( "audio output", 150 ); + set_callbacks( E_(OpenAudio), E_(CloseAudio) ); +vlc_module_end(); -MODULE_ACTIVATE_START - _M( aout_getfunctions )( &p_module->p_functions->aout ); - _M( vout_getfunctions )( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START +#if 0 /* FIXME */ /* check if we registered a window class because we need to * unregister it */ WNDCLASS wndclass; if( GetClassInfo( GetModuleHandle(NULL), "VLC DirectX", &wndclass ) ) UnregisterClass( "VLC DirectX", GetModuleHandle(NULL) ); -MODULE_DEACTIVATE_STOP +#endif + diff --git a/plugins/directx/vout_directx.c b/plugins/directx/vout_directx.c index fcab2c86c4..dcc46dc13e 100644 --- a/plugins/directx/vout_directx.c +++ b/plugins/directx/vout_directx.c @@ -2,7 +2,7 @@ * vout_directx.c: Windows DirectX video output display method ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: vout_directx.c,v 1.41 2002/07/29 19:07:00 gbazin Exp $ + * $Id: vout_directx.c,v 1.42 2002/07/31 20:56:51 sam Exp $ * * Authors: Gildas Bazin * @@ -60,13 +60,10 @@ DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x /***************************************************************************** * Local prototypes. *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Display ( vout_thread_t *, picture_t * ); static int NewPictureVec ( vout_thread_t *, picture_t *, int ); static void FreePictureVec ( vout_thread_t *, picture_t *, int ); @@ -85,27 +82,14 @@ static void DirectXGetDDrawCaps ( vout_thread_t *p_vout ); static int DirectXGetSurfaceDesc ( picture_t *p_pic ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( vout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocate DirectX video thread output method + * OpenVideo: allocate DirectX video thread output method ***************************************************************************** * This function allocates and initialize the DirectX vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +int E_(OpenVideo) ( vlc_object_t *p_this ) { + vout_thread_t * p_vout = (vout_thread_t *)p_this; + /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) @@ -115,6 +99,12 @@ static int vout_Create( vout_thread_t *p_vout ) } /* Initialisations */ + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = NULL; + p_vout->pf_display = Display; + p_vout->p_sys->p_ddobject = NULL; p_vout->p_sys->p_display = NULL; p_vout->p_sys->p_current_surface = NULL; @@ -182,18 +172,18 @@ static int vout_Create( vout_thread_t *p_vout ) return 0; error: - vout_Destroy( p_vout ); + Destroy( p_vout ); return 1; } /***************************************************************************** - * vout_Init: initialize DirectX video thread output method + * Init: initialize DirectX video thread output method ***************************************************************************** * This function create the directx surfaces needed by the output thread. * It is called at the beginning of the thread. *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_chroma_backup; @@ -268,25 +258,27 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Sys video thread output method + * End: terminate Sys video thread output method ***************************************************************************** - * Terminate an output method created by vout_Create. + * Terminate an output method created by Create. * It is called at the end of the thread. *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { FreePictureVec( p_vout, p_vout->p_picture, I_OUTPUTPICTURES ); return; } /***************************************************************************** - * vout_Destroy: destroy Sys video thread output method + * CloseVideo: destroy Sys video thread output method ***************************************************************************** - * Terminate an output method created by vout_Create + * Terminate an output method created by Create *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) -{ - msg_Dbg( p_vout, "vout_Destroy" ); +void E_(CloseVideo) ( vlc_object_t *p_this ) +{ + vout_thread_t * p_vout = (vout_thread_t *)p_this; + + msg_Dbg( p_vout, "CloseVideo" ); DirectXCloseDisplay( p_vout ); DirectXCloseDDraw( p_vout ); @@ -315,12 +307,12 @@ static void vout_Destroy( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Manage: handle Sys events + * Manage: handle Sys events ***************************************************************************** * This function should be called regularly by the video output thread. * It returns a non null value if an error occured. *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) +static int Manage( vout_thread_t *p_vout ) { WINDOWPLACEMENT window_placement; @@ -412,20 +404,12 @@ static int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Render: render previously calculated output - *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - -/***************************************************************************** - * vout_Display: displays previously rendered output + * Display: displays previously rendered output ***************************************************************************** * This function sends the currently rendered image to the display, wait until * it is displayed and switch the two rendering buffers, preparing next frame. *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void Display( vout_thread_t *p_vout, picture_t *p_pic ) { HRESULT dxresult; @@ -828,7 +812,7 @@ static int DirectXCreateSurface( vout_thread_t *p_vout, ***************************************************************************** * This function is used to move or resize an overlay surface on the screen. * Ususally the overlay is moved by the user and thus, by a move or resize - * event (in vout_Manage). + * event (in Manage). *****************************************************************************/ void DirectXUpdateOverlay( vout_thread_t *p_vout ) { diff --git a/plugins/downmix/Makefile b/plugins/downmix/Makefile index 33723b4862..190a26667e 100644 --- a/plugins/downmix/Makefile +++ b/plugins/downmix/Makefile @@ -1,3 +1,3 @@ downmix_SOURCES = downmix.c ac3_downmix_c.c -downmixsse_SOURCES = downmixsse.c ac3_downmix_sse.c -downmix3dn_SOURCES = downmix3dn.c ac3_downmix_3dn.c +downmixsse_SOURCES = downmix.c ac3_downmix_sse.c +downmix3dn_SOURCES = downmix.c ac3_downmix_3dn.c diff --git a/plugins/downmix/ac3_downmix_3dn.c b/plugins/downmix/ac3_downmix_3dn.c index 3559636d13..7543da3b24 100644 --- a/plugins/downmix/ac3_downmix_3dn.c +++ b/plugins/downmix/ac3_downmix_3dn.c @@ -2,7 +2,7 @@ * ac3_downmix_3dn.c: accelerated 3D Now! ac3 downmix functions ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: ac3_downmix_3dn.c,v 1.11 2002/06/01 12:31:58 sam Exp $ + * $Id: ac3_downmix_3dn.c,v 1.12 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * @@ -30,7 +30,7 @@ static const float sqrt2_3dn __asm__ ("sqrt2_3dn") = 0.7071068; -void _M( downmix_3f_2r_to_2ch ) (float * samples, dm_par_t * dm_par) +void E_( downmix_3f_2r_to_2ch ) (float * samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -76,7 +76,7 @@ void _M( downmix_3f_2r_to_2ch ) (float * samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t * dm_par) +void E_( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -115,7 +115,7 @@ void _M( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) +void E_( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -159,7 +159,7 @@ void _M( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) +void E_( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -196,7 +196,7 @@ void _M( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t * dm_par) +void E_( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -233,7 +233,7 @@ void _M( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( stream_sample_1ch_to_s16 ) (s16 *s16_samples, float *left) +void E_( stream_sample_1ch_to_s16 ) (s16 *s16_samples, float *left) { __asm__ __volatile__ ( ".align 16\n" @@ -268,7 +268,7 @@ void _M( stream_sample_1ch_to_s16 ) (s16 *s16_samples, float *left) : "a" (s16_samples), "c" (left)); } -void _M( stream_sample_2ch_to_s16 ) (s16 *s16_samples, float *left, float *right) +void E_( stream_sample_2ch_to_s16 ) (s16 *s16_samples, float *left, float *right) { __asm__ __volatile__ ( diff --git a/plugins/downmix/ac3_downmix_c.c b/plugins/downmix/ac3_downmix_c.c index 75311dbb21..40c891dfee 100644 --- a/plugins/downmix/ac3_downmix_c.c +++ b/plugins/downmix/ac3_downmix_c.c @@ -2,7 +2,7 @@ * ac3_downmix_c.c: ac3 downmix functions in C ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: ac3_downmix_c.c,v 1.5 2002/06/01 12:31:58 sam Exp $ + * $Id: ac3_downmix_c.c,v 1.6 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -31,7 +31,7 @@ #include "ac3_downmix.h" -void _M( downmix_3f_2r_to_2ch ) (float *samples, dm_par_t *dm_par) +void E_( downmix_3f_2r_to_2ch ) (float *samples, dm_par_t *dm_par) { int i; float *left, *right, *center, *left_sur, *right_sur; @@ -51,7 +51,7 @@ void _M( downmix_3f_2r_to_2ch ) (float *samples, dm_par_t *dm_par) } } -void _M( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t *dm_par) +void E_( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t *dm_par) { int i; float *left, *right, *left_sur, *right_sur; @@ -70,7 +70,7 @@ void _M( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t *dm_par) } } -void _M( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t *dm_par) +void E_( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t *dm_par) { int i; float *left, *right, *center, *right_sur; @@ -90,7 +90,7 @@ void _M( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t *dm_par) } -void _M( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t *dm_par) +void E_( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t *dm_par) { int i; float *left, *right, *right_sur; @@ -109,7 +109,7 @@ void _M( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t *dm_par) } -void _M( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t *dm_par) +void E_( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t *dm_par) { int i; float *left, *right, *center; @@ -128,7 +128,7 @@ void _M( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t *dm_par) } -void _M( stream_sample_2ch_to_s16 ) (s16 *out_buf, float *left, float *right) +void E_( stream_sample_2ch_to_s16 ) (s16 *out_buf, float *left, float *right) { int i; for (i=0; i < 256; i++) { @@ -138,7 +138,7 @@ void _M( stream_sample_2ch_to_s16 ) (s16 *out_buf, float *left, float *right) } -void _M( stream_sample_1ch_to_s16 ) (s16 *out_buf, float *center) +void E_( stream_sample_1ch_to_s16 ) (s16 *out_buf, float *center) { int i; float tmp; diff --git a/plugins/downmix/ac3_downmix_common.h b/plugins/downmix/ac3_downmix_common.h index 305cdb462f..870225fc8e 100644 --- a/plugins/downmix/ac3_downmix_common.h +++ b/plugins/downmix/ac3_downmix_common.h @@ -2,7 +2,7 @@ * ac3_downmix_common.h: ac3 downmix functions headers ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: ac3_downmix_common.h,v 1.1 2001/05/15 16:19:42 sam Exp $ + * $Id: ac3_downmix_common.h,v 1.2 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -22,11 +22,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -void _M( downmix_3f_2r_to_2ch ) ( float *, dm_par_t * ); -void _M( downmix_2f_2r_to_2ch ) ( float *, dm_par_t * ); -void _M( downmix_3f_1r_to_2ch ) ( float *, dm_par_t * ); -void _M( downmix_2f_1r_to_2ch ) ( float *, dm_par_t * ); -void _M( downmix_3f_0r_to_2ch ) ( float *, dm_par_t * ); -void _M( stream_sample_2ch_to_s16 ) ( s16 *, float *, float * ); -void _M( stream_sample_1ch_to_s16 ) ( s16 *, float * ); +void E_( downmix_3f_2r_to_2ch ) ( float *, dm_par_t * ); +void E_( downmix_2f_2r_to_2ch ) ( float *, dm_par_t * ); +void E_( downmix_3f_1r_to_2ch ) ( float *, dm_par_t * ); +void E_( downmix_2f_1r_to_2ch ) ( float *, dm_par_t * ); +void E_( downmix_3f_0r_to_2ch ) ( float *, dm_par_t * ); +void E_( stream_sample_2ch_to_s16 ) ( s16 *, float *, float * ); +void E_( stream_sample_1ch_to_s16 ) ( s16 *, float * ); diff --git a/plugins/downmix/ac3_downmix_sse.c b/plugins/downmix/ac3_downmix_sse.c index 585c0c4e50..60a6d9d81d 100644 --- a/plugins/downmix/ac3_downmix_sse.c +++ b/plugins/downmix/ac3_downmix_sse.c @@ -2,7 +2,7 @@ * ac3_downmix_sse.c: accelerated SSE ac3 downmix functions ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: ac3_downmix_sse.c,v 1.11 2002/06/01 12:31:58 sam Exp $ + * $Id: ac3_downmix_sse.c,v 1.12 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -31,7 +31,7 @@ static const float sqrt2_sse __asm__ ("sqrt2_sse") __attribute__ ((aligned (16))) = 0.7071068; -void _M( downmix_3f_2r_to_2ch ) (float * samples, dm_par_t * dm_par) +void E_( downmix_3f_2r_to_2ch ) (float * samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -76,7 +76,7 @@ void _M( downmix_3f_2r_to_2ch ) (float * samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t * dm_par) +void E_( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -114,7 +114,7 @@ void _M( downmix_2f_2r_to_2ch ) (float *samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) +void E_( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -157,7 +157,7 @@ void _M( downmix_3f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) +void E_( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -193,7 +193,7 @@ void _M( downmix_2f_1r_to_2ch ) (float *samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t * dm_par) +void E_( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t * dm_par) { __asm__ __volatile__ ( ".align 16\n" @@ -229,7 +229,7 @@ void _M( downmix_3f_0r_to_2ch ) (float *samples, dm_par_t * dm_par) : "a" (samples), "c" (dm_par)); } -void _M( stream_sample_1ch_to_s16 ) (s16 *s16_samples, float *left) +void E_( stream_sample_1ch_to_s16 ) (s16 *s16_samples, float *left) { __asm__ __volatile__ ( ".align 16\n" @@ -268,7 +268,7 @@ void _M( stream_sample_1ch_to_s16 ) (s16 *s16_samples, float *left) : "a" (s16_samples), "c" (left)); } -void _M( stream_sample_2ch_to_s16 ) (s16 *s16_samples, float *left, float *right) +void E_( stream_sample_2ch_to_s16 ) (s16 *s16_samples, float *left, float *right) { __asm__ __volatile__ ( ".align 16\n" diff --git a/plugins/downmix/downmix.c b/plugins/downmix/downmix.c index fb29253227..70df34cc82 100644 --- a/plugins/downmix/downmix.c +++ b/plugins/downmix/downmix.c @@ -2,7 +2,7 @@ * downmix.c : AC3 downmix module ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: downmix.c,v 1.9 2002/06/01 12:31:58 sam Exp $ + * $Id: downmix.c,v 1.10 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * @@ -33,45 +33,41 @@ #include "ac3_downmix_common.h" /***************************************************************************** - * Local and extern prototypes. + * Module initializer *****************************************************************************/ -static void downmix_getfunctions( function_list_t * p_function_list ); - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("AC3 downmix module") ) - ADD_CAPABILITY( DOWNMIX, 50 ) - ADD_SHORTCUT( "c" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - downmix_getfunctions( &p_module->p_functions->downmix ); -MODULE_ACTIVATE_STOP +static int Open ( vlc_object_t *p_this ) +{ + downmix_t *p_downmix = (downmix_t *)p_this; -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + p_downmix->pf_downmix_3f_2r_to_2ch = E_( downmix_3f_2r_to_2ch ); + p_downmix->pf_downmix_3f_1r_to_2ch = E_( downmix_3f_1r_to_2ch ); + p_downmix->pf_downmix_2f_2r_to_2ch = E_( downmix_2f_2r_to_2ch ); + p_downmix->pf_downmix_2f_1r_to_2ch = E_( downmix_2f_1r_to_2ch ); + p_downmix->pf_downmix_3f_0r_to_2ch = E_( downmix_3f_0r_to_2ch ); + p_downmix->pf_stream_sample_2ch_to_s16 = E_( stream_sample_2ch_to_s16 ); + p_downmix->pf_stream_sample_1ch_to_s16 = E_( stream_sample_1ch_to_s16 ); -/* Following functions are local */ + return VLC_SUCCESS; +} /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void downmix_getfunctions( function_list_t * p_function_list ) -{ -#define F p_function_list->functions.downmix - F.pf_downmix_3f_2r_to_2ch = _M( downmix_3f_2r_to_2ch ); - F.pf_downmix_3f_1r_to_2ch = _M( downmix_3f_1r_to_2ch ); - F.pf_downmix_2f_2r_to_2ch = _M( downmix_2f_2r_to_2ch ); - F.pf_downmix_2f_1r_to_2ch = _M( downmix_2f_1r_to_2ch ); - F.pf_downmix_3f_0r_to_2ch = _M( downmix_3f_0r_to_2ch ); - F.pf_stream_sample_2ch_to_s16 = _M( stream_sample_2ch_to_s16 ); - F.pf_stream_sample_1ch_to_s16 = _M( stream_sample_1ch_to_s16 ); -#undef F -} +vlc_module_begin(); +#ifdef MODULE_NAME_IS_downmix + set_description( _("AC3 downmix module") ); + set_capability( "downmix", 50 ); + add_shortcut( "c" ); +#elif defined( MODULE_NAME_IS_downmixsse ) + set_description( _("SSE AC3 downmix module") ); + set_capability( "downmix", 200 ); + add_shortcut( "sse" ); +#elif defined( MODULE_NAME_IS_downmix3dn ) + set_description( _("3D Now! AC3 downmix module") ); + set_capability( "downmix", 200 ); + add_shortcut( "3dn" ); + add_shortcut( "3dnow" ); +#endif + set_callbacks( Open, NULL ); +vlc_module_end(); diff --git a/plugins/downmix/downmix3dn.c b/plugins/downmix/downmix3dn.c deleted file mode 100644 index 463d95c1f7..0000000000 --- a/plugins/downmix/downmix3dn.c +++ /dev/null @@ -1,79 +0,0 @@ -/***************************************************************************** - * downmix3dn.c : accelerated 3D Now! AC3 downmix module - ***************************************************************************** - * Copyright (C) 1999-2001 VideoLAN - * $Id: downmix3dn.c,v 1.10 2002/06/01 12:31:58 sam Exp $ - * - * Authors: Renaud Dartus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include -#include - -#include - -#include "ac3_downmix.h" -#include "ac3_downmix_common.h" - -/***************************************************************************** - * Local and extern prototypes. - *****************************************************************************/ -static void downmix_getfunctions( function_list_t * p_function_list ); - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("3D Now! AC3 downmix module") ) - ADD_CAPABILITY( DOWNMIX, 200 ) - ADD_REQUIREMENT( 3DNOW ) - ADD_SHORTCUT( "3dn" ) - ADD_SHORTCUT( "3dnow" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - downmix_getfunctions( &p_module->p_functions->downmix ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void downmix_getfunctions( function_list_t * p_function_list ) -{ -#define F p_function_list->functions.downmix - F.pf_downmix_3f_2r_to_2ch = _M( downmix_3f_2r_to_2ch ); - F.pf_downmix_3f_1r_to_2ch = _M( downmix_3f_1r_to_2ch ); - F.pf_downmix_2f_2r_to_2ch = _M( downmix_2f_2r_to_2ch ); - F.pf_downmix_2f_1r_to_2ch = _M( downmix_2f_1r_to_2ch ); - F.pf_downmix_3f_0r_to_2ch = _M( downmix_3f_0r_to_2ch ); - F.pf_stream_sample_2ch_to_s16 = _M( stream_sample_2ch_to_s16 ); - F.pf_stream_sample_1ch_to_s16 = _M( stream_sample_1ch_to_s16 ); -#undef F -} - diff --git a/plugins/downmix/downmixsse.c b/plugins/downmix/downmixsse.c deleted file mode 100644 index a2651e994c..0000000000 --- a/plugins/downmix/downmixsse.c +++ /dev/null @@ -1,78 +0,0 @@ -/***************************************************************************** - * downmixsse.c : accelerated SSE AC3 downmix module - ***************************************************************************** - * Copyright (C) 1999-2001 VideoLAN - * $Id: downmixsse.c,v 1.10 2002/06/01 12:31:58 sam Exp $ - * - * Authors: Renaud Dartus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include -#include - -#include - -#include "ac3_downmix.h" -#include "ac3_downmix_common.h" - -/***************************************************************************** - * Local and extern prototypes. - *****************************************************************************/ -static void downmix_getfunctions( function_list_t * p_function_list ); - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("SSE AC3 downmix module") ) - ADD_CAPABILITY( DOWNMIX, 200 ) - ADD_REQUIREMENT( SSE ) - ADD_SHORTCUT( "sse" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - downmix_getfunctions( &p_module->p_functions->downmix ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void downmix_getfunctions( function_list_t * p_function_list ) -{ -#define F p_function_list->functions.downmix - F.pf_downmix_3f_2r_to_2ch = _M( downmix_3f_2r_to_2ch ); - F.pf_downmix_3f_1r_to_2ch = _M( downmix_3f_1r_to_2ch ); - F.pf_downmix_2f_2r_to_2ch = _M( downmix_2f_2r_to_2ch ); - F.pf_downmix_2f_1r_to_2ch = _M( downmix_2f_1r_to_2ch ); - F.pf_downmix_3f_0r_to_2ch = _M( downmix_3f_0r_to_2ch ); - F.pf_stream_sample_2ch_to_s16 = _M( stream_sample_2ch_to_s16 ); - F.pf_stream_sample_1ch_to_s16 = _M( stream_sample_1ch_to_s16 ); -#undef F -} - diff --git a/plugins/dsp/dsp.c b/plugins/dsp/dsp.c index d338dfb7a2..2b2701e35e 100644 --- a/plugins/dsp/dsp.c +++ b/plugins/dsp/dsp.c @@ -2,7 +2,7 @@ * dsp.c : OSS /dev/dsp module for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: dsp.c,v 1.18 2002/07/20 18:01:42 sam Exp $ + * $Id: dsp.c,v 1.19 2002/07/31 20:56:51 sam Exp $ * * Authors: Michel Kaempf * Samuel Hocevar @@ -61,60 +61,36 @@ struct aout_sys_t }; /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void aout_getfunctions ( function_list_t * ); -static int aout_Open ( aout_thread_t * ); -static int aout_SetFormat ( aout_thread_t * ); -static int aout_GetBufInfo ( aout_thread_t *, int ); -static void aout_Play ( aout_thread_t *, byte_t *, int ); -static void aout_Close ( aout_thread_t * ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); -/***************************************************************************** - * Capabilities defined in the other files. - *****************************************************************************/ +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_FILE ( "dspdev", "/dev/dsp", NULL, N_("OSS dsp device"), NULL ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Linux OSS /dev/dsp module") ) - ADD_CAPABILITY( AOUT, 100 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - aout_getfunctions( &p_module->p_functions->aout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_file( "dspdev", "/dev/dsp", NULL, N_("OSS dsp device"), NULL ); + set_description( _("Linux OSS /dev/dsp module") ); + set_capability( "audio output", 100 ); + set_callbacks( Open, Close ); +vlc_module_end(); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void aout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} - -/***************************************************************************** - * aout_Open: opens the audio device (the digital sound processor) + * Open: opens the audio device (the digital sound processor) ***************************************************************************** * This function opens the dsp as a usual non-blocking write-only file, and * modifies the p_aout->p_sys->i_fd with the file's descriptor. *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) +static int Open( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; + /* Allocate structure */ p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); if( p_aout->p_sys == NULL ) @@ -131,6 +107,10 @@ static int aout_Open( aout_thread_t *p_aout ) return( -1 ); } + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + /* Open the sound device */ if( (p_aout->p_sys->i_fd = open( p_aout->p_sys->psz_device, O_WRONLY )) < 0 ) @@ -146,14 +126,14 @@ static int aout_Open( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_SetFormat: resets the dsp and sets its format + * SetFormat: resets the dsp and sets its format ***************************************************************************** * This functions resets the DSP device, tries to initialize the output * format with the value contained in the dsp structure, and if this value * could not be set, the default value returned by ioctl is set. It then * does the same for the stereo mode, and for the output rate. *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { int i_format; int i_rate; @@ -219,7 +199,7 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_GetBufInfo: buffer status query + * GetBufInfo: buffer status query ***************************************************************************** * This function fills in the audio_buf_info structure : * - returns : number of available fragments (not partially used ones) @@ -228,7 +208,7 @@ static int aout_SetFormat( aout_thread_t *p_aout ) * - int bytes : available space in bytes (includes partially used fragments) * Note! 'bytes' could be more than fragments*fragsize *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_GETOSPACE, &p_aout->p_sys->audio_buf ); @@ -240,11 +220,11 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) } /***************************************************************************** - * aout_Play: plays a sound samples buffer + * Play: plays a sound samples buffer ***************************************************************************** * This function writes a buffer of i_length bytes in the dsp *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { int i_tmp; i_tmp = write( p_aout->p_sys->i_fd, buffer, i_size ); @@ -256,10 +236,12 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } /***************************************************************************** - * aout_Close: closes the dsp audio device + * Close: closes the dsp audio device *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +static void Close( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; + close( p_aout->p_sys->i_fd ); free( p_aout->p_sys->psz_device ); } diff --git a/plugins/dummy/aout_dummy.c b/plugins/dummy/aout_dummy.c index bccf14dfdc..a58ff6b6d5 100644 --- a/plugins/dummy/aout_dummy.c +++ b/plugins/dummy/aout_dummy.c @@ -2,7 +2,7 @@ * aout_dummy.c : dummy audio output plugin ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: aout_dummy.c,v 1.22 2002/07/20 18:01:42 sam Exp $ + * $Id: aout_dummy.c,v 1.23 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -29,77 +29,47 @@ #include #include -/***************************************************************************** - * vout_dummy_t: dummy video output method descriptor - ***************************************************************************** - * This structure is part of the video output thread descriptor. - * It describes the dummy specific properties of an output thread. - *****************************************************************************/ -struct aout_sys_t -{ - /* Prevent malloc(0) */ - int i_dummy; -}; - /***************************************************************************** * Local prototypes. *****************************************************************************/ -static int aout_Open ( aout_thread_t *p_aout ); -static int aout_SetFormat ( aout_thread_t *p_aout ); -static int aout_GetBufInfo ( aout_thread_t *p_aout, int i_buffer_info ); -static void aout_Play ( aout_thread_t *p_aout, - byte_t *buffer, int i_size ); -static void aout_Close ( aout_thread_t *p_aout ); +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * OpenAudio: opens a dummy audio device *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ) +int E_(OpenAudio) ( vlc_object_t *p_this ) { - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} + aout_thread_t * p_aout = (aout_thread_t *)p_this; -/***************************************************************************** - * aout_Open: opens a dummy audio device - *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) -{ - return( 0 ); + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + + return VLC_SUCCESS; } /***************************************************************************** - * aout_SetFormat: pretends to set the dsp output format + * SetFormat: pretends to set the dsp output format *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { return( 0 ); } /***************************************************************************** - * aout_GetBufInfo: returns available bytes in buffer + * GetBufInfo: returns available bytes in buffer *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { return( sizeof(s16) * i_buffer_limit + 1 ); /* value big enough to sleep */ } /***************************************************************************** - * aout_Play: pretends to play a sound - *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) -{ - ; -} - -/***************************************************************************** - * aout_Close: closes the dummy audio device + * Play: pretends to play a sound *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { ; } diff --git a/plugins/dummy/dec_dummy.c b/plugins/dummy/dec_dummy.c index 9d65097287..a1f17e41ae 100644 --- a/plugins/dummy/dec_dummy.c +++ b/plugins/dummy/dec_dummy.c @@ -2,7 +2,7 @@ * dec_dummy.c: dummy decoder plugin for vlc. ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: dec_dummy.c,v 1.1 2002/07/23 20:15:41 sam Exp $ + * $Id: dec_dummy.c,v 1.2 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -40,26 +40,18 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static int Probe ( vlc_fourcc_t * ); -static int Run ( decoder_fifo_t * ); +static int Run ( decoder_fifo_t * ); /***************************************************************************** - * Capabilities - *****************************************************************************/ -void _M( dec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = Probe; - p_function_list->functions.dec.pf_run = Run; -} - -/***************************************************************************** - * Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score ***************************************************************************** * Always returns 0 because we are the dummy decoder! *****************************************************************************/ -static int Probe( vlc_fourcc_t *pi_type ) +int E_(OpenDecoder) ( vlc_object_t *p_this ) { - return 0; + ((decoder_fifo_t*)p_this)->pf_run = Run; + + return VLC_SUCCESS; } /***************************************************************************** diff --git a/plugins/dummy/dummy.c b/plugins/dummy/dummy.c index a2a8c51d29..1c8707c854 100644 --- a/plugins/dummy/dummy.c +++ b/plugins/dummy/dummy.c @@ -2,7 +2,7 @@ * dummy.c : dummy plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: dummy.c,v 1.23 2002/07/23 20:15:41 sam Exp $ + * $Id: dummy.c,v 1.24 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -29,18 +29,10 @@ #include -/***************************************************************************** - * Capabilities defined in the other files. - *****************************************************************************/ -void _M( access_getfunctions ) ( function_list_t * p_function_list ); -void _M( demux_getfunctions ) ( function_list_t * p_function_list ); -void _M( aout_getfunctions ) ( function_list_t * p_function_list ); -void _M( vout_getfunctions ) ( function_list_t * p_function_list ); -void _M( intf_getfunctions ) ( function_list_t * p_function_list ); -void _M( dec_getfunctions ) ( function_list_t * p_function_list ); +#include "dummy.h" /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define CHROMA_TEXT N_("dummy image chroma format") #define CHROMA_LONGTEXT N_( \ @@ -48,36 +40,28 @@ void _M( dec_getfunctions ) ( function_list_t * p_function_list ); "format instead of trying to improve performances by using the most " \ "efficient one.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Video"), NULL ) -ADD_STRING ( "dummy-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT ) -MODULE_CONFIG_STOP - - -MODULE_INIT_START - SET_DESCRIPTION( _("dummy functions module") ) - /* Capability score set to 0 because we don't want to be spawned - * unless explicitly requested to */ - ADD_CAPABILITY( INTF, 0 ) - ADD_CAPABILITY( ACCESS, 0 ) - ADD_CAPABILITY( DEMUX, 0 ) - ADD_CAPABILITY( DECODER, 0 ) - ADD_CAPABILITY( AOUT, 0 ) - ADD_CAPABILITY( VOUT, 0 ) - ADD_SHORTCUT( "vlc" ) -MODULE_INIT_STOP - - -MODULE_ACTIVATE_START - _M( access_getfunctions )( &p_module->p_functions->access ); - _M( demux_getfunctions )( &p_module->p_functions->demux ); - _M( aout_getfunctions )( &p_module->p_functions->aout ); - _M( vout_getfunctions )( &p_module->p_functions->vout ); - _M( intf_getfunctions )( &p_module->p_functions->intf ); - _M( dec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("dummy functions module") ); + add_shortcut( "vlc" ); + add_submodule(); + set_capability( "interface", 0 ); + set_callbacks( E_(OpenIntf), NULL ); + add_submodule(); + set_capability( "access", 0 ); + set_callbacks( E_(OpenAccess), NULL ); + add_submodule(); + set_capability( "demux", 0 ); + set_callbacks( E_(OpenDemux), E_(CloseDemux) ); + add_submodule(); + set_capability( "decoder", 0 ); + set_callbacks( E_(OpenDecoder), NULL ); + add_submodule(); + set_capability( "audio output", 0 ); + set_callbacks( E_(OpenAudio), NULL ); + add_submodule(); + set_capability( "video output", 0 ); + set_callbacks( E_(OpenVideo), NULL ); + add_category_hint( N_("Video"), NULL ); + add_string( "dummy-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT ); +vlc_module_end(); diff --git a/plugins/dummy/dummy.h b/plugins/dummy/dummy.h new file mode 100644 index 0000000000..22e47bd33c --- /dev/null +++ b/plugins/dummy/dummy.h @@ -0,0 +1,39 @@ +/***************************************************************************** + * dummy.h : dummy plugin for vlc + ***************************************************************************** + * Copyright (C) 2000, 2001, 2002 VideoLAN + * $Id: dummy.h,v 1.1 2002/07/31 20:56:51 sam Exp $ + * + * Authors: Samuel Hocevar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +/***************************************************************************** + * External prototypes + *****************************************************************************/ +int E_(OpenIntf) ( vlc_object_t * ); + +int E_(OpenAccess) ( vlc_object_t * ); + +int E_(OpenDemux) ( vlc_object_t * ); +void E_(CloseDemux) ( vlc_object_t * ); + +int E_(OpenDecoder) ( vlc_object_t * ); + +int E_(OpenAudio) ( vlc_object_t * ); + +int E_(OpenVideo) ( vlc_object_t * ); + diff --git a/plugins/dummy/input_dummy.c b/plugins/dummy/input_dummy.c index fab47c066a..3abd98b833 100644 --- a/plugins/dummy/input_dummy.c +++ b/plugins/dummy/input_dummy.c @@ -2,7 +2,7 @@ * input_dummy.c: dummy input plugin, to manage "vlc:***" special options ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: input_dummy.c,v 1.20 2002/07/20 18:01:42 sam Exp $ + * $Id: input_dummy.c,v 1.21 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -36,11 +36,7 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static int DummyInit ( input_thread_t * ); -static int DummyOpen ( input_thread_t * ); -static void DummyClose ( input_thread_t * ); -static void DummyEnd ( input_thread_t * ); -static int DummyDemux ( input_thread_t * ); +static int Demux ( input_thread_t * ); /***************************************************************************** * access_sys_t: private input data @@ -60,61 +56,34 @@ struct demux_sys_t #define COMMAND_PAUSE 3 /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * OpenAccess: open the target, ie. do nothing *****************************************************************************/ -void _M( access_getfunctions )( function_list_t * p_function_list ) +int E_(OpenAccess) ( vlc_object_t *p_this ) { -#define input p_function_list->functions.access - input.pf_open = DummyOpen; - input.pf_read = NULL; - input.pf_close = DummyClose; - input.pf_set_program = NULL; - input.pf_set_area = NULL; - input.pf_seek = NULL; -#undef input -} - -void _M( demux_getfunctions )( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.demux - input.pf_init = DummyInit; - input.pf_end = DummyEnd; - input.pf_demux = DummyDemux; - input.pf_rewind = NULL; -#undef input -} + input_thread_t *p_input = (input_thread_t *)p_this; -/***************************************************************************** - * DummyOpen: open the target, ie. do nothing - *****************************************************************************/ -static int DummyOpen( input_thread_t * p_input ) -{ p_input->stream.i_method = INPUT_METHOD_NONE; /* Force dummy demux plug-in */ p_input->psz_demux = "vlc"; - return 0; -} -/***************************************************************************** - * DummyClose: close the target, ie. do nothing - *****************************************************************************/ -static void DummyClose( input_thread_t * p_input ) -{ + return VLC_SUCCESS; } /***************************************************************************** - * DummyInit: initialize the target, ie. parse the command + * OpenDemux: initialize the target, ie. parse the command *****************************************************************************/ -static int DummyInit( input_thread_t *p_input ) +int E_(OpenDemux) ( vlc_object_t *p_this ) { + input_thread_t *p_input = (input_thread_t *)p_this; char * psz_name = p_input->psz_name; int i_len = strlen( psz_name ); struct demux_sys_t * p_method; int i_arg; p_input->stream.b_seekable = 0; + p_input->pf_demux = Demux; + p_input->pf_rewind = NULL; p_method = malloc( sizeof( struct demux_sys_t ) ); if( p_method == NULL ) @@ -168,17 +137,19 @@ static int DummyInit( input_thread_t *p_input ) } /***************************************************************************** - * DummyEnd: end the target, ie. do nothing + * CloseDemux: initialize the target, ie. parse the command *****************************************************************************/ -static void DummyEnd( input_thread_t *p_input ) +void E_(CloseDemux) ( vlc_object_t *p_this ) { + input_thread_t *p_input = (input_thread_t *)p_this; + free( p_input->p_demux_data ); } /***************************************************************************** - * DummyDemux: do what the command says + * Demux: do what the command says *****************************************************************************/ -static int DummyDemux( input_thread_t *p_input ) +static int Demux( input_thread_t *p_input ) { struct demux_sys_t * p_method = p_input->p_demux_data; playlist_t *p_playlist; diff --git a/plugins/dummy/intf_dummy.c b/plugins/dummy/intf_dummy.c index 54fa2c586d..0c6bc8effa 100644 --- a/plugins/dummy/intf_dummy.c +++ b/plugins/dummy/intf_dummy.c @@ -2,7 +2,7 @@ * intf_dummy.c: dummy interface plugin ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: intf_dummy.c,v 1.21 2002/07/20 18:01:42 sam Exp $ + * $Id: intf_dummy.c,v 1.22 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -30,45 +30,17 @@ #include #include -/***************************************************************************** - * intf_sys_t: description and status of FB interface - *****************************************************************************/ -struct intf_sys_t -{ - /* Prevent malloc(0) */ - int i_dummy; -}; - /***************************************************************************** * Local prototypes. *****************************************************************************/ -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( intf_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} +static void Run ( intf_thread_t * ); /***************************************************************************** - * intf_Open: initialize dummy interface + * Open: initialize dummy interface *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) +int E_(OpenIntf) ( vlc_object_t *p_this ) { - /* Allocate instance and initialize some members */ - p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); - if( p_intf->p_sys == NULL ) - { - return( 1 ); - }; - + intf_thread_t *p_intf = (intf_thread_t*) p_this; #ifdef WIN32 AllocConsole(); freopen( "CONOUT$", "w", stdout ); @@ -78,23 +50,15 @@ static int intf_Open( intf_thread_t *p_intf ) msg_Info( p_intf, _("\nUsing the dummy interface plugin...") ); #endif - return( 0 ); -} + p_intf->pf_run = Run; -/***************************************************************************** - * intf_Close: destroy dummy interface - *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) -{ - /* Destroy structure */ - free( p_intf->p_sys ); + return VLC_SUCCESS; } - /***************************************************************************** - * intf_Run: main loop + * Run: main loop *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { while( !p_intf->b_die ) { diff --git a/plugins/dummy/null.c b/plugins/dummy/null.c index 51d0904004..d86c070ced 100644 --- a/plugins/dummy/null.c +++ b/plugins/dummy/null.c @@ -2,7 +2,7 @@ * null.c : NULL module for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: null.c,v 1.7 2002/06/01 12:31:58 sam Exp $ + * $Id: null.c,v 1.8 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -24,41 +24,12 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include /* strdup() */ - #include /***************************************************************************** - * Build configuration tree. + * Module descriptor. *****************************************************************************/ -MODULE_CONFIG_START - /* ADD_PANE( "First pane" ) - ADD_SUBCATEGORY_HINT( "First frame" ) - - ADD_STRING( "Random text: ", MODULE_VAR(text), NULL ) - ADD_SUBCATEGORY_HINT( "Second frame" ) - - ADD_FILE( "Select file: ", MODULE_VAR(file), NULL ) - ADD_SUBCATEGORY_HINT( "Third frame" ) - - ADD_PANE( "Second pane" ) - ADD_SUBCATEGORY_HINT( "Frame" ) - */ -MODULE_CONFIG_STOP - - -MODULE_INIT_START - SET_DESCRIPTION( _("the Null module that does nothing") ) -MODULE_INIT_STOP - - -MODULE_ACTIVATE_START - /* Since the Null module can't do anything, there is no need to - * fill the p_functions structure. */ -MODULE_ACTIVATE_STOP - - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("the module that does nothing") ); +vlc_module_end(); diff --git a/plugins/dummy/vout_dummy.c b/plugins/dummy/vout_dummy.c index d2b11946ec..9867d48384 100644 --- a/plugins/dummy/vout_dummy.c +++ b/plugins/dummy/vout_dummy.c @@ -2,7 +2,7 @@ * vout_dummy.c: Dummy video output display method for testing purposes ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: vout_dummy.c,v 1.26 2002/07/23 00:39:16 sam Exp $ + * $Id: vout_dummy.c,v 1.27 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -35,68 +35,37 @@ #define DUMMY_HEIGHT 16 #define DUMMY_MAX_DIRECTBUFFERS 10 -/***************************************************************************** - * vout_sys_t: dummy video output method descriptor - ***************************************************************************** - * This structure is part of the video output thread descriptor. - * It describes the dummy specific properties of an output thread. - *****************************************************************************/ -struct vout_sys_t -{ - /* Nothing needed here. Maybe stats ? */ - - /* Prevent malloc(0) */ - int i_dummy; -}; - /***************************************************************************** * Local prototypes *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( vout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Render ( vout_thread_t *, picture_t * ); +static void Display ( vout_thread_t *, picture_t * ); /***************************************************************************** - * vout_Create: allocates dummy video thread output method + * OpenVideo: activates dummy video thread output method ***************************************************************************** - * This function allocates and initializes a dummy vout method. + * This function initializes a dummy vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +int E_(OpenVideo) ( vlc_object_t *p_this ) { - /* Allocate structure */ - p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); - if( p_vout->p_sys == NULL ) - { - msg_Err( p_vout, "out of memory" ); - return( 1 ); - } + vout_thread_t * p_vout = (vout_thread_t *)p_this; - return( 0 ); + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = Render; + p_vout->pf_display = Display; + + return VLC_SUCCESS; } /***************************************************************************** - * vout_Init: initialize dummy video thread output method + * Init: initialize dummy video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index, i_chroma; char *psz_chroma; @@ -184,9 +153,9 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate dummy video thread output method + * End: terminate dummy video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -199,38 +168,28 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy dummy video thread output method - ***************************************************************************** - * Terminate an output method created by DummyCreateOutputMethod - *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) -{ - free( p_vout->p_sys ); -} - -/***************************************************************************** - * vout_Manage: handle dummy events + * Manage: handle dummy events ***************************************************************************** * This function should be called regularly by video output thread. It manages * console events. It returns a non null value on error. *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) +static int Manage( vout_thread_t *p_vout ) { return( 0 ); } /***************************************************************************** - * vout_Render: render previously calculated output + * Render: render previously calculated output *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) +static void Render( vout_thread_t *p_vout, picture_t *p_pic ) { /* No need to do anything, the fake direct buffers stay as they are */ } /***************************************************************************** - * vout_Display: displays previously rendered output + * Display: displays previously rendered output *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void Display( vout_thread_t *p_vout, picture_t *p_pic ) { /* No need to do anything, the fake direct buffers stay as they are */ } diff --git a/plugins/dvd/dvd.c b/plugins/dvd/dvd.c index 1948fda211..0751610ecb 100644 --- a/plugins/dvd/dvd.c +++ b/plugins/dvd/dvd.c @@ -2,7 +2,7 @@ * dvd.c : DVD input module for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: dvd.c,v 1.33 2002/07/17 21:28:19 stef Exp $ + * $Id: dvd.c,v 1.34 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -44,15 +44,14 @@ # include "dummy_dvdcss.h" #endif -/***************************************************************************** - * Capabilities defined in the other files. - *****************************************************************************/ -void _M( access_getfunctions)( function_list_t * p_function_list ); -void _M( demux_getfunctions)( function_list_t * p_function_list ); - /***************************************************************************** * Local prototypes. *****************************************************************************/ +int E_(DVDOpen) ( vlc_object_t * ); +void E_(DVDClose) ( vlc_object_t * ); + +int E_(DVDInit) ( vlc_object_t * ); + #ifdef GOD_DAMN_DMCA static void *p_libdvdcss; static void ProbeLibDVDCSS ( void ); @@ -60,38 +59,33 @@ static void UnprobeLibDVDCSS( void ); #endif /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("[dvd:][device][@raw_device][@[title][,[chapter][,angle]]]"), NULL ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - ADD_CAPABILITY( DEMUX, 0 ) +vlc_module_begin(); + int i; + add_category_hint( N_("[dvd:][device][@raw_device][@[title][,[chapter][,angle]]]"), NULL ); #ifdef GOD_DAMN_DMCA - SET_DESCRIPTION( _("DVD input module, uses libdvdcss if present") ) - ADD_CAPABILITY( ACCESS, 90 ) + set_description( _("DVD input module, uses libdvdcss if installed") ); + i = 90; #else - SET_DESCRIPTION( _("DVD input module, uses libdvdcss") ) - ADD_CAPABILITY( ACCESS, 100 ) + set_description( _("DVD input module, uses libdvdcss") ); + i = 100; #endif - ADD_SHORTCUT( "dvdold" ); -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( access_getfunctions)( &p_module->p_functions->access ); - _M( demux_getfunctions)( &p_module->p_functions->demux ); + add_shortcut( "dvdold" ); + add_submodule(); + set_capability( "access", i ); + set_callbacks( E_(DVDOpen), E_(DVDClose) ); + add_submodule(); + set_capability( "demux", 0 ); + set_callbacks( E_(DVDInit), NULL ); #ifdef GOD_DAMN_DMCA ProbeLibDVDCSS(); #endif -MODULE_ACTIVATE_STOP +vlc_module_end(); -MODULE_DEACTIVATE_START -#ifdef GOD_DAMN_DMCA +#if 0 /* FIXME */ UnprobeLibDVDCSS(); #endif -MODULE_DEACTIVATE_STOP - /* Following functions are local */ diff --git a/plugins/dvd/dvd_access.c b/plugins/dvd/dvd_access.c index b6ae7a0bce..735665c1ed 100644 --- a/plugins/dvd/dvd_access.c +++ b/plugins/dvd/dvd_access.c @@ -8,7 +8,7 @@ * -dvd_udf to find files ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: dvd_access.c,v 1.21 2002/07/17 21:28:19 stef Exp $ + * $Id: dvd_access.c,v 1.22 2002/07/31 20:56:51 sam Exp $ * * Author: Stéphane Borel * @@ -69,8 +69,6 @@ *****************************************************************************/ /* called from outside */ -static int DVDOpen ( input_thread_t * ); -static void DVDClose ( input_thread_t * ); static int DVDSetArea ( input_thread_t *, input_area_t * ); static int DVDSetProgram ( input_thread_t *, pgrm_descriptor_t * ); static ssize_t DVDRead ( input_thread_t *, byte_t *, size_t ); @@ -78,22 +76,6 @@ static void DVDSeek ( input_thread_t *, off_t ); static char * DVDParse( input_thread_t * ); -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( access_getfunctions)( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.access - input.pf_open = DVDOpen; - input.pf_close = DVDClose; - input.pf_read = DVDRead; - input.pf_set_area = DVDSetArea; - input.pf_set_program = DVDSetProgram; - input.pf_seek = DVDSeek; -#undef input -} - /* * Data access functions */ @@ -104,8 +86,9 @@ void _M( access_getfunctions)( function_list_t * p_function_list ) /***************************************************************************** * DVDOpen: open dvd *****************************************************************************/ -static int DVDOpen( input_thread_t *p_input ) +int E_(DVDOpen) ( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; char * psz_device; thread_dvd_data_t * p_dvd; input_area_t * p_area; @@ -119,6 +102,11 @@ static int DVDOpen( input_thread_t *p_input ) } p_input->p_access_data = (void *)p_dvd; + p_input->pf_read = DVDRead; + p_input->pf_seek = DVDSeek; + p_input->pf_set_area = DVDSetArea; + p_input->pf_set_program = DVDSetProgram; + /* Parse command line */ if( !( psz_device = DVDParse( p_input ) ) ) { @@ -247,8 +235,9 @@ static int DVDOpen( input_thread_t *p_input ) /***************************************************************************** * DVDClose: close dvd *****************************************************************************/ -static void DVDClose( input_thread_t *p_input ) +void E_(DVDClose) ( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; thread_dvd_data_t *p_dvd = (thread_dvd_data_t*)p_input->p_access_data; IfoDestroy( p_dvd->p_ifo ); @@ -465,7 +454,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) DVDReadAudio( p_input ); DVDReadSPU ( p_input ); - if( p_input->p_demux_module ) + if( p_input->p_demux ) { DVDLaunchDecoders( p_input ); } diff --git a/plugins/dvd/dvd_demux.c b/plugins/dvd/dvd_demux.c index e8153ea9d4..1688d1e3d7 100644 --- a/plugins/dvd/dvd_demux.c +++ b/plugins/dvd/dvd_demux.c @@ -1,7 +1,7 @@ /* dvd_demux.c: DVD demux functions. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: dvd_demux.c,v 1.7 2002/06/01 12:31:58 sam Exp $ + * $Id: dvd_demux.c,v 1.8 2002/07/31 20:56:51 sam Exp $ * * Author: Stéphane Borel * @@ -50,29 +50,10 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ - -/* called from outside */ -static int DVDRewind ( input_thread_t * ); static int DVDDemux ( input_thread_t * ); -static int DVDInit ( input_thread_t * ); -static void DVDEnd ( input_thread_t * ); void DVDLaunchDecoders( input_thread_t * ); -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( demux_getfunctions)( function_list_t * p_function_list ) -{ -#define demux p_function_list->functions.demux - demux.pf_init = DVDInit; - demux.pf_end = DVDEnd; - demux.pf_demux = DVDDemux; - demux.pf_rewind = DVDRewind; -#undef demux -} - /* * Data demux functions */ @@ -80,13 +61,18 @@ void _M( demux_getfunctions)( function_list_t * p_function_list ) /***************************************************************************** * DVDInit: initializes DVD structures *****************************************************************************/ -static int DVDInit( input_thread_t * p_input ) +int E_(DVDInit) ( vlc_object_t *p_this ) { + input_thread_t *p_input = (input_thread_t *)p_this; + if( p_input->stream.i_method != INPUT_METHOD_DVD ) { return -1; } + p_input->pf_demux = DVDDemux; + p_input->pf_rewind = NULL; + vlc_mutex_lock( &p_input->stream.stream_lock ); DVDLaunchDecoders( p_input ); @@ -96,13 +82,6 @@ static int DVDInit( input_thread_t * p_input ) return 0; } -/***************************************************************************** - * DVDEnd: frees unused data - *****************************************************************************/ -static void DVDEnd( input_thread_t * p_input ) -{ -} - /***************************************************************************** * DVDDemux *****************************************************************************/ @@ -131,11 +110,3 @@ static int DVDDemux( input_thread_t * p_input ) return i; } - -/***************************************************************************** - * DVDRewind : reads a stream backward - *****************************************************************************/ -static int DVDRewind( input_thread_t * p_input ) -{ - return( -1 ); -} diff --git a/plugins/dvdplay/access.c b/plugins/dvdplay/access.c index e792bfb5f7..2522e33a3c 100644 --- a/plugins/dvdplay/access.c +++ b/plugins/dvdplay/access.c @@ -2,7 +2,7 @@ * access.c: access capabilities for dvdplay plugin. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: access.c,v 1.2 2002/07/25 20:34:35 stef Exp $ + * $Id: access.c,v 1.3 2002/07/31 20:56:51 sam Exp $ * * Author: Stéphane Borel * @@ -62,44 +62,23 @@ * Local prototypes *****************************************************************************/ /* called from outside */ -static int dvdplay_Open ( input_thread_t * ); -static void dvdplay_Close ( input_thread_t * ); -static int dvdplay_SetArea ( input_thread_t *, - input_area_t * ); -static int dvdplay_SetProgram ( input_thread_t *, - pgrm_descriptor_t * ); -static int dvdplay_Read ( input_thread_t *, - byte_t *, size_t ); +static int dvdplay_SetArea ( input_thread_t *, input_area_t * ); +static int dvdplay_SetProgram ( input_thread_t *, pgrm_descriptor_t * ); +static int dvdplay_Read ( input_thread_t *, byte_t *, size_t ); static void dvdplay_Seek ( input_thread_t *, off_t ); static void pf_vmg_callback ( void*, dvdplay_event_t ); /* only from inside */ - static int dvdNewArea( input_thread_t *, input_area_t * ); static int dvdNewPGC ( input_thread_t * ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( access_getfunctions )( function_list_t * p_function_list ) -{ -#define access p_function_list->functions.access - access.pf_open = dvdplay_Open; - access.pf_close = dvdplay_Close; - access.pf_read = dvdplay_Read; - access.pf_set_area = dvdplay_SetArea; - access.pf_set_program = dvdplay_SetProgram; - access.pf_seek = dvdplay_Seek; -#undef access -} - -/***************************************************************************** - * dvdplay_Open: open libdvdplay + * OpenDVD: open libdvdplay *****************************************************************************/ -static int dvdplay_Open( input_thread_t *p_input ) +int E_(OpenDVD) ( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; char * psz_source; dvd_data_t * p_dvd; input_area_t * p_area; @@ -118,6 +97,11 @@ static int dvdplay_Open( input_thread_t *p_input ) p_input->p_access_data = (void *)p_dvd; + p_input->pf_read = dvdplay_Read; + p_input->pf_seek = dvdplay_Seek; + p_input->pf_set_area = dvdplay_SetArea; + p_input->pf_set_program = dvdplay_SetProgram; + /* command line */ if( ( psz_source = dvdplay_ParseCL( p_input, &i_title, &i_chapter, &i_angle ) ) == NULL ) @@ -208,13 +192,12 @@ static int dvdplay_Open( input_thread_t *p_input ) } /***************************************************************************** - * dvdplay_Close: close libdvdplay + * CloseDVD: close libdvdplay *****************************************************************************/ -static void dvdplay_Close( input_thread_t *p_input ) +void E_(CloseDVD) ( vlc_object_t *p_this ) { - dvd_data_t * p_dvd; - - p_dvd = (dvd_data_t *)p_input->p_access_data; + input_thread_t * p_input = (input_thread_t *)p_this; + dvd_data_t * p_dvd = (dvd_data_t *)p_input->p_access_data; /* close libdvdplay */ dvdplay_close( p_dvd->vmg ); diff --git a/plugins/dvdplay/demux.c b/plugins/dvdplay/demux.c index e6e39b2505..e62b112161 100644 --- a/plugins/dvdplay/demux.c +++ b/plugins/dvdplay/demux.c @@ -2,7 +2,7 @@ * demux.c: demux functions for dvdplay. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: demux.c,v 1.1 2002/07/23 19:56:19 stef Exp $ + * $Id: demux.c,v 1.2 2002/07/31 20:56:51 sam Exp $ * * Author: Stéphane Borel * @@ -56,36 +56,14 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ - -/* called from outside */ -static int dvdplay_Rewind ( struct input_thread_t * ); -static int dvdplay_Demux ( struct input_thread_t * ); -static int dvdplay_Init ( struct input_thread_t * ); -static void dvdplay_End ( struct input_thread_t * ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( demux_getfunctions)( function_list_t * p_function_list ) -{ -#define demux p_function_list->functions.demux - demux.pf_init = dvdplay_Init; - demux.pf_end = dvdplay_End; - demux.pf_demux = dvdplay_Demux; - demux.pf_rewind = dvdplay_Rewind; -#undef demux -} - -/* - * Data demux functions - */ +static int Demux ( input_thread_t * ); /***************************************************************************** - * dvdplay_Init: initializes dvdplay structures + * InitDVD: initializes dvdplay structures *****************************************************************************/ -static int dvdplay_Init( input_thread_t * p_input ) +int E_(InitDVD) ( vlc_object_t *p_this ) { + input_thread_t *p_input = (input_thread_t *)p_this; dvd_data_t * p_dvd; char * psz_intf = NULL; @@ -97,6 +75,9 @@ static int dvdplay_Init( input_thread_t * p_input ) p_input->p_demux_data = (void*)p_input->p_access_data; p_dvd = (dvd_data_t *)p_input->p_demux_data; + p_input->pf_demux = Demux; + p_input->pf_rewind = NULL; + psz_intf = config_GetPsz( p_input, "intf" ); config_PutPsz( p_input, "intf", "dvdplay" ); p_dvd->p_intf = intf_Create( p_input ); @@ -112,10 +93,11 @@ static int dvdplay_Init( input_thread_t * p_input ) } /***************************************************************************** - * dvdplay_End: frees unused data + * EndDVD: frees unused data *****************************************************************************/ -static void dvdplay_End( input_thread_t * p_input ) +void E_(EndDVD) ( vlc_object_t *p_this ) { + input_thread_t *p_input = (input_thread_t *)p_this; dvd_data_t * p_dvd; intf_thread_t * p_intf = NULL; @@ -133,9 +115,9 @@ static void dvdplay_End( input_thread_t * p_input ) } /***************************************************************************** - * dvdplay_Demux + * Demux *****************************************************************************/ -static int dvdplay_Demux( input_thread_t * p_input ) +static int Demux( input_thread_t * p_input ) { dvd_data_t * p_dvd; data_packet_t * p_data; @@ -188,10 +170,3 @@ static int dvdplay_Demux( input_thread_t * p_input ) return i_data_nb; } -/***************************************************************************** - * dvdplay_Rewind : reads a stream backward - *****************************************************************************/ -static int dvdplay_Rewind( input_thread_t * p_input ) -{ - return( -1 ); -} diff --git a/plugins/dvdplay/dvd.c b/plugins/dvdplay/dvd.c index 261d1f9f4d..7ae7a93d67 100644 --- a/plugins/dvdplay/dvd.c +++ b/plugins/dvdplay/dvd.c @@ -7,7 +7,7 @@ ***************************************************************************** * * Copyright (C) 2001 VideoLAN - * $Id: dvd.c,v 1.1 2002/07/23 19:56:19 stef Exp $ + * $Id: dvd.c,v 1.2 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -35,32 +35,30 @@ #include /***************************************************************************** - * Capabilities defined in the other files. + * Exported prototypes *****************************************************************************/ -void _M( access_getfunctions)( function_list_t * p_function_list ); -void _M( demux_getfunctions)( function_list_t * p_function_list ); -void _M( intf_getfunctions)( function_list_t * p_function_list ); +int E_(OpenDVD) ( vlc_object_t * ); +void E_(CloseDVD) ( vlc_object_t * ); +int E_(InitDVD) ( vlc_object_t * ); +void E_(EndDVD) ( vlc_object_t * ); +int E_(OpenIntf) ( vlc_object_t * ); +void E_(CloseIntf) ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -ADD_CATEGORY_HINT( "[dvdplay:][device][@[title][,[chapter][,angle]]]", NULL ) -MODULE_CONFIG_STOP +vlc_module_begin(); + add_category_hint( "[dvdplay:][device][@[title][,[chapter][,angle]]]", NULL ); + set_description( "dvdplay input module" ); + add_submodule(); + set_capability( "access", 120 ); + set_callbacks( E_(OpenDVD), E_(CloseDVD) ); + add_shortcut( "dvd" ); + add_submodule(); + set_capability( "demux", 0 ); + set_callbacks( E_(InitDVD), E_(EndDVD) ); + add_submodule(); + set_capability( "interface", 0 ); + set_callbacks( E_(OpenIntf), E_(CloseIntf) ); +vlc_module_end(); -MODULE_INIT_START - SET_DESCRIPTION( "dvdplay input module" ) - ADD_CAPABILITY( INTF, 0 ) - ADD_CAPABILITY( DEMUX, 0 ) - ADD_CAPABILITY( ACCESS, 120 ) - ADD_SHORTCUT( "dvd" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( access_getfunctions)( &p_module->p_functions->access ); - _M( demux_getfunctions)( &p_module->p_functions->demux ); - _M( intf_getfunctions)( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP diff --git a/plugins/dvdplay/intf.c b/plugins/dvdplay/intf.c index a3c4165c8b..d7d0733ce5 100644 --- a/plugins/dvdplay/intf.c +++ b/plugins/dvdplay/intf.c @@ -2,7 +2,7 @@ * intf.c: interface for DVD video manager ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: intf.c,v 1.1 2002/07/23 19:56:19 stef Exp $ + * $Id: intf.c,v 1.2 2002/07/31 20:56:51 sam Exp $ * * Authors: Stéphane Borel * @@ -59,27 +59,15 @@ struct intf_sys_t static int InitThread ( intf_thread_t *p_intf ); /* Exported functions */ -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); - +static void RunIntf ( intf_thread_t *p_intf ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * OpenIntf: initialize dummy interface *****************************************************************************/ -void _M( intf_getfunctions )( function_list_t * p_function_list ) +int E_(OpenIntf) ( vlc_object_t *p_this ) { - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} + intf_thread_t *p_intf = (intf_thread_t *)p_this; -/***************************************************************************** - * intf_Open: initialize dummy interface - *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ /* Allocate instance and initialize some members */ p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) @@ -87,6 +75,8 @@ static int intf_Open( intf_thread_t *p_intf ) return( 1 ); }; + p_intf->pf_run = RunIntf; + p_intf->p_sys->m_still_time = 0; p_intf->p_sys->b_inf_still = 0; p_intf->p_sys->b_still = 0; @@ -95,19 +85,21 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy dummy interface + * CloseIntf: destroy dummy interface *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) +void E_(CloseIntf) ( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t *)p_this; + /* Destroy structure */ free( p_intf->p_sys ); } /***************************************************************************** - * intf_Run: main loop + * RunIntf: main loop *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void RunIntf( intf_thread_t *p_intf ) { vout_thread_t * p_vout; dvdplay_ctrl_t control; diff --git a/plugins/dvdread/dvdread.c b/plugins/dvdread/dvdread.c index 99730b7086..8470eba049 100644 --- a/plugins/dvdread/dvdread.c +++ b/plugins/dvdread/dvdread.c @@ -2,7 +2,7 @@ * dvdread.c : DvdRead input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: dvdread.c,v 1.17 2002/06/02 23:11:48 sam Exp $ + * $Id: dvdread.c,v 1.18 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -30,29 +30,24 @@ #include /***************************************************************************** - * Capabilities defined in the other files. + * External prototypes *****************************************************************************/ -void _M( access_getfunctions)( function_list_t * p_function_list ); -void _M( demux_getfunctions)( function_list_t * p_function_list ); +int E_(OpenDVD) ( vlc_object_t * ); +void E_(CloseDVD) ( vlc_object_t * ); + +int E_(InitDVD) ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("[dvdread:][device][@[title][,[chapter][,angle]]]"), NULL ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("DVDRead input module") ) - ADD_CAPABILITY( DEMUX, 0 ) - ADD_CAPABILITY( ACCESS, 110 ) - //ADD_SHORTCUT( "dvd" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( access_getfunctions)( &p_module->p_functions->access ); - _M( demux_getfunctions)( &p_module->p_functions->demux ); -MODULE_ACTIVATE_STOP +vlc_module_begin(); + add_category_hint( "[dvdread:][device][@[title][,[chapter][,angle]]]", NULL ); + set_description( _("DVDRead input module") ); + add_submodule(); + set_capability( "access", 110 ); + set_callbacks( E_(OpenDVD), E_(CloseDVD) ); + add_submodule(); + set_capability( "demux", 0 ); + set_callbacks( E_(InitDVD), NULL ); +vlc_module_end(); -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP diff --git a/plugins/dvdread/input_dvdread.c b/plugins/dvdread/input_dvdread.c index b068e41aa1..deff9b5905 100644 --- a/plugins/dvdread/input_dvdread.c +++ b/plugins/dvdread/input_dvdread.c @@ -6,7 +6,7 @@ * It depends on: libdvdread for ifo files and block reading. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: input_dvdread.c,v 1.41 2002/07/23 00:39:17 sam Exp $ + * $Id: input_dvdread.c,v 1.42 2002/07/31 20:56:51 sam Exp $ * * Author: Stéphane Borel * @@ -79,13 +79,9 @@ * Local prototypes *****************************************************************************/ /* called from outside */ -static int DvdReadInit ( input_thread_t * ); -static void DvdReadEnd ( input_thread_t * ); static int DvdReadDemux ( input_thread_t * ); static int DvdReadRewind ( input_thread_t * ); -static int DvdReadOpen ( input_thread_t * ); -static void DvdReadClose ( input_thread_t * ); static int DvdReadSetArea ( input_thread_t *, input_area_t * ); static int DvdReadSetProgram ( input_thread_t *, pgrm_descriptor_t * ); static int DvdReadRead ( input_thread_t *, byte_t *, size_t ); @@ -96,46 +92,25 @@ static void DvdReadLauchDecoders( input_thread_t * p_input ); static void DvdReadHandleDSI( thread_dvd_data_t * p_dvd, u8 * p_data ); static void DvdReadFindCell ( thread_dvd_data_t * p_dvd ); -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( access_getfunctions )( function_list_t * p_function_list ) -{ -#define access p_function_list->functions.access - access.pf_open = DvdReadOpen; - access.pf_close = DvdReadClose; - access.pf_read = DvdReadRead; - access.pf_set_area = DvdReadSetArea; - access.pf_set_program = DvdReadSetProgram; - access.pf_seek = DvdReadSeek; -#undef access -} - -void _M( demux_getfunctions )( function_list_t * p_function_list ) -{ -#define demux p_function_list->functions.demux - demux.pf_init = DvdReadInit; - demux.pf_end = DvdReadEnd; - demux.pf_demux = DvdReadDemux; - demux.pf_rewind = DvdReadRewind; -#undef demux -} - /* * Data demux functions */ /***************************************************************************** - * DvdReadInit: initializes DVD structures + * InitDVD: initializes DVD structures *****************************************************************************/ -static int DvdReadInit( input_thread_t * p_input ) +int E_(InitDVD) ( vlc_object_t *p_this ) { + input_thread_t *p_input = (input_thread_t *)p_this; + if( p_input->stream.i_method != INPUT_METHOD_DVD ) { return -1; } + p_input->pf_demux = DvdReadDemux; + p_input->pf_rewind = NULL; + vlc_mutex_lock( &p_input->stream.stream_lock ); DvdReadLauchDecoders( p_input ); @@ -145,13 +120,6 @@ static int DvdReadInit( input_thread_t * p_input ) return 0; } -/***************************************************************************** - * DvdReadEnd: frees unused data - *****************************************************************************/ -static void DvdReadEnd( input_thread_t * p_input ) -{ -} - /***************************************************************************** * DvdReadDemux *****************************************************************************/ @@ -232,10 +200,11 @@ static int DvdReadRewind( input_thread_t * p_input ) */ /***************************************************************************** - * DvdReadOpen: open libdvdread + * OpenDVD: open libdvdread *****************************************************************************/ -static int DvdReadOpen( input_thread_t *p_input ) +int E_(OpenDVD) ( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; char * psz_orig; char * psz_parser; char * psz_source; @@ -255,6 +224,11 @@ static int DvdReadOpen( input_thread_t *p_input ) return( -1 ); } + p_input->pf_read = DvdReadRead; + p_input->pf_seek = DvdReadSeek; + p_input->pf_set_area = DvdReadSetArea; + p_input->pf_set_program = DvdReadSetProgram; + while( *psz_parser && *psz_parser != '@' ) { psz_parser++; @@ -420,13 +394,12 @@ static int DvdReadOpen( input_thread_t *p_input ) } /***************************************************************************** - * DvdReadClose: close libdvdread + * CloseDVD: close libdvdread *****************************************************************************/ -static void DvdReadClose( input_thread_t *p_input ) +void E_(CloseDVD) ( vlc_object_t *p_this ) { - thread_dvd_data_t * p_dvd; - - p_dvd = (thread_dvd_data_t *)p_input->p_access_data; + input_thread_t * p_input = (input_thread_t *)p_this; + thread_dvd_data_t * p_dvd = (thread_dvd_data_t *)p_input->p_access_data; /* close libdvdread */ DVDCloseFile( p_dvd->p_title ); @@ -772,7 +745,7 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area ) /* FIXME: hack to check that the demuxer is ready, and set * the decoders */ - if( p_input->p_demux_module ) + if( p_input->p_demux ) { DvdReadLauchDecoders( p_input ); } diff --git a/plugins/esd/esd.c b/plugins/esd/esd.c index 12e77f3f79..202c7fa0f7 100644 --- a/plugins/esd/esd.c +++ b/plugins/esd/esd.c @@ -2,7 +2,7 @@ * esd.c : EsounD module ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: esd.c,v 1.16 2002/07/20 18:01:42 sam Exp $ + * $Id: esd.c,v 1.17 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -48,52 +48,32 @@ struct aout_sys_t }; /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void aout_getfunctions ( function_list_t * p_function_list ); -static int aout_Open ( aout_thread_t * ); -static int aout_SetFormat ( aout_thread_t * ); -static int aout_GetBufInfo ( aout_thread_t *, int ); -static void aout_Play ( aout_thread_t *, byte_t *, int ); -static void aout_Close ( aout_thread_t * ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("EsounD audio module") ) - ADD_CAPABILITY( AOUT, 50 ) - ADD_SHORTCUT( "esound" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - aout_getfunctions( &p_module->p_functions->aout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void aout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} +vlc_module_begin(); + set_description( _("EsounD audio module") ); + set_capability( "audio output", 50 ); + set_callbacks( Open, Close ); + add_shortcut( "esound" ); +vlc_module_end(); /***************************************************************************** - * aout_Open: open an esd socket + * Open: open an esd socket *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) +static int Open( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; + /* mpg123 does it this way */ int i_bits = ESD_BITS16; int i_mode = ESD_STREAM; @@ -136,13 +116,17 @@ static int aout_Open( aout_thread_t *p_aout ) return( -1 ); } + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + return( 0 ); } /***************************************************************************** - * aout_SetFormat: set the output format + * SetFormat: set the output format *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { int i_fd; @@ -155,20 +139,20 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_GetBufInfo: buffer status query + * GetBufInfo: buffer status query *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { /* arbitrary value that should be changed */ return( i_buffer_limit ); } /***************************************************************************** - * aout_Play: play a sound samples buffer + * Play: play a sound samples buffer ***************************************************************************** * This function writes a buffer of i_length bytes in the socket *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { int i_amount; @@ -199,10 +183,12 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } /***************************************************************************** - * aout_Close: close the Esound socket + * Close: close the Esound socket *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +static void Close( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; + close( p_aout->p_sys->i_fd ); } diff --git a/plugins/familiar/familiar.c b/plugins/familiar/familiar.c index 6db4bd59f3..00646dc1c5 100644 --- a/plugins/familiar/familiar.c +++ b/plugins/familiar/familiar.c @@ -2,7 +2,7 @@ * familiar.c : familiar plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: familiar.c,v 1.6 2002/07/24 20:46:08 jpsaman Exp $ + * $Id: familiar.c,v 1.7 2002/07/31 20:56:51 sam Exp $ * * Authors: Jean-Paul Saman * @@ -90,47 +90,27 @@ void g_atexit( GVoidFunc func ) /***************************************************************************** * Local prototypes. *****************************************************************************/ -static void intf_getfunctions ( function_list_t * p_function_list ); -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); - -/***************************************************************************** - * Building configuration tree - *****************************************************************************/ -MODULE_CONFIG_START - ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Familiar Linux Gtk+ interface module") ) - ADD_CAPABILITY( INTF, 70 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( intf_getfunctions )( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); +static void Run ( intf_thread_t * ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} +vlc_module_begin(); + set_description( _("Familiar Linux Gtk+ interface module") ); + set_capability( "interface", 70 ); + set_callbacks( Open, Close ); +vlc_module_end(); /***************************************************************************** - * intf_Open: initialize and create window + * Open: initialize and create window *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ +static int Open( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; + /* Allocate instance and initialize some members */ p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) @@ -142,14 +122,18 @@ static int intf_Open( intf_thread_t *p_intf ) /* Initialize Gtk+ thread */ p_intf->p_sys->p_input = NULL; + p_intf->pf_run = Run; + return( 0 ); } /***************************************************************************** - * intf_Close: destroy interface window + * Close: destroy interface window *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) -{ +static void Close( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; + if( p_intf->p_sys->p_input ) { vlc_object_release( p_intf->p_sys->p_input ); @@ -160,14 +144,14 @@ static void intf_Close( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Run: Gtk+ thread + * Run: Gtk+ thread ***************************************************************************** * this part of the interface is in a separate thread so that we can call * gtk_main() from within it without annoying the rest of the program. * XXX: the approach may look kludgy, and probably is, but I could not find * a better way to dynamically load a Gtk+ interface at runtime. *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { /* gtk_init needs to know the command line. We don't care, so we * give it an empty one */ diff --git a/plugins/fb/fb.c b/plugins/fb/fb.c index fb12103493..5db904d446 100644 --- a/plugins/fb/fb.c +++ b/plugins/fb/fb.c @@ -2,7 +2,7 @@ * fb.c : framebuffer plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: fb.c,v 1.21 2002/07/23 00:39:17 sam Exp $ + * $Id: fb.c,v 1.22 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -43,17 +43,15 @@ #include /***************************************************************************** - * Capabilities defined in the other files. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); -static int vout_Create ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); -static int vout_Manage ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Display ( vout_thread_t *, picture_t * ); static int OpenDisplay ( vout_thread_t * ); static void CloseDisplay ( vout_thread_t * ); @@ -62,26 +60,17 @@ static void TextMode ( int i_tty ); static void GfxMode ( int i_tty ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ #define FB_DEV_VAR "fbdev" -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING ( FB_DEV_VAR, "/dev/fb0", NULL, N_("framebuffer device"), NULL ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Linux console framebuffer module") ) - ADD_CAPABILITY( VOUT, 30 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string( FB_DEV_VAR, "/dev/fb0", NULL, N_("framebuffer device"), NULL ); + set_description( _("Linux console framebuffer module") ); + set_capability( "video output", 30 ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: video output framebuffer method descriptor @@ -119,27 +108,14 @@ struct vout_sys_t }; /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates FB video thread output method + * Create: allocates FB video thread output method ***************************************************************************** * This function allocates and initializes a FB vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + struct sigaction sig_tty; /* sigaction for tty change */ struct vt_mode vt_mode; /* vt current mode */ struct termios new_termios; @@ -151,6 +127,12 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); }; + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = NULL; + p_vout->pf_display = Display; + /* Set tty and fb devices */ p_vout->p_sys->i_tty = 0; /* 0 == /dev/tty0 == current console */ @@ -240,9 +222,9 @@ static int vout_Create( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize framebuffer video thread output method + * Init: initialize framebuffer video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -339,21 +321,23 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate framebuffer video thread output method + * End: terminate framebuffer video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { /* Clear the screen */ memset( p_vout->p_sys->p_video, 0, p_vout->p_sys->i_page_size ); } /***************************************************************************** - * vout_Destroy: destroy FB video thread output method + * Destroy: destroy FB video thread output method ***************************************************************************** - * Terminate an output method created by vout_CreateOutputMethod + * Terminate an output method created by Create *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +static void Destroy( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + CloseDisplay( p_vout ); /* Reset the terminal */ @@ -374,12 +358,12 @@ static void vout_Destroy( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Manage: handle FB events + * Manage: handle FB events ***************************************************************************** * This function should be called regularly by video output thread. It manages * console events. It returns a non null value on error. *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) +static int Manage( vout_thread_t *p_vout ) { #if 0 u8 buf; @@ -407,10 +391,10 @@ static int vout_Manage( vout_thread_t *p_vout ) p_vout->i_changes &= ~VOUT_SIZE_CHANGE; /* Destroy XImages to change their size */ - vout_End( p_vout ); + End( p_vout ); /* Recreate XImages. If SysInit failed, the thread can't go on. */ - if( vout_Init( p_vout ) ) + if( Init( p_vout ) ) { msg_Err( p_vout, "cannot reinit framebuffer screen" ); return( 1 ); @@ -430,20 +414,12 @@ static int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Render: renders previously calculated output - *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - -/***************************************************************************** - * vout_Display: displays previously rendered output + * Display: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to FB image, waits until * it is displayed and switch the two rendering buffers, preparing next frame. *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void Display( vout_thread_t *p_vout, picture_t *p_pic ) { /* swap the two Y offsets if the drivers supports panning */ if( p_vout->p_sys->b_pan ) @@ -461,7 +437,7 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) } #if 0 -static void vout_SetPalette( vout_thread_t *p_vout, +static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue, u16 *transp ) { struct fb_cmap cmap = { 0, 256, red, green, blue, transp }; diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c index 5c9fc560a2..8a6d7d7cc0 100644 --- a/plugins/ffmpeg/ffmpeg.c +++ b/plugins/ffmpeg/ffmpeg.c @@ -2,7 +2,7 @@ * ffmpeg.c: video decoder using ffmpeg library ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ffmpeg.c,v 1.20 2002/07/23 17:19:02 fenrir Exp $ + * $Id: ffmpeg.c,v 1.21 2002/07/31 20:56:51 sam Exp $ * * Authors: Laurent Aimar * @@ -49,8 +49,8 @@ /* * Local prototypes */ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); static int InitThread ( videodec_thread_t * ); static void EndThread ( videodec_thread_t * ); static void DecodeThread ( videodec_thread_t * ); @@ -59,16 +59,7 @@ static void DecodeThread ( videodec_thread_t * ); static int b_ffmpeginit = 0; /***************************************************************************** - * Capabilities - *****************************************************************************/ -void _M( vdec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} - -/***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define ERROR_RESILIENCE_LONGTEXT \ @@ -82,50 +73,47 @@ void _M( vdec_getfunctions )( function_list_t * p_function_list ) "when there not enough time.\n It's usefull with low CPU power " \ "but it could produce broken pictures." -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); #if LIBAVCODEC_BUILD >= 4611 - ADD_INTEGER ( "ffmpeg-error-resilience", 0, NULL, - "error resilience", ERROR_RESILIENCE_LONGTEXT ) - ADD_INTEGER ( "ffmpeg-workaround-bugs", 0, NULL, - "workaround bugs", "0-99, seems to be for msmpeg v3\n" ) + add_integer ( "ffmpeg-error-resilience", 0, NULL, + "error resilience", ERROR_RESILIENCE_LONGTEXT ); + add_integer ( "ffmpeg-workaround-bugs", 0, NULL, + "workaround bugs", "0-99, seems to be for msmpeg v3\n" ); #endif - ADD_BOOL( "ffmpeg-hurry-up", 0, NULL, "hurry up", HURRY_UP_LONGTEXT ) - -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( "ffmpeg video decoder((MS)MPEG4,SVQ1,H263)" ) - ADD_CAPABILITY( DECODER, 70 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( vdec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - + add_bool( "ffmpeg-hurry-up", 0, NULL, "hurry up", HURRY_UP_LONGTEXT ); + set_description( _("ffmpeg video decoder((MS)MPEG4,SVQ1,H263)") ); + set_capability( "decoder", 70 ); + set_callbacks( OpenDecoder, NULL ); +vlc_module_end(); /***************************************************************************** - * decoder_Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able * to chose. *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) +static int OpenDecoder( vlc_object_t *p_this ) { - return( ffmpeg_GetFfmpegCodec( *pi_type, NULL, NULL ) ? 0 : -1 ); + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + + if( ffmpeg_GetFfmpegCodec( p_fifo->i_fourcc, NULL, NULL ) ) + { + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; + } + + return VLC_EGENERIC; } /***************************************************************************** - * decoder_Run: this function is called just after the thread is created + * RunDecoder: this function is called just after the thread is created *****************************************************************************/ -static int decoder_Run ( decoder_fifo_t * p_fifo ) +static int RunDecoder( decoder_fifo_t *p_fifo ) { videodec_thread_t *p_vdec; int b_error; - + if ( !(p_vdec = (videodec_thread_t*)malloc( sizeof(videodec_thread_t))) ) { msg_Err( p_fifo, "out of memory" ); @@ -598,7 +586,7 @@ static void ffmpeg_ConvertPicture( picture_t *p_pic, /***************************************************************************** * InitThread: initialize vdec output thread ***************************************************************************** - * This function is called from decoder_Run and performs the second step + * This function is called from RunDecoderoder and performs the second step * of the initialization. It returns 0 on success. Note that the thread's * flag are not modified inside this function. *****************************************************************************/ diff --git a/plugins/filter/clone.c b/plugins/filter/clone.c index 2cd20cc0ae..3c349252d5 100644 --- a/plugins/filter/clone.c +++ b/plugins/filter/clone.c @@ -2,7 +2,7 @@ * clone.c : Clone video plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: clone.c,v 1.8 2002/07/20 18:01:42 sam Exp $ + * $Id: clone.c,v 1.9 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -34,36 +34,32 @@ #include "filter_common.h" /***************************************************************************** - * Capabilities defined in the other files. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); + +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static void Render ( vout_thread_t *, picture_t * ); + +static void RemoveAllVout ( vout_thread_t *p_vout ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define COUNT_TEXT N_("Number of clones") #define COUNT_LONGTEXT N_("Select the number of video windows in which to "\ "clone the video") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_INTEGER ( "clone-count", 2, NULL, COUNT_TEXT, COUNT_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("image clone video module") ) - /* Capability score set to 0 because we don't want to be spawned - * as a video output unless explicitly requested to */ - ADD_CAPABILITY( VOUT_FILTER, 0 ) - ADD_SHORTCUT( "clone" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_integer( "clone-count", 2, NULL, COUNT_TEXT, COUNT_LONGTEXT ); + set_description( _("image clone video module") ); + set_capability( "video filter", 0 ); + add_shortcut( "clone" ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: Clone video output method descriptor @@ -78,40 +74,13 @@ struct vout_sys_t }; /***************************************************************************** - * Local prototypes - *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); - -static void RemoveAllVout ( vout_thread_t *p_vout ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates Clone video thread output method + * Create: allocates Clone video thread output method ***************************************************************************** * This function allocates and initializes a Clone vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); @@ -121,6 +90,12 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = NULL; + p_vout->pf_render = Render; + p_vout->pf_display = NULL; + /* Look what method was requested */ p_vout->p_sys->i_clones = config_GetInt( p_vout, "clone-count" ); @@ -141,9 +116,9 @@ static int vout_Create( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize Clone video thread output method + * Init: initialize Clone video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index, i_vout; picture_t *p_pic; @@ -181,9 +156,9 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Clone video thread output method + * End: terminate Clone video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -196,12 +171,14 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy Clone video thread output method + * Destroy: destroy Clone video thread output method ***************************************************************************** * Terminate an output method created by CloneCreateOutputMethod *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +static void Destroy( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + RemoveAllVout( p_vout ); free( p_vout->p_sys->pp_vout ); @@ -209,24 +186,13 @@ static void vout_Destroy( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Manage: handle Clone events - ***************************************************************************** - * This function should be called regularly by video output thread. It manages - * console events. It returns a non null value on error. - *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) -{ - return( 0 ); -} - -/***************************************************************************** - * vout_Render: displays previously rendered output + * Render: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to Clone image, waits * until it is displayed and switch the two rendering buffers, preparing next * frame. *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) +static void Render( vout_thread_t *p_vout, picture_t *p_pic ) { picture_t *p_outpic = NULL; int i_vout, i_plane; @@ -277,18 +243,6 @@ static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) } } -/***************************************************************************** - * vout_Display: displays previously rendered output - ***************************************************************************** - * This function send the currently rendered image to Invert image, waits - * until it is displayed and switch the two rendering buffers, preparing next - * frame. - *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - /***************************************************************************** * RemoveAllVout: destroy all the child video output threads *****************************************************************************/ diff --git a/plugins/filter/crop.c b/plugins/filter/crop.c index eb2555772c..54af369bea 100644 --- a/plugins/filter/crop.c +++ b/plugins/filter/crop.c @@ -2,7 +2,7 @@ * crop.c : Crop video plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: crop.c,v 1.5 2002/07/23 00:39:17 sam Exp $ + * $Id: crop.c,v 1.6 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -34,12 +34,20 @@ #include "filter_common.h" /***************************************************************************** - * Capabilities defined in the other files. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); + +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Render ( vout_thread_t *, picture_t * ); + +static void UpdateStats ( vout_thread_t *, picture_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define GEOMETRY_TEXT N_("Crop geometry") #define GEOMETRY_LONGTEXT N_("Set the geometry of the zone to crop") @@ -47,26 +55,15 @@ static void vout_getfunctions( function_list_t * p_function_list ); #define AUTOCROP_TEXT N_("Automatic cropping") #define AUTOCROP_LONGTEXT N_("Activate automatic black border cropping") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING ( "crop-geometry", NULL, NULL, GEOMETRY_TEXT, GEOMETRY_LONGTEXT ) -ADD_BOOL ( "autocrop", 0, NULL, AUTOCROP_TEXT, AUTOCROP_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("image crop video module") ) - /* Capability score set to 0 because we don't want to be spawned - * as a video output unless explicitly requested to */ - ADD_CAPABILITY( VOUT_FILTER, 0 ) - ADD_SHORTCUT( "crop" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string( "crop-geometry", NULL, NULL, GEOMETRY_TEXT, GEOMETRY_LONGTEXT ); + add_bool( "autocrop", 0, NULL, AUTOCROP_TEXT, AUTOCROP_LONGTEXT ); + set_description( _("image crop video module") ); + set_capability( "video filter", 0 ); + add_shortcut( "crop" ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: Crop video output method descriptor @@ -89,40 +86,14 @@ struct vout_sys_t }; /***************************************************************************** - * Local prototypes - *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); - -static void UpdateStats ( vout_thread_t *, picture_t * ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates Crop video thread output method + * Create: allocates Crop video thread output method ***************************************************************************** * This function allocates and initializes a Crop vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) @@ -131,13 +102,19 @@ static int vout_Create( vout_thread_t *p_vout ) return 1; } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = Render; + p_vout->pf_display = NULL; + return 0; } /***************************************************************************** - * vout_Init: initialize Crop video thread output method + * Init: initialize Crop video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; char *psz_var; @@ -272,9 +249,9 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Crop video thread output method + * End: terminate Crop video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -287,23 +264,25 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy Crop video thread output method + * Destroy: destroy Crop video thread output method ***************************************************************************** * Terminate an output method created by CropCreateOutputMethod *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +static void Destroy( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + vout_DestroyThread( p_vout->p_sys->p_vout ); free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle Crop events + * Manage: handle Crop events ***************************************************************************** * This function should be called regularly by video output thread. It manages * console events. It returns a non null value on error. *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) +static int Manage( vout_thread_t *p_vout ) { if( !p_vout->p_sys->b_changed ) { @@ -329,13 +308,13 @@ static int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Render: display previously rendered output + * Render: display previously rendered output ***************************************************************************** * This function sends the currently rendered image to Crop image, waits * until it is displayed and switches the two rendering buffers, preparing next * frame. *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) +static void Render( vout_thread_t *p_vout, picture_t *p_pic ) { picture_t *p_outpic = NULL; int i_plane; @@ -397,18 +376,6 @@ static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) UpdateStats( p_vout, p_pic ); } -/***************************************************************************** - * vout_Display: displays previously rendered output - ***************************************************************************** - * This function send the currently rendered image to Invert image, waits - * until it is displayed and switch the two rendering buffers, preparing next - * frame. - *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic ) { u8 *p_in = p_pic->p[0].p_pixels; diff --git a/plugins/filter/deinterlace.c b/plugins/filter/deinterlace.c index 59b90ee275..33c17bd8b7 100644 --- a/plugins/filter/deinterlace.c +++ b/plugins/filter/deinterlace.c @@ -2,7 +2,7 @@ * deinterlace.c : deinterlacer plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: deinterlace.c,v 1.19 2002/07/23 00:39:17 sam Exp $ + * $Id: deinterlace.c,v 1.20 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -40,9 +40,14 @@ #define DEINTERLACE_LINEAR 5 /***************************************************************************** - * Capabilities defined in the other files. + * Local protypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); + +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static void Render ( vout_thread_t *, picture_t * ); static void RenderBob ( vout_thread_t *, picture_t *, picture_t *, int ); static void RenderMean ( vout_thread_t *, picture_t *, picture_t * ); @@ -52,33 +57,22 @@ static void RenderLinear ( vout_thread_t *, picture_t *, picture_t *, int ); static void Merge ( void *, const void *, const void *, size_t ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define MODE_TEXT N_("Deinterlace mode") #define MODE_LONGTEXT N_("one of \"discard\", \"blend\", \"mean\", \"bob\" or \"linear\"") static char *mode_list[] = { "discard", "blend", "mean", "bob", "linear", NULL }; -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING_FROM_LIST ( "deinterlace-mode", "discard", mode_list, NULL, \ - MODE_TEXT, MODE_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("deinterlacing module") ) - /* Capability score set to 0 because we don't want to be spawned - * as a video output unless explicitly requested to */ - ADD_CAPABILITY( VOUT_FILTER, 0 ) - ADD_SHORTCUT( "deinterlace" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string_from_list( "deinterlace-mode", "discard", mode_list, NULL, + MODE_TEXT, MODE_LONGTEXT ); + set_description( _("deinterlacing module") ); + set_capability( "video filter", 0 ); + add_shortcut( "deinterlace" ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: Deinterlace video output method descriptor @@ -98,38 +92,13 @@ struct vout_sys_t }; /***************************************************************************** - * Local prototypes - *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates Deinterlace video thread output method + * Create: allocates Deinterlace video thread output method ***************************************************************************** * This function allocates and initializes a Deinterlace vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) -{ +static int Create( vlc_object_t *p_this ) +{ + vout_thread_t *p_vout = (vout_thread_t *)p_this; char *psz_method; /* Allocate structure */ @@ -140,6 +109,12 @@ static int vout_Create( vout_thread_t *p_vout ) return 1; } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = NULL; + p_vout->pf_render = Render; + p_vout->pf_display = NULL; + p_vout->p_sys->i_mode = DEINTERLACE_DISCARD; p_vout->p_sys->b_double_rate = 0; p_vout->p_sys->last_date = 0; @@ -193,9 +168,9 @@ static int vout_Create( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize Deinterlace video thread output method + * Init: initialize Deinterlace video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -275,9 +250,9 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Deinterlace video thread output method + * End: terminate Deinterlace video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -290,36 +265,27 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy Deinterlace video thread output method + * Destroy: destroy Deinterlace video thread output method ***************************************************************************** * Terminate an output method created by DeinterlaceCreateOutputMethod *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +static void Destroy( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + vout_DestroyThread( p_vout->p_sys->p_vout ); free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle Deinterlace events - ***************************************************************************** - * This function should be called regularly by video output thread. It manages - * console events. It returns a non null value on error. - *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) -{ - return 0; -} - -/***************************************************************************** - * vout_Render: displays previously rendered output + * Render: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to Deinterlace image, * waits until it is displayed and switch the two rendering buffers, preparing * next frame. *****************************************************************************/ -static void vout_Render ( vout_thread_t *p_vout, picture_t *p_pic ) +static void Render ( vout_thread_t *p_vout, picture_t *p_pic ) { picture_t *pp_outpic[2]; @@ -399,16 +365,6 @@ static void vout_Render ( vout_thread_t *p_vout, picture_t *p_pic ) } } -/***************************************************************************** - * vout_Display: displays previously rendered output - ***************************************************************************** - * This function does nothing, since all the rendering was already done. - *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - /***************************************************************************** * RenderBob: renders a bob picture *****************************************************************************/ diff --git a/plugins/filter/distort.c b/plugins/filter/distort.c index 869ed58845..db1274e4ed 100644 --- a/plugins/filter/distort.c +++ b/plugins/filter/distort.c @@ -2,7 +2,7 @@ * distort.c : Misc video effects plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: distort.c,v 1.18 2002/07/23 20:16:36 sam Exp $ + * $Id: distort.c,v 1.19 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -39,37 +39,35 @@ #define DISTORT_MODE_RIPPLE 2 /***************************************************************************** - * Capabilities defined in the other files. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); + +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static void Render ( vout_thread_t *, picture_t * ); + +static void DistortWave ( vout_thread_t *, picture_t *, picture_t * ); +static void DistortRipple ( vout_thread_t *, picture_t *, picture_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define MODE_TEXT N_("Distort mode") #define MODE_LONGTEXT N_("one of \"wave\" and \"ripple\"") static char *mode_list[] = { "wave", "ripple", NULL }; -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING_FROM_LIST( "distort-mode", "wave", mode_list, NULL, MODE_TEXT, MODE_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("miscellaneous video effects module") ) - /* Capability score set to 0 because we don't want to be spawned - * as a video output unless explicitly requested to */ - ADD_CAPABILITY( VOUT_FILTER, 0 ) - ADD_SHORTCUT( "distort" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string_from_list( "distort-mode", "wave", mode_list, NULL, + MODE_TEXT, MODE_LONGTEXT ); + set_description( _("miscellaneous video effects module") ); + set_capability( "video filter", 0 ); + add_shortcut( "distort" ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: Distort video output method descriptor @@ -88,41 +86,13 @@ struct vout_sys_t }; /***************************************************************************** - * Local prototypes - *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); - -static void DistortWave ( vout_thread_t *, picture_t *, picture_t * ); -static void DistortRipple ( vout_thread_t *, picture_t *, picture_t * ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates Distort video thread output method + * Create: allocates Distort video thread output method ***************************************************************************** * This function allocates and initializes a Distort vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; char *psz_method, *psz_method_tmp; /* Allocate structure */ @@ -132,6 +102,13 @@ static int vout_Create( vout_thread_t *p_vout ) msg_Err( p_vout, "out of memory" ); return( 1 ); } + + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = NULL; + p_vout->pf_render = Render; + p_vout->pf_display = NULL; + p_vout->p_sys->i_mode = 0; /* Look what method was requested from command line*/ if( !(psz_method = psz_method_tmp = config_GetPsz( p_vout, "filter" )) ) @@ -189,9 +166,9 @@ static int vout_Create( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize Distort video thread output method + * Init: initialize Distort video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -229,9 +206,9 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Distort video thread output method + * End: terminate Distort video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -244,36 +221,27 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy Distort video thread output method + * Destroy: destroy Distort video thread output method ***************************************************************************** * Terminate an output method created by DistortCreateOutputMethod *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +static void Destroy( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + vout_DestroyThread( p_vout->p_sys->p_vout ); free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle Distort events - ***************************************************************************** - * This function should be called regularly by video output thread. It manages - * console events. It returns a non null value on error. - *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) -{ - return( 0 ); -} - -/***************************************************************************** - * vout_Render: displays previously rendered output + * Render: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to Distort image, waits * until it is displayed and switch the two rendering buffers, preparing next * frame. *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) +static void Render( vout_thread_t *p_vout, picture_t *p_pic ) { picture_t *p_outpic; @@ -307,18 +275,6 @@ static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic ); } -/***************************************************************************** - * vout_Display: displays previously rendered output - ***************************************************************************** - * This function send the currently rendered image to Invert image, waits - * until it is displayed and switch the two rendering buffers, preparing next - * frame. - *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - /***************************************************************************** * DistortWave: draw a wave effect on the picture *****************************************************************************/ diff --git a/plugins/filter/invert.c b/plugins/filter/invert.c index 04cfeca145..8e780172fe 100644 --- a/plugins/filter/invert.c +++ b/plugins/filter/invert.c @@ -2,7 +2,7 @@ * invert.c : Invert video plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: invert.c,v 1.15 2002/07/20 18:01:42 sam Exp $ + * $Id: invert.c,v 1.16 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -34,30 +34,24 @@ #include "filter_common.h" /***************************************************************************** - * Capabilities defined in the other files. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); + +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static void Render ( vout_thread_t *, picture_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("invert video module") ) - /* Capability score set to 0 because we don't want to be spawned - * as a video output unless explicitly requested to */ - ADD_CAPABILITY( VOUT_FILTER, 0 ) - ADD_SHORTCUT( "invert" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("invert video module") ); + set_capability( "video filter", 0 ); + add_shortcut( "invert" ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: Invert video output method descriptor @@ -71,38 +65,14 @@ struct vout_sys_t }; /***************************************************************************** - * Local prototypes - *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates Invert video thread output method + * Create: allocates Invert video thread output method ***************************************************************************** * This function allocates and initializes a Invert vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) @@ -111,13 +81,19 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = NULL; + p_vout->pf_render = Render; + p_vout->pf_display = NULL; + return( 0 ); } /***************************************************************************** - * vout_Init: initialize Invert video thread output method + * Init: initialize Invert video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -152,9 +128,9 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Invert video thread output method + * End: terminate Invert video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -167,36 +143,27 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy Invert video thread output method + * Destroy: destroy Invert video thread output method ***************************************************************************** * Terminate an output method created by InvertCreateOutputMethod *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) -{ +static void Destroy( vlc_object_t *p_this ) +{ + vout_thread_t *p_vout = (vout_thread_t *)p_this; + vout_DestroyThread( p_vout->p_sys->p_vout ); free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle Invert events - ***************************************************************************** - * This function should be called regularly by video output thread. It manages - * console events. It returns a non null value on error. - *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) -{ - return( 0 ); -} - -/***************************************************************************** - * vout_Render: displays previously rendered output + * Render: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to Invert image, waits * until it is displayed and switch the two rendering buffers, preparing next * frame. *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) +static void Render( vout_thread_t *p_vout, picture_t *p_pic ) { picture_t *p_outpic; int i_index; @@ -252,15 +219,3 @@ static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic ); } -/***************************************************************************** - * vout_Display: displays previously rendered output - ***************************************************************************** - * This function send the currently rendered image to Invert image, waits - * until it is displayed and switch the two rendering buffers, preparing next - * frame. - *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - diff --git a/plugins/filter/transform.c b/plugins/filter/transform.c index 651a3a9bb3..c126f397df 100644 --- a/plugins/filter/transform.c +++ b/plugins/filter/transform.c @@ -2,7 +2,7 @@ * transform.c : transform image plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: transform.c,v 1.16 2002/07/20 18:01:42 sam Exp $ + * $Id: transform.c,v 1.17 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -40,37 +40,32 @@ #define TRANSFORM_MODE_270 5 /***************************************************************************** - * Capabilities defined in the other files. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); + +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static void Render ( vout_thread_t *, picture_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define TYPE_TEXT N_("Transform type") #define TYPE_LONGTEXT N_("One of '90', '180', '270', 'hflip' and 'vflip'") static char *type_list[] = { "90", "180", "270", "hflip", "vflip", NULL }; -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING_FROM_LIST("transform-type", "90", type_list, NULL, TYPE_TEXT, TYPE_LONGTEXT) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("image transformation module") ) - /* Capability score set to 0 because we don't want to be spawned - * as a video output unless explicitly requested to */ - ADD_CAPABILITY( VOUT_FILTER, 0 ) - ADD_SHORTCUT( "transform" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string_from_list( "transform-type", "90", type_list, NULL, + TYPE_TEXT, TYPE_LONGTEXT); + set_description( _("image transformation module") ); + set_capability( "video filter", 0 ); + add_shortcut( "transform" ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: Transform video output method descriptor @@ -86,38 +81,13 @@ struct vout_sys_t }; /***************************************************************************** - * Local prototypes - *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates Transform video thread output method + * Create: allocates Transform video thread output method ***************************************************************************** * This function allocates and initializes a Transform vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; char *psz_method; /* Allocate structure */ @@ -128,6 +98,12 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = NULL; + p_vout->pf_render = Render; + p_vout->pf_display = NULL; + /* Look what method was requested */ psz_method = config_GetPsz( p_vout, "transform-type" ); @@ -179,9 +155,9 @@ static int vout_Create( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize Transform video thread output method + * Init: initialize Transform video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -227,9 +203,9 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Transform video thread output method + * End: terminate Transform video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -242,36 +218,27 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy Transform video thread output method + * Destroy: destroy Transform video thread output method ***************************************************************************** * Terminate an output method created by TransformCreateOutputMethod *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +static void Destroy( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + vout_DestroyThread( p_vout->p_sys->p_vout ); free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle Transform events - ***************************************************************************** - * This function should be called regularly by video output thread. It manages - * console events. It returns a non null value on error. - *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) -{ - return( 0 ); -} - -/***************************************************************************** - * vout_Render: displays previously rendered output + * Render: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to Transform image, waits * until it is displayed and switch the two rendering buffers, preparing next * frame. *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) +static void Render( vout_thread_t *p_vout, picture_t *p_pic ) { picture_t *p_outpic; int i_index; @@ -417,14 +384,3 @@ static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic ); } -/***************************************************************************** - * vout_Display: displays previously rendered output - ***************************************************************************** - * This function send the currently rendered image to Invert image, waits - * until it is displayed and switch the two rendering buffers, preparing next - * frame. - *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} diff --git a/plugins/filter/wall.c b/plugins/filter/wall.c index 921f2838cf..2ec8215244 100644 --- a/plugins/filter/wall.c +++ b/plugins/filter/wall.c @@ -2,7 +2,7 @@ * wall.c : Wall video plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: wall.c,v 1.24 2002/07/20 18:01:42 sam Exp $ + * $Id: wall.c,v 1.25 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -34,12 +34,19 @@ #include "filter_common.h" /***************************************************************************** - * Capabilities defined in the other files. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); + +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static void Render ( vout_thread_t *, picture_t * ); + +static void RemoveAllVout ( vout_thread_t *p_vout ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define COLS_TEXT N_("Number of columns") #define COLS_LONGTEXT N_("Select the number of horizontal videowindows in " \ @@ -53,27 +60,16 @@ static void vout_getfunctions( function_list_t * p_function_list ); #define ACTIVE_LONGTEXT N_("comma separated list of active windows, " \ "defaults to all") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_INTEGER ( "wall-cols", 3, NULL, COLS_TEXT, COLS_LONGTEXT ) -ADD_INTEGER ( "wall-rows", 3, NULL, ROWS_TEXT, ROWS_LONGTEXT ) -ADD_STRING ( "wall-active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("image wall video module") ) - /* Capability score set to 0 because we don't want to be spawned - * as a video output unless explicitly requested to */ - ADD_CAPABILITY( VOUT_FILTER, 0 ) - ADD_SHORTCUT( "wall" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_integer( "wall-cols", 3, NULL, COLS_TEXT, COLS_LONGTEXT ); + add_integer( "wall-rows", 3, NULL, ROWS_TEXT, ROWS_LONGTEXT ); + add_string( "wall-active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT ); + set_description( _("image wall video module") ); + set_capability( "video filter", 0 ); + add_shortcut( "wall" ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: Wall video output method descriptor @@ -96,40 +92,13 @@ struct vout_sys_t }; /***************************************************************************** - * Local prototypes - *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); - -static void RemoveAllVout ( vout_thread_t *p_vout ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates Wall video thread output method + * Create: allocates Wall video thread output method ***************************************************************************** * This function allocates and initializes a Wall vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; char *psz_method, *psz_tmp, *psz_method_tmp; int i_vout; @@ -141,6 +110,12 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = NULL; + p_vout->pf_render = Render; + p_vout->pf_display = NULL; + /* Look what method was requested */ p_vout->p_sys->i_col = config_GetInt( p_vout, "wall-cols" ); p_vout->p_sys->i_row = config_GetInt( p_vout, "wall-rows" ); @@ -215,9 +190,9 @@ static int vout_Create( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize Wall video thread output method + * Init: initialize Wall video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index, i_row, i_col, i_width, i_height; picture_t *p_pic; @@ -297,9 +272,9 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Wall video thread output method + * End: terminate Wall video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -312,12 +287,14 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy Wall video thread output method + * Destroy: destroy Wall video thread output method ***************************************************************************** * Terminate an output method created by WallCreateOutputMethod *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +static void Destroy( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + RemoveAllVout( p_vout ); free( p_vout->p_sys->pp_vout ); @@ -325,24 +302,13 @@ static void vout_Destroy( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Manage: handle Wall events - ***************************************************************************** - * This function should be called regularly by video output thread. It manages - * console events. It returns a non null value on error. - *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) -{ - return( 0 ); -} - -/***************************************************************************** - * vout_Render: displays previously rendered output + * Render: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to Wall image, waits * until it is displayed and switch the two rendering buffers, preparing next * frame. *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) +static void Render( vout_thread_t *p_vout, picture_t *p_pic ) { picture_t *p_outpic = NULL; int i_col, i_row, i_vout, i_plane; @@ -438,18 +404,6 @@ static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) } } -/***************************************************************************** - * vout_Display: displays previously rendered output - ***************************************************************************** - * This function send the currently rendered image to Invert image, waits - * until it is displayed and switch the two rendering buffers, preparing next - * frame. - *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - /***************************************************************************** * RemoveAllVout: destroy all the child video output threads *****************************************************************************/ diff --git a/plugins/fx/scope.c b/plugins/fx/scope.c index 2dcf46c837..beb456d2e8 100644 --- a/plugins/fx/scope.c +++ b/plugins/fx/scope.c @@ -2,7 +2,7 @@ * scope.c : Scope effect module ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: scope.c,v 1.10 2002/07/23 00:39:17 sam Exp $ + * $Id: scope.c,v 1.11 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -44,61 +44,38 @@ *****************************************************************************/ struct aout_sys_t { - aout_thread_t aout; aout_fifo_t *p_aout_fifo; + aout_thread_t *p_aout; vout_thread_t *p_vout; }; /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void aout_getfunctions( function_list_t * p_function_list ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); -static int aout_Open ( aout_thread_t *p_aout ); -static int aout_SetFormat ( aout_thread_t *p_aout ); -static int aout_GetBufInfo ( aout_thread_t *p_aout, int i_buffer_info ); -static void aout_Play ( aout_thread_t *p_aout, - byte_t *buffer, int i_size ); -static void aout_Close ( aout_thread_t *p_aout ); +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("scope effect module") ) - ADD_CAPABILITY( AOUT, 0 ) - ADD_SHORTCUT( "scope" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - aout_getfunctions( &p_module->p_functions->aout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void aout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} +vlc_module_begin(); + set_description( _("scope effect") ); + set_capability( "audio output", 0 ); + set_callbacks( Open, Close ); + add_shortcut( "scope" ); +vlc_module_end(); /***************************************************************************** - * aout_Open: open a scope effect plugin + * Open: open a scope effect plugin *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) +static int Open( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; char *psz_method; /* Allocate structure */ @@ -136,83 +113,83 @@ static int aout_Open( aout_thread_t *p_aout ) } /* Open audio output */ - p_aout->p_sys->aout.i_format = p_aout->i_format; - p_aout->p_sys->aout.i_rate = p_aout->i_rate; - p_aout->p_sys->aout.i_channels = p_aout->i_channels; - - p_aout->p_sys->aout.p_module = - module_Need( p_aout, MODULE_CAPABILITY_AOUT, - "", (void *)&p_aout->p_sys->aout ); - if( p_aout->p_sys->aout.p_module == NULL ) + p_aout->p_sys->p_aout = vlc_object_create( p_aout, VLC_OBJECT_AOUT ); + + p_aout->p_sys->p_aout->i_format = p_aout->i_format; + p_aout->p_sys->p_aout->i_rate = p_aout->i_rate; + p_aout->p_sys->p_aout->i_channels = p_aout->i_channels; + + p_aout->p_sys->p_aout->p_module = + module_Need( p_aout->p_sys->p_aout, "audio output", "" ); + if( p_aout->p_sys->p_aout->p_module == NULL ) { msg_Err( p_aout, "no suitable aout module" ); + vlc_object_destroy( p_aout->p_sys->p_aout ); vout_DestroyThread( p_aout->p_sys->p_vout ); free( p_aout->p_sys ); return -1; } -#define aout_functions p_aout->p_sys->aout.p_module->p_functions->aout.functions.aout - p_aout->p_sys->aout.pf_open = aout_functions.pf_open; - p_aout->p_sys->aout.pf_setformat = aout_functions.pf_setformat; - p_aout->p_sys->aout.pf_getbufinfo = aout_functions.pf_getbufinfo; - p_aout->p_sys->aout.pf_play = aout_functions.pf_play; - p_aout->p_sys->aout.pf_close = aout_functions.pf_close; -#undef aout_functions - + vlc_object_attach( p_aout->p_sys->p_aout, p_aout ); + + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + return( 0 ); } /***************************************************************************** - * aout_SetFormat: set the output format + * SetFormat: set the output format *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { int i_ret; /* Force the output method */ - p_aout->p_sys->aout.i_format = p_aout->i_format; - p_aout->p_sys->aout.i_channels = p_aout->i_channels; - p_aout->p_sys->aout.i_rate = p_aout->i_rate; + p_aout->p_sys->p_aout->i_format = p_aout->i_format; + p_aout->p_sys->p_aout->i_channels = p_aout->i_channels; + p_aout->p_sys->p_aout->i_rate = p_aout->i_rate; /* * Initialize audio device */ - i_ret = p_aout->p_sys->aout.pf_setformat( &p_aout->p_sys->aout ); + i_ret = p_aout->p_sys->p_aout->pf_setformat( p_aout->p_sys->p_aout ); if( i_ret ) { return i_ret; } - if( p_aout->p_sys->aout.i_format != p_aout->i_format - || p_aout->p_sys->aout.i_channels != p_aout->i_channels ) + if( p_aout->p_sys->p_aout->i_format != p_aout->i_format + || p_aout->p_sys->p_aout->i_channels != p_aout->i_channels ) { msg_Err( p_aout, "plugin is not very cooperative" ); return 0; } - p_aout->i_channels = p_aout->p_sys->aout.i_channels; - p_aout->i_format = p_aout->p_sys->aout.i_format; - p_aout->i_rate = p_aout->p_sys->aout.i_rate; + p_aout->i_channels = p_aout->p_sys->p_aout->i_channels; + p_aout->i_format = p_aout->p_sys->p_aout->i_format; + p_aout->i_rate = p_aout->p_sys->p_aout->i_rate; return 0; } /***************************************************************************** - * aout_GetBufInfo: buffer status query + * GetBufInfo: buffer status query *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { - return p_aout->p_sys->aout.pf_getbufinfo( &p_aout->p_sys->aout, - i_buffer_limit ); + return p_aout->p_sys->p_aout->pf_getbufinfo( p_aout->p_sys->p_aout, + i_buffer_limit ); } /***************************************************************************** - * aout_Play: play a sound samples buffer + * Play: play a sound samples buffer ***************************************************************************** * This function writes a buffer of i_length bytes in the socket *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *p_buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *p_buffer, int i_size ) { picture_t *p_outpic; int i_index, i_image; @@ -220,7 +197,7 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *p_buffer, int i_size ) u16 *p_sample; /* Play the real sound */ - p_aout->p_sys->aout.pf_play( &p_aout->p_sys->aout, p_buffer, i_size ); + p_aout->p_sys->p_aout->pf_play( p_aout->p_sys->p_aout, p_buffer, i_size ); for( i_image = 0; (i_image + 1) * SCOPE_WIDTH * 8 < i_size ; i_image++ ) { @@ -303,13 +280,20 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *p_buffer, int i_size ) } /***************************************************************************** - * aout_Close: close the Esound socket + * Close: close the plugin *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +static void Close( vlc_object_t *p_this ) { - p_aout->p_sys->aout.pf_close( &p_aout->p_sys->aout ); - module_Unneed( p_aout->p_sys->aout.p_module ); + aout_thread_t *p_aout = (aout_thread_t *)p_this; + + /* Kill audio output */ + module_Unneed( p_aout->p_sys->p_aout, p_aout->p_sys->p_aout->p_module ); + vlc_object_detach_all( p_aout->p_sys->p_aout ); + vlc_object_destroy( p_aout->p_sys->p_aout ); + + /* Kill video output */ vout_DestroyThread( p_aout->p_sys->p_vout ); + free( p_aout->p_sys ); } diff --git a/plugins/ggi/ggi.c b/plugins/ggi/ggi.c index 87e735439e..28de1c46bc 100644 --- a/plugins/ggi/ggi.c +++ b/plugins/ggi/ggi.c @@ -2,7 +2,7 @@ * ggi.c : GGI plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: ggi.c,v 1.24 2002/07/23 00:39:17 sam Exp $ + * $Id: ggi.c,v 1.25 2002/07/31 20:56:51 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -36,46 +36,35 @@ #include /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Display ( vout_thread_t *, picture_t * ); static int OpenDisplay ( vout_thread_t * ); static void CloseDisplay ( vout_thread_t * ); static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ #define DISPLAY_TEXT N_("X11 display name") #define DISPLAY_LONGTEXT N_("Specify the X11 hardware display you want to use."\ "\nBy default vlc will use the value of the DISPLAY"\ " environment variable.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING ( "ggi_display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( "General Graphics Interface video output" ) - ADD_CAPABILITY( VOUT, 30 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string( "ggi-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ); + set_description( "General Graphics Interface video output" ); + set_capability( "video output", 30 ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: video output GGI method descriptor @@ -99,29 +88,16 @@ struct vout_sys_t }; /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocate GGI video thread output method + * Create: allocate GGI video thread output method ***************************************************************************** * This function allocate and initialize a GGI vout method. It uses some of the * vout properties to choose the correct mode, and change them according to the * mode actually used. *****************************************************************************/ -int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) @@ -138,15 +114,21 @@ int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = NULL; + p_vout->pf_display = Display; + return( 0 ); } /***************************************************************************** - * vout_Init: initialize GGI video thread output method + * Init: initialize GGI video thread output method ***************************************************************************** * This function initialize the GGI display device. *****************************************************************************/ -int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { #define p_b p_vout->p_sys->pp_buffer int i_index; @@ -251,11 +233,11 @@ int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate GGI video thread output method + * End: terminate GGI video thread output method ***************************************************************************** - * Terminate an output method created by vout_Create + * Terminate an output method created by Create *****************************************************************************/ -void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { #define p_b p_vout->p_sys->pp_buffer /* Release buffer */ @@ -267,24 +249,26 @@ void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy GGI video thread output method + * Destroy: destroy GGI video thread output method ***************************************************************************** - * Terminate an output method created by vout_Create + * Terminate an output method created by Create *****************************************************************************/ -void vout_Destroy( vout_thread_t *p_vout ) -{ +static void Destroy( vlc_object_t *p_this ) +{ + vout_thread_t *p_vout = (vout_thread_t *)p_this; + CloseDisplay( p_vout ); free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle GGI events + * Manage: handle GGI events ***************************************************************************** * This function should be called regularly by video output thread. It returns * a non null value if an error occured. *****************************************************************************/ -int vout_Manage( vout_thread_t *p_vout ) +static int Manage( vout_thread_t *p_vout ) { struct timeval tv = { 0, 1000 }; /* 1 millisecond */ gii_event_mask mask; @@ -344,17 +328,9 @@ int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Render: displays previously rendered output - *****************************************************************************/ -void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - -/***************************************************************************** - * vout_Display: displays previously rendered output + * Display: displays previously rendered output *****************************************************************************/ -void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void Display( vout_thread_t *p_vout, picture_t *p_pic ) { #define p_b p_vout->p_sys->pp_buffer p_pic->p->p_pixels = p_b[ p_vout->p_sys->i_index ]->write; diff --git a/plugins/glide/glide.c b/plugins/glide/glide.c index 3fc9cecce6..78fc4dbbfc 100644 --- a/plugins/glide/glide.c +++ b/plugins/glide/glide.c @@ -2,7 +2,7 @@ * glide.c : 3dfx Glide plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: glide.c,v 1.17 2002/07/23 00:39:17 sam Exp $ + * $Id: glide.c,v 1.18 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -44,39 +44,28 @@ #define GLIDE_BYTES_PER_PIXEL 2 /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Display ( vout_thread_t *, picture_t * ); static int OpenDisplay ( vout_thread_t * ); static void CloseDisplay ( vout_thread_t * ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("3dfx Glide module") ) - ADD_CAPABILITY( VOUT, 20 ) - ADD_SHORTCUT( "3dfx" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("3dfx Glide module") ); + set_capability( "video output", 20 ); + add_shortcut( "3dfx" ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: Glide video output method descriptor @@ -93,27 +82,14 @@ struct vout_sys_t }; /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( vout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates Glide video thread output method + * Create: allocates Glide video thread output method ***************************************************************************** * This function allocates and initializes a Glide vout method. *****************************************************************************/ -int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) @@ -130,13 +106,19 @@ int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = NULL; + p_vout->pf_display = Display; + return( 0 ); } /***************************************************************************** - * vout_Init: initialize Glide video thread output method + * Init: initialize Glide video thread output method *****************************************************************************/ -int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -187,31 +169,32 @@ int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Glide video thread output method + * End: terminate Glide video thread output method *****************************************************************************/ -void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { ; } /***************************************************************************** - * vout_Destroy: destroy Glide video thread output method + * Destroy: destroy Glide video thread output method ***************************************************************************** - * Terminate an output method created by vout_CreateOutputMethod + * Terminate an output method created by Create *****************************************************************************/ -void vout_Destroy( vout_thread_t *p_vout ) +static void Destroy( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; CloseDisplay( p_vout ); free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle Glide events + * Manage: handle Glide events ***************************************************************************** * This function should be called regularly by video output thread. It manages * console events. It returns a non null value on error. *****************************************************************************/ -int vout_Manage( vout_thread_t *p_vout ) +static int Manage( vout_thread_t *p_vout ) { int buf; @@ -235,17 +218,9 @@ int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Render: renders previously calculated output - *****************************************************************************/ -void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - -/***************************************************************************** - * vout_Display: displays previously rendered output + * Display: displays previously rendered output *****************************************************************************/ -void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void Display( vout_thread_t *p_vout, picture_t *p_pic ) { grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER ); diff --git a/plugins/gtk/gnome.c b/plugins/gtk/gnome.c index 1093aef0c2..3ea6b4277a 100644 --- a/plugins/gtk/gnome.c +++ b/plugins/gtk/gnome.c @@ -2,7 +2,7 @@ * gnome.c : Gnome plugin for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: gnome.c,v 1.31 2002/07/23 19:28:25 stef Exp $ + * $Id: gnome.c,v 1.32 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -43,12 +43,11 @@ /***************************************************************************** * Local prototypes. *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ); -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); -static gint GnomeManage ( gpointer p_data ); +static void Run ( intf_thread_t * ); +static gint Manage ( gpointer ); /***************************************************************************** * Local variables (mutex-protected). @@ -56,7 +55,7 @@ static gint GnomeManage ( gpointer p_data ); static void ** pp_global_data = NULL; /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ #define TOOLTIPS_TEXT N_("show tooltips") #define TOOLTIPS_LONGTEXT N_("Show tooltips for configuration options.") @@ -69,38 +68,27 @@ static void ** pp_global_data = NULL; "You can set the maximum height that the configuration windows in the " \ "preferences menu will occupy.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_BOOL ( "gnome-tooltips", 1, GtkHideTooltips, TOOLTIPS_TEXT, - TOOLTIPS_LONGTEXT ) -ADD_BOOL ( "gnome-toolbartext", 1, GtkHideToolbarText, TOOLBAR_TEXT, - TOOLBAR_LONGTEXT ) -ADD_INTEGER( "gnome-prefs-maxh", 480, NULL, PREFS_MAXH_TEXT, - PREFS_MAXH_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - pp_global_data = p_module->p_vlc->pp_global_data; - SET_DESCRIPTION( _("Gnome interface module") ) -#ifndef WIN32 - if( getenv( "DISPLAY" ) == NULL ) - { - ADD_CAPABILITY( INTF, 15 ) - } - else +vlc_module_begin(); +#ifdef WIN32 + int i = 90; +#else + int i = getenv( "DISPLAY" ) == NULL ? 15 : 100; #endif - { - ADD_CAPABILITY( INTF, 100 ) - } - ADD_PROGRAM( "gnome-vlc" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - intf_getfunctions( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + pp_global_data = p_module->p_vlc->pp_global_data; + + add_category_hint( N_("Miscellaneous"), NULL ); + add_bool( "gnome-tooltips", 1, GtkHideTooltips, + TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT ); + add_bool( "gnome-toolbartext", 1, GtkHideToolbarText, TOOLBAR_TEXT, + TOOLBAR_LONGTEXT ); + add_integer( "gnome-prefs-maxh", 480, NULL, + PREFS_MAXH_TEXT, PREFS_MAXH_LONGTEXT ); + + set_description( _("GNOME interface module") ); + set_capability( "interface", i ); + set_callbacks( Open, Close ); + set_program( "gnome-vlc" ); +vlc_module_end(); /***************************************************************************** * g_atexit: kludge to avoid the Gnome thread to segfault at exit @@ -146,21 +134,12 @@ void g_atexit( GVoidFunc func ) } /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Open: initialize and create window *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ) +static int Open( vlc_object_t *p_this ) { - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} + intf_thread_t *p_intf = (intf_thread_t *)p_this; -/***************************************************************************** - * intf_Open: initialize and create window - *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ /* Allocate instance and initialize some members */ p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) @@ -169,6 +148,8 @@ static int intf_Open( intf_thread_t *p_intf ) return( 1 ); } + p_intf->pf_run = Run; + p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); /* Initialize Gnome thread */ @@ -189,10 +170,12 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy interface window + * Close: destroy interface window *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) +static void Close( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t *)p_this; + if( p_intf->p_sys->p_input ) { vlc_object_release( p_intf->p_sys->p_input ); @@ -205,14 +188,14 @@ static void intf_Close( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Run: Gnome thread + * Run: Gnome thread ***************************************************************************** * this part of the interface is in a separate thread so that we can call * gtk_main() from within it without annoying the rest of the program. * XXX: the approach may look kludgy, and probably is, but I could not find * a better way to dynamically load a Gnome interface at runtime. *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { /* gnome_init needs to know the command line. We don't care, so we * give it an empty one */ @@ -327,7 +310,7 @@ static void intf_Run( intf_thread_t *p_intf ) /* Sleep to avoid using all CPU - since some interfaces needs to access * keyboard events, a 100ms delay is a good compromise */ - i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, GnomeManage, p_intf ); + i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, Manage, p_intf ); /* Enter gnome mode */ gtk_main(); @@ -350,12 +333,12 @@ static void intf_Run( intf_thread_t *p_intf ) /* following functions are local */ /***************************************************************************** - * GnomeManage: manage main thread messages + * Manage: manage main thread messages ***************************************************************************** * In this function, called approx. 10 times a second, we check what the * main program wanted to tell us. *****************************************************************************/ -static gint GnomeManage( gpointer p_data ) +static gint Manage( gpointer p_data ) { #define p_intf ((intf_thread_t *)p_data) int i_start, i_stop; diff --git a/plugins/gtk/gtk.c b/plugins/gtk/gtk.c index 19c0ac87b6..a6a79329a8 100644 --- a/plugins/gtk/gtk.c +++ b/plugins/gtk/gtk.c @@ -2,7 +2,7 @@ * gtk.c : Gtk+ plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: gtk.c,v 1.30 2002/07/15 20:09:31 sam Exp $ + * $Id: gtk.c,v 1.31 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * @@ -44,12 +44,11 @@ /***************************************************************************** * Local prototypes. *****************************************************************************/ -static void intf_getfunctions ( function_list_t * p_function_list ); -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); -static gint GtkManage ( gpointer p_data ); +static void Run ( intf_thread_t * ); +static gint Manage ( gpointer ); /***************************************************************************** * Local variables (mutex-protected). @@ -57,7 +56,7 @@ static gint GtkManage ( gpointer p_data ); static void ** pp_global_data = NULL; /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ #define TOOLTIPS_TEXT N_("show tooltips") #define TOOLTIPS_LONGTEXT N_("Show tooltips for configuration options.") @@ -67,34 +66,25 @@ static void ** pp_global_data = NULL; "You can set the maximum height that the configuration windows in the " \ "preferences menu will occupy.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_BOOL( "gtk-tooltips", 1, GtkHideTooltips, TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT) -ADD_INTEGER( "gtk-prefs-maxh", 480, NULL, PREFS_MAXH_TEXT, PREFS_MAXH_LONGTEXT) -MODULE_CONFIG_STOP - -MODULE_INIT_START - pp_global_data = p_module->p_vlc->pp_global_data; - SET_DESCRIPTION( _("Gtk+ interface module") ) -#ifndef WIN32 - if( getenv( "DISPLAY" ) == NULL ) - { - ADD_CAPABILITY( INTF, 10 ) - } - else +vlc_module_begin(); +#ifdef WIN32 + int i = 90; +#else + int i = getenv( "DISPLAY" ) == NULL ? 10 : 90; #endif - { - ADD_CAPABILITY( INTF, 90 ) - } - ADD_PROGRAM( "gvlc" ) -MODULE_INIT_STOP + pp_global_data = p_module->p_vlc->pp_global_data; -MODULE_ACTIVATE_START - intf_getfunctions( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP + add_category_hint( N_("Miscellaneous"), NULL ); + add_bool( "gtk-tooltips", 1, GtkHideTooltips, + TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT ); + add_integer( "gtk-prefs-maxh", 480, NULL, + PREFS_MAXH_TEXT, PREFS_MAXH_LONGTEXT ); -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + set_description( _("Gtk+ interface module") ); + set_capability( "interface", i ); + set_callbacks( Open, Close ); + set_program( "gvlc" ); +vlc_module_end(); /***************************************************************************** * g_atexit: kludge to avoid the Gtk+ thread to segfault at exit @@ -140,21 +130,12 @@ void g_atexit( GVoidFunc func ) } /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Open: initialize and create window *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ) +static int Open( vlc_object_t *p_this ) { - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} + intf_thread_t *p_intf = (intf_thread_t *)p_this; -/***************************************************************************** - * intf_Open: initialize and create window - *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ /* Allocate instance and initialize some members */ p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) @@ -163,6 +144,8 @@ static int intf_Open( intf_thread_t *p_intf ) return( 1 ); } + p_intf->pf_run = Run; + p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); /* Initialize Gtk+ thread */ @@ -183,10 +166,12 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy interface window + * Close: destroy interface window *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) +static void Close( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t *)p_this; + if( p_intf->p_sys->p_input ) { vlc_object_release( p_intf->p_sys->p_input ); @@ -199,14 +184,14 @@ static void intf_Close( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Run: Gtk+ thread + * Run: Gtk+ thread ***************************************************************************** * this part of the interface is in a separate thread so that we can call * gtk_main() from within it without annoying the rest of the program. * XXX: the approach may look kludgy, and probably is, but I could not find * a better way to dynamically load a Gtk+ interface at runtime. *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { /* gtk_init needs to know the command line. We don't care, so we * give it an empty one */ @@ -314,7 +299,7 @@ static void intf_Run( intf_thread_t *p_intf ) /* Sleep to avoid using all CPU - since some interfaces needs to access * keyboard events, a 100ms delay is a good compromise */ - i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, GtkManage, p_intf ); + i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, Manage, p_intf ); /* Enter Gtk mode */ gtk_main(); @@ -337,12 +322,12 @@ static void intf_Run( intf_thread_t *p_intf ) /* following functions are local */ /***************************************************************************** - * GtkManage: manage main thread messages + * Manage: manage main thread messages ***************************************************************************** * In this function, called approx. 10 times a second, we check what the * main program wanted to tell us. *****************************************************************************/ -static gint GtkManage( gpointer p_data ) +static gint Manage( gpointer p_data ) { #define p_intf ((intf_thread_t *)p_data) int i_start, i_stop; diff --git a/plugins/gtk/gtk_preferences.c b/plugins/gtk/gtk_preferences.c index b6fd1644e9..a06d4654e8 100644 --- a/plugins/gtk/gtk_preferences.c +++ b/plugins/gtk/gtk_preferences.c @@ -2,7 +2,7 @@ * gtk_preferences.c: functions to handle the preferences dialog box. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_preferences.c,v 1.34 2002/07/11 19:28:13 sam Exp $ + * $Id: gtk_preferences.c,v 1.35 2002/07/31 20:56:51 sam Exp $ * * Authors: Gildas Bazin * Loïc Minier @@ -172,7 +172,7 @@ static void GtkCreateConfigDialog( char *psz_module_name, /* Look for the selected module */ - for( p_module = p_intf->p_vlc->module_bank.first ; p_module != NULL ; + for( p_module = p_intf->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -315,17 +315,26 @@ static void GtkCreateConfigDialog( char *psz_module_name, /* build a list of available modules */ { gchar * entry[2]; + char * psz_capability; - for( p_module_bis = p_intf->p_vlc->module_bank.first ; + for( p_module_bis = p_intf->p_vlc->p_module_bank->first ; p_module_bis != NULL ; p_module_bis = p_module_bis->next ) { - if( p_module_bis->i_capabilities & (1 << p_item->i_value) ) +#if 0 /* FIXME */ + for( psz_capability = p_module_bis->pp_capabilities[0] ; + *psz_capability ; + psz_capability++ ) { - entry[0] = p_module_bis->psz_object_name; - entry[1] = p_module_bis->psz_longname; - gtk_clist_append( GTK_CLIST(module_clist), entry ); + if( !strcmp( psz_capability, p_item->psz_type ) ) + { + entry[0] = p_module_bis->psz_object_name; + entry[1] = p_module_bis->psz_longname; + gtk_clist_append( GTK_CLIST(module_clist), entry ); + break; + } } +#endif } } @@ -651,7 +660,7 @@ void GtkModuleHighlighted( GtkCList *module_clist, int row, int column, if( gtk_clist_get_text( GTK_CLIST(module_clist), row, 0, &psz_name ) ) { /* look for module 'psz_name' */ - for( p_module = p_intf->p_vlc->module_bank.first ; + for( p_module = p_intf->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { diff --git a/plugins/idct/idct.c b/plugins/idct/idct.c index af1fa323ae..9e39acb755 100644 --- a/plugins/idct/idct.c +++ b/plugins/idct/idct.c @@ -2,7 +2,7 @@ * idct.c : C IDCT module ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: idct.c,v 1.24 2002/06/01 12:31:59 sam Exp $ + * $Id: idct.c,v 1.25 2002/07/31 20:56:51 sam Exp $ * * Author: Gaël Hendryckx * @@ -32,29 +32,17 @@ #include "idct.h" #include "block_c.h" -/***************************************************************************** - * Local and extern prototypes. - *****************************************************************************/ -static void idct_getfunctions( function_list_t * p_function_list ); +static int Open( vlc_object_t *p_this ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("IDCT module") ) - ADD_CAPABILITY( IDCT, 50 ) - ADD_SHORTCUT( "c" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - idct_getfunctions( &p_module->p_functions->idct ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("IDCT module") ); + set_capability( "idct", 50 ); + add_shortcut( "c" ); + set_callbacks( Open, NULL ); +vlc_module_end(); /* Following functions are local */ diff --git a/plugins/idct/idct_decl.h b/plugins/idct/idct_decl.h index 4f0de977f5..a177fc353e 100644 --- a/plugins/idct/idct_decl.h +++ b/plugins/idct/idct_decl.h @@ -2,7 +2,7 @@ * idct_decl.h : common declarations, must be included at the very end ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idct_decl.h,v 1.2 2002/02/15 13:32:53 sam Exp $ + * $Id: idct_decl.h,v 1.3 2002/07/31 20:56:51 sam Exp $ * * Author: Christophe Massiot * @@ -38,19 +38,16 @@ static void IDCTAdd( dctelem_t * p_block, yuv_data_t * p_dest, AddBlock( p_block, p_dest, i_stride ); } +static void * IDCTFunctions[] = + { InitIDCT, NormScan, SparseIDCTAdd, SparseIDCTCopy, IDCTAdd, IDCTCopy }; + /***************************************************************************** * Functions exported as capabilities. They are declared as static so that * we don't pollute the namespace too much. *****************************************************************************/ -static void idct_getfunctions( function_list_t * p_function_list ) +static int Open( vlc_object_t *p_this ) { -#define F p_function_list->functions.idct - F.pf_idct_init = InitIDCT; - F.pf_norm_scan = NormScan; - F.pf_sparse_idct_add = SparseIDCTAdd; - F.pf_sparse_idct_copy = SparseIDCTCopy; - F.pf_idct_add = IDCTAdd; - F.pf_idct_copy = IDCTCopy; -#undef F + p_this->p_private = IDCTFunctions; + return VLC_SUCCESS; } diff --git a/plugins/idct/idctaltivec.c b/plugins/idct/idctaltivec.c index de0796539e..24eb39f96b 100644 --- a/plugins/idct/idctaltivec.c +++ b/plugins/idct/idctaltivec.c @@ -2,7 +2,7 @@ * idctaltivec.c : AltiVec IDCT module ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: idctaltivec.c,v 1.26 2002/06/01 16:45:34 sam Exp $ + * $Id: idctaltivec.c,v 1.27 2002/07/31 20:56:51 sam Exp $ * * Authors: Christophe Massiot * @@ -36,32 +36,18 @@ #include "idct.h" -/***************************************************************************** - * Local prototypes. - *****************************************************************************/ -static void idct_getfunctions( function_list_t * p_function_list ); +static int Open( vlc_object_t *p_this ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("AltiVec IDCT module") ) - ADD_CAPABILITY( IDCT, 200 ) - ADD_REQUIREMENT( ALTIVEC ) - ADD_SHORTCUT( "altivec" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - idct_getfunctions( &p_module->p_functions->idct ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ +vlc_module_begin(); + set_description( _("AltiVec IDCT module") ); + set_capability( "idct", 200 ); + add_shortcut( "altivec" ); + add_requirement( ALTIVEC ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * NormScan : This IDCT uses reordered coeffs, so we patch the scan table diff --git a/plugins/idct/idctclassic.c b/plugins/idct/idctclassic.c index 90dd083867..4e2d29ff57 100644 --- a/plugins/idct/idctclassic.c +++ b/plugins/idct/idctclassic.c @@ -2,7 +2,7 @@ * idctclassic.c : Classic IDCT module ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: idctclassic.c,v 1.25 2002/06/01 12:31:59 sam Exp $ + * $Id: idctclassic.c,v 1.26 2002/07/31 20:56:51 sam Exp $ * * Authors: Gaël Hendryckx * @@ -32,31 +32,17 @@ #include "idct.h" #include "block_c.h" -/***************************************************************************** - * Local and extern prototypes. - *****************************************************************************/ -static void idct_getfunctions( function_list_t * p_function_list ); +static int Open( vlc_object_t *p_this ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("classic IDCT module") ) - ADD_CAPABILITY( IDCT, 100 ) - ADD_SHORTCUT( "classic" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - idct_getfunctions( &p_module->p_functions->idct ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ +vlc_module_begin(); + set_description( _("classic IDCT module") ); + set_capability( "idct", 100 ); + add_shortcut( "classic" ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * NormScan : Unused in this IDCT @@ -293,4 +279,3 @@ static inline void RestoreCPUState( ) #include "idct_sparse.h" #include "idct_decl.h" - diff --git a/plugins/idct/idctmmx.c b/plugins/idct/idctmmx.c index 0b0de44bfc..b7b4ad33e2 100644 --- a/plugins/idct/idctmmx.c +++ b/plugins/idct/idctmmx.c @@ -2,7 +2,7 @@ * idctmmx.c : MMX IDCT module ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: idctmmx.c,v 1.27 2002/06/01 12:31:59 sam Exp $ + * $Id: idctmmx.c,v 1.28 2002/07/31 20:56:51 sam Exp $ * * Authors: Aaron Holtzman * Michel Lespinasse @@ -38,32 +38,18 @@ #include "idct.h" #include "block_mmx.h" -/***************************************************************************** - * Local prototypes. - *****************************************************************************/ -static void idct_getfunctions( function_list_t * p_function_list ); +static int Open( vlc_object_t *p_this ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("MMX IDCT module") ) - ADD_CAPABILITY( IDCT, 150 ) - ADD_REQUIREMENT( MMX ) - ADD_SHORTCUT( "mmx" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - idct_getfunctions( &p_module->p_functions->idct ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ +vlc_module_begin(); + set_description( _("MMX IDCT module") ); + set_capability( "idct", 150 ); + add_shortcut( "mmx" ); + add_requirement( MMX ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * NormScan : This IDCT uses reordered coeffs, so we patch the scan table diff --git a/plugins/idct/idctmmxext.c b/plugins/idct/idctmmxext.c index 19ab685148..80e0be6feb 100644 --- a/plugins/idct/idctmmxext.c +++ b/plugins/idct/idctmmxext.c @@ -2,7 +2,7 @@ * idctmmxext.c : MMX EXT IDCT module ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: idctmmxext.c,v 1.24 2002/06/01 12:31:59 sam Exp $ + * $Id: idctmmxext.c,v 1.25 2002/07/31 20:56:51 sam Exp $ * * Authors: Aaron Holtzman * Michel Lespinasse @@ -38,32 +38,18 @@ #include "idct.h" #include "block_mmx.h" -/***************************************************************************** - * Local prototypes. - *****************************************************************************/ -static void idct_getfunctions( function_list_t * p_function_list ); +static int Open( vlc_object_t *p_this ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("MMX EXT IDCT module") ) - ADD_CAPABILITY( IDCT, 200 ) - ADD_REQUIREMENT( MMXEXT ) - ADD_SHORTCUT( "mmxext" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - idct_getfunctions( &p_module->p_functions->idct ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ +vlc_module_begin(); + set_description( _("MMX EXT IDCT module") ); + set_capability( "idct", 200 ); + add_shortcut( "mmxext" ); + add_requirement( MMXEXT ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * NormScan : This IDCT uses reordered coeffs, so we patch the scan table diff --git a/plugins/imdct/Makefile b/plugins/imdct/Makefile index 32c0f91bed..ceec9a617a 100644 --- a/plugins/imdct/Makefile +++ b/plugins/imdct/Makefile @@ -1,5 +1,5 @@ COMMON_SOURCES = ac3_imdct_common.c imdct_SOURCES = imdct.c ac3_imdct_c.c ac3_srfft_c.c $(COMMON_SOURCES) -imdctsse_SOURCES = imdctsse.c ac3_imdct_sse.c ac3_srfft_sse.c $(COMMON_SOURCES) -imdct3dn_SOURCES = imdct3dn.c ac3_imdct_3dn.c ac3_srfft_3dn.c $(COMMON_SOURCES) +imdctsse_SOURCES = imdct.c ac3_imdct_sse.c ac3_srfft_sse.c $(COMMON_SOURCES) +imdct3dn_SOURCES = imdct.c ac3_imdct_3dn.c ac3_srfft_3dn.c $(COMMON_SOURCES) diff --git a/plugins/imdct/ac3_imdct_3dn.c b/plugins/imdct/ac3_imdct_3dn.c index b79dda37d0..f21159bff5 100644 --- a/plugins/imdct/ac3_imdct_3dn.c +++ b/plugins/imdct/ac3_imdct_3dn.c @@ -2,7 +2,7 @@ * ac3_imdct_3dn.c: accelerated 3D Now! ac3 DCT ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_imdct_3dn.c,v 1.11 2002/06/01 12:31:59 sam Exp $ + * $Id: ac3_imdct_3dn.c,v 1.12 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * @@ -37,8 +37,8 @@ # define M_PI 3.14159265358979323846 #endif -void _M( fft_64p ) ( complex_t *x ); -void _M( fft_128p ) ( complex_t *a ); +void E_( fft_64p ) ( complex_t *x ); +void E_( fft_128p ) ( complex_t *a ); static void imdct512_pre_ifft_twiddle_3dn (const int *pmt, complex_t *buf, float *data, float *xcos_sin_sse); static void imdct512_post_ifft_twiddle_3dn (complex_t *buf, float *xcos_sin_sse); @@ -46,7 +46,7 @@ static void imdct512_window_delay_3dn (complex_t *buf, float *data_ptr, float *w static void imdct512_window_delay_nol_3dn (complex_t *buf, float *data_ptr, float *window_prt, float *delay_prt); -void _M( imdct_init ) (imdct_t * p_imdct) +void E_( imdct_init ) (imdct_t * p_imdct) { int i; float scale = 181.019; @@ -62,18 +62,18 @@ void _M( imdct_init ) (imdct_t * p_imdct) } } -void _M( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[]) +void E_( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[]) { imdct512_pre_ifft_twiddle_3dn (pm128, p_imdct->buf, data, p_imdct->xcos_sin_sse); - _M( fft_128p ) (p_imdct->buf); + E_( fft_128p ) (p_imdct->buf); imdct512_post_ifft_twiddle_3dn (p_imdct->buf, p_imdct->xcos_sin_sse); imdct512_window_delay_3dn (p_imdct->buf, data, window, delay); } -void _M( imdct_do_512_nol ) (imdct_t * p_imdct, float data[], float delay[]) +void E_( imdct_do_512_nol ) (imdct_t * p_imdct, float data[], float delay[]) { imdct512_pre_ifft_twiddle_3dn (pm128, p_imdct->buf, data, p_imdct->xcos_sin_sse); - _M( fft_128p ) (p_imdct->buf); + E_( fft_128p ) (p_imdct->buf); imdct512_post_ifft_twiddle_3dn (p_imdct->buf, p_imdct->xcos_sin_sse); imdct512_window_delay_nol_3dn (p_imdct->buf, data, window, delay); } diff --git a/plugins/imdct/ac3_imdct_c.c b/plugins/imdct/ac3_imdct_c.c index f9f2b97dd0..ef1206f5d3 100644 --- a/plugins/imdct/ac3_imdct_c.c +++ b/plugins/imdct/ac3_imdct_c.c @@ -2,7 +2,7 @@ * ac3_imdct_c.c: ac3 DCT in C ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ac3_imdct_c.c,v 1.6 2002/06/01 12:31:59 sam Exp $ + * $Id: ac3_imdct_c.c,v 1.7 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -40,10 +40,10 @@ # define M_PI 3.14159265358979323846 #endif -void _M( fft_64p ) ( complex_t *x ); -void _M( fft_128p ) ( complex_t *x ); +void E_( fft_64p ) ( complex_t *x ); +void E_( fft_128p ) ( complex_t *x ); -void _M( imdct_init ) (imdct_t * p_imdct) +void E_( imdct_init ) (imdct_t * p_imdct) { int i; float scale = 181.019; @@ -55,7 +55,7 @@ void _M( imdct_init ) (imdct_t * p_imdct) } } -void _M( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[]) +void E_( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[]) { int i, j; float tmp_a_r, tmp_a_i; @@ -77,7 +77,7 @@ void _M( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[]) p_imdct->buf[i].imag = -1.0 * (data[2*j] * p_imdct->xcos1[j] + data[256-2*j-1] * p_imdct->xsin1[j]); } - _M( fft_128p ) ( &p_imdct->buf[0] ); + E_( fft_128p ) ( &p_imdct->buf[0] ); /* Post IFFT complex multiply plus IFFT complex conjugate */ for (i=0; i < 128; i++) { @@ -122,7 +122,7 @@ void _M( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[]) } -void _M( imdct_do_512_nol ) (imdct_t * p_imdct, float data[], float delay[]) +void E_( imdct_do_512_nol ) (imdct_t * p_imdct, float data[], float delay[]) { int i, j; @@ -148,7 +148,7 @@ void _M( imdct_do_512_nol ) (imdct_t * p_imdct, float data[], float delay[]) p_imdct->buf[i].imag = -1.0 * (data[2*j] * p_imdct->xcos1[j] + data[256-2*j-1] * p_imdct->xsin1[j]); } - _M( fft_128p ) ( &p_imdct->buf[0] ); + E_( fft_128p ) ( &p_imdct->buf[0] ); /* Post IFFT complex multiply plus IFFT complex conjugate*/ for (i=0; i < 128; i++) { diff --git a/plugins/imdct/ac3_imdct_common.c b/plugins/imdct/ac3_imdct_common.c index 943197f2e9..cecde1b44c 100644 --- a/plugins/imdct/ac3_imdct_common.c +++ b/plugins/imdct/ac3_imdct_common.c @@ -2,7 +2,7 @@ * ac3_imdct_common.c: common ac3 DCT functions ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_imdct_common.c,v 1.7 2002/06/01 12:31:59 sam Exp $ + * $Id: ac3_imdct_common.c,v 1.8 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -37,9 +37,9 @@ # define M_PI 3.14159265358979323846 #endif -void _M( fft_64p ) ( complex_t *x ); +void E_( fft_64p ) ( complex_t *x ); -void _M( imdct_do_256 ) (imdct_t * p_imdct, float data[],float delay[]) +void E_( imdct_do_256 ) (imdct_t * p_imdct, float data[],float delay[]) { int i, j, k; int p, q; @@ -73,8 +73,8 @@ void _M( imdct_do_256 ) (imdct_t * p_imdct, float data[],float delay[]) buf2[k].imag = -1.0f*(data[q + 1] * p_imdct->xcos2[j] + data[p + 1] * p_imdct->xsin2[j]); } - _M( fft_64p ) ( &buf1[0] ); - _M( fft_64p ) ( &buf2[0] ); + E_( fft_64p ) ( &buf1[0] ); + E_( fft_64p ) ( &buf2[0] ); /* Post IFFT complex multiply */ for( i=0; i < 64; i++) { @@ -117,7 +117,7 @@ void _M( imdct_do_256 ) (imdct_t * p_imdct, float data[],float delay[]) } -void _M( imdct_do_256_nol ) (imdct_t * p_imdct, float data[], float delay[]) +void E_( imdct_do_256_nol ) (imdct_t * p_imdct, float data[], float delay[]) { int i, j, k; int p, q; @@ -150,8 +150,8 @@ void _M( imdct_do_256_nol ) (imdct_t * p_imdct, float data[], float delay[]) buf2[k].imag = -1.0f*(data[q + 1] * p_imdct->xcos2[j] + data[p + 1] * p_imdct->xsin2[j]); } - _M( fft_64p ) ( &buf1[0] ); - _M( fft_64p ) ( &buf2[0] ); + E_( fft_64p ) ( &buf1[0] ); + E_( fft_64p ) ( &buf2[0] ); /* Post IFFT complex multiply */ for( i=0; i < 64; i++) { diff --git a/plugins/imdct/ac3_imdct_common.h b/plugins/imdct/ac3_imdct_common.h index 3977b2a3ba..f22b297714 100644 --- a/plugins/imdct/ac3_imdct_common.h +++ b/plugins/imdct/ac3_imdct_common.h @@ -2,7 +2,7 @@ * ac3_imdct_common.h: common ac3 DCT headers ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_imdct_common.h,v 1.2 2001/05/16 14:51:29 reno Exp $ + * $Id: ac3_imdct_common.h,v 1.3 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -22,8 +22,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -void _M( imdct_init ) ( imdct_t * p_imdct ); -void _M( imdct_do_256 ) ( imdct_t * p_imdct, float data[], float delay[] ); -void _M( imdct_do_256_nol ) ( imdct_t * p_imdct, float data[], float delay[] ); -void _M( imdct_do_512 ) ( imdct_t * p_imdct, float data[], float delay[] ); -void _M( imdct_do_512_nol ) ( imdct_t * p_imdct, float data[], float delay[] ); +void E_( imdct_init ) ( imdct_t * p_imdct ); +void E_( imdct_do_256 ) ( imdct_t * p_imdct, float data[], float delay[] ); +void E_( imdct_do_256_nol ) ( imdct_t * p_imdct, float data[], float delay[] ); +void E_( imdct_do_512 ) ( imdct_t * p_imdct, float data[], float delay[] ); +void E_( imdct_do_512_nol ) ( imdct_t * p_imdct, float data[], float delay[] ); diff --git a/plugins/imdct/ac3_imdct_sse.c b/plugins/imdct/ac3_imdct_sse.c index 56863afed3..06000970dc 100644 --- a/plugins/imdct/ac3_imdct_sse.c +++ b/plugins/imdct/ac3_imdct_sse.c @@ -2,7 +2,7 @@ * ac3_imdct_sse.c: accelerated SSE ac3 DCT ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: ac3_imdct_sse.c,v 1.12 2002/06/01 12:31:59 sam Exp $ + * $Id: ac3_imdct_sse.c,v 1.13 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -38,8 +38,8 @@ # define M_PI 3.14159265358979323846 #endif -void _M( fft_64p ) ( complex_t *x ); -void _M( fft_128p ) ( complex_t *a ); +void E_( fft_64p ) ( complex_t *x ); +void E_( fft_128p ) ( complex_t *a ); static void imdct512_pre_ifft_twiddle_sse ( const int *, complex_t *, float *, float * ); @@ -49,7 +49,7 @@ static void imdct512_window_delay_sse ( complex_t *, float *, static void imdct512_window_delay_nol_sse ( complex_t *, float *, float *, float * ); -void _M( imdct_init ) (imdct_t * p_imdct) +void E_( imdct_init ) (imdct_t * p_imdct) { int i; float scale = 181.019; @@ -65,21 +65,21 @@ void _M( imdct_init ) (imdct_t * p_imdct) } } -void _M( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[]) +void E_( imdct_do_512 ) (imdct_t * p_imdct, float data[], float delay[]) { imdct512_pre_ifft_twiddle_sse( pm128, p_imdct->buf, data, p_imdct->xcos_sin_sse ); - _M( fft_128p ) ( p_imdct->buf ); + E_( fft_128p ) ( p_imdct->buf ); imdct512_post_ifft_twiddle_sse( p_imdct->buf, p_imdct->xcos_sin_sse ); imdct512_window_delay_sse( p_imdct->buf, data, window, delay ); } -void _M( imdct_do_512_nol ) (imdct_t * p_imdct, float data[], float delay[]) +void E_( imdct_do_512_nol ) (imdct_t * p_imdct, float data[], float delay[]) { imdct512_pre_ifft_twiddle_sse( pm128, p_imdct->buf, data, p_imdct->xcos_sin_sse ); - _M( fft_128p ) ( p_imdct->buf ); + E_( fft_128p ) ( p_imdct->buf ); imdct512_post_ifft_twiddle_sse( p_imdct->buf, p_imdct->xcos_sin_sse ); imdct512_window_delay_nol_sse( p_imdct->buf, data, window, delay ); } diff --git a/plugins/imdct/ac3_srfft_3dn.c b/plugins/imdct/ac3_srfft_3dn.c index 90b9f2c57d..b39303d4ef 100644 --- a/plugins/imdct/ac3_srfft_3dn.c +++ b/plugins/imdct/ac3_srfft_3dn.c @@ -2,7 +2,7 @@ * ac3_srfft_3dn.c: accelerated 3D Now! ac3 fft functions ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ac3_srfft_3dn.c,v 1.6 2002/06/01 12:31:59 sam Exp $ + * $Id: ac3_srfft_3dn.c,v 1.7 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * @@ -39,7 +39,7 @@ static void fft_8_3dn (complex_t *x); static void fft_asmb_3dn (int k, complex_t *x, complex_t *wTB, const complex_t *d, const complex_t *d_3); -void _M( fft_64p ) ( complex_t *a ) +void E_( fft_64p ) ( complex_t *a ) { fft_8_3dn(&a[0]); fft_4_3dn(&a[8]); fft_4_3dn(&a[12]); fft_asmb_3dn(2, &a[0], &a[8], &delta16[0], &delta16_3[0]); @@ -56,7 +56,7 @@ void _M( fft_64p ) ( complex_t *a ) fft_asmb_3dn(8, &a[0], &a[32],&delta64[0], &delta64_3[0]); } -void _M( fft_128p ) ( complex_t *a ) +void E_( fft_128p ) ( complex_t *a ) { fft_8_3dn(&a[0]); fft_4_3dn(&a[8]); fft_4_3dn(&a[12]); fft_asmb_3dn(2, &a[0], &a[8], &delta16[0], &delta16_3[0]); diff --git a/plugins/imdct/ac3_srfft_c.c b/plugins/imdct/ac3_srfft_c.c index 8e124a52bb..972c6ca516 100644 --- a/plugins/imdct/ac3_srfft_c.c +++ b/plugins/imdct/ac3_srfft_c.c @@ -2,7 +2,7 @@ * ac3_srfft.c: ac3 FFT in C ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ac3_srfft_c.c,v 1.5 2002/06/01 12:31:59 sam Exp $ + * $Id: ac3_srfft_c.c,v 1.6 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -249,7 +249,7 @@ static void fft_asmb16(complex_t *x, complex_t *wTB) } -void _M( fft_64p ) ( complex_t *a ) +void E_( fft_64p ) ( complex_t *a ) { fft_8(&a[0]); fft_4(&a[8]); fft_4(&a[12]); fft_asmb16(&a[0], &a[8]); @@ -267,7 +267,7 @@ void _M( fft_64p ) ( complex_t *a ) } -void _M( fft_128p ) ( complex_t *a ) +void E_( fft_128p ) ( complex_t *a ) { fft_8(&a[0]); fft_4(&a[8]); fft_4(&a[12]); fft_asmb16(&a[0], &a[8]); diff --git a/plugins/imdct/ac3_srfft_sse.c b/plugins/imdct/ac3_srfft_sse.c index 55f6a5bed2..c3b0570ebd 100644 --- a/plugins/imdct/ac3_srfft_sse.c +++ b/plugins/imdct/ac3_srfft_sse.c @@ -2,7 +2,7 @@ * ac3_srfft_sse.c: accelerated SSE ac3 fft functions ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ac3_srfft_sse.c,v 1.13 2002/06/01 12:31:59 sam Exp $ + * $Id: ac3_srfft_sse.c,v 1.14 2002/07/31 20:56:51 sam Exp $ * * Authors: Renaud Dartus * Aaron Holtzman @@ -51,7 +51,7 @@ static void fft_8_sse (complex_t *x); static void fft_asmb_sse (ck_sse_t * ck, int k, complex_t *x, complex_t *wTB, const complex_t *d, const complex_t *d_3); -void _M( fft_64p ) ( complex_t *a ) +void E_( fft_64p ) ( complex_t *a ) { ck_sse_t ck; ck.C1 = C_1_sse; @@ -71,7 +71,7 @@ void _M( fft_64p ) ( complex_t *a ) fft_asmb_sse(&ck, 8, &a[0], &a[32],&delta64[0], &delta64_3[0]); } -void _M( fft_128p ) ( complex_t *a ) +void E_( fft_128p ) ( complex_t *a ) { ck_sse_t ck; ck.C1 = C_1_sse; diff --git a/plugins/imdct/imdct.c b/plugins/imdct/imdct.c index 2ebf2844f8..9dbf11e93a 100644 --- a/plugins/imdct/imdct.c +++ b/plugins/imdct/imdct.c @@ -2,7 +2,7 @@ * imdct.c : IMDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: imdct.c,v 1.10 2002/06/01 12:31:59 sam Exp $ + * $Id: imdct.c,v 1.11 2002/07/31 20:56:51 sam Exp $ * * Authors: Gaël Hendryckx * @@ -33,43 +33,39 @@ #include "ac3_imdct_common.h" /***************************************************************************** - * Local and extern prototypes. + * Module initializer *****************************************************************************/ -static void imdct_getfunctions( function_list_t * p_function_list ); - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("AC3 IMDCT module") ) - ADD_CAPABILITY( IMDCT, 50 ) - ADD_SHORTCUT( "c" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - imdct_getfunctions( &p_module->p_functions->imdct ); -MODULE_ACTIVATE_STOP +static int Open ( vlc_object_t *p_this ) +{ + imdct_t *p_imdct = (imdct_t *)p_this; -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + p_imdct->pf_imdct_init = E_( imdct_init ); + p_imdct->pf_imdct_256 = E_( imdct_do_256 ); + p_imdct->pf_imdct_256_nol = E_( imdct_do_256_nol ); + p_imdct->pf_imdct_512 = E_( imdct_do_512 ); + p_imdct->pf_imdct_512_nol = E_( imdct_do_512_nol ); -/* Following functions are local */ + return VLC_SUCCESS; +} /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void imdct_getfunctions( function_list_t * p_function_list ) -{ -#define F p_function_list->functions.imdct - F.pf_imdct_init = _M( imdct_init ); - F.pf_imdct_256 = _M( imdct_do_256 ); - F.pf_imdct_256_nol = _M( imdct_do_256_nol ); - F.pf_imdct_512 = _M( imdct_do_512 ); - F.pf_imdct_512_nol = _M( imdct_do_512_nol ); -#undef F -} +vlc_module_begin(); +#if defined( MODULE_NAME_IS_imdct ) + set_description( _("AC3 IMDCT module") ); + set_capability( "imdct", 50 ); + add_shortcut( "c" ); +#elif defined( MODULE_NAME_IS_imdctsse ) + set_description( _("SSE AC3 IMDCT module") ); + set_capability( "imdct", 200 ); + add_shortcut( "sse" ); +#elif defined( MODULE_NAME_IS_imdct3dn ) + set_description( _("3D Now! AC3 IMDCT module") ); + set_capability( "imdct", 200 ); + add_shortcut( "3dn" ); + add_shortcut( "3dnow" ); +#endif + set_callbacks( Open, NULL ); +vlc_module_end(); diff --git a/plugins/imdct/imdct3dn.c b/plugins/imdct/imdct3dn.c deleted file mode 100644 index 5ac2b8ebde..0000000000 --- a/plugins/imdct/imdct3dn.c +++ /dev/null @@ -1,77 +0,0 @@ -/***************************************************************************** - * imdct3dn.c : accelerated 3D Now! IMDCT module - ***************************************************************************** - * Copyright (C) 1999-2001 VideoLAN - * $Id: imdct3dn.c,v 1.12 2002/06/01 12:31:59 sam Exp $ - * - * Authors: Renaud Dartus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include -#include - -#include - -#include "ac3_imdct.h" -#include "ac3_imdct_common.h" - -/***************************************************************************** - * Local and extern prototypes. - *****************************************************************************/ -static void imdct_getfunctions( function_list_t * p_function_list ); - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("3D Now! AC3 IMDCT module") ) - ADD_CAPABILITY( IMDCT, 200 ) - ADD_REQUIREMENT( 3DNOW ) - ADD_SHORTCUT( "3dn" ) - ADD_SHORTCUT( "3dnow" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - imdct_getfunctions( &p_module->p_functions->imdct ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void imdct_getfunctions( function_list_t * p_function_list ) -{ -#define F p_function_list->functions.imdct - F.pf_imdct_init = _M( imdct_init ); - F.pf_imdct_256 = _M( imdct_do_256 ); - F.pf_imdct_256_nol = _M( imdct_do_256_nol ); - F.pf_imdct_512 = _M( imdct_do_512 ); - F.pf_imdct_512_nol = _M( imdct_do_512_nol ); -#undef F -} - diff --git a/plugins/imdct/imdctsse.c b/plugins/imdct/imdctsse.c deleted file mode 100644 index 448df1a1c1..0000000000 --- a/plugins/imdct/imdctsse.c +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - * imdctsse.c : accelerated SSE IMDCT module - ***************************************************************************** - * Copyright (C) 1999, 2000 VideoLAN - * $Id: imdctsse.c,v 1.13 2002/06/01 12:31:59 sam Exp $ - * - * Authors: Gaël Hendryckx - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include -#include - -#include - -#include "ac3_imdct.h" -#include "ac3_imdct_common.h" - -/***************************************************************************** - * Local and extern prototypes. - *****************************************************************************/ -static void imdct_getfunctions( function_list_t * p_function_list ); - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("SSE AC3 IMDCT module") ) - ADD_CAPABILITY( IMDCT, 200 ) - ADD_REQUIREMENT( SSE ) - ADD_SHORTCUT( "sse" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - imdct_getfunctions( &p_module->p_functions->imdct ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void imdct_getfunctions( function_list_t * p_function_list ) -{ -#define F p_function_list->functions.imdct - F.pf_imdct_init = _M( imdct_init ); - F.pf_imdct_256 = _M( imdct_do_256 ); - F.pf_imdct_256_nol = _M( imdct_do_256_nol ); - F.pf_imdct_512 = _M( imdct_do_512 ); - F.pf_imdct_512_nol = _M( imdct_do_512_nol ); -#undef F -} - diff --git a/plugins/kde/kde.cpp b/plugins/kde/kde.cpp index 92b8c65976..5e8fd77c05 100644 --- a/plugins/kde/kde.cpp +++ b/plugins/kde/kde.cpp @@ -2,7 +2,7 @@ * kde.cpp : KDE plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: kde.cpp,v 1.14 2002/07/01 17:39:27 sam Exp $ + * $Id: kde.cpp,v 1.15 2002/07/31 20:56:51 sam Exp $ * * Authors: Andres Krapf Sun Mar 25 2001 * @@ -36,44 +36,6 @@ #include #include -/***************************************************************************** - * Capabilities defined in the other files. - *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ); - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -extern "C" -{ - -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("KDE interface module") ) -#ifndef WIN32 - if( getenv( "DISPLAY" ) == NULL ) - { - ADD_CAPABILITY( INTF, 8 ) - } - else -#endif - { - ADD_CAPABILITY( INTF, 85 ) - } - ADD_PROGRAM( "kvlc" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - intf_getfunctions( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -} // extern "C" - /***************************************************************************** * The local class. *****************************************************************************/ @@ -93,20 +55,26 @@ class KThread ~KThread(); // These methods get exported to the core - static int open ( intf_thread_t *p_intf ); - static void close ( intf_thread_t *p_intf ); - static void run ( intf_thread_t *p_intf ); + static int open ( vlc_object_t * ); + static void close ( vlc_object_t * ); + static void run ( intf_thread_t * ); }; /***************************************************************************** - * Functions exported as capabilities. + * Module descriptor *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.intf.pf_open = KThread::open; - p_function_list->functions.intf.pf_close = KThread::close; - p_function_list->functions.intf.pf_run = KThread::run; -} +vlc_module_begin(); +#ifdef WIN32 + int i = 90; +#else + int i = getenv( "DISPLAY" ) == NULL ? 8 : 85; +#endif + set_description( _("KDE interface module") ); + set_capability( "interface", i ); + set_program( "kvlc" ); + //set_callbacks( E_(Open), E_(Close) ); + set_callbacks( KThread::open, KThread::close ); +vlc_module_end(); /***************************************************************************** * KThread::KThread: KDE interface constructor @@ -163,8 +131,10 @@ KThread::~KThread() /***************************************************************************** * KThread::open: initialize and create window *****************************************************************************/ -int KThread::open(intf_thread_t *p_intf) +int KThread::open(vlc_object_t *p_this) { + intf_thread_t *p_intf = (intf_thread_t *)p_this; + /* Allocate instance and initialize some members */ p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) @@ -173,6 +143,8 @@ int KThread::open(intf_thread_t *p_intf) return( 1 ); } + p_intf->pf_run = KThread::run; + p_intf->p_sys->p_thread = new KThread(p_intf); return ( 0 ); } @@ -180,8 +152,10 @@ int KThread::open(intf_thread_t *p_intf) /***************************************************************************** * KThread::close: destroy interface window *****************************************************************************/ -void KThread::close(intf_thread_t *p_intf) +void KThread::close(vlc_object_t *p_this) { + intf_thread_t *p_intf = (intf_thread_t *)p_this; + delete p_intf->p_sys->p_thread; free( p_intf->p_sys ); } diff --git a/plugins/kde/kde_preferences.cpp b/plugins/kde/kde_preferences.cpp index f3605b2cb6..523886e663 100644 --- a/plugins/kde/kde_preferences.cpp +++ b/plugins/kde/kde_preferences.cpp @@ -37,7 +37,7 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name, this->p_intf = p_intf; /* Look for the selected module */ - for( p_module = p_intf->p_vlc->module_bank.first ; p_module != NULL ; + for( p_module = p_intf->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -95,7 +95,8 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name, /* build a list of available plugins */ - for( p_module_bis = p_intf->p_vlc->module_bank.first ; +#if 0 /* FIXME */ + for( p_module_bis = p_intf->p_vlc->p_module_bank->first ; p_module_bis != NULL ; p_module_bis = p_module_bis->next ) { if( p_module_bis->i_capabilities & (1 << p_item->i_value)){ @@ -104,6 +105,7 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name, p_module_bis->psz_longname); } } +#endif vlc_mutex_unlock( p_item->p_lock ); } break; @@ -208,7 +210,7 @@ KPreferences::~KPreferences() bool KPreferences::isConfigureable(QString module) { module_t *p_module; - for( p_module = p_intf->p_vlc->module_bank.first ; + for( p_module = p_intf->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { if( !module.compare( p_module->psz_object_name ) ) { diff --git a/plugins/lirc/lirc.c b/plugins/lirc/lirc.c index b2a68c39bc..17e4299894 100644 --- a/plugins/lirc/lirc.c +++ b/plugins/lirc/lirc.c @@ -2,7 +2,7 @@ * lirc.c : lirc plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: lirc.c,v 1.14 2002/07/20 18:01:42 sam Exp $ + * $Id: lirc.c,v 1.15 2002/07/31 20:56:51 sam Exp $ * * Authors: Sigmund Augdal * @@ -47,49 +47,27 @@ struct intf_sys_t }; /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ); - -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); - -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START - -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("infrared remote control module") ) - ADD_CAPABILITY( INTF, 8 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - intf_getfunctions( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); +static void Run ( intf_thread_t * ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} +vlc_module_begin(); + set_description( _("infrared remote control module") ); + set_capability( "interface", 0 ); + set_callbacks( Open, Close ); +vlc_module_end(); /***************************************************************************** - * intf_Open: initialize dummy interface + * Open: initialize interface *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) +static int Open( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t *)p_this; int i_fd; /* Allocate instance and initialize some members */ @@ -100,6 +78,8 @@ static int intf_Open( intf_thread_t *p_intf ) return 1; } + p_intf->pf_run = Run; + i_fd = lirc_init( "vlc", 1 ); if( i_fd == -1 ) { @@ -125,10 +105,12 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy dummy interface + * Close: destroy interface *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) +static void Close( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t *)p_this; + if( p_intf->p_sys->p_input ) { vlc_object_release( p_intf->p_sys->p_input ); @@ -141,9 +123,9 @@ static void intf_Close( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Run: main loop + * Run: main loop *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { char *code, *c; playlist_t *p_playlist; diff --git a/plugins/lpcm_adec/lpcm_adec.c b/plugins/lpcm_adec/lpcm_adec.c index 1a479c0e29..0fc0d3134f 100644 --- a/plugins/lpcm_adec/lpcm_adec.c +++ b/plugins/lpcm_adec/lpcm_adec.c @@ -2,7 +2,7 @@ * lpcm_adec.c: lpcm decoder thread ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: lpcm_adec.c,v 1.19 2002/07/23 00:39:17 sam Exp $ + * $Id: lpcm_adec.c,v 1.20 2002/07/31 20:56:51 sam Exp $ * * Authors: Samuel Hocevar * Henri Fallon @@ -41,52 +41,42 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); + void DecodeFrame ( lpcmdec_thread_t * ); static int InitThread ( lpcmdec_thread_t * ); static void EndThread ( lpcmdec_thread_t * ); - /***************************************************************************** - * Capabilities + * Module descriptor *****************************************************************************/ -void _M( adec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} +vlc_module_begin(); + set_description( _("linear PCM audio decoder") ); + set_capability( "decoder", 100 ); + set_callbacks( OpenDecoder, NULL ); +vlc_module_end(); /***************************************************************************** - * Build configuration tree. + * OpenDecoder: probe the decoder and return score *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("linear PCM audio decoder") ) - ADD_CAPABILITY( DECODER, 100 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( adec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * decoder_Probe: probe the decoder and return score - *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) +static int OpenDecoder( vlc_object_t *p_this ) { - return ( *pi_type == VLC_FOURCC('l','p','c','m') ) ? 0 : -1; + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + + if( p_fifo->i_fourcc != VLC_FOURCC('l','p','c','m') ) + { + return VLC_EGENERIC; + } + + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; } /***************************************************************************** - * decoder_Run: the lpcm decoder + * RunDecoder: the lpcm decoder *****************************************************************************/ -static int decoder_Run( decoder_fifo_t * p_fifo ) +static int RunDecoder( decoder_fifo_t * p_fifo ) { lpcmdec_thread_t * p_lpcmdec; diff --git a/plugins/macosx/aout_macosx.m b/plugins/macosx/aout_macosx.m index 9c4108aae7..e9fd86f2e4 100644 --- a/plugins/macosx/aout_macosx.m +++ b/plugins/macosx/aout_macosx.m @@ -2,7 +2,7 @@ * aout_macosx.m: CoreAudio output plugin ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: aout_macosx.m,v 1.8 2002/07/20 18:01:42 sam Exp $ + * $Id: aout_macosx.m,v 1.9 2002/07/31 20:56:52 sam Exp $ * * Authors: Colin Delacroix * Jon Lech Johansen @@ -54,22 +54,19 @@ struct aout_sys_t UInt32 ui_buffer_size; // audio device buffer size vlc_bool_t b_buffer_data; // available buffer data? vlc_mutex_t mutex_lock; // pthread locks for sync of - vlc_cond_t cond_sync; // aout_Play and callback + vlc_cond_t cond_sync; // Play and callback mtime_t clock_diff; // diff between system clock & audio }; /***************************************************************************** * Local prototypes. *****************************************************************************/ -static int aout_Open ( aout_thread_t *p_aout ); -static int aout_SetFormat ( aout_thread_t *p_aout ); -static int aout_GetBufInfo ( aout_thread_t *p_aout, int i_buffer_info ); -static void aout_Play ( aout_thread_t *p_aout, - byte_t *buffer, int i_size ); -static void aout_Close ( aout_thread_t *p_aout ); +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); -static int CABeginFormat ( aout_thread_t *p_aout ); -static int CAEndFormat ( aout_thread_t *p_aout ); +static int CABeginFormat ( aout_thread_t * ); +static int CAEndFormat ( aout_thread_t * ); static OSStatus CAIOCallback ( AudioDeviceID inDevice, const AudioTimeStamp *inNow, @@ -80,23 +77,11 @@ static OSStatus CAIOCallback ( AudioDeviceID inDevice, void *threadGlobals ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * OpenAudio: opens a CoreAudio HAL device *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} - -/***************************************************************************** - * aout_Open: opens a CoreAudio HAL device - *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) +int E_(OpenAudio) ( vlc_object_t *p_this ) { + aout_thread_t * p_aout = (aout_thread_t *)p_this; OSStatus err; UInt32 ui_param_size; @@ -170,13 +155,17 @@ static int aout_Open( aout_thread_t *p_aout ) return( -1 ); } + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + return( 0 ); } /***************************************************************************** - * aout_SetFormat: pretends to set the dsp output format + * SetFormat: pretends to set the dsp output format *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { if( CAEndFormat( p_aout ) ) { @@ -260,9 +249,9 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_GetBufInfo: returns available bytes in buffer + * GetBufInfo: returns available bytes in buffer *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { return( 0 ); /* send data as soon as possible */ } @@ -301,7 +290,7 @@ static OSStatus CAIOCallback( AudioDeviceID inDevice, //X msg_Warn( p_aout, "audio output is starving, expect glitches" ); } - /* see aout_Play below */ + /* see Play below */ vlc_mutex_lock( &p_sys->mutex_lock ); p_sys->b_buffer_data = 0; vlc_cond_signal( &p_sys->cond_sync ); @@ -311,15 +300,15 @@ static OSStatus CAIOCallback( AudioDeviceID inDevice, } /***************************************************************************** - * aout_Play: play a sound + * Play: play a sound *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { OSStatus err; UInt32 ui_buffer_size = p_aout->p_sys->ui_buffer_size; /* - * wait for a callback to occur (to flush the buffer), so aout_Play + * wait for a callback to occur (to flush the buffer), so Play * can't be called twice, losing the data we just wrote. */ vlc_mutex_lock( &p_aout->p_sys->mutex_lock ); @@ -345,10 +334,12 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } /***************************************************************************** - * aout_Close: closes the CoreAudio HAL device + * CloseAudio: closes the CoreAudio HAL device *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +void E_(CloseAudio) ( vlc_object_t *p_this ) { + aout_thread_t * p_aout = (aout_thread_t *)p_this; + if( CAEndFormat( p_aout ) ) { msg_Err( p_aout, "CAEndFormat failed" ); diff --git a/plugins/macosx/intf_macosx.m b/plugins/macosx/intf_macosx.m index 38cd2d5dc5..9518309756 100644 --- a/plugins/macosx/intf_macosx.m +++ b/plugins/macosx/intf_macosx.m @@ -2,7 +2,7 @@ * intf_macosx.m: MacOS X interface plugin ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: intf_macosx.m,v 1.9 2002/07/23 20:50:05 massiot Exp $ + * $Id: intf_macosx.m,v 1.10 2002/07/31 20:56:52 sam Exp $ * * Authors: Jon Lech Johansen * Christophe Massiot @@ -43,26 +43,15 @@ /***************************************************************************** * Local prototypes. *****************************************************************************/ -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); +static void Run ( intf_thread_t *p_intf ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * OpenIntf: initialize interface *****************************************************************************/ -void _M( intf_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} +int E_(OpenIntf) ( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t*) p_this; -/***************************************************************************** - * intf_Open: initialize interface - *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) { @@ -76,6 +65,8 @@ static int intf_Open( intf_thread_t *p_intf ) p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); + p_intf->pf_run = Run; + [[VLCApplication sharedApplication] autorelease]; [NSApp initIntlSupport]; [NSApp setIntf: p_intf]; @@ -86,10 +77,12 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy interface + * CloseIntf: destroy interface *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) +void E_(CloseIntf) ( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t*) p_this; + msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub ); [p_intf->p_sys->o_sendport release]; @@ -99,9 +92,9 @@ static void intf_Close( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Run: main loop + * Run: main loop *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { [NSApp run]; } diff --git a/plugins/macosx/macosx.m b/plugins/macosx/macosx.m index b872b47325..43b3aa65e5 100644 --- a/plugins/macosx/macosx.m +++ b/plugins/macosx/macosx.m @@ -2,7 +2,7 @@ * macosx.m: MacOS X plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: macosx.m,v 1.3 2002/06/08 19:32:19 sam Exp $ + * $Id: macosx.m,v 1.4 2002/07/31 20:56:52 sam Exp $ * * Authors: Colin Delacroix * Eugenio Jarosiewicz @@ -33,31 +33,30 @@ #include /***************************************************************************** - * Capabilities defined in the other files. + * External prototypes *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ); -void _M( vout_getfunctions )( function_list_t * p_function_list ); -void _M( intf_getfunctions )( function_list_t * p_function_list ); +int E_(OpenIntf) ( vlc_object_t * ); +void E_(CloseIntf) ( vlc_object_t * ); -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("MacOS X interface, sound and video module") ) - ADD_CAPABILITY( INTF, 100 ) - ADD_CAPABILITY( AOUT, 100 ) - ADD_CAPABILITY( VOUT, 100 ) -MODULE_INIT_STOP +int E_(OpenAudio) ( vlc_object_t * ); +void E_(CloseAudio) ( vlc_object_t * ); -MODULE_ACTIVATE_START - _M( vout_getfunctions )( &p_module->p_functions->vout ); - _M( aout_getfunctions )( &p_module->p_functions->aout ); - _M( intf_getfunctions )( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP +int E_(OpenVideo) ( vlc_object_t * ); +void E_(CloseVideo) ( vlc_object_t * ); -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +/***************************************************************************** + * Module descriptor + *****************************************************************************/ +vlc_module_begin(); + set_description( _("MacOS X interface, sound and video module") ); + add_submodule(); + set_capability( "interface", 100 ); + set_callbacks( E_(OpenIntf), E_(CloseIntf) ); + add_submodule(); + set_capability( "video output", 100 ); + set_callbacks( E_(OpenVideo), E_(CloseVideo) ); + add_submodule(); + set_capability( "audio output", 100 ); + set_callbacks( E_(OpenAudio), E_(CloseAudio) ); +vlc_module_end(); diff --git a/plugins/macosx/vout_macosx.m b/plugins/macosx/vout_macosx.m index 5fb32642b3..44bdd3e382 100644 --- a/plugins/macosx/vout_macosx.m +++ b/plugins/macosx/vout_macosx.m @@ -2,7 +2,7 @@ * vout_macosx.m: MacOS X video output plugin ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: vout_macosx.m,v 1.16 2002/07/25 22:48:56 massiot Exp $ + * $Id: vout_macosx.m,v 1.17 2002/07/31 20:56:52 sam Exp $ * * Authors: Colin Delacroix * Florian G. Pflug @@ -55,10 +55,8 @@ struct picture_sys_t /***************************************************************************** * Local prototypes *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); static int vout_Init ( vout_thread_t * ); static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); static int vout_Manage ( vout_thread_t * ); static void vout_Render ( vout_thread_t *, picture_t * ); static void vout_Display ( vout_thread_t *, picture_t * ); @@ -75,27 +73,13 @@ static int QTNewPicture ( vout_thread_t *, picture_t * ); static void QTFreePicture ( vout_thread_t *, picture_t * ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( vout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates MacOS X video thread output method + * OpenVideo: allocates MacOS X video thread output method ***************************************************************************** * This function allocates and initializes a MacOS X vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) -{ +int E_(OpenVideo) ( vlc_object_t *p_this ) +{ + vout_thread_t * p_vout = (vout_thread_t *)p_this; OSErr err; p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); @@ -182,6 +166,12 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = vout_Init; + p_vout->pf_end = vout_End; + p_vout->pf_manage = vout_Manage; + p_vout->pf_render = NULL; + p_vout->pf_display = vout_Display; + return( 0 ); } @@ -261,10 +251,12 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy video thread output method + * CloseVideo: destroy video thread output method *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) -{ +void E_(CloseVideo) ( vlc_object_t *p_this ) +{ + vout_thread_t * p_vout = (vout_thread_t *)p_this; + if( CoDestroyWindow( p_vout ) ) { msg_Err( p_vout, "unable to destroy window" ); @@ -340,14 +332,6 @@ static int vout_Manage( vout_thread_t *p_vout ) return( 0 ); } -/***************************************************************************** - * vout_Render: render previously calculated output - *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - /***************************************************************************** * vout_Display: displays previously rendered output ***************************************************************************** diff --git a/plugins/mad/mad_adec.c b/plugins/mad/mad_adec.c index 4f43ef90f6..8a11c0c1b5 100644 --- a/plugins/mad/mad_adec.c +++ b/plugins/mad/mad_adec.c @@ -40,60 +40,50 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); static int InitThread ( mad_adec_thread_t * p_mad_adec ); static void EndThread ( mad_adec_thread_t * p_mad_adec ); /***************************************************************************** - * Capabilities - *****************************************************************************/ -void _M( adec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} - -/***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define DOWNSCALE_TEXT N_("Mad audio downscale routine (fast,mp321)") #define DOWNSCALE_LONGTEXT N_( \ "Specify the mad audio downscale routine you want to use. By default " \ "the mad plugin will use the fastest routine.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING ( "downscale", "fast", NULL, DOWNSCALE_TEXT, DOWNSCALE_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("libmad MPEG 1/2/3 audio decoder library") ) - ADD_CAPABILITY( DECODER, 100 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( adec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string( "downscale", "fast", NULL, DOWNSCALE_TEXT, DOWNSCALE_LONGTEXT ); + set_description( _("libmad MPEG 1/2/3 audio decoder") ); + set_capability( "decoder", 100 ); + set_callbacks( OpenDecoder, NULL ); +vlc_module_end(); /***************************************************************************** - * decoder_Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able - * to chose. + * to choose. *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) -{ - return *pi_type == VLC_FOURCC('m','p','g','a') ? 0 : -1; +static int OpenDecoder( vlc_object_t *p_this ) +{ + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + + if( p_fifo->i_fourcc != VLC_FOURCC('m','p','g','a') ) + { + return VLC_EGENERIC; + } + + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; } /***************************************************************************** - * decoder_Run: this function is called just after the thread is created + * RunDecoder: this function is called just after the thread is created *****************************************************************************/ -static int decoder_Run ( decoder_fifo_t * p_fifo ) +static int RunDecoder( decoder_fifo_t *p_fifo ) { mad_adec_thread_t * p_mad_adec; diff --git a/plugins/memcpy/fastmemcpy.h b/plugins/memcpy/fastmemcpy.h index e00c840b10..031a3989ac 100644 --- a/plugins/memcpy/fastmemcpy.h +++ b/plugins/memcpy/fastmemcpy.h @@ -1,7 +1,7 @@ /***************************************************************************** * fastmemcpy.h : fast memcpy routines ***************************************************************************** - * $Id: fastmemcpy.h,v 1.4 2002/07/21 23:40:23 sam Exp $ + * $Id: fastmemcpy.h,v 1.5 2002/07/31 20:56:52 sam Exp $ * * Authors: various Linux kernel hackers * various MPlayer hackers @@ -153,7 +153,7 @@ __asm__ __volatile__(\ #define MIN_LEN 0x40 /* 64-byte blocks */ #endif -void * _M( fast_memcpy )(void * to, const void * from, size_t len) +void * fast_memcpy(void * to, const void * from, size_t len) { void *retval; size_t i; diff --git a/plugins/memcpy/memcpy.c b/plugins/memcpy/memcpy.c index e8c03d0738..4a07d9c9ea 100644 --- a/plugins/memcpy/memcpy.c +++ b/plugins/memcpy/memcpy.c @@ -2,7 +2,7 @@ * memcpy.c : classic memcpy module ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: memcpy.c,v 1.9 2002/06/01 12:32:00 sam Exp $ + * $Id: memcpy.c,v 1.10 2002/07/31 20:56:52 sam Exp $ * * Authors: Samuel Hocevar * @@ -37,78 +37,70 @@ #undef HAVE_ALTIVEC #if defined( MODULE_NAME_IS_memcpy3dn ) +# define PRIORITY 100 # define HAVE_3DNOW # include "fastmemcpy.h" #elif defined( MODULE_NAME_IS_memcpymmx ) +# define PRIORITY 100 # define HAVE_MMX # include "fastmemcpy.h" #elif defined( MODULE_NAME_IS_memcpymmxext ) +# define PRIORITY 200 # define HAVE_MMX2 # include "fastmemcpy.h" +#else +# define PRIORITY 50 #endif /***************************************************************************** - * Local and extern prototypes. + * Extern prototype *****************************************************************************/ -static void memcpy_getfunctions( function_list_t * p_function_list ); #ifndef MODULE_NAME_IS_memcpy -void * _M( fast_memcpy ) ( void * to, const void * from, size_t len ); +# define fast_memcpy E_(fast_memcpy) + void *fast_memcpy( void * to, const void * from, size_t len ); #endif /***************************************************************************** - * Build configuration tree. + * Module initializer *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START +static int Activate ( vlc_object_t *p_this ) +{ #ifdef MODULE_NAME_IS_memcpy - SET_DESCRIPTION( _("libc memcpy module") ) - ADD_CAPABILITY( MEMCPY, 50 ) - ADD_SHORTCUT( "c" ) - ADD_SHORTCUT( "libc" ) -#elif defined( MODULE_NAME_IS_memcpy3dn ) - SET_DESCRIPTION( _("3D Now! memcpy module") ) - ADD_CAPABILITY( MEMCPY, 100 ) - ADD_REQUIREMENT( 3DNOW ) - ADD_SHORTCUT( "3dn" ) - ADD_SHORTCUT( "3dnow" ) - ADD_SHORTCUT( "memcpy3dn" ) - ADD_SHORTCUT( "memcpy3dnow" ) -#elif defined( MODULE_NAME_IS_memcpymmx ) - SET_DESCRIPTION( _("MMX memcpy module") ) - ADD_CAPABILITY( MEMCPY, 100 ) - ADD_REQUIREMENT( MMX ) - ADD_SHORTCUT( "mmx" ) - ADD_SHORTCUT( "memcpymmx" ) -#elif defined( MODULE_NAME_IS_memcpymmxext ) - SET_DESCRIPTION( _("MMX EXT memcpy module") ) - ADD_CAPABILITY( MEMCPY, 200 ) - ADD_REQUIREMENT( MMXEXT ) - ADD_SHORTCUT( "mmxext" ) - ADD_SHORTCUT( "memcpymmxext" ) + p_this->p_vlc->pf_memcpy = memcpy; +#else + p_this->p_vlc->pf_memcpy = E_(fast_memcpy); #endif -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - memcpy_getfunctions( &p_module->p_functions->memcpy ); -MODULE_ACTIVATE_STOP -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ + return VLC_SUCCESS; +} /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void memcpy_getfunctions( function_list_t * p_function_list ) -{ +vlc_module_begin(); #ifdef MODULE_NAME_IS_memcpy - p_function_list->functions.memcpy.pf_memcpy = memcpy; -#else - p_function_list->functions.memcpy.pf_memcpy = _M( fast_memcpy ); + set_description( _("libc memcpy module") ); + add_shortcut( "c" ); + add_shortcut( "libc" ); +#elif defined( MODULE_NAME_IS_memcpy3dn ) + set_description( _("3D Now! memcpy module") ); + add_requirement( 3DNOW ); + add_shortcut( "3dn" ); + add_shortcut( "3dnow" ); + add_shortcut( "memcpy3dn" ); + add_shortcut( "memcpy3dnow" ); +#elif defined( MODULE_NAME_IS_memcpymmx ) + set_description( _("MMX memcpy module") ); + add_requirement( MMX ); + add_shortcut( "mmx" ); + add_shortcut( "memcpymmx" ); +#elif defined( MODULE_NAME_IS_memcpymmxext ) + set_description( _("MMX EXT memcpy module") ); + add_requirement( MMXEXT ); + add_shortcut( "mmxext" ); + add_shortcut( "memcpymmxext" ); #endif -} + set_capability( "memcpy", PRIORITY ); + set_callbacks( Activate, NULL ); +vlc_module_end(); diff --git a/plugins/memcpy/memcpyaltivec.c b/plugins/memcpy/memcpyaltivec.c index d3d1a4ddb5..590cc1d508 100644 --- a/plugins/memcpy/memcpyaltivec.c +++ b/plugins/memcpy/memcpyaltivec.c @@ -2,7 +2,7 @@ * memcpyaltivec.c : AltiVec memcpy module ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: memcpyaltivec.c,v 1.6 2002/06/01 12:32:00 sam Exp $ + * $Id: memcpyaltivec.c,v 1.7 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * @@ -32,44 +32,30 @@ #include /***************************************************************************** - * Local and extern prototypes. + * Local prototypes. *****************************************************************************/ -static void memcpy_getfunctions( function_list_t * p_function_list ); -void * _M( fast_memcpy ) ( void * to, const void * from, size_t len ); +static void * fast_memcpy ( void * to, const void * from, size_t len ); /***************************************************************************** - * Build configuration tree. + * Module initializer. *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("AltiVec memcpy module") ) - ADD_CAPABILITY( MEMCPY, 100 ) - ADD_REQUIREMENT( ALTIVEC ) - ADD_SHORTCUT( "altivec" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - memcpy_getfunctions( &p_module->p_functions->memcpy ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/* Following functions are local */ +static int Activate ( vlc_object_t *p_this ) +{ + p_this->p_vlc->pf_memcpy = fast_memcpy; + return VLC_SUCCESS; +} /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor. *****************************************************************************/ -static void memcpy_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.memcpy.pf_memcpy = _M( fast_memcpy ); -} +vlc_module_begin(); + set_description( _("AltiVec memcpy module") ); + set_capability( "memcpy", 100 ); + set_callbacks( Activate, NULL ); + add_shortcut( "altivec" ); +vlc_module_end(); #else -# define _M( toto ) toto typedef unsigned long size_t; #endif /* __BUILD_ALTIVEC_ASM__ */ @@ -92,7 +78,7 @@ typedef unsigned long size_t; } \ } -void * _M( fast_memcpy )(void * _to, const void * _from, size_t len) +static void * fast_memcpy( void * _to, const void * _from, size_t len ) { void * retval = _to; unsigned char * to = (unsigned char *)_to; @@ -161,7 +147,7 @@ void * _M( fast_memcpy )(void * _to, const void * _from, size_t len) * unexpand -a */ -void * _M( fast_memcpy )(void * _to, const void * _from, size_t len) +static void * fast_memcpy( void * _to, const void * _from, size_t len ) { asm (" \n" " cmplwi %cr0, %r5, 16 \n" diff --git a/plugins/mga/mga.c b/plugins/mga/mga.c index da28acfaf0..2bad00364a 100644 --- a/plugins/mga/mga.c +++ b/plugins/mga/mga.c @@ -2,7 +2,7 @@ * mga.c : Matrox Graphic Array plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: mga.c,v 1.20 2002/07/23 00:39:17 sam Exp $ + * $Id: mga.c,v 1.21 2002/07/31 20:56:52 sam Exp $ * * Authors: Aaron Holtzman * Samuel Hocevar @@ -41,37 +41,25 @@ #endif /***************************************************************************** - * Capabilities defined in the other files. + * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static void Display ( vout_thread_t *, picture_t * ); static int NewPicture ( vout_thread_t *, picture_t * ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Matrox Graphic Array video module") ) - ADD_CAPABILITY( VOUT, 10 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("Matrox Graphic Array video module") ); + set_capability( "video output", 10 ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: video output MGA method descriptor @@ -135,27 +123,14 @@ struct picture_sys_t #define CEIL32(x) (((x)+31)&~31) /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocates dummy video thread output method + * Create: allocates dummy video thread output method ***************************************************************************** * This function allocates and initializes a dummy vout method. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +static int Create( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) @@ -172,13 +147,19 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = NULL; + p_vout->pf_render = NULL; + p_vout->pf_display = Display; + return( 0 ); } /***************************************************************************** - * vout_Init: initialize dummy video thread output method + * Init: initialize dummy video thread output method *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -279,9 +260,9 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate dummy video thread output method + * End: terminate dummy video thread output method *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -295,42 +276,21 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy dummy video thread output method + * Destroy: destroy dummy video thread output method ***************************************************************************** * Terminate an output method created by DummyCreateOutputMethod *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) -{ +static void Destroy( vlc_object_t *p_this ) +{ + vout_thread_t *p_vout = (vout_thread_t *)p_this; close( p_vout->p_sys->i_fd ); - free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle dummy events - ***************************************************************************** - * This function should be called regularly by video output thread. It manages - * console events. It returns a non null value on error. - *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) -{ - return( 0 ); -} - -/***************************************************************************** - * vout_Render: displays previously calculated output - *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - /* Grmbl, if we have a G200 which mistakenly assumes 4:2:0 planar - * has *packed* chroma information, we'll need to do some - * vonversion... but vlc does this for us. */ -} - -/***************************************************************************** - * vout_Display: displays previously rendered output + * Display: displays previously rendered output *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void Display( vout_thread_t *p_vout, picture_t *p_pic ) { ioctl( p_vout->p_sys->i_fd, MGA_VID_FSEL, &p_pic->p_sys->i_frame ); } diff --git a/plugins/mga/xmga.c b/plugins/mga/xmga.c index 5aad30d5cc..764a220c32 100644 --- a/plugins/mga/xmga.c +++ b/plugins/mga/xmga.c @@ -2,7 +2,7 @@ * xmga.c : X11 MGA plugin for vlc ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: xmga.c,v 1.19 2002/07/23 00:39:17 sam Exp $ + * $Id: xmga.c,v 1.20 2002/07/31 20:56:52 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -59,15 +59,13 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void vout_getfunctions( function_list_t * ); +static int Create ( vlc_object_t * ); +static void Destroy ( vlc_object_t * ); -static int vout_Create ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); -static int vout_Manage ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void MGADisplay( vout_thread_t *, picture_t * ); static int CreateWindow ( vout_thread_t * ); static void DestroyWindow ( vout_thread_t * ); @@ -85,7 +83,7 @@ static void DestroyCursor ( vout_thread_t * ); static void ToggleCursor ( vout_thread_t * ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ #define ALT_FS_TEXT N_("alternate fullscreen method") @@ -102,23 +100,14 @@ static void ToggleCursor ( vout_thread_t * ); "Specify the X11 hardware display you want to use. By default vlc will " \ "use the value of the DISPLAY environment variable.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING ( "xmga-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ) -ADD_BOOL ( "xmga-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("X11 MGA module") ) - ADD_CAPABILITY( VOUT, 60 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - vout_getfunctions( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string( "xmga-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ); + add_bool( "xmga-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT ); + set_description( _("X11 MGA module") ); + set_capability( "video output", 60 ); + set_callbacks( Create, Destroy ); +vlc_module_end(); /***************************************************************************** * vout_sys_t: video output method descriptor @@ -213,29 +202,15 @@ typedef struct mwmhints_t #endif /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void vout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocate X11 video thread output method + * Create: allocate X11 video thread output method ***************************************************************************** * This function allocate and initialize a X11 vout method. It uses some of the * vout properties to choose the window size, and change them according to the * actual properties of the display. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) -{ +static int Create( vlc_object_t *p_this ) +{ + vout_thread_t *p_vout = (vout_thread_t *)p_this; char *psz_display; /* Allocate structure */ @@ -284,16 +259,24 @@ static int vout_Create( vout_thread_t *p_vout ) /* Misc init */ p_vout->p_sys->b_altfullscreen = 0; + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = NULL; + p_vout->pf_display = MGADisplay; + return( 0 ); } /***************************************************************************** - * vout_Destroy: destroy X11 video thread output method + * Destroy: destroy X11 video thread output method ***************************************************************************** - * Terminate an output method created by vout_CreateOutputMethod + * Terminate an output method created by Create *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) -{ +static void Destroy( vlc_object_t *p_this ) +{ + vout_thread_t *p_vout = (vout_thread_t *)p_this; + /* Restore cursor if it was blanked */ if( !p_vout->p_sys->b_mouse_pointer_visible ) { @@ -311,12 +294,12 @@ static void vout_Destroy( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize X11 video thread output method + * Init: initialize X11 video thread output method ***************************************************************************** * This function create the XImages needed by the output thread. It is called * at the beginning of the thread, but also each time the window is resized. *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -393,20 +376,12 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Render: render previously calculated output - *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - - /***************************************************************************** - * vout_Display: displays previously rendered output + * MGADisplay: displays previously rendered output ***************************************************************************** * This function sends the currently rendered image to X11 server. * (The Xv extension takes care of "double-buffering".) *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void MGADisplay( vout_thread_t *p_vout, picture_t *p_pic ) { int i_width, i_height, i_x, i_y; @@ -415,13 +390,13 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) } /***************************************************************************** - * vout_Manage: handle X11 events + * Manage: handle X11 events ***************************************************************************** * This function should be called regularly by video output thread. It manages * X11 events and allows window resizing. It returns a non null value on * error. *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) +static int Manage( vout_thread_t *p_vout ) { XEvent xevent; /* X11 event */ vlc_bool_t b_resized; /* window has been resized */ @@ -644,12 +619,12 @@ static int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate X11 video thread output method + * End: terminate X11 video thread output method ***************************************************************************** - * Destroy the X11 XImages created by vout_Init. It is called at the end of + * Destroy the X11 XImages created by Init. It is called at the end of * the thread, but also each time the window is resized. *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; diff --git a/plugins/motion/motion.c b/plugins/motion/motion.c index fcaf16b489..92a65ae4a6 100644 --- a/plugins/motion/motion.c +++ b/plugins/motion/motion.c @@ -2,7 +2,7 @@ * motion.c : C motion compensation module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: motion.c,v 1.17 2002/06/01 12:32:00 sam Exp $ + * $Id: motion.c,v 1.18 2002/07/31 20:56:52 sam Exp $ * * Authors: Aaron Holtzman * Michel Lespinasse @@ -31,28 +31,19 @@ #include /***************************************************************************** - * Local and extern prototypes. + * Local prototype *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ); +static int Open ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("motion compensation module") ) - ADD_CAPABILITY( MOTION, 50 ) - ADD_SHORTCUT( "c" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - motion_getfunctions( &p_module->p_functions->motion ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("motion compensation module") ); + set_capability( "motion compensation", 50 ); + add_shortcut( "c" ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * Simple motion compensation in C @@ -128,38 +119,27 @@ MC_FUNC (avg,xy) * Functions exported as capabilities. They are declared as static so that * we don't pollute the namespace too much. *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ) +static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, int, int ) = { - static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, - int, int ) = + /* Copying functions */ { - { - /* Copying functions */ - { - /* Width == 16 */ - MC_put_o16_c, MC_put_x16_c, MC_put_y16_c, MC_put_xy16_c - }, - { - /* Width == 8 */ - MC_put_o8_c, MC_put_x8_c, MC_put_y8_c, MC_put_xy8_c - } - }, - { - /* Averaging functions */ - { - /* Width == 16 */ - MC_avg_o16_c, MC_avg_x16_c, MC_avg_y16_c, MC_avg_xy16_c - }, - { - /* Width == 8 */ - MC_avg_o8_c, MC_avg_x8_c, MC_avg_y8_c, MC_avg_xy8_c - } - } - }; - -#define list p_function_list->functions.motion - memcpy( list.ppppf_motion, ppppf_motion, sizeof( void * ) * 16 ); -#undef list - - return; + /* Width == 16 */ + { MC_put_o16_c, MC_put_x16_c, MC_put_y16_c, MC_put_xy16_c }, + /* Width == 8 */ + { MC_put_o8_c, MC_put_x8_c, MC_put_y8_c, MC_put_xy8_c } + }, + /* Averaging functions */ + { + /* Width == 16 */ + { MC_avg_o16_c, MC_avg_x16_c, MC_avg_y16_c, MC_avg_xy16_c }, + /* Width == 8 */ + { MC_avg_o8_c, MC_avg_x8_c, MC_avg_y8_c, MC_avg_xy8_c } + } +}; + +static int Open ( vlc_object_t *p_this ) +{ + p_this->p_private = ppppf_motion; + return VLC_SUCCESS; } + diff --git a/plugins/motion/motion3dnow.c b/plugins/motion/motion3dnow.c index fed3ca628e..a94ebcd19c 100644 --- a/plugins/motion/motion3dnow.c +++ b/plugins/motion/motion3dnow.c @@ -2,7 +2,7 @@ * motion3dnow.c : 3D Now! motion compensation module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: motion3dnow.c,v 1.11 2002/06/01 12:32:00 sam Exp $ + * $Id: motion3dnow.c,v 1.12 2002/07/31 20:56:52 sam Exp $ * * Authors: Aaron Holtzman * Michel Lespinasse @@ -33,30 +33,21 @@ #include "mmx.h" /***************************************************************************** - * Local and extern prototypes. + * Local prototype. *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ); +static int Open ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("3D Now! motion compensation module") ) - ADD_CAPABILITY( MOTION, 150 ) - ADD_REQUIREMENT( 3DNOW ) - ADD_SHORTCUT( "3dn" ) - ADD_SHORTCUT( "3dnow" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - motion_getfunctions( &p_module->p_functions->motion ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("3D Now! motion compensation module") ); + set_capability( "motion compensation", 150 ); + add_requirement( 3DNOW ); + add_shortcut( "3dn" ); + add_shortcut( "3dnow" ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * Motion compensation in 3D Now! (OK I know this does MMXEXT too and it's ugly) @@ -559,39 +550,27 @@ static void MC_put_xy8_3dnow (yuv_data_t * dest, yuv_data_t * ref, * Functions exported as capabilities. They are declared as static so that * we don't pollute the namespace too much. *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ) +static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, int, int ) = { - static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, - int, int ) = + /* Copying functions */ { - { - /* Copying functions */ - { - /* Width == 16 */ - MC_put_16_3dnow, MC_put_x16_3dnow, MC_put_y16_3dnow, MC_put_xy16_3dnow - }, - { - /* Width == 8 */ - MC_put_8_3dnow, MC_put_x8_3dnow, MC_put_y8_3dnow, MC_put_xy8_3dnow - } - }, - { - /* Averaging functions */ - { - /* Width == 16 */ - MC_avg_16_3dnow, MC_avg_x16_3dnow, MC_avg_y16_3dnow, MC_avg_xy16_3dnow - }, - { - /* Width == 8 */ - MC_avg_8_3dnow, MC_avg_x8_3dnow, MC_avg_y8_3dnow, MC_avg_xy8_3dnow - } - } - }; - -#define list p_function_list->functions.motion - memcpy( list.ppppf_motion, ppppf_motion, sizeof( void * ) * 16 ); -#undef list - - return; + /* Width == 16 */ + { MC_put_16_3dnow, MC_put_x16_3dnow, MC_put_y16_3dnow, MC_put_xy16_3dnow }, + /* Width == 8 */ + { MC_put_8_3dnow, MC_put_x8_3dnow, MC_put_y8_3dnow, MC_put_xy8_3dnow } + }, + /* Averaging functions */ + { + /* Width == 16 */ + { MC_avg_16_3dnow, MC_avg_x16_3dnow, MC_avg_y16_3dnow, MC_avg_xy16_3dnow }, + /* Width == 8 */ + { MC_avg_8_3dnow, MC_avg_x8_3dnow, MC_avg_y8_3dnow, MC_avg_xy8_3dnow } + } +}; + +static int Open ( vlc_object_t *p_this ) +{ + p_this->p_private = ppppf_motion; + return VLC_SUCCESS; } diff --git a/plugins/motion/motionaltivec.c b/plugins/motion/motionaltivec.c index 4d5224ffa8..20c00d566d 100644 --- a/plugins/motion/motionaltivec.c +++ b/plugins/motion/motionaltivec.c @@ -2,7 +2,7 @@ * motionaltivec.c : AltiVec motion compensation module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: motionaltivec.c,v 1.14 2002/06/01 16:45:34 sam Exp $ + * $Id: motionaltivec.c,v 1.15 2002/07/31 20:56:52 sam Exp $ * * Authors: Michel Lespinasse * Paul Mackerras @@ -36,29 +36,20 @@ #endif /***************************************************************************** - * Local and extern prototypes. + * Local prototype *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ); +static int Open ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("AltiVec motion compensation module") ) - ADD_CAPABILITY( MOTION, 150 ) - ADD_REQUIREMENT( ALTIVEC ) - ADD_SHORTCUT( "altivec" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - motion_getfunctions( &p_module->p_functions->motion ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("AltiVec motion compensation module") ); + set_capability( "motion compensation", 150 ); + add_requirement( ALTIVEC ); + add_shortcut( "altivec" ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * Motion compensation in AltiVec @@ -2056,40 +2047,28 @@ void MC_avg_xy_8_altivec (unsigned char * dest, unsigned char * ref, * Functions exported as capabilities. They are declared as static so that * we don't pollute the namespace too much. *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ) +static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, int, int ) = { - static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, - int, int ) = + /* Copying functions */ { - { - /* Copying functions */ - { - /* Width == 16 */ - MC_put_o_16_altivec, MC_put_x_16_altivec, MC_put_y_16_altivec, MC_put_xy_16_altivec - }, - { - /* Width == 8 */ - MC_put_o_8_altivec, MC_put_x_8_altivec, MC_put_y_8_altivec, MC_put_xy_8_altivec - } - }, - { - /* Averaging functions */ - { - /* Width == 16 */ - MC_avg_o_16_altivec, MC_avg_x_16_altivec, MC_avg_y_16_altivec, MC_avg_xy_16_altivec - }, - { - /* Width == 8 */ - MC_avg_o_8_altivec, MC_avg_x_8_altivec, MC_avg_y_8_altivec, MC_avg_xy_8_altivec - } - } - }; - -#define list p_function_list->functions.motion - memcpy( list.ppppf_motion, ppppf_motion, sizeof( void * ) * 16 ); -#undef list - - return; + /* Width == 16 */ + { MC_put_o_16_altivec, MC_put_x_16_altivec, MC_put_y_16_altivec, MC_put_xy_16_altivec }, + /* Width == 8 */ + { MC_put_o_8_altivec, MC_put_x_8_altivec, MC_put_y_8_altivec, MC_put_xy_8_altivec } + }, + /* Averaging functions */ + { + /* Width == 16 */ + { MC_avg_o_16_altivec, MC_avg_x_16_altivec, MC_avg_y_16_altivec, MC_avg_xy_16_altivec }, + /* Width == 8 */ + { MC_avg_o_8_altivec, MC_avg_x_8_altivec, MC_avg_y_8_altivec, MC_avg_xy_8_altivec } + } +}; + +static int Open ( vlc_object_t *p_this ) +{ + p_this->p_private = ppppf_motion; + return VLC_SUCCESS; } #endif /* __BUILD_ALTIVEC_ASM__ */ diff --git a/plugins/motion/motionmmx.c b/plugins/motion/motionmmx.c index 54410832c0..3d5e51c1ca 100644 --- a/plugins/motion/motionmmx.c +++ b/plugins/motion/motionmmx.c @@ -2,7 +2,7 @@ * motionmmx.c : MMX motion compensation module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: motionmmx.c,v 1.19 2002/06/02 23:29:29 sam Exp $ + * $Id: motionmmx.c,v 1.20 2002/07/31 20:56:52 sam Exp $ * * Authors: Aaron Holtzman * Michel Lespinasse @@ -34,29 +34,20 @@ #include "mmx.h" /***************************************************************************** - * Local and extern prototypes. + * Local prototype. *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ); +static int Open ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("MMX motion compensation module") ) - ADD_CAPABILITY( MOTION, 150 ) - ADD_REQUIREMENT( MMX ) - ADD_SHORTCUT( "mmx" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - motion_getfunctions( &p_module->p_functions->motion ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("MMX motion compensation module") ); + set_capability( "motion compensation", 150 ); + add_requirement( MMX ); + add_shortcut( "mmx" ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * Motion compensation in MMX @@ -643,39 +634,27 @@ static void MC_put_y8_mmx (yuv_data_t * dest, yuv_data_t * ref, * Functions exported as capabilities. They are declared as static so that * we don't pollute the namespace too much. *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ) +static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, int, int ) = { - static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, - int, int ) = + /* Copying functions */ { - { - /* Copying functions */ - { - /* Width == 16 */ - MC_put_16_mmx, MC_put_x16_mmx, MC_put_y16_mmx, MC_put_xy16_mmx - }, - { - /* Width == 8 */ - MC_put_8_mmx, MC_put_x8_mmx, MC_put_y8_mmx, MC_put_xy8_mmx - } - }, - { - /* Averaging functions */ - { - /* Width == 16 */ - MC_avg_16_mmx, MC_avg_x16_mmx, MC_avg_y16_mmx, MC_avg_xy16_mmx - }, - { - /* Width == 8 */ - MC_avg_8_mmx, MC_avg_x8_mmx, MC_avg_y8_mmx, MC_avg_xy8_mmx - } - } - }; - -#define list p_function_list->functions.motion - memcpy( list.ppppf_motion, ppppf_motion, sizeof( void * ) * 16 ); -#undef list - - return; + /* Width == 16 */ + { MC_put_16_mmx, MC_put_x16_mmx, MC_put_y16_mmx, MC_put_xy16_mmx }, + /* Width == 8 */ + { MC_put_8_mmx, MC_put_x8_mmx, MC_put_y8_mmx, MC_put_xy8_mmx } + }, + /* Averaging functions */ + { + /* Width == 16 */ + { MC_avg_16_mmx, MC_avg_x16_mmx, MC_avg_y16_mmx, MC_avg_xy16_mmx }, + /* Width == 8 */ + { MC_avg_8_mmx, MC_avg_x8_mmx, MC_avg_y8_mmx, MC_avg_xy8_mmx } + } +}; + +static int Open ( vlc_object_t *p_this ) +{ + p_this->p_private = ppppf_motion; + return VLC_SUCCESS; } diff --git a/plugins/motion/motionmmxext.c b/plugins/motion/motionmmxext.c index 3a2ba36a9c..5bc3115bd6 100644 --- a/plugins/motion/motionmmxext.c +++ b/plugins/motion/motionmmxext.c @@ -2,7 +2,7 @@ * motionmmxext.c : MMX EXT motion compensation module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: motionmmxext.c,v 1.19 2002/06/01 12:32:00 sam Exp $ + * $Id: motionmmxext.c,v 1.20 2002/07/31 20:56:52 sam Exp $ * * Authors: Aaron Holtzman * Michel Lespinasse @@ -33,29 +33,20 @@ #include "mmx.h" /***************************************************************************** - * Local and extern prototypes. + * Local prototype. *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ); +static int Open ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("MMXEXT motion compensation module") ) - ADD_CAPABILITY( MOTION, 200 ) - ADD_REQUIREMENT( MMXEXT ) - ADD_SHORTCUT( "mmxext" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - motion_getfunctions( &p_module->p_functions->motion ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("MMX EXT motion compensation module") ); + set_capability( "motion compensation", 200 ); + add_requirement( MMXEXT ); + add_shortcut( "mmxext" ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * Motion compensation in MMXEXT (OK I know this does 3DNow too and it's ugly) @@ -534,39 +525,27 @@ static void MC_put_y8_3dnow (yuv_data_t * dest, yuv_data_t * ref, * Functions exported as capabilities. They are declared as static so that * we don't pollute the namespace too much. *****************************************************************************/ -static void motion_getfunctions( function_list_t * p_function_list ) +static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, int, int ) = { - static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, - int, int ) = + /* Copying functions */ { - { - /* Copying functions */ - { - /* Width == 16 */ - MC_put_16_mmxext, MC_put_x16_mmxext, MC_put_y16_mmxext, MC_put_xy16_mmxext - }, - { - /* Width == 8 */ - MC_put_8_mmxext, MC_put_x8_mmxext, MC_put_y8_mmxext, MC_put_xy8_mmxext - } - }, - { - /* Averaging functions */ - { - /* Width == 16 */ - MC_avg_16_mmxext, MC_avg_x16_mmxext, MC_avg_y16_mmxext, MC_avg_xy16_mmxext - }, - { - /* Width == 8 */ - MC_avg_8_mmxext, MC_avg_x8_mmxext, MC_avg_y8_mmxext, MC_avg_xy8_mmxext - } - } - }; - -#define list p_function_list->functions.motion - memcpy( list.ppppf_motion, ppppf_motion, sizeof( void * ) * 16 ); -#undef list - - return; + /* Width == 16 */ + { MC_put_16_mmxext, MC_put_x16_mmxext, MC_put_y16_mmxext, MC_put_xy16_mmxext }, + /* Width == 8 */ + { MC_put_8_mmxext, MC_put_x8_mmxext, MC_put_y8_mmxext, MC_put_xy8_mmxext } + }, + /* Averaging functions */ + { + /* Width == 16 */ + { MC_avg_16_mmxext, MC_avg_x16_mmxext, MC_avg_y16_mmxext, MC_avg_xy16_mmxext }, + /* Width == 8 */ + { MC_avg_8_mmxext, MC_avg_x8_mmxext, MC_avg_y8_mmxext, MC_avg_xy8_mmxext } + } +}; + +static int Open ( vlc_object_t *p_this ) +{ + p_this->p_private = ppppf_motion; + return VLC_SUCCESS; } diff --git a/plugins/mp4/mp4.c b/plugins/mp4/mp4.c index c5e92eed65..25ee669981 100644 --- a/plugins/mp4/mp4.c +++ b/plugins/mp4/mp4.c @@ -2,7 +2,7 @@ * mp4.c : MP4 file input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: mp4.c,v 1.7 2002/07/23 22:42:20 fenrir Exp $ + * $Id: mp4.c,v 1.8 2002/07/31 20:56:52 sam Exp $ * Authors: Laurent Aimar * * This program is free software; you can redistribute it and/or modify @@ -37,42 +37,20 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void input_getfunctions( function_list_t * ); -static int MP4Demux ( input_thread_t * ); -static int MP4Init ( input_thread_t * ); -static void MP4End ( input_thread_t * ); +static int MP4Init ( vlc_object_t * ); +static void __MP4End ( vlc_object_t * ); +static int MP4Demux ( input_thread_t * ); -/***************************************************************************** - * Build configuration tree. - *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( "MP4 file input" ) - ADD_CAPABILITY( DEMUX, 242 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->demux ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +#define MP4End(a) __MP4End(VLC_OBJECT(a)) /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Module descriptor *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.demux - input.pf_init = MP4Init; - input.pf_end = MP4End; - input.pf_demux = MP4Demux; - input.pf_rewind = NULL; -#undef input -} +vlc_module_begin(); + set_description( "MP4 demuxer" ); + set_capability( "demux", 242 ); + set_callbacks( MP4Init, __MP4End ); +vlc_module_end(); /***************************************************************************** * Declaration of local function @@ -102,8 +80,9 @@ static int MP4_DecodeSample(); /***************************************************************************** * MP4Init: check file and initializes MP4 structures *****************************************************************************/ -static int MP4Init( input_thread_t *p_input ) -{ +static int MP4Init( vlc_object_t * p_this ) +{ + input_thread_t *p_input = (input_thread_t *)p_this; u8 *p_peek; u32 i_type; @@ -131,6 +110,8 @@ static int MP4Init( input_thread_t *p_input ) p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE ; } + p_input->pf_demux = MP4Demux; + /* a little test to see if it could be a mp4 */ if( input_Peek( p_input, &p_peek, 8 ) < 8 ) { @@ -389,11 +370,12 @@ static int MP4Demux( input_thread_t *p_input ) /***************************************************************************** * MP4End: frees unused data *****************************************************************************/ -static void MP4End( input_thread_t *p_input ) +static void __MP4End ( vlc_object_t * p_this ) { #define FREE( p ) \ if( p ) { free( p ); } int i_track; + input_thread_t * p_input = (input_thread_t *)p_this; demux_data_mp4_t *p_demux = p_input->p_demux_data; msg_Dbg( p_input, "Freeing all memory" ); diff --git a/plugins/mpeg_adec/mpeg_adec.c b/plugins/mpeg_adec/mpeg_adec.c index 653bbb55dc..62c05fda93 100644 --- a/plugins/mpeg_adec/mpeg_adec.c +++ b/plugins/mpeg_adec/mpeg_adec.c @@ -2,7 +2,7 @@ * mpeg_adec.c: MPEG audio decoder thread ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: mpeg_adec.c,v 1.26 2002/07/23 00:39:17 sam Exp $ + * $Id: mpeg_adec.c,v 1.27 2002/07/31 20:56:52 sam Exp $ * * Authors: Michel Kaempf * Michel Lespinasse @@ -42,52 +42,46 @@ /***************************************************************************** * Local Prototypes *****************************************************************************/ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); -static void EndThread ( adec_thread_t * ); -static void DecodeThread ( adec_thread_t * ); +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); -/***************************************************************************** - * Capabilities - *****************************************************************************/ -void _M( adec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} +static void EndThread ( adec_thread_t * ); +static void DecodeThread ( adec_thread_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("MPEG I/II layer 1/2 audio decoder") ) - ADD_CAPABILITY( DECODER, 50 ) - ADD_REQUIREMENT( FPU ) - ADD_SHORTCUT( "builtin" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( adec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("MPEG I/II layer 1/2 audio decoder") ); + set_capability( "decoder", 50 ); + add_requirement( FPU ); + add_shortcut( "builtin" ); + set_callbacks( OpenDecoder, NULL ); +vlc_module_end(); /***************************************************************************** - * decoder_Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score + ***************************************************************************** + * Tries to launch a decoder and return score so that the interface is able + * to choose. *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) -{ - return *pi_type == VLC_FOURCC('m','p','g','a') ? 0 : -1; +static int OpenDecoder( vlc_object_t *p_this ) +{ + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + + if( p_fifo->i_fourcc != VLC_FOURCC('m','p','g','a') ) + { + return VLC_EGENERIC; + } + + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; } /***************************************************************************** - * decoder_Run: initialize, go inside main loop, detroy + * RunDecoder: initialize, go inside main loop, destroy *****************************************************************************/ -static int decoder_Run ( decoder_fifo_t * p_fifo ) +static int RunDecoder( decoder_fifo_t *p_fifo ) { adec_thread_t * p_adec; diff --git a/plugins/mpeg_system/mpeg_audio.c b/plugins/mpeg_system/mpeg_audio.c index e4b252bc9b..15c4dd2d88 100644 --- a/plugins/mpeg_system/mpeg_audio.c +++ b/plugins/mpeg_system/mpeg_audio.c @@ -2,7 +2,7 @@ * mpeg_audio.c : mpeg_audio Stream input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: mpeg_audio.c,v 1.13 2002/07/23 00:39:17 sam Exp $ + * $Id: mpeg_audio.c,v 1.14 2002/07/31 20:56:52 sam Exp $ * * Authors: Laurent Aimar * @@ -35,45 +35,20 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void input_getfunctions ( function_list_t * p_function_list ); -static int MPEGAudioDemux ( input_thread_t * ); -static int MPEGAudioInit ( input_thread_t * ); -static void MPEGAudioEnd ( input_thread_t * ); +static int Activate ( vlc_object_t * ); +static int Demux ( input_thread_t * ); /* TODO: support MPEG-2.5, not difficult */ /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( "MPEG I/II Audio stream demux" ) - ADD_CAPABILITY( DEMUX, 110 ) - ADD_SHORTCUT( "mpegaudio" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->demux ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.demux - input.pf_init = MPEGAudioInit; - input.pf_end = MPEGAudioEnd; - input.pf_demux = MPEGAudioDemux; - input.pf_rewind = NULL; -#undef input -} +vlc_module_begin(); + set_description( _("ISO 13818-3 MPEG I/II audio stream demux" ) ); + set_capability( "demux", 100 ); + set_callbacks( Activate, NULL ); + add_shortcut( "mpegaudio" ); +vlc_module_end(); /***************************************************************************** * Definitions of structures and functions used by this plugins @@ -442,17 +417,21 @@ static void MPEGAudio_ExtractXingHeader( input_thread_t *p_input, /***************************************************************************** - * MPEGaudioInit : initializes MPEGaudio structures + * Activate: initializes MPEGaudio structures *****************************************************************************/ -static int MPEGAudioInit( input_thread_t * p_input ) +static int Activate( vlc_object_t * p_this ) { - demux_data_mpegaudio_t *p_mpegaudio; + input_thread_t * p_input = (input_thread_t *)p_this; + demux_data_mpegaudio_t * p_mpegaudio; mpegaudio_format_t mpeg; es_descriptor_t * p_es; int i_pos; int b_forced; input_info_category_t * p_category; + /* Set the demux function */ + p_input->pf_demux = Demux; + /* XXX: i don't know what it's supposed to do, copied from ESInit */ /* Initialize access plug-in structures. */ if( p_input->i_mtu == 0 ) @@ -585,22 +564,12 @@ static int MPEGAudioInit( input_thread_t * p_input ) return( 0 ); } - -/***************************************************************************** - * MPEGAudioEnd: frees unused data - *****************************************************************************/ -static void MPEGAudioEnd( input_thread_t * p_input ) -{ - -} - - /***************************************************************************** - * MPEGAudioDemux: reads and demuxes data packets + * Demux: reads and demuxes data packets ***************************************************************************** * Returns -1 in case of error, 0 in case of EOF, 1 otherwise *****************************************************************************/ -static int MPEGAudioDemux( input_thread_t * p_input ) +static int Demux( input_thread_t * p_input ) { int i_pos; int i_toread; diff --git a/plugins/mpeg_system/mpeg_es.c b/plugins/mpeg_system/mpeg_es.c index 94b2823587..3c94612b08 100644 --- a/plugins/mpeg_system/mpeg_es.c +++ b/plugins/mpeg_system/mpeg_es.c @@ -2,7 +2,7 @@ * mpeg_es.c : Elementary Stream input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: mpeg_es.c,v 1.12 2002/07/24 16:21:46 sam Exp $ + * $Id: mpeg_es.c,v 1.13 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * @@ -42,56 +42,35 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ); -static int ESDemux ( input_thread_t * ); -static int ESInit ( input_thread_t * ); -static void ESEnd ( input_thread_t * ); +static int Activate ( vlc_object_t * ); +static int Demux ( input_thread_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("ISO 13818-2 MPEG Elementary Stream input") ) - ADD_CAPABILITY( DEMUX, 150 ) - ADD_SHORTCUT( "es" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->demux ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.demux - input.pf_init = ESInit; - input.pf_end = ESEnd; - input.pf_demux = ESDemux; - input.pf_rewind = NULL; -#undef input -} +vlc_module_begin(); + set_description( _("ISO 13818-1 MPEG Elementary Stream input") ); + set_capability( "demux", 150 ); + set_callbacks( Activate, NULL ); + add_shortcut( "es" ); +vlc_module_end(); /* * Data reading functions */ /***************************************************************************** - * ESInit: initializes ES structures + * Activate: initializes ES structures *****************************************************************************/ -static int ESInit( input_thread_t * p_input ) +static int Activate( vlc_object_t * p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; es_descriptor_t * p_es; byte_t * p_peek; + /* Set the demux function */ + p_input->pf_demux = Demux; + /* Initialize access plug-in structures. */ if( p_input->i_mtu == 0 ) { @@ -154,18 +133,11 @@ static int ESInit( input_thread_t * p_input ) } /***************************************************************************** - * ESEnd: frees unused data - *****************************************************************************/ -static void ESEnd( input_thread_t * p_input ) -{ -} - -/***************************************************************************** - * ESDemux: reads and demuxes data packets + * Demux: reads and demuxes data packets ***************************************************************************** * Returns -1 in case of error, 0 in case of EOF, 1 otherwise *****************************************************************************/ -static int ESDemux( input_thread_t * p_input ) +static int Demux( input_thread_t * p_input ) { ssize_t i_read; decoder_fifo_t * p_fifo = diff --git a/plugins/mpeg_system/mpeg_ps.c b/plugins/mpeg_system/mpeg_ps.c index 909d6a1b16..1a09518f1c 100644 --- a/plugins/mpeg_system/mpeg_ps.c +++ b/plugins/mpeg_system/mpeg_ps.c @@ -2,7 +2,7 @@ * mpeg_ps.c : Program Stream input module for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: mpeg_ps.c,v 1.16 2002/07/23 00:39:17 sam Exp $ + * $Id: mpeg_ps.c,v 1.17 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * @@ -41,51 +41,30 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ); -static int PSDemux ( input_thread_t * ); -static int PSInit ( input_thread_t * ); -static void PSEnd ( input_thread_t * ); +static int Activate ( vlc_object_t * ); +static int Demux ( input_thread_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("ISO 13818-1 MPEG Program Stream input") ) - ADD_CAPABILITY( DEMUX, 100 ) - ADD_SHORTCUT( "ps" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->demux ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.demux - input.pf_init = PSInit; - input.pf_end = PSEnd; - input.pf_demux = PSDemux; - input.pf_rewind = NULL; -#undef input -} +vlc_module_begin(); + set_description( _("ISO 13818-1 MPEG Program Stream input") ); + set_capability( "demux", 100 ); + set_callbacks( Activate, NULL ); + add_shortcut( "ps" ); +vlc_module_end(); /***************************************************************************** - * PSInit: initializes PS structures + * Activate: initializes PS structures *****************************************************************************/ -static int PSInit( input_thread_t * p_input ) +static int Activate( vlc_object_t * p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; byte_t * p_peek; + /* Set the demux function */ + p_input->pf_demux = Demux; + /* Initialize access plug-in structures. */ if( p_input->i_mtu == 0 ) { @@ -271,19 +250,12 @@ static int PSInit( input_thread_t * p_input ) } /***************************************************************************** - * PSEnd: frees unused data - *****************************************************************************/ -static void PSEnd( input_thread_t * p_input ) -{ -} - -/***************************************************************************** - * PSDemux: reads and demuxes data packets + * Demux: reads and demuxes data packets ***************************************************************************** * Returns -1 in case of error, 0 in case of EOF, otherwise the number of * packets. *****************************************************************************/ -static int PSDemux( input_thread_t * p_input ) +static int Demux( input_thread_t * p_input ) { int i; diff --git a/plugins/mpeg_system/mpeg_ts.c b/plugins/mpeg_system/mpeg_ts.c index d2ff7c9b21..3c8585c989 100644 --- a/plugins/mpeg_system/mpeg_ts.c +++ b/plugins/mpeg_system/mpeg_ts.c @@ -2,7 +2,7 @@ * mpeg_ts.c : Transport Stream input module for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: mpeg_ts.c,v 1.16 2002/07/23 00:39:17 sam Exp $ + * $Id: mpeg_ts.c,v 1.17 2002/07/31 20:56:52 sam Exp $ * * Authors: Henri Fallon * Johan Bilien @@ -58,10 +58,8 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ); -static int TSInit ( input_thread_t * ); -static void TSEnd ( input_thread_t * ); -static int TSDemux ( input_thread_t * ); +static int Activate ( vlc_object_t * ); +static int Demux ( input_thread_t * ); #if defined MODULE_NAME_IS_mpeg_ts static void TSDemuxPSI ( input_thread_t *, data_packet_t *, @@ -78,54 +76,35 @@ static void TS_DVBPSI_HandlePMT ( input_thread_t *, dvbpsi_pmt_t * ); #endif /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START +vlc_module_begin(); #if defined MODULE_NAME_IS_mpeg_ts - SET_DESCRIPTION( _("ISO 13818-1 MPEG Transport Stream input") ) - ADD_CAPABILITY( DEMUX, 160 ) - ADD_SHORTCUT( "ts" ) + set_description( _("ISO 13818-1 MPEG Transport Stream input") ); + set_capability( "demux", 160 ); + add_shortcut( "ts" ); #elif defined MODULE_NAME_IS_mpeg_ts_dvbpsi - SET_DESCRIPTION( _("ISO 13818-1 MPEG Transport Stream input (libdvbpsi)") ) - ADD_CAPABILITY( DEMUX, 170 ) - ADD_SHORTCUT( "ts_dvbpsi" ) + set_description( _("ISO 13818-1 MPEG Transport Stream input (libdvbpsi)") ); + set_capability( "demux", 170 ); + add_shortcut( "ts_dvbpsi" ); #endif -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - input_getfunctions( &p_module->p_functions->demux ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void input_getfunctions( function_list_t * p_function_list ) -{ -#define input p_function_list->functions.demux - input.pf_init = TSInit; - input.pf_end = TSEnd; - input.pf_demux = TSDemux; - input.pf_rewind = NULL; -#undef input -} + set_callbacks( Activate, NULL ); +vlc_module_end(); /***************************************************************************** - * TSInit: initializes TS structures + * Activate: initializes TS structures *****************************************************************************/ -static int TSInit( input_thread_t * p_input ) +static int Activate( vlc_object_t * p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; es_descriptor_t * p_pat_es; es_ts_data_t * p_demux_data; stream_ts_data_t * p_stream_data; byte_t * p_peek; + /* Set the demux function */ + p_input->pf_demux = Demux; + /* Initialize access plug-in structures. */ if( p_input->i_mtu == 0 ) { @@ -199,19 +178,12 @@ static int TSInit( input_thread_t * p_input ) } /***************************************************************************** - * TSEnd: frees unused data - *****************************************************************************/ -static void TSEnd( input_thread_t * p_input ) -{ -} - -/***************************************************************************** - * TSDemux: reads and demuxes data packets + * Demux: reads and demuxes data packets ***************************************************************************** * Returns -1 in case of error, 0 in case of EOF, otherwise the number of * packets. *****************************************************************************/ -static int TSDemux( input_thread_t * p_input ) +static int Demux( input_thread_t * p_input ) { int i_read_once = (p_input->i_mtu ? p_input->i_bufsize / TS_PACKET_SIZE : diff --git a/plugins/mpeg_vdec/video_parser.c b/plugins/mpeg_vdec/video_parser.c index 7a2145b48f..01ff89b69f 100644 --- a/plugins/mpeg_vdec/video_parser.c +++ b/plugins/mpeg_vdec/video_parser.c @@ -2,7 +2,7 @@ * video_parser.c : video parser thread ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: video_parser.c,v 1.26 2002/07/23 00:39:17 sam Exp $ + * $Id: video_parser.c,v 1.27 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * Samuel Hocevar @@ -50,23 +50,14 @@ /* * Local prototypes */ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); static int InitThread ( vpar_thread_t * ); static void EndThread ( vpar_thread_t * ); static void BitstreamCallback ( bit_stream_t *, vlc_bool_t ); /***************************************************************************** - * Capabilities - *****************************************************************************/ -void _M( vdec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} - -/***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define VDEC_IDCT_TEXT N_("IDCT module") #define VDEC_IDCT_LONGTEXT N_( \ @@ -92,45 +83,43 @@ void _M( vdec_getfunctions )( function_list_t * p_function_list ) "you select more pictures than what your CPU is capable to decode, " \ "you won't get anything.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL) -ADD_MODULE ( "mpeg-idct", MODULE_CAPABILITY_IDCT, NULL, NULL, - VDEC_IDCT_TEXT, VDEC_IDCT_LONGTEXT ) -ADD_MODULE ( "mpeg-motion", MODULE_CAPABILITY_MOTION, NULL, NULL, - VDEC_MOTION_TEXT, VDEC_IDCT_LONGTEXT ) -ADD_INTEGER ( "vdec-smp", 0, NULL, VDEC_SMP_TEXT, VDEC_SMP_LONGTEXT ) -ADD_STRING ( "vpar-synchro", NULL, NULL, VPAR_SYNCHRO_TEXT, - VPAR_SYNCHRO_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("MPEG I/II video decoder module") ) - ADD_CAPABILITY( DECODER, 50 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( vdec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_module ( "mpeg-idct", "idct", NULL, NULL, + VDEC_IDCT_TEXT, VDEC_IDCT_LONGTEXT ); + add_module ( "mpeg-motion", "motion", NULL, NULL, + VDEC_MOTION_TEXT, VDEC_IDCT_LONGTEXT ); + add_integer ( "vdec-smp", 0, NULL, VDEC_SMP_TEXT, VDEC_SMP_LONGTEXT ); + add_string ( "vpar-synchro", NULL, NULL, VPAR_SYNCHRO_TEXT, + VPAR_SYNCHRO_LONGTEXT ); + set_description( _("MPEG I/II video decoder module") ); + set_capability( "decoder", 50 ); + set_callbacks( OpenDecoder, NULL ); +vlc_module_end(); /***************************************************************************** - * decoder_Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able * to chose. *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) +static int OpenDecoder( vlc_object_t *p_this ) { - return *pi_type == VLC_FOURCC('m','p','g','v') ? 0 : -1; + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + + if( p_fifo->i_fourcc == VLC_FOURCC('m','p','g','v') ) + { + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; + } + + return VLC_EGENERIC; } /***************************************************************************** - * decoder_Run: this function is called just after the thread is created + * RunDecoder: this function is called just after the thread is created *****************************************************************************/ -static int decoder_Run ( decoder_fifo_t * p_fifo ) +static int RunDecoder ( decoder_fifo_t * p_fifo ) { vpar_thread_t * p_vpar; vlc_bool_t b_error; @@ -199,7 +188,7 @@ static int decoder_Run ( decoder_fifo_t * p_fifo ) /***************************************************************************** * InitThread: initialize vpar output thread ***************************************************************************** - * This function is called from decoder_Run and performs the second step + * This function is called from Run and performs the second step * of the initialization. It returns 0 on success. Note that the thread's * flag are not modified inside this function. *****************************************************************************/ @@ -211,45 +200,41 @@ static int InitThread( vpar_thread_t *p_vpar ) * Choose the best motion compensation module */ psz_name = config_GetPsz( p_vpar->p_fifo, "mpeg-motion" ); - p_vpar->p_motion_module = module_Need( p_vpar->p_fifo, - MODULE_CAPABILITY_MOTION, psz_name, NULL ); + p_vpar->p_motion = + module_Need( p_vpar->p_fifo, "motion compensation", psz_name ); if( psz_name ) free( psz_name ); - if( p_vpar->p_motion_module == NULL ) + if( p_vpar->p_motion == NULL ) { msg_Err( p_vpar->p_fifo, "no suitable motion compensation module" ); free( p_vpar ); return( -1 ); } -#define f ( p_vpar->p_motion_module->p_functions->motion.functions.motion ) - memcpy( p_vpar->pool.ppppf_motion, f.ppppf_motion, sizeof(void *) * 16 ); -#undef f + memcpy( p_vpar->pool.ppppf_motion, + p_vpar->p_fifo->p_private, sizeof(void *) * 16 ); /* * Choose the best IDCT module */ psz_name = config_GetPsz( p_vpar->p_fifo, "mpeg-idct" ); - p_vpar->p_idct_module = module_Need( p_vpar->p_fifo, - MODULE_CAPABILITY_IDCT, psz_name, NULL ); + p_vpar->p_idct = module_Need( p_vpar->p_fifo, "idct", psz_name ); if( psz_name ) free( psz_name ); - if( p_vpar->p_idct_module == NULL ) + if( p_vpar->p_idct == NULL ) { msg_Err( p_vpar->p_fifo, "no suitable IDCT module" ); - module_Unneed( p_vpar->p_motion_module ); + module_Unneed( p_vpar->p_fifo, p_vpar->p_motion ); free( p_vpar ); return( -1 ); } -#define f p_vpar->p_idct_module->p_functions->idct.functions.idct - p_vpar->pool.pf_idct_init = f.pf_idct_init; - p_vpar->pf_sparse_idct_add = f.pf_sparse_idct_add; - p_vpar->pf_idct_add = f.pf_idct_add; - p_vpar->pf_sparse_idct_copy = f.pf_sparse_idct_copy; - p_vpar->pf_idct_copy = f.pf_idct_copy; - p_vpar->pf_norm_scan = f.pf_norm_scan; -#undef f + p_vpar->pool.pf_idct_init = ((void**)p_vpar->p_fifo->p_private)[0]; + p_vpar->pf_norm_scan = ((void**)p_vpar->p_fifo->p_private)[1]; + p_vpar->pf_sparse_idct_add = ((void**)p_vpar->p_fifo->p_private)[2]; + p_vpar->pf_sparse_idct_copy = ((void**)p_vpar->p_fifo->p_private)[3]; + p_vpar->pf_idct_add = ((void**)p_vpar->p_fifo->p_private)[4]; + p_vpar->pf_idct_copy = ((void**)p_vpar->p_fifo->p_private)[5]; /* Initialize input bitstream */ InitBitstream( &p_vpar->bit_stream, p_vpar->p_fifo, @@ -401,8 +386,8 @@ static void EndThread( vpar_thread_t *p_vpar ) vpar_EndPool( p_vpar ); - module_Unneed( p_vpar->p_idct_module ); - module_Unneed( p_vpar->p_motion_module ); + module_Unneed( p_vpar->p_fifo, p_vpar->p_idct ); + module_Unneed( p_vpar->p_fifo, p_vpar->p_motion ); free( p_vpar ); } diff --git a/plugins/mpeg_vdec/video_parser.h b/plugins/mpeg_vdec/video_parser.h index b693630d2b..70278351a3 100644 --- a/plugins/mpeg_vdec/video_parser.h +++ b/plugins/mpeg_vdec/video_parser.h @@ -2,7 +2,7 @@ * video_parser.h : video parser thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_parser.h,v 1.6 2002/06/01 12:32:00 sam Exp $ + * $Id: video_parser.h,v 1.7 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * Jean-Marc Dressler @@ -337,10 +337,10 @@ typedef struct vpar_thread_s u8 pi_default_nonintra_quant[64]; /* Motion compensation plug-in used and shortcuts */ - module_t * p_motion_module; + module_t * p_motion; /* IDCT plug-in used and shortcuts */ - module_t * p_idct_module; + module_t * p_idct; void ( * pf_sparse_idct_add )( dctelem_t *, yuv_data_t *, int, void *, int ); void ( * pf_idct_add ) ( dctelem_t *, yuv_data_t *, int, diff --git a/plugins/mpeg_vdec/vpar_pool.c b/plugins/mpeg_vdec/vpar_pool.c index 7f73c22f70..a2fa4d6962 100644 --- a/plugins/mpeg_vdec/vpar_pool.c +++ b/plugins/mpeg_vdec/vpar_pool.c @@ -2,7 +2,7 @@ * vpar_pool.c : management of the pool of decoder threads ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: vpar_pool.c,v 1.12 2002/06/08 14:08:46 sam Exp $ + * $Id: vpar_pool.c,v 1.13 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * @@ -107,7 +107,7 @@ void vpar_SpawnPool( vpar_thread_t * p_vpar ) p_control = p_vpar->p_fifo->p_stream_ctrl; vlc_mutex_lock( &p_control->control_lock ); - i_new_smp = p_control->i_smp; + i_new_smp = config_GetInt( p_vpar->p_fifo, "vdec-smp" ); vlc_mutex_unlock( &p_control->control_lock ); /* FIXME: No error check because I'm tired. Come back later... */ diff --git a/plugins/network/ipv4.c b/plugins/network/ipv4.c index 0c2d1f1a72..78880c3d3e 100644 --- a/plugins/network/ipv4.c +++ b/plugins/network/ipv4.c @@ -2,7 +2,7 @@ * ipv4.c: IPv4 network abstraction layer ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: ipv4.c,v 1.14 2002/07/19 21:14:13 massiot Exp $ + * $Id: ipv4.c,v 1.15 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * Mathias Kretschmer @@ -60,37 +60,16 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static void getfunctions( function_list_t * ); -static int NetworkOpen( vlc_object_t *, network_socket_t * ); +static int NetOpen( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("IPv4 network abstraction layer") ) - ADD_CAPABILITY( NETWORK, 50 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - getfunctions( &p_module->p_functions->network ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void getfunctions( function_list_t * p_function_list ) -{ -#define f p_function_list->functions.network - f.pf_open = NetworkOpen; -#undef f -} +vlc_module_begin(); + set_description( _("IPv4 network abstraction layer") ); + set_capability( "network", 50 ); + set_callbacks( NetOpen, NULL ); +vlc_module_end(); /***************************************************************************** * BuildAddr: utility function to build a struct sockaddr_in @@ -357,10 +336,12 @@ static int OpenTCP( vlc_object_t * p_this, network_socket_t * p_socket ) } /***************************************************************************** - * NetworkOpen: wrapper around OpenUDP and OpenTCP + * NetOpen: wrapper around OpenUDP and OpenTCP *****************************************************************************/ -static int NetworkOpen( vlc_object_t * p_this, network_socket_t * p_socket ) +static int NetOpen( vlc_object_t * p_this ) { + network_socket_t * p_socket = p_this->p_private; + if( p_socket->i_type == NETWORK_UDP ) { return OpenUDP( p_this, p_socket ); diff --git a/plugins/network/ipv6.c b/plugins/network/ipv6.c index 0de88c4557..03d1429ae4 100644 --- a/plugins/network/ipv6.c +++ b/plugins/network/ipv6.c @@ -2,7 +2,7 @@ * ipv6.c: IPv6 network abstraction layer ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: ipv6.c,v 1.15 2002/07/29 19:01:27 gbazin Exp $ + * $Id: ipv6.c,v 1.16 2002/07/31 20:56:52 sam Exp $ * * Authors: Alexis Guillard * Christophe Massiot @@ -70,37 +70,16 @@ static const struct in6_addr in6addr_any = {{IN6ADDR_ANY_INIT}}; /***************************************************************************** * Local prototypes *****************************************************************************/ -static void getfunctions( function_list_t * ); -static int NetworkOpen( vlc_object_t *, network_socket_t * ); +static int Open( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("IPv6 network abstraction layer") ) - ADD_CAPABILITY( NETWORK, 40 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - getfunctions( &p_module->p_functions->network ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void getfunctions( function_list_t * p_function_list ) -{ -#define f p_function_list->functions.network - f.pf_open = NetworkOpen; -#undef f -} +vlc_module_begin(); + set_description( _("IPv6 network abstraction layer") ); + set_capability( "network", 40 ); + set_callbacks( Open, NULL ); +vlc_module_end(); /***************************************************************************** * BuildAddr: utility function to build a struct sockaddr_in6 @@ -426,10 +405,12 @@ static int OpenTCP( vlc_object_t * p_this, network_socket_t * p_socket ) } /***************************************************************************** - * NetworkOpen: wrapper around OpenUDP and OpenTCP + * Open: wrapper around OpenUDP and OpenTCP *****************************************************************************/ -static int NetworkOpen( vlc_object_t * p_this, network_socket_t * p_socket ) +static int Open( vlc_object_t * p_this ) { + network_socket_t * p_socket = p_this->p_private; + if( p_socket->i_type == NETWORK_UDP ) { return OpenUDP( p_this, p_socket ); diff --git a/plugins/qnx/aout_qnx.c b/plugins/qnx/aout_qnx.c index 04a98297e7..5324df5d94 100644 --- a/plugins/qnx/aout_qnx.c +++ b/plugins/qnx/aout_qnx.c @@ -43,33 +43,18 @@ struct aout_sys_t /***************************************************************************** * Local prototypes *****************************************************************************/ -static int aout_Open ( aout_thread_t *p_aout ); -static int aout_SetFormat ( aout_thread_t *p_aout ); -static int aout_GetBufInfo ( aout_thread_t *p_aout, int i_buffer_info ); -static void aout_Play ( aout_thread_t *p_aout, - byte_t *buffer, int i_size ); -static void aout_Close ( aout_thread_t *p_aout ); +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} - -/***************************************************************************** - * aout_Open : creates a handle and opens an alsa device + * Open : creates a handle and opens an alsa device ***************************************************************************** * This function opens an alsa device, through the alsa API *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) +int E_(OpenAudio)( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; int i_ret; /* allocate structure */ @@ -97,22 +82,25 @@ static int aout_Open( aout_thread_t *p_aout ) PLUGIN_DISABLE_MMAP ) ) < 0 ) { msg_Err( p_aout, "unable to disable mmap (%s)", snd_strerror(i_ret) ); - aout_Close( p_aout ); + Close( p_this ); free( p_aout->p_sys ); return( 1 ); } + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + return( 0 ); } - /***************************************************************************** - * aout_SetFormat : set the audio output format + * SetFormat : set the audio output format ***************************************************************************** * This function prepares the device, sets the rate, format, the mode * ("play as soon as you have data"), and buffer information. *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { int i_ret; int i_bytes_per_sample; @@ -181,14 +169,14 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_BufInfo: buffer status query + * GetBufInfo: buffer status query ***************************************************************************** * This function returns the number of used byte in the queue. * It also deals with errors : indeed if the device comes to run out * of data to play, it switches to the "underrun" status. It has to * be flushed and re-prepared *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { int i_ret; snd_pcm_channel_status_t status; @@ -221,11 +209,11 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) } /***************************************************************************** - * aout_Play : plays a sample + * Play : plays a sample ***************************************************************************** * Plays a sample using the snd_pcm_write function from the alsa API *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { int i_ret; @@ -238,10 +226,11 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } /***************************************************************************** - * aout_Close : close the audio device + * CloseAudio: close the audio device *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +static void E_(CloseAudio) ( vlc_object_t *p_this ) { + aout_thread_t *p_aout = (aout_thread_t *)p_this; int i_ret; if( ( i_ret = snd_pcm_close( p_aout->p_sys->p_pcm_handle ) ) < 0 ) diff --git a/plugins/qnx/qnx.c b/plugins/qnx/qnx.c index 2f679ed4a5..32fbff1f07 100644 --- a/plugins/qnx/qnx.c +++ b/plugins/qnx/qnx.c @@ -29,27 +29,24 @@ #include /***************************************************************************** - * Capabilities defined in the other files. + * External prototypes ******************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ); -void _M( vout_getfunctions )( function_list_t * p_function_list ); +int E_(OpenAudio) ( vlc_object_t * ); +void E_(CloseAudio) ( vlc_object_t * ); + +int E_(OpenVideo) ( vlc_object_t * ); +void E_(CloseVideo) ( vlc_object_t * ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("QNX RTOS module") ) - ADD_CAPABILITY( VOUT, 100 ) - ADD_CAPABILITY( AOUT, 50 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( aout_getfunctions )( &p_module->p_functions->aout ); - _M( vout_getfunctions )( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP +vlc_module_begin(); + set_description( _("QNX RTOS module") ); + add_submodule(); + set_capability( "video output", 100 ); + set_callbacks( E_(OpenVideo), E_(CloseVideo) ); + add_submodule(); + set_capability( "audio output", 100 ); + set_callbacks( E_(OpenAudio), E_(CloseAudio) ); +vlc_module_end(); -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP diff --git a/plugins/qnx/vout_qnx.c b/plugins/qnx/vout_qnx.c index 52fe0e42a5..da8e2917d2 100644 --- a/plugins/qnx/vout_qnx.c +++ b/plugins/qnx/vout_qnx.c @@ -107,13 +107,10 @@ struct picture_sys_t /***************************************************************************** * Local prototypes *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); +static int QNXInit ( vout_thread_t * ); +static void QNXEnd ( vout_thread_t * ); +static int QNXManage ( vout_thread_t * ); +static void QNXDisplay ( vout_thread_t *, picture_t * ); static int QNXInitDisplay ( vout_thread_t * ); static int QNXCreateWnd ( vout_thread_t * ); @@ -121,33 +118,20 @@ static int QNXDestroyWnd ( vout_thread_t * ); static int NewPicture ( vout_thread_t *, picture_t *, int ); static void FreePicture ( vout_thread_t *, picture_t * ); -static int ResizeOverlayOutput ( vout_thread_t * ); +static int ResizeOverlayOutput ( vout_thread_t * ); static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( vout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocate QNX video thread output method + * OpenVideo: allocate QNX video thread output method ***************************************************************************** * This function allocate and initialize a QNX vout method. It uses some of the * vout properties to choose the window size, and change them according to the * actual properties of the display. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) -{ +int E_(OpenVideo) ( vlc_object_t *p_this ) +{ + vout_thread_t * p_vout = (vout_thread_t *)p_this; + /* init connection to photon */ if( PtInit( "/dev/photon" ) != 0 ) { @@ -178,16 +162,22 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = QNXInit; + p_vout->pf_end = QNXEnd; + p_vout->pf_manage = QNXManage; + p_vout->pf_render = NULL; + p_vout->pf_display = QNXDisplay; + return( 0 ); } /***************************************************************************** - * vout_Init: initialize QNX video thread output method + * QNXInit: initialize QNX video thread output method ***************************************************************************** * This function create the buffers needed by the output thread. It is called * at the beginning of the thread, but also each time the window is resized. *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int QNXInit( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -264,12 +254,12 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate QNX video thread output method + * QNXEnd: terminate QNX video thread output method ***************************************************************************** - * Destroy the buffers created by vout_Init. It is called at the end of + * Destroy the buffers created by QNXInit. It is called at the end of * the thread, but also each time the window is resized. *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void QNXEnd( vout_thread_t *p_vout ) { int i_index; @@ -282,12 +272,14 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy QNX video thread output method + * CloseVideo: destroy QNX video thread output method ***************************************************************************** - * Terminate an output method created by vout_CreateOutputMethod + * Terminate an output method created by QNXCreate *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) -{ +void E_(CloseVideo) ( vlc_object_t *p_this ) +{ + vout_thread_t * p_vout = (vout_thread_t *)p_this; + /* destroy the window */ QNXDestroyWnd( p_vout ); @@ -296,12 +288,12 @@ static void vout_Destroy( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Manage: handle QNX events + * QNXManage: handle QNX events ***************************************************************************** * This function should be called regularly by video output thread. It allows * window resizing. It returns a non null value on error. *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) +static int QNXManage( vout_thread_t *p_vout ) { int i_ev, i_buflen; PhEvent_t *p_event; @@ -464,8 +456,8 @@ static int vout_Manage( vout_thread_t *p_vout ) p_vout->output.i_height = p_vout->p_sys->dim.h; p_vout->i_changes |= VOUT_YUV_CHANGE; - vout_End( p_vout ); - if( vout_Init( p_vout ) ) + QNXEnd( p_vout ); + if( QNXInit( p_vout ) ) { msg_Err( p_vout, "cannot resize display" ); return( 1 ); @@ -489,20 +481,12 @@ static int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Render: render previously calculated output - *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - -/***************************************************************************** - * vout_Display: displays previously rendered output + * QNXDisplay: displays previously rendered output ***************************************************************************** * This function send the currently rendered image to QNX server, wait until * it is displayed and switch the two rendering buffer, preparing next frame. *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void QNXDisplay( vout_thread_t *p_vout, picture_t *p_pic ) { if( p_vout->p_sys->i_mode == MODE_NORMAL_MEM || p_vout->p_sys->i_mode == MODE_SHARED_MEM ) diff --git a/plugins/qt/intf_qt.cpp b/plugins/qt/intf_qt.cpp index d4a28ae7d8..9e79be0008 100644 --- a/plugins/qt/intf_qt.cpp +++ b/plugins/qt/intf_qt.cpp @@ -2,7 +2,7 @@ * intf_qt.cpp: Qt interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_qt.cpp,v 1.17 2002/07/20 18:01:43 sam Exp $ + * $Id: intf_qt.cpp,v 1.18 2002/07/31 20:56:52 sam Exp $ * * Authors: Samuel Hocevar * @@ -134,33 +134,16 @@ struct intf_sys_t }; /***************************************************************************** - * Local prototypes. + * Local prototype *****************************************************************************/ -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); +static void Run ( intf_thread_t *p_intf ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Open: initialize and create window *****************************************************************************/ -extern "C" -{ - -void _M( intf_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} - -} - -/***************************************************************************** - * intf_Open: initialize and create window - *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) +int E_(Open) ( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t*) p_this; char *pp_argv[] = { "" }; int i_argc = 1; @@ -172,6 +155,8 @@ static int intf_Open( intf_thread_t *p_intf ) return 1; } + p_intf->pf_run = Run; + /* Create the C++ objects */ p_intf->p_sys->p_app = new QApplication( i_argc, pp_argv ); p_intf->p_sys->p_window = new IntfWindow( p_intf ); @@ -185,10 +170,12 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy interface window + * Close: destroy interface window *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) +void E_(Close) ( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t*) p_this; + if( p_intf->p_sys->p_input ) { vlc_object_release( p_intf->p_sys->p_input ); @@ -203,12 +190,12 @@ static void intf_Close( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Run: Qt thread + * Run: Qt thread ***************************************************************************** * This part of the interface is in a separate thread so that we can call * exec() from within it without annoying the rest of the program. *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { p_intf->p_sys->p_window->show(); diff --git a/plugins/qt/qt.cpp b/plugins/qt/qt.cpp index 057cd081ca..b240413a0c 100644 --- a/plugins/qt/qt.cpp +++ b/plugins/qt/qt.cpp @@ -2,7 +2,7 @@ * qt.cpp : Qt plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: qt.cpp,v 1.11 2002/06/01 12:32:00 sam Exp $ + * $Id: qt.cpp,v 1.12 2002/07/31 20:56:52 sam Exp $ * * Authors: Samuel Hocevar * @@ -29,39 +29,24 @@ #include -extern "C" -{ /***************************************************************************** - * Capabilities defined in the other files. + * External prototypes *****************************************************************************/ -void _M( intf_getfunctions )( function_list_t * p_function_list ); +int E_(Open) ( vlc_object_t * ); +void E_(Close) ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Qt interface module") ) -#ifndef WIN32 - if( getenv( "DISPLAY" ) == NULL ) - { - ADD_CAPABILITY( INTF, 7 ) - } - else +vlc_module_begin(); +#ifdef WIN32 + int i = 80; +#else + int i = getenv( "DISPLAY" ) == NULL ? 7 : 80; #endif - { - ADD_CAPABILITY( INTF, 80 ) - } - ADD_PROGRAM( "qvlc" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( intf_getfunctions )( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + set_description( _("Qt interface module") ); + set_capability( "interface", i ); + set_program( "qvlc" ); + set_callbacks( E_(Open), E_(Close) ); +vlc_module_end(); -} /* extern "C" */ diff --git a/plugins/satellite/input_satellite.c b/plugins/satellite/input_satellite.c index ffc4ecf5cc..e42840dcad 100644 --- a/plugins/satellite/input_satellite.c +++ b/plugins/satellite/input_satellite.c @@ -50,8 +50,6 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static int SatelliteOpen ( input_thread_t * ); -static void SatelliteClose ( input_thread_t * ); static ssize_t SatelliteRead( input_thread_t * p_input, byte_t * p_buffer, size_t i_len ); static int SatelliteSetArea ( input_thread_t *, input_area_t * ); @@ -59,26 +57,11 @@ static int SatelliteSetProgram ( input_thread_t *, pgrm_descriptor_t * ); static void SatelliteSeek ( input_thread_t *, off_t ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Open: open the dvr device *****************************************************************************/ -void _M( access_getfunctions )( function_list_t * p_function_list ) -{ -#define access p_function_list->functions.access - access.pf_open = SatelliteOpen; - access.pf_close = SatelliteClose; - access.pf_read = SatelliteRead; - access.pf_set_area = SatelliteSetArea; - access.pf_set_program = SatelliteSetProgram; - access.pf_seek = SatelliteSeek; -#undef access -} - -/***************************************************************************** - * SatelliteOpen : open the dvr device - *****************************************************************************/ -static int SatelliteOpen( input_thread_t * p_input ) +int E_(Open) ( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; input_socket_t * p_satellite; char * psz_parser; char * psz_next; @@ -102,6 +85,11 @@ static int SatelliteOpen( input_thread_t * p_input ) return( -1 ); } + p_input->pf_read = SatelliteRead; + p_input->pf_set_program = SatelliteSetProgram; + p_input->pf_set_area = SatelliteSetArea; + p_input->pf_seek = SatelliteSeek; + i_freq = (int)strtol( psz_parser, &psz_next, 10 ); if( *psz_next ) @@ -308,10 +296,11 @@ static int SatelliteOpen( input_thread_t * p_input ) } /***************************************************************************** - * SatelliteClose : Closes the device + * Close : Close the device *****************************************************************************/ -static void SatelliteClose( input_thread_t * p_input ) +void E_(Close) ( vlc_object_t *p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; input_socket_t * p_satellite; int i_es_index; diff --git a/plugins/satellite/satellite.c b/plugins/satellite/satellite.c index 81a2a17445..01e66b0eb6 100644 --- a/plugins/satellite/satellite.c +++ b/plugins/satellite/satellite.c @@ -29,13 +29,13 @@ #include /***************************************************************************** - * Capabilities defined in the other files. + * External prototypes *****************************************************************************/ -void _M( access_getfunctions )( function_list_t * p_function_list ); -void _M( demux_getfunctions )( function_list_t * p_function_list ); +int E_(Open) ( vlc_object_t * ); +void E_(Close) ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define FREQ_TEXT N_("satellite default transponder frequency") @@ -62,28 +62,22 @@ void _M( demux_getfunctions )( function_list_t * p_function_list ); #define LNB_SLOF_TEXT N_("antenna lnb_slof (kHz)") #define LNB_SLOF_LONGTEXT "" -MODULE_CONFIG_START - ADD_CATEGORY_HINT( N_("Input"), NULL ) - ADD_INTEGER ( "frequency", 11954, NULL, FREQ_TEXT, FREQ_LONGTEXT ) - ADD_INTEGER ( "polarization", 0, NULL, POL_TEXT, POL_LONGTEXT ) - ADD_INTEGER ( "fec", 3, NULL, FEC_TEXT, FEC_LONGTEXT ) - ADD_INTEGER ( "symbol-rate", 27500, NULL, SRATE_TEXT, SRATE_LONGTEXT ) - ADD_BOOL ( "diseqc", 0, NULL, DISEQC_TEXT, DISEQC_LONGTEXT ) - ADD_INTEGER ( "lnb-lof1", 10000, NULL, LNB_LOF1_TEXT, LNB_LOF1_LONGTEXT ) - ADD_INTEGER ( "lnb-lof2", 10000, NULL, LNB_LOF2_TEXT, LNB_LOF2_LONGTEXT ) - ADD_INTEGER ( "lnb-slof", 11700, NULL, LNB_SLOF_TEXT, LNB_SLOF_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("satellite input module") ) - ADD_CAPABILITY( ACCESS, 0 ) - ADD_SHORTCUT( "sat" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( access_getfunctions )( &p_module->p_functions->access ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Input"), NULL ); + add_integer( "frequency", 11954, NULL, FREQ_TEXT, FREQ_LONGTEXT ); + add_integer( "polarization", 0, NULL, POL_TEXT, POL_LONGTEXT ); + add_integer( "fec", 3, NULL, FEC_TEXT, FEC_LONGTEXT ); + add_integer( "symbol-rate", 27500, NULL, SRATE_TEXT, SRATE_LONGTEXT ); + add_bool( "diseqc", 0, NULL, DISEQC_TEXT, DISEQC_LONGTEXT ); + add_integer( "lnb-lof1", 10000, NULL, + LNB_LOF1_TEXT, LNB_LOF1_LONGTEXT ); + add_integer( "lnb-lof2", 10000, NULL, + LNB_LOF2_TEXT, LNB_LOF2_LONGTEXT ); + add_integer( "lnb-slof", 11700, NULL, + LNB_SLOF_TEXT, LNB_SLOF_LONGTEXT ); + set_description( _("satellite input module") ); + set_capability( "access", 0 ); + add_shortcut( "sat" ); + set_callbacks( E_(Open), E_(Close) ); +vlc_module_end(); diff --git a/plugins/sdl/aout_sdl.c b/plugins/sdl/aout_sdl.c index 1a7fe78f6f..1fc103d75d 100644 --- a/plugins/sdl/aout_sdl.c +++ b/plugins/sdl/aout_sdl.c @@ -2,7 +2,7 @@ * aout_sdl.c : audio sdl functions library ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: aout_sdl.c,v 1.30 2002/07/20 18:01:43 sam Exp $ + * $Id: aout_sdl.c,v 1.31 2002/07/31 20:56:52 sam Exp $ * * Authors: Michel Kaempf * Samuel Hocevar @@ -56,38 +56,24 @@ struct aout_sys_t }; /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static int aout_Open ( aout_thread_t *p_aout ); -static int aout_SetFormat ( aout_thread_t *p_aout ); -static int aout_GetBufInfo ( aout_thread_t *p_aout, int i_buffer_info ); -static void aout_Play ( aout_thread_t *p_aout, - byte_t *buffer, int i_size ); -static void aout_Close ( aout_thread_t *p_aout ); +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); -static void aout_SDLCallback ( void *userdata, Uint8 *stream, int len ); +static void SDLCallback ( void *, Uint8 *, int ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} - -/***************************************************************************** - * aout_Open: open the audio device + * OpenAudio: open the audio device ***************************************************************************** * This function opens the dsp as a usual non-blocking write-only file, and * modifies the p_aout->i_fd with the file's descriptor. *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) +int E_(OpenAudio) ( vlc_object_t *p_this ) { + aout_thread_t * p_aout = (aout_thread_t *)p_this; + SDL_AudioSpec desired; if( SDL_WasInit( SDL_INIT_AUDIO ) != 0 ) @@ -95,6 +81,10 @@ static int aout_Open( aout_thread_t *p_aout ) return( 1 ); } + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; + /* Allocate structure */ p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); @@ -136,7 +126,7 @@ static int aout_Open( aout_thread_t *p_aout ) desired.format = AUDIO_S16LSB; /* stereo 16 bits */ #endif desired.channels = p_aout->i_channels; - desired.callback = aout_SDLCallback; + desired.callback = SDLCallback; desired.userdata = p_aout->p_sys; desired.samples = 1024; @@ -160,14 +150,14 @@ static int aout_Open( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_SetFormat: reset the audio device and sets its format + * SetFormat: reset the audio device and sets its format ***************************************************************************** * This functions resets the audio device, tries to initialize the output * format with the value contained in the dsp structure, and if this value * could not be set, the default value returned by ioctl is set. It then * does the same for the stereo mode, and for the output rate. *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { /* TODO: finish and clean this */ SDL_AudioSpec desired; @@ -180,7 +170,7 @@ static int aout_SetFormat( aout_thread_t *p_aout ) desired.format = AUDIO_S16LSB; /* stereo 16 bits */ #endif desired.channels = p_aout->i_channels; - desired.callback = aout_SDLCallback; + desired.callback = SDLCallback; desired.userdata = p_aout->p_sys; desired.samples = 2048; @@ -201,12 +191,12 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_GetBufInfo: buffer status query + * GetBufInfo: buffer status query ***************************************************************************** * returns the number of bytes in the audio buffer compared to the size of * i_buffer_limit... *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { if(i_buffer_limit > p_aout->p_sys->i_audio_end) { @@ -217,11 +207,11 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) } /***************************************************************************** - * aout_Play: play a sound samples buffer + * Play: play a sound samples buffer ***************************************************************************** * This function writes a buffer of i_length bytes in the dsp *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) { byte_t * audio_buf = p_aout->p_sys->audio_buf; @@ -238,10 +228,12 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) } /***************************************************************************** - * aout_Close: close the audio device + * CloseAudio: close the audio device *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) +void E_(CloseAudio) ( vlc_object_t *p_this ) { + aout_thread_t * p_aout = (aout_thread_t *)p_this; + if( p_aout->p_sys->b_active ) { SDL_PauseAudio( 1 ); /* pause audio */ @@ -260,9 +252,9 @@ static void aout_Close( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_SDLCallback: what to do once SDL has played sound samples + * SDLCallback: what to do once SDL has played sound samples *****************************************************************************/ -static void aout_SDLCallback( void *userdata, byte_t *stream, int len ) +static void SDLCallback( void *userdata, byte_t *stream, int len ) { aout_sys_t * p_sys = userdata; diff --git a/plugins/sdl/sdl.c b/plugins/sdl/sdl.c index ed8c90d80f..1bbaed6471 100644 --- a/plugins/sdl/sdl.c +++ b/plugins/sdl/sdl.c @@ -2,7 +2,7 @@ * sdl.c : SDL plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: sdl.c,v 1.21 2002/06/01 12:32:00 sam Exp $ + * $Id: sdl.c,v 1.22 2002/07/31 20:56:52 sam Exp $ * * Authors: Samuel Hocevar * Pierre Baillet @@ -32,28 +32,24 @@ #include /***************************************************************************** - * Capabilities defined in the other files. + * External prototypes *****************************************************************************/ -void _M( aout_getfunctions )( function_list_t * p_function_list ); -void _M( vout_getfunctions )( function_list_t * p_function_list ); +int E_(OpenVideo) ( vlc_object_t * ); +void E_(CloseVideo) ( vlc_object_t * ); + +int E_(OpenAudio) ( vlc_object_t * ); +void E_(CloseAudio) ( vlc_object_t * ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Simple DirectMedia Layer module") ) - ADD_CAPABILITY( AOUT, 40 ) - ADD_CAPABILITY( VOUT, 100 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( aout_getfunctions )( &p_module->p_functions->aout ); - _M( vout_getfunctions )( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("Simple DirectMedia Layer module") ); + add_submodule(); + set_capability( "video output", 40 ); + set_callbacks( E_(OpenVideo), E_(CloseVideo) ); + add_submodule(); + set_capability( "audio output", 40 ); + set_callbacks( E_(OpenAudio), E_(CloseAudio) ); +vlc_module_end(); diff --git a/plugins/sdl/vout_sdl.c b/plugins/sdl/vout_sdl.c index 62ed23fa88..e19045eb1a 100644 --- a/plugins/sdl/vout_sdl.c +++ b/plugins/sdl/vout_sdl.c @@ -2,7 +2,7 @@ * vout_sdl.c: SDL video output display method ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: vout_sdl.c,v 1.97 2002/07/23 00:39:17 sam Exp $ + * $Id: vout_sdl.c,v 1.98 2002/07/31 20:56:52 sam Exp $ * * Authors: Samuel Hocevar * Pierre Baillet @@ -83,15 +83,12 @@ struct picture_sys_t }; /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static int vout_Manage ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); +static int Init ( vout_thread_t * ); +static void End ( vout_thread_t * ); +static int Manage ( vout_thread_t * ); +static void Display ( vout_thread_t *, picture_t * ); static int OpenDisplay ( vout_thread_t * ); static void CloseDisplay ( vout_thread_t * ); @@ -99,29 +96,16 @@ static int NewPicture ( vout_thread_t *, picture_t * ); static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( vout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocate SDL video thread output method + * OpenVideo: allocate SDL video thread output method ***************************************************************************** * This function allocate and initialize a SDL vout method. It uses some of the * vout properties to choose the correct mode, and change them according to the * mode actually used. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +int E_(OpenVideo) ( vlc_object_t *p_this ) { + vout_thread_t * p_vout = (vout_thread_t *)p_this; + #ifdef HAVE_SETENV char *psz_method; #endif @@ -139,6 +123,12 @@ static int vout_Create( vout_thread_t *p_vout ) return( 1 ); } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = Manage; + p_vout->pf_render = NULL; + p_vout->pf_display = Display; + #ifdef HAVE_SETENV psz_method = config_GetPsz( p_vout, "vout" ); if( psz_method ) @@ -189,11 +179,11 @@ static int vout_Create( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize SDL video thread output method + * Init: initialize SDL video thread output method ***************************************************************************** * This function initialize the SDL display device. *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int Init( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -254,11 +244,11 @@ static int vout_Init( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate Sys video thread output method + * End: terminate Sys video thread output method ***************************************************************************** - * Terminate an output method created by vout_SDLCreate + * Terminate an output method created by OpenVideo *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void End( vout_thread_t *p_vout ) { int i_index; @@ -282,26 +272,27 @@ static void vout_End( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy Sys video thread output method + * CloseVideo: destroy Sys video thread output method ***************************************************************************** * Terminate an output method created by vout_SDLCreate *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +void E_(CloseVideo) ( vlc_object_t *p_this ) { - CloseDisplay( p_vout ); + vout_thread_t * p_vout = (vout_thread_t *)p_this; + CloseDisplay( p_vout ); SDL_QuitSubSystem( SDL_INIT_VIDEO ); free( p_vout->p_sys ); } /***************************************************************************** - * vout_Manage: handle Sys events + * Manage: handle Sys events ***************************************************************************** * This function should be called regularly by video output thread. It returns * a non null value if an error occured. *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) +static int Manage( vout_thread_t *p_vout ) { SDL_Event event; /* SDL event */ @@ -518,19 +509,11 @@ static int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Render: render previously calculated output - *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - -/***************************************************************************** - * vout_Display: displays previously rendered output + * Display: displays previously rendered output ***************************************************************************** * This function sends the currently rendered image to the display. *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void Display( vout_thread_t *p_vout, picture_t *p_pic ) { int x, y, w, h; SDL_Rect disp; diff --git a/plugins/spudec/spu_decoder.c b/plugins/spudec/spu_decoder.c index 15d6b1480f..c23a6a363c 100644 --- a/plugins/spudec/spu_decoder.c +++ b/plugins/spudec/spu_decoder.c @@ -2,7 +2,7 @@ * spu_decoder.c : spu decoder thread ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: spu_decoder.c,v 1.30 2002/07/23 00:39:17 sam Exp $ + * $Id: spu_decoder.c,v 1.31 2002/07/31 20:56:52 sam Exp $ * * Authors: Samuel Hocevar * Rudolf Cornelissen @@ -45,8 +45,8 @@ /***************************************************************************** * Local prototypes *****************************************************************************/ -static int decoder_Probe ( vlc_fourcc_t * ); -static int decoder_Run ( decoder_fifo_t * ); +static int OpenDecoder ( vlc_object_t * ); +static int RunDecoder ( decoder_fifo_t * ); static int InitThread ( spudec_thread_t * ); static void EndThread ( spudec_thread_t * ); @@ -56,49 +56,38 @@ static int ParseControlSequences( spudec_thread_t *, subpicture_t * ); static int ParseRLE ( spudec_thread_t *, subpicture_t *, u8 * ); static void RenderSPU ( vout_thread_t *, picture_t *, const subpicture_t * ); - -/***************************************************************************** - * Capabilities - *****************************************************************************/ -void _M( spudec_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.dec.pf_probe = decoder_Probe; - p_function_list->functions.dec.pf_run = decoder_Run; -} - /***************************************************************************** - * Build configuration tree. + * Module descriptor. *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("DVD subtitles decoder module") ) - ADD_CAPABILITY( DECODER, 50 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( spudec_getfunctions )( &p_module->p_functions->dec ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("DVD subtitles decoder module") ); + set_capability( "decoder", 50 ); + set_callbacks( OpenDecoder, NULL ); +vlc_module_end(); /***************************************************************************** - * decoder_Probe: probe the decoder and return score + * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able * to chose. *****************************************************************************/ -static int decoder_Probe( vlc_fourcc_t *pi_type ) +static int OpenDecoder( vlc_object_t *p_this ) { - return ( *pi_type == VLC_FOURCC('s','p','u',' ') ) ? 0 : -1; + decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; + + if( p_fifo->i_fourcc == VLC_FOURCC('s','p','u',' ') ) + { + p_fifo->pf_run = RunDecoder; + return VLC_SUCCESS; + } + + return VLC_EGENERIC; } /***************************************************************************** - * decoder_Run: this function is called just after the thread is created + * RunDecoder: this function is called just after the thread is created *****************************************************************************/ -static int decoder_Run( decoder_fifo_t * p_fifo ) +static int RunDecoder( decoder_fifo_t * p_fifo ) { spudec_thread_t * p_spudec; diff --git a/plugins/text/logger.c b/plugins/text/logger.c index eb77930d0b..78f2c21f64 100644 --- a/plugins/text/logger.c +++ b/plugins/text/logger.c @@ -2,7 +2,7 @@ * logger.c : file logging plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: logger.c,v 1.13 2002/07/20 18:01:43 sam Exp $ + * $Id: logger.c,v 1.14 2002/07/31 20:56:52 sam Exp $ * * Authors: Samuel Hocevar * @@ -68,54 +68,34 @@ struct intf_sys_t }; /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void intf_getfunctions ( function_list_t * p_function_list ); -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); +static void Run ( intf_thread_t * ); static void FlushQueue ( msg_subscription_t *, FILE *, int ); static void TextPrint ( const msg_item_t *, FILE * ); static void HtmlPrint ( const msg_item_t *, FILE * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START - ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) - ADD_STRING( "logfile", NULL, NULL, N_("log filename"), N_("Specify the log filename.") ) - ADD_STRING( "logmode", NULL, NULL, N_("log format"), N_("Specify the log format. Available choices are \"text\" (default) and \"html\"") ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("file logging interface module") ) - ADD_CAPABILITY( INTF, 1 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - intf_getfunctions( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string( "logfile", NULL, NULL, N_("log filename"), N_("Specify the log filename.") ); + add_string( "logmode", NULL, NULL, N_("log format"), N_("Specify the log format. Available choices are \"text\" (default) and \"html\"") ); + set_description( _("file logging interface module") ); + set_capability( "interface", 0 ); + set_callbacks( Open, Close ); +vlc_module_end(); /***************************************************************************** - * intf_Open: initialize and create stuff + * Open: initialize and create stuff *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ +static int Open( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; char *psz_mode, *psz_file; #ifdef WIN32 @@ -210,10 +190,12 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy interface stuff + * Close: destroy interface stuff *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) -{ +static void Close( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; + /* Flush the queue and unsubscribe from the message queue */ FlushQueue( p_intf->p_sys->p_sub, p_intf->p_sys->p_file, p_intf->p_sys->i_mode ); @@ -238,12 +220,12 @@ static void intf_Close( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Run: rc thread + * Run: rc thread ***************************************************************************** * This part of the interface is in a separate thread so that we can call * exec() from within it without annoying the rest of the program. *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { while( !p_intf->b_die ) { diff --git a/plugins/text/ncurses.c b/plugins/text/ncurses.c index 0aba806a72..a255dc9b41 100644 --- a/plugins/text/ncurses.c +++ b/plugins/text/ncurses.c @@ -2,7 +2,7 @@ * ncurses.c : NCurses plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: ncurses.c,v 1.19 2002/07/20 18:01:43 sam Exp $ + * $Id: ncurses.c,v 1.20 2002/07/31 20:56:52 sam Exp $ * * Authors: Samuel Hocevar * @@ -39,14 +39,13 @@ /***************************************************************************** * Local prototypes. *****************************************************************************/ -static void intf_getfunctions ( function_list_t * ); -static int intf_Open ( intf_thread_t * ); -static void intf_Close ( intf_thread_t * ); -static void intf_Run ( intf_thread_t * ); - -static void FullScreen ( intf_thread_t * ); -static void Play ( intf_thread_t * ); -static void Stop ( intf_thread_t * ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); + +static void Run ( intf_thread_t * ); +static void FullScreen ( intf_thread_t * ); +static void Play ( intf_thread_t * ); +static void Stop ( intf_thread_t * ); static void Next ( intf_thread_t * ); static void Eject ( intf_thread_t * ); static void Pause ( intf_thread_t * ); @@ -61,52 +60,33 @@ static int PrintFullLine ( const char *p_fmt, ... ); static void ManageSlider ( intf_thread_t * ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("ncurses interface module") ) - ADD_CAPABILITY( INTF, 10 ) - ADD_SHORTCUT( "curses" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - intf_getfunctions( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("ncurses interface module") ); + set_capability( "interface", 10 ); + set_callbacks( Open, Close ); + add_shortcut( "curses" ); +vlc_module_end(); /***************************************************************************** * intf_sys_t: description and status of ncurses interface *****************************************************************************/ struct intf_sys_t { - /* special actions */ - vlc_mutex_t change_lock; /* the change lock */ + input_thread_t * p_input; float f_slider_state; float f_slider_state_old; }; /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Open: initialize and create window *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} +static int Open( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; -/***************************************************************************** - * intf_Open: initialize and create window - *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ /* Allocate instance and initialize some members */ p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) @@ -115,7 +95,9 @@ static int intf_Open( intf_thread_t *p_intf ) return( 1 ); } - memset ( p_intf->p_sys, 0, sizeof ( intf_sys_t ) ); + p_intf->p_sys->p_input = NULL; + + p_intf->pf_run = Run; /* Initialize the curses library */ initscr(); @@ -135,10 +117,17 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy interface window + * Close: destroy interface window *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) -{ +static void Close( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; + + if( p_intf->p_sys->p_input ) + { + vlc_object_release( p_intf->p_sys->p_input ); + } + /* Close the ncurses interface */ endwin(); @@ -147,9 +136,9 @@ static void intf_Close( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Run: ncurses thread + * Run: ncurses thread *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { signed char i_key; time_t t_last_refresh; @@ -161,10 +150,20 @@ static void intf_Run( intf_thread_t *p_intf ) while( !p_intf->b_die ) { - p_intf->pf_manage( p_intf ); - msleep( INTF_IDLE_SLEEP ); + /* Update the input */ + if( p_intf->p_sys->p_input == NULL ) + { + p_intf->p_sys->p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, + FIND_ANYWHERE ); + } + else if( p_intf->p_sys->p_input->b_dead ) + { + vlc_object_release( p_intf->p_sys->p_input ); + p_intf->p_sys->p_input = NULL; + } + while( (i_key = getch()) != -1 ) { /* @@ -316,11 +315,11 @@ Redraw ( intf_thread_t *p_intf, time_t *t_last_refresh ) row++; move ( row, 0 ); - if ( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL ) + if ( p_intf->p_sys->p_input != NULL ) { PrintFullLine ( " DVD Chapter:%3d DVD Title:%3d", - p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area->i_part, - p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area->i_id ); + p_intf->p_sys->p_input->stream.p_selected_area->i_part, + p_intf->p_sys->p_input->stream.p_selected_area->i_id ); } row++; @@ -347,17 +346,22 @@ Redraw ( intf_thread_t *p_intf, time_t *t_last_refresh ) static void FullScreen( intf_thread_t *p_intf ) { - vlc_mutex_lock( &p_intf->p_vlc->p_vout_bank->pp_vout[0]->change_lock ); + vout_thread_t *p_vout; - p_intf->p_vlc->p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE; + p_vout = vlc_object_find( p_intf->p_sys->p_input, + VLC_OBJECT_VOUT, FIND_CHILD ); + if( p_vout == NULL ) + { + return; + } - vlc_mutex_unlock( &p_intf->p_vlc->p_vout_bank->pp_vout[0]->change_lock ); + p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; + vlc_object_release( p_vout ); } static void Eject ( intf_thread_t *p_intf ) { - char *psz_device = NULL; - char *psz_parser; + char *psz_device = NULL, *psz_parser, *psz_name; /* * Get the active input @@ -365,15 +369,30 @@ static void Eject ( intf_thread_t *p_intf ) * If it's neither a VCD nor a DVD, then return */ - /* - * Don't really know if I must lock the stuff here, we're using it read-only - */ + playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + + if( p_playlist == NULL ) + { + return; + } + + vlc_mutex_lock( &p_playlist->object_lock ); - if( p_intf->p_vlc->p_playlist->current.psz_name != NULL) + if( p_playlist->i_index < 0 ) + { + vlc_mutex_unlock( &p_playlist->object_lock ); + vlc_object_release( p_playlist ); + return; + } + + psz_name = p_playlist->pp_items[ p_playlist->i_index ]->psz_name; + + if( psz_name ) { - if( !strncmp(p_intf->p_vlc->p_playlist->current.psz_name, "dvd:", 4) ) + if( !strncmp(psz_name, "dvd:", 4) ) { - switch( p_intf->p_vlc->p_playlist->current.psz_name[4] ) + switch( psz_name[4] ) { case '\0': case '@': @@ -381,13 +400,13 @@ static void Eject ( intf_thread_t *p_intf ) break; default: /* Omit the first 4 characters */ - psz_device = strdup( p_intf->p_vlc->p_playlist->current.psz_name + 4 ); + psz_device = strdup( psz_name + 4 ); break; } } - else if( !strncmp(p_intf->p_vlc->p_playlist->current.psz_name, "vcd:", 4) ) + else if( !strncmp(psz_name, "vcd:", 4) ) { - switch( p_intf->p_vlc->p_playlist->current.psz_name[4] ) + switch( psz_name[4] ) { case '\0': case '@': @@ -395,16 +414,19 @@ static void Eject ( intf_thread_t *p_intf ) break; default: /* Omit the first 4 characters */ - psz_device = strdup( p_intf->p_vlc->p_playlist->current.psz_name + 4 ); + psz_device = strdup( psz_name + 4 ); break; } } else { - psz_device = strdup( p_intf->p_vlc->p_playlist->current.psz_name ); + psz_device = strdup( psz_name ); } } + vlc_mutex_unlock( &p_playlist->object_lock ); + vlc_object_release( p_playlist ); + if( psz_device == NULL ) { return; @@ -422,7 +444,7 @@ static void Eject ( intf_thread_t *p_intf ) } /* If there's a stream playing, we aren't allowed to eject ! */ - if( p_intf->p_vlc->p_input_bank->pp_input[0] == NULL ) + if( p_intf->p_sys->p_input == NULL ) { //X msg_Dbg( p_input, "ejecting %s", psz_device ); @@ -435,72 +457,51 @@ static void Eject ( intf_thread_t *p_intf ) static void Play ( intf_thread_t *p_intf ) { - if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL ) + playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + if( p_playlist ) { - input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_PLAY ); - p_intf->p_vlc->p_playlist->b_stopped = 0; - } - else - { - vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock ); + vlc_mutex_lock( &p_playlist->object_lock ); - if( p_intf->p_vlc->p_playlist->b_stopped ) + if( p_playlist->i_size ) { - if( p_intf->p_vlc->p_playlist->i_size ) - { - vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock ); - intf_PlaylistJumpto( p_intf->p_vlc->p_playlist, - p_intf->p_vlc->p_playlist->i_index ); - } - else - { - vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock ); - } + vlc_mutex_unlock( &p_playlist->object_lock ); + playlist_Play( p_playlist ); + vlc_object_release( p_playlist ); } else { - - vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock ); + vlc_mutex_unlock( &p_playlist->object_lock ); + vlc_object_release( p_playlist ); } - } } static void Pause ( intf_thread_t *p_intf ) { - if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL ) + if( p_intf->p_sys->p_input == NULL ) { - if ( p_intf->p_vlc->p_input_bank->pp_input[0]->i_status & INPUT_STATUS_PLAY ) - { - input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_PAUSE ); - - vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock ); - p_intf->p_vlc->p_playlist->b_stopped = 0; - vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock ); - } - else - { - Play ( p_intf ); - } + return; } + + input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE ); + + return; } static void Stop ( intf_thread_t *p_intf ) { - if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL ) + playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + if( p_playlist == NULL ) { - /* end playing item */ - p_intf->p_vlc->p_input_bank->pp_input[0]->b_eof = 1; - - /* update playlist */ - vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock ); - - p_intf->p_vlc->p_playlist->i_index--; - p_intf->p_vlc->p_playlist->b_stopped = 1; + return; + } - vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock ); + playlist_Stop( p_playlist ); + vlc_object_release( p_playlist ); - } + return; } static void Next ( intf_thread_t *p_intf ) @@ -508,31 +509,31 @@ static void Next ( intf_thread_t *p_intf ) int i_id; input_area_t * p_area; - i_id = p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area->i_id+1; + i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id+1; - if ( i_id < p_intf->p_vlc->p_input_bank->pp_input[0]->stream.i_area_nb ) + if ( i_id < p_intf->p_sys->p_input->stream.i_area_nb ) { - p_area = p_intf->p_vlc->p_input_bank->pp_input[0]->stream.pp_areas[i_id]; + p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id]; - input_ChangeArea( p_intf->p_vlc->p_input_bank->pp_input[0], + input_ChangeArea( p_intf->p_sys->p_input, (input_area_t *) p_area ); - input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_PLAY ); + input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); } } static void ManageSlider ( intf_thread_t *p_intf ) { - if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL ) + if( p_intf->p_sys->p_input != NULL ) { - vlc_mutex_lock( &p_intf->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock ); + vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); - if( p_intf->p_vlc->p_input_bank->pp_input[0]->stream.b_seekable && - p_intf->p_vlc->p_input_bank->pp_input[0]->i_status & INPUT_STATUS_PLAY ) + if( p_intf->p_sys->p_input->stream.b_seekable && + p_intf->p_sys->p_input->stream.control.i_status == PLAYING_S ) { float newvalue = p_intf->p_sys->f_slider_state; -#define p_area p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area +#define p_area p_intf->p_sys->p_input->stream.p_selected_area /* If the user hasn't touched the slider since the last time, * then the input can safely change it */ @@ -550,9 +551,9 @@ static void ManageSlider ( intf_thread_t *p_intf ) off_t i_seek = ( newvalue * p_area->i_size ) / 100; /* release the lock to be able to seek */ - vlc_mutex_unlock( &p_intf->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock ); - input_Seek( p_intf->p_vlc->p_input_bank->pp_input[0]->p_this, i_seek, INPUT_SEEK_SET ); - vlc_mutex_lock( &p_intf->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock ); + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); + input_Seek( p_intf, i_seek, INPUT_SEEK_SET ); + vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); /* Update the old value */ p_intf->p_sys->f_slider_state_old = newvalue; @@ -560,7 +561,7 @@ static void ManageSlider ( intf_thread_t *p_intf ) # undef p_area } - vlc_mutex_unlock( &p_intf->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock ); + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); } } @@ -569,15 +570,15 @@ static void PrevTitle ( intf_thread_t *p_intf ) input_area_t * p_area; int i_id; - i_id = p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area->i_id - 1; + i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id - 1; /* Disallow area 0 since it is used for video_ts.vob */ if ( i_id > 0 ) { - p_area = p_intf->p_vlc->p_input_bank->pp_input[0]->stream.pp_areas[i_id]; - input_ChangeArea( p_intf->p_vlc->p_input_bank->pp_input[0], (input_area_t*)p_area ); + p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id]; + input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); - input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_PLAY ); + input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); } } @@ -586,14 +587,14 @@ static void NextTitle ( intf_thread_t *p_intf ) input_area_t * p_area; int i_id; - i_id = p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area->i_id + 1; + i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id + 1; - if ( i_id < p_intf->p_vlc->p_input_bank->pp_input[0]->stream.i_area_nb ) + if ( i_id < p_intf->p_sys->p_input->stream.i_area_nb ) { - p_area = p_intf->p_vlc->p_input_bank->pp_input[0]->stream.pp_areas[i_id]; - input_ChangeArea( p_intf->p_vlc->p_input_bank->pp_input[0], (input_area_t*)p_area ); + p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id]; + input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); - input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_PLAY ); + input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); } } @@ -601,14 +602,14 @@ static void PrevChapter ( intf_thread_t *p_intf ) { input_area_t * p_area; - p_area = p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area; + p_area = p_intf->p_sys->p_input->stream.p_selected_area; if ( p_area->i_part > 0 ) { p_area->i_part--; - input_ChangeArea( p_intf->p_vlc->p_input_bank->pp_input[0], (input_area_t*)p_area ); + input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); - input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_PLAY ); + input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); } } @@ -616,14 +617,14 @@ static void NextChapter( intf_thread_t *p_intf ) { input_area_t * p_area; - p_area = p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area; + p_area = p_intf->p_sys->p_input->stream.p_selected_area; if ( p_area->i_part < p_area->i_part_nb ) { p_area->i_part++; - input_ChangeArea( p_intf->p_vlc->p_input_bank->pp_input[0], (input_area_t*)p_area ); + input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); - input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_PLAY ); + input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); } } diff --git a/plugins/text/rc.c b/plugins/text/rc.c index e0ae2896fa..0828a9fbf6 100644 --- a/plugins/text/rc.c +++ b/plugins/text/rc.c @@ -2,7 +2,7 @@ * rc.c : remote control stdin/stdout plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: rc.c,v 1.23 2002/07/21 18:57:02 sigmunau Exp $ + * $Id: rc.c,v 1.24 2002/07/31 20:56:52 sam Exp $ * * Authors: Peter Surda * @@ -48,58 +48,30 @@ #include /* select() */ #endif -/***************************************************************************** - * intf_sys_t: description and status of rc interface - *****************************************************************************/ -struct intf_sys_t -{ - input_thread_t * p_input; -}; - #define MAX_LINE_LENGTH 256 /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void intf_getfunctions ( function_list_t * p_function_list ); -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); +static int Activate ( vlc_object_t * ); +static void Run ( intf_thread_t *p_intf ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("remote control interface module") ) - ADD_CAPABILITY( INTF, 20 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - intf_getfunctions( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("remote control interface module") ); + set_capability( "interface", 20 ); + set_callbacks( Activate, NULL ); +vlc_module_end(); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Activate: initialize and create stuff *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ) +static int Activate( vlc_object_t *p_this ) { - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} + intf_thread_t *p_intf = (intf_thread_t*)p_this; -/***************************************************************************** - * intf_Open: initialize and create stuff - *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ #ifdef HAVE_ISATTY /* Check that stdin is a TTY */ if( !isatty( 0 ) ) @@ -112,13 +84,7 @@ static int intf_Open( intf_thread_t *p_intf ) /* Non-buffered stdout */ setvbuf( stdout, (char *)NULL, _IOLBF, 0 ); - /* Allocate instance and initialize some members */ - p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) ); - if( p_intf->p_sys == NULL ) - { - msg_Err( p_intf, "out of memory" ); - return 1; - } + p_intf->pf_run = Run; #ifdef WIN32 AllocConsole(); @@ -133,22 +99,15 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy interface stuff - *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) -{ - /* Destroy structure */ - free( p_intf->p_sys ); -} - -/***************************************************************************** - * intf_Run: rc thread + * Run: rc thread ***************************************************************************** * This part of the interface is in a separate thread so that we can call * exec() from within it without annoying the rest of the program. *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { + input_thread_t * p_input; + char p_buffer[ MAX_LINE_LENGTH + 1 ]; vlc_bool_t b_complete = 0; input_info_category_t * p_category; @@ -166,7 +125,7 @@ static void intf_Run( intf_thread_t *p_intf ) memset(psz_dashes, '-', 80); psz_dashes[80] = '\0'; - p_intf->p_sys->p_input = NULL; + p_input = NULL; while( !p_intf->b_die ) { @@ -202,21 +161,19 @@ static void intf_Run( intf_thread_t *p_intf ) } /* Manage the input part */ - if( p_intf->p_sys->p_input == NULL ) + if( p_input == NULL ) { - p_intf->p_sys->p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, - FIND_ANYWHERE ); + p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, + FIND_ANYWHERE ); } - else if( p_intf->p_sys->p_input->b_dead ) + else if( p_input->b_dead ) { - vlc_object_release( p_intf->p_sys->p_input ); - p_intf->p_sys->p_input = NULL; + vlc_object_release( p_input ); + p_input = NULL; } - if( p_intf->p_sys->p_input ) + if( p_input ) { - input_thread_t *p_input = p_intf->p_sys->p_input; - /* Get position */ vlc_mutex_lock( &p_input->stream.stream_lock ); if( !p_input->b_die && p_input->stream.i_mux_rate ) @@ -266,19 +223,18 @@ static void intf_Run( intf_thread_t *p_intf ) case 'p': case 'P': - if( p_intf->p_sys->p_input ) + if( p_input ) { - input_SetStatus( p_intf->p_sys->p_input, - INPUT_STATUS_PAUSE ); + input_SetStatus( p_input, INPUT_STATUS_PAUSE ); } break; case 'f': case 'F': - if( p_intf->p_sys->p_input ) + if( p_input ) { vout_thread_t *p_vout; - p_vout = vlc_object_find( p_intf->p_sys->p_input, + p_vout = vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD ); if( p_vout ) @@ -301,7 +257,7 @@ static void intf_Run( intf_thread_t *p_intf ) case 'r': case 'R': - if( p_intf->p_sys->p_input ) + if( p_input ) { for( i_dummy = 1; i_dummy < MAX_LINE_LENGTH && p_cmd[ i_dummy ] >= '0' @@ -312,8 +268,7 @@ static void intf_Run( intf_thread_t *p_intf ) } p_cmd[ i_dummy ] = 0; - input_Seek( p_intf->p_sys->p_input, - (off_t)atoi( p_cmd + 1 ), + input_Seek( p_input, (off_t)atoi( p_cmd + 1 ), INPUT_SEEK_SECONDS | INPUT_SEEK_SET ); /* rcreseek(f_cpos); */ } @@ -334,8 +289,8 @@ static void intf_Run( intf_thread_t *p_intf ) case 'i': case 'I': printf( "Dumping stream info\n" ); - vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); - p_category = p_intf->p_sys->p_input->stream.p_info; + vlc_mutex_lock( &p_input->stream.stream_lock ); + p_category = p_input->stream.p_info; while ( p_category ) { psz_dashes[72 - strlen(p_category->psz_name) ] = '\0'; @@ -353,7 +308,10 @@ static void intf_Run( intf_thread_t *p_intf ) } psz_dashes[78] = '\0'; printf( "+%s+\n", psz_dashes ); - vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); + vlc_mutex_unlock( &p_input->stream.stream_lock ); + break; + case '\0': + /* Ignore empty lines */ break; default: printf( "unknown command `%s'\n", p_cmd ); @@ -364,11 +322,10 @@ static void intf_Run( intf_thread_t *p_intf ) msleep( INTF_IDLE_SLEEP ); } - if( p_intf->p_sys->p_input ) + if( p_input ) { - vlc_object_release( p_intf->p_sys->p_input ); - p_intf->p_sys->p_input = NULL; + vlc_object_release( p_input ); + p_input = NULL; } - } diff --git a/plugins/vcd/Makefile b/plugins/vcd/Makefile index 3510de2050..a98da4814a 100644 --- a/plugins/vcd/Makefile +++ b/plugins/vcd/Makefile @@ -1 +1 @@ -vcd_SOURCES = vcd.c input_vcd.c cdrom_tools.c +vcd_SOURCES = vcd.c cdrom_tools.c diff --git a/plugins/vcd/input_vcd.c b/plugins/vcd/input_vcd.c deleted file mode 100644 index c263b7148b..0000000000 --- a/plugins/vcd/input_vcd.c +++ /dev/null @@ -1,411 +0,0 @@ -/**************************************************************************** - * input_vcd.c: VideoCD raw reading plugin. - ***************************************************************************** - * Copyright (C) 1998-2001 VideoLAN - * - * Author: Johan Bilien - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include -#include - -#include -#include - -#ifdef HAVE_UNISTD_H -# include -#endif - -#include -#include -#include -#include -#include - -#if defined( WIN32 ) -# include /* read() */ -#else -# include /* struct iovec */ -#endif - -#if defined( WIN32 ) -# include "input_iovec.h" -#endif - -#include "input_vcd.h" -#include "cdrom_tools.h" - -/* how many blocks VCDRead will read in each loop */ -#define VCD_BLOCKS_ONCE 20 -#define VCD_DATA_ONCE (VCD_BLOCKS_ONCE * VCD_DATA_SIZE) - -/***************************************************************************** - * Local prototypes - *****************************************************************************/ -/* called from outside */ - -static int VCDOpen ( input_thread_t *); -static void VCDClose ( input_thread_t *); -static int VCDRead ( input_thread_t *, byte_t *, size_t ); -static void VCDSeek ( input_thread_t *, off_t ); -static int VCDSetArea ( input_thread_t *, input_area_t * ); -static int VCDSetProgram ( input_thread_t *, pgrm_descriptor_t * ); - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( access_getfunctions )( function_list_t * p_function_list ) -{ -#define access p_function_list->functions.access - access.pf_open = VCDOpen; - access.pf_close = VCDClose; - access.pf_read = VCDRead; - access.pf_set_area = VCDSetArea; - access.pf_set_program = VCDSetProgram; - access.pf_seek = VCDSeek; -#undef access -} - -/* - * Data reading functions - */ - -/***************************************************************************** - * VCDOpen: open vcd - *****************************************************************************/ -static int VCDOpen( input_thread_t *p_input ) -{ - char * psz_orig; - char * psz_parser; - char * psz_source; - char * psz_next; - struct stat stat_info; - thread_vcd_data_t * p_vcd; - int i; - input_area_t * p_area; - int i_title = 1; - int i_chapter = 1; - - - - /* parse the options passed in command line : */ - psz_orig = psz_parser = psz_source = strdup( p_input->psz_name ); - - if( !psz_orig ) - { - return( -1 ); - } - - while( *psz_parser && *psz_parser != '@' ) - { - psz_parser++; - } - - if( *psz_parser == '@' ) - { - /* Found options */ - *psz_parser = '\0'; - ++psz_parser; - - i_title = (int)strtol( psz_parser, &psz_next, 10 ); - if( *psz_next ) - { - psz_parser = psz_next + 1; - i_chapter = (int)strtol( psz_parser, &psz_next, 10 ); - } - - i_title = i_title ? i_title : 1; - i_chapter = i_chapter ? i_chapter : 1; - } - - if( !*psz_source ) - { - if( !p_input->psz_access ) - { - free( psz_orig ); - return -1; - } - psz_source = config_GetPsz( p_input, "vcd" ); - } - - /* test the type of file given */ - - if( stat( psz_source, &stat_info ) == -1 ) - { - msg_Err( p_input, "cannot stat() source `%s' (%s)", - psz_source, strerror(errno)); - return( -1 ); - } - - if( !S_ISBLK(stat_info.st_mode) && !S_ISCHR(stat_info.st_mode)) - { - msg_Warn( p_input, "vcd module discarded (not a valid drive)" ); - return -1; - } - - - p_vcd = malloc( sizeof(thread_vcd_data_t) ); - - if( p_vcd == NULL ) - { - msg_Err( p_input, "out of memory" ); - return -1; - } - - p_input->p_access_data = (void *)p_vcd; - - p_input->i_mtu = VCD_DATA_ONCE; - - vlc_mutex_lock( &p_input->stream.stream_lock ); - - p_input->stream.b_pace_control = 1; - - p_input->stream.b_seekable = 1; - p_input->stream.p_selected_area->i_size = 0; - p_input->stream.p_selected_area->i_tell = 0; - - vlc_mutex_unlock( &p_input->stream.stream_lock ); - - p_vcd->i_handle = open( psz_source, O_RDONLY | O_NONBLOCK ); - - if( p_vcd->i_handle == -1 ) - { - msg_Err( p_input, "could not open %s\n", psz_source ); - free (p_vcd); - return -1; - } - - /* We read the Table Of Content information */ - p_vcd->nb_tracks = ioctl_GetTrackCount( p_vcd->i_handle, - psz_source ); - if( p_vcd->nb_tracks < 0 ) - { - msg_Err( p_input, "unable to count tracks" ); - close( p_vcd->i_handle ); - free( p_vcd ); - return -1; - } - else if( p_vcd->nb_tracks <= 1 ) - { - msg_Err( p_input, "no movie tracks found" ); - close( p_vcd->i_handle ); - free( p_vcd ); - return -1; - } - - p_vcd->p_sectors = ioctl_GetSectors( p_vcd->i_handle, - psz_source ); - if( p_vcd->p_sectors == NULL ) - { - input_BuffersEnd( p_input, p_input->p_method_data ); - close( p_vcd->i_handle ); - free( p_vcd ); - return -1; - } - - /* Set stream and area data */ - vlc_mutex_lock( &p_input->stream.stream_lock ); - - /* Initialize ES structures */ - input_InitStream( p_input, sizeof( stream_ps_data_t ) ); - - /* disc input method */ - p_input->stream.i_method = INPUT_METHOD_VCD; - -#define area p_input->stream.pp_areas - for( i = 1 ; i <= p_vcd->nb_tracks - 1 ; i++ ) - { - input_AddArea( p_input ); - - /* Titles are Program Chains */ - area[i]->i_id = i; - - /* Absolute start offset and size */ - area[i]->i_start = (off_t)p_vcd->p_sectors[i] * (off_t)VCD_DATA_SIZE; - area[i]->i_size = (off_t)(p_vcd->p_sectors[i+1] - p_vcd->p_sectors[i]) - * (off_t)VCD_DATA_SIZE; - - /* Number of chapters */ - area[i]->i_part_nb = 0; // will be the entry points - area[i]->i_part = 1; - - area[i]->i_plugin_data = p_vcd->p_sectors[i]; - } -#undef area - - p_area = p_input->stream.pp_areas[i_title]; - - VCDSetArea( p_input, p_area ); - - vlc_mutex_unlock( &p_input->stream.stream_lock ); - - p_input->psz_demux = "ps"; - - return 0; -} - -/***************************************************************************** - * VCDClose: closes vcd - *****************************************************************************/ -static void VCDClose( input_thread_t *p_input ) -{ - thread_vcd_data_t *p_vcd = (thread_vcd_data_t *)p_input->p_access_data; - - close( p_vcd->i_handle ); - free( p_vcd ); -} - -/***************************************************************************** - * VCDRead: reads from the VCD into PES packets. - ***************************************************************************** - * Returns -1 in case of error, 0 in case of EOF, otherwise the number of - * bytes. - *****************************************************************************/ -static int VCDRead( input_thread_t * p_input, byte_t * p_buffer, - size_t i_len ) -{ - thread_vcd_data_t * p_vcd; - int i_blocks; - int i_index; - int i_read; - byte_t p_last_sector[ VCD_DATA_SIZE ]; - - p_vcd = (thread_vcd_data_t *)p_input->p_access_data; - - i_read = 0; - - /* Compute the number of blocks we have to read */ - - i_blocks = i_len / VCD_DATA_SIZE; - - for ( i_index = 0 ; i_index < i_blocks ; i_index++ ) - { - if ( ioctl_ReadSector( p_vcd->i_handle, p_vcd->i_sector, - p_buffer + i_index * VCD_DATA_SIZE ) < 0 ) - { - msg_Err( p_input, "could not read sector %d", p_vcd->i_sector ); - return -1; - } - - p_vcd->i_sector ++; - if ( p_vcd->i_sector == p_vcd->p_sectors[p_vcd->i_track + 1] ) - { - input_area_t *p_area; - - if ( p_vcd->i_track >= p_vcd->nb_tracks - 1 ) - return 0; /* EOF */ - - p_area = p_input->stream.pp_areas[ - p_input->stream.p_selected_area->i_id + 1 ]; - - msg_Dbg( p_input, "new title" ); - - p_area->i_part = 1; - VCDSetArea( p_input, p_area ); - - } - i_read += VCD_DATA_SIZE; - } - - if ( i_len % VCD_DATA_SIZE ) /* this should not happen */ - { - if ( ioctl_ReadSector( p_vcd->i_handle, p_vcd->i_sector, - p_last_sector ) < 0 ) - { - msg_Err( p_input, "could not read sector %d", p_vcd->i_sector ); - return -1; - } - - p_input->p_vlc->pf_memcpy( p_buffer + i_blocks * VCD_DATA_SIZE, - p_last_sector, i_len % VCD_DATA_SIZE ); - i_read += i_len % VCD_DATA_SIZE; - } - - p_input->stream.p_selected_area->i_tell = - (off_t)p_vcd->i_sector * (off_t)VCD_DATA_SIZE - - p_input->stream.p_selected_area->i_start; - - return i_read; -} - - -/***************************************************************************** - * VCDSetProgram: Does nothing since a VCD is mono_program - *****************************************************************************/ -static int VCDSetProgram( input_thread_t * p_input, - pgrm_descriptor_t * p_program) -{ - return 0; -} - - -/***************************************************************************** - * VCDSetArea: initialize input data for title x, chapter y. - * It should be called for each user navigation request. - ****************************************************************************/ -static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area ) -{ - thread_vcd_data_t * p_vcd; - - p_vcd = (thread_vcd_data_t*)p_input->p_access_data; - - /* we can't use the interface slider until initilization is complete */ - p_input->stream.b_seekable = 0; - - if( p_area != p_input->stream.p_selected_area ) - { - /* Reset the Chapter position of the current title */ - p_input->stream.p_selected_area->i_part = 1; - p_input->stream.p_selected_area->i_tell = 0; - - /* Change the default area */ - p_input->stream.p_selected_area = p_area; - - /* Change the current track */ - /* The first track is not a valid one */ - p_vcd->i_track = p_area->i_id; - p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track]; - } - - /* warn interface that something has changed */ - p_input->stream.b_seekable = 1; - p_input->stream.b_changed = 1; - - return 0; -} - - -/**************************************************************************** - * VCDSeek - ****************************************************************************/ -static void VCDSeek( input_thread_t * p_input, off_t i_off ) -{ - thread_vcd_data_t * p_vcd; - - p_vcd = (thread_vcd_data_t *) p_input->p_access_data; - - p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track] - + i_off / (off_t)VCD_DATA_SIZE; - - p_input->stream.p_selected_area->i_tell = - (off_t)p_vcd->i_sector * (off_t)VCD_DATA_SIZE - - p_input->stream.p_selected_area->i_start; -} diff --git a/plugins/vcd/vcd.c b/plugins/vcd/vcd.c index 7b1e369a3a..d160379acc 100644 --- a/plugins/vcd/vcd.c +++ b/plugins/vcd/vcd.c @@ -2,9 +2,9 @@ * vcd.c : VCD input module for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: vcd.c,v 1.12 2002/06/01 12:32:00 sam Exp $ + * $Id: vcd.c,v 1.13 2002/07/31 20:56:52 sam Exp $ * - * Authors: Samuel Hocevar + * Author: Johan Bilien * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,32 +24,386 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include /* strdup() */ +#include +#include #include +#include + +#ifdef HAVE_UNISTD_H +# include +#endif + +#include +#include +#include +#include +#include + +#if defined( WIN32 ) +# include /* read() */ +#else +# include /* struct iovec */ +#endif + +#if defined( WIN32 ) +# include "input_iovec.h" +#endif + +#include "input_vcd.h" +#include "cdrom_tools.h" + +/* how many blocks VCDRead will read in each loop */ +#define VCD_BLOCKS_ONCE 20 +#define VCD_DATA_ONCE (VCD_BLOCKS_ONCE * VCD_DATA_SIZE) + +/***************************************************************************** + * Local prototypes + *****************************************************************************/ +static int VCDOpen ( vlc_object_t * ); +static void VCDClose ( vlc_object_t * ); +static int VCDRead ( input_thread_t *, byte_t *, size_t ); +static void VCDSeek ( input_thread_t *, off_t ); +static int VCDSetArea ( input_thread_t *, input_area_t * ); +static int VCDSetProgram ( input_thread_t *, pgrm_descriptor_t * ); + +/***************************************************************************** + * Module descriptior + *****************************************************************************/ +vlc_module_begin(); + set_description( _("VCD input module") ); + set_capability( "access", 80 ); + set_callbacks( VCDOpen, VCDClose ); + add_shortcut( "svcd" ); +vlc_module_end(); + +/* + * Data reading functions + */ + +/***************************************************************************** + * VCDOpen: open vcd + *****************************************************************************/ +static int VCDOpen( vlc_object_t *p_this ) +{ + input_thread_t * p_input = (input_thread_t *)p_this; + char * psz_orig; + char * psz_parser; + char * psz_source; + char * psz_next; + struct stat stat_info; + thread_vcd_data_t * p_vcd; + int i; + input_area_t * p_area; + int i_title = 1; + int i_chapter = 1; + + p_input->pf_read = VCDRead; + p_input->pf_seek = VCDSeek; + p_input->pf_set_area = VCDSetArea; + p_input->pf_set_program = VCDSetProgram; + + /* parse the options passed in command line : */ + psz_orig = psz_parser = psz_source = strdup( p_input->psz_name ); + + if( !psz_orig ) + { + return( -1 ); + } + + while( *psz_parser && *psz_parser != '@' ) + { + psz_parser++; + } + + if( *psz_parser == '@' ) + { + /* Found options */ + *psz_parser = '\0'; + ++psz_parser; + + i_title = (int)strtol( psz_parser, &psz_next, 10 ); + if( *psz_next ) + { + psz_parser = psz_next + 1; + i_chapter = (int)strtol( psz_parser, &psz_next, 10 ); + } + + i_title = i_title ? i_title : 1; + i_chapter = i_chapter ? i_chapter : 1; + } + + if( !*psz_source ) + { + if( !p_input->psz_access ) + { + free( psz_orig ); + return -1; + } + psz_source = config_GetPsz( p_input, "vcd" ); + } + + /* test the type of file given */ + + if( stat( psz_source, &stat_info ) == -1 ) + { + msg_Err( p_input, "cannot stat() source `%s' (%s)", + psz_source, strerror(errno)); + return( -1 ); + } + + if( !S_ISBLK(stat_info.st_mode) && !S_ISCHR(stat_info.st_mode)) + { + msg_Warn( p_input, "vcd module discarded (not a valid drive)" ); + return -1; + } + + + p_vcd = malloc( sizeof(thread_vcd_data_t) ); + + if( p_vcd == NULL ) + { + msg_Err( p_input, "out of memory" ); + return -1; + } + + p_input->p_access_data = (void *)p_vcd; + + p_input->i_mtu = VCD_DATA_ONCE; + + vlc_mutex_lock( &p_input->stream.stream_lock ); + + p_input->stream.b_pace_control = 1; + + p_input->stream.b_seekable = 1; + p_input->stream.p_selected_area->i_size = 0; + p_input->stream.p_selected_area->i_tell = 0; + + vlc_mutex_unlock( &p_input->stream.stream_lock ); + + p_vcd->i_handle = open( psz_source, O_RDONLY | O_NONBLOCK ); + + if( p_vcd->i_handle == -1 ) + { + msg_Err( p_input, "could not open %s\n", psz_source ); + free (p_vcd); + return -1; + } + + /* We read the Table Of Content information */ + p_vcd->nb_tracks = ioctl_GetTrackCount( p_vcd->i_handle, + psz_source ); + if( p_vcd->nb_tracks < 0 ) + { + msg_Err( p_input, "unable to count tracks" ); + close( p_vcd->i_handle ); + free( p_vcd ); + return -1; + } + else if( p_vcd->nb_tracks <= 1 ) + { + msg_Err( p_input, "no movie tracks found" ); + close( p_vcd->i_handle ); + free( p_vcd ); + return -1; + } + + p_vcd->p_sectors = ioctl_GetSectors( p_vcd->i_handle, + psz_source ); + if( p_vcd->p_sectors == NULL ) + { + input_BuffersEnd( p_input, p_input->p_method_data ); + close( p_vcd->i_handle ); + free( p_vcd ); + return -1; + } + + /* Set stream and area data */ + vlc_mutex_lock( &p_input->stream.stream_lock ); + + /* Initialize ES structures */ + input_InitStream( p_input, sizeof( stream_ps_data_t ) ); + + /* disc input method */ + p_input->stream.i_method = INPUT_METHOD_VCD; + +#define area p_input->stream.pp_areas + for( i = 1 ; i <= p_vcd->nb_tracks - 1 ; i++ ) + { + input_AddArea( p_input ); + + /* Titles are Program Chains */ + area[i]->i_id = i; + + /* Absolute start offset and size */ + area[i]->i_start = (off_t)p_vcd->p_sectors[i] * (off_t)VCD_DATA_SIZE; + area[i]->i_size = (off_t)(p_vcd->p_sectors[i+1] - p_vcd->p_sectors[i]) + * (off_t)VCD_DATA_SIZE; + + /* Number of chapters */ + area[i]->i_part_nb = 0; // will be the entry points + area[i]->i_part = 1; + + area[i]->i_plugin_data = p_vcd->p_sectors[i]; + } +#undef area + + p_area = p_input->stream.pp_areas[i_title]; + + VCDSetArea( p_input, p_area ); + + vlc_mutex_unlock( &p_input->stream.stream_lock ); + + p_input->psz_demux = "ps"; + + return 0; +} + +/***************************************************************************** + * VCDClose: closes vcd + *****************************************************************************/ +static void VCDClose( vlc_object_t *p_this ) +{ + input_thread_t * p_input = (input_thread_t *)p_this; + thread_vcd_data_t *p_vcd = (thread_vcd_data_t *)p_input->p_access_data; + + close( p_vcd->i_handle ); + free( p_vcd ); +} /***************************************************************************** - * Capabilities defined in the other files. + * VCDRead: reads from the VCD into PES packets. + ***************************************************************************** + * Returns -1 in case of error, 0 in case of EOF, otherwise the number of + * bytes. *****************************************************************************/ -void _M( access_getfunctions )( function_list_t * p_function_list ); +static int VCDRead( input_thread_t * p_input, byte_t * p_buffer, + size_t i_len ) +{ + thread_vcd_data_t * p_vcd; + int i_blocks; + int i_index; + int i_read; + byte_t p_last_sector[ VCD_DATA_SIZE ]; + + p_vcd = (thread_vcd_data_t *)p_input->p_access_data; + + i_read = 0; + + /* Compute the number of blocks we have to read */ + + i_blocks = i_len / VCD_DATA_SIZE; + + for ( i_index = 0 ; i_index < i_blocks ; i_index++ ) + { + if ( ioctl_ReadSector( p_vcd->i_handle, p_vcd->i_sector, + p_buffer + i_index * VCD_DATA_SIZE ) < 0 ) + { + msg_Err( p_input, "could not read sector %d", p_vcd->i_sector ); + return -1; + } + + p_vcd->i_sector ++; + if ( p_vcd->i_sector == p_vcd->p_sectors[p_vcd->i_track + 1] ) + { + input_area_t *p_area; + + if ( p_vcd->i_track >= p_vcd->nb_tracks - 1 ) + return 0; /* EOF */ + + p_area = p_input->stream.pp_areas[ + p_input->stream.p_selected_area->i_id + 1 ]; + + msg_Dbg( p_input, "new title" ); + + p_area->i_part = 1; + VCDSetArea( p_input, p_area ); + + } + i_read += VCD_DATA_SIZE; + } + + if ( i_len % VCD_DATA_SIZE ) /* this should not happen */ + { + if ( ioctl_ReadSector( p_vcd->i_handle, p_vcd->i_sector, + p_last_sector ) < 0 ) + { + msg_Err( p_input, "could not read sector %d", p_vcd->i_sector ); + return -1; + } + + p_input->p_vlc->pf_memcpy( p_buffer + i_blocks * VCD_DATA_SIZE, + p_last_sector, i_len % VCD_DATA_SIZE ); + i_read += i_len % VCD_DATA_SIZE; + } + + p_input->stream.p_selected_area->i_tell = + (off_t)p_vcd->i_sector * (off_t)VCD_DATA_SIZE + - p_input->stream.p_selected_area->i_start; + + return i_read; +} + /***************************************************************************** - * Build configuration tree. + * VCDSetProgram: Does nothing since a VCD is mono_program *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP +static int VCDSetProgram( input_thread_t * p_input, + pgrm_descriptor_t * p_program) +{ + return 0; +} + + +/***************************************************************************** + * VCDSetArea: initialize input data for title x, chapter y. + * It should be called for each user navigation request. + ****************************************************************************/ +static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area ) +{ + thread_vcd_data_t * p_vcd; + + p_vcd = (thread_vcd_data_t*)p_input->p_access_data; + + /* we can't use the interface slider until initilization is complete */ + p_input->stream.b_seekable = 0; + + if( p_area != p_input->stream.p_selected_area ) + { + /* Reset the Chapter position of the current title */ + p_input->stream.p_selected_area->i_part = 1; + p_input->stream.p_selected_area->i_tell = 0; + + /* Change the default area */ + p_input->stream.p_selected_area = p_area; + + /* Change the current track */ + /* The first track is not a valid one */ + p_vcd->i_track = p_area->i_id; + p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track]; + } + + /* warn interface that something has changed */ + p_input->stream.b_seekable = 1; + p_input->stream.b_changed = 1; + + return 0; +} + -MODULE_INIT_START - SET_DESCRIPTION( _("VCD input module") ) - ADD_CAPABILITY( ACCESS, 80 ) - ADD_SHORTCUT( "svcd" ) -MODULE_INIT_STOP +/**************************************************************************** + * VCDSeek + ****************************************************************************/ +static void VCDSeek( input_thread_t * p_input, off_t i_off ) +{ + thread_vcd_data_t * p_vcd; -MODULE_ACTIVATE_START - _M( access_getfunctions )( &p_module->p_functions->access ); -MODULE_ACTIVATE_STOP + p_vcd = (thread_vcd_data_t *) p_input->p_access_data; -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track] + + i_off / (off_t)VCD_DATA_SIZE; + p_input->stream.p_selected_area->i_tell = + (off_t)p_vcd->i_sector * (off_t)VCD_DATA_SIZE + - p_input->stream.p_selected_area->i_start; +} diff --git a/plugins/win32/intf_win32.cpp b/plugins/win32/intf_win32.cpp index 430e3f2e1b..7f3aa7b95b 100644 --- a/plugins/win32/intf_win32.cpp +++ b/plugins/win32/intf_win32.cpp @@ -40,28 +40,17 @@ intf_thread_t *p_intfGlobal; /***************************************************************************** * Local prototypes. *****************************************************************************/ -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); static void intf_Run ( intf_thread_t *p_intf ); int Win32Manage( void *p_data ); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Open: initialize interface *****************************************************************************/ -void _M( intf_getfunctions )( function_list_t * p_function_list ) +int E_(Open)( vlc_object_t *p_this ) { - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} + intf_thread_t *p_intf = (intf_thread_t *)p_this; -/***************************************************************************** - * intf_Open: initialize interface - *****************************************************************************/ -static int intf_Open( intf_thread_t *p_intf ) -{ /* Allocate instance and initialize some members */ p_intf->p_sys = (intf_sys_s *) malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) @@ -71,6 +60,7 @@ static int intf_Open( intf_thread_t *p_intf ) }; p_intfGlobal = p_intf; + p_intf->pf_run = intf_Run; p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); @@ -86,10 +76,12 @@ static int intf_Open( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Close: destroy interface + * Close: destroy interface *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) +void E_(Close)( vlc_object_t *p_this ) { + intf_thread_t *p_intf = (intf_thread_t *)p_this; + if( p_intf->p_sys->p_input ) { vlc_object_release( p_intf->p_sys->p_input ); diff --git a/plugins/win32/waveout.c b/plugins/win32/waveout.c index 76e8169b8c..a6345cdb5d 100644 --- a/plugins/win32/waveout.c +++ b/plugins/win32/waveout.c @@ -2,7 +2,7 @@ * waveout.c : Windows waveOut plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: waveout.c,v 1.10 2002/07/20 18:01:43 sam Exp $ + * $Id: waveout.c,v 1.11 2002/07/31 20:56:52 sam Exp $ * * Authors: Gildas Bazin * @@ -36,37 +36,26 @@ #include /***************************************************************************** - * Local prototypes. + * Local prototypes *****************************************************************************/ -static void aout_getfunctions( function_list_t * p_function_list ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); -static int aout_Open ( aout_thread_t *p_aout ); -static int aout_SetFormat ( aout_thread_t *p_aout ); -static int aout_GetBufInfo ( aout_thread_t *p_aout, int i_buffer_info ); -static void aout_Play ( aout_thread_t *p_aout, - byte_t *buffer, int i_size ); -static void aout_Close ( aout_thread_t *p_aout ); +static int SetFormat ( aout_thread_t * ); +static int GetBufInfo ( aout_thread_t *, int ); +static void Play ( aout_thread_t *, byte_t *, int ); /* local functions */ static int OpenWaveOutDevice( aout_thread_t *p_aout ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ -MODULE_CONFIG_START -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Win32 waveOut extension module") ) - ADD_CAPABILITY( AOUT, 250 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - aout_getfunctions( &p_module->p_functions->aout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + set_description( _("Win32 waveOut extension module") ); + set_capability( "audio output", 250 ); + set_callbacks( Open, Close ); +vlc_module_end(); /***************************************************************************** * aout_sys_t: waveOut audio output method descriptor @@ -91,25 +80,13 @@ struct aout_sys_t }; /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -static void aout_getfunctions( function_list_t * p_function_list ) -{ - p_function_list->functions.aout.pf_open = aout_Open; - p_function_list->functions.aout.pf_setformat = aout_SetFormat; - p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo; - p_function_list->functions.aout.pf_play = aout_Play; - p_function_list->functions.aout.pf_close = aout_Close; -} - -/***************************************************************************** - * aout_Open: open the audio device + * Open: open the audio device ***************************************************************************** * This function opens and setups Win32 waveOut *****************************************************************************/ -static int aout_Open( aout_thread_t *p_aout ) -{ +static int Open( vlc_object_t *p_this ) +{ + aout_thread_t *p_aout = (aout_thread_t *)p_this; int i; /* Allocate structure */ @@ -121,6 +98,9 @@ static int aout_Open( aout_thread_t *p_aout ) return( 1 ); } + p_aout->pf_setformat = SetFormat; + p_aout->pf_getbufinfo = GetBufInfo; + p_aout->pf_play = Play; /* Initialize some variables */ p_aout->p_sys->i_current_buffer = 0; @@ -132,15 +112,15 @@ static int aout_Open( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_SetFormat: reset the audio device and sets its format + * SetFormat: reset the audio device and sets its format ***************************************************************************** * This functions set a new audio format. * For this we need to close the current device and create another * one with the desired format. *****************************************************************************/ -static int aout_SetFormat( aout_thread_t *p_aout ) +static int SetFormat( aout_thread_t *p_aout ) { - msg_Dbg( p_aout, "aout_SetFormat" ); + msg_Dbg( p_aout, "SetFormat" ); /* Check if the format has changed */ @@ -162,12 +142,12 @@ static int aout_SetFormat( aout_thread_t *p_aout ) } /***************************************************************************** - * aout_GetBufInfo: buffer status query + * GetBufInfo: buffer status query ***************************************************************************** * returns the number of bytes in the audio buffer that have not yet been * sent to the sound device. *****************************************************************************/ -static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) +static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) { MMTIME mmtime; @@ -181,7 +161,7 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) #if 0 - msg_Dbg( p_aout, "aout_GetBufInfo: %i", + msg_Dbg( p_aout, "GetBufInfo: %i", p_aout->p_sys->dw_counter - mmtime.u.cb ); #endif @@ -189,11 +169,11 @@ static int aout_GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) } /***************************************************************************** - * aout_Play: play a sound buffer + * Play: play a sound buffer ***************************************************************************** * This function writes a buffer of i_length bytes *****************************************************************************/ -static void aout_Play( aout_thread_t *p_aout, byte_t *p_buffer, int i_size ) +static void Play( aout_thread_t *p_aout, byte_t *p_buffer, int i_size ) { MMRESULT result; int current_buffer = p_aout->p_sys->i_current_buffer; @@ -243,10 +223,11 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *p_buffer, int i_size ) } /***************************************************************************** - * aout_Close: close the audio device + * Close: close the audio device *****************************************************************************/ -static void aout_Close( aout_thread_t *p_aout ) -{ +static void Close( vlc_object_t *p_this ) +{ + aout_thread_t *p_aout = (aout_thread_t *)p_this; int i; /* Before calling waveOutClose we must reset the device */ diff --git a/plugins/win32/win32.cpp b/plugins/win32/win32.cpp index 26eb1b9a3d..e3480b3c84 100644 --- a/plugins/win32/win32.cpp +++ b/plugins/win32/win32.cpp @@ -31,12 +31,13 @@ #include "win32.h" /* Borland specific */ /***************************************************************************** - * Capabilities defined in the other files. + * External prototypes *****************************************************************************/ -void _M( intf_getfunctions ) ( function_list_t * p_function_list ); +int E_(Open) ( vlc_object_t * ); +void E_(Close) ( vlc_object_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define MAX_LINES_TEXT N_("maximum number of lines in the log window") @@ -44,22 +45,13 @@ void _M( intf_getfunctions ) ( function_list_t * p_function_list ); "You can set the maximum number of lines that the log window will display."\ " Enter -1 if you want to keep all messages." ) -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) - ADD_INTEGER( "intfwin-max-lines", 500, NULL, MAX_LINES_TEXT, MAX_LINES_LONGTEXT ) -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("Win32 interface module") ) - ADD_CAPABILITY( INTF, 100 ) - ADD_SHORTCUT( "win" ) - ADD_SHORTCUT( "win32" ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( intf_getfunctions )( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_integer( "intfwin-max-lines", 500, NULL, MAX_LINES_TEXT, MAX_LINES_LONGTEXT ); + set_description( _("Win32 interface module") ); + set_capability( "interface", 100 ); + set_callbacks( E_(Open), E_(Close) ); + add_shortcut( "win" ); + add_shortcut( "win32" ); +vlc_module_end(); diff --git a/plugins/win32/win32.h b/plugins/win32/win32.h index 47f5e29233..3724dbd7bd 100644 --- a/plugins/win32/win32.h +++ b/plugins/win32/win32.h @@ -24,8 +24,4 @@ * Exported interface functions. *****************************************************************************/ extern "C" __declspec(dllexport) - int __VLC_SYMBOL( InitModule ) ( module_t *p_module ); -extern "C" __declspec(dllexport) - int __VLC_SYMBOL( ActivateModule ) ( module_t *p_module ); -extern "C" __declspec(dllexport) - int __VLC_SYMBOL( DeactivateModule ) ( module_t *p_module ); + int __VLC_SYMBOL( vlc_entry ) ( module_t *p_module ); diff --git a/plugins/x11/x11.c b/plugins/x11/x11.c index 764a05da3a..91cf6a58ac 100644 --- a/plugins/x11/x11.c +++ b/plugins/x11/x11.c @@ -2,7 +2,7 @@ * x11.c : X11 plugin for vlc ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: x11.c,v 1.20 2002/07/02 19:14:59 sam Exp $ + * $Id: x11.c,v 1.21 2002/07/31 20:56:52 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -31,12 +31,15 @@ #include -#include "xcommon.h" - /***************************************************************************** - * Building configuration tree + * Exported prototypes *****************************************************************************/ +extern int E_(Activate) ( vlc_object_t * ); +extern void E_(Deactivate) ( vlc_object_t * ); +/***************************************************************************** + * Module descriptor + *****************************************************************************/ #define ALT_FS_TEXT N_("alternate fullscreen method") #define ALT_FS_LONGTEXT N_( \ "There are two ways to make a fullscreen window, unfortunately each one " \ @@ -60,25 +63,16 @@ #define SHM_LONGTEXT N_( \ "Use shared memory to communicate between vlc and the X server.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING ( "x11-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ) -ADD_BOOL ( "x11-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT ) -ADD_INTEGER ( "x11-drawable", -1, NULL, DRAWABLE_TEXT, DRAWABLE_LONGTEXT ) +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string( "x11-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ); + add_bool( "x11-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT ); + add_integer( "x11-drawable", -1, NULL, DRAWABLE_TEXT, DRAWABLE_LONGTEXT ); #ifdef HAVE_SYS_SHM_H -ADD_BOOL ( "x11-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT ) + add_bool( "x11-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT ); #endif -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("X11 module") ) - ADD_CAPABILITY( VOUT, 50 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( vout_getfunctions )( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + set_description( _("X11 module") ); + set_capability( "video output", 50 ); + set_callbacks( E_(Activate), E_(Deactivate) ); +vlc_module_end(); diff --git a/plugins/x11/xcommon.c b/plugins/x11/xcommon.c index fee4365574..caeeaf9f37 100644 --- a/plugins/x11/xcommon.c +++ b/plugins/x11/xcommon.c @@ -2,7 +2,7 @@ * xcommon.c: Functions common to the X11 and XVideo plugins ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: xcommon.c,v 1.45 2002/07/23 00:39:17 sam Exp $ + * $Id: xcommon.c,v 1.46 2002/07/31 20:56:52 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -65,39 +65,20 @@ # include #endif -#include "xcommon.h" - #include "netutils.h" /* network_ChannelJoin */ -/***************************************************************************** - * Defines - *****************************************************************************/ -#ifdef MODULE_NAME_IS_xvideo -# define IMAGE_TYPE XvImage -# define EXTRA_ARGS int i_xvport, int i_chroma -# define EXTRA_ARGS_SHM int i_xvport, int i_chroma, XShmSegmentInfo *p_shm -# define DATA_SIZE(p) (p)->data_size -# define IMAGE_FREE XFree /* There is nothing like XvDestroyImage */ -#else -# define IMAGE_TYPE XImage -# define EXTRA_ARGS Visual *p_visual, int i_depth, int i_bytes_per_pixel -# define EXTRA_ARGS_SHM Visual *p_visual, int i_depth, XShmSegmentInfo *p_shm -# define DATA_SIZE(p) ((p)->bytes_per_line * (p)->height) -# define IMAGE_FREE XDestroyImage -#endif - -VLC_DECLARE_STRUCT(x11_window_t) +#include "xcommon.h" /***************************************************************************** * Local prototypes *****************************************************************************/ -static int vout_Create ( vout_thread_t * ); -static void vout_Destroy ( vout_thread_t * ); -static void vout_Render ( vout_thread_t *, picture_t * ); -static void vout_Display ( vout_thread_t *, picture_t * ); -static int vout_Manage ( vout_thread_t * ); -static int vout_Init ( vout_thread_t * ); -static void vout_End ( vout_thread_t * ); +int E_(Activate) ( vlc_object_t * ); +void E_(Deactivate) ( vlc_object_t * ); + +static int InitVideo ( vout_thread_t * ); +static void EndVideo ( vout_thread_t * ); +static void DisplayVideo ( vout_thread_t *, picture_t * ); +static int ManageVideo ( vout_thread_t * ); static int InitDisplay ( vout_thread_t * ); @@ -133,141 +114,15 @@ static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * ); #endif /***************************************************************************** - * x11_window_t: X11 window descriptor - ***************************************************************************** - * This structure contains all the data necessary to describe an X11 window. - *****************************************************************************/ -struct x11_window_t -{ - Window base_window; /* base window */ - Window video_window; /* sub-window for displaying video */ - GC gc; /* graphic context instance handler */ - int i_width; /* width of main window */ - int i_height; /* height of main window */ - Atom wm_protocols; - Atom wm_delete_window; -}; - -/***************************************************************************** - * vout_sys_t: video output method descriptor - ***************************************************************************** - * This structure is part of the video output thread descriptor. - * It describes the X11 and XVideo specific properties of an output thread. - *****************************************************************************/ -struct vout_sys_t -{ - /* Internal settings and properties */ - Display * p_display; /* display pointer */ - - Visual * p_visual; /* visual pointer */ - int i_screen; /* screen number */ - - /* Our current window */ - x11_window_t * p_win; - - /* Our two windows */ - x11_window_t original_window; - x11_window_t fullscreen_window; - - /* X11 generic properties */ - vlc_bool_t b_altfullscreen; /* which fullscreen method */ - vlc_bool_t b_createwindow; /* are we the base window's owner ? */ -#ifdef HAVE_SYS_SHM_H - vlc_bool_t b_shm; /* shared memory extension flag */ -#endif - -#ifdef MODULE_NAME_IS_xvideo - int i_xvport; -#else - Colormap colormap; /* colormap used (8bpp only) */ - - int i_screen_depth; - int i_bytes_per_pixel; - int i_bytes_per_line; -#endif - - /* Screen saver properties */ - int i_ss_timeout; /* timeout */ - int i_ss_interval; /* interval between changes */ - int i_ss_blanking; /* blanking mode */ - int i_ss_exposure; /* exposure mode */ -#ifdef DPMSINFO_IN_DPMS_H - BOOL b_ss_dpms; /* DPMS mode */ -#endif - - /* Mouse pointer properties */ - vlc_bool_t b_mouse_pointer_visible; - mtime_t i_time_mouse_last_moved; /* used to auto-hide pointer*/ - Cursor blank_cursor; /* the hidden cursor */ - mtime_t i_time_button_last_pressed; /* to track dbl-clicks */ - Pixmap cursor_pixmap; -}; - -/***************************************************************************** - * picture_sys_t: direct buffer method descriptor - ***************************************************************************** - * This structure is part of the picture descriptor, it describes the - * XVideo specific properties of a direct buffer. - *****************************************************************************/ -struct picture_sys_t -{ - IMAGE_TYPE * p_image; - -#ifdef HAVE_SYS_SHM_H - XShmSegmentInfo shminfo; /* shared memory zone information */ -#endif -}; - -/***************************************************************************** - * mwmhints_t: window manager hints - ***************************************************************************** - * Fullscreen needs to be able to hide the wm decorations so we provide - * this structure to make it easier. - *****************************************************************************/ -#define MWM_HINTS_DECORATIONS (1L << 1) -#define PROP_MWM_HINTS_ELEMENTS 5 -typedef struct mwmhints_t -{ - u32 flags; - u32 functions; - u32 decorations; - s32 input_mode; - u32 status; -} mwmhints_t; - -/***************************************************************************** - * Chroma defines - *****************************************************************************/ -#ifdef MODULE_NAME_IS_xvideo -# define MAX_DIRECTBUFFERS 10 -#else -# define MAX_DIRECTBUFFERS 2 -#endif - -/***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. - *****************************************************************************/ -void _M( vout_getfunctions )( function_list_t * p_function_list ) -{ - p_function_list->functions.vout.pf_create = vout_Create; - p_function_list->functions.vout.pf_init = vout_Init; - p_function_list->functions.vout.pf_end = vout_End; - p_function_list->functions.vout.pf_destroy = vout_Destroy; - p_function_list->functions.vout.pf_manage = vout_Manage; - p_function_list->functions.vout.pf_render = vout_Render; - p_function_list->functions.vout.pf_display = vout_Display; -} - -/***************************************************************************** - * vout_Create: allocate X11 video thread output method + * Activate: allocate X11 video thread output method ***************************************************************************** * This function allocate and initialize a X11 vout method. It uses some of the * vout properties to choose the window size, and change them according to the * actual properties of the display. *****************************************************************************/ -static int vout_Create( vout_thread_t *p_vout ) +int E_(Activate) ( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; char * psz_display; #ifdef MODULE_NAME_IS_xvideo char * psz_chroma; @@ -275,6 +130,12 @@ static int vout_Create( vout_thread_t *p_vout ) vlc_bool_t b_chroma = 0; #endif + p_vout->pf_init = InitVideo; + p_vout->pf_end = EndVideo; + p_vout->pf_manage = ManageVideo; + p_vout->pf_render = NULL; + p_vout->pf_display = DisplayVideo; + /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) @@ -409,12 +270,14 @@ static int vout_Create( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Destroy: destroy X11 video thread output method + * Deactivate: destroy X11 video thread output method ***************************************************************************** - * Terminate an output method created by vout_CreateOutputMethod + * Terminate an output method created by Open *****************************************************************************/ -static void vout_Destroy( vout_thread_t *p_vout ) +void E_(Deactivate) ( vlc_object_t *p_this ) { + vout_thread_t *p_vout = (vout_thread_t *)p_this; + /* If the fullscreen window is still open, close it */ if( p_vout->b_fullscreen ) { @@ -448,12 +311,12 @@ static void vout_Destroy( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_Init: initialize X11 video thread output method + * InitVideo: initialize X11 video thread output method ***************************************************************************** * This function create the XImages needed by the output thread. It is called * at the beginning of the thread, but also each time the window is resized. *****************************************************************************/ -static int vout_Init( vout_thread_t *p_vout ) +static int InitVideo( vout_thread_t *p_vout ) { int i_index; picture_t *p_pic; @@ -545,21 +408,13 @@ static int vout_Init( vout_thread_t *p_vout ) return( 0 ); } -/***************************************************************************** - * vout_Render: render previously calculated output - *****************************************************************************/ -static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - ; -} - /***************************************************************************** - * vout_Display: displays previously rendered output + * DisplayVideo: displays previously rendered output ***************************************************************************** * This function sends the currently rendered image to X11 server. * (The Xv extension takes care of "double-buffering".) *****************************************************************************/ -static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) +static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic ) { int i_width, i_height, i_x, i_y; @@ -613,13 +468,13 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) } /***************************************************************************** - * vout_Manage: handle X11 events + * ManageVideo: handle X11 events ***************************************************************************** * This function should be called regularly by video output thread. It manages * X11 events and allows window resizing. It returns a non null value on * error. *****************************************************************************/ -static int vout_Manage( vout_thread_t *p_vout ) +static int ManageVideo( vout_thread_t *p_vout ) { XEvent xevent; /* X11 event */ char i_key; /* ISO Latin-1 key */ @@ -937,12 +792,12 @@ static int vout_Manage( vout_thread_t *p_vout ) } /***************************************************************************** - * vout_End: terminate X11 video thread output method + * EndVideo: terminate X11 video thread output method ***************************************************************************** - * Destroy the X11 XImages created by vout_Init. It is called at the end of + * Destroy the X11 XImages created by Init. It is called at the end of * the thread, but also each time the window is resized. *****************************************************************************/ -static void vout_End( vout_thread_t *p_vout ) +static void EndVideo( vout_thread_t *p_vout ) { int i_index; @@ -1141,7 +996,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win ) XSelectInput( p_vout->p_sys->p_display, p_win->video_window, ExposureMask ); - /* make sure the video window will be centered in the next vout_Manage() */ + /* make sure the video window will be centered in the next ManageVideo() */ p_vout->i_changes |= VOUT_SIZE_CHANGE; /* If the cursor was formerly blank than blank it again */ diff --git a/plugins/x11/xcommon.h b/plugins/x11/xcommon.h index 5cddc0d1a0..7a43393c18 100644 --- a/plugins/x11/xcommon.h +++ b/plugins/x11/xcommon.h @@ -1,13 +1,13 @@ /***************************************************************************** - * xcommon.h: Common X11 and Xvideo video output display method + * xcommon.h: Defines common to the X11 and XVideo plugins ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: xcommon.h,v 1.3 2002/03/17 13:53:21 gbazin Exp $ + * $Id: xcommon.h,v 1.4 2002/07/31 20:56:52 sam Exp $ * - * Authors: Shane Harper - * Vincent Seguin + * Authors: Vincent Seguin * Samuel Hocevar * David Kennedy + * Gildas Bazin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,7 +25,133 @@ *****************************************************************************/ /***************************************************************************** - * Common prototypes + * Defines *****************************************************************************/ -void _M( vout_getfunctions )( function_list_t * p_function_list ); +#ifdef MODULE_NAME_IS_xvideo +# define IMAGE_TYPE XvImage +# define EXTRA_ARGS int i_xvport, int i_chroma +# define EXTRA_ARGS_SHM int i_xvport, int i_chroma, XShmSegmentInfo *p_shm +# define DATA_SIZE(p) (p)->data_size +# define IMAGE_FREE XFree /* There is nothing like XvDestroyImage */ +#else +# define IMAGE_TYPE XImage +# define EXTRA_ARGS Visual *p_visual, int i_depth, int i_bytes_per_pixel +# define EXTRA_ARGS_SHM Visual *p_visual, int i_depth, XShmSegmentInfo *p_shm +# define DATA_SIZE(p) ((p)->bytes_per_line * (p)->height) +# define IMAGE_FREE XDestroyImage +#endif + +VLC_DECLARE_STRUCT(x11_window_t) + +/***************************************************************************** + * x11_window_t: X11 window descriptor + ***************************************************************************** + * This structure contains all the data necessary to describe an X11 window. + *****************************************************************************/ +struct x11_window_t +{ + Window base_window; /* base window */ + Window video_window; /* sub-window for displaying video */ + GC gc; /* graphic context instance handler */ + int i_width; /* width of main window */ + int i_height; /* height of main window */ + Atom wm_protocols; + Atom wm_delete_window; +}; + +/***************************************************************************** + * vout_sys_t: video output method descriptor + ***************************************************************************** + * This structure is part of the video output thread descriptor. + * It describes the X11 and XVideo specific properties of an output thread. + *****************************************************************************/ +struct vout_sys_t +{ + /* Internal settings and properties */ + Display * p_display; /* display pointer */ + + Visual * p_visual; /* visual pointer */ + int i_screen; /* screen number */ + + /* Our current window */ + x11_window_t * p_win; + + /* Our two windows */ + x11_window_t original_window; + x11_window_t fullscreen_window; + + /* X11 generic properties */ + vlc_bool_t b_altfullscreen; /* which fullscreen method */ + vlc_bool_t b_createwindow; /* are we the base window's owner ? */ +#ifdef HAVE_SYS_SHM_H + vlc_bool_t b_shm; /* shared memory extension flag */ +#endif + +#ifdef MODULE_NAME_IS_xvideo + int i_xvport; +#else + Colormap colormap; /* colormap used (8bpp only) */ + + int i_screen_depth; + int i_bytes_per_pixel; + int i_bytes_per_line; +#endif + + /* Screen saver properties */ + int i_ss_timeout; /* timeout */ + int i_ss_interval; /* interval between changes */ + int i_ss_blanking; /* blanking mode */ + int i_ss_exposure; /* exposure mode */ +#ifdef DPMSINFO_IN_DPMS_H + BOOL b_ss_dpms; /* DPMS mode */ +#endif + + /* Mouse pointer properties */ + vlc_bool_t b_mouse_pointer_visible; + mtime_t i_time_mouse_last_moved; /* used to auto-hide pointer*/ + Cursor blank_cursor; /* the hidden cursor */ + mtime_t i_time_button_last_pressed; /* to track dbl-clicks */ + Pixmap cursor_pixmap; +}; + +/***************************************************************************** + * picture_sys_t: direct buffer method descriptor + ***************************************************************************** + * This structure is part of the picture descriptor, it describes the + * XVideo specific properties of a direct buffer. + *****************************************************************************/ +struct picture_sys_t +{ + IMAGE_TYPE * p_image; + +#ifdef HAVE_SYS_SHM_H + XShmSegmentInfo shminfo; /* shared memory zone information */ +#endif +}; + +/***************************************************************************** + * mwmhints_t: window manager hints + ***************************************************************************** + * Fullscreen needs to be able to hide the wm decorations so we provide + * this structure to make it easier. + *****************************************************************************/ +#define MWM_HINTS_DECORATIONS (1L << 1) +#define PROP_MWM_HINTS_ELEMENTS 5 +typedef struct mwmhints_t +{ + u32 flags; + u32 functions; + u32 decorations; + s32 input_mode; + u32 status; +} mwmhints_t; + +/***************************************************************************** + * Chroma defines + *****************************************************************************/ +#ifdef MODULE_NAME_IS_xvideo +# define MAX_DIRECTBUFFERS 10 +#else +# define MAX_DIRECTBUFFERS 2 +#endif diff --git a/plugins/x11/xvideo.c b/plugins/x11/xvideo.c index 089ecc2a5e..e893a401d3 100644 --- a/plugins/x11/xvideo.c +++ b/plugins/x11/xvideo.c @@ -2,7 +2,7 @@ * xvideo.c : Xvideo plugin for vlc ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: xvideo.c,v 1.16 2002/07/02 19:14:59 sam Exp $ + * $Id: xvideo.c,v 1.17 2002/07/31 20:56:52 sam Exp $ * * Authors: Shane Harper * Vincent Seguin @@ -32,10 +32,14 @@ #include -#include "xcommon.h" +/***************************************************************************** + * Exported prototypes + *****************************************************************************/ +extern int E_(Activate) ( vlc_object_t * ); +extern void E_(Deactivate) ( vlc_object_t * ); /***************************************************************************** - * Building configuration tree + * Module descriptor *****************************************************************************/ #define ADAPTOR_TEXT N_("XVideo adaptor number") #define ADAPTOR_LONGTEXT N_( \ @@ -70,29 +74,20 @@ #define SHM_LONGTEXT N_( \ "Use shared memory to communicate between vlc and the X server.") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_STRING ( "xvideo-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ) -ADD_INTEGER ( "xvideo-adaptor", -1, NULL, ADAPTOR_TEXT, ADAPTOR_LONGTEXT ) -ADD_BOOL ( "xvideo-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT ) -ADD_STRING ( "xvideo-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT ) -ADD_INTEGER ( "xvideo-drawable", -1, NULL, DRAWABLE_TEXT, DRAWABLE_LONGTEXT ) +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_string( "xvideo-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ); + add_integer( "xvideo-adaptor", -1, NULL, ADAPTOR_TEXT, ADAPTOR_LONGTEXT ); + add_bool( "xvideo-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT ); + add_string( "xvideo-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT ); + add_integer( "xvideo-drawable", -1, NULL, DRAWABLE_TEXT, DRAWABLE_LONGTEXT ); #ifdef HAVE_SYS_SHM_H -ADD_BOOL ( "xvideo-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT ) + add_bool( "xvideo-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT ); #endif -MODULE_CONFIG_STOP - -MODULE_INIT_START - SET_DESCRIPTION( _("XVideo extension module") ) - ADD_CAPABILITY( VOUT, 150 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - _M( vout_getfunctions )( &p_module->p_functions->vout ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + set_description( _("XVideo extension module") ); + set_capability( "video output", 150 ); + set_callbacks( E_(Activate), E_(Deactivate) ); +vlc_module_end(); /* following functions are local */ diff --git a/plugins/xosd/xosd.c b/plugins/xosd/xosd.c index ee8242fac9..5ac18817e1 100644 --- a/plugins/xosd/xosd.c +++ b/plugins/xosd/xosd.c @@ -2,7 +2,7 @@ * xosd.c : X On Screen Display interface ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: xosd.c,v 1.4 2002/07/20 18:01:43 sam Exp $ + * $Id: xosd.c,v 1.5 2002/07/31 20:56:52 sam Exp $ * * Authors: Loïc Minier * @@ -50,13 +50,13 @@ struct intf_sys_t /***************************************************************************** * Local prototypes. *****************************************************************************/ -static void intf_getfunctions ( function_list_t * p_function_list ); -static int intf_Open ( intf_thread_t *p_intf ); -static void intf_Close ( intf_thread_t *p_intf ); -static void intf_Run ( intf_thread_t *p_intf ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); + +static void Run ( intf_thread_t * ); /***************************************************************************** - * Build configuration tree. + * Module descriptor *****************************************************************************/ #define POSITION_TEXT N_("flip vertical position") #define POSITION_LONGTEXT N_("Display xosd output on the bottom of the " \ @@ -71,43 +71,26 @@ static void intf_Run ( intf_thread_t *p_intf ); #define FONT_TEXT N_("font") #define FONT_LONGTEXT N_("Font used to display text in the xosd output") -MODULE_CONFIG_START -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_BOOL( "xosd-position", 1, NULL, POSITION_TEXT, POSITION_LONGTEXT ) -ADD_INTEGER( "xosd-text-offset", 0, NULL, TXT_OFS_TEXT, TXT_OFS_LONGTEXT ) -ADD_INTEGER( "xosd-shadow-offset", 1, NULL, SHD_OFS_TEXT, SHD_OFS_LONGTEXT ) -ADD_STRING( "xosd-font", "-misc-fixed-medium-r-*-*-*-300-*-*-*-*-*-*", NULL, FONT_TEXT, FONT_LONGTEXT ) -MODULE_CONFIG_STOP -// -misc-fixed-medium-r-normal-*-*-160-*-*-c-*-iso8859-15 - -MODULE_INIT_START - SET_DESCRIPTION( _("xosd interface module") ) - ADD_CAPABILITY( INTF, 40 ) -MODULE_INIT_STOP - -MODULE_ACTIVATE_START - intf_getfunctions( &p_module->p_functions->intf ); -MODULE_ACTIVATE_STOP - -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP +vlc_module_begin(); + add_category_hint( N_("Miscellaneous"), NULL ); + add_bool( "xosd-position", 1, NULL, POSITION_TEXT, POSITION_LONGTEXT ); + add_integer( "xosd-text-offset", 0, NULL, TXT_OFS_TEXT, TXT_OFS_LONGTEXT ); + add_integer( "xosd-shadow-offset", 1, NULL, + SHD_OFS_TEXT, SHD_OFS_LONGTEXT ); + add_string( "xosd-font", "-misc-fixed-medium-r-*-*-*-300-*-*-*-*-*-*", + NULL, FONT_TEXT, FONT_LONGTEXT ); + set_description( _("xosd interface module") ); + set_capability( "interface", 40 ); + set_callbacks( Open, Close ); +vlc_module_end(); /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Open: initialize and create stuff *****************************************************************************/ -static void intf_getfunctions( function_list_t * p_function_list ) +static int Open( vlc_object_t *p_this ) { - p_function_list->functions.intf.pf_open = intf_Open; - p_function_list->functions.intf.pf_close = intf_Close; - p_function_list->functions.intf.pf_run = intf_Run; -} + intf_thread_t *p_intf = (intf_thread_t *)p_this; -/***************************************************************************** - * intf_Open: initialize and create stuff - *****************************************************************************/ -static int intf_Open( intf_thread_t * p_intf ) -{ /* Allocate instance and initialize some members */ p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) @@ -127,14 +110,19 @@ static int intf_Open( intf_thread_t * p_intf ) 0, XOSD_string, "xosd interface initialized" ); + + p_intf->pf_run = Run; + return( 0 ); } /***************************************************************************** - * intf_Close: destroy interface stuff + * Close: destroy interface stuff *****************************************************************************/ -static void intf_Close( intf_thread_t *p_intf ) -{ +static void Close( vlc_object_t *p_this ) +{ + intf_thread_t *p_intf = (intf_thread_t *)p_this; + if( p_intf->p_sys->psz_source ) free( p_intf->p_sys->psz_source ); /* Uninitialize library */ @@ -145,11 +133,11 @@ static void intf_Close( intf_thread_t *p_intf ) } /***************************************************************************** - * intf_Run: xosd thread + * Run: xosd thread ***************************************************************************** * This part of the interface runs in a separate thread *****************************************************************************/ -static void intf_Run( intf_thread_t *p_intf ) +static void Run( intf_thread_t *p_intf ) { p_intf->p_sys->p_input = NULL; diff --git a/src/audio_output/audio_output.c b/src/audio_output/audio_output.c index 9da3637ccf..f7ddbabd5e 100644 --- a/src/audio_output/audio_output.c +++ b/src/audio_output/audio_output.c @@ -2,7 +2,7 @@ * audio_output.c : audio output thread ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: audio_output.c,v 1.86 2002/06/08 14:08:46 sam Exp $ + * $Id: audio_output.c,v 1.87 2002/07/31 20:56:52 sam Exp $ * * Authors: Michel Kaempf * Cyril Deguet @@ -88,8 +88,7 @@ aout_thread_t *aout_CreateThread( vlc_object_t *p_parent, /* Choose the best module */ psz_name = config_GetPsz( p_aout, "aout" ); - p_aout->p_module = module_Need( p_aout, MODULE_CAPABILITY_AOUT, - psz_name, (void *)p_aout ); + p_aout->p_module = module_Need( p_aout, "audio output", psz_name ); if( psz_name ) free( psz_name ); if( p_aout->p_module == NULL ) { @@ -98,21 +97,12 @@ aout_thread_t *aout_CreateThread( vlc_object_t *p_parent, return NULL; } -#define aout_functions p_aout->p_module->p_functions->aout.functions.aout - p_aout->pf_open = aout_functions.pf_open; - p_aout->pf_setformat = aout_functions.pf_setformat; - p_aout->pf_getbufinfo = aout_functions.pf_getbufinfo; - p_aout->pf_play = aout_functions.pf_play; - p_aout->pf_close = aout_functions.pf_close; -#undef aout_functions - /* * Initialize audio device */ if ( p_aout->pf_setformat( p_aout ) ) { - p_aout->pf_close( p_aout ); - module_Unneed( p_aout->p_module ); + module_Unneed( p_aout, p_aout->p_module ); vlc_object_destroy( p_aout ); return NULL; } @@ -126,8 +116,7 @@ aout_thread_t *aout_CreateThread( vlc_object_t *p_parent, * this thread is only called in main and all calls are blocking */ if( aout_SpawnThread( p_aout ) ) { - p_aout->pf_close( p_aout ); - module_Unneed( p_aout->p_module ); + module_Unneed( p_aout, p_aout->p_module ); vlc_object_destroy( p_aout ); return NULL; } @@ -263,11 +252,8 @@ void aout_DestroyThread( aout_thread_t * p_aout ) } vlc_mutex_destroy( &p_aout->fifos_lock ); - /* Free the plugin */ - p_aout->pf_close( p_aout ); - /* Release the aout module */ - module_Unneed( p_aout->p_module ); + module_Unneed( p_aout, p_aout->p_module ); /* Free structure */ vlc_object_destroy( p_aout ); diff --git a/src/input/input.c b/src/input/input.c index c59cf46937..a75faf3ed8 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -4,7 +4,7 @@ * decoders. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: input.c,v 1.208 2002/07/25 21:53:53 sigmunau Exp $ + * $Id: input.c,v 1.209 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * @@ -87,20 +87,10 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, p_input->psz_source = strdup( p_item->psz_name ); /* Demux */ - p_input->p_demux_module = NULL; - p_input->pf_init = NULL; - p_input->pf_end = NULL; - p_input->pf_demux = NULL; - p_input->pf_rewind = NULL; + p_input->p_demux = NULL; /* Access */ - p_input->p_access_module = NULL; - p_input->pf_open = NULL; - p_input->pf_close = NULL; - p_input->pf_read = NULL; - p_input->pf_seek = NULL; - p_input->pf_set_area = NULL; - p_input->pf_set_program = NULL; + p_input->p_access = NULL; p_input->i_bufsize = 0; p_input->i_mtu = 0; @@ -146,7 +136,6 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, p_input->stream.control.i_rate = DEFAULT_RATE; p_input->stream.control.b_mute = 0; p_input->stream.control.b_grayscale = config_GetInt( p_input, "grayscale" ); - p_input->stream.control.i_smp = config_GetInt( p_input, "vdec-smp" ); /* Initialize input info */ p_input->stream.p_info = malloc( sizeof( input_info_category_t ) ); @@ -249,7 +238,7 @@ static int RunThread( input_thread_t *p_input ) input_AccessReinit( p_input ); p_input->pf_set_program( p_input, - p_input->stream.p_new_program ); + p_input->stream.p_new_program ); /* Escape all decoders for the stream discontinuity they * will encounter. */ @@ -293,7 +282,8 @@ static int RunThread( input_thread_t *p_input ) if( p_input->stream.p_selected_area->i_seek != NO_SEEK ) { - if( p_input->stream.b_seekable && p_input->pf_seek != NULL ) + if( p_input->stream.b_seekable + && p_input->pf_seek != NULL ) { off_t i_new_pos; @@ -355,7 +345,7 @@ static int RunThread( input_thread_t *p_input ) if( i_count == 0 && p_input->stream.b_seekable ) { /* End of file - we do not set b_die because only the - * interface is allowed to do so. */ + * playlist is allowed to do so. */ msg_Info( p_input, "EOF reached" ); p_input->b_eof = 1; } @@ -463,26 +453,16 @@ static int InitThread( input_thread_t * p_input ) } /* Find and open appropriate access module */ - p_input->p_access_module = - module_Need( p_input, MODULE_CAPABILITY_ACCESS, - p_input->psz_access, (void *)p_input ); + p_input->p_access = module_Need( p_input, "access", + p_input->psz_access ); - if( p_input->p_access_module == NULL ) + if( p_input->p_access == NULL ) { msg_Err( p_input, "no suitable access module for `%s/%s://%s'", p_input->psz_access, p_input->psz_demux, p_input->psz_name ); return -1; } -#define f p_input->p_access_module->p_functions->access.functions.access - p_input->pf_open = f.pf_open; - p_input->pf_close = f.pf_close; - p_input->pf_read = f.pf_read; - p_input->pf_set_area = f.pf_set_area; - p_input->pf_set_program = f.pf_set_program; - p_input->pf_seek = f.pf_seek; -#undef f - /* Waiting for stream. */ if( p_input->i_mtu ) { @@ -499,32 +479,24 @@ static int InitThread( input_thread_t * p_input ) { if( p_input->b_die || p_input->b_error || p_input->b_eof ) { - module_Unneed( p_input->p_access_module ); + module_Unneed( p_input, p_input->p_access ); return -1; } } } /* Find and open appropriate demux module */ - p_input->p_demux_module = - module_Need( p_input, MODULE_CAPABILITY_DEMUX, - p_input->psz_demux, (void *)p_input ); + p_input->p_demux = module_Need( p_input, "demux", + p_input->psz_demux ); - if( p_input->p_demux_module == NULL ) + if( p_input->p_demux== NULL ) { msg_Err( p_input, "no suitable demux module for `%s/%s://%s'", p_input->psz_access, p_input->psz_demux, p_input->psz_name ); - module_Unneed( p_input->p_access_module ); + module_Unneed( p_input, p_input->p_access ); return -1; } -#define f p_input->p_demux_module->p_functions->demux.functions.demux - p_input->pf_init = f.pf_init; - p_input->pf_end = f.pf_end; - p_input->pf_demux = f.pf_demux; - p_input->pf_rewind = f.pf_rewind; -#undef f - return 0; } @@ -568,12 +540,10 @@ static void EndThread( input_thread_t * p_input ) input_EndStream( p_input ); /* Free demultiplexer's data */ - p_input->pf_end( p_input ); - module_Unneed( p_input->p_demux_module ); + module_Unneed( p_input, p_input->p_demux ); /* Close the access plug-in */ - p_input->pf_close( p_input ); - module_Unneed( p_input->p_access_module ); + module_Unneed( p_input, p_input->p_access ); input_AccessEnd( p_input ); diff --git a/src/input/input_dec.c b/src/input/input_dec.c index 8b601dc1cb..f2a628de82 100644 --- a/src/input/input_dec.c +++ b/src/input/input_dec.c @@ -2,7 +2,7 @@ * input_dec.c: Functions for the management of decoders ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: input_dec.c,v 1.40 2002/07/23 00:39:17 sam Exp $ + * $Id: input_dec.c,v 1.41 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * @@ -45,43 +45,43 @@ static void DeleteDecoderFifo( decoder_fifo_t * ); decoder_fifo_t * input_RunDecoder( input_thread_t * p_input, es_descriptor_t * p_es ) { - char * psz_plugin = config_GetPsz( p_input, "codec" ); + char * psz_plugin; + decoder_fifo_t *p_fifo; - /* Get a suitable module */ - p_es->p_module = module_Need( p_input, MODULE_CAPABILITY_DECODER, - psz_plugin, (void *)&p_es->i_fourcc ); - if( psz_plugin ) free( psz_plugin ); - if( p_es->p_module == NULL ) + /* Create the decoder configuration structure */ + p_fifo = CreateDecoderFifo( p_input, p_es ); + + if( p_fifo == NULL ) { - msg_Err( p_input, "no suitable decoder module for fourcc `%4.4s'", - (char*)&p_es->i_fourcc ); + msg_Err( p_input, "could not create decoder fifo" ); return NULL; } - /* Create the decoder configuration structure */ - p_es->p_decoder_fifo = CreateDecoderFifo( p_input, p_es ); - - if( p_es->p_decoder_fifo == NULL ) + /* Get a suitable module */ + psz_plugin = config_GetPsz( p_fifo, "codec" ); + p_fifo->p_module = module_Need( p_fifo, "decoder", psz_plugin ); + if( psz_plugin ) free( psz_plugin ); + if( p_fifo->p_module == NULL ) { - msg_Err( p_input, "could not create decoder fifo" ); - module_Unneed( p_es->p_module ); + msg_Err( p_fifo, "no suitable decoder module for fourcc `%4.4s'", + (char*)&p_fifo->i_fourcc ); + DeleteDecoderFifo( p_fifo ); + vlc_object_destroy( p_fifo ); return NULL; } /* Spawn the decoder thread */ - if ( vlc_thread_create( p_es->p_decoder_fifo, "decoder", - p_es->p_module->p_functions->dec.functions.dec.pf_run, 0 ) ) + if( vlc_thread_create( p_fifo, "decoder", p_fifo->pf_run, 0 ) ) { - msg_Err( p_input, "cannot spawn decoder thread \"%s\"", - p_es->p_module->psz_object_name ); - DeleteDecoderFifo( p_es->p_decoder_fifo ); - module_Unneed( p_es->p_module ); + msg_Err( p_fifo, "cannot spawn decoder thread \"%s\"", + p_fifo->p_module->psz_object_name ); + module_Unneed( p_fifo, p_fifo->p_module ); return NULL; } p_input->stream.b_changed = 1; - return p_es->p_decoder_fifo; + return p_fifo; } @@ -117,7 +117,10 @@ void input_EndDecoder( input_thread_t * p_input, es_descriptor_t * p_es ) DeleteDecoderFifo( p_es->p_decoder_fifo ); /* Unneed module */ - module_Unneed( p_es->p_module ); + module_Unneed( p_es->p_decoder_fifo, p_es->p_decoder_fifo->p_module ); + + /* Delete the fifo */ + vlc_object_destroy( p_es->p_decoder_fifo ); /* Tell the input there is no more decoder */ p_es->p_decoder_fifo = NULL; @@ -257,7 +260,5 @@ static void DeleteDecoderFifo( decoder_fifo_t * p_fifo ) /* Destroy the lock and cond */ vlc_cond_destroy( &p_fifo->data_wait ); vlc_mutex_destroy( &p_fifo->data_lock ); - - vlc_object_destroy( p_fifo ); } diff --git a/src/input/input_ext-intf.c b/src/input/input_ext-intf.c index d820a4a68b..f88d802112 100644 --- a/src/input/input_ext-intf.c +++ b/src/input/input_ext-intf.c @@ -2,7 +2,7 @@ * input_ext-intf.c: services to the interface ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: input_ext-intf.c,v 1.39 2002/07/23 00:39:17 sam Exp $ + * $Id: input_ext-intf.c,v 1.40 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * @@ -414,17 +414,3 @@ int input_ToggleMute( input_thread_t * p_input ) return 0; } -/**************************************************************************** - * input_SetSMP: change the number of video decoder threads - ****************************************************************************/ -int input_SetSMP( input_thread_t * p_input, int i_smp ) -{ - /* No need to warn the input thread since only the decoders - * worry about it. */ - vlc_mutex_lock( &p_input->stream.control.control_lock ); - p_input->stream.control.i_smp = i_smp; - vlc_mutex_unlock( &p_input->stream.control.control_lock ); - - return 0; -} - diff --git a/src/input/input_ext-plugins.c b/src/input/input_ext-plugins.c index 930eb87495..7f74315f08 100644 --- a/src/input/input_ext-plugins.c +++ b/src/input/input_ext-plugins.c @@ -2,7 +2,7 @@ * input_ext-plugins.c: useful functions for access and demux plug-ins ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: input_ext-plugins.c,v 1.17 2002/07/24 23:11:55 massiot Exp $ + * $Id: input_ext-plugins.c,v 1.18 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * @@ -206,8 +206,6 @@ static inline data_buffer_t * NewBuffer( input_buffers_t * p_buffers, /* Safety check */ if( p_buffers->i_allocated > INPUT_MAX_ALLOCATION ) { -//X intf_Err( "INPUT_MAX_ALLOCATION reached (%d)", -//X p_buffers->i_allocated ); return NULL; } @@ -226,7 +224,6 @@ static inline data_buffer_t * NewBuffer( input_buffers_t * p_buffers, p_buf = malloc( sizeof(input_buffers_t) + i_size ); if( p_buf == NULL ) { -//X intf_ErrMsg( "Out of memory" ); return NULL; } p_buf->i_size = i_size; @@ -239,7 +236,6 @@ static inline data_buffer_t * NewBuffer( input_buffers_t * p_buffers, p_buf = malloc( sizeof(input_buffers_t) + i_size ); if( p_buf == NULL ) { -//X intf_ErrMsg( "Out of memory" ); return NULL; } p_buf->i_size = i_size; @@ -250,7 +246,7 @@ static inline data_buffer_t * NewBuffer( input_buffers_t * p_buffers, p_buf->p_next = NULL; p_buf->i_refcount = 0; - return( p_buf ); + return p_buf; } data_buffer_t * input_NewBuffer( input_buffers_t * p_buffers, size_t i_size ) @@ -318,7 +314,6 @@ static inline data_packet_t * ShareBuffer( input_buffers_t * p_buffers, p_data = malloc( sizeof(data_packet_t) ); if( p_data == NULL ) { -//X intf_ErrMsg( "Out of memory" ); return NULL; } } @@ -331,7 +326,7 @@ static inline data_packet_t * ShareBuffer( input_buffers_t * p_buffers, p_data->p_payload_end = p_data->p_demux_start + p_buf->i_size; p_buf->i_refcount++; - return( p_data ); + return p_data; } data_packet_t * input_ShareBuffer( input_buffers_t * p_buffers, @@ -352,9 +347,11 @@ data_packet_t * input_ShareBuffer( input_buffers_t * p_buffers, static inline data_packet_t * NewPacket( input_buffers_t * p_buffers, size_t i_size ) { - data_buffer_t * p_buf = NewBuffer( p_buffers, i_size ); + data_buffer_t * p_buf; data_packet_t * p_data; + p_buf = NewBuffer( p_buffers, i_size ); + if( p_buf == NULL ) { return( NULL ); @@ -434,7 +431,6 @@ static inline pes_packet_t * NewPES( input_buffers_t * p_buffers ) p_pes = malloc( sizeof(pes_packet_t) ); if( p_pes == NULL ) { -//X intf_ErrMsg( "Out of memory" ); return NULL; } } @@ -524,7 +520,8 @@ ssize_t input_FillBuffer( input_thread_t * p_input ) i_remains + p_input->i_bufsize ); if( p_buf == NULL ) { - return( -1 ); + msg_Err( p_input, "failed allocating a new buffer (decoder stuck?)" ); + return -1; } p_buf->i_refcount = 1; @@ -668,8 +665,9 @@ void input_AccessEnd( input_thread_t * p_input ) /***************************************************************************** * input_FDClose: close the target *****************************************************************************/ -void input_FDClose( input_thread_t * p_input ) +void __input_FDClose( vlc_object_t * p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data; msg_Info( p_input, "closing `%s/%s://%s'", @@ -682,8 +680,9 @@ void input_FDClose( input_thread_t * p_input ) /***************************************************************************** * input_FDNetworkClose: close a network target *****************************************************************************/ -void input_FDNetworkClose( input_thread_t * p_input ) +void __input_FDNetworkClose( vlc_object_t * p_this ) { + input_thread_t * p_input = (input_thread_t *)p_this; input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data; msg_Info( p_input, "closing network `%s/%s://%s'", diff --git a/src/input/input_programs.c b/src/input/input_programs.c index 4fe43cac46..5b90b07fff 100644 --- a/src/input/input_programs.c +++ b/src/input/input_programs.c @@ -2,7 +2,7 @@ * input_programs.c: es_descriptor_t, pgrm_descriptor_t management ***************************************************************************** * Copyright (C) 1999-2002 VideoLAN - * $Id: input_programs.c,v 1.93 2002/07/23 00:39:17 sam Exp $ + * $Id: input_programs.c,v 1.94 2002/07/31 20:56:52 sam Exp $ * * Authors: Christophe Massiot * @@ -651,8 +651,6 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) *****************************************************************************/ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) { - decoder_fifo_t *p_fifo; - if( p_es == NULL ) { msg_Err( p_input, "nothing to do in input_SelectES" ); @@ -670,16 +668,14 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) /* Release the lock, not to block the input thread during * the creation of the thread. */ vlc_mutex_unlock( &p_input->stream.stream_lock ); - p_fifo = input_RunDecoder( p_input, p_es ); + p_es->p_decoder_fifo = input_RunDecoder( p_input, p_es ); vlc_mutex_lock( &p_input->stream.stream_lock ); - if( p_fifo == NULL ) + if( p_es->p_decoder_fifo == NULL ) { return -1; } - p_es->p_decoder_fifo = p_fifo; - return 0; } diff --git a/src/interface/interface.c b/src/interface/interface.c index c71f87f620..67d3d6f702 100644 --- a/src/interface/interface.c +++ b/src/interface/interface.c @@ -4,7 +4,7 @@ * interface, such as command line. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: interface.c,v 1.96 2002/06/04 00:11:12 sam Exp $ + * $Id: interface.c,v 1.97 2002/07/31 20:56:52 sam Exp $ * * Authors: Vincent Seguin * @@ -70,8 +70,7 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this ) /* Choose the best module */ psz_name = config_GetPsz( p_intf, "intf" ); - p_intf->p_module = module_Need( p_intf, MODULE_CAPABILITY_INTF, - psz_name, (void *)p_intf ); + p_intf->p_module = module_Need( p_intf, "interface", psz_name ); if( psz_name ) free( psz_name ); if( p_intf->p_module == NULL ) @@ -81,12 +80,6 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this ) return NULL; } -#define f p_intf->p_module->p_functions->intf.functions.intf - p_intf->pf_open = f.pf_open; - p_intf->pf_close = f.pf_close; - p_intf->pf_run = f.pf_run; -#undef f - /* Initialize structure */ p_intf->b_menu = 0; p_intf->b_menu_change = 0; @@ -162,11 +155,8 @@ void intf_StopThread( intf_thread_t *p_intf ) *****************************************************************************/ void intf_Destroy( intf_thread_t *p_intf ) { - /* Destroy interface */ - p_intf->pf_close( p_intf ); - /* Unlock module */ - module_Unneed( p_intf->p_module ); + module_Unneed( p_intf, p_intf->p_module ); vlc_mutex_destroy( &p_intf->change_lock ); diff --git a/src/libvlc.c b/src/libvlc.c index c17491006a..e96c6855ad 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -1,10 +1,8 @@ /***************************************************************************** * libvlc.c: main libvlc source - * Includes the main() function for vlc. Parses command line, starts playlist - * and spawns threads. ***************************************************************************** - * Copyright (C) 1998-2001 VideoLAN - * $Id: libvlc.c,v 1.18 2002/07/21 18:57:02 sigmunau Exp $ + * Copyright (C) 1998-2002 VideoLAN + * $Id: libvlc.c,v 1.19 2002/07/31 20:56:52 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -102,7 +100,6 @@ static int GetFilenames ( vlc_t *, int, char *[] ); static void Usage ( vlc_t *, const char *psz_module_name ); static void ListModules ( vlc_t * ); static void Version ( void ); -static void Build ( void ); #ifndef WIN32 static void InitSignalHandler ( void ); @@ -204,7 +201,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) fprintf( stderr, COPYRIGHT_MESSAGE "\n" ); /* Guess what CPU we have */ - p_vlc->i_cpu_capabilities = CPUCapabilities( p_vlc ); + p_vlc->i_cpu = CPUCapabilities( p_vlc ); /* * Support for gettext @@ -275,13 +272,13 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) } p_help_module->psz_object_name = "help"; config_Duplicate( p_help_module, p_help_config ); - p_help_module->next = p_vlc->module_bank.first; - p_vlc->module_bank.first = p_help_module; + p_help_module->next = p_vlc->p_module_bank->first; + p_vlc->p_module_bank->first = p_help_module; /* End hack */ if( config_LoadCmdLine( p_vlc, &i_argc, ppsz_argv, VLC_TRUE ) ) { - p_vlc->module_bank.first = p_help_module->next; + p_vlc->p_module_bank->first = p_help_module->next; config_Free( p_help_module ); vlc_object_destroy( p_help_module ); module_EndBank( p_vlc ); @@ -297,7 +294,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) Usage( p_vlc, "help" ); Usage( p_vlc, "main" ); - p_vlc->module_bank.first = p_help_module->next; + p_vlc->p_module_bank->first = p_help_module->next; config_Free( p_help_module ); vlc_object_destroy( p_help_module ); module_EndBank( p_vlc ); @@ -309,19 +306,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) if( config_GetInt( p_vlc, "version" ) ) { Version(); - p_vlc->module_bank.first = p_help_module->next; - config_Free( p_help_module ); - vlc_object_destroy( p_help_module ); - module_EndBank( p_vlc ); - msg_Destroy( p_vlc ); - return VLC_EEXIT; - } - - /* Check for build option */ - if( config_GetInt( p_vlc, "build" ) ) - { - Build(); - p_vlc->module_bank.first = p_help_module->next; + p_vlc->p_module_bank->first = p_help_module->next; config_Free( p_help_module ); vlc_object_destroy( p_help_module ); module_EndBank( p_vlc ); @@ -330,7 +315,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) } /* Hack: remove the help module here */ - p_vlc->module_bank.first = p_help_module->next; + p_vlc->p_module_bank->first = p_help_module->next; /* End hack */ /* @@ -342,11 +327,11 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) module_LoadBuiltins( p_vlc ); module_LoadPlugins( p_vlc ); msg_Dbg( p_vlc, "module bank initialized, found %i modules", - p_vlc->module_bank.i_count ); + p_vlc->p_module_bank->i_count ); /* Hack: insert the help module here */ - p_help_module->next = p_vlc->module_bank.first; - p_vlc->module_bank.first = p_help_module; + p_help_module->next = p_vlc->p_module_bank->first; + p_vlc->p_module_bank->first = p_help_module; /* End hack */ /* Check for help on modules */ @@ -354,7 +339,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) { Usage( p_vlc, p_tmp ); free( p_tmp ); - p_vlc->module_bank.first = p_help_module->next; + p_vlc->p_module_bank->first = p_help_module->next; config_Free( p_help_module ); vlc_object_destroy( p_help_module ); module_EndBank( p_vlc ); @@ -366,7 +351,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) if( config_GetInt( p_vlc, "longhelp" ) ) { Usage( p_vlc, NULL ); - p_vlc->module_bank.first = p_help_module->next; + p_vlc->p_module_bank->first = p_help_module->next; config_Free( p_help_module ); vlc_object_destroy( p_help_module ); module_EndBank( p_vlc ); @@ -378,7 +363,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) if( config_GetInt( p_vlc, "list" ) ) { ListModules( p_vlc ); - p_vlc->module_bank.first = p_help_module->next; + p_vlc->p_module_bank->first = p_help_module->next; config_Free( p_help_module ); vlc_object_destroy( p_help_module ); module_EndBank( p_vlc ); @@ -387,7 +372,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) } /* Hack: remove the help module here */ - p_vlc->module_bank.first = p_help_module->next; + p_vlc->p_module_bank->first = p_help_module->next; config_Free( p_help_module ); vlc_object_destroy( p_help_module ); /* End hack */ @@ -430,19 +415,23 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) /* p_vlc inititalization. FIXME ? */ p_vlc->i_desync = config_GetInt( p_vlc, "desync" ) * (mtime_t)1000; +#if defined( __i386__ ) if( !config_GetInt( p_vlc, "mmx" ) ) - p_vlc->i_cpu_capabilities &= ~CPU_CAPABILITY_MMX; + p_vlc->i_cpu &= ~CPU_CAPABILITY_MMX; if( !config_GetInt( p_vlc, "3dn" ) ) - p_vlc->i_cpu_capabilities &= ~CPU_CAPABILITY_3DNOW; + p_vlc->i_cpu &= ~CPU_CAPABILITY_3DNOW; if( !config_GetInt( p_vlc, "mmxext" ) ) - p_vlc->i_cpu_capabilities &= ~CPU_CAPABILITY_MMXEXT; + p_vlc->i_cpu &= ~CPU_CAPABILITY_MMXEXT; if( !config_GetInt( p_vlc, "sse" ) ) - p_vlc->i_cpu_capabilities &= ~CPU_CAPABILITY_SSE; + p_vlc->i_cpu &= ~CPU_CAPABILITY_SSE; +#endif +#if defined( __powerpc__ ) || defined( SYS_DARWIN ) if( !config_GetInt( p_vlc, "altivec" ) ) - p_vlc->i_cpu_capabilities &= ~CPU_CAPABILITY_ALTIVEC; + p_vlc->i_cpu &= ~CPU_CAPABILITY_ALTIVEC; +#endif #define PRINT_CAPABILITY( capability, string ) \ - if( p_vlc->i_cpu_capabilities & capability ) \ + if( p_vlc->i_cpu & capability ) \ { \ strncat( p_capabilities, string " ", \ sizeof(p_capabilities) - strlen(p_capabilities) ); \ @@ -465,19 +454,14 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) * Choose the best memcpy module */ psz_module = config_GetPsz( p_vlc, "memcpy" ); - p_vlc->p_memcpy_module = - module_Need( p_vlc, MODULE_CAPABILITY_MEMCPY, psz_module, NULL ); + p_vlc->p_memcpy_module = module_Need( p_vlc, "memcpy", psz_module ); if( psz_module ) free( psz_module ); + if( p_vlc->p_memcpy_module == NULL ) { - msg_Err( p_vlc, "no suitable memcpy module, using libc default" ); + msg_Warn( p_vlc, "no suitable memcpy module, using libc default" ); p_vlc->pf_memcpy = memcpy; } - else - { - p_vlc->pf_memcpy = p_vlc->p_memcpy_module->p_functions - ->memcpy.functions.memcpy.pf_memcpy; - } /* * Initialize shared resources and libraries @@ -486,8 +470,8 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) && network_ChannelCreate( p_vlc ) ) { /* On error during Channels initialization, switch off channels */ - msg_Err( p_vlc, - "channels initialization failed, deactivating channels" ); + msg_Warn( p_vlc, + "channels initialization failed, deactivating channels" ); config_PutInt( p_vlc, "network-channel", VLC_FALSE ); } @@ -500,7 +484,7 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) msg_Err( p_vlc, "playlist initialization failed" ); if( p_vlc->p_memcpy_module != NULL ) { - module_Unneed( p_vlc->p_memcpy_module ); + module_Unneed( p_vlc, p_vlc->p_memcpy_module ); } module_EndBank( p_vlc ); msg_Destroy( p_vlc ); @@ -721,7 +705,7 @@ vlc_error_t vlc_end_r( vlc_t *p_vlc ) */ if( p_vlc->p_memcpy_module != NULL ) { - module_Unneed( p_vlc->p_memcpy_module ); + module_Unneed( p_vlc, p_vlc->p_memcpy_module ); } free( p_vlc->psz_homedir ); @@ -931,7 +915,7 @@ static void Usage( vlc_t *p_this, const char *psz_module_name ) #endif /* Enumerate the config for each module */ - for( p_module = p_this->p_vlc->module_bank.first ; + for( p_module = p_this->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -1116,7 +1100,7 @@ static void ListModules( vlc_t *p_this ) fprintf( stderr, _("[module] [description]\n") ); /* Enumerate each module */ - for( p_module = p_this->p_vlc->module_bank.first ; + for( p_module = p_this->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -1165,25 +1149,6 @@ static void Version( void ) #endif } -/***************************************************************************** - * Build: print information about the vlc build - ***************************************************************************** - * Print the ./configure command line and other information. - *****************************************************************************/ -static void Build( void ) -{ -#ifdef WIN32 - ShowConsole(); -#endif - - fprintf( stderr, "configured with %s\n", CONFIGURE_LINE ); - -#ifdef WIN32 /* Pause the console because it's destroyed when we exit */ - fprintf( stderr, _("\nPress the RETURN key to continue...\n") ); - getchar(); -#endif -} - /***************************************************************************** * ShowConsole: On Win32, create an output console for debug messages ***************************************************************************** diff --git a/src/libvlc.h b/src/libvlc.h index 17552a0327..4b7ba85d50 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -2,7 +2,7 @@ * libvlc.h: main libvlc header ***************************************************************************** * Copyright (C) 1998-2002 VideoLAN - * $Id: libvlc.h,v 1.8 2002/07/29 19:05:47 gbazin Exp $ + * $Id: libvlc.h,v 1.9 2002/07/31 20:56:52 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -316,127 +316,134 @@ /* * Quick usage guide for the configuration options: * - * MODULE_CONFIG_START - * MODULE_CONFIG_STOP - * ADD_CATEGORY_HINT( N_(text), N_(longtext) ) - * ADD_SUBCATEGORY_HINT( N_(text), N_(longtext) ) - * ADD_USAGE_HINT( N_(text) ) - * ADD_STRING( option_name, value, p_callback, N_(text), N_(longtext) ) - * ADD_FILE( option_name, psz_value, p_callback, N_(text), N_(longtext) ) - * ADD_MODULE( option_name, psz_value, i_capability, p_callback, - * N_(text), N_(longtext) ) - * ADD_INTEGER( option_name, i_value, p_callback, N_(text), N_(longtext) ) - * ADD_BOOL( option_name, b_value, p_callback, N_(text), N_(longtext) ) + * add_category_hint( N_(text), N_(longtext) ); + * add_subcategory_hint( N_(text), N_(longtext) ); + * add_usage_hint( N_(text) ); + * add_string( option_name, value, p_callback, N_(text), N_(longtext) ); + * add_file( option_name, psz_value, p_callback, N_(text), N_(longtext) ); + * add_module( option_name, psz_value, i_capability, p_callback, + * N_(text), N_(longtext) ); + * add_integer( option_name, i_value, p_callback, N_(text), N_(longtext) ); + * add_bool( option_name, b_value, p_callback, N_(text), N_(longtext) ); */ -MODULE_CONFIG_START - -/* Interface options */ -ADD_CATEGORY_HINT( N_("Interface"), NULL) -ADD_MODULE_WITH_SHORT ( "intf", 'I', MODULE_CAPABILITY_INTF, NULL, NULL, INTF_TEXT, INTF_LONGTEXT ) -ADD_BOOL_WITH_SHORT ( "verbose", 'v', 0, NULL, VERBOSE_TEXT, VERBOSE_LONGTEXT ) -ADD_BOOL_WITH_SHORT ( "quiet", 'q', 0, NULL, QUIET_TEXT, QUIET_LONGTEXT ) -ADD_BOOL ( "color", 0, NULL, COLOR_TEXT, COLOR_LONGTEXT ) -ADD_STRING ( "search-path", NULL, NULL, INTF_PATH_TEXT, INTF_PATH_LONGTEXT ) -ADD_STRING ( "plugin-path", NULL, NULL, PLUGIN_PATH_TEXT, PLUGIN_PATH_LONGTEXT ) - -/* Audio options */ -ADD_CATEGORY_HINT( N_("Audio"), NULL) -ADD_MODULE_WITH_SHORT ( "aout", 'A', MODULE_CAPABILITY_AOUT, NULL, NULL, AOUT_TEXT, AOUT_LONGTEXT ) -ADD_BOOL ( "audio", 1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT ) -ADD_BOOL ( "mono", 0, NULL, MONO_TEXT, MONO_LONGTEXT ) -ADD_INTEGER ( "volume", VOLUME_DEFAULT, NULL, VOLUME_TEXT, VOLUME_LONGTEXT ) -ADD_INTEGER ( "rate", 44100, NULL, RATE_TEXT, RATE_LONGTEXT ) -ADD_INTEGER ( "desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT ) -ADD_INTEGER ( "audio-format", 0, NULL, FORMAT_TEXT, FORMAT_LONGTEXT ) - -/* Video options */ -ADD_CATEGORY_HINT( N_("Video"), NULL ) -ADD_MODULE_WITH_SHORT ( "vout", 'V', MODULE_CAPABILITY_VOUT, NULL, NULL, VOUT_TEXT, VOUT_LONGTEXT ) -ADD_BOOL ( "video", 1, NULL, VIDEO_TEXT, VIDEO_LONGTEXT ) -ADD_INTEGER ( "width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT ) -ADD_INTEGER ( "height", -1, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT ) -ADD_FLOAT ( "zoom", 1, NULL, ZOOM_TEXT, ZOOM_LONGTEXT ) -ADD_BOOL ( "grayscale", 0, NULL, GRAYSCALE_TEXT, GRAYSCALE_LONGTEXT ) -ADD_BOOL ( "fullscreen", 0, NULL, FULLSCREEN_TEXT, FULLSCREEN_LONGTEXT ) -ADD_BOOL ( "overlay", 1, NULL, OVERLAY_TEXT, OVERLAY_LONGTEXT ) -ADD_INTEGER ( "spumargin", -1, NULL, SPUMARGIN_TEXT, SPUMARGIN_LONGTEXT ) -ADD_MODULE ( "filter", MODULE_CAPABILITY_VOUT_FILTER, NULL, NULL, FILTER_TEXT, FILTER_LONGTEXT ) - -/* Input options */ -ADD_CATEGORY_HINT( N_("Input"), NULL ) -ADD_INTEGER ( "server-port", 1234, NULL, SERVER_PORT_TEXT, SERVER_PORT_LONGTEXT ) -ADD_BOOL ( "network-channel", 0, NULL, NETCHANNEL_TEXT, NETCHANNEL_LONGTEXT ) -ADD_STRING ( "channel-server", "localhost", NULL, CHAN_SERV_TEXT, CHAN_SERV_LONGTEXT ) -ADD_INTEGER ( "channel-port", 6010, NULL, CHAN_PORT_TEXT, CHAN_PORT_LONGTEXT ) -ADD_INTEGER ( "mtu", 1500, NULL, MTU_TEXT, MTU_LONGTEXT ) -ADD_STRING ( "iface", "eth0", NULL, IFACE_TEXT, IFACE_LONGTEXT ) - -ADD_INTEGER ( "program", 0, NULL, INPUT_PROGRAM_TEXT, INPUT_PROGRAM_LONGTEXT ) -ADD_INTEGER ( "audio-type", -1, NULL, INPUT_AUDIO_TEXT, INPUT_AUDIO_LONGTEXT ) -ADD_INTEGER ( "audio-channel", -1, NULL, INPUT_CHAN_TEXT, INPUT_CHAN_LONGTEXT ) -ADD_INTEGER ( "spu-channel", -1, NULL, INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT ) - -ADD_STRING ( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT ) -ADD_STRING ( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT ) - -ADD_BOOL_WITH_SHORT ( "ipv6", '6', 0, NULL, IPV6_TEXT, IPV6_LONGTEXT ) -ADD_BOOL_WITH_SHORT ( "ipv4", '4', 0, NULL, IPV4_TEXT, IPV4_LONGTEXT ) - -/* Decoder options */ -ADD_CATEGORY_HINT( N_("Decoders"), NULL ) -ADD_MODULE ( "codec", MODULE_CAPABILITY_DECODER, NULL, NULL, CODEC_TEXT, CODEC_LONGTEXT ) - -/* CPU options */ -ADD_CATEGORY_HINT( N_("CPU"), NULL ) -ADD_BOOL ( "mmx", 1, NULL, MMX_TEXT, MMX_LONGTEXT ) -ADD_BOOL ( "3dn", 1, NULL, THREE_DN_TEXT, THREE_DN_LONGTEXT ) -ADD_BOOL ( "mmxext", 1, NULL, MMXEXT_TEXT, MMXEXT_LONGTEXT ) -ADD_BOOL ( "sse", 1, NULL, SSE_TEXT, SSE_LONGTEXT ) -ADD_BOOL ( "altivec", 1, NULL, ALTIVEC_TEXT, ALTIVEC_LONGTEXT ) - -/* Playlist options */ -ADD_CATEGORY_HINT( N_("Playlist"), NULL ) -ADD_BOOL ( "playlist", 0, NULL, PL_LAUNCH_TEXT, PL_LAUNCH_LONGTEXT ) -ADD_BOOL ( "enqueue", 0, NULL, PL_ENQUEUE_TEXT, PL_ENQUEUE_LONGTEXT ) -ADD_BOOL ( "loop", 0, NULL, PL_LOOP_TEXT, PL_LOOP_LONGTEXT ) - -/* Misc options */ -ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) -ADD_MODULE ( "memcpy", MODULE_CAPABILITY_MEMCPY, NULL, NULL, MEMCPY_TEXT, MEMCPY_LONGTEXT ) -ADD_MODULE ( "access", MODULE_CAPABILITY_ACCESS, NULL, NULL, ACCESS_TEXT, ACCESS_LONGTEXT ) -ADD_MODULE ( "demux", MODULE_CAPABILITY_DEMUX, NULL, NULL, DEMUX_TEXT, DEMUX_LONGTEXT ) - -#if defined(WIN32) -ADD_BOOL ( "fast-mutex", 0, NULL, FAST_MUTEX_TEXT, FAST_MUTEX_LONGTEXT ) -ADD_INTEGER ( "win9x-cv-method", 0, NULL, WIN9X_CV_TEXT, WIN9X_CV_LONGTEXT ) +vlc_module_begin(); + /* Interface options */ + add_category_hint( N_("Interface"), NULL); + add_module_with_short( "intf", 'I', "interface", NULL, NULL, + INTF_TEXT, INTF_LONGTEXT ); + add_bool_with_short( "verbose", 'v', 0, NULL, + VERBOSE_TEXT, VERBOSE_LONGTEXT ); + add_bool_with_short( "quiet", 'q', 0, NULL, QUIET_TEXT, QUIET_LONGTEXT ); + add_bool( "color", 0, NULL, COLOR_TEXT, COLOR_LONGTEXT ); + add_string( "search-path", NULL, NULL, INTF_PATH_TEXT, INTF_PATH_LONGTEXT ); + add_string( "plugin-path", NULL, NULL, + PLUGIN_PATH_TEXT, PLUGIN_PATH_LONGTEXT ); + + /* Audio options */ + add_category_hint( N_("Audio"), NULL); + add_module_with_short( "aout", 'A', "audio output", NULL, NULL, + AOUT_TEXT, AOUT_LONGTEXT ); + add_bool( "audio", 1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT ); + add_bool( "mono", 0, NULL, MONO_TEXT, MONO_LONGTEXT ); + add_integer( "volume", VOLUME_DEFAULT, NULL, VOLUME_TEXT, VOLUME_LONGTEXT ); + add_integer( "rate", 44100, NULL, RATE_TEXT, RATE_LONGTEXT ); + add_integer( "desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT ); + add_integer( "audio-format", 0, NULL, FORMAT_TEXT, FORMAT_LONGTEXT ); + + /* Video options */ + add_category_hint( N_("Video"), NULL ); + add_module_with_short( "vout", 'V', "video output", NULL, NULL, + VOUT_TEXT, VOUT_LONGTEXT ); + add_bool( "video", 1, NULL, VIDEO_TEXT, VIDEO_LONGTEXT ); + add_integer( "width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT ); + add_integer( "height", -1, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT ); + add_float( "zoom", 1, NULL, ZOOM_TEXT, ZOOM_LONGTEXT ); + add_bool( "grayscale", 0, NULL, GRAYSCALE_TEXT, GRAYSCALE_LONGTEXT ); + add_bool( "fullscreen", 0, NULL, FULLSCREEN_TEXT, FULLSCREEN_LONGTEXT ); + add_bool( "overlay", 1, NULL, OVERLAY_TEXT, OVERLAY_LONGTEXT ); + add_integer( "spumargin", -1, NULL, SPUMARGIN_TEXT, SPUMARGIN_LONGTEXT ); + add_module( "filter", "video filter", NULL, NULL, + FILTER_TEXT, FILTER_LONGTEXT ); + + /* Input options */ + add_category_hint( N_("Input"), NULL ); + add_integer( "server-port", 1234, NULL, + SERVER_PORT_TEXT, SERVER_PORT_LONGTEXT ); + add_bool( "network-channel", 0, NULL, + NETCHANNEL_TEXT, NETCHANNEL_LONGTEXT ); + add_string( "channel-server", "localhost", NULL, + CHAN_SERV_TEXT, CHAN_SERV_LONGTEXT ); + add_integer( "channel-port", 6010, NULL, + CHAN_PORT_TEXT, CHAN_PORT_LONGTEXT ); + add_integer( "mtu", 1500, NULL, MTU_TEXT, MTU_LONGTEXT ); + add_string( "iface", "eth0", NULL, IFACE_TEXT, IFACE_LONGTEXT ); + + add_integer( "program", 0, NULL, + INPUT_PROGRAM_TEXT, INPUT_PROGRAM_LONGTEXT ); + add_integer( "audio-type", -1, NULL, + INPUT_AUDIO_TEXT, INPUT_AUDIO_LONGTEXT ); + add_integer( "audio-channel", -1, NULL, + INPUT_CHAN_TEXT, INPUT_CHAN_LONGTEXT ); + add_integer( "spu-channel", -1, NULL, + INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT ); + + add_string( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT ); + add_string( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT ); + + add_bool_with_short( "ipv6", '6', 0, NULL, IPV6_TEXT, IPV6_LONGTEXT ); + add_bool_with_short( "ipv4", '4', 0, NULL, IPV4_TEXT, IPV4_LONGTEXT ); + + /* Decoder options */ + add_category_hint( N_("Decoders"), NULL ); + add_module( "codec", "decoder", NULL, NULL, CODEC_TEXT, CODEC_LONGTEXT ); + + /* CPU options */ + add_category_hint( N_("CPU"), NULL ); +#if defined( __i386__ ) + add_bool( "mmx", 1, NULL, MMX_TEXT, MMX_LONGTEXT ); + add_bool( "3dn", 1, NULL, THREE_DN_TEXT, THREE_DN_LONGTEXT ); + add_bool( "mmxext", 1, NULL, MMXEXT_TEXT, MMXEXT_LONGTEXT ); + add_bool( "sse", 1, NULL, SSE_TEXT, SSE_LONGTEXT ); +#endif +#if defined( __powerpc__ ) || defined( SYS_DARWIN ) + add_bool( "altivec", 1, NULL, ALTIVEC_TEXT, ALTIVEC_LONGTEXT ); #endif -/* Usage (mainly useful for cmd line stuff) */ -ADD_USAGE_HINT( PLAYLIST_USAGE ) + /* Playlist options */ + add_category_hint( N_("Playlist"), NULL ); + add_bool( "playlist", 0, NULL, PL_LAUNCH_TEXT, PL_LAUNCH_LONGTEXT ); + add_bool( "enqueue", 0, NULL, PL_ENQUEUE_TEXT, PL_ENQUEUE_LONGTEXT ); + add_bool( "loop", 0, NULL, PL_LOOP_TEXT, PL_LOOP_LONGTEXT ); -MODULE_CONFIG_STOP + /* Misc options */ + add_category_hint( N_("Miscellaneous"), NULL ); + add_module( "memcpy", "memcpy", NULL, NULL, MEMCPY_TEXT, MEMCPY_LONGTEXT ); + add_module( "access", "access", NULL, NULL, ACCESS_TEXT, ACCESS_LONGTEXT ); + add_module( "demux", "demux", NULL, NULL, DEMUX_TEXT, DEMUX_LONGTEXT ); -MODULE_INIT_START - SET_DESCRIPTION( N_("main program") ) - ADD_CAPABILITY( MAIN, 100/*whatever*/ ) -MODULE_INIT_STOP +#if defined(WIN32) + add_bool( "fast-mutex", 0, NULL, FAST_MUTEX_TEXT, FAST_MUTEX_LONGTEXT ); + add_integer( "win9x-cv-method", 0, NULL, WIN9X_CV_TEXT, WIN9X_CV_LONGTEXT ); +#endif -MODULE_ACTIVATE_START -MODULE_ACTIVATE_STOP + /* Usage (mainly useful for cmd line stuff) */ + add_usage_hint( PLAYLIST_USAGE ); -MODULE_DEACTIVATE_START -MODULE_DEACTIVATE_STOP + set_description( N_("main program") ); + set_capability( "main", 100 ); +vlc_module_end(); static module_config_t p_help_config[] = { - { CONFIG_ITEM_BOOL, "help", 'h', N_("print help") }, - { CONFIG_ITEM_BOOL, "longhelp", 'H', N_("print detailed help") }, - { CONFIG_ITEM_BOOL, "list", 'l', N_("print a list of available modules") }, - { CONFIG_ITEM_STRING, "module", 'p', N_("print help on module") }, - { CONFIG_ITEM_BOOL, "version", '\0', N_("print version information") }, - { CONFIG_ITEM_BOOL, "build", '\0', N_("print build information") }, - { CONFIG_HINT_END, NULL, '\0' } + { CONFIG_ITEM_BOOL, NULL, "help", 'h', N_("print help") }, + { CONFIG_ITEM_BOOL, NULL, "longhelp", 'H', N_("print detailed help") }, + { CONFIG_ITEM_BOOL, NULL, "list", 'l', + N_("print a list of available modules") }, + { CONFIG_ITEM_STRING, NULL, "module", 'p', N_("print help on module") }, + { CONFIG_ITEM_BOOL, NULL, "version", '\0', + N_("print version information") }, + { CONFIG_HINT_END, NULL, NULL, '\0' } }; /***************************************************************************** diff --git a/src/misc/configuration.c b/src/misc/configuration.c index 03f43b620f..81db0c19d3 100644 --- a/src/misc/configuration.c +++ b/src/misc/configuration.c @@ -2,7 +2,7 @@ * configuration.c management of the modules configuration ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: configuration.c,v 1.32 2002/07/03 19:40:49 sam Exp $ + * $Id: configuration.c,v 1.33 2002/07/31 20:56:53 sam Exp $ * * Authors: Gildas Bazin * @@ -266,7 +266,7 @@ module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name) if( !psz_name ) return NULL; - for( p_module = p_this->p_vlc->module_bank.first ; + for( p_module = p_this->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -337,6 +337,8 @@ void config_Duplicate( module_t *p_module, module_config_t *p_orig ) p_module->p_config[i].f_value = p_orig[i].f_value; p_module->p_config[i].b_dirty = p_orig[i].b_dirty; + p_module->p_config[i].psz_type = p_orig[i].psz_type ? + strdup( _(p_orig[i].psz_type) ) : NULL; p_module->p_config[i].psz_name = p_orig[i].psz_name ? strdup( _(p_orig[i].psz_name) ) : NULL; p_module->p_config[i].psz_text = p_orig[i].psz_text ? @@ -364,7 +366,7 @@ void config_Duplicate( module_t *p_module, module_config_t *p_orig ) } /* the callback pointer is only valid when the module is loaded so this - * value is set in ActivateModule() and reset in DeactivateModule() */ + * value is set in module_activate() and reset in module_deactivate() */ p_module->p_config[i].pf_callback = NULL; } } @@ -381,6 +383,9 @@ void config_Free( module_t *p_module ) for( ; p_item->i_type != CONFIG_HINT_END ; p_item++ ) { + if( p_item->psz_type ) + free( p_item->psz_type ); + if( p_item->psz_name ) free( p_item->psz_name ); @@ -486,7 +491,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) } /* Look for the selected module, if NULL then save everything */ - for( p_module = p_this->p_vlc->module_bank.first ; p_module != NULL ; + for( p_module = p_this->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -506,7 +511,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) !memcmp( &line[1], p_module->psz_object_name, strlen(p_module->psz_object_name) ) ) { - msg_Dbg( p_this, "loading config for module <%s>", + msg_Dbg( p_this, "loading config for module \"%s\"", p_module->psz_object_name ); break; @@ -555,18 +560,16 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) if( !*psz_option_value ) break; /* ignore empty option */ p_item->i_value = atoi( psz_option_value); - msg_Dbg( p_this, "found <%s> option %s=%i", - p_module->psz_object_name, p_item->psz_name, - p_item->i_value ); + msg_Dbg( p_this, "option \"%s\", value %i", + p_item->psz_name, p_item->i_value ); break; case CONFIG_ITEM_FLOAT: if( !*psz_option_value ) break; /* ignore empty option */ p_item->f_value = (float)atof( psz_option_value); - msg_Dbg( p_this, "found <%s> option %s=%f", - p_module->psz_object_name, p_item->psz_name, - (double)p_item->f_value ); + msg_Dbg( p_this, "option \"%s\", value %f", + p_item->psz_name, (double)p_item->f_value ); break; default: @@ -581,10 +584,9 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) vlc_mutex_unlock( p_item->p_lock ); - msg_Dbg( p_this, "found <%s> option %s=%s", - p_module->psz_object_name, p_item->psz_name, - p_item->psz_value != NULL ? - p_item->psz_value : "(NULL)" ); + msg_Dbg( p_this, "option \"%s\", value \"%s\"", + p_item->psz_name, + p_item->psz_value ? p_item->psz_value : "" ); break; } } @@ -698,7 +700,8 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) if( (p_line[0] == '[') && (p_index2 = strchr(p_line,']'))) { /* we found a section, check if we need to do a backup */ - for( p_module = p_this->p_vlc->module_bank.first; p_module != NULL; + for( p_module = p_this->p_vlc->p_module_bank->first; + p_module != NULL; p_module = p_module->next ) { if( ((p_index2 - &p_line[1]) @@ -719,7 +722,7 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) /* we don't have this section in our list so we need to back * it up */ *p_index2 = 0; - msg_Dbg( p_this, "backing up config for unknown module <%s>", + msg_Dbg( p_this, "backing up config for unknown module \"%s\"", &p_line[1] ); *p_index2 = ']'; @@ -760,7 +763,7 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) fprintf( file, "###\n### " COPYRIGHT_MESSAGE "\n###\n\n" ); /* Look for the selected module, if NULL then save everything */ - for( p_module = p_this->p_vlc->module_bank.first ; p_module != NULL ; + for( p_module = p_this->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -771,7 +774,7 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) if( !p_module->i_config_items ) continue; - msg_Dbg( p_this, "saving config for module <%s>", + msg_Dbg( p_this, "saving config for module \"%s\"", p_module->psz_object_name ); fprintf( file, "[%s]", p_module->psz_object_name ); @@ -885,7 +888,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], */ i_opts = 0; - for( p_module = p_this->p_vlc->module_bank.first; + for( p_module = p_this->p_vlc->p_module_bank->first; p_module != NULL ; p_module = p_module->next ) { @@ -935,7 +938,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], /* Fill the p_longopts and psz_shortopts structures */ i_index = 0; - for( p_module = p_this->p_vlc->module_bank.first ; + for( p_module = p_this->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { diff --git a/src/misc/messages.c b/src/misc/messages.c index eccb5af86b..9795bb00b0 100644 --- a/src/misc/messages.c +++ b/src/misc/messages.c @@ -4,7 +4,7 @@ * modules, especially intf modules. See config.h for output configuration. ***************************************************************************** * Copyright (C) 1998-2002 VideoLAN - * $Id: messages.c,v 1.5 2002/07/23 00:30:22 sam Exp $ + * $Id: messages.c,v 1.6 2002/07/31 20:56:53 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -65,6 +65,9 @@ void __msg_Create( vlc_object_t *p_this ) /* Message queue initialization */ vlc_mutex_init( p_this, &p_this->p_vlc->msg_bank.lock ); + p_this->p_vlc->msg_bank.b_configured = VLC_FALSE; + p_this->p_vlc->msg_bank.b_overflow = VLC_FALSE; + p_this->p_vlc->msg_bank.i_start = 0; p_this->p_vlc->msg_bank.i_stop = 0; @@ -81,6 +84,8 @@ void __msg_Flush( vlc_object_t *p_this ) vlc_mutex_lock( &p_this->p_vlc->msg_bank.lock ); + p_this->p_vlc->msg_bank.b_configured = VLC_TRUE; + for( i_index = p_this->p_vlc->msg_bank.i_start; i_index != p_this->p_vlc->msg_bank.i_stop; i_index = (i_index+1) % VLC_MSG_QSIZE ) @@ -102,16 +107,23 @@ void __msg_Flush( vlc_object_t *p_this ) *****************************************************************************/ void __msg_Destroy( vlc_object_t *p_this ) { - /* Destroy lock */ - vlc_mutex_destroy( &p_this->p_vlc->msg_bank.lock ); - if( p_this->p_vlc->msg_bank.i_sub ) { - fprintf( stderr, "main error: stale interface subscribers\n" ); + msg_Err( p_this, "stale interface subscribers" ); } - /* Free remaining messages */ - FlushMsg( &p_this->p_vlc->msg_bank ); + /* Flush the queue */ + if( !p_this->p_vlc->msg_bank.b_configured ) + { + msg_Flush( p_this ); + } + else + { + FlushMsg( &p_this->p_vlc->msg_bank ); + } + + /* Destroy lock */ + vlc_mutex_destroy( &p_this->p_vlc->msg_bank.lock ); } /***************************************************************************** @@ -237,8 +249,9 @@ DECLARE_MSG_FN( __msg_Dbg, VLC_MSG_DBG ); static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module, const char *psz_format, va_list args ) { + msg_bank_t * p_bank = &p_this->p_vlc->msg_bank; /* message bank */ char * psz_str = NULL; /* formatted message string */ - msg_item_t * p_item; /* pointer to message */ + msg_item_t * p_item = NULL; /* pointer to message */ msg_item_t item; /* message in case of a full queue */ #ifdef WIN32 char * psz_temp; @@ -278,28 +291,56 @@ static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module, #endif /* Put message in queue */ - vlc_mutex_lock( &p_this->p_vlc->msg_bank.lock ); + vlc_mutex_lock( &p_bank->lock ); /* Check there is room in the queue for our message */ - if( ((p_this->p_vlc->msg_bank.i_stop - p_this->p_vlc->msg_bank.i_start + 1) % VLC_MSG_QSIZE) == 0 ) + if( p_bank->b_overflow ) + { + FlushMsg( &p_this->p_vlc->msg_bank ); + + if( ((p_bank->i_stop - p_bank->i_start + 1) % VLC_MSG_QSIZE) == 0 ) + { + /* Still in overflow mode, print from a dummy item */ + p_item = &item; + } + else + { + /* Pheeew, at last, there is room in the queue! */ + p_bank->b_overflow = VLC_FALSE; + } + } + else if( ((p_bank->i_stop - p_bank->i_start + 2) % VLC_MSG_QSIZE) == 0 ) { FlushMsg( &p_this->p_vlc->msg_bank ); - if( ((p_this->p_vlc->msg_bank.i_stop - p_this->p_vlc->msg_bank.i_start + 1) % VLC_MSG_QSIZE) == 0 ) + if( ((p_bank->i_stop - p_bank->i_start + 2) % VLC_MSG_QSIZE) == 0 ) { - fprintf( stderr, "main warning: message queue overflow\n" ); + p_bank->b_overflow = VLC_TRUE; + + /* Put the overflow message in the queue */ + p_item = p_bank->msg + p_bank->i_stop; + p_bank->i_stop = (p_bank->i_stop + 1) % VLC_MSG_QSIZE; + + p_item->i_type = VLC_MSG_ERR; + p_item->i_object_id = p_this->i_object_id; + p_item->psz_module = strdup( "message" ); + p_item->psz_msg = strdup( "message queue overflowed" ); + + PrintMsg( p_this, p_item ); + + /* We print from a dummy item */ p_item = &item; - goto print_message; } } - /* Put the message in the queue */ - p_item = p_this->p_vlc->msg_bank.msg + p_this->p_vlc->msg_bank.i_stop; - p_this->p_vlc->msg_bank.i_stop = - (p_this->p_vlc->msg_bank.i_stop + 1) % VLC_MSG_QSIZE; + if( !p_bank->b_overflow ) + { + /* Put the message in the queue */ + p_item = p_bank->msg + p_bank->i_stop; + p_bank->i_stop = (p_bank->i_stop + 1) % VLC_MSG_QSIZE; + } /* Fill message information fields */ -print_message: p_item->i_type = i_type; p_item->i_object_id = p_this->i_object_id; p_item->psz_module = strdup( psz_module ); @@ -307,7 +348,13 @@ print_message: PrintMsg( p_this, p_item ); - vlc_mutex_unlock( &p_this->p_vlc->msg_bank.lock ); + if( p_bank->b_overflow ) + { + free( p_item->psz_module ); + free( p_item->psz_msg ); + } + + vlc_mutex_unlock( &p_bank->lock ); } /* following functions are local */ @@ -322,6 +369,12 @@ static void FlushMsg ( msg_bank_t *p_bank ) { int i_index, i_start, i_stop; + /* Only flush the queue if it has been properly configured */ + if( !p_bank->b_configured ) + { + return; + } + /* Get the maximum message index that can be freed */ i_stop = p_bank->i_stop; @@ -372,29 +425,32 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item ) static const char *ppsz_color[4] = { WHITE, RED, YELLOW, GRAY }; int i_type = p_item->i_type; + if( p_this->p_vlc->b_quiet || !p_this->p_vlc->msg_bank.b_configured ) + { + return; + } + + if( !p_this->p_vlc->b_verbose && + ( (i_type == VLC_MSG_WARN) || (i_type == VLC_MSG_DBG) ) ) + { + return; + } + /* Send the message to stderr */ - if( (i_type == VLC_MSG_ERR) - || ( (i_type == VLC_MSG_INFO) && !p_this->p_vlc->b_quiet ) - || ( (i_type == VLC_MSG_WARN) && p_this->p_vlc->b_verbose - && !p_this->p_vlc->b_quiet ) - || ( (i_type == VLC_MSG_DBG) && p_this->p_vlc->b_verbose - && !p_this->p_vlc->b_quiet ) ) + if( p_this->p_vlc->b_color ) { - if( p_this->p_vlc->b_color ) - { - fprintf( stderr, "[" GREEN "%.2x" GRAY ":" GREEN "%.6x" GRAY "] " - "%s%s: %s%s" GRAY "\n", p_this->p_vlc->i_unique, - p_item->i_object_id, p_item->psz_module, - ppsz_type[i_type], ppsz_color[i_type], - p_item->psz_msg ); - } - else - { - fprintf( stderr, "[%.2x:%.6x] %s%s: %s\n", - p_this->p_vlc->i_unique, p_item->i_object_id, - p_item->psz_module, ppsz_type[i_type], - p_item->psz_msg ); - } + fprintf( stderr, "[" GREEN "%.2x" GRAY ":" GREEN "%.6x" GRAY "] " + "%s%s: %s%s" GRAY "\n", p_this->p_vlc->i_unique, + p_item->i_object_id, p_item->psz_module, + ppsz_type[i_type], ppsz_color[i_type], + p_item->psz_msg ); + } + else + { + fprintf( stderr, "[%.2x:%.6x] %s%s: %s\n", + p_this->p_vlc->i_unique, p_item->i_object_id, + p_item->psz_module, ppsz_type[i_type], + p_item->psz_msg ); } } diff --git a/src/misc/modules.c b/src/misc/modules.c index b5b3b3119c..bc3de85da0 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -2,7 +2,7 @@ * modules.c : Builtin and plugin modules management functions ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules.c,v 1.74 2002/07/23 00:39:17 sam Exp $ + * $Id: modules.c,v 1.75 2002/07/31 20:56:53 sam Exp $ * * Authors: Samuel Hocevar * Ethan C. Baldridge @@ -78,11 +78,6 @@ # include "modules_builtin_msvc.h" #endif -/***************************************************************************** - * Static variables - *****************************************************************************/ -DECLARE_MODULE_CAPABILITY_TABLE; - /***************************************************************************** * Local prototypes *****************************************************************************/ @@ -90,20 +85,15 @@ DECLARE_MODULE_CAPABILITY_TABLE; static void AllocateAllPlugins ( vlc_object_t * ); static int AllocatePluginModule ( vlc_object_t *, char * ); #endif -static int AllocateBuiltinModule( vlc_object_t *, - int ( * ) ( module_t * ), - int ( * ) ( module_t * ), - int ( * ) ( module_t * ) ); +static int AllocateBuiltinModule( vlc_object_t *, int ( * ) ( module_t * ) ); static int DeleteModule ( module_t * ); static int LockModule ( module_t * ); static int UnlockModule ( module_t * ); #ifdef HAVE_DYNAMIC_PLUGINS static int HideModule ( module_t * ); -static int CallSymbol ( module_t *, char * ); -#endif - -#ifdef HAVE_DYNAMIC_PLUGINS -static module_symbols_t symbols; +static void DupModule ( module_t * ); +static void UndupModule ( module_t * ); +static int CallEntry ( module_t * ); #endif /***************************************************************************** @@ -114,17 +104,26 @@ static module_symbols_t symbols; *****************************************************************************/ void __module_InitBank( vlc_object_t *p_this ) { - p_this->p_vlc->module_bank.first = NULL; - p_this->p_vlc->module_bank.i_count = 0; - vlc_mutex_init( p_this, &p_this->p_vlc->module_bank.lock ); + module_bank_t *p_bank; + + p_bank = vlc_object_create( p_this, sizeof(module_bank_t) ); + p_bank->psz_object_name = "module bank"; + + p_bank->first = NULL; + p_bank->i_count = 0; + vlc_mutex_init( p_this, &p_bank->lock ); /* * Store the symbols to be exported */ #ifdef HAVE_DYNAMIC_PLUGINS - STORE_SYMBOLS( &symbols ); + STORE_SYMBOLS( &p_bank->symbols ); #endif + /* Everything worked, attach the object */ + p_this->p_vlc->p_module_bank = p_bank; + vlc_object_attach( p_bank, p_this->p_vlc ); + return; } @@ -150,23 +149,27 @@ void __module_EndBank( vlc_object_t *p_this ) { module_t * p_next; - while( p_this->p_vlc->module_bank.first != NULL ) + vlc_object_detach_all( p_this->p_vlc->p_module_bank ); + + while( p_this->p_vlc->p_module_bank->first != NULL ) { - if( DeleteModule( p_this->p_vlc->module_bank.first ) ) + if( DeleteModule( p_this->p_vlc->p_module_bank->first ) ) { /* Module deletion failed */ - msg_Err( p_this, "`%s' can't be removed, trying harder", - p_this->p_vlc->module_bank.first->psz_object_name ); + msg_Err( p_this, "module \"%s\" can't be removed, trying harder", + p_this->p_vlc->p_module_bank->first->psz_object_name ); /* We just free the module by hand. Niahahahahaha. */ - p_next = p_this->p_vlc->module_bank.first->next; - free( p_this->p_vlc->module_bank.first ); - p_this->p_vlc->module_bank.first = p_next; + p_next = p_this->p_vlc->p_module_bank->first->next; + free( p_this->p_vlc->p_module_bank->first ); + p_this->p_vlc->p_module_bank->first = p_next; } } /* Destroy the lock */ - vlc_mutex_destroy( &p_this->p_vlc->module_bank.lock ); + vlc_mutex_destroy( &p_this->p_vlc->p_module_bank->lock ); + + vlc_object_destroy( p_this->p_vlc->p_module_bank ); return; } @@ -181,9 +184,7 @@ void __module_EndBank( vlc_object_t *p_this ) *****************************************************************************/ void __module_LoadMain( vlc_object_t *p_this ) { - AllocateBuiltinModule( p_this, InitModule__MODULE_main, - ActivateModule__MODULE_main, - DeactivateModule__MODULE_main ); + AllocateBuiltinModule( p_this, vlc_entry__main ); } /***************************************************************************** @@ -222,10 +223,10 @@ void __module_ManageBank( vlc_object_t *p_this ) module_t * p_module; /* We take the global lock */ - vlc_mutex_lock( &p_this->p_vlc->module_bank.lock ); + vlc_mutex_lock( &p_this->p_vlc->p_module_bank->lock ); /* Parse the module list to see if any modules need to be unloaded */ - for( p_module = p_this->p_vlc->module_bank.first ; + for( p_module = p_this->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { @@ -238,7 +239,7 @@ void __module_ManageBank( vlc_object_t *p_this ) } else { - msg_Dbg( p_this, "hiding unused plugin module `%s'", + msg_Dbg( p_this, "hiding unused plugin module \"%s\"", p_module->psz_object_name ); HideModule( p_module ); @@ -249,7 +250,7 @@ void __module_ManageBank( vlc_object_t *p_this ) } /* We release the global lock */ - vlc_mutex_unlock( &p_this->p_vlc->module_bank.lock ); + vlc_mutex_unlock( &p_this->p_vlc->p_module_bank->lock ); #endif /* HAVE_DYNAMIC_PLUGINS */ return; @@ -260,8 +261,8 @@ void __module_ManageBank( vlc_object_t *p_this ) ***************************************************************************** * This function returns the module that best fits the asked capabilities. *****************************************************************************/ -module_t * __module_Need( vlc_object_t *p_this, int i_capability, - const char *psz_name, void *p_data ) +module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability, + const char *psz_name ) { typedef struct module_list_t module_list_t; @@ -274,7 +275,7 @@ module_t * __module_Need( vlc_object_t *p_this, int i_capability, module_list_t *p_list, *p_first, *p_tmp; - int i_ret, i_index = 0; + int i_index = 0; vlc_bool_t b_intf = VLC_FALSE; module_t *p_module; @@ -282,8 +283,7 @@ module_t * __module_Need( vlc_object_t *p_this, int i_capability, int i_shortcuts = 0; char *psz_shortcuts = NULL; - msg_Dbg( p_this, "looking for %s module", - MODULE_CAPABILITY( i_capability ) ); + msg_Dbg( p_this, "looking for %s module", psz_capability ); /* Count how many different shortcuts were asked for */ if( psz_name && *psz_name ) @@ -310,30 +310,48 @@ module_t * __module_Need( vlc_object_t *p_this, int i_capability, } /* We take the global lock */ - vlc_mutex_lock( &p_this->p_vlc->module_bank.lock ); + vlc_mutex_lock( &p_this->p_vlc->p_module_bank->lock ); /* Sort the modules and test them */ - p_list = malloc( p_this->p_vlc->module_bank.i_count + p_list = malloc( p_this->p_vlc->p_module_bank->i_count * sizeof( module_list_t ) ); p_first = NULL; /* Parse the module list for capabilities and probe each of them */ - for( p_module = p_this->p_vlc->module_bank.first ; + for( p_module = p_this->p_vlc->p_module_bank->first ; p_module != NULL ; p_module = p_module->next ) { - int i_shortcut_bonus = 0; + module_t * p_submodule = NULL; + int i_shortcut_bonus = 0, i_submodule; - /* Test that this module can do everything we need */ - if( !(p_module->i_capabilities & ( 1 << i_capability )) ) + /* Test that this module can do what we need */ + if( strcmp( p_module->psz_capability, psz_capability ) ) { - continue; + for( i_submodule = 0; + i_submodule < p_module->i_children; + i_submodule++ ) + { + if( !strcmp( ((module_t*)p_module->pp_children[ i_submodule ]) + ->psz_capability, psz_capability ) ) + { + p_submodule = + (module_t*)p_module->pp_children[ i_submodule ]; + p_submodule->next = p_module->next; + break; + } + } + + if( p_submodule == NULL ) + { + continue; + } + + p_module = p_submodule; } /* Test if we have the required CPU */ - if( (p_module->i_cpu_capabilities - & p_this->p_vlc->i_cpu_capabilities) - != p_module->i_cpu_capabilities ) + if( (p_module->i_cpu & p_this->p_vlc->i_cpu) != p_module->i_cpu ) { continue; } @@ -351,7 +369,7 @@ module_t * __module_Need( vlc_object_t *p_this, int i_capability, b_trash && p_module->pp_shortcuts[i_dummy]; i_dummy++ ) { - b_trash = strcmp( psz_name, "any" ) + b_trash = ( strcmp(psz_name, "any") || !p_module->i_score ) && strcmp( psz_name, p_module->pp_shortcuts[i_dummy] ); } @@ -376,39 +394,32 @@ module_t * __module_Need( vlc_object_t *p_this, int i_capability, } } /* If we didn't require a shortcut, trash zero-scored plugins */ - else if( !p_module->pi_score[i_capability] ) + else if( !p_module->i_score ) { continue; } /* Special case: test if we requested a particular intf plugin */ - if( i_capability == MODULE_CAPABILITY_INTF ) + if( p_module->psz_program + && !strcmp( p_module->psz_program, + p_this->p_vlc->psz_object_name ) ) { - if( p_module->psz_program != NULL - && !strcmp( p_module->psz_program, - p_this->p_vlc->psz_object_name ) ) - { - if( !b_intf ) - { - /* Remove previous non-matching plugins */ - i_index = 0; - b_intf = VLC_TRUE; - } - } - else + if( !b_intf ) { - if( b_intf ) - { - /* This one doesn't match */ - continue; - } + /* Remove previous non-matching plugins */ + i_index = 0; + b_intf = VLC_TRUE; } } + else if( b_intf ) + { + /* This one doesn't match */ + continue; + } /* Store this new module */ p_list[ i_index ].p_module = p_module; - p_list[ i_index ].i_score = p_module->pi_score[i_capability] - + i_shortcut_bonus; + p_list[ i_index ].i_score = p_module->i_score + i_shortcut_bonus; /* Add it to the modules-to-probe list */ if( i_index == 0 ) @@ -444,6 +455,9 @@ module_t * __module_Need( vlc_object_t *p_this, int i_capability, i_index++; } + msg_Dbg( p_this, "probing %i candidate%s", + i_index, i_index == 1 ? "" : "s" ); + /* Lock all selected modules */ p_tmp = p_first; while( p_tmp != NULL ) @@ -453,81 +467,19 @@ module_t * __module_Need( vlc_object_t *p_this, int i_capability, } /* We can release the global lock, module refcounts were incremented */ - vlc_mutex_unlock( &p_this->p_vlc->module_bank.lock ); + vlc_mutex_unlock( &p_this->p_vlc->p_module_bank->lock ); /* Parse the linked list and use the first successful module */ p_tmp = p_first; while( p_tmp != NULL ) { - /* Test the requested capability */ - switch( i_capability ) - { - case MODULE_CAPABILITY_ACCESS: - i_ret = p_tmp->p_module->p_functions->access.functions. - access.pf_open( (input_thread_t *)p_data ); - break; - - case MODULE_CAPABILITY_DEMUX: - i_ret = p_tmp->p_module->p_functions->demux.functions. - demux.pf_init( (input_thread_t *)p_data ); - break; - - case MODULE_CAPABILITY_NETWORK: - i_ret = p_tmp->p_module->p_functions->network.functions. - network.pf_open( p_this, (network_socket_t *)p_data ); - break; - - case MODULE_CAPABILITY_DECODER: - i_ret = p_tmp->p_module->p_functions->dec.functions. - dec.pf_probe( (vlc_fourcc_t *)p_data ); - break; - - case MODULE_CAPABILITY_INTF: - i_ret = p_tmp->p_module->p_functions->intf.functions. - intf.pf_open( (intf_thread_t *)p_data ); - break; - - case MODULE_CAPABILITY_AOUT: - i_ret = p_tmp->p_module->p_functions->aout.functions. - aout.pf_open( (aout_thread_t *)p_data ); - break; - - case MODULE_CAPABILITY_VOUT: - case MODULE_CAPABILITY_VOUT_FILTER: - i_ret = p_tmp->p_module->p_functions->vout.functions. - vout.pf_create( (vout_thread_t *)p_data ); - break; - - case MODULE_CAPABILITY_CHROMA: - i_ret = p_tmp->p_module->p_functions->chroma.functions. - chroma.pf_init( (vout_thread_t *)p_data ); - break; - - case MODULE_CAPABILITY_IDCT: - case MODULE_CAPABILITY_IMDCT: - case MODULE_CAPABILITY_MOTION: - case MODULE_CAPABILITY_DOWNMIX: - case MODULE_CAPABILITY_MEMCPY: - /* This one always works */ - i_ret = 0; - break; - - default: - msg_Err( p_this, "unknown module type %i", i_capability ); - i_ret = -1; - break; - } - - /* If the high score was broken, we have a new champion */ - if( i_ret == 0 ) + if( p_tmp->p_module->pf_activate + && p_tmp->p_module->pf_activate( p_this ) == VLC_SUCCESS ) { break; } - else - { - UnlockModule( p_tmp->p_module ); - } + UnlockModule( p_tmp->p_module ); p_tmp = p_tmp->p_next; } @@ -553,19 +505,18 @@ module_t * __module_Need( vlc_object_t *p_this, int i_capability, if( p_module != NULL ) { - msg_Info( p_module, "found and locked %s module `%s'", - MODULE_CAPABILITY( i_capability ), - p_module->psz_object_name ); + msg_Info( p_module, "using %s module \"%s\"", + psz_capability, p_module->psz_object_name ); } else if( p_first == NULL ) { - msg_Err( p_this, "no available %s module matched `%s'", - MODULE_CAPABILITY( i_capability ), psz_name ); + msg_Err( p_this, "no %s module matched \"%s\"", + psz_capability, (psz_name && *psz_name) ? psz_name : "any" ); } else if( psz_name != NULL && *psz_name ) { - msg_Err( p_this, "could not load any %s module matching `%s'", - MODULE_CAPABILITY( i_capability ), psz_name ); + msg_Err( p_this, "no %s module matching \"%s\" could be loaded", + psz_capability, (psz_name && *psz_name) ? psz_name : "any" ); } if( psz_shortcuts ) @@ -583,19 +534,25 @@ module_t * __module_Need( vlc_object_t *p_this, int i_capability, * This function must be called by the thread that called module_Need, to * decrease the reference count and allow for hiding of modules. *****************************************************************************/ -void module_Unneed( module_t * p_module ) +void __module_Unneed( vlc_object_t * p_this, module_t * p_module ) { + /* Use the close method */ + if( p_module->pf_deactivate ) + { + p_module->pf_deactivate( p_this ); + } + /* We take the global lock */ - vlc_mutex_lock( &p_module->p_vlc->module_bank.lock ); + vlc_mutex_lock( &p_module->p_vlc->p_module_bank->lock ); /* Just unlock the module - we can't do anything if it fails, * so there is no need to check the return value. */ UnlockModule( p_module ); - msg_Info( p_module, "unlocking module `%s'", p_module->psz_object_name ); + msg_Info( p_module, "unlocking module \"%s\"", p_module->psz_object_name ); /* We release the global lock */ - vlc_mutex_unlock( &p_module->p_vlc->module_bank.lock ); + vlc_mutex_unlock( &p_module->p_vlc->p_module_bank->lock ); return; } @@ -706,8 +663,7 @@ static void AllocateAllPlugins( vlc_object_t *p_this ) *****************************************************************************/ static int AllocatePluginModule( vlc_object_t * p_this, char * psz_filename ) { - char **pp_shortcut; - module_t * p_module, * p_othermodule; + module_t * p_module; module_handle_t handle; /* Try to dynamically load the module. */ @@ -716,7 +672,7 @@ static int AllocatePluginModule( vlc_object_t * p_this, char * psz_filename ) char psz_buffer[256]; /* The plugin module couldn't be opened */ - msg_Warn( p_this, "cannot open %s (%s)", + msg_Warn( p_this, "cannot open `%s' (%s)", psz_filename, module_error( psz_buffer ) ); return -1; } @@ -731,47 +687,58 @@ static int AllocatePluginModule( vlc_object_t * p_this, char * psz_filename ) return -1; } - /* We need to fill these since they may be needed by CallSymbol() */ - p_module->is.plugin.psz_filename = psz_filename; - p_module->is.plugin.handle = handle; - p_module->p_symbols = &symbols; + /* We need to fill these since they may be needed by CallEntry() */ + p_module->psz_filename = psz_filename; + p_module->handle = handle; + p_module->p_symbols = &p_this->p_vlc->p_module_bank->symbols; /* Initialize the module: fill p_module->psz_object_name, default config */ - if( CallSymbol( p_module, "InitModule" MODULE_SUFFIX ) != 0 ) + if( CallEntry( p_module ) != 0 ) { - /* We couldn't call InitModule() */ + /* We couldn't call module_init() */ vlc_object_destroy( p_module ); module_unload( handle ); return -1; } - /* Check that we don't already have a module with this name */ - for( p_othermodule = p_this->p_vlc->module_bank.first ; - p_othermodule != NULL ; - p_othermodule = p_othermodule->next ) - { - if( !strcmp( p_othermodule->psz_object_name, - p_module->psz_object_name ) ) - { - msg_Warn( p_this, - "cannot load %s, a module named `%s' already exists", - psz_filename, p_module->psz_object_name ); - config_Free( p_module ); - vlc_object_destroy( p_module ); - module_unload( handle ); - return -1; - } - } + DupModule( p_module ); + p_module->psz_filename = strdup( p_module->psz_filename ); + p_module->psz_longname = strdup( p_module->psz_longname ); + + /* Everything worked fine ! The module is ready to be added to the list. */ + p_module->i_usage = 0; + p_module->i_unused_delay = 0; + + p_module->b_builtin = VLC_FALSE; - /* Activate the module : fill the capability structure, etc. */ - if( CallSymbol( p_module, "ActivateModule" MODULE_SUFFIX ) != 0 ) + /* Link module into the linked list */ + if( p_this->p_vlc->p_module_bank->first != NULL ) { - /* We couldn't call ActivateModule() */ - config_Free( p_module ); - vlc_object_destroy( p_module ); - module_unload( handle ); - return -1; + p_this->p_vlc->p_module_bank->first->prev = p_module; } + p_module->next = p_this->p_vlc->p_module_bank->first; + p_module->prev = NULL; + p_this->p_vlc->p_module_bank->first = p_module; + p_this->p_vlc->p_module_bank->i_count++; + + msg_Dbg( p_this, "plugin \"%s\", %s", + p_module->psz_object_name, p_module->psz_longname ); + + vlc_object_attach( p_module, p_this->p_vlc->p_module_bank ); + + return 0; +} + +/***************************************************************************** + * DupModule: make a plugin module standalone. + ***************************************************************************** + * This function duplicates all strings in the module, so that the dynamic + * object can be unloaded. It acts recursively on submodules. + *****************************************************************************/ +static void DupModule( module_t *p_module ) +{ + char **pp_shortcut; + int i_submodule; for( pp_shortcut = p_module->pp_shortcuts ; *pp_shortcut ; pp_shortcut++ ) { @@ -780,56 +747,49 @@ static int AllocatePluginModule( vlc_object_t * p_this, char * psz_filename ) /* We strdup() these entries so that they are still valid when the * module is unloaded. */ - p_module->is.plugin.psz_filename = - strdup( p_module->is.plugin.psz_filename ); p_module->psz_object_name = strdup( p_module->psz_object_name ); - p_module->psz_longname = strdup( p_module->psz_longname ); - - if( p_module->is.plugin.psz_filename == NULL - || p_module->psz_object_name == NULL - || p_module->psz_longname == NULL ) - { - msg_Err( p_this, "out of memory" ); - - free( p_module->is.plugin.psz_filename ); - free( p_module->psz_object_name ); - free( p_module->psz_longname ); - free( p_module->psz_program ); - - config_Free( p_module ); - vlc_object_destroy( p_module ); - module_unload( handle ); - return -1; - } + p_module->psz_capability = strdup( p_module->psz_capability ); if( p_module->psz_program != NULL ) { p_module->psz_program = strdup( p_module->psz_program ); } - /* Everything worked fine ! The module is ready to be added to the list. */ - p_module->i_usage = 0; - p_module->i_unused_delay = 0; + for( i_submodule = 0; i_submodule < p_module->i_children; i_submodule++ ) + { + DupModule( (module_t*)p_module->pp_children[ i_submodule ] ); + } +} - p_module->b_builtin = VLC_FALSE; +/***************************************************************************** + * UndupModule: free a duplicated module. + ***************************************************************************** + * This function frees the allocations done in DupModule(). + *****************************************************************************/ +static void UndupModule( module_t *p_module ) +{ + char **pp_shortcut; + int i_submodule; - /* Link module into the linked list */ - if( p_this->p_vlc->module_bank.first != NULL ) + for( i_submodule = 0; i_submodule < p_module->i_children; i_submodule++ ) { - p_this->p_vlc->module_bank.first->prev = p_module; + UndupModule( (module_t*)p_module->pp_children[ i_submodule ] ); } - p_module->next = p_this->p_vlc->module_bank.first; - p_module->prev = NULL; - p_this->p_vlc->module_bank.first = p_module; - p_this->p_vlc->module_bank.i_count++; - msg_Dbg( p_this, "plugin `%s', %s", - p_module->psz_object_name, p_module->psz_longname ); + for( pp_shortcut = p_module->pp_shortcuts ; *pp_shortcut ; pp_shortcut++ ) + { + free( *pp_shortcut ); + } - vlc_object_attach( p_module, p_this ); + free( p_module->psz_object_name ); + free( p_module->psz_capability ); - return 0; + if( p_module->psz_program != NULL ) + { + free( p_module->psz_program ); + } } + #endif /* HAVE_DYNAMIC_PLUGINS */ /***************************************************************************** @@ -840,11 +800,9 @@ static int AllocatePluginModule( vlc_object_t * p_this, char * psz_filename ) * module_Unneed and HideModule. It can be removed by DeleteModule. *****************************************************************************/ static int AllocateBuiltinModule( vlc_object_t * p_this, - int ( *pf_init ) ( module_t * ), - int ( *pf_activate ) ( module_t * ), - int ( *pf_deactivate ) ( module_t * ) ) + int ( *pf_entry ) ( module_t * ) ) { - module_t * p_module, * p_othermodule; + module_t * p_module; /* Now that we have successfully loaded the module, we can * allocate a structure for it */ @@ -856,38 +814,11 @@ static int AllocateBuiltinModule( vlc_object_t * p_this, } /* Initialize the module : fill p_module->psz_object_name, etc. */ - if( pf_init( p_module ) != 0 ) - { - /* With a well-written module we shouldn't have to print an - * additional error message here, but just make sure. */ - msg_Err( p_this, "failed calling init in builtin module" ); - vlc_object_destroy( p_module ); - return -1; - } - - /* Check that we don't already have a module with this name */ - for( p_othermodule = p_this->p_vlc->module_bank.first ; - p_othermodule != NULL ; - p_othermodule = p_othermodule->next ) - { - if( !strcmp( p_othermodule->psz_object_name, - p_module->psz_object_name ) ) - { - msg_Warn( p_this, "cannot load builtin `%s', " - "a module named `%s' already exists", - p_module->psz_object_name, p_module->psz_object_name ); - config_Free( p_module ); - vlc_object_destroy( p_module ); - return -1; - } - } - - if( pf_activate( p_module ) != 0 ) + if( pf_entry( p_module ) != 0 ) { /* With a well-written module we shouldn't have to print an * additional error message here, but just make sure. */ - msg_Err( p_this, "failed calling activate in builtin module" ); - config_Free( p_module ); + msg_Err( p_this, "failed calling entry point in builtin module" ); vlc_object_destroy( p_module ); return -1; } @@ -897,22 +828,21 @@ static int AllocateBuiltinModule( vlc_object_t * p_this, p_module->i_unused_delay = 0; p_module->b_builtin = VLC_TRUE; - p_module->is.builtin.pf_deactivate = pf_deactivate; /* Link module into the linked list */ - if( p_this->p_vlc->module_bank.first != NULL ) + if( p_this->p_vlc->p_module_bank->first != NULL ) { - p_this->p_vlc->module_bank.first->prev = p_module; + p_this->p_vlc->p_module_bank->first->prev = p_module; } - p_module->next = p_this->p_vlc->module_bank.first; + p_module->next = p_this->p_vlc->p_module_bank->first; p_module->prev = NULL; - p_this->p_vlc->module_bank.first = p_module; - p_this->p_vlc->module_bank.i_count++; + p_this->p_vlc->p_module_bank->first = p_module; + p_this->p_vlc->p_module_bank->i_count++; - msg_Dbg( p_this, "builtin `%s', %s", + msg_Dbg( p_this, "builtin \"%s\", %s", p_module->psz_object_name, p_module->psz_longname ); - vlc_object_attach( p_module, p_this ); + vlc_object_attach( p_module, p_this->p_vlc->p_module_bank ); return 0; } @@ -931,22 +861,17 @@ static int DeleteModule( module_t * p_module ) { if( p_module->i_usage != 0 ) { - msg_Err( p_module, "trying to free builtin module `%s' with " + msg_Err( p_module, "trying to free builtin module \"%s\" with " "usage %i", p_module->psz_object_name, p_module->i_usage ); return -1; } - else - { - /* We deactivate the module now. */ - p_module->is.builtin.pf_deactivate( p_module ); - } } #ifdef HAVE_DYNAMIC_PLUGINS else { if( p_module->i_usage >= 1 ) { - msg_Err( p_module, "trying to free module `%s' which is " + msg_Err( p_module, "trying to free module \"%s\" which is " "still in use", p_module->psz_object_name ); return -1; } @@ -973,7 +898,7 @@ static int DeleteModule( module_t * p_module ) } else { - p_module->p_vlc->module_bank.first = p_module->next; + p_module->p_vlc->p_module_bank->first = p_module->next; } if( p_module->next != NULL ) @@ -981,26 +906,26 @@ static int DeleteModule( module_t * p_module ) p_module->next->prev = p_module->prev; } - p_module->p_vlc->module_bank.i_count--; + p_module->p_vlc->p_module_bank->i_count--; /* We free the structures that we strdup()ed in Allocate*Module(). */ #ifdef HAVE_DYNAMIC_PLUGINS if( !p_module->b_builtin ) { - char **pp_shortcut = p_module->pp_shortcuts; - - for( ; *pp_shortcut ; pp_shortcut++ ) - { - free( *pp_shortcut ); - } - - free( p_module->is.plugin.psz_filename ); - free( p_module->psz_object_name ); + UndupModule( p_module ); + free( p_module->psz_filename ); free( p_module->psz_longname ); - free( p_module->psz_program ); } #endif + /* Free and detach the object's children */ + while( p_module->i_children ) + { + vlc_object_t *p_this = p_module->pp_children[0]; + vlc_object_detach_all( p_this ); + vlc_object_destroy( p_this ); + } + config_Free( p_module ); vlc_object_destroy( p_module ); @@ -1028,7 +953,7 @@ static int LockModule( module_t * p_module ) if( p_module->b_builtin ) { /* A builtin module should always have a refcount >= 0 ! */ - msg_Err( p_module, "builtin module `%s' has refcount %i", + msg_Err( p_module, "builtin module \"%s\" has refcount %i", p_module->psz_object_name, p_module->i_usage ); return -1; } @@ -1037,20 +962,19 @@ static int LockModule( module_t * p_module ) if( p_module->i_usage != -1 ) { /* This shouldn't happen. Ever. We have serious problems here. */ - msg_Err( p_module, "plugin module `%s' has refcount %i", + msg_Err( p_module, "plugin module \"%s\" has refcount %i", p_module->psz_object_name, p_module->i_usage ); return -1; } /* i_usage == -1, which means that the module isn't in memory */ - if( module_load( p_module->is.plugin.psz_filename, - &p_module->is.plugin.handle ) ) + if( module_load( p_module->psz_filename, &p_module->handle ) ) { char psz_buffer[256]; /* The plugin module couldn't be opened */ - msg_Err( p_module, "cannot open %s (%s)", - p_module->is.plugin.psz_filename, module_error(psz_buffer) ); + msg_Err( p_module, "cannot open `%s' (%s)", + p_module->psz_filename, module_error(psz_buffer) ); return -1; } @@ -1058,16 +982,6 @@ static int LockModule( module_t * p_module ) * unloaded ? It makes XMMS crash nastily, perhaps we should try * to be a bit more clever here. */ - /* Activate the module : fill the capability structure, etc. */ - if( CallSymbol( p_module, "ActivateModule" MODULE_SUFFIX ) != 0 ) - { - /* We couldn't call ActivateModule() -- looks nasty, but - * we can't do much about it. Just try to unload module. */ - module_unload( p_module->is.plugin.handle ); - p_module->i_usage = -1; - return -1; - } - /* Everything worked fine ! The module is ready to be used */ p_module->i_usage = 1; #endif /* HAVE_DYNAMIC_PLUGINS */ @@ -1086,7 +1000,7 @@ static int UnlockModule( module_t * p_module ) if( p_module->i_usage <= 0 ) { /* This shouldn't happen. Ever. We have serious problems here. */ - msg_Err( p_module, "trying to call module_Unneed() on `%s' " + msg_Err( p_module, "trying to call module_Unneed() on \"%s\" " "which is not in use", p_module->psz_object_name ); return -1; } @@ -1103,7 +1017,7 @@ static int UnlockModule( module_t * p_module ) * HideModule: remove a module from memory but keep its structure. ***************************************************************************** * This function can only be called if i_usage == 0. It will make a call - * to the module's inner DeactivateModule() symbol, and then unload it + * to the module's inner module_deactivate() symbol, and then unload it * from memory. A call to module_Need() will automagically load it again. *****************************************************************************/ static int HideModule( module_t * p_module ) @@ -1111,63 +1025,54 @@ static int HideModule( module_t * p_module ) if( p_module->b_builtin ) { /* A builtin module should never be hidden. */ - msg_Err( p_module, "trying to hide builtin module `%s'", + msg_Err( p_module, "trying to hide builtin module \"%s\"", p_module->psz_object_name ); return -1; } if( p_module->i_usage >= 1 ) { - msg_Err( p_module, "trying to hide module `%s' which is still " + msg_Err( p_module, "trying to hide module \"%s\" which is still " "in use", p_module->psz_object_name ); return -1; } if( p_module->i_usage <= -1 ) { - msg_Err( p_module, "trying to hide module `%s' which is already " + msg_Err( p_module, "trying to hide module \"%s\" which is already " "hidden", p_module->psz_object_name ); return -1; } - /* Deactivate the module : free the capability structure, etc. */ - if( CallSymbol( p_module, "DeactivateModule" MODULE_SUFFIX ) != 0 ) - { - /* We couldn't call DeactivateModule() -- looks nasty, but - * we can't do much about it. Just try to unload module anyway. */ - module_unload( p_module->is.plugin.handle ); - p_module->i_usage = -1; - return -1; - } - /* Everything worked fine, we can safely unload the module. */ - module_unload( p_module->is.plugin.handle ); + module_unload( p_module->handle ); p_module->i_usage = -1; return 0; } /***************************************************************************** - * CallSymbol: calls a module symbol. + * CallEntry: call an entry point. ***************************************************************************** * This function calls a symbol given its name and a module structure. The * symbol MUST refer to a function returning int and taking a module_t* as * an argument. *****************************************************************************/ -static int CallSymbol( module_t * p_module, char * psz_name ) +static int CallEntry( module_t * p_module ) { + static char *psz_name = "vlc_entry" MODULE_SUFFIX; int (* pf_symbol) ( module_t * p_module ); /* Try to resolve the symbol */ - pf_symbol = module_getsymbol( p_module->is.plugin.handle, psz_name ); + pf_symbol = module_getsymbol( p_module->handle, psz_name ); if( pf_symbol == NULL ) { char psz_buffer[256]; /* We couldn't load the symbol */ - msg_Warn( p_module, "cannot find symbol %s in module %s (%s)", - psz_name, p_module->is.plugin.psz_filename, + msg_Warn( p_module, "cannot find symbol \"%s\" in file `%s' (%s)", + psz_name, p_module->psz_filename, module_error( psz_buffer ) ); return -1; } @@ -1177,8 +1082,8 @@ static int CallSymbol( module_t * p_module, char * psz_name ) { /* With a well-written module we shouldn't have to print an * additional error message here, but just make sure. */ - msg_Err( p_module, "failed calling symbol %s in module %s", - psz_name, p_module->is.plugin.psz_filename ); + msg_Err( p_module, "failed calling symbol \"%s\" in file `%s'", + psz_name, p_module->psz_filename ); return -1; } diff --git a/src/misc/modules_builtin.h.in b/src/misc/modules_builtin.h.in index 1183f9bbff..72bcd66426 100644 --- a/src/misc/modules_builtin.h.in +++ b/src/misc/modules_builtin.h.in @@ -21,13 +21,9 @@ *****************************************************************************/ #define ALLOCATE_BUILTIN( NAME ) \ - AllocateBuiltinModule( p_this, InitModule__MODULE_ ## NAME, \ - ActivateModule__MODULE_ ## NAME, \ - DeactivateModule__MODULE_ ## NAME ); + AllocateBuiltinModule( p_this, vlc_entry__ ## NAME ); /* We also consider the main program as a module (useful for config stuff) */ -int InitModule__MODULE_main( module_t* ); -int ActivateModule__MODULE_main( module_t* ); -int DeactivateModule__MODULE_main( module_t* ); +int vlc_entry__main( module_t* ); /* Add stuff here */ diff --git a/src/misc/modules_plugin.h b/src/misc/modules_plugin.h index 6f3bbe35f3..01d78f0281 100644 --- a/src/misc/modules_plugin.h +++ b/src/misc/modules_plugin.h @@ -251,8 +251,8 @@ static inline const char * module_error( char *psz_buffer ) (p_symbols)->input_ReadTS_inner = input_ReadTS; \ (p_symbols)->input_DemuxPS_inner = input_DemuxPS; \ (p_symbols)->input_DemuxTS_inner = input_DemuxTS; \ - (p_symbols)->input_FDClose_inner = input_FDClose; \ - (p_symbols)->input_FDNetworkClose_inner = input_FDNetworkClose; \ + (p_symbols)->__input_FDClose_inner = __input_FDClose; \ + (p_symbols)->__input_FDNetworkClose_inner = __input_FDNetworkClose; \ (p_symbols)->input_FDRead_inner = input_FDRead; \ (p_symbols)->input_FDNetworkRead_inner = input_FDNetworkRead; \ (p_symbols)->input_FDSeek_inner = input_FDSeek; \ @@ -266,7 +266,7 @@ static inline const char * module_error( char *psz_buffer ) (p_symbols)->GetLang_2B_inner = GetLang_2B; \ (p_symbols)->DecodeLanguage_inner = DecodeLanguage; \ (p_symbols)->__module_Need_inner = __module_Need; \ - (p_symbols)->module_Unneed_inner = module_Unneed; \ + (p_symbols)->__module_Unneed_inner = __module_Unneed; \ (p_symbols)->mstrtime_inner = mstrtime; \ (p_symbols)->mdate_inner = mdate; \ (p_symbols)->mwait_inner = mwait; \ diff --git a/src/misc/netutils.c b/src/misc/netutils.c index c45aecb8fb..03601ddea0 100644 --- a/src/misc/netutils.c +++ b/src/misc/netutils.c @@ -2,7 +2,7 @@ * netutils.c: various network functions ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: netutils.c,v 1.72 2002/07/20 18:01:43 sam Exp $ + * $Id: netutils.c,v 1.73 2002/07/31 20:56:53 sam Exp $ * * Authors: Vincent Seguin * Benoit Steiner @@ -197,13 +197,12 @@ int __network_ChannelJoin( vlc_object_t *p_this, int i_channel ) socket_desc.i_server_port = i_port; /* Find an appropriate network module */ - p_network = module_Need( p_this, MODULE_CAPABILITY_NETWORK, psz_network, - &socket_desc ); + p_network = module_Need( p_this, "network", psz_network/*, &socket_desc*/ ); if( p_network == NULL ) { return( -1 ); } - module_Unneed( p_network ); + module_Unneed( p_this, p_network ); free( psz_vlcs ); /* Do we really need this ? -- Meuuh */ i_fd = socket_desc.i_handle; diff --git a/src/misc/objects.c b/src/misc/objects.c index 6e8d689968..4dd6521740 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -2,7 +2,7 @@ * objects.c: vlc_object_t handling ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: objects.c,v 1.11 2002/06/08 14:08:46 sam Exp $ + * $Id: objects.c,v 1.12 2002/07/31 20:56:53 sam Exp $ * * Authors: Samuel Hocevar * @@ -101,8 +101,8 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type ) default: i_size = i_type > sizeof(vlc_object_t) ? i_type : sizeof(vlc_object_t); - i_type = VLC_OBJECT_PRIVATE; - psz_type = "private"; + i_type = VLC_OBJECT_GENERIC; + psz_type = "generic"; break; } @@ -146,6 +146,8 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type ) p_new->pp_children = NULL; p_new->i_children = 0; + p_new->p_private = NULL; + vlc_mutex_init( p_new, &p_new->object_lock ); vlc_cond_init( p_new, &p_new->object_wait ); @@ -234,7 +236,7 @@ void * __vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode ) /* Otherwise, recursively look for the object */ if( (i_mode & 0x000f) == FIND_ANYWHERE ) { - p_found = vlc_object_find_inner( CAST_TO_VLC_OBJECT(p_this->p_vlc), + p_found = vlc_object_find_inner( VLC_OBJECT(p_this->p_vlc), i_type, (i_mode & ~0x000f) | FIND_CHILD ); } @@ -497,7 +499,8 @@ static void vlc_dumpstructure_inner( vlc_object_t *p_this, strcpy( psz_children, ", 1 child" ); break; default: - snprintf( psz_children, 20, ", %i children", p_this->i_children ); + snprintf( psz_children, 20, + ", %i children", p_this->i_children ); psz_children[19] = '\0'; break; } diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index b2197ec2f0..833df04b8e 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -5,7 +5,7 @@ * thread, and destroy a previously oppened video output thread. ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: video_output.c,v 1.187 2002/07/23 00:39:17 sam Exp $ + * $Id: video_output.c,v 1.188 2002/07/31 20:56:53 sam Exp $ * * Authors: Vincent Seguin * @@ -184,9 +184,8 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent, p_vout->p_module = module_Need( p_vout, ( p_vout->psz_filter_chain ) ? - MODULE_CAPABILITY_VOUT_FILTER : - MODULE_CAPABILITY_VOUT, - psz_plugin, (void *)p_vout ); + "video filter" : "video output", + psz_plugin ); if( psz_plugin ) free( psz_plugin ); if( p_vout->p_module == NULL ) @@ -196,16 +195,6 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent, return( NULL ); } -#define f p_vout->p_module->p_functions->vout.functions.vout - p_vout->pf_create = f.pf_create; - p_vout->pf_init = f.pf_init; - p_vout->pf_end = f.pf_end; - p_vout->pf_destroy = f.pf_destroy; - p_vout->pf_manage = f.pf_manage; - p_vout->pf_render = f.pf_render; - p_vout->pf_display = f.pf_display; -#undef f - /* Create thread and set locks */ vlc_mutex_init( p_vout, &p_vout->picture_lock ); vlc_mutex_init( p_vout, &p_vout->subpicture_lock ); @@ -216,8 +205,7 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent, if( vlc_thread_create( p_vout, "video output", RunThread, 0 ) ) { msg_Err( p_vout, "%s", strerror(ENOMEM) ); - p_vout->pf_destroy( p_vout ); - module_Unneed( p_vout->p_module ); + module_Unneed( p_vout, p_vout->p_module ); vlc_object_destroy( p_vout ); return NULL; } @@ -334,9 +322,7 @@ static int InitThread( vout_thread_t *p_vout ) p_vout->b_direct = 0; /* Choose the best module */ - p_vout->chroma.p_module = - module_Need( p_vout, MODULE_CAPABILITY_CHROMA, - NULL, (void *)p_vout ); + p_vout->chroma.p_module = module_Need( p_vout, "chroma", NULL ); if( p_vout->chroma.p_module == NULL ) { @@ -347,11 +333,6 @@ static int InitThread( vout_thread_t *p_vout ) return( 1 ); } -#define f p_vout->chroma.p_module->p_functions->chroma.functions.chroma - p_vout->chroma.pf_init = f.pf_init; - p_vout->chroma.pf_end = f.pf_end; -#undef f - if( I_OUTPUTPICTURES < 2 * VOUT_MAX_PICTURES ) { msg_Dbg( p_vout, "indirect render, mapping " @@ -417,8 +398,6 @@ static void RunThread( vout_thread_t *p_vout) if( p_vout->b_error ) { /* Destroy thread structures allocated by Create and InitThread */ - p_vout->pf_destroy( p_vout ); - DestroyThread( p_vout ); return; } @@ -590,9 +569,9 @@ static void RunThread( vout_thread_t *p_vout) p_directbuffer = vout_RenderPicture( p_vout, p_picture, p_subpic ); /* - * Call the plugin-specific rendering method + * Call the plugin-specific rendering method if there is one */ - if( p_picture != NULL ) + if( p_picture != NULL && p_vout->pf_render ) { /* Render the direct buffer returned by vout_RenderPicture */ p_vout->pf_render( p_vout, p_directbuffer ); @@ -631,7 +610,10 @@ static void RunThread( vout_thread_t *p_vout) if( p_picture != NULL ) { /* Display the direct buffer returned by vout_RenderPicture */ - p_vout->pf_display( p_vout, p_directbuffer ); + if( p_vout->pf_display ) + { + p_vout->pf_display( p_vout, p_directbuffer ); + } /* Reinitialize idle loop count */ i_idle_loops = 0; @@ -645,7 +627,7 @@ static void RunThread( vout_thread_t *p_vout) /* * Check events and manage thread */ - if( p_vout->pf_manage( p_vout ) ) + if( p_vout->pf_manage && p_vout->pf_manage( p_vout ) ) { /* A fatal error occured, and the thread must terminate * immediately, without displaying anything - setting b_error to 1 @@ -671,13 +653,13 @@ static void RunThread( vout_thread_t *p_vout) if( p_vout->pf_init( p_vout ) ) { msg_Err( p_vout, "cannot resize display" ); - /* FixMe: p_vout->pf_end will be called again in EndThread() */ + /* FIXME: pf_end will be called again in EndThread() */ p_vout->b_error = 1; } /* Need to reinitialise the chroma plugin */ - p_vout->chroma.pf_end( p_vout ); - p_vout->chroma.pf_init( p_vout ); + p_vout->chroma.p_module->pf_deactivate( VLC_OBJECT(p_vout) ); + p_vout->chroma.p_module->pf_activate( VLC_OBJECT(p_vout) ); } } @@ -693,9 +675,6 @@ static void RunThread( vout_thread_t *p_vout) /* End of thread */ EndThread( p_vout ); - /* Destroy method-dependant resources */ - p_vout->pf_destroy( p_vout ); - /* Destroy thread structures allocated by CreateThread */ DestroyThread( p_vout ); } @@ -739,8 +718,7 @@ static void EndThread( vout_thread_t *p_vout ) if( !p_vout->b_direct ) { - p_vout->chroma.pf_end( p_vout ); - module_Unneed( p_vout->chroma.p_module ); + module_Unneed( p_vout, p_vout->chroma.p_module ); } /* Destroy all remaining pictures */ @@ -782,7 +760,7 @@ static void DestroyThread( vout_thread_t *p_vout ) vlc_mutex_destroy( &p_vout->change_lock ); /* Release the module */ - module_Unneed( p_vout->p_module ); + module_Unneed( p_vout, p_vout->p_module ); } /* following functions are local */ diff --git a/src/video_output/vout_pictures.h b/src/video_output/vout_pictures.h index 8f30704bec..1d95f75aa3 100644 --- a/src/video_output/vout_pictures.h +++ b/src/video_output/vout_pictures.h @@ -2,7 +2,7 @@ * vout_pictures.h : picture management definitions ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: vout_pictures.h,v 1.1 2002/07/23 00:39:17 sam Exp $ + * $Id: vout_pictures.h,v 1.2 2002/07/31 20:56:53 sam Exp $ * * Authors: Samuel Hocevar * @@ -26,11 +26,11 @@ *****************************************************************************/ /* Packed RGB for 8bpp */ -#define FOURCC_BI_RGB VLC_FOURCC( 0 , 0 , 0 , 0 ) +#define FOURCC_BI_RGB 0x00000000 #define FOURCC_RGB2 VLC_FOURCC('R','G','B','2') /* Packed RGB for 16, 24, 32bpp */ -#define FOURCC_BI_BITFIELDS VLC_FOURCC( 0 , 0 , 0 , 3 ) +#define FOURCC_BI_BITFIELDS 0x00000003 /* Packed RGB 15bpp, 0x1f, 0x7e0, 0xf800 */ #define FOURCC_RV15 VLC_FOURCC('R','V','1','5')