Permalink
Browse files

Revision 1015

* Changes for v4l2 capture.
* Added framerate property for the omx_videomixer. Now the omx_videomixer would operate at the frame rate specified by this property.
  • Loading branch information...
1 parent 7f0893b commit 5b325ea5ccaac0b4c02712a07a2283942477f22b dchaverri committed Feb 14, 2012
View
@@ -48,6 +48,7 @@ libgstomx_la_SOURCES = gstomx.c gstomx.h \
gstomx_filereadersrc.c gstomx_filereadersrc.h \
swcsc.c swcsc.h \
gstperf.c gstperf.h \
+ gstomxbufferalloc.c gstomxbufferalloc.h \
gstomx_buffertransport.c gstomx_buffertransport.h \
gstomx_base_vfpc.c gstomx_base_vfpc.h \
gstomx_base_vfpc2.c gstomx_base_vfpc2.h \
View
@@ -64,6 +64,8 @@
#include "gstomx_vc1dec.h"
#include "gstomx_videomixer.h"
+#include "gstomxbufferalloc.h"
+
#include "config.h"
GST_DEBUG_CATEGORY (gstomx_debug);
@@ -118,6 +120,7 @@ static TableItem element_table[] =
// { "omx_volume", "libomxil-bellagio.so.0", "OMX.st.volume.component", NULL, GST_RANK_NONE, gst_omx_volume_get_type },
{ "swcsc", "libOMX_Core.so", NULL, NULL, GST_RANK_PRIMARY, gst_swcsc_get_type },
{ "gstperf", "libOMX_Core.so", NULL, NULL, GST_RANK_PRIMARY, gst_perf_get_type },
+ { "omxbufferalloc", "libOMX_Core.so", NULL, NULL, GST_RANK_PRIMARY, gst_omx_buffer_alloc_get_type },
{ "omx_scaler", "libOMX_Core.so", "OMX.TI.VPSSM3.VFPC.INDTXSCWB", "", GST_RANK_PRIMARY, gst_omx_scaler_get_type },
{ "omx_mdeiscaler", "libOMX_Core.so", "OMX.TI.VPSSM3.VFPC.DEIMDUALOUT", "", GST_RANK_PRIMARY, gst_omx_mdeiscaler_get_type },
{ "omx_hdeiscaler", "libOMX_Core.so", "OMX.TI.VPSSM3.VFPC.DEIHDUALOUT", "", GST_RANK_PRIMARY, gst_omx_hdeiscaler_get_type },
@@ -98,13 +98,16 @@ release_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer)
break;
}
}
+#include <sys/time.h>
static void gst_omxbuffertransport_finalize(GstBuffer *gstbuffer)
{
GstOmxBufferTransport *self = GST_OMXBUFFERTRANSPORT(gstbuffer);
int ii;
- GST_LOG("begin\n");
+ GST_LOG("begin\n");
+ static guint64 beftime = 0;
+ if(self->omxbuffer)
release_buffer (self->port, self->omxbuffer);
for(ii = 0; ii < self->numAdditionalHeaders; ii++) {
@@ -116,10 +119,23 @@ static void gst_omxbuffertransport_finalize(GstBuffer *gstbuffer)
free(self->addHeader);
//printf("free\n");
}
+ if(self->parent)
+ gst_buffer_unref(self->parent);
+
+ if(self->bufSem) {
+ struct timeval tv;
+ guint64 afttime;
+ gettimeofday(&tv, NULL);
+ afttime = (tv.tv_sec * 1000000 + tv.tv_usec);
+ //printf("sem up:%lld\n",(afttime-beftime) );
+ beftime = afttime;
+ g_sem_up(self->bufSem);
+ }
+
self->addHeader = NULL;
self->omxbuffer = NULL;
self->port = NULL;
-
+ self->parent = NULL;
/* Call GstBuffer's finalize routine, so our base class can do it's cleanup
* as well. If we don't do this, we'll have a memory leak that is very
* difficult to track down.
@@ -153,12 +169,47 @@ GstBuffer* gst_omxbuffertransport_new (GOmxPort *port, OMX_BUFFERHEADERTYPE *buf
tdt_buf->numAdditionalHeaders = 0;
tdt_buf->addHeader = NULL;
+ tdt_buf->parent = NULL;
+ tdt_buf->bufSem = NULL;
+
+ GST_LOG("end new\n");
+
+ return GST_BUFFER(tdt_buf);
+}
+
+GstBuffer* gst_omxbuffertransport_clone (GstBuffer *parent, GOmxPort *port)
+{
+ GstOmxBufferTransport *tdt_buf;
+ tdt_buf = (GstOmxBufferTransport*)
+ gst_mini_object_new(GST_TYPE_OMXBUFFERTRANSPORT);
+
+ g_return_val_if_fail(tdt_buf != NULL, NULL);
+
+ GST_BUFFER_SIZE(tdt_buf) = GST_BUFFER_SIZE(parent);
+ GST_BUFFER_DATA(tdt_buf) = GST_BUFFER_DATA(parent);
+ GST_BUFFER_CAPS(GST_BUFFER (tdt_buf)) = gst_caps_ref (GST_BUFFER_CAPS(parent));
+ GST_BUFFER_TIMESTAMP(tdt_buf) = GST_BUFFER_TIMESTAMP(parent);
+ GST_BUFFER_DURATION(tdt_buf) = GST_BUFFER_DURATION(parent);
+
+ if (GST_BUFFER_DATA(tdt_buf) == NULL) {
+ gst_mini_object_unref(GST_MINI_OBJECT(tdt_buf));
+ return NULL;
+ }
+
+ tdt_buf->omxbuffer = NULL;
+ tdt_buf->port = port;
+ tdt_buf->numAdditionalHeaders = 0;
+ tdt_buf->addHeader = NULL;
+ tdt_buf->bufSem = NULL;
+ tdt_buf->parent = parent;
GST_LOG("end new\n");
return GST_BUFFER(tdt_buf);
+
}
+
void gst_omxbuffertransport_set_additional_headers (GstOmxBufferTransport *self ,guint numHeaders,OMX_BUFFERHEADERTYPE **buffer)
{
int ii;
@@ -180,4 +231,9 @@ void gst_omxbuffertransport_set_additional_headers (GstOmxBufferTransport *self
return ;
}
+void gst_omxbuffertransport_set_bufsem (GstOmxBufferTransport *self ,GSem *sem)
+{
+ self->bufSem = sem;
+ return ;
+}
@@ -61,6 +61,8 @@ struct _GstOmxBufferTransport {
GOmxPort *port;
guint numAdditionalHeaders;
OMX_BUFFERHEADERTYPE **addHeader;
+ GstBuffer *parent;
+ GSem *bufSem;
};
struct _GstOmxBufferTransportClass {
View
@@ -69,6 +69,7 @@ g_omx_port_new (GOmxCore *core, const gchar *name, guint index)
port->enabled = TRUE;
port->queue = async_queue_new ();
port->mutex = g_mutex_new ();
+ port->cond = g_cond_new();
port->ignore_count = 0;
port->n_offset = 0;
@@ -83,6 +84,7 @@ g_omx_port_free (GOmxPort *port)
DEBUG (port, "begin");
g_mutex_free (port->mutex);
+ g_cond_free(port->cond);
async_queue_free (port->queue);
g_free (port->name);
@@ -355,8 +357,12 @@ g_omx_port_push_buffer (GOmxPort *port,
/* Avoid a race condition of pAppPrivate getting set to null
after the buffer is submitted back again */
OMX_PTR appPrivate = omx_buffer->pAppPrivate;
- omx_buffer->pAppPrivate = NULL;
- gst_buffer_unref (appPrivate);
+ //omx_buffer->pAppPrivate = NULL;
+ g_mutex_lock(port->mutex);
+ GST_BUFFER_FLAG_UNSET(appPrivate,GST_BUFFER_FLAG_BUSY);
+ gst_buffer_unref (appPrivate);
+ g_cond_signal(port->cond);
+ g_mutex_unlock(port->mutex);
} else
async_queue_push (port->queue, omx_buffer);
}
@@ -723,15 +729,19 @@ send_prep_eos_event (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer, GstEvent
static OMX_BUFFERHEADERTYPE *
get_input_buffer_header (GOmxPort *port, GstBuffer *src)
{
- OMX_BUFFERHEADERTYPE *omx_buffer;
+ OMX_BUFFERHEADERTYPE *omx_buffer,*tmp;
int index;
index = omxbuffer_index(port, GST_BUFFER_DATA (src));
omx_buffer = port->buffers[index];
omx_buffer->pBuffer = GST_BUFFER_DATA(src);
- omx_buffer->nOffset = GST_GET_OMXBUFFER(src)->nOffset;
+ tmp = GST_GET_OMXBUFFER(src);
+ if(tmp)
+ omx_buffer->nOffset = tmp->nOffset;
+ else
+ omx_buffer->nOffset = 0;
omx_buffer->nFilledLen = GST_BUFFER_SIZE (src);
omx_buffer->pAppPrivate = gst_buffer_ref (src);
View
@@ -30,6 +30,8 @@
G_BEGIN_DECLS
+#define GST_BUFFER_FLAG_BUSY (GST_BUFFER_FLAG_LAST << 1)
+
/* Typedefs. */
typedef enum GOmxPortType GOmxPortType;
@@ -88,6 +90,8 @@ struct GOmxPort
/** if omx_allocate flag is not set then structure will contain upstream omx buffer pointer information */
OmxBufferInfo *share_buffer_info;
+
+ GCond *cond;
};
/* Macros. */
Oops, something went wrong.

0 comments on commit 5b325ea

Please sign in to comment.