- Fix PAD_IS_USABLE on ghostpads
authorWim Taymans <wim.taymans@gmail.com>
Tue, 31 Dec 2002 14:51:54 +0000 (14:51 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 31 Dec 2002 14:51:54 +0000 (14:51 +0000)
Original commit message from CVS:
- Fix PAD_IS_USABLE on ghostpads
- fix typos in gstindex.h flags
- conditional lock in trashstack asm

gst/gstelement.c
gst/gstindex.h
gst/gstpad.h
gst/gsttrashstack.h

index 0af8858..0e3461d 100644 (file)
@@ -145,8 +145,6 @@ gst_element_class_init (GstElementClass *klass)
   klass->elementfactory                = NULL;
   klass->padtemplates                  = NULL;
   klass->numpadtemplates               = 0;
-  klass->send_event                    = NULL;
-  klass->query                         = NULL;
 }
 
 static void
@@ -1770,22 +1768,19 @@ gst_element_get_random_pad (GstElement *element, GstPadDirection dir)
               GST_DEBUG_PAD_NAME (pad));
 
     if (GST_PAD_DIRECTION (pad) == dir) {
-           /*
-            * FIXME: for some reason a ghosted pad doesn't get it's flag
-            * set, which makes this check fail for them.
       if (GST_PAD_IS_USABLE (pad)) {
-      */
        return pad;
-       /*
       }
-      else
+      else {
         GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is not usable",
                   GST_DEBUG_PAD_NAME (pad));
-                  */
+      }
     }
-    else
+    else {
       GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is in wrong direction",
                  GST_DEBUG_PAD_NAME (pad));
+    }
+
     pads = g_list_next (pads);
   }
   return NULL;
index be7d669..bdf342b 100644 (file)
@@ -74,11 +74,11 @@ struct _GstIndexAssociation {
 };
 
 typedef enum {
-  GST_ACCOCIATION_FLAG_NONE    = 0,
-  GST_ACCOCIATION_FLAG_KEY_UNIT = (1 << 0),
+  GST_ASSOCIATION_FLAG_NONE    = 0,
+  GST_ASSOCIATION_FLAG_KEY_UNIT = (1 << 0),
 
   /* new flags should start here */
-  GST_ACCOCIATION_FLAG_LAST    = (1 << 8),
+  GST_ASSOCIATION_FLAG_LAST    = (1 << 8),
 } GstAssocFlags;
 
 #define GST_INDEX_FORMAT_FORMAT(entry)         ((entry)->data.format.format)
index 0597586..54e6e45 100644 (file)
@@ -277,7 +277,7 @@ struct _GstGhostPadClass {
 
 /* Some check functions (unused?) */
 #define GST_PAD_IS_CONNECTED(pad)      (GST_PAD_PEER(pad) != NULL)
-#define GST_PAD_IS_ACTIVE(pad)         (!GST_FLAG_IS_SET(pad, GST_PAD_DISABLED))
+#define GST_PAD_IS_ACTIVE(pad)         (!GST_FLAG_IS_SET(GST_PAD_REALIZE(pad), GST_PAD_DISABLED))
 #define GST_PAD_IS_USABLE(pad)         (GST_PAD_IS_CONNECTED (pad) && \
                                         GST_PAD_IS_ACTIVE(pad) && GST_PAD_IS_ACTIVE(GST_PAD_PEER (pad)))
 #define GST_PAD_CAN_PULL(pad)          (GST_IS_REAL_PAD(pad) && GST_REAL_PAD(pad)->gethandler != NULL)
index 3c1ba33..b814dfc 100644 (file)
@@ -50,6 +50,12 @@ GST_INLINE_FUNC gpointer     gst_trash_stack_pop     (GstTrashStack *stack);
 
 #if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2 
 
+#ifdef GST_CONFIG_NO_SMP
+#define SMP_LOCK ""
+#else
+#define SMP_LOCK "lock ; "
+#endif
+
 /*
  * intel ia32 optimized lockfree implementations
  */
@@ -71,7 +77,7 @@ gst_trash_stack_push (GstTrashStack *stack, gpointer mem)
  __asm__ __volatile__ (
    "1:                         \n\t"
    "  movl %2, (%1);           \n\t"   /* mem->next == stack->head */
-   "  lock; cmpxchg %1, %0;    \n\t"   /* if head unchanged, move mem into it */
+   SMP_LOCK "cmpxchg %1, %0;   \n\t"   /* if head unchanged, move mem into it */
    "  jnz 1b;                  \n"     /* head changed, retry */
      :
      : "m" (*stack),
@@ -98,7 +104,7 @@ gst_trash_stack_pop (GstTrashStack *stack)
     "  movl (%%eax), %%ebx;     \n\t"  /* take value pointed to by head (head->next) */
     "  movl %%edx, %%ecx;       \n\t"  /* take counter */
     "  incl %%ecx;              \n\t"  /* and increment */
-    "  lock; cmpxchg8b %1;      \n\t"  /* if eax:edx == *stack, move ebx:ecx to *stack,
+    SMP_LOCK "cmpxchg8b %1;     \n\t"  /* if eax:edx == *stack, move ebx:ecx to *stack,
                                         * else *stack is moved into eax:edx again... */
     "  jnz 10b;                 \n\t"  /* ... and we retry */
     "20:                        \n"
@@ -178,7 +184,7 @@ gst_trash_stack_free (GstTrashStack *stack)
   g_free (stack);
 }
 
-#endif /* defined (G_CAN_INLINE) || defined (__GST_TRASH_STACK_C__)*/
+#endif /* defined (GST_CAN_INLINE) || defined (__GST_TRASH_STACK_C__)*/
 
 G_END_DECLS