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
<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 \
<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 \
GtkObject
+ GtkWidget
+ GtkRange
+ GtkContainer
GstObject
GstElement
GstBin
GstFakeSrc
GstDiskSrc
GstAsyncDiskSrc
+ GstHttpSrc
GstFdSrc
GstAudioSrc
GstSineSrc
</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>
+
</para>
-<!-- ##### ARG GstHttpSrc:bytesperread ##### -->
-<para>
-Specify how many bytes to read at a time.
-
-</para>
-
-
<!-- ##### STRUCT GstBinClass ##### -->
<para>
@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>
</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>
</para>
-<!-- ##### MACRO GST_THREAD_CLASS ##### -->
+<!-- ##### STRUCT GstFakeSink ##### -->
<para>
</para>
-@klass:
-<!-- ##### STRUCT GstFakeSink ##### -->
+<!-- ##### MACRO GST_THREAD_CLASS ##### -->
<para>
</para>
+@klass:
<!-- ##### MACRO GST_BIN_CLASS ##### -->
<para>
</para>
-<!-- ##### MACRO GST_ESDSINK_CLASS ##### -->
+<!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### -->
<para>
</para>
@klass:
-<!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### -->
+<!-- ##### MACRO GST_ESDSINK_CLASS ##### -->
<para>
</para>
</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>
</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>
@obj:
-<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
-
-
-
<!-- ##### FUNCTION gst_audiosrc_push ##### -->
<para>
@src:
+<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
+
+
+
<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
<para>
@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>
* Boston, MA 02111-1307, USA.
*/
+//#define DEBUG_ENABLED
#include <gstqueue.h>
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);
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);
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;
/* 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);
}
// 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(">");
}
}
/* 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);
}
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) {
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 */
}
/* 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 */
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);
}
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;
* Boston, MA 02111-1307, USA.
*/
+//#define DEBUG_ENABLED
#include <gstqueue.h>
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);
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);
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;
/* 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);
}
// 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(">");
}
}
/* 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);
}
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) {
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 */
}
#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
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
}
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;
} 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");
// 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");
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);
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);
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;
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);
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);