mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
Fixed the mpeg2 encoder. Added MMX optimisations for motion estimation.
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.
This commit is contained in:
parent
212677286e
commit
8f2b441e96
13 changed files with 227 additions and 159 deletions
|
@ -345,8 +345,12 @@ plugins/mpeg2/mpeg2enc/Makefile
|
||||||
plugins/mpeg1/Makefile
|
plugins/mpeg1/Makefile
|
||||||
plugins/mpeg1/mpeg_play/Makefile
|
plugins/mpeg1/mpeg_play/Makefile
|
||||||
plugins/mpeg1/parse/Makefile
|
plugins/mpeg1/parse/Makefile
|
||||||
|
plugins/mpeg1/mpeg1encoder/Makefile
|
||||||
plugins/mpeg1video/Makefile
|
plugins/mpeg1video/Makefile
|
||||||
plugins/mpeg1video/parse/Makefile
|
plugins/mpeg1video/parse/Makefile
|
||||||
|
plugins/filters/Makefile
|
||||||
|
plugins/filters/smooth/Makefile
|
||||||
|
plugins/filters/median/Makefile
|
||||||
plugins/effects/Makefile
|
plugins/effects/Makefile
|
||||||
plugins/effects/stereo/Makefile
|
plugins/effects/stereo/Makefile
|
||||||
plugins/effects/volume/Makefile
|
plugins/effects/volume/Makefile
|
||||||
|
|
|
@ -359,6 +359,64 @@ GstBuffer *buffer
|
||||||
<RETURNS>void </RETURNS>
|
<RETURNS>void </RETURNS>
|
||||||
GstBuffer *buffer,GstMeta *meta
|
GstBuffer *buffer,GstMeta *meta
|
||||||
</FUNCTION>
|
</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>
|
<MACRO>
|
||||||
<NAME>GST_TYPE_CONNECTION</NAME>
|
<NAME>GST_TYPE_CONNECTION</NAME>
|
||||||
#define GST_TYPE_CONNECTION \
|
#define GST_TYPE_CONNECTION \
|
||||||
|
@ -1767,64 +1825,6 @@ GtkObject *object,guchar *argname
|
||||||
<RETURNS>xmlDocPtr </RETURNS>
|
<RETURNS>xmlDocPtr </RETURNS>
|
||||||
GstElement *element
|
GstElement *element
|
||||||
</FUNCTION>
|
</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>
|
<MACRO>
|
||||||
<NAME>GST_TYPE_ASYNCDISKSRC</NAME>
|
<NAME>GST_TYPE_ASYNCDISKSRC</NAME>
|
||||||
#define GST_TYPE_ASYNCDISKSRC \
|
#define GST_TYPE_ASYNCDISKSRC \
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
GtkObject
|
GtkObject
|
||||||
|
GtkWidget
|
||||||
|
GtkRange
|
||||||
|
GtkContainer
|
||||||
GstObject
|
GstObject
|
||||||
GstElement
|
GstElement
|
||||||
GstBin
|
GstBin
|
||||||
|
@ -15,6 +18,7 @@ GtkObject
|
||||||
GstFakeSrc
|
GstFakeSrc
|
||||||
GstDiskSrc
|
GstDiskSrc
|
||||||
GstAsyncDiskSrc
|
GstAsyncDiskSrc
|
||||||
|
GstHttpSrc
|
||||||
GstFdSrc
|
GstFdSrc
|
||||||
GstAudioSrc
|
GstAudioSrc
|
||||||
GstSineSrc
|
GstSineSrc
|
||||||
|
|
|
@ -14,3 +14,14 @@ Reads data from a URL.
|
||||||
|
|
||||||
</para>
|
</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>
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,6 @@
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### ARG GstHttpSrc:bytesperread ##### -->
|
|
||||||
<para>
|
|
||||||
Specify how many bytes to read at a time.
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### STRUCT GstBinClass ##### -->
|
<!-- ##### STRUCT GstBinClass ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -174,13 +167,6 @@ Specify how many bytes to read at a time.
|
||||||
|
|
||||||
@Returns:
|
@Returns:
|
||||||
|
|
||||||
<!-- ##### MACRO GST_SINESRC ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@obj:
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_object_get_type ##### -->
|
<!-- ##### FUNCTION gst_object_get_type ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -188,19 +174,19 @@ Specify how many bytes to read at a time.
|
||||||
|
|
||||||
@Returns:
|
@Returns:
|
||||||
|
|
||||||
|
<!-- ##### MACRO GST_SINESRC ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@obj:
|
||||||
|
|
||||||
<!-- ##### SECTION ./tmpl/plugin.sgml:Long_Description ##### -->
|
<!-- ##### SECTION ./tmpl/plugin.sgml:Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_QUEUE_CLASS ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@klass:
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_audiosrc_get_type ##### -->
|
<!-- ##### FUNCTION gst_audiosrc_get_type ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -208,6 +194,13 @@ Specify how many bytes to read at a time.
|
||||||
|
|
||||||
@Returns:
|
@Returns:
|
||||||
|
|
||||||
|
<!-- ##### MACRO GST_QUEUE_CLASS ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@klass:
|
||||||
|
|
||||||
<!-- ##### MACRO GST_IS_QUEUE ##### -->
|
<!-- ##### MACRO GST_IS_QUEUE ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -346,6 +339,12 @@ Specify how many bytes to read at a time.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### STRUCT GstFakeSink ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_THREAD_CLASS ##### -->
|
<!-- ##### MACRO GST_THREAD_CLASS ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -353,12 +352,6 @@ Specify how many bytes to read at a time.
|
||||||
|
|
||||||
@klass:
|
@klass:
|
||||||
|
|
||||||
<!-- ##### STRUCT GstFakeSink ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_BIN_CLASS ##### -->
|
<!-- ##### MACRO GST_BIN_CLASS ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -667,14 +660,14 @@ The frequency.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_ESDSINK_CLASS ##### -->
|
<!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@klass:
|
@klass:
|
||||||
|
|
||||||
<!-- ##### MACRO GST_ASYNCDISKSRC_CLASS ##### -->
|
<!-- ##### MACRO GST_ESDSINK_CLASS ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
@ -1274,13 +1267,6 @@ plugin
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_audiosink_get_type ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@Returns:
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_META ##### -->
|
<!-- ##### MACRO GST_META ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -1288,6 +1274,13 @@ plugin
|
||||||
|
|
||||||
@meta:
|
@meta:
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gst_audiosink_get_type ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@Returns:
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_httpsrc_get_type ##### -->
|
<!-- ##### FUNCTION gst_httpsrc_get_type ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -1329,12 +1322,6 @@ plugin
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_TYPE_FILTER ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_IS_SINESRC_CLASS ##### -->
|
<!-- ##### MACRO GST_IS_SINESRC_CLASS ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -1342,6 +1329,12 @@ plugin
|
||||||
|
|
||||||
@obj:
|
@obj:
|
||||||
|
|
||||||
|
<!-- ##### MACRO GST_TYPE_FILTER ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_IS_AUDIOSRC_CLASS ##### -->
|
<!-- ##### MACRO GST_IS_AUDIOSRC_CLASS ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -1419,10 +1412,6 @@ GstElement
|
||||||
|
|
||||||
@obj:
|
@obj:
|
||||||
|
|
||||||
<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_audiosrc_push ##### -->
|
<!-- ##### FUNCTION gst_audiosrc_push ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -1430,6 +1419,10 @@ GstElement
|
||||||
|
|
||||||
@src:
|
@src:
|
||||||
|
|
||||||
|
<!-- ##### SECTION ./tmpl/plugin.sgml:Short_Description ##### -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
|
<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -1495,12 +1488,6 @@ GstElement
|
||||||
|
|
||||||
@klass:
|
@klass:
|
||||||
|
|
||||||
<!-- ##### ARG GstHttpSrc:location ##### -->
|
|
||||||
<para>
|
|
||||||
Specify the location of the file. The location must be a fully qualified URL.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_IS_AUDIOSINK ##### -->
|
<!-- ##### MACRO GST_IS_AUDIOSINK ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//#define DEBUG_ENABLED
|
||||||
|
|
||||||
#include <gstqueue.h>
|
#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_init(GstQueue *queue);
|
||||||
static void gst_queue_set_arg(GtkObject *object,GtkArg *arg,guint id);
|
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 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_push(GstConnection *connection);
|
||||||
void gst_queue_chain(GstPad *pad,GstBuffer *buf);
|
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);
|
queue->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
|
||||||
gst_element_add_pad(GST_ELEMENT(queue),queue->sinkpad);
|
gst_element_add_pad(GST_ELEMENT(queue),queue->sinkpad);
|
||||||
gst_pad_set_chain_function(queue->sinkpad,gst_queue_chain);
|
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);
|
queue->srcpad = gst_pad_new("src",GST_PAD_SRC);
|
||||||
gst_element_add_pad(GST_ELEMENT(queue),queue->srcpad);
|
gst_element_add_pad(GST_ELEMENT(queue),queue->srcpad);
|
||||||
|
|
||||||
|
@ -123,6 +126,18 @@ GstElement *gst_queue_new(gchar *name) {
|
||||||
return queue;
|
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) {
|
void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
||||||
GstQueue *queue;
|
GstQueue *queue;
|
||||||
gboolean tosignal = FALSE;
|
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 */
|
/* we have to lock the queue since we span threads */
|
||||||
|
|
||||||
GST_LOCK(queue);
|
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) {
|
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);
|
GST_UNLOCK(queue);
|
||||||
while (queue->level_buffers >= queue->max_buffers) {
|
while (queue->level_buffers >= queue->max_buffers) {
|
||||||
g_mutex_lock(queue->fulllock);
|
g_mutex_lock(queue->fulllock);
|
||||||
// g_print("0");
|
//g_print("O");
|
||||||
g_cond_wait(queue->fullcond,queue->fulllock);
|
g_cond_wait(queue->fullcond,queue->fulllock);
|
||||||
g_mutex_unlock(queue->fulllock);
|
g_mutex_unlock(queue->fulllock);
|
||||||
}
|
}
|
||||||
GST_LOCK(queue);
|
GST_LOCK(queue);
|
||||||
//g_print("queue: waiting done %d\n", queue->level_buffers);
|
DEBUG("queue: waiting done %d\n", queue->level_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,10 +181,11 @@ void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
||||||
//g_print("+");
|
//g_print("+");
|
||||||
|
|
||||||
/* if we were empty, but aren't any more, signal a condition */
|
/* 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 */
|
/* 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);
|
GST_UNLOCK(queue);
|
||||||
|
|
||||||
if (tosignal) {
|
if (tosignal) {
|
||||||
|
@ -188,13 +204,13 @@ void gst_queue_push(GstConnection *connection) {
|
||||||
|
|
||||||
/* have to lock for thread-safety */
|
/* have to lock for thread-safety */
|
||||||
GST_LOCK(queue);
|
GST_LOCK(queue);
|
||||||
//g_print("queue: push %d\n", queue->level_buffers);
|
DEBUG("queue: push %d\n", queue->level_buffers);
|
||||||
|
|
||||||
if (!queue->level_buffers) {
|
if (!queue->level_buffers) {
|
||||||
GST_UNLOCK(queue);
|
GST_UNLOCK(queue);
|
||||||
while (!queue->level_buffers) {
|
while (!queue->level_buffers) {
|
||||||
g_mutex_lock(queue->emptylock);
|
g_mutex_lock(queue->emptylock);
|
||||||
// g_print("0");
|
//g_print("U");
|
||||||
g_cond_wait(queue->emptycond,queue->emptylock);
|
g_cond_wait(queue->emptycond,queue->emptylock);
|
||||||
g_mutex_unlock(queue->emptylock);
|
g_mutex_unlock(queue->emptylock);
|
||||||
}
|
}
|
||||||
|
@ -204,14 +220,10 @@ void gst_queue_push(GstConnection *connection) {
|
||||||
front = queue->queue;
|
front = queue->queue;
|
||||||
buf = (GstBuffer *)(front->data);
|
buf = (GstBuffer *)(front->data);
|
||||||
queue->queue = g_list_remove_link(queue->queue,front);
|
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);
|
g_list_free(front);
|
||||||
queue->level_buffers--;
|
queue->level_buffers--;
|
||||||
|
//g_print("-%d", queue->level_buffers);
|
||||||
tosignal = queue->level_buffers < queue->max_buffers;
|
tosignal = queue->level_buffers < queue->max_buffers;
|
||||||
//g_print("queue: push end %d\n", queue->level_buffers);
|
|
||||||
GST_UNLOCK(queue);
|
GST_UNLOCK(queue);
|
||||||
|
|
||||||
if (tosignal) {
|
if (tosignal) {
|
||||||
|
@ -220,6 +232,9 @@ void gst_queue_push(GstConnection *connection) {
|
||||||
g_mutex_unlock(queue->fulllock);
|
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 */
|
/* unlock now */
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,8 +73,10 @@ struct _GstBuffer {
|
||||||
/* refcounting */
|
/* refcounting */
|
||||||
#ifdef HAVE_ATOMIC_H
|
#ifdef HAVE_ATOMIC_H
|
||||||
atomic_t refcount;
|
atomic_t refcount;
|
||||||
|
#define GST_BUFFER_REFCOUNT(buf) (atomic_read(&(GST_BUFFER((buf))->refcount)))
|
||||||
#else
|
#else
|
||||||
int refcount;
|
int refcount;
|
||||||
|
#define GST_BUFFER_REFCOUNT(buf) (GST_BUFFER(buf)->refcount)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* data type of this buffer */
|
/* data type of this buffer */
|
||||||
|
|
|
@ -74,18 +74,19 @@ static char gst_videoscale_interp_simple(unsigned char *src, int x, int y, int d
|
||||||
int interp;
|
int interp;
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
if (x>0) src--;
|
//printf("scale: %d %d %p\n", ix, iy, src);
|
||||||
if (x>dw-1) src--;
|
if (x>=ix) src-=(ix);
|
||||||
if (y>0) src-=sw;
|
if (y>=iy) src-=(sw*iy);
|
||||||
if (y>dh-1) src-=sw;
|
|
||||||
|
|
||||||
isourcep = src;
|
isourcep = src;
|
||||||
interp =0;
|
interp =0;
|
||||||
|
|
||||||
for (i =0; i<iy; i++) {
|
for (i =0; i<iy; i++) {
|
||||||
for (j =0; j<ix; j++) {
|
for (j =0; j<ix; j++) {
|
||||||
|
//printf("%d ", *isourcep);
|
||||||
interp += *isourcep++;
|
interp += *isourcep++;
|
||||||
}
|
}
|
||||||
|
//printf("\n");
|
||||||
isourcep = isourcep-ix+sw;
|
isourcep = isourcep-ix+sw;
|
||||||
}
|
}
|
||||||
return interp/(ix*iy);
|
return interp/(ix*iy);
|
||||||
|
@ -153,7 +154,8 @@ static void gst_videoscale_scale_plane(unsigned char *src, unsigned char *dest,
|
||||||
}
|
}
|
||||||
sourcep += xinc;
|
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) {
|
if (dy <= 0) {
|
||||||
dy += incyE;
|
dy += incyE;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//#define DEBUG_ENABLED
|
||||||
|
|
||||||
#include <gstqueue.h>
|
#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_init(GstQueue *queue);
|
||||||
static void gst_queue_set_arg(GtkObject *object,GtkArg *arg,guint id);
|
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 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_push(GstConnection *connection);
|
||||||
void gst_queue_chain(GstPad *pad,GstBuffer *buf);
|
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);
|
queue->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
|
||||||
gst_element_add_pad(GST_ELEMENT(queue),queue->sinkpad);
|
gst_element_add_pad(GST_ELEMENT(queue),queue->sinkpad);
|
||||||
gst_pad_set_chain_function(queue->sinkpad,gst_queue_chain);
|
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);
|
queue->srcpad = gst_pad_new("src",GST_PAD_SRC);
|
||||||
gst_element_add_pad(GST_ELEMENT(queue),queue->srcpad);
|
gst_element_add_pad(GST_ELEMENT(queue),queue->srcpad);
|
||||||
|
|
||||||
|
@ -123,6 +126,18 @@ GstElement *gst_queue_new(gchar *name) {
|
||||||
return queue;
|
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) {
|
void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
||||||
GstQueue *queue;
|
GstQueue *queue;
|
||||||
gboolean tosignal = FALSE;
|
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 */
|
/* we have to lock the queue since we span threads */
|
||||||
|
|
||||||
GST_LOCK(queue);
|
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) {
|
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);
|
GST_UNLOCK(queue);
|
||||||
while (queue->level_buffers >= queue->max_buffers) {
|
while (queue->level_buffers >= queue->max_buffers) {
|
||||||
g_mutex_lock(queue->fulllock);
|
g_mutex_lock(queue->fulllock);
|
||||||
// g_print("0");
|
//g_print("O");
|
||||||
g_cond_wait(queue->fullcond,queue->fulllock);
|
g_cond_wait(queue->fullcond,queue->fulllock);
|
||||||
g_mutex_unlock(queue->fulllock);
|
g_mutex_unlock(queue->fulllock);
|
||||||
}
|
}
|
||||||
GST_LOCK(queue);
|
GST_LOCK(queue);
|
||||||
//g_print("queue: waiting done %d\n", queue->level_buffers);
|
DEBUG("queue: waiting done %d\n", queue->level_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,10 +181,11 @@ void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
||||||
//g_print("+");
|
//g_print("+");
|
||||||
|
|
||||||
/* if we were empty, but aren't any more, signal a condition */
|
/* 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 */
|
/* 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);
|
GST_UNLOCK(queue);
|
||||||
|
|
||||||
if (tosignal) {
|
if (tosignal) {
|
||||||
|
@ -188,13 +204,13 @@ void gst_queue_push(GstConnection *connection) {
|
||||||
|
|
||||||
/* have to lock for thread-safety */
|
/* have to lock for thread-safety */
|
||||||
GST_LOCK(queue);
|
GST_LOCK(queue);
|
||||||
//g_print("queue: push %d\n", queue->level_buffers);
|
DEBUG("queue: push %d\n", queue->level_buffers);
|
||||||
|
|
||||||
if (!queue->level_buffers) {
|
if (!queue->level_buffers) {
|
||||||
GST_UNLOCK(queue);
|
GST_UNLOCK(queue);
|
||||||
while (!queue->level_buffers) {
|
while (!queue->level_buffers) {
|
||||||
g_mutex_lock(queue->emptylock);
|
g_mutex_lock(queue->emptylock);
|
||||||
// g_print("0");
|
//g_print("U");
|
||||||
g_cond_wait(queue->emptycond,queue->emptylock);
|
g_cond_wait(queue->emptycond,queue->emptylock);
|
||||||
g_mutex_unlock(queue->emptylock);
|
g_mutex_unlock(queue->emptylock);
|
||||||
}
|
}
|
||||||
|
@ -204,14 +220,10 @@ void gst_queue_push(GstConnection *connection) {
|
||||||
front = queue->queue;
|
front = queue->queue;
|
||||||
buf = (GstBuffer *)(front->data);
|
buf = (GstBuffer *)(front->data);
|
||||||
queue->queue = g_list_remove_link(queue->queue,front);
|
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);
|
g_list_free(front);
|
||||||
queue->level_buffers--;
|
queue->level_buffers--;
|
||||||
|
//g_print("-%d", queue->level_buffers);
|
||||||
tosignal = queue->level_buffers < queue->max_buffers;
|
tosignal = queue->level_buffers < queue->max_buffers;
|
||||||
//g_print("queue: push end %d\n", queue->level_buffers);
|
|
||||||
GST_UNLOCK(queue);
|
GST_UNLOCK(queue);
|
||||||
|
|
||||||
if (tosignal) {
|
if (tosignal) {
|
||||||
|
@ -220,6 +232,9 @@ void gst_queue_push(GstConnection *connection) {
|
||||||
g_mutex_unlock(queue->fulllock);
|
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 */
|
/* unlock now */
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#noinst_PROGRAMS = basic m types a r plugin w s args mpg123 mcut push qtest
|
#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 \
|
noinst_PROGRAMS = qtest spectrum record wave mp3 teardown buffer mp3parse \
|
||||||
mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \
|
mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \
|
||||||
aviparse vidcapture avi2mpg mp2tomp1
|
aviparse vidcapture avi2mpg mp2tomp1 mp1tomp1
|
||||||
|
|
||||||
SUBDIRS = xml cothreads bindings
|
SUBDIRS = xml cothreads bindings
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ mpeg2parse_CFLAGS = $(shell gnome-config --cflags gnomeui)
|
||||||
mpeg2parse_LDFLAGS = $(shell gnome-config --libs gnomeui)
|
mpeg2parse_LDFLAGS = $(shell gnome-config --libs gnomeui)
|
||||||
mp2tomp1_CFLAGS = $(shell gnome-config --cflags gnomeui)
|
mp2tomp1_CFLAGS = $(shell gnome-config --cflags gnomeui)
|
||||||
mp2tomp1_LDFLAGS = $(shell gnome-config --libs 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
|
buffer_SOURCES = buffer.c mem.c
|
||||||
teardown_SOURCES = teardown.c mem.c
|
teardown_SOURCES = teardown.c mem.c
|
||||||
|
|
|
@ -16,7 +16,7 @@ void eof(GstSrc *src) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) {
|
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_queue, *video_queue;
|
||||||
GstElement *audio_thread, *video_thread;
|
GstElement *audio_thread, *video_thread;
|
||||||
GstElement *fdsink;
|
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 (strncmp(gst_pad_get_name(pad), "video_", 6) == 0) {
|
||||||
//} else if (0) {
|
//} else if (0) {
|
||||||
|
|
||||||
|
gst_plugin_load("smooth");
|
||||||
|
gst_plugin_load("median");
|
||||||
gst_plugin_load("mpeg2enc");
|
gst_plugin_load("mpeg2enc");
|
||||||
// construct internal pipeline elements
|
// 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");
|
encode = gst_elementfactory_make("mpeg2enc","encode");
|
||||||
g_return_if_fail(encode != NULL);
|
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);
|
fd = open(outfile,O_CREAT|O_RDWR|O_TRUNC);
|
||||||
|
|
||||||
fdsinkfactory = gst_elementfactory_find("fdsink");
|
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
|
// create the thread and pack stuff into it
|
||||||
video_thread = gst_thread_new("video_thread");
|
video_thread = gst_thread_new("video_thread");
|
||||||
g_return_if_fail(video_thread != NULL);
|
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(encode));
|
||||||
gst_bin_add(GST_BIN(video_thread),GST_ELEMENT(fdsink));
|
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_pad_connect(gst_element_get_pad(encode,"src"),
|
||||||
gst_element_get_pad(fdsink,"sink"));
|
gst_element_get_pad(fdsink,"sink"));
|
||||||
|
|
||||||
// set up pad connections
|
// set up pad connections
|
||||||
gst_element_add_ghost_pad(GST_ELEMENT(video_thread),
|
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
|
// construct queue and connect everything in the main pipeline
|
||||||
video_queue = gst_elementfactory_make("queue","video_queue");
|
video_queue = gst_elementfactory_make("queue","video_queue");
|
||||||
|
|
|
@ -116,6 +116,7 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) {
|
||||||
gst_plugin_load("mpeg2play");
|
gst_plugin_load("mpeg2play");
|
||||||
gst_plugin_load("videoscale");
|
gst_plugin_load("videoscale");
|
||||||
gst_plugin_load("mpeg2enc");
|
gst_plugin_load("mpeg2enc");
|
||||||
|
//gst_plugin_load("mpeg1encoder");
|
||||||
// construct internal pipeline elements
|
// construct internal pipeline elements
|
||||||
parse_video = gst_elementfactory_make("mp1videoparse","parse_video");
|
parse_video = gst_elementfactory_make("mp1videoparse","parse_video");
|
||||||
g_return_if_fail(parse_video != NULL);
|
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");
|
videoscale = gst_elementfactory_make("videoscale","videoscale");
|
||||||
g_return_if_fail(videoscale != NULL);
|
g_return_if_fail(videoscale != NULL);
|
||||||
encode = gst_elementfactory_make("mpeg2enc","encode");
|
encode = gst_elementfactory_make("mpeg2enc","encode");
|
||||||
|
//encode = gst_elementfactory_make("mpeg1encoder","encode");
|
||||||
g_return_if_fail(encode != NULL);
|
g_return_if_fail(encode != NULL);
|
||||||
//gtk_object_set(GTK_OBJECT(show),"width",640, "height", 480,NULL);
|
//gtk_object_set(GTK_OBJECT(show),"width",640, "height", 480,NULL);
|
||||||
fd = open(outfile,O_CREAT|O_RDWR|O_TRUNC);
|
fd = open(outfile,O_CREAT|O_RDWR|O_TRUNC);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
int main(int argc,char *argv[]) {
|
int main(int argc,char *argv[]) {
|
||||||
int fd;
|
int fd;
|
||||||
GstPipeline *pipeline;
|
GstPipeline *pipeline;
|
||||||
GstElement *audiosrc, *videosrc, *fdsink, *encoder, *compress;
|
GstElement *audiosrc, *videosrc, *fdsink, *encoder, *compress, *video_queue, *video_thread;
|
||||||
GstElementFactory *audiosrcfactory, *fdsinkfactory, *encoderfactory, *compressfactory;
|
GstElementFactory *audiosrcfactory, *fdsinkfactory, *encoderfactory, *compressfactory;
|
||||||
GstElementFactory *videosrcfactory;
|
GstElementFactory *videosrcfactory;
|
||||||
GList *padlist;
|
GList *padlist;
|
||||||
|
@ -22,13 +22,14 @@ int main(int argc,char *argv[]) {
|
||||||
|
|
||||||
audiosrcfactory = gst_elementfactory_find("audiosrc");
|
audiosrcfactory = gst_elementfactory_find("audiosrc");
|
||||||
audiosrc = gst_elementfactory_create(audiosrcfactory,"audiosrc");
|
audiosrc = gst_elementfactory_create(audiosrcfactory,"audiosrc");
|
||||||
|
|
||||||
videosrcfactory = gst_elementfactory_find("v4lsrc");
|
videosrcfactory = gst_elementfactory_find("v4lsrc");
|
||||||
videosrc = gst_elementfactory_create(videosrcfactory,"videosrc");
|
videosrc = gst_elementfactory_create(videosrcfactory,"videosrc");
|
||||||
compressfactory = gst_elementfactory_find("jpegenc");
|
compressfactory = gst_elementfactory_find("jpegenc");
|
||||||
compress = gst_elementfactory_create(compressfactory,"jpegenc");
|
compress = gst_elementfactory_create(compressfactory,"jpegenc");
|
||||||
encoderfactory = gst_elementfactory_find("aviencoder");
|
encoderfactory = gst_elementfactory_find("aviencoder");
|
||||||
encoder = gst_elementfactory_create(encoderfactory,"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);
|
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");
|
fdsink = gst_elementfactory_create(fdsinkfactory,"fdsink");
|
||||||
gtk_object_set(GTK_OBJECT(fdsink),"fd",fd,NULL);
|
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(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 */
|
/* connect src to sink */
|
||||||
gst_pad_connect(gst_element_get_pad(videosrc,"src"),
|
gst_element_add_ghost_pad(GST_ELEMENT(video_thread),
|
||||||
gst_element_get_pad(compress,"sink"));
|
gst_element_get_pad(compress,"sink"));
|
||||||
gst_pad_connect(gst_element_get_pad(compress,"src"),
|
gst_pad_connect(gst_element_get_pad(compress,"src"),
|
||||||
gst_element_get_pad(encoder,"video_00"));
|
gst_element_get_pad(encoder,"video_00"));
|
||||||
gst_pad_connect(gst_element_get_pad(encoder,"src"),
|
gst_pad_connect(gst_element_get_pad(encoder,"src"),
|
||||||
gst_element_get_pad(fdsink,"sink"));
|
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");
|
g_print("\neverything's built, setting it up to be runnable\n");
|
||||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_RUNNING);
|
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_RUNNING);
|
||||||
|
|
||||||
g_print("\nok, runnable, hitting 'play'...\n");
|
g_print("\nok, runnable, hitting 'play'...\n");
|
||||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue