Search
j0ke.net Open Build Service
>
Projects
>
multimedia
:
SL11
>
xine-lib
> xine-lib-1.1.20.1-install-plugins-helper.diff
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File xine-lib-1.1.20.1-install-plugins-helper.diff of Package xine-lib (Revision 20)
Currently displaying revision
20
,
show latest
diff -uNr xine-lib-1.1.20.orig/configure.ac xine-lib-1.1.20/configure.ac --- xine-lib-1.1.20.orig/configure.ac 2011-11-13 17:46:57.513129735 +0100 +++ xine-lib-1.1.20/configure.ac 2011-11-13 17:40:51.572377268 +0100 @@ -2657,6 +2657,28 @@ AM_CONDITIONAL(HAVE_W32DLL, test "x$enable_w32dll" != "xno") +dnl --------------------------------------------- +dnl let distro override plugin install helper path +dnl --------------------------------------------- +AC_ARG_WITH(install-plugins-helper, + AC_HELP_STRING([--with-install-plugins-helper], + [specify path of helper script to call to install plugins]), + [ + case "${withval}" in + yes) AC_MSG_ERROR(bad value ${withval} for --with-install-plugins-helper) ;; + no) AC_MSG_ERROR(bad value ${withval} for --with-install-plugins-helper) ;; + *) XINE_INSTALL_PLUGINS_HELPER="${withval}" ;; + esac + ], + [ + dnl Default value + XINE_INSTALL_PLUGINS_HELPER="`makeexpand "${libexecdir}/xine-install-plugins-helper"`" + ] +) +AC_MSG_NOTICE(Using $XINE_INSTALL_PLUGINS_HELPER as plugin install helper) +AC_DEFINE_UNQUOTED(XINE_INSTALL_PLUGINS_HELPER, "$XINE_INSTALL_PLUGINS_HELPER", + [plugin install helper script]) +AC_SUBST(XINE_INSTALL_PLUGINS_HELPER) dnl --------------------------------------------- dnl some include paths ( !!! DO NOT REMOVE !!! ) diff -uNr xine-lib-1.1.20.orig/src/xine-engine/audio_decoder.c xine-lib-1.1.20/src/xine-engine/audio_decoder.c --- xine-lib-1.1.20.orig/src/xine-engine/audio_decoder.c 2011-11-13 17:46:57.513129735 +0100 +++ xine-lib-1.1.20/src/xine-engine/audio_decoder.c 2011-10-04 23:42:53.000000000 +0200 @@ -41,6 +41,7 @@ #include "xine_internal.h" #include "xineutils.h" +#include "install_plugins_helper.h" static void *audio_decoder_loop (void *stream_gen) { @@ -344,6 +345,10 @@ _x_stream_info_set(stream, XINE_STREAM_INFO_AUDIO_HANDLED, (stream->audio_decoder_plugin != NULL)); + + if(buf->type != buftype_unknown && !stream->audio_decoder_plugin) + _x_install_plugins_helper(stream,"decoder-audio", buf->type, _x_buf_audio_name( buf->type )); + } if (audio_type != stream->audio_type) { diff -uNr xine-lib-1.1.20.orig/src/xine-engine/install_plugins_helper.c xine-lib-1.1.20/src/xine-engine/install_plugins_helper.c --- xine-lib-1.1.20.orig/src/xine-engine/install_plugins_helper.c 2011-11-13 17:46:57.513129735 +0100 +++ xine-lib-1.1.20/src/xine-engine/install_plugins_helper.c 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2007 Sascha Sommer + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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 + * + * helper functions to query the internet for additional plugins + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdio.h> +#include <unistd.h> +#include <sys/wait.h> + +#include "install_plugins_helper.h" + +#define PROCNAME_LEN 100 + +static const char * +get_helper(xine_stream_t *stream) +{ + const char *helper; + + helper = getenv("XINE_INSTALL_PLUGINS_HELPER"); + if (helper == NULL) + helper = XINE_INSTALL_PLUGINS_HELPER; + + xine_log (stream->xine, XINE_LOG_MSG, + _("Using plugin install helper '%s'"), helper); + + return helper; +} + +static void +get_procname(char* procname, size_t len) +{ + char name[100]; + FILE* fp; + size_t pos = 0; + snprintf(name, sizeof(name), "/proc/%u/cmdline", getpid()); + + fp = fopen(name,"rb"); + if(fp){ + while(fp && !feof(fp) && pos < sizeof(name)-1){ + procname[pos] = fgetc(fp); + if(procname[pos] == ' ') /* ignore arguments */ + break; + if(procname[pos] == '/') /* ignore the path to the executable */ + pos = 0; + else + ++pos; + } + fclose(fp); + } + procname[pos] = '\0'; +} + + +void _x_install_plugins_helper(xine_stream_t* stream,char* plugin_type, uint32_t id, char* plugin_desc) +{ + xine_cfg_entry_t cfgentry; + char* helper = get_helper(stream); + FILE* fp; + + if(helper && xine_config_lookup_entry(stream->xine, "media.plugins_helper", &cfgentry) && cfgentry.num_value + && (fp = fopen(helper,"rb") )) { + char procname[PROCNAME_LEN]; +// char* procname = getenv("_"); /* might deliver /opt/kde3/bin/start_kdeinit_wrapper etc... */ + pid_t pid; + fclose(fp); + get_procname(procname,PROCNAME_LEN); + pid = fork(); + if(pid == 0) { + size_t len = 5 + strlen(XINE_VERSION) + 1 + strlen(procname) + 1 + strlen(plugin_desc) + 1 + strlen(plugin_type) + 1 + 100 + 1; + char* str = calloc(1,len + 1); + if(str){ + snprintf(str,len,"xine|%s|%s|%s|%s=%u",XINE_VERSION,procname,plugin_desc,plugin_type,id); + if(execl(helper,"xine-install-plugins-helper",str, NULL) == -1) + xine_log(stream->xine, XINE_LOG_MSG, + _("Couldn't start plugins_helper")); + free(str); + } + }else if(pid < 0){ + xine_log(stream->xine, XINE_LOG_MSG, + _("Couldn't fork")); + }else{ + waitpid(pid, NULL, 0); + } + } +} + diff -uNr xine-lib-1.1.20.orig/src/xine-engine/install_plugins_helper.h xine-lib-1.1.20/src/xine-engine/install_plugins_helper.h --- xine-lib-1.1.20.orig/src/xine-engine/install_plugins_helper.h 2011-11-13 17:46:57.513129735 +0100 +++ xine-lib-1.1.20/src/xine-engine/install_plugins_helper.h 1970-01-01 01:00:00.000000000 +0100 @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2007 Sascha Sommer + * + * This file is part of xine, a free video player. + * + * xine 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. + * + * xine 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 + * + * helper functions to query the internet for additional codecs + */ + +#ifndef PLUGINS_HELPER_H +#define PLUGINS_HELPER_H + +#include <inttypes.h> +#include "xine_internal.h" + +/* + * execute install plugins helper + */ +void _x_install_plugins_helper(xine_stream_t *stream, char* plugin_type, uint32_t type, char* plugin_desc) XINE_PROTECTED; + + +#endif diff -uNr xine-lib-1.1.20.orig/src/xine-engine/Makefile.am xine-lib-1.1.20/src/xine-engine/Makefile.am --- xine-lib-1.1.20.orig/src/xine-engine/Makefile.am 2011-11-13 17:46:57.513129735 +0100 +++ xine-lib-1.1.20/src/xine-engine/Makefile.am 2011-10-04 23:42:53.000000000 +0200 @@ -19,7 +19,7 @@ video_overlay.c osd.c scratch.c demux.c vo_scale.c \ xine_interface.c post.c tvmode.c broadcaster.c io_helper.c \ input_rip.c input_cache.c info_helper.c refcounter.c \ - alphablend.c + alphablend.c install_plugins_helper.c # FIXME: these are currently unused: EXTRA_DIST = lrb.c lrb.h accel_xvmc.h @@ -39,7 +39,8 @@ audio_out.h resample.h video_out.h xine_internal.h spu_decoder.h \ video_overlay.h osd.h scratch.h xine_plugin.h xineintl.h \ plugin_catalog.h audio_decoder.h video_decoder.h post.h \ - io_helper.h broadcaster.h info_helper.h refcounter.h alphablend.h + io_helper.h broadcaster.h info_helper.h refcounter.h alphablend.h \ + install_plugins_helper.h noinst_HEADERS = bswap.h ffmpeg_bswap.h xine_private.h diff -uNr xine-lib-1.1.20.orig/src/xine-engine/video_decoder.c xine-lib-1.1.20/src/xine-engine/video_decoder.c --- xine-lib-1.1.20.orig/src/xine-engine/video_decoder.c 2011-11-13 17:46:57.517129699 +0100 +++ xine-lib-1.1.20/src/xine-engine/video_decoder.c 2011-11-08 21:26:43.000000000 +0100 @@ -38,6 +38,7 @@ #include "xine_internal.h" #include "xineutils.h" +#include "install_plugins_helper.h" #include <sched.h> #define SPU_SLEEP_INTERVAL (90000/2) @@ -408,6 +409,10 @@ stream->video_decoder_plugin = _x_get_video_decoder (stream, streamtype); _x_stream_info_set(stream, XINE_STREAM_INFO_VIDEO_HANDLED, (stream->video_decoder_plugin != NULL)); + if(buf->type != buftype_unknown && !stream->video_decoder_plugin) + _x_install_plugins_helper(stream,"decoder-video", buf->type, _x_buf_video_name( buf->type )); + + } if (stream->video_decoder_plugin) diff -uNr xine-lib-1.1.20.orig/src/xine-engine/xine.c xine-lib-1.1.20/src/xine-engine/xine.c --- xine-lib-1.1.20.orig/src/xine-engine/xine.c 2011-11-13 17:46:57.517129699 +0100 +++ xine-lib-1.1.20/src/xine-engine/xine.c 2011-11-13 17:35:47.579072679 +0100 @@ -1816,6 +1816,15 @@ 0, NULL, this); /* + * enable/disable option for the plugins helper + */ + this->config->register_bool(this->config, + "media.plugins_helper", 1, + _("Run plugins helper"), + _("Searches the internet for missing plugins"), + 0, NULL, this); + + /* * keep track of all opened streams */ this->streams = xine_list_new();