mpegtbase: simplify code
authorEdward Hervey <edward@collabora.com>
Fri, 7 Jun 2013 10:53:08 +0000 (12:53 +0200)
committerEdward Hervey <edward@collabora.com>
Wed, 19 Jun 2013 10:29:47 +0000 (12:29 +0200)
We don't need generic methods for push/flush since we know all the
subclass that we control

gst/mpegtsdemux/mpegtsbase.c

index 6f08043..494a8bb 100644 (file)
@@ -1296,9 +1296,7 @@ mpegts_base_flush (MpegTSBase * base, gboolean hard)
   MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base);
 
   /* Call implementation */
-  if (G_UNLIKELY (klass->flush == NULL))
-    GST_WARNING_OBJECT (base, "Class doesn't have a 'flush' implementation !");
-  else
+  if (klass->flush)
     klass->flush (base, hard);
 }
 
@@ -1368,21 +1366,6 @@ query_upstream_latency (MpegTSBase * base)
   base->queried_latency = TRUE;
 }
 
-static inline GstFlowReturn
-mpegts_base_push (MpegTSBase * base, MpegTSPacketizerPacket * packet,
-    MpegTSPacketizerSection * section)
-{
-  MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base);
-
-  /* Call implementation */
-  if (G_UNLIKELY (klass->push == NULL)) {
-    GST_ERROR_OBJECT (base, "Class doesn't have a 'push' implementation !");
-    return GST_FLOW_ERROR;
-  }
-
-  return klass->push (base, packet, section);
-}
-
 static GstFlowReturn
 mpegts_base_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
 {
@@ -1443,11 +1426,11 @@ mpegts_base_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
         }
       }
       /* we need to push section packet downstream */
-      res = mpegts_base_push (base, &packet, &section);
+      res = klass->push (base, &packet, &section);
 
     } else if (MPEGTS_BIT_IS_SET (base->is_pes, packet.pid)) {
       /* push the packet downstream */
-      res = mpegts_base_push (base, &packet, NULL);
+      res = klass->push (base, &packet, NULL);
     }
 
   next: