Mercurial > audlegacy-plugins
changeset 135:33d24bd94ccc trunk
[svn] Adds mplayer controls the plugin pack. I don't know crap about
configure.ac, so it's totally busted. Also, I used the string "what" in
common.c and interface.c. I'm not going to pretend I actually know what
I was doing there, but it seems to work despite that.
author | asheldon |
---|---|
date | Sat, 28 Oct 2006 18:08:06 -0700 |
parents | 8b343e9684b5 |
children | 6b5a52635b3b |
files | AUTHORS ChangeLog configure.ac src/mplayer/AUTHORS src/mplayer/COPYING src/mplayer/ChangeLog src/mplayer/Makefile src/mplayer/NEWS src/mplayer/README src/mplayer/README.audacious src/mplayer/common.c src/mplayer/interface.c src/mplayer/xmmsmplayer.c src/mplayer/xmmsmplayer.h |
diffstat | 13 files changed, 1610 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/AUTHORS Fri Oct 27 13:12:59 2006 -0700 +++ b/AUTHORS Sat Oct 28 18:08:06 2006 -0700 @@ -9,6 +9,7 @@ Derek Pomery <nemo@m8y.org> Mohammed Sameer <msameer@foolab.org> Jonathan Schleifer <js@h3c.de> +Aaron Sheldon <asheldon at uiuc.edu> Stephen Sokolow <deitarion@gmail.com> Tony Vroon <chainsaw@gentoo.org> Yoshiki Yazawa <yaz@cc.or.rim.jp>
--- a/ChangeLog Fri Oct 27 13:12:59 2006 -0700 +++ b/ChangeLog Sat Oct 28 18:08:06 2006 -0700 @@ -1,3 +1,13 @@ +2006-10-27 20:12:59 +0000 William Pitcock <nenolod@nenolod.net> + revision [268] + - fixes from Christian Birchinger <joker -at- gentoo.org> + + trunk/src/alarm/Makefile | 2 +- + trunk/src/alarm/interface.c | 8 ++++++-- + trunk/src/alarm/interface.h | 2 ++ + 3 files changed, 9 insertions(+), 3 deletions(-) + + 2006-10-27 19:52:59 +0000 William Pitcock <nenolod@nenolod.net> revision [266] - fix ChangeLog (i forgot to add asheldon to the changelog definition file, oops)
--- a/configure.ac Fri Oct 27 13:12:59 2006 -0700 +++ b/configure.ac Sat Oct 28 18:08:06 2006 -0700 @@ -387,6 +387,19 @@ INPUT_PLUGINS="$INPUT_PLUGINS adplug" fi +AC_ARG_ENABLE(mplayer, + [ --disable-mplayer disable mplayer plugin. (default=enabled) ], + [enable_mplayer=$enableval], + [enable_mplayer=yes] +) + +if test "$enable_mplayer" = "yes"; then + INPUT_PLUGINS="$INPUT_PLUGINS mplayer" + AC_SUBST(LIBNMS_CFLAGS) + AC_SUBST(LIBNMS_LIBS) + AC_SUBST(LIBNMS_SRC) +fi + dnl *** Ogg Vorbis AC_ARG_ENABLE(vorbis, @@ -1128,6 +1141,7 @@ echo " AdLib synthesizer (adplug): $have_adplug" echo " Apple Lossless Audio Codec (alac): yes" echo " WavPack 4.31+ (wavpack): $have_wavpack" +echo " Mplayer controls (mplayer): $enable_mplayer" echo echo " General" echo " -------"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/AUTHORS Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,2 @@ +Nandan Dixit <nandan@cse.iitb.ac.in> +Aaron Sheldon <asheldon@engineering.uiuc.edu>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/COPYING Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/ChangeLog Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,8 @@ + +0.0.1 +-- +First Release! + +0.5.0 +__ +Ported to Audacious
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/Makefile Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,17 @@ +include ../../mk/rules.mk +include ../../mk/init.mk + +OBJECTIVE_LIBS = libmplayer$(SHARED_SUFFIX) + +LIBDIR = $(plugindir)/$(INPUT_PLUGIN_DIR) + +LIBADD += $(GTK_LIBS) + +SOURCES = xmmsmplayer.c common.c interface.c + +CFLAGS += $(GTK_CFLAGS) -I../../intl -I../.. +CXXFLAGS += $(GTK_CFLAGS) -I../../intl -I../.. + +OBJECTS = ${SOURCES:.c=.o} + +include ../../mk/objective.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/README Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,9 @@ +XmmsMPlayer +----------- + +This an xmms plugin that allows you to use xmms as a front-end for +MPlayer. You'll need MPlayer properly installed and in the PATH. + +For more info, see http://www.cse.iitb.ac.in/nandan/xmmsmplayer/ + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/README.audacious Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,10 @@ +This is a terrible port from XMMS to Audacious. + +It's a horrible hack, and the ./configure scripts do more damage than +good. Hopefully it will work for most, though patches for ./configure +are more than welcome! + +In fact, patches of any kind are welcome since it's a total hack and +magic that it works as-is. + +- Aaron Sheldon
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/common.c Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,19 @@ +#include <audacious/rcfile.h> +#include "xmmsmplayer.h" + +struct mplayer_cfg *mplayer_read_cfg(){ + RcFile *cfg; + struct mplayer_cfg *new_cfg; + new_cfg=(struct mplayer_cfg *)malloc(sizeof(struct mplayer_cfg)); + memset(new_cfg,0,sizeof(struct mplayer_cfg)); + cfg = bmp_rcfile_open("what"); + bmp_rcfile_read_int(cfg,"xmms-mplayer","vo",&(new_cfg->vo)); + bmp_rcfile_read_int(cfg,"xmms-mplayer","ao",&(new_cfg->ao)); + bmp_rcfile_read_bool(cfg,"xmms-mplayer","zoom",&(new_cfg->zoom)); + bmp_rcfile_read_bool(cfg,"xmms-mplayer","framedrop",&(new_cfg->framedrop)); + bmp_rcfile_read_bool(cfg,"xmms-mplayer","idx",&(new_cfg->idx)); + bmp_rcfile_read_bool(cfg,"xmms-mplayer","onewin",&(new_cfg->onewin)); + bmp_rcfile_read_bool(cfg,"xmms-mplayer","xmmsaudio",&(new_cfg->xmmsaudio)); + bmp_rcfile_read_string(cfg,"xmms-mplayer","extra",&(new_cfg->extra)); + return new_cfg; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/interface.c Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,500 @@ + + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <string.h> + +#include <glib.h> +#include <gtk/gtk.h> +#include <gdk/gdk.h> +#include <gdk/gdkx.h> +#include <audacious/plugin.h> +#include <audacious/beepctrl.h> +#include <audacious/rcfile.h> +#include <audacious/util.h> + +#include "xmmsmplayer.h" + +static GtkWidget *vo_none; +static GtkWidget *vo_xv; +static GtkWidget *vo_x11; +static GtkWidget *vo_gl; +static GtkWidget *vo_sdl; +static GtkWidget *opt_zoom; +static GtkWidget *opt_framedrop; +static GtkWidget *opt_idx; +static GtkWidget *opt_onewin; +static GtkWidget *opt_xmmsaudio; +static GtkWidget *ao_none; +static GtkWidget *ao_oss; +static GtkWidget *ao_arts; +static GtkWidget *ao_esd; +static GtkWidget *ao_alsa; +static GtkWidget *ao_sdl; +static GtkWidget *entry_extra_opts; + +static GtkWidget *mplayer_configure_win = NULL; + +void mplayer_destroyed_conf_win(GtkWidget *widget, gpointer data) { + mplayer_configure_win = NULL; +} + + +void on_btn_cancel_clicked(GtkButton *button, gpointer user_data){ + gtk_widget_destroy(mplayer_configure_win); + mplayer_configure_win=NULL; +} + + +void on_btn_ok_clicked (GtkButton *button, gpointer user_data){ + RcFile *cfg; + struct mplayer_cfg new_cfg; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_none))) + new_cfg.vo=MPLAYER_VO_NONE; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_xv))) + new_cfg.vo=MPLAYER_VO_XV; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_x11))) + new_cfg.vo=MPLAYER_VO_X11; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_gl))) + new_cfg.vo=MPLAYER_VO_GL; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vo_sdl))) + new_cfg.vo=MPLAYER_VO_SDL; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_none))) + new_cfg.ao=MPLAYER_AO_NONE; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_oss))) + new_cfg.ao=MPLAYER_AO_OSS; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_arts))) + new_cfg.ao=MPLAYER_AO_ARTS; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_esd))) + new_cfg.ao=MPLAYER_AO_ESD; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_alsa))) + new_cfg.ao=MPLAYER_AO_ALSA; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ao_sdl))) + new_cfg.ao=MPLAYER_AO_SDL; + new_cfg.zoom=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_zoom)); + new_cfg.framedrop= + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_framedrop)); + new_cfg.idx=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_idx)); + new_cfg.onewin=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_onewin)); + new_cfg.xmmsaudio=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_xmmsaudio)); + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_xmmsaudio))) + new_cfg.ao=MPLAYER_AO_XMMS; + new_cfg.extra=gtk_entry_get_text(GTK_ENTRY(entry_extra_opts)); + +// cfg = xmms_cfg_open_default_file(); + cfg=bmp_rcfile_open("what"); + bmp_rcfile_write_int(cfg,"xmms-mplayer","vo",new_cfg.vo); + bmp_rcfile_write_int(cfg,"xmms-mplayer","ao",new_cfg.ao); + bmp_rcfile_write_boolean(cfg,"xmms-mplayer","zoom",new_cfg.zoom); + bmp_rcfile_write_boolean(cfg,"xmms-mplayer","framedrop",new_cfg.framedrop); + bmp_rcfile_write_boolean(cfg,"xmms-mplayer","idx",new_cfg.idx); + bmp_rcfile_write_boolean(cfg,"xmms-mplayer","onewin",new_cfg.onewin); + bmp_rcfile_write_boolean(cfg,"xmms-mplayer","xmmsaudio",new_cfg.xmmsaudio); + bmp_rcfile_write_string(cfg,"xmms-mplayer","extra",new_cfg.extra); + bmp_rcfile_write(cfg, "what"); +// xmms_cfg_write_default_file(cfg); + bmp_rcfile_free(cfg); + + gtk_widget_destroy(mplayer_configure_win); + mplayer_configure_win=NULL; +} + + +GtkWidget* +mplayer_create_configure_win (void) +{ + GtkWidget *window1; + GtkWidget *scrolledwindow1; + GtkWidget *layout1; + GtkWidget *notebook1; + GtkWidget *scrolledwindow2; + GtkWidget *layout2; + GSList *layout2_group = NULL; + GtkWidget *label_vo; + GtkWidget *scrolledwindow3; + GtkWidget *layout3; + GSList *layout3_group = NULL; + GtkWidget *label_ao; + GtkWidget *scrolledwindow4; + GtkWidget *layout4; + GtkWidget *label_other; + GtkWidget *scrolledwindow5; + GtkWidget *layout5; + GtkWidget *label_extra_des; + GtkWidget *label_extra; + GtkWidget *btn_ok; + GtkWidget *btn_cancel; + + window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_object_set_data (GTK_OBJECT (window1), "window1", window1); + gtk_window_set_title (GTK_WINDOW (window1), "Xmms-Mplayer"); + gtk_widget_set_usize (window1, 550, 430); + + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_ref (scrolledwindow1); + gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow1", scrolledwindow1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow1); + gtk_container_add (GTK_CONTAINER (window1), scrolledwindow1); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + layout1 = gtk_layout_new (NULL, NULL); + gtk_widget_ref (layout1); + gtk_object_set_data_full (GTK_OBJECT (window1), "layout1", layout1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (layout1); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), layout1); + gtk_layout_set_size (GTK_LAYOUT (layout1), 336, 235); + GTK_ADJUSTMENT (GTK_LAYOUT (layout1)->hadjustment)->step_increment = 10; + GTK_ADJUSTMENT (GTK_LAYOUT (layout1)->vadjustment)->step_increment = 10; + + notebook1 = gtk_notebook_new (); + gtk_widget_ref (notebook1); + gtk_object_set_data_full (GTK_OBJECT (window1), "notebook1", notebook1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (notebook1); + gtk_layout_put (GTK_LAYOUT (layout1), notebook1, 24, 24); + gtk_widget_set_usize (notebook1, 496, 336); + + scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_ref (scrolledwindow2); + gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow2", scrolledwindow2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow2); + gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow2); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + layout2 = gtk_layout_new (NULL, NULL); + gtk_widget_ref (layout2); + gtk_object_set_data_full (GTK_OBJECT (window1), "layout2", layout2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (layout2); + gtk_container_add (GTK_CONTAINER (scrolledwindow2), layout2); + gtk_layout_set_size (GTK_LAYOUT (layout2), 384, 296); + GTK_ADJUSTMENT (GTK_LAYOUT (layout2)->hadjustment)->step_increment = 10; + GTK_ADJUSTMENT (GTK_LAYOUT (layout2)->vadjustment)->step_increment = 10; + + vo_none = gtk_radio_button_new_with_label (layout2_group, "Automatic (MPlayer Chooses)"); + layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_none)); + gtk_widget_ref (vo_none); + gtk_object_set_data_full (GTK_OBJECT (window1), "vo_none", vo_none, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vo_none); + gtk_layout_put (GTK_LAYOUT (layout2), vo_none, 24, 32); + gtk_widget_set_usize (vo_none, 336, 24); + + vo_xv = gtk_radio_button_new_with_label (layout2_group, "Xvideo"); + layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_xv)); + gtk_widget_ref (vo_xv); + gtk_object_set_data_full (GTK_OBJECT (window1), "vo_xv", vo_xv, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vo_xv); + gtk_layout_put (GTK_LAYOUT (layout2), vo_xv, 24, 64); + gtk_widget_set_usize (vo_xv, 96, 24); + + vo_x11 = gtk_radio_button_new_with_label (layout2_group, "X11"); + layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_x11)); + gtk_widget_ref (vo_x11); + gtk_object_set_data_full (GTK_OBJECT (window1), "vo_x11", vo_x11, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vo_x11); + gtk_layout_put (GTK_LAYOUT (layout2), vo_x11, 24, 104); + gtk_widget_set_usize (vo_x11, 96, 24); + + vo_gl = gtk_radio_button_new_with_label (layout2_group, "GL"); + layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_gl)); + gtk_widget_ref (vo_gl); + gtk_object_set_data_full (GTK_OBJECT (window1), "vo_gl", vo_gl, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vo_gl); + gtk_layout_put (GTK_LAYOUT (layout2), vo_gl, 24, 144); + gtk_widget_set_usize (vo_gl, 96, 24); + + vo_sdl = gtk_radio_button_new_with_label (layout2_group, "SDL"); + layout2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (vo_sdl)); + gtk_widget_ref (vo_sdl); + gtk_object_set_data_full (GTK_OBJECT (window1), "vo_sdl", vo_sdl, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vo_sdl); + gtk_layout_put (GTK_LAYOUT (layout2), vo_sdl, 24, 184); + gtk_widget_set_usize (vo_sdl, 96, 24); + + label_vo = gtk_label_new ("Video Out"); + gtk_widget_ref (label_vo); + gtk_object_set_data_full (GTK_OBJECT (window1), "label_vo", label_vo, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label_vo); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label_vo); + + scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_ref (scrolledwindow3); + gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow3", scrolledwindow3, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow3); + gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow3); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + layout3 = gtk_layout_new (NULL, NULL); + gtk_widget_ref (layout3); + gtk_object_set_data_full (GTK_OBJECT (window1), "layout3", layout3, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (layout3); + gtk_container_add (GTK_CONTAINER (scrolledwindow3), layout3); + gtk_layout_set_size (GTK_LAYOUT (layout3), 382, 295); + GTK_ADJUSTMENT (GTK_LAYOUT (layout3)->hadjustment)->step_increment = 10; + GTK_ADJUSTMENT (GTK_LAYOUT (layout3)->vadjustment)->step_increment = 10; + + ao_none = gtk_radio_button_new_with_label (layout3_group, "Automatic (MPlayer Chooses)"); + layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_none)); + gtk_widget_ref (ao_none); + gtk_object_set_data_full (GTK_OBJECT (window1), "ao_none", ao_none, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (ao_none); + gtk_layout_put (GTK_LAYOUT (layout3), ao_none, 24, 32); + gtk_widget_set_usize (ao_none, 272, 24); + + ao_oss = gtk_radio_button_new_with_label (layout3_group, "OSS"); + layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_oss)); + gtk_widget_ref (ao_oss); + gtk_object_set_data_full (GTK_OBJECT (window1), "ao_oss", ao_oss, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (ao_oss); + gtk_layout_put (GTK_LAYOUT (layout3), ao_oss, 24, 64); + gtk_widget_set_usize (ao_oss, 96, 24); + + ao_arts = gtk_radio_button_new_with_label (layout3_group, "ARTS"); + layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_arts)); + gtk_widget_ref (ao_arts); + gtk_object_set_data_full (GTK_OBJECT (window1), "ao_arts", ao_arts, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (ao_arts); + gtk_layout_put (GTK_LAYOUT (layout3), ao_arts, 24, 96); + gtk_widget_set_usize (ao_arts, 96, 24); + + ao_esd = gtk_radio_button_new_with_label (layout3_group, "ESD"); + layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_esd)); + gtk_widget_ref (ao_esd); + gtk_object_set_data_full (GTK_OBJECT (window1), "ao_esd", ao_esd, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (ao_esd); + gtk_layout_put (GTK_LAYOUT (layout3), ao_esd, 24, 128); + gtk_widget_set_usize (ao_esd, 96, 24); + + ao_alsa = gtk_radio_button_new_with_label (layout3_group, "ALSA"); + layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_alsa)); + gtk_widget_ref (ao_alsa); + gtk_object_set_data_full (GTK_OBJECT (window1), "ao_alsa", ao_alsa, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (ao_alsa); + gtk_layout_put (GTK_LAYOUT (layout3), ao_alsa, 24, 160); + gtk_widget_set_usize (ao_alsa, 103, 24); + + ao_sdl = gtk_radio_button_new_with_label (layout3_group, "SDL"); + layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (ao_sdl)); + gtk_widget_ref (ao_sdl); + gtk_object_set_data_full (GTK_OBJECT (window1), "ao_sdl", ao_sdl, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (ao_sdl); + gtk_layout_put (GTK_LAYOUT (layout3), ao_sdl, 24, 192); + gtk_widget_set_usize (ao_sdl, 103, 24); + + opt_xmmsaudio = gtk_radio_button_new_with_label (layout3_group, "XMMS Output Plugin (Experimental)"); + layout3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (opt_xmmsaudio)); + gtk_widget_ref (opt_xmmsaudio); + gtk_object_set_data_full (GTK_OBJECT (window1), "opt_xmmsaudio", opt_xmmsaudio, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opt_xmmsaudio); + gtk_layout_put (GTK_LAYOUT (layout3), opt_xmmsaudio, 24, 224); + gtk_widget_set_usize (opt_xmmsaudio, 272, 24); + + label_ao = gtk_label_new ("Audio Out"); + gtk_widget_ref (label_ao); + gtk_object_set_data_full (GTK_OBJECT (window1), "label_ao", label_ao, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label_ao); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label_ao); + + scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_ref (scrolledwindow4); + gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow4", scrolledwindow4, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow4); + gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow4); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + layout4 = gtk_layout_new (NULL, NULL); + gtk_widget_ref (layout4); + gtk_object_set_data_full (GTK_OBJECT (window1), "layout4", layout4, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (layout4); + gtk_container_add (GTK_CONTAINER (scrolledwindow4), layout4); + gtk_layout_set_size (GTK_LAYOUT (layout4), 377, 272); + GTK_ADJUSTMENT (GTK_LAYOUT (layout4)->hadjustment)->step_increment = 10; + GTK_ADJUSTMENT (GTK_LAYOUT (layout4)->vadjustment)->step_increment = 10; + + opt_zoom = gtk_check_button_new_with_label ("Software Zoom"); + gtk_widget_ref (opt_zoom); + gtk_object_set_data_full (GTK_OBJECT (window1), "opt_zoom", opt_zoom, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opt_zoom); + gtk_layout_put (GTK_LAYOUT (layout4), opt_zoom, 24, 32); + gtk_widget_set_usize (opt_zoom, 168, 24); + + opt_framedrop = gtk_check_button_new_with_label ("Frame Dropping"); + gtk_widget_ref (opt_framedrop); + gtk_object_set_data_full (GTK_OBJECT (window1), "opt_framedrop", opt_framedrop, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opt_framedrop); + gtk_layout_put (GTK_LAYOUT (layout4), opt_framedrop, 24, 72); + gtk_widget_set_usize (opt_framedrop, 136, 24); + + opt_idx = gtk_check_button_new_with_label ("Build Index"); + gtk_widget_ref (opt_idx); + gtk_object_set_data_full (GTK_OBJECT (window1), "opt_idx", opt_idx, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opt_idx); + gtk_layout_put (GTK_LAYOUT (layout4), opt_idx, 24, 112); + gtk_widget_set_usize (opt_idx, 102, 24); + + opt_onewin = gtk_check_button_new_with_label ("One Window (Experimental)"); + gtk_widget_ref (opt_onewin); + gtk_object_set_data_full (GTK_OBJECT (window1), "opt_onewin", opt_onewin, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opt_onewin); + gtk_layout_put (GTK_LAYOUT (layout4), opt_onewin, 24, 152); + gtk_widget_set_usize (opt_onewin, 240, 24); + + label_other = gtk_label_new ("Other"); + gtk_widget_ref (label_other); + gtk_object_set_data_full (GTK_OBJECT (window1), "label_other", label_other, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label_other); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label_other); + + scrolledwindow5 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_ref (scrolledwindow5); + gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow5", scrolledwindow5, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow5); + gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow5); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow5), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + layout5 = gtk_layout_new (NULL, NULL); + gtk_widget_ref (layout5); + gtk_object_set_data_full (GTK_OBJECT (window1), "layout5", layout5, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (layout5); + gtk_container_add (GTK_CONTAINER (scrolledwindow5), layout5); + gtk_layout_set_size (GTK_LAYOUT (layout5), 346, 267); + GTK_ADJUSTMENT (GTK_LAYOUT (layout5)->hadjustment)->step_increment = 10; + GTK_ADJUSTMENT (GTK_LAYOUT (layout5)->vadjustment)->step_increment = 10; + + entry_extra_opts = gtk_entry_new (); + gtk_widget_ref (entry_extra_opts); + gtk_object_set_data_full (GTK_OBJECT (window1), "entry_extra_opts", entry_extra_opts, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (entry_extra_opts); + gtk_layout_put (GTK_LAYOUT (layout5), entry_extra_opts, 40, 192); + gtk_widget_set_usize (entry_extra_opts, 392, 24); + + label_extra_des = gtk_label_new ("Extra options for mplayer can be added here.\nParsing is done based on spaces.\nQuotes and escapes are not recognised yet."); + gtk_widget_ref (label_extra_des); + gtk_object_set_data_full (GTK_OBJECT (window1), "label_extra_des", label_extra_des, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label_extra_des); + gtk_layout_put (GTK_LAYOUT (layout5), label_extra_des, 40, 48); + gtk_widget_set_usize (label_extra_des, 392, 128); + gtk_label_set_justify (GTK_LABEL (label_extra_des), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (label_extra_des), 0.18, 1); + + label_extra = gtk_label_new ("Extra"); + gtk_widget_ref (label_extra); + gtk_object_set_data_full (GTK_OBJECT (window1), "label_extra", label_extra, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label_extra); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), label_extra); + + btn_ok = gtk_button_new_with_label ("OK"); + gtk_widget_ref (btn_ok); + gtk_object_set_data_full (GTK_OBJECT (window1), "btn_ok", btn_ok, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (btn_ok); + gtk_layout_put (GTK_LAYOUT (layout1), btn_ok, 432, 376); + gtk_widget_set_usize (btn_ok, 88, 32); + + btn_cancel = gtk_button_new_with_label ("Cancel"); + gtk_widget_ref (btn_cancel); + gtk_object_set_data_full (GTK_OBJECT (window1), "btn_cancel", btn_cancel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (btn_cancel); + gtk_layout_put (GTK_LAYOUT (layout1), btn_cancel, 24, 376); + gtk_widget_set_usize (btn_cancel, 88, 30); + + gtk_signal_connect(GTK_OBJECT(window1), + "destroy", + GTK_SIGNAL_FUNC(mplayer_destroyed_conf_win), + NULL); + + gtk_signal_connect (GTK_OBJECT (btn_ok), "clicked", + GTK_SIGNAL_FUNC (on_btn_ok_clicked), + NULL); + gtk_signal_connect (GTK_OBJECT (btn_cancel), "clicked", + GTK_SIGNAL_FUNC (on_btn_cancel_clicked), + NULL); + return window1; +} + +void mplayer_configure(){ + struct mplayer_cfg *cfg; + if (mplayer_configure_win) + return; + mplayer_configure_win=mplayer_create_configure_win(); + gtk_widget_show(mplayer_configure_win); + cfg=mplayer_read_cfg(); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_zoom),cfg->zoom); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_framedrop),cfg->framedrop); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_idx),cfg->idx); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_onewin),cfg->onewin); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (opt_xmmsaudio),cfg->xmmsaudio); + + switch(cfg->vo){ + case MPLAYER_VO_NONE: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_none), TRUE); + break; + case MPLAYER_VO_XV: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_xv), TRUE); + break; + case MPLAYER_VO_X11: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_x11), TRUE); + break; + case MPLAYER_VO_GL: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_gl), TRUE); + break; + case MPLAYER_VO_SDL: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vo_sdl), TRUE); + break; + } + switch(cfg->ao){ + case MPLAYER_AO_NONE: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_none), TRUE); + break; + case MPLAYER_AO_OSS: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_oss), TRUE); + break; + case MPLAYER_AO_ARTS: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_arts), TRUE); + break; + case MPLAYER_AO_ESD: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_esd), TRUE); + break; + case MPLAYER_AO_SDL: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_sdl), TRUE); + break; + case MPLAYER_AO_ALSA: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ao_alsa), TRUE); + break; + } + gtk_entry_set_text(GTK_ENTRY(entry_extra_opts),cfg->extra); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/xmmsmplayer.c Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,591 @@ +#include <gtk/gtk.h> +#include <gdk/gdk.h> +#include <gdk/gdkx.h> +#include <glib.h> + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <pthread.h> +#include <audacious/plugin.h> +#include <audacious/beepctrl.h> +#include <audacious/rcfile.h> +#include <audacious/util.h> +#include <unistd.h> + +#include <fcntl.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <sys/types.h> + +#include <stdio.h> +#include <sys/wait.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xos.h> +#include <X11/Xatom.h> +#include <X11/keysym.h> +#include <assert.h> + +#include <X11/Xmd.h> + + +#include "xmmsmplayer.h" +static Atom XA_WIN_LAYER; +static Atom XA_NET_WM_STATE; +static Atom XA_NET_WM_STATE_FULLSCREEN; +static Atom XA_NET_WM_STATE_ABOVE; +static Atom XA_NET_WM_STATE_STAYS_ON_TOP; +static Atom XA_NET_WM_STATE_BELOW; + +static Window mplayer_video = 0; +static gchar mplayer_wid[16]; + +static int mplayer_pipe[2]; /* Control mplayer thru this pipe */ +static pthread_t mplayer_tid; /* Thread id */ +static gchar *mplayer_file=NULL; /* filename */ +static struct mplayer_info *mplayer_current_info=NULL; +static gint mplayer_current_time=0; /* to be returned to xmms */ + +static char *mplayer_fifoname=NULL; +static InputPlugin *mplayer_ip=NULL; /* Information to be returned to xmms */ +static gint mplayer_playing=0; +static struct mplayer_cfg *mplayer_current_cfg=NULL; +static Display *dis = NULL; + +InputPlugin *get_iplugin_info(void){ + if(!mplayer_ip){ + mplayer_ip=(InputPlugin *) malloc(sizeof (InputPlugin)); + memset(mplayer_ip,0,sizeof (InputPlugin)); + mplayer_ip->description = strdup("MPlayer Plugin for Xmms"); + mplayer_ip->init = mplayer_init; + mplayer_ip->is_our_file = mplayer_is_our_file; + mplayer_ip->play_file = mplayer_play_file; + mplayer_ip->stop = mplayer_stop; + mplayer_ip->pause = mplayer_pause; + mplayer_ip->seek = mplayer_seek; + mplayer_ip->get_time = mplayer_get_time; + mplayer_ip->get_song_info = mplayer_get_song_info; + mplayer_ip->set_info = NULL; + mplayer_ip->cleanup = mplayer_cleanup; + mplayer_ip->about = mplayer_about; + mplayer_ip->configure = mplayer_configure; + + } + return mplayer_ip; +} + +void mplayer_init(){ + /*Add read configure!! */ + + /*mplayer_playing=0;*/ +} +int mplayer_is_our_file(char *filename){ + gchar *ext; + ext = strrchr(filename, '.'); + if (ext){ + if((!strcasecmp(ext, ".mpg")) || + (!strcasecmp(ext, ".mpeg")) || + (!strcasecmp(ext, ".divx")) || + (!strcasecmp(ext, ".qt")) || + (!strcasecmp(ext, ".mov")) || + (!strcasecmp(ext, ".mp2")) || + (!strcasecmp(ext, ".mpa")) || + (!strcasecmp(ext, ".dat")) || + (!strcasecmp(ext, ".rm")) || + (!strcasecmp(ext, ".swf")) || + (!strcasecmp(ext, ".wma")) || + (!strcasecmp(ext, ".wmv")) || + (!strcasecmp(ext, ".wmp")) || + (!strcasecmp(ext, ".asf")) || + (!strcasecmp(ext, ".avi")) + ) return TRUE; + } + return FALSE; +} +void mplayer_play_file(char *filename){ + pthread_attr_t tattr; + void *arg; + int ret,pipe_ret; + gchar temp[10]; + gchar *username; + + mplayer_debugf("debug-play-in\n"); + mplayer_file=filename; + pipe_ret=pipe(mplayer_pipe); + + if(mplayer_current_info)g_free(mplayer_current_info); + mplayer_current_info = mplayer_read_file_info(filename); + mplayer_debugf("Setting info:\n%sTerm\n%i\n%i\n%i\n%i\n\n", + mplayer_current_info->caption, + mplayer_current_info->length * 1000, + mplayer_current_info->abr, + mplayer_current_info->rate, + mplayer_current_info->nch); + mplayer_debugf("debug-play-fileinfo-done\n"); + /* usleep(100000);*/ + mplayer_ip->set_info(mplayer_current_info->caption, + mplayer_current_info->length * 1000, + mplayer_current_info->abr, + mplayer_current_info->rate, + mplayer_current_info->nch); + mplayer_debugf("debug-play-sent-info\n"); + mplayer_debugf("debug- reading configfile\n"); + if (mplayer_current_cfg){ + g_free(mplayer_current_cfg->extra); + g_free(mplayer_current_cfg); + } + mplayer_current_cfg=mplayer_read_cfg(); + if(mplayer_current_cfg->onewin &&(!mplayer_video)){ +/* mplayer_video=gtk_window_new(GTK_WINDOW_DIALOG); + gtk_widget_set_usize(GTK_WIDGET(mplayer_video), 320, 240); + gtk_window_set_title(GTK_WINDOW(mplayer_video), "XMMS - MPlayer"); + gtk_signal_connect(GTK_OBJECT(mplayer_video), + "destroy", + GTK_SIGNAL_FUNC(mplayer_quitting_video), + NULL); + gtk_widget_show(mplayer_video); + sprintf(mplayer_wid,"%i",GDK_WINDOW_XWINDOW(mplayer_video->window)); +*/ + if(!dis) dis = XOpenDisplay(NULL); + assert(dis); + XEvent report; + int blackColor = BlackPixel(dis, DefaultScreen(dis)); + int whiteColor = WhitePixel(dis, DefaultScreen(dis)); + mplayer_video = XCreateSimpleWindow(dis, DefaultRootWindow(dis), 0, 0, + 320, 240, 0, blackColor, blackColor); + XMapWindow(dis,mplayer_video); + XFlush(dis); + XSelectInput (dis, mplayer_video, KeyPressMask); + sprintf(mplayer_wid,"%i",mplayer_video); + } + if((!mplayer_current_cfg->onewin) &&(mplayer_video)){ + XDestroyWindow(dis,mplayer_video); + mplayer_video=0; + mplayer_wid[0]='\0'; + } + if(mplayer_current_cfg->xmmsaudio){ + if(!mplayer_fifoname){ + username = getenv("LOGNAME"); + if(!username)username = getenv("USERNAME"); + if(!username)username = getenv("USER"); + sprintf(temp,"%i",getpid()); + if (!username)mplayer_fifoname=g_strconcat("/tmp/xmmsmplayer-",temp,(char*)0); + else mplayer_fifoname=g_strconcat("/tmp/xmmsmplayer-",username,"-",temp,(char*)0); + mkfifo(mplayer_fifoname,0600); + } + mplayer_ip->output->open_audio(FMT_S16_LE, + mplayer_current_info->rate, + mplayer_current_info->nch); + } + mplayer_debugf("debug- read configfile\n"); + if (mplayer_playing==1) mplayer_debugf("Duplicate call!! -- Panic \n"); + else mplayer_playing=1; + mplayer_debugf("debug-play-creating-thread\n"); + ret = pthread_create(&mplayer_tid, NULL, mplayer_play_loop, arg); + mplayer_debugf("debug-play-out\n\n"); +} + +void mplayer_stop(){ + int ret; + if (mplayer_playing==0) mplayer_debugf("Confusion: Restopped!\n"); + else { + mplayer_playing=0; + if(mplayer_current_cfg->xmmsaudio)mplayer_ip->output->close_audio(); + if (write(mplayer_pipe[1],"quit\n",5)==5){ + mplayer_debugf("debug-stop-if\n"); + }; + mplayer_debugf("debug-stop\n"); + ret = pthread_join(mplayer_tid, NULL); + mplayer_debugf("debug-stop\n\n"); + } +} + +void mplayer_cleanup(){ + if (mplayer_playing) mplayer_stop(); + if (mplayer_fifoname){ + remove(mplayer_fifoname); + g_free(mplayer_fifoname); + mplayer_fifoname=NULL; + } + +} + +void mplayer_pause(short p){ + write(mplayer_pipe[1],"pause\n",6); +} + +void mplayer_seek(int t){ + char buff[16]; + if(mplayer_playing){ + sprintf(buff,"seek %i\n",(t - mplayer_current_time)); + write(mplayer_pipe[1],buff,strlen(buff)); + } +} + +gint mplayer_get_time(){ + return (mplayer_current_time*1000) ; +} +void mplayer_get_song_info(char * filename, char ** title, int * length){ + struct mplayer_info *info; + char *temp,*name; + info = mplayer_read_file_info(filename); + *title = g_strdup(info->caption); + *length = (info->length * 1000); + g_free(info); +} + +void *mplayer_play_loop(void *arg){ + char buff[35]; + int mplayer_slave_pid; + int i,read_length,playtime,one_read; + int mplayer_status_pipe[2]; + int mplayer_error_stream; + int mplayer_fifo_fd; + int pipe_ret; + char **params; + char audio_buff[MPLAYER_AUDIO_SIZE]; + int audio_buff_read; + gboolean audio_flag, status_flag; + struct timespec nanotime; + nanotime.tv_sec=0; + nanotime.tv_nsec=1; + + + pipe_ret=pipe(mplayer_status_pipe); + + if ((mplayer_slave_pid=vfork())==0){ + //close(mplayer_pipe[1]); + mplayer_debugf("debug Pre-exec!\n"); + mplayer_error_stream=open("/dev/null",0); + mplayer_debugf("debug Making vector\n"); + params=mplayer_make_vector(); + mplayer_debugf("debug Made vector\n"); + close(0); + close(1); + close(2); + if(dup2(mplayer_pipe[0],0)!=0) mplayer_debugf("duplication error\n"); + if(dup2(mplayer_status_pipe[1],1)!=0) mplayer_debugf("duplication error\n"); + if(dup2(mplayer_error_stream,2)!=0) mplayer_debugf("duplication error\n"); + /*i=execlp("mplayer","mplayer","-vo","x11","-zoom","-sws","2","-framedrop","-slave","-wid",mplayer_wid,mplayer_file,(char *)0);*/ + i=execvp("mplayer",params); + mplayer_debugf("Fatal Error: Couldnt start MPlayer! exec returned %i\n",i); + _exit(-1); + } + else{ + close(mplayer_status_pipe[1]); /* EXTREMELY IMPORTANT, a little tricky! */ + close(mplayer_pipe[0]); + if(mplayer_current_cfg->xmmsaudio){ + mplayer_debugf("debug - Opening fifo...\n"); + mplayer_fifo_fd=open(mplayer_fifoname,O_RDONLY); + mplayer_debugf("debug - Opened fifo\n"); + fcntl(mplayer_status_pipe[0],F_SETFL,O_NDELAY); + } + audio_buff_read=-1; + read_length=-1; + one_read=-1; + while((wait3((union wait *)0,WNOHANG,(struct rusage *)0)!=mplayer_slave_pid)&&(mplayer_playing==1)){ + audio_flag=FALSE; + status_flag=FALSE; + /* Window event code here */ + if(mplayer_current_cfg->xmmsaudio){ + // do{ + + /* mplayer_debugf("debug - reading fifo...\n");*/ + audio_buff_read=read(mplayer_fifo_fd,audio_buff,MPLAYER_AUDIO_SIZE); + if (audio_buff_read==0) break; + if (audio_buff_read>0){ + mplayer_ip->output->write_audio(audio_buff,audio_buff_read); + /*mplayer_ip->add_vis_pcm();*/ + audio_flag=TRUE; + mplayer_debugf(" %i ",audio_buff_read); + } + //} + //while(audio_buff_read>0); + } + do{ + if(mplayer_current_cfg->onewin ){ + XEvent report; + if(XCheckWindowEvent(dis,mplayer_video,KeyPressMask, &report)){ + if (XLookupKeysym(&report.xkey, 0) == XK_f){ + fprintf (stdout, "The f was pressed.\n"); + XMoveResizeWindow(dis,mplayer_video,0,0,1280,1024); + XMapRaised(dis,mplayer_video); + XRaiseWindow(dis,mplayer_video); + XSetTransientForHint(dis,mplayer_video, RootWindow(dis,0)); + + XClientMessageEvent xev; + char *state; + + memset( &xev,0,sizeof( xev ) ); + xev.type=ClientMessage; + xev.message_type=XA_WIN_LAYER; + xev.display=dis; + xev.window=mplayer_video; + xev.format=32; + xev.data.l[0]=10; + xev.data.l[1]=CurrentTime; + XSendEvent( dis,RootWindow( dis,0),False,SubstructureRedirectMask,(XEvent*)&xev ); + + +fprintf(stdout,"Cleared 1\n"); +XSetWindowAttributes attr; + attr.override_redirect = True; + XChangeWindowAttributes(dis,mplayer_video, CWOverrideRedirect, &attr); + + XFlush(dis); + + } + } + } + one_read= read(mplayer_status_pipe[0],buff+read_length,1); + if (one_read==0) break; + if (one_read > 0) { + status_flag=TRUE; + if ((buff[read_length]==(char)13)||(buff[read_length]==(char)10)) read_length=0; + if (read_length < 32 ) read_length++; + if (read_length >= 16){ + sscanf(buff+3,"%i",&playtime); + mplayer_current_time=playtime; + } + } + } + while (one_read>0); + + /* + audio_buff_read=0; + if(mplayer_current_cfg->xmmsaudio){ + mplayer_debugf("debug - reading fifo...\n"); + + audio_buff_read=read(mplayer_fifo_fd,audio_buff,MPLAYER_AUDIO_SIZE); + if (audio_buff_read>0)mplayer_ip->output->write_audio(audio_buff,audio_buff_read); + } + read_length=read(mplayer_status_pipe[0],buff,1); + if(read_length>0){ + if ((buff[0]==(char)13)||(buff[0]==(char)10) ) { + one_read=1; + read_length=0; + while((read_length<16)&&(one_read>0)) { + audio_buff_read=0; + if(mplayer_current_cfg->xmmsaudio){ + mplayer_debugf("debug - readin fifo...\n"); + audio_buff_read=read(mplayer_fifo_fd,audio_buff,MPLAYER_AUDIO_SIZE); + mplayer_debugf("debug - read fifo...%i\n", audio_buff_read); + if (audio_buff_read>0)mplayer_ip->output->write_audio(audio_buff,audio_buff_read); + } + mplayer_debugf("debug - readin status...\n"); + one_read= read(mplayer_status_pipe[0],buff+read_length,16-read_length); + read_length += one_read; + if ((audio_buff_read <= 0)&&(one_read <= 0)) usleep(5); + } + sscanf(buff+3,"%i",&playtime); + mplayer_current_time=playtime;} + + } + else if ((audio_buff_read <= 0)&&(read_length <= 0)) usleep(5); + */ + + //else if (read_length == -1) break; + } + if (mplayer_playing==1){ + if(mplayer_current_cfg->xmmsaudio)mplayer_ip->output->close_audio(); + mplayer_playing=0; + xmms_remote_playlist_next(ctrlsocket_get_session_id()); + } + // if (mplayer_dont_spawn) mplayer_dont_spawn=0; + // else xmms_remote_playlist_next(ctrlsocket_get_session_id()); + pthread_exit(NULL); + } +} + + +struct mplayer_info *mplayer_read_file_info(char *filename){ + struct mplayer_info *info; + int datalength,done=0; + FILE *inquiry, *size_query; + char mplayer_command[256]; + char buff[4096]; + char *temp; + info=(struct mplayer_info *)malloc(sizeof(struct mplayer_info)); + memset((char *)info,0,sizeof(struct mplayer_info)); + sprintf(mplayer_command,"mplayer -slave -identify -vo null -ao null -frames 0 \"%s\" 2> /dev/null",filename); + inquiry=popen(mplayer_command,"r"); + done=0; + while((!feof(inquiry)) && (done <4000) ){ + fscanf(inquiry,"%c",(buff+done)); + done++; + } + buff[done]=(char)0; + pclose(inquiry); + mplayer_debugf("debug-id\n"); + temp=strstr(buff,"Name:"); + if (temp) mplayer_read_to_eol(info->title,temp+5); + mplayer_debugf("debug-id\n"); + temp=strstr(buff,"Artist:"); + if (temp) mplayer_read_to_eol(info->artist,temp+7); + mplayer_debugf("debug-id\n"); + temp=strstr(buff,"ID_VIDEO_BITRATE="); + if (temp) sscanf(temp+strlen("ID_VIDEO_BITRATE=") ,"%i",&(info->vbr)); + temp=strstr(buff,"ID_VIDEO_WIDTH="); + if (temp) sscanf(temp+strlen("ID_VIDEO_WIDTH=") ,"%i",&(info->x)); + temp=strstr(buff,"ID_VIDEO_HEIGHT="); + if (temp) sscanf(temp+strlen("ID_VIDEO_HEIGHT=") ,"%i",&(info->y)); + temp=strstr(buff,"ID_AUDIO_BITRATE="); + if (temp) sscanf(temp+strlen("ID_AUDIO_BITRATE="),"%i",&(info->abr)); + info->br = info->abr + info->vbr; + temp=strstr(buff,"ID_AUDIO_RATE="); + if (temp) sscanf(temp+strlen("ID_AUDIO_RATE="),"%i",&(info->rate)); + temp=strstr(buff,"ID_AUDIO_NCH="); + if (temp) sscanf(temp+strlen("ID_AUDIO_NCH="),"%i",&(info->nch)); + temp=strstr(buff,"ID_LENGTH="); + if (temp) sscanf(temp+strlen("ID_LENGTH="),"%i",&(info->length)); + else{ + sprintf(mplayer_command,"du -b \"%s\" ",filename); + size_query=popen(mplayer_command,"r"); + fscanf(size_query,"%i",&(info->filesize)); + pclose(size_query); + if (info->br > 0) info->length=((info->filesize * 8)/(info->br));} + mplayer_debugf("debug-id\n"); + info->filename=filename; + if((strlen(info->artist)+strlen(info->title)>0)){ + sprintf(info->caption,"%s - %s",info->artist,info->title);} + else{ + temp = g_strdup(g_basename(filename)); + strcpy(info->caption,temp); + free(temp); + if ((temp = strrchr(info->caption, '.')) != NULL) + *temp = '\0'; + } + mplayer_debugf("debug-id\n\n"); + return info; +} + +char **mplayer_make_vector(){ /*To be passed to exec*/ + char** vector; + char** temp; + int i=0; + vector =(char **)malloc(sizeof(char*)*MPLAYER_MAX_VECTOR); + memset(vector,0,sizeof(char*)*MPLAYER_MAX_VECTOR); + mplayer_vector_append(vector,"mplayer"); + mplayer_vector_append(vector,"-slave"); + if(mplayer_current_cfg->vo){ + mplayer_vector_append(vector,"-vo"); + switch(mplayer_current_cfg->vo){ + case MPLAYER_VO_XV: + mplayer_vector_append(vector,"xv"); + break; + case MPLAYER_VO_X11: + mplayer_vector_append(vector,"x11"); + break; + case MPLAYER_VO_GL: + mplayer_vector_append(vector,"gl"); + break; + case MPLAYER_VO_SDL: + mplayer_vector_append(vector,"sdl"); + break; + } + } + if(mplayer_current_cfg->ao){ + mplayer_vector_append(vector,"-ao"); + switch( mplayer_current_cfg->ao){ + case MPLAYER_AO_OSS: + mplayer_vector_append(vector,"oss"); + break; + case MPLAYER_AO_ARTS: + mplayer_vector_append(vector,"arts"); + break; + case MPLAYER_AO_ESD: + mplayer_vector_append(vector,"esd"); + break; + case MPLAYER_AO_ALSA: + mplayer_vector_append(vector,"alsa"); + break; + case MPLAYER_AO_SDL: + mplayer_vector_append(vector,"sdl"); + break; + } + } + if(mplayer_current_cfg->zoom) mplayer_vector_append(vector,"-zoom"); + if(mplayer_current_cfg->framedrop)mplayer_vector_append(vector,"-framedrop"); + if(mplayer_current_cfg->idx) mplayer_vector_append(vector,"-idx"); + if(mplayer_current_cfg->onewin){ + mplayer_vector_append(vector,"-wid"); + mplayer_vector_append(vector,mplayer_wid);} + if(mplayer_current_cfg->xmmsaudio){ + mplayer_vector_append(vector,"-ao"); + mplayer_vector_append(vector,"pcm"); + mplayer_vector_append(vector,"-aofile"); + mplayer_vector_append(vector,mplayer_fifoname); + mplayer_vector_append(vector,"-autosync"); + mplayer_vector_append(vector,"10000"); + mplayer_vector_append(vector,"-nowaveheader"); + mplayer_vector_append(vector,"-format"); + mplayer_vector_append(vector,"128"); + } + if(mplayer_current_cfg->extra){ + mplayer_debugf("debug - adding extra options\n"); + temp= g_strsplit(mplayer_current_cfg->extra," ",0); + while(temp[i]){ + mplayer_vector_append(vector,temp[i]); + i++; + } + g_strfreev(temp); + } + + mplayer_vector_append(vector,mplayer_file); + return vector; +} +void mplayer_vector_append(char**vector,char*param){ + int i=0; + while(vector[i])i++; + if(i >= (MPLAYER_MAX_VECTOR -1)) { + mplayer_debugf("Too many arguments to mplayer!!\n"); + mplayer_debugf("Ignoring parameter: %s\n",param); + return; + } + mplayer_debugf("Adding parameter: %s\n",param); + vector[i]=strdup(param); +} + +void mplayer_read_to_eol(char *str1,char *str2){ + /* copy str2 to str1 till \n is reached in str2 */ + int i=0,j=0; + while(!((str2[j]=='\n')||(str2[j]==(char)0)||(str2[j]==(char)10)||(j>32) )) + str1[i++]=str2[j++]; + str1[i]=(char)0; +} + + +static void mplayer_about(void) +{ + static GtkWidget *window = NULL; + if (window) + return; + + window = xmms_show_message( + "About " PACKAGE, + PACKAGE " " VERSION "\n" + "Author: " " Nandan Dixit " " <nandan@cse.iitb.ac.in>" "\n" + "http://xmmsmplayer.sourceforge.net/" "\n" + "Ported to Audacious: " " Aaron Sheldon " "\n" + "http://audacious-media-player.org/" "\n" + "This library is free software; you can redistribute it and/or\n" + "modify it under the terms of the GNU Library General Public\n", + "Ok", FALSE, NULL, NULL); + + gtk_signal_connect(GTK_OBJECT(window), "destroy", + GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window); + + gtk_widget_show(window); + +} +/* +void mplayer_quitting_video(GtkWidget *widget, gpointer data) { + mplayer_debugf("debug - entered quitting_video\n"); + if(widget==mplayer_video){ + mplayer_debugf("debug - correct widget\n"); + mplayer_video=NULL; + mplayer_wid[0]='\0'; + } +} +*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mplayer/xmmsmplayer.h Sat Oct 28 18:08:06 2006 -0700 @@ -0,0 +1,89 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <string.h> + +//#include <iconv.h> +//#include <libintl.h> + +#include <glib.h> +#include <gtk/gtk.h> +#include <gdk/gdk.h> +#include <gdk/gdkx.h> +#include <audacious/plugin.h> +#include <audacious/beepctrl.h> +#include <audacious/rcfile.h> +#include <audacious/util.h> +#include <time.h> + +#define MPLAYER_INFO_SIZE 128 +#define MPLAYER_TITLE_SIZE 260 +#define MPLAYER_AUDIO_SIZE 4096 +#define MPLAYER_MAX_VECTOR 64 + +/* For debugging output change the define below */ +#define mplayer_debugf +/* #define mplayer_debugf printf */ + + +enum mplayer_vo{ + MPLAYER_VO_NONE = 0, + MPLAYER_VO_XV, + MPLAYER_VO_X11, + MPLAYER_VO_GL, + MPLAYER_VO_SDL +}; + +enum mplayer_ao{ + MPLAYER_AO_NONE = 0, + MPLAYER_AO_OSS, + MPLAYER_AO_ARTS, + MPLAYER_AO_ESD, + MPLAYER_AO_ALSA, + MPLAYER_AO_SDL, + MPLAYER_AO_XMMS +}; +struct mplayer_info { /* Stores the info about a file */ + gchar *filename; + gint vbr,abr,br; /*Video, audio and total bitrates */ + gchar artist[MPLAYER_INFO_SIZE]; + gchar title[MPLAYER_INFO_SIZE]; + glong filesize; /* bytes */ + gint length; /* in seconds */ + gchar caption[MPLAYER_TITLE_SIZE]; + gint rate; /*sampling rate*/ + gint nch; /*no of channels */ + gint x,y; /*x,y resolution */ +} +; + +struct mplayer_cfg{ + gint vo,ao; + gboolean zoom,framedrop,idx,onewin,xmmsaudio; + gchar *extra; +}; + +void mplayer_read_to_eol(char *str1,char *str2); +char **mplayer_make_vector(); +void *mplayer_play_loop(void *arg); +void mplayer_vector_append(char**vector,char*param); + +struct mplayer_info *mplayer_read_file_info(char *filename); +gint mplayer_is_our_file(char *filename); +void mplayer_quitting_video(GtkWidget *widget, gpointer data); +void mplayer_play_file(char *filename); +void mplayer_stop(); +void mplayer_cleanup(); +void mplayer_pause(short p); +void mplayer_seek(int t); +gint mplayer_get_time(); +void mplayer_get_song_info(char * filename, char ** title, int * length); +void mplayer_init(); +InputPlugin *get_iplugin_info(void); + +void on_button_ok_clicked (GtkButton *button, gpointer user_data); +GtkWidget* mplayer_create_configure_win (void); +void mplayer_configure(); +static void mplayer_about(void); +struct mplayer_cfg *mplayer_read_cfg(); +void mplayer_quitting_video(GtkWidget *widget, gpointer data);