I'd like to upload the attached NMU.

-- 
Adeodato Simó
    EM: asp16 [ykwim] alu.ua.es | PK: DA6AE621
 
If there is a sin against life, it consists perhaps not so much in
despairing of life as in hoping for another life and in eluding the
implacable grandeur of this life.
                -- Albert Camus
diff -u xine-lib-1.0.1/debian/changelog xine-lib-1.0.1/debian/changelog
--- xine-lib-1.0.1/debian/changelog
+++ xine-lib-1.0.1/debian/changelog
@@ -1,3 +1,33 @@
+xine-lib (1.0.1-1.3) unstable; urgency=low
+
+  * Non-maintainer upload.
+
+  * Backport patch from 1.0.2 that fixes hard hang-ups when a plugin listed in
+    ~/.xine/catalog.cache becomes unloadable (closes: #328454). Plugins can
+    become unloadable if DT_NEEDED libraries get uninstalled, which is
+    possible because the package lists many of these libraries in the
+    Recommends or Suggests fields only. With this fix, amarok should not
+    freeze with the XINE engine anymore (closes: #327203), and totem either
+    (closes: #328265).
+
+    Patch included in debian/patches/fix-hangs-at-load-time.diff, but since
+    there's no patch applying code in debian/rules, it's present in the
+    .diff.gz as well.
+
+  * Fix the script that invokes dpkg-shlibdeps to split dependencies among
+    Depends, Recommends, and Suggests: it generated empty fields if one of the
+    expected plugins was not actually available. (Closes: #328184)
+
+    This means that now the package now suggests libgnomevfs2-0 (closes:
+    #326935) and libflac7 (closes: #328168). Submitters may wish to reopen if
+    they want a discussion with the maintainer about the need of these being
+    strong Depends instead of Suggests.
+
+  * xineplug_flac.so now links against libflac7 instead of libflac6, which
+    closes: #325960 (the FLAC transition bug).
+
+ -- Adeodato Simó <[EMAIL PROTECTED]>  Thu, 15 Sep 2005 14:54:50 +0200
+
 xine-lib (1.0.1-1.2) unstable; urgency=low
 
   * NMU.
diff -u xine-lib-1.0.1/debian/shlibdeps.sh xine-lib-1.0.1/debian/shlibdeps.sh
--- xine-lib-1.0.1/debian/shlibdeps.sh
+++ xine-lib-1.0.1/debian/shlibdeps.sh
@@ -48,13 +48,13 @@
 for file in $RECOMMENDED; do
     if test ! -f "$file"; then
        echo "WARNING: non-existing file \"$file\" in RECOMMENDED list"
-       RECOMMENDED=`echo "$var" | grep -v $file`
+       RECOMMENDED=`echo "$RECOMMENDED" | grep -v $file`
     fi
 done
 for file in $OPTIONAL; do
     if test ! -f "$file"; then
        echo "WARNING: non-existing file \"$file\" in OPTIONAL list"
-       OPTIONAL=`echo "$var" | grep -v $file`
+       OPTIONAL=`echo "$OPTIONAL" | grep -v $file`
     fi
 done
 
only in patch2:
unchanged:
--- xine-lib-1.0.1.orig/src/xine-engine/load_plugins.c
+++ xine-lib-1.0.1/src/xine-engine/load_plugins.c
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
  *
- * $Id: load_plugins.c,v 1.193.2.2 2005/04/20 17:21:16 mroi Exp $
+ * $Id: load_plugins.c,v 1.193.2.5 2005/07/18 01:46:40 miguelfreitas Exp $
  *
  *
  * Load input/demux/audio_out/video_out/codec plugins
@@ -42,6 +42,7 @@
 
 #define LOG_MODULE "load_plugins"
 #define LOG_VERBOSE
+
 /*
 #define LOG
 */
@@ -60,9 +61,10 @@
 #include "xineutils.h"
 #include "compat.h"
 
+#if 0
+
 static char *plugin_name;
 
-#if 0
 #if DONT_CATCH_SIGSEGV
 
 #define install_segv_handler()
@@ -523,18 +525,18 @@
   dir = opendir(path);
   if (dir) {
     struct dirent *pEntry;
-    int path_len;
+    size_t path_len, str_size;
     char *str = NULL;
 
     path_len = strlen(path);
-    str = malloc(path_len * 2 + 2); /* +2 for '/' and '\0' */
+    str_size = path_len * 2 + 2; /* +2 for '/' and '\0' */
+    str = malloc(str_size);
     xine_fast_memcpy(str, path, path_len);
     str[path_len] = '/';
     str[path_len + 1] = '\0';
 
     while ((pEntry = readdir (dir)) != NULL) {
-      size_t str_size = 0;
-      size_t new_str_size = 0;
+      size_t new_str_size;
       void *lib = NULL;
       plugin_info_t *info = NULL;
       
@@ -725,7 +727,8 @@
       break;
     }
     node->plugin_class = NULL;
-    dec_file_ref(node->file);
+    if (node->file)
+      dec_file_ref(node->file);
   }
 }
 
@@ -1132,28 +1135,27 @@
   xine_t           *xine = stream->xine;
   plugin_catalog_t *catalog = xine->plugin_catalog;
   plugin_node_t    *node;
+  input_plugin_t   *plugin = NULL;
 
   pthread_mutex_lock (&catalog->lock);
 
   node = xine_list_first_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
   while (node) {
-    input_plugin_t   *plugin;
 
-    if (!node->plugin_class && !_load_plugin_class(xine, node, NULL))
-      return NULL;
-    if ((plugin = ((input_class_t 
*)node->plugin_class)->get_instance(node->plugin_class, stream, mrl))) {
-      inc_node_ref(node);
-      plugin->node = node;
-      pthread_mutex_unlock (&catalog->lock);
-      return plugin;
+    if (node->plugin_class || _load_plugin_class(xine, node, NULL)) {
+      if ((plugin = ((input_class_t 
*)node->plugin_class)->get_instance(node->plugin_class, stream, mrl))) {
+        inc_node_ref(node);
+        plugin->node = node;
+        break;
+      }
     }
-
+    
     node = xine_list_next_content 
(stream->xine->plugin_catalog->plugin_lists[PLUGIN_INPUT - 1]);
   }
 
   pthread_mutex_unlock (&catalog->lock);
 
-  return NULL;
+  return plugin;
 }
 
 
@@ -1176,6 +1178,7 @@
   int               i;
   int               methods[3];
   plugin_catalog_t *catalog = stream->xine->plugin_catalog;
+  demux_plugin_t   *plugin = NULL;
 
   methods[0] = method1;
   methods[1] = method2;
@@ -1187,7 +1190,7 @@
   }
 
   i = 0;
-  while (methods[i] != -1) {
+  while (methods[i] != -1 && !plugin) {
 
     plugin_node_t *node;
 
@@ -1198,18 +1201,15 @@
     node = xine_list_first_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
 
     while (node) {
-      demux_plugin_t *plugin;
 
       xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: probing demux 
'%s'\n", node->info->id);
 
-      if (!node->plugin_class && !_load_plugin_class(stream->xine, node, NULL))
-       return NULL;
-
-      if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
-       inc_node_ref(node);
-       plugin->node = node;
-       pthread_mutex_unlock (&catalog->lock);
-       return plugin;
+      if (node->plugin_class || _load_plugin_class(stream->xine, node, NULL)) {
+        if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
+         inc_node_ref(node);
+         plugin->node = node;
+         break;
+        }
       }
 
       node = xine_list_next_content 
(stream->xine->plugin_catalog->plugin_lists[PLUGIN_DEMUX - 1]);
@@ -1220,7 +1220,7 @@
     i++;
   }
 
-  return NULL;
+  return plugin;
 }
 
 demux_plugin_t *_x_find_demux_plugin (xine_stream_t *stream, input_plugin_t 
*input) {
@@ -1252,7 +1252,7 @@
 
   plugin_catalog_t  *catalog = stream->xine->plugin_catalog;
   plugin_node_t     *node;
-  demux_plugin_t    *plugin;
+  demux_plugin_t    *plugin = NULL;
 
   pthread_mutex_lock(&catalog->lock);
   node = xine_list_first_content(catalog->plugin_lists[PLUGIN_DEMUX - 1]);
@@ -1260,21 +1260,19 @@
 
   while (node) {
     if (strcasecmp(node->info->id, name) == 0) {
-      if (!node->plugin_class && !_load_plugin_class(stream->xine, node, NULL))
-       return NULL;
-
-      if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
-       inc_node_ref(node);
-       plugin->node = node;
-       pthread_mutex_unlock (&catalog->lock);
-       return plugin;
+      if (node->plugin_class || _load_plugin_class(stream->xine, node, NULL)) {
+        if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
+         inc_node_ref(node);
+         plugin->node = node;
+         break;
+        }
       }
     }
     node = xine_list_next_content(catalog->plugin_lists[PLUGIN_DEMUX - 1]);
   }
 
   pthread_mutex_unlock(&catalog->lock);
-  return NULL;
+  return plugin;
 }
 
 /*
@@ -1293,14 +1291,14 @@
   xine_t           *xine = stream->xine;
   plugin_catalog_t *catalog = xine->plugin_catalog;
   plugin_node_t    *last_demux = NULL;
-  demux_plugin_t   *plugin;
+  demux_plugin_t   *plugin = NULL;
 
   methods[0] = METHOD_BY_CONTENT;
   methods[1] = METHOD_BY_EXTENSION;
   methods[2] = -1;
 
   i = 0;
-  while (methods[i] != -1) {
+  while (methods[i] != -1 && !plugin) {
 
     plugin_node_t *node;
 
@@ -1319,16 +1317,14 @@
       } else {
        xprintf(stream->xine, XINE_VERBOSITY_DEBUG, 
                "load_plugin: probing '%s' (method %d)...\n", node->info->id, 
stream->content_detection_method );
-       if (!node->plugin_class && !_load_plugin_class(xine, node, NULL))
-         return NULL;
-
-        if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
-         xprintf (stream->xine, XINE_VERBOSITY_DEBUG,
-                  "load_plugins: using demuxer '%s' (instead of '%s')\n", 
node->info->id, last_demux_name);
-         inc_node_ref(node);
-         plugin->node = node;
-         pthread_mutex_unlock (&catalog->lock);
-         return plugin;
+       if (node->plugin_class || _load_plugin_class(xine, node, NULL)) {
+          if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
+           xprintf (stream->xine, XINE_VERBOSITY_DEBUG,
+                    "load_plugins: using demuxer '%s' (instead of '%s')\n", 
node->info->id, last_demux_name);
+           inc_node_ref(node);
+           plugin->node = node;
+           break;
+          }
         }
       }
 
@@ -1340,6 +1336,9 @@
     i++;
   }
 
+  if( plugin )
+    return plugin;
+
   if( !last_demux )
     return NULL;
 
@@ -1747,6 +1746,7 @@
   plugin_node_t    *node;
   int               i, j;
   plugin_catalog_t *catalog = stream->xine->plugin_catalog;
+  video_decoder_t  *vd = NULL;
 
   lprintf ("looking for video decoder for streamtype %02x\n", stream_type);
 
@@ -1754,13 +1754,10 @@
 
   for (i = 0; i < PLUGINS_PER_TYPE; i++) {
 
-    video_decoder_t *vd=NULL;
-
     node = catalog->video_decoder_map[stream_type][i];
 
     if (!node) {
-      pthread_mutex_unlock (&catalog->lock);
-      return NULL;
+      break;
     }
 
     if (!node->plugin_class && !_load_plugin_class (stream->xine, node, NULL)) 
{
@@ -1784,8 +1781,7 @@
           "load_plugins: plugin %s will be used for video streamtype %02x.\n", 
           node->info->id, stream_type);
       
-      pthread_mutex_unlock (&catalog->lock);
-      return vd;
+      break;
     } else {
       /* remove non working plugin from catalog */
       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
@@ -1799,7 +1795,7 @@
   }
 
   pthread_mutex_unlock (&catalog->lock);
-  return NULL;
+  return vd;
 }
 
 void _x_free_video_decoder (xine_stream_t *stream, video_decoder_t *vd) {
@@ -1821,6 +1817,7 @@
   plugin_node_t    *node;
   int               i, j;
   plugin_catalog_t *catalog = stream->xine->plugin_catalog;
+  audio_decoder_t  *ad = NULL;
 
   lprintf ("looking for audio decoder for streamtype %02x\n", stream_type);
 
@@ -1828,13 +1825,10 @@
 
   for (i = 0; i < PLUGINS_PER_TYPE; i++) {
 
-    audio_decoder_t *ad;
-
     node = catalog->audio_decoder_map[stream_type][i];
 
     if (!node) {
-      pthread_mutex_unlock (&catalog->lock);
-      return NULL;
+      break;
     }
 
     if (!node->plugin_class && !_load_plugin_class (stream->xine, node, NULL)) 
{
@@ -1857,8 +1851,7 @@
       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
           "load_plugins: plugin %s will be used for audio streamtype %02x.\n", 
           node->info->id, stream_type);
-      pthread_mutex_unlock (&catalog->lock);
-      return ad;
+      break;
     } else {
       /* remove non working plugin from catalog */
       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
@@ -1872,7 +1865,7 @@
   }
 
   pthread_mutex_unlock (&catalog->lock);
-  return NULL;
+  return ad;
 }
 
 void _x_free_audio_decoder (xine_stream_t *stream, audio_decoder_t *ad) {
@@ -1942,7 +1935,7 @@
     _unload_unref_plugins(self, self->plugin_catalog->plugin_lists[i]);
   } 
 
-#ifdef LOG
+#if 0
   {
     plugin_file_t *file;
 
@@ -1970,19 +1963,18 @@
   plugin_node_t    *node;
   int               i, j;
   plugin_catalog_t *catalog = stream->xine->plugin_catalog;
+  spu_decoder_t    *sd = NULL;
 
   lprintf ("looking for spu decoder for streamtype %02x\n", stream_type);
 
   pthread_mutex_lock (&catalog->lock);
 
   for (i = 0; i < PLUGINS_PER_TYPE; i++) {
-    spu_decoder_t *sd;
 
     node = catalog->spu_decoder_map[stream_type][i];
 
     if (!node) {
-      pthread_mutex_unlock (&catalog->lock);
-      return NULL;
+      break;
     }
 
     if (!node->plugin_class && !_load_plugin_class (stream->xine, node, NULL)) 
{
@@ -2005,8 +1997,7 @@
       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
           "load_plugins: plugin %s will be used for spu streamtype %02x.\n", 
           node->info->id, stream_type);
-      pthread_mutex_unlock (&catalog->lock);
-      return sd;
+      break;
     } else {
       /* remove non working plugin from catalog */
       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
@@ -2020,7 +2011,7 @@
   }
 
   pthread_mutex_unlock (&catalog->lock);
-  return NULL;
+  return sd;
 }
 
 void _x_free_spu_decoder (xine_stream_t *stream, spu_decoder_t *sd) {
@@ -2150,6 +2141,7 @@
                            xine_video_port_t **video_target) {
   plugin_catalog_t *catalog = xine->plugin_catalog;
   plugin_node_t    *node;
+  post_plugin_t    *post = NULL;
   
   if( !name )
     return NULL;
@@ -2160,13 +2152,11 @@
   while (node) {
     
     if (strcmp(node->info->id, name) == 0) {
-      post_plugin_t *post;
       
       if (!node->plugin_class && !_load_plugin_class(xine, node, NULL)) {
         xprintf(xine, XINE_VERBOSITY_DEBUG,
                "load_plugins: requested post plugin %s failed to load\n", 
name);
-       pthread_mutex_unlock(&catalog->lock);
-       return NULL;
+       break;
       }
       
       post = ((post_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class,
@@ -2181,7 +2171,6 @@
        post->xine = xine;
        post->node = node;
        inc_node_ref(node);
-       pthread_mutex_unlock(&catalog->lock);
        
        /* init the lists of announced connections */
        i = 0;
@@ -2217,12 +2206,11 @@
        /* copy the post plugin type to the public part */
        post->xine_post.type = ((post_info_t *)node->info->special_info)->type;
        
-       return &post->xine_post;
+       break;
       } else {
         xprintf(xine, XINE_VERBOSITY_DEBUG,
                "load_plugins: post plugin %s failed to instantiate itself\n", 
name);
-       pthread_mutex_unlock(&catalog->lock);
-       return NULL;
+       break;
       }
     }
     
@@ -2231,8 +2219,12 @@
   
   pthread_mutex_unlock(&catalog->lock);
   
-  xprintf(xine, XINE_VERBOSITY_DEBUG, "load_plugins: no post plugin named %s 
found\n", name);
-  return NULL;
+  if(post)
+    return &post->xine_post;
+  else {
+    xprintf(xine, XINE_VERBOSITY_DEBUG, "load_plugins: no post plugin named %s 
found\n", name);
+    return NULL;
+  }
 }
 
 void xine_post_dispose(xine_t *xine, xine_post_t *post_gen) {
only in patch2:
unchanged:
--- xine-lib-1.0.1.orig/debian/patches/fix-hangs-at-load-time.diff
+++ xine-lib-1.0.1/debian/patches/fix-hangs-at-load-time.diff
@@ -0,0 +1,439 @@
+diff -u -Nrua xine-lib-1.0.1/src/xine-engine/load_plugins.c 
xine-lib-1.0.2/src/xine-engine/load_plugins.c
+--- xine-lib-1.0.1/src/xine-engine/load_plugins.c      2005-04-26 
10:09:12.000000000 +0200
++++ xine-lib-1.0.2/src/xine-engine/load_plugins.c      2005-07-18 
03:46:40.000000000 +0200
+@@ -17,7 +17,7 @@
+  * along with this program; if not, write to the Free Software
+  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+  *
+- * $Id: load_plugins.c,v 1.193.2.2 2005/04/20 17:21:16 mroi Exp $
++ * $Id: load_plugins.c,v 1.193.2.5 2005/07/18 01:46:40 miguelfreitas Exp $
+  *
+  *
+  * Load input/demux/audio_out/video_out/codec plugins
+@@ -42,6 +42,7 @@
+ 
+ #define LOG_MODULE "load_plugins"
+ #define LOG_VERBOSE
++
+ /*
+ #define LOG
+ */
+@@ -60,9 +61,10 @@
+ #include "xineutils.h"
+ #include "compat.h"
+ 
++#if 0
++
+ static char *plugin_name;
+ 
+-#if 0
+ #if DONT_CATCH_SIGSEGV
+ 
+ #define install_segv_handler()
+@@ -523,18 +525,18 @@
+   dir = opendir(path);
+   if (dir) {
+     struct dirent *pEntry;
+-    int path_len;
++    size_t path_len, str_size;
+     char *str = NULL;
+ 
+     path_len = strlen(path);
+-    str = malloc(path_len * 2 + 2); /* +2 for '/' and '\0' */
++    str_size = path_len * 2 + 2; /* +2 for '/' and '\0' */
++    str = malloc(str_size);
+     xine_fast_memcpy(str, path, path_len);
+     str[path_len] = '/';
+     str[path_len + 1] = '\0';
+ 
+     while ((pEntry = readdir (dir)) != NULL) {
+-      size_t str_size = 0;
+-      size_t new_str_size = 0;
++      size_t new_str_size;
+       void *lib = NULL;
+       plugin_info_t *info = NULL;
+       
+@@ -725,7 +727,8 @@
+       break;
+     }
+     node->plugin_class = NULL;
+-    dec_file_ref(node->file);
++    if (node->file)
++      dec_file_ref(node->file);
+   }
+ }
+ 
+@@ -1132,28 +1135,27 @@
+   xine_t           *xine = stream->xine;
+   plugin_catalog_t *catalog = xine->plugin_catalog;
+   plugin_node_t    *node;
++  input_plugin_t   *plugin = NULL;
+ 
+   pthread_mutex_lock (&catalog->lock);
+ 
+   node = xine_list_first_content (catalog->plugin_lists[PLUGIN_INPUT - 1]);
+   while (node) {
+-    input_plugin_t   *plugin;
+ 
+-    if (!node->plugin_class && !_load_plugin_class(xine, node, NULL))
+-      return NULL;
+-    if ((plugin = ((input_class_t 
*)node->plugin_class)->get_instance(node->plugin_class, stream, mrl))) {
+-      inc_node_ref(node);
+-      plugin->node = node;
+-      pthread_mutex_unlock (&catalog->lock);
+-      return plugin;
++    if (node->plugin_class || _load_plugin_class(xine, node, NULL)) {
++      if ((plugin = ((input_class_t 
*)node->plugin_class)->get_instance(node->plugin_class, stream, mrl))) {
++        inc_node_ref(node);
++        plugin->node = node;
++        break;
++      }
+     }
+-
++    
+     node = xine_list_next_content 
(stream->xine->plugin_catalog->plugin_lists[PLUGIN_INPUT - 1]);
+   }
+ 
+   pthread_mutex_unlock (&catalog->lock);
+ 
+-  return NULL;
++  return plugin;
+ }
+ 
+ 
+@@ -1176,6 +1178,7 @@
+   int               i;
+   int               methods[3];
+   plugin_catalog_t *catalog = stream->xine->plugin_catalog;
++  demux_plugin_t   *plugin = NULL;
+ 
+   methods[0] = method1;
+   methods[1] = method2;
+@@ -1187,7 +1190,7 @@
+   }
+ 
+   i = 0;
+-  while (methods[i] != -1) {
++  while (methods[i] != -1 && !plugin) {
+ 
+     plugin_node_t *node;
+ 
+@@ -1198,18 +1201,15 @@
+     node = xine_list_first_content (catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+ 
+     while (node) {
+-      demux_plugin_t *plugin;
+ 
+       xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "load_plugins: probing 
demux '%s'\n", node->info->id);
+ 
+-      if (!node->plugin_class && !_load_plugin_class(stream->xine, node, 
NULL))
+-      return NULL;
+-
+-      if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
+-      inc_node_ref(node);
+-      plugin->node = node;
+-      pthread_mutex_unlock (&catalog->lock);
+-      return plugin;
++      if (node->plugin_class || _load_plugin_class(stream->xine, node, NULL)) 
{
++        if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
++        inc_node_ref(node);
++        plugin->node = node;
++        break;
++        }
+       }
+ 
+       node = xine_list_next_content 
(stream->xine->plugin_catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+@@ -1220,7 +1220,7 @@
+     i++;
+   }
+ 
+-  return NULL;
++  return plugin;
+ }
+ 
+ demux_plugin_t *_x_find_demux_plugin (xine_stream_t *stream, input_plugin_t 
*input) {
+@@ -1252,7 +1252,7 @@
+ 
+   plugin_catalog_t  *catalog = stream->xine->plugin_catalog;
+   plugin_node_t     *node;
+-  demux_plugin_t    *plugin;
++  demux_plugin_t    *plugin = NULL;
+ 
+   pthread_mutex_lock(&catalog->lock);
+   node = xine_list_first_content(catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+@@ -1260,21 +1260,19 @@
+ 
+   while (node) {
+     if (strcasecmp(node->info->id, name) == 0) {
+-      if (!node->plugin_class && !_load_plugin_class(stream->xine, node, 
NULL))
+-      return NULL;
+-
+-      if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
+-      inc_node_ref(node);
+-      plugin->node = node;
+-      pthread_mutex_unlock (&catalog->lock);
+-      return plugin;
++      if (node->plugin_class || _load_plugin_class(stream->xine, node, NULL)) 
{
++        if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
++        inc_node_ref(node);
++        plugin->node = node;
++        break;
++        }
+       }
+     }
+     node = xine_list_next_content(catalog->plugin_lists[PLUGIN_DEMUX - 1]);
+   }
+ 
+   pthread_mutex_unlock(&catalog->lock);
+-  return NULL;
++  return plugin;
+ }
+ 
+ /*
+@@ -1293,14 +1291,14 @@
+   xine_t           *xine = stream->xine;
+   plugin_catalog_t *catalog = xine->plugin_catalog;
+   plugin_node_t    *last_demux = NULL;
+-  demux_plugin_t   *plugin;
++  demux_plugin_t   *plugin = NULL;
+ 
+   methods[0] = METHOD_BY_CONTENT;
+   methods[1] = METHOD_BY_EXTENSION;
+   methods[2] = -1;
+ 
+   i = 0;
+-  while (methods[i] != -1) {
++  while (methods[i] != -1 && !plugin) {
+ 
+     plugin_node_t *node;
+ 
+@@ -1319,16 +1317,14 @@
+       } else {
+       xprintf(stream->xine, XINE_VERBOSITY_DEBUG, 
+               "load_plugin: probing '%s' (method %d)...\n", node->info->id, 
stream->content_detection_method );
+-      if (!node->plugin_class && !_load_plugin_class(xine, node, NULL))
+-        return NULL;
+-
+-        if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
+-        xprintf (stream->xine, XINE_VERBOSITY_DEBUG,
+-                 "load_plugins: using demuxer '%s' (instead of '%s')\n", 
node->info->id, last_demux_name);
+-        inc_node_ref(node);
+-        plugin->node = node;
+-        pthread_mutex_unlock (&catalog->lock);
+-        return plugin;
++      if (node->plugin_class || _load_plugin_class(xine, node, NULL)) {
++          if ((plugin = ((demux_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
++          xprintf (stream->xine, XINE_VERBOSITY_DEBUG,
++                   "load_plugins: using demuxer '%s' (instead of '%s')\n", 
node->info->id, last_demux_name);
++          inc_node_ref(node);
++          plugin->node = node;
++          break;
++          }
+         }
+       }
+ 
+@@ -1340,6 +1336,9 @@
+     i++;
+   }
+ 
++  if( plugin )
++    return plugin;
++
+   if( !last_demux )
+     return NULL;
+ 
+@@ -1747,6 +1746,7 @@
+   plugin_node_t    *node;
+   int               i, j;
+   plugin_catalog_t *catalog = stream->xine->plugin_catalog;
++  video_decoder_t  *vd = NULL;
+ 
+   lprintf ("looking for video decoder for streamtype %02x\n", stream_type);
+ 
+@@ -1754,13 +1754,10 @@
+ 
+   for (i = 0; i < PLUGINS_PER_TYPE; i++) {
+ 
+-    video_decoder_t *vd=NULL;
+-
+     node = catalog->video_decoder_map[stream_type][i];
+ 
+     if (!node) {
+-      pthread_mutex_unlock (&catalog->lock);
+-      return NULL;
++      break;
+     }
+ 
+     if (!node->plugin_class && !_load_plugin_class (stream->xine, node, 
NULL)) {
+@@ -1784,8 +1781,7 @@
+           "load_plugins: plugin %s will be used for video streamtype 
%02x.\n", 
+           node->info->id, stream_type);
+       
+-      pthread_mutex_unlock (&catalog->lock);
+-      return vd;
++      break;
+     } else {
+       /* remove non working plugin from catalog */
+       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
+@@ -1799,7 +1795,7 @@
+   }
+ 
+   pthread_mutex_unlock (&catalog->lock);
+-  return NULL;
++  return vd;
+ }
+ 
+ void _x_free_video_decoder (xine_stream_t *stream, video_decoder_t *vd) {
+@@ -1821,6 +1817,7 @@
+   plugin_node_t    *node;
+   int               i, j;
+   plugin_catalog_t *catalog = stream->xine->plugin_catalog;
++  audio_decoder_t  *ad = NULL;
+ 
+   lprintf ("looking for audio decoder for streamtype %02x\n", stream_type);
+ 
+@@ -1828,13 +1825,10 @@
+ 
+   for (i = 0; i < PLUGINS_PER_TYPE; i++) {
+ 
+-    audio_decoder_t *ad;
+-
+     node = catalog->audio_decoder_map[stream_type][i];
+ 
+     if (!node) {
+-      pthread_mutex_unlock (&catalog->lock);
+-      return NULL;
++      break;
+     }
+ 
+     if (!node->plugin_class && !_load_plugin_class (stream->xine, node, 
NULL)) {
+@@ -1857,8 +1851,7 @@
+       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
+           "load_plugins: plugin %s will be used for audio streamtype 
%02x.\n", 
+           node->info->id, stream_type);
+-      pthread_mutex_unlock (&catalog->lock);
+-      return ad;
++      break;
+     } else {
+       /* remove non working plugin from catalog */
+       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
+@@ -1872,7 +1865,7 @@
+   }
+ 
+   pthread_mutex_unlock (&catalog->lock);
+-  return NULL;
++  return ad;
+ }
+ 
+ void _x_free_audio_decoder (xine_stream_t *stream, audio_decoder_t *ad) {
+@@ -1942,7 +1935,7 @@
+     _unload_unref_plugins(self, self->plugin_catalog->plugin_lists[i]);
+   } 
+ 
+-#ifdef LOG
++#if 0
+   {
+     plugin_file_t *file;
+ 
+@@ -1970,19 +1963,18 @@
+   plugin_node_t    *node;
+   int               i, j;
+   plugin_catalog_t *catalog = stream->xine->plugin_catalog;
++  spu_decoder_t    *sd = NULL;
+ 
+   lprintf ("looking for spu decoder for streamtype %02x\n", stream_type);
+ 
+   pthread_mutex_lock (&catalog->lock);
+ 
+   for (i = 0; i < PLUGINS_PER_TYPE; i++) {
+-    spu_decoder_t *sd;
+ 
+     node = catalog->spu_decoder_map[stream_type][i];
+ 
+     if (!node) {
+-      pthread_mutex_unlock (&catalog->lock);
+-      return NULL;
++      break;
+     }
+ 
+     if (!node->plugin_class && !_load_plugin_class (stream->xine, node, 
NULL)) {
+@@ -2005,8 +1997,7 @@
+       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
+           "load_plugins: plugin %s will be used for spu streamtype %02x.\n", 
+           node->info->id, stream_type);
+-      pthread_mutex_unlock (&catalog->lock);
+-      return sd;
++      break;
+     } else {
+       /* remove non working plugin from catalog */
+       xprintf(stream->xine, XINE_VERBOSITY_DEBUG,
+@@ -2020,7 +2011,7 @@
+   }
+ 
+   pthread_mutex_unlock (&catalog->lock);
+-  return NULL;
++  return sd;
+ }
+ 
+ void _x_free_spu_decoder (xine_stream_t *stream, spu_decoder_t *sd) {
+@@ -2150,6 +2141,7 @@
+                           xine_video_port_t **video_target) {
+   plugin_catalog_t *catalog = xine->plugin_catalog;
+   plugin_node_t    *node;
++  post_plugin_t    *post = NULL;
+   
+   if( !name )
+     return NULL;
+@@ -2160,13 +2152,11 @@
+   while (node) {
+     
+     if (strcmp(node->info->id, name) == 0) {
+-      post_plugin_t *post;
+       
+       if (!node->plugin_class && !_load_plugin_class(xine, node, NULL)) {
+         xprintf(xine, XINE_VERBOSITY_DEBUG,
+               "load_plugins: requested post plugin %s failed to load\n", 
name);
+-      pthread_mutex_unlock(&catalog->lock);
+-      return NULL;
++      break;
+       }
+       
+       post = ((post_class_t 
*)node->plugin_class)->open_plugin(node->plugin_class,
+@@ -2181,7 +2171,6 @@
+       post->xine = xine;
+       post->node = node;
+       inc_node_ref(node);
+-      pthread_mutex_unlock(&catalog->lock);
+       
+       /* init the lists of announced connections */
+       i = 0;
+@@ -2217,12 +2206,11 @@
+       /* copy the post plugin type to the public part */
+       post->xine_post.type = ((post_info_t *)node->info->special_info)->type;
+       
+-      return &post->xine_post;
++      break;
+       } else {
+         xprintf(xine, XINE_VERBOSITY_DEBUG,
+               "load_plugins: post plugin %s failed to instantiate itself\n", 
name);
+-      pthread_mutex_unlock(&catalog->lock);
+-      return NULL;
++      break;
+       }
+     }
+     
+@@ -2231,8 +2219,12 @@
+   
+   pthread_mutex_unlock(&catalog->lock);
+   
+-  xprintf(xine, XINE_VERBOSITY_DEBUG, "load_plugins: no post plugin named %s 
found\n", name);
+-  return NULL;
++  if(post)
++    return &post->xine_post;
++  else {
++    xprintf(xine, XINE_VERBOSITY_DEBUG, "load_plugins: no post plugin named 
%s found\n", name);
++    return NULL;
++  }
+ }
+ 
+ void xine_post_dispose(xine_t *xine, xine_post_t *post_gen) {

Reply via email to