Fixed the mpeg2 encoder. Added MMX optimisations for motion estimation.
authorWim Taymans <wim.taymans@gmail.com>
Sun, 21 May 2000 21:58:20 +0000 (21:58 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sun, 21 May 2000 21:58:20 +0000 (21:58 +0000)
Original commit message from CVS:
Fixed the mpeg2 encoder. Added MMX optimisations for motion estimation.
Added another mpeg1 encoder.
Added Two filters: smooth and median (a median cut filter)
Made the queue pull buffers.

13 files changed:
configure.in
docs/gst/gstreamer-decl.txt
docs/gst/gstreamer.hierarchy
docs/gst/tmpl/gsthttpsrc.sgml
docs/gst/tmpl/gstreamer-unused.sgml
gst/elements/gstqueue.c
gst/gstbuffer.h
libs/videoscale/gstvideoscale.c
plugins/elements/gstqueue.c
test/Makefile.am
test/avi2mpg.c
test/mp2tomp1.c
test/vidcapture.c

index 0550616..542948b 100644 (file)
@@ -345,8 +345,12 @@ plugins/mpeg2/mpeg2enc/Makefile
 plugins/mpeg1/Makefile
 plugins/mpeg1/mpeg_play/Makefile
 plugins/mpeg1/parse/Makefile
+plugins/mpeg1/mpeg1encoder/Makefile
 plugins/mpeg1video/Makefile
 plugins/mpeg1video/parse/Makefile
+plugins/filters/Makefile
+plugins/filters/smooth/Makefile
+plugins/filters/median/Makefile
 plugins/effects/Makefile
 plugins/effects/stereo/Makefile
 plugins/effects/volume/Makefile
index ca4a6d4..ce2f17a 100644 (file)
@@ -359,6 +359,64 @@ GstBuffer *buffer
 <RETURNS>void  </RETURNS>
 GstBuffer *buffer,GstMeta *meta
 </FUNCTION>
+<TYPEDEF>
+<NAME>GstClockTime</NAME>
+typedef guint64 GstClockTime;
+</TYPEDEF>
+<TYPEDEF>
+<NAME>GstClockTimeDiff</NAME>
+typedef gint64 GstClockTimeDiff;
+</TYPEDEF>
+<MACRO>
+<NAME>GST_CLOCK_DIFF</NAME>
+#define GST_CLOCK_DIFF(s, e) (GstClockTimeDiff)((s)-(e))
+</MACRO>
+<STRUCT>
+<NAME>GstClock</NAME>
+</STRUCT>
+<STRUCT>
+<NAME>GstClock</NAME>
+struct GstClock {
+  gchar *name;
+  GstClockTime start_time;
+  GstClockTime current_time;
+  GstClockTimeDiff adjust;
+  gboolean locking;
+  GList *sinkobjects;
+  GMutex *sinkmutex;
+  GMutex *lock;
+};
+</STRUCT>
+<FUNCTION>
+<NAME>gst_clock_new</NAME>
+<RETURNS>GstClock  *</RETURNS>
+gchar *name
+</FUNCTION>
+<FUNCTION>
+<NAME>gst_clock_get_system</NAME>
+<RETURNS>GstClock  *</RETURNS>
+void
+</FUNCTION>
+<FUNCTION>
+<NAME>gst_clock_register</NAME>
+<RETURNS>void  </RETURNS>
+GstClock *clock, GstObject *obj
+</FUNCTION>
+<FUNCTION>
+<NAME>gst_clock_set</NAME>
+<RETURNS>void  </RETURNS>
+GstClock *clock, GstClockTime time
+</FUNCTION>
+<FUNCTION>
+<NAME>gst_clock_reset</NAME>
+<RETURNS>void  </RETURNS>
+GstClock *clock
+</FUNCTION>
+<FUNCTION>
+<NAME>gst_clock_wait</NAME>
+<RETURNS>void  </RETURNS>
+GstClock *clock, GstClockTime time, GstObject *obj
+</FUNCTION>
 <MACRO>
 <NAME>GST_TYPE_CONNECTION</NAME>
 #define GST_TYPE_CONNECTION \
@@ -1767,64 +1825,6 @@ GtkObject *object,guchar *argname
 <RETURNS>xmlDocPtr  </RETURNS>
 GstElement *element
 </FUNCTION>
-<TYPEDEF>
-<NAME>GstClockTime</NAME>
-typedef guint64 GstClockTime;
-</TYPEDEF>
-<TYPEDEF>
-<NAME>GstClockTimeDiff</NAME>
-typedef gint64 GstClockTimeDiff;
-</TYPEDEF>
-<MACRO>
-<NAME>GST_CLOCK_DIFF</NAME>
-#define GST_CLOCK_DIFF(s, e) (GstClockTimeDiff)((s)-(e))
-</MACRO>
-<STRUCT>
-<NAME>GstClock</NAME>
-</STRUCT>
-<STRUCT>
-<NAME>GstClock</NAME>
-struct GstClock {
-  gchar *name;
-  GstClockTime start_time;
-  GstClockTime current_time;
-  GstClockTimeDiff adjust;
-  gboolean locking;
-  GList *sinkobjects;
-  GMutex *sinkmutex;
-  GMutex *lock;
-};
-</STRUCT>
-<FUNCTION>
-<NAME>gst_clock_new</NAME>
-<RETURNS>GstClock  *</RETURNS>
-gchar *name
-</FUNCTION>
-<FUNCTION>
-<NAME>gst_clock_get_system</NAME>
-<RETURNS>GstClock  *</RETURNS>
-void
-</FUNCTION>
-<FUNCTION>
-<NAME>gst_clock_register</NAME>
-<RETURNS>void  </RETURNS>
-GstClock *clock, GstObject *obj
-</FUNCTION>
-<FUNCTION>
-<NAME>gst_clock_set</NAME>
-<RETURNS>void  </RETURNS>
-GstClock *clock, GstClockTime time
-</FUNCTION>
-<FUNCTION>
-<NAME>gst_clock_reset</NAME>
-<RETURNS>void  </RETURNS>
-GstClock *clock
-</FUNCTION>
-<FUNCTION>
-<NAME>gst_clock_wait</NAME>
-<RETURNS>void  </RETURNS>
-GstClock *clock, GstClockTime time, GstObject *obj
-</FUNCTION>
 <MACRO>
 <NAME>GST_TYPE_ASYNCDISKSRC</NAME>
 #define GST_TYPE_ASYNCDISKSRC \
index 9ff9ac8..9f67b2d 100644 (file)
@@ -1,4 +1,7 @@
 GtkObject
+  GtkWidget
+    GtkRange
+    GtkContainer
   GstObject
     GstElement
       GstBin
@@ -15,6 +18,7 @@ GtkObject
         GstFakeSrc
         GstDiskSrc
         GstAsyncDiskSrc
+        GstHttpSrc
         GstFdSrc
         GstAudioSrc
         GstSineSrc
index 2ba4a00..f1c74b8 100644 (file)
@@ -14,3 +14,14 @@ Reads data from a URL.
 
 </para>
 
+<!-- ##### ARG GstHttpSrc:location ##### -->
+<para>
+Specify the location of the file. The location must be a fully qualified URL.
+</para>
+
+<!-- ##### ARG GstHttpSrc:bytesperread ##### -->
+<para>
+Specify how many bytes to read at a time.
+
+</para>
+
index 24320c0..3a53dc7 100644 (file)
 </para>
 
 
-<!-- ##### ARG GstHttpSrc:bytesperread ##### -->
-<para>
-Specify how many bytes to read at a time.
-
-</para>
-
-
 <!-- ##### STRUCT GstBinClass ##### -->
 <para>
 
@@ -174,19 +167,19 @@ Specify how many bytes to read at a time.
 
 @Returns: 
 
-<!-- ##### MACRO GST_SINESRC ##### -->
+<!-- ##### FUNCTION gst_object_get_type ##### -->
 <para>
 
 </para>
 
-@obj
+@Returns
 
-<!-- ##### FUNCTION gst_object_get_type ##### -->
+<!-- ##### MACRO GST_SINESRC ##### -->
 <para>
 
 </para>
 
-@Returns
+@obj
 
 <!-- ##### SECTION ./tmpl/plugin.sgml:Long_Description ##### -->
 <para>
@@ -194,19 +187,19 @@ Specify how many bytes to read at a time.
 </para>
 
 
-<!-- ##### MACRO GST_QUEUE_CLASS ##### -->
+<!-- ##### FUNCTION gst_audiosrc_get_type ##### -->
 <para>
 
 </para>
 
-@klass: 
+@Returns: 
 
-<!-- ##### FUNCTION gst_audiosrc_get_type ##### -->
+<!-- ##### MACRO GST_QUEUE_CLASS ##### -->
 <para>
 
 </para>
 
-@Returns: 
+@klass: 
 
 <!-- ##### MACRO GST_IS_QUEUE ##### -->
 <para>
@@ -346,18 +339,18 @@ Specify how many bytes to read at a time.
 </para>
 
 
-<!-- ##### MACRO GST_THREAD_CLASS ##### -->
+<!-- ##### STRUCT GstFakeSink ##### -->
 <para>
 
 </para>
 
-@klass: 
 
-<!-- ##### STRUCT GstFakeSink ##### -->
+<!-- ##### MACRO GST_THREAD_CLASS ##### -->
 <para>
 
 </para>
 
+@klass: 
 
 <!-- ##### MACRO GST_BIN_CLASS ##### -->
 <para>
@@ -667,14 +660,14 @@ The frequency.
 </para>
 
 
-<!-- ##### MACRO GST_ESDSINK_CLASS ##### -->
+<!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### -->
 <para>
 
 </para>
 
 @klass: 
 
-<!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### -->
+<!-- ##### MACRO GST_ESDSINK_CLASS ##### -->
 <para>
 
 </para>
@@ -1274,19 +1267,19 @@ plugin
 </para>
 
 
-<!-- ##### FUNCTION gst_audiosink_get_type ##### -->
+<!-- ##### MACRO GST_META ##### -->
 <para>
 
 </para>
 
-@Returns
+@meta
 
-<!-- ##### MACRO GST_META ##### -->
+<!-- ##### FUNCTION gst_audiosink_get_type ##### -->
 <para>
 
 </para>
 
-@meta
+@Returns
 
 <!-- ##### FUNCTION gst_httpsrc_get_type ##### -->
 <para>
@@ -1329,18 +1322,18 @@ plugin
 </para>
 
 
-<!-- ##### MACRO GST_TYPE_FILTER ##### -->
+<!-- ##### MACRO GST_IS_SINESRC_CLASS ##### -->
 <para>
 
 </para>
 
+@obj: 
 
-<!-- ##### MACRO GST_IS_SINESRC_CLASS ##### -->
+<!-- ##### MACRO GST_TYPE_FILTER ##### -->
 <para>
 
 </para>
 
-@obj: 
 
 <!-- ##### MACRO GST_IS_AUDIOSRC_CLASS ##### -->
 <para>
@@ -1419,10 +1412,6 @@ GstElement
 
 @obj: 
 
-<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
-
-
-
 <!-- ##### FUNCTION gst_audiosrc_push ##### -->
 <para>
 
@@ -1430,6 +1419,10 @@ GstElement
 
 @src: 
 
+<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
+
+
+
 <!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
 <para>
 
@@ -1495,12 +1488,6 @@ GstElement
 
 @klass: 
 
-<!-- ##### ARG GstHttpSrc:location ##### -->
-<para>
-Specify the location of the file. The location must be a fully qualified URL.
-</para>
-
-
 <!-- ##### MACRO GST_IS_AUDIOSINK ##### -->
 <para>
 
index 45867c6..4cf73cc 100644 (file)
@@ -17,6 +17,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+//#define DEBUG_ENABLED
 
 #include <gstqueue.h>
 
@@ -48,6 +49,7 @@ static void gst_queue_class_init(GstQueueClass *klass);
 static void gst_queue_init(GstQueue *queue);
 static void gst_queue_set_arg(GtkObject *object,GtkArg *arg,guint id);
 static void gst_queue_get_arg(GtkObject *object,GtkArg *arg,guint id);
+static GstBuffer *gst_queue_pull(GstPad *pad);
 
 void gst_queue_push(GstConnection *connection);
 void gst_queue_chain(GstPad *pad,GstBuffer *buf);
@@ -99,6 +101,7 @@ static void gst_queue_init(GstQueue *queue) {
   queue->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
   gst_element_add_pad(GST_ELEMENT(queue),queue->sinkpad);
   gst_pad_set_chain_function(queue->sinkpad,gst_queue_chain);
+  gst_pad_set_pull_function(queue->sinkpad,gst_queue_pull);
   queue->srcpad = gst_pad_new("src",GST_PAD_SRC);
   gst_element_add_pad(GST_ELEMENT(queue),queue->srcpad);
 
@@ -123,6 +126,18 @@ GstElement *gst_queue_new(gchar *name) {
   return queue;
 }
 
+static GstBuffer *gst_queue_pull(GstPad *pad) {
+  GstQueue *queue;
+  GstBuffer *buf;
+
+  queue = GST_QUEUE(pad->parent);
+
+  if (GST_PAD_CAN_PULL(queue->srcpad) && (buf = gst_pad_pull(queue->srcpad)) != NULL) {
+    return buf;
+  }
+  else return NULL;
+}
+
 void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
   GstQueue *queue;
   gboolean tosignal = FALSE;
@@ -136,19 +151,19 @@ void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
   /* we have to lock the queue since we span threads */
   
   GST_LOCK(queue);
-  //g_print("queue: chain %d\n", queue->level_buffers);
+  DEBUG("queue: chain %d %p\n", queue->level_buffers, buf);
 
   if (queue->level_buffers >= queue->max_buffers) {
-         //g_print("queue: waiting %d\n", queue->level_buffers);
+    DEBUG("queue: waiting %d\n", queue->level_buffers);
     GST_UNLOCK(queue);
     while (queue->level_buffers >= queue->max_buffers) {
       g_mutex_lock(queue->fulllock);
-//      g_print("0");
+      //g_print("O");
       g_cond_wait(queue->fullcond,queue->fulllock);
       g_mutex_unlock(queue->fulllock);
     }
     GST_LOCK(queue);
-         //g_print("queue: waiting done %d\n", queue->level_buffers);
+    DEBUG("queue: waiting done %d\n", queue->level_buffers);
   }
   
 
@@ -163,20 +178,21 @@ void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
 //    queue->tail = g_list_next(queue->tail);
     queue->queue = g_list_append(queue->queue,buf);
   }
-//  g_print("+");
+  //g_print("+");
 
   /* if we were empty, but aren't any more, signal a condition */
-  tosignal = (queue->level_buffers++ == 0);
+  tosignal = (queue->level_buffers <= 0);
+  queue->level_buffers++;
 
   /* we can unlock now */
-       //g_print("queue: chain %d end\n", queue->level_buffers);
+  DEBUG("queue: chain %d end\n", queue->level_buffers);
   GST_UNLOCK(queue);
 
   if (tosignal) {
     g_mutex_lock(queue->emptylock);
     g_cond_signal(queue->emptycond);
     g_mutex_unlock(queue->emptylock);
-//    g_print(">");
+    //g_print(">");
   }
 }
 
@@ -188,13 +204,13 @@ void gst_queue_push(GstConnection *connection) {
 
   /* have to lock for thread-safety */
   GST_LOCK(queue);
-       //g_print("queue: push %d\n", queue->level_buffers);
+  DEBUG("queue: push %d\n", queue->level_buffers);
 
   if (!queue->level_buffers) {
     GST_UNLOCK(queue);
     while (!queue->level_buffers) {
       g_mutex_lock(queue->emptylock);
-//      g_print("0");
+      //g_print("U");
       g_cond_wait(queue->emptycond,queue->emptylock);
       g_mutex_unlock(queue->emptylock);
     }
@@ -204,14 +220,10 @@ void gst_queue_push(GstConnection *connection) {
   front = queue->queue;
   buf = (GstBuffer *)(front->data);
   queue->queue = g_list_remove_link(queue->queue,front);
-       //g_print("queue: pushing %d\n", queue->level_buffers);
-  gst_pad_push(queue->srcpad,buf);
-       //g_print("queue: pushing %d done\n", queue->level_buffers);
   g_list_free(front);
   queue->level_buffers--;
-
+  //g_print("-%d", queue->level_buffers);
   tosignal = queue->level_buffers < queue->max_buffers;
-       //g_print("queue: push end %d\n", queue->level_buffers);
   GST_UNLOCK(queue);
 
   if (tosignal) {
@@ -219,7 +231,10 @@ void gst_queue_push(GstConnection *connection) {
     g_cond_signal(queue->fullcond);
     g_mutex_unlock(queue->fulllock);
   }
-  
+
+  DEBUG("queue: pushing %d %p\n", queue->level_buffers, buf);
+  gst_pad_push(queue->srcpad,buf);
+  DEBUG("queue: pushing %d done\n", queue->level_buffers);
 
   /* unlock now */
 }
index f52db4f..a550a25 100644 (file)
@@ -73,8 +73,10 @@ struct _GstBuffer {
   /* refcounting */
 #ifdef HAVE_ATOMIC_H
   atomic_t refcount;
+#define GST_BUFFER_REFCOUNT(buf)       (atomic_read(&(GST_BUFFER((buf))->refcount)))
 #else
   int refcount;
+#define GST_BUFFER_REFCOUNT(buf)       (GST_BUFFER(buf)->refcount)
 #endif
 
   /* data type of this buffer */
index 8ac083a..0b78c63 100644 (file)
@@ -74,18 +74,19 @@ static char gst_videoscale_interp_simple(unsigned char *src, int x, int y, int d
   int interp;
   int i,j;
 
-  if (x>0) src--;
-  if (x>dw-1) src--;
-  if (y>0) src-=sw;
-  if (y>dh-1) src-=sw;
+  //printf("scale: %d %d %p\n", ix, iy, src);
+  if (x>=ix) src-=(ix);
+  if (y>=iy) src-=(sw*iy);
 
   isourcep = src;
   interp =0;
 
   for (i =0; i<iy; i++) {
     for (j =0; j<ix; j++) {
+      //printf("%d ", *isourcep);
       interp += *isourcep++;
     }
+    //printf("\n");
     isourcep = isourcep-ix+sw;
   }
   return interp/(ix*iy);
@@ -153,7 +154,8 @@ static void gst_videoscale_scale_plane(unsigned char *src, unsigned char *dest,
       }
       sourcep += xinc;
 
-      *dest++ = gst_videoscale_interp_other(sourcep, x, y, dw, dh, sw, sh, 3, 3);
+      *dest++ = gst_videoscale_interp_simple(sourcep, x, y, dw, dh, sw, sh, xinc+xskip, yinc+yskip);
+      //*dest++ = *sourcep;
     }
     if (dy <= 0) {
       dy += incyE;
index 45867c6..4cf73cc 100644 (file)
@@ -17,6 +17,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+//#define DEBUG_ENABLED
 
 #include <gstqueue.h>
 
@@ -48,6 +49,7 @@ static void gst_queue_class_init(GstQueueClass *klass);
 static void gst_queue_init(GstQueue *queue);
 static void gst_queue_set_arg(GtkObject *object,GtkArg *arg,guint id);
 static void gst_queue_get_arg(GtkObject *object,GtkArg *arg,guint id);
+static GstBuffer *gst_queue_pull(GstPad *pad);
 
 void gst_queue_push(GstConnection *connection);
 void gst_queue_chain(GstPad *pad,GstBuffer *buf);
@@ -99,6 +101,7 @@ static void gst_queue_init(GstQueue *queue) {
   queue->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
   gst_element_add_pad(GST_ELEMENT(queue),queue->sinkpad);
   gst_pad_set_chain_function(queue->sinkpad,gst_queue_chain);
+  gst_pad_set_pull_function(queue->sinkpad,gst_queue_pull);
   queue->srcpad = gst_pad_new("src",GST_PAD_SRC);
   gst_element_add_pad(GST_ELEMENT(queue),queue->srcpad);
 
@@ -123,6 +126,18 @@ GstElement *gst_queue_new(gchar *name) {
   return queue;
 }
 
+static GstBuffer *gst_queue_pull(GstPad *pad) {
+  GstQueue *queue;
+  GstBuffer *buf;
+
+  queue = GST_QUEUE(pad->parent);
+
+  if (GST_PAD_CAN_PULL(queue->srcpad) && (buf = gst_pad_pull(queue->srcpad)) != NULL) {
+    return buf;
+  }
+  else return NULL;
+}
+
 void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
   GstQueue *queue;
   gboolean tosignal = FALSE;
@@ -136,19 +151,19 @@ void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
   /* we have to lock the queue since we span threads */
   
   GST_LOCK(queue);
-  //g_print("queue: chain %d\n", queue->level_buffers);
+  DEBUG("queue: chain %d %p\n", queue->level_buffers, buf);
 
   if (queue->level_buffers >= queue->max_buffers) {
-         //g_print("queue: waiting %d\n", queue->level_buffers);
+    DEBUG("queue: waiting %d\n", queue->level_buffers);
     GST_UNLOCK(queue);
     while (queue->level_buffers >= queue->max_buffers) {
       g_mutex_lock(queue->fulllock);
-//      g_print("0");
+      //g_print("O");
       g_cond_wait(queue->fullcond,queue->fulllock);
       g_mutex_unlock(queue->fulllock);
     }
     GST_LOCK(queue);
-         //g_print("queue: waiting done %d\n", queue->level_buffers);
+    DEBUG("queue: waiting done %d\n", queue->level_buffers);
   }
   
 
@@ -163,20 +178,21 @@ void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
 //    queue->tail = g_list_next(queue->tail);
     queue->queue = g_list_append(queue->queue,buf);
   }
-//  g_print("+");
+  //g_print("+");
 
   /* if we were empty, but aren't any more, signal a condition */
-  tosignal = (queue->level_buffers++ == 0);
+  tosignal = (queue->level_buffers <= 0);
+  queue->level_buffers++;
 
   /* we can unlock now */
-       //g_print("queue: chain %d end\n", queue->level_buffers);
+  DEBUG("queue: chain %d end\n", queue->level_buffers);
   GST_UNLOCK(queue);
 
   if (tosignal) {
     g_mutex_lock(queue->emptylock);
     g_cond_signal(queue->emptycond);
     g_mutex_unlock(queue->emptylock);
-//    g_print(">");
+    //g_print(">");
   }
 }
 
@@ -188,13 +204,13 @@ void gst_queue_push(GstConnection *connection) {
 
   /* have to lock for thread-safety */
   GST_LOCK(queue);
-       //g_print("queue: push %d\n", queue->level_buffers);
+  DEBUG("queue: push %d\n", queue->level_buffers);
 
   if (!queue->level_buffers) {
     GST_UNLOCK(queue);
     while (!queue->level_buffers) {
       g_mutex_lock(queue->emptylock);
-//      g_print("0");
+      //g_print("U");
       g_cond_wait(queue->emptycond,queue->emptylock);
       g_mutex_unlock(queue->emptylock);
     }
@@ -204,14 +220,10 @@ void gst_queue_push(GstConnection *connection) {
   front = queue->queue;
   buf = (GstBuffer *)(front->data);
   queue->queue = g_list_remove_link(queue->queue,front);
-       //g_print("queue: pushing %d\n", queue->level_buffers);
-  gst_pad_push(queue->srcpad,buf);
-       //g_print("queue: pushing %d done\n", queue->level_buffers);
   g_list_free(front);
   queue->level_buffers--;
-
+  //g_print("-%d", queue->level_buffers);
   tosignal = queue->level_buffers < queue->max_buffers;
-       //g_print("queue: push end %d\n", queue->level_buffers);
   GST_UNLOCK(queue);
 
   if (tosignal) {
@@ -219,7 +231,10 @@ void gst_queue_push(GstConnection *connection) {
     g_cond_signal(queue->fullcond);
     g_mutex_unlock(queue->fulllock);
   }
-  
+
+  DEBUG("queue: pushing %d %p\n", queue->level_buffers, buf);
+  gst_pad_push(queue->srcpad,buf);
+  DEBUG("queue: pushing %d done\n", queue->level_buffers);
 
   /* unlock now */
 }
index 27c826a..25dce54 100644 (file)
@@ -1,7 +1,7 @@
 #noinst_PROGRAMS = basic m types a r plugin w s args mpg123 mcut push qtest
 noinst_PROGRAMS = qtest spectrum record wave mp3 teardown buffer mp3parse \
                  mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \
-                       aviparse vidcapture avi2mpg mp2tomp1
+                       aviparse vidcapture avi2mpg mp2tomp1 mp1tomp1
 
 SUBDIRS = xml cothreads bindings
 
@@ -19,6 +19,8 @@ mpeg2parse_CFLAGS = $(shell gnome-config --cflags gnomeui)
 mpeg2parse_LDFLAGS = $(shell gnome-config --libs gnomeui)
 mp2tomp1_CFLAGS = $(shell gnome-config --cflags gnomeui)
 mp2tomp1_LDFLAGS = $(shell gnome-config --libs gnomeui)
+mp1tomp1_CFLAGS = $(shell gnome-config --cflags gnomeui)
+mp1tomp1_LDFLAGS = $(shell gnome-config --libs gnomeui)
 
 buffer_SOURCES = buffer.c mem.c
 teardown_SOURCES = teardown.c mem.c
index c332dc5..23203e6 100644 (file)
@@ -16,7 +16,7 @@ void eof(GstSrc *src) {
 }
 
 void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) {
-  GstElement *parse_audio, *parse_video, *decode, *decode_video, *play, *encode;
+  GstElement *parse_audio, *parse_video, *decode, *decode_video, *play, *encode, *smooth;
   GstElement *audio_queue, *video_queue;
   GstElement *audio_thread, *video_thread;
   GstElement *fdsink;
@@ -60,11 +60,16 @@ void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) {
   } else if (strncmp(gst_pad_get_name(pad), "video_", 6) == 0) {
   //} else if (0) {
 
+    gst_plugin_load("smooth");
+    gst_plugin_load("median");
     gst_plugin_load("mpeg2enc");
     // construct internal pipeline elements
+    smooth = gst_elementfactory_make("smooth","smooth");
+    //smooth = gst_elementfactory_make("median","median");
+    g_return_if_fail(smooth != NULL);
+    //gtk_object_set(GTK_OBJECT(smooth),"filtersize",9,NULL);
     encode = gst_elementfactory_make("mpeg2enc","encode");
     g_return_if_fail(encode != NULL);
-    //gtk_object_set(GTK_OBJECT(show),"width",640, "height", 480,NULL);
     fd = open(outfile,O_CREAT|O_RDWR|O_TRUNC);
     
     fdsinkfactory = gst_elementfactory_find("fdsink");
@@ -76,14 +81,17 @@ void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) {
     // create the thread and pack stuff into it
     video_thread = gst_thread_new("video_thread");
     g_return_if_fail(video_thread != NULL);
+    gst_bin_add(GST_BIN(video_thread),GST_ELEMENT(smooth));
     gst_bin_add(GST_BIN(video_thread),GST_ELEMENT(encode));
     gst_bin_add(GST_BIN(video_thread),GST_ELEMENT(fdsink));
+    gst_pad_connect(gst_element_get_pad(smooth,"src"),
+                    gst_element_get_pad(encode,"sink"));
     gst_pad_connect(gst_element_get_pad(encode,"src"),
                     gst_element_get_pad(fdsink,"sink"));
 
     // set up pad connections
     gst_element_add_ghost_pad(GST_ELEMENT(video_thread),
-                              gst_element_get_pad(encode,"sink"));
+                              gst_element_get_pad(smooth,"sink"));
 
     // construct queue and connect everything in the main pipeline
     video_queue = gst_elementfactory_make("queue","video_queue");
index 5557e62..7d7b3ef 100644 (file)
@@ -116,6 +116,7 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) {
     gst_plugin_load("mpeg2play");
     gst_plugin_load("videoscale");
     gst_plugin_load("mpeg2enc");
+    //gst_plugin_load("mpeg1encoder");
     // construct internal pipeline elements
     parse_video = gst_elementfactory_make("mp1videoparse","parse_video");
     g_return_if_fail(parse_video != NULL);
@@ -124,6 +125,7 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) {
     videoscale = gst_elementfactory_make("videoscale","videoscale");
     g_return_if_fail(videoscale != NULL);
     encode = gst_elementfactory_make("mpeg2enc","encode");
+    //encode = gst_elementfactory_make("mpeg1encoder","encode");
     g_return_if_fail(encode != NULL);
     //gtk_object_set(GTK_OBJECT(show),"width",640, "height", 480,NULL);
     fd = open(outfile,O_CREAT|O_RDWR|O_TRUNC);
index ecc6a28..1886bbe 100644 (file)
@@ -7,7 +7,7 @@
 int main(int argc,char *argv[]) {
   int fd;
   GstPipeline *pipeline;
-  GstElement *audiosrc, *videosrc, *fdsink, *encoder, *compress;
+  GstElement *audiosrc, *videosrc, *fdsink, *encoder, *compress, *video_queue, *video_thread;
   GstElementFactory *audiosrcfactory, *fdsinkfactory, *encoderfactory, *compressfactory;
   GstElementFactory *videosrcfactory;
   GList *padlist;
@@ -22,13 +22,14 @@ int main(int argc,char *argv[]) {
 
   audiosrcfactory = gst_elementfactory_find("audiosrc");
   audiosrc = gst_elementfactory_create(audiosrcfactory,"audiosrc");
+
   videosrcfactory = gst_elementfactory_find("v4lsrc");
   videosrc = gst_elementfactory_create(videosrcfactory,"videosrc");
   compressfactory = gst_elementfactory_find("jpegenc");
   compress = gst_elementfactory_create(compressfactory,"jpegenc");
   encoderfactory = gst_elementfactory_find("aviencoder");
   encoder = gst_elementfactory_create(encoderfactory,"aviencoder");
-  gtk_object_set(GTK_OBJECT(videosrc),"width",256,"height",192,NULL);
+  gtk_object_set(GTK_OBJECT(videosrc),"width",384,"height",288,NULL);
 
   gtk_object_set(GTK_OBJECT(encoder),"video","00:MJPG",NULL);
 
@@ -38,22 +39,37 @@ int main(int argc,char *argv[]) {
   fdsink = gst_elementfactory_create(fdsinkfactory,"fdsink");
   gtk_object_set(GTK_OBJECT(fdsink),"fd",fd,NULL);
 
-  /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(videosrc));
-  gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(encoder));
-  gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(fdsink));
+
+  /* add objects to the main pipeline */
+  video_thread = gst_thread_new("video_thread");
+  g_return_if_fail(video_thread != NULL);
+  gst_bin_add(GST_BIN(video_thread),GST_ELEMENT(compress));
+  gst_bin_add(GST_BIN(video_thread),GST_ELEMENT(encoder));
+  gst_bin_add(GST_BIN(video_thread),GST_ELEMENT(fdsink));
 
   /* connect src to sink */
-  gst_pad_connect(gst_element_get_pad(videosrc,"src"),
-                  gst_element_get_pad(compress,"sink"));
+  gst_element_add_ghost_pad(GST_ELEMENT(video_thread),
+                            gst_element_get_pad(compress,"sink"));
   gst_pad_connect(gst_element_get_pad(compress,"src"),
                   gst_element_get_pad(encoder,"video_00"));
   gst_pad_connect(gst_element_get_pad(encoder,"src"),
                   gst_element_get_pad(fdsink,"sink"));
 
+
+  // construct queue and connect everything in the main pipeline
+  video_queue = gst_elementfactory_make("queue","video_queue");
+  gtk_object_set(GTK_OBJECT(video_queue),"max_level",30,NULL);
+  gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(video_queue));
+  gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(video_thread));
+  gst_pad_connect(gst_element_get_pad(videosrc, "src"),
+                  gst_element_get_pad(video_queue,"sink"));
+  gst_pad_connect(gst_element_get_pad(video_queue,"src"),
+                  gst_element_get_pad(video_thread,"sink"));
+
+  gtk_object_set(GTK_OBJECT(video_thread),"create_thread",TRUE,NULL);
   g_print("\neverything's built, setting it up to be runnable\n");
   gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_RUNNING);
-
   g_print("\nok, runnable, hitting 'play'...\n");
   gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);