return gst_pad_get_bufferpool (identity->srcpad);
}
+static GstCaps*
+gst_identity_getcaps (GstPad *pad, GstCaps *caps)
+{
+ GstIdentity *identity;
+ GstPad *otherpad;
+
+ identity = GST_IDENTITY (gst_pad_get_parent (pad));
+ otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
+
+ return gst_pad_get_allowed_caps (otherpad);
+}
+
static GstPadConnectReturn
gst_identity_connect (GstPad *pad, GstCaps *caps)
{
gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain));
gst_pad_set_bufferpool_function (identity->sinkpad, gst_identity_get_bufferpool);
gst_pad_set_connect_function (identity->sinkpad, gst_identity_connect);
+ gst_pad_set_getcaps_function (identity->sinkpad, gst_identity_getcaps);
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
gst_pad_set_connect_function (identity->srcpad, gst_identity_connect);
+ gst_pad_set_getcaps_function (identity->srcpad, gst_identity_getcaps);
identity->loop_based = FALSE;
identity->sleep_time = 0;
gint state_idx = 0;
GstElementState state;
- GST_DEBUG_ELEMENT (GST_CAT_PARENTAGE, bin, "trying to remove child %s\n", GST_ELEMENT_NAME (element));
+ GST_DEBUG_ELEMENT (GST_CAT_PARENTAGE, bin, "trying to remove child %s", GST_ELEMENT_NAME (element));
g_return_if_fail (bin != NULL);
g_return_if_fail (GST_IS_BIN (bin));
GstElementStateReturn ret;
if (GST_ELEMENT_CLASS (parent_class)->change_state) {
- GST_DEBUG_ELEMENT (GST_CAT_STATES, bin, "setting bin's own state\n");
+ GST_DEBUG_ELEMENT (GST_CAT_STATES, bin, "setting bin's own state");
ret = GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT (bin));
return ret;
if (!running) {
if (GST_STATE (bin) == GST_STATE_PLAYING && GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING) {
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, bin,
- "waiting for child shutdown after useless iteration\n");
+ "waiting for child shutdown after useless iteration");
gst_element_wait_state_change (GST_ELEMENT (bin));
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, bin, "child shutdown\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, bin, "child shutdown");
}
}
/* start with the current state */
curpending = GST_STATE(element);
- GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "setting state from %s to %s\n",
+ GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "setting state from %s to %s",
gst_element_statename (curpending),
gst_element_statename (state));
GST_STATE_PENDING (element) = curpending;
if (curpending != state) {
- GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "intermediate: setting state to %s\n",
+ GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "intermediate: setting state to %s",
gst_element_statename (curpending));
}
switch (return_val) {
case GST_STATE_FAILURE:
- GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "have failed change_state return\n");
+ GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "have failed change_state return");
return return_val;
case GST_STATE_ASYNC:
- GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "element will change state async\n");
+ GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "element will change state async");
return return_val;
default:
/* Last thing we do is verify that a successful state change really
* did change the state... */
if (GST_STATE (element) != curpending) {
GST_DEBUG_ELEMENT (GST_CAT_STATES, element,
- "element claimed state-change success, but state didn't change %s, %s <-> %s\n",
+ "element claimed state-change success, but state didn't change %s, %s <-> %s",
gst_element_statename (GST_STATE (element)),
gst_element_statename (GST_STATE_PENDING (element)),
gst_element_statename (curpending));
{
GList *pads = GST_ELEMENT_PADS (element);
- GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "negotiating pads\n");
+ GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "negotiating pads");
while (pads) {
GstPad *pad = GST_PAD (pads->data);
/* only try to negotiate if the peer element is in PAUSED or higher too */
if (otherstate >= GST_STATE_READY) {
- GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "perform negotiate for %s:%s and %s:%s\n",
+ GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "perform negotiate for %s:%s and %s:%s",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
if (!gst_pad_perform_negotiate (GST_PAD (srcpad), GST_PAD (sinkpad)))
return FALSE;
}
else {
- GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "not negotiatiating %s:%s and %s:%s, not in READY yet\n",
+ GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "not negotiatiating %s:%s and %s:%s, not in READY yet",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
}
}
{
GList *pads = GST_ELEMENT_PADS (element);
- GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "clearing pad caps\n");
+ GST_DEBUG_ELEMENT (GST_CAT_CAPS, element, "clearing pad caps");
while (pads) {
GstRealPad *pad = GST_PAD_REALIZE (pads->data);
GList *pads;
GstPad *pad;
- GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "dispose\n");
+ GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "dispose");
gst_element_set_state (element, GST_STATE_NULL);
switch (entry->propstype) {
case GST_PROPS_INT_TYPE:
- GST_DEBUG (GST_CAT_PROPERTIES, "%s: int %d\n", name, entry->data.int_data);
+ GST_DEBUG (GST_CAT_PROPERTIES, "%s: int %d", name, entry->data.int_data);
break;
case GST_PROPS_FLOAT_TYPE:
- GST_DEBUG (GST_CAT_PROPERTIES, "%s: float %f\n", name, entry->data.float_data);
+ GST_DEBUG (GST_CAT_PROPERTIES, "%s: float %f", name, entry->data.float_data);
break;
case GST_PROPS_FOURCC_TYPE:
- GST_DEBUG (GST_CAT_PROPERTIES, "%s: fourcc %4.4s\n", name, (gchar*)&entry->data.fourcc_data);
+ GST_DEBUG (GST_CAT_PROPERTIES, "%s: fourcc %4.4s", name, (gchar*)&entry->data.fourcc_data);
break;
case GST_PROPS_BOOL_TYPE:
- GST_DEBUG (GST_CAT_PROPERTIES, "%s: bool %d\n", name, entry->data.bool_data);
+ GST_DEBUG (GST_CAT_PROPERTIES, "%s: bool %d", name, entry->data.bool_data);
break;
case GST_PROPS_STRING_TYPE:
- GST_DEBUG (GST_CAT_PROPERTIES, "%s: string %s\n", name, entry->data.string_data.string);
+ GST_DEBUG (GST_CAT_PROPERTIES, "%s: string %s", name, entry->data.string_data.string);
break;
case GST_PROPS_INT_RANGE_TYPE:
- GST_DEBUG (GST_CAT_PROPERTIES, "%s: int range %d-%d\n", name, entry->data.int_range_data.min,
+ GST_DEBUG (GST_CAT_PROPERTIES, "%s: int range %d-%d", name, entry->data.int_range_data.min,
entry->data.int_range_data.max);
break;
case GST_PROPS_FLOAT_RANGE_TYPE:
- GST_DEBUG (GST_CAT_PROPERTIES, "%s: float range %f-%f\n", name, entry->data.float_range_data.min,
+ GST_DEBUG (GST_CAT_PROPERTIES, "%s: float range %f-%f", name, entry->data.float_range_data.min,
entry->data.float_range_data.max);
break;
case GST_PROPS_LIST_TYPE:
- GST_DEBUG (GST_CAT_PROPERTIES, "[list]\n");
+ GST_DEBUG (GST_CAT_PROPERTIES, "[list]");
{
GList *entries = entry->data.list_data.entries;
switch (entry2->propstype) {
/* b <---> a */
case GST_PROPS_FOURCC_TYPE:
- GST_DEBUG(GST_CAT_PROPERTIES,"\"%4.4s\" <--> \"%4.4s\" ?\n",
+ GST_DEBUG(GST_CAT_PROPERTIES,"\"%4.4s\" <--> \"%4.4s\" ?",
(char*) &entry2->data.fourcc_data, (char*) &entry1->data.fourcc_data);
return (entry2->data.fourcc_data == entry1->data.fourcc_data);
default:
switch (entry2->propstype) {
/* b <---> a - d */
case GST_PROPS_INT_RANGE_TYPE:
- GST_DEBUG(GST_CAT_PROPERTIES,"%d <= %d <= %d ?\n",entry2->data.int_range_data.min,
+ GST_DEBUG(GST_CAT_PROPERTIES,"%d <= %d <= %d ?",entry2->data.int_range_data.min,
entry1->data.int_data,entry2->data.int_range_data.max);
return (entry2->data.int_range_data.min <= entry1->data.int_data &&
entry2->data.int_range_data.max >= entry1->data.int_data);
/* b <---> a */
case GST_PROPS_INT_TYPE:
- GST_DEBUG(GST_CAT_PROPERTIES,"%d == %d ?\n",entry1->data.int_data,entry2->data.int_data);
+ GST_DEBUG(GST_CAT_PROPERTIES,"%d == %d ?",entry1->data.int_data,entry2->data.int_data);
return (entry2->data.int_data == entry1->data.int_data);
default:
break;
switch (entry2->propstype) {
/* t <---> t */
case GST_PROPS_STRING_TYPE:
- GST_DEBUG(GST_CAT_PROPERTIES,"\"%s\" <--> \"%s\" ?\n",
+ GST_DEBUG(GST_CAT_PROPERTIES,"\"%s\" <--> \"%s\" ?",
entry2->data.string_data.string, entry1->data.string_data.string);
return (!strcmp (entry2->data.string_data.string, entry1->data.string_data.string));
default:
queue->writer = FALSE;
queue->not_empty = g_cond_new ();
queue->not_full = g_cond_new ();
- GST_DEBUG_ELEMENT (GST_CAT_THREAD, queue, "initialized queue's not_empty & not_full conditions\n");
+ GST_DEBUG_ELEMENT (GST_CAT_THREAD, queue, "initialized queue's not_empty & not_full conditions");
}
static void
static void
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
{
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p\n", data);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p", data);
if (GST_IS_BUFFER (data)) {
gst_buffer_unref (GST_BUFFER (data));
restart:
/* we have to lock the queue since we span threads */
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld\n", pthread_self ());
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld", pthread_self ());
g_mutex_lock (queue->qlock);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld\n", pthread_self ());
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld", pthread_self ());
if (GST_IS_EVENT (buf)) {
switch (GST_EVENT_TYPE (buf)) {
}
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d\n",buf,GST_BUFFER_SIZE(buf));
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d",buf,GST_BUFFER_SIZE(buf));
if (queue->level_buffers == queue->size_buffers) {
/* if this is a leaky queue... */
/* FIXME don't want to leak events! */
/* if we leak on the upstream side, drop the current buffer */
if (queue->leaky == GST_QUEUE_LEAK_UPSTREAM) {
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end");
if (GST_IS_EVENT (buf))
fprintf(stderr, "Error: queue [%s] leaked an event, type:%d\n",
GST_ELEMENT_NAME(GST_ELEMENT(queue)),
GST_EVENT_TYPE(GST_EVENT(buf)));
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end");
gst_buffer_unref(buf);
/* now we have to clean up and exit right away */
g_mutex_unlock (queue->qlock);
else {
GList *front;
GstBuffer *leakbuf;
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on downstream end\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on downstream end");
front = queue->queue;
leakbuf = (GstBuffer *)(front->data);
if (GST_IS_EVENT (leakbuf))
}
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d\n",
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d",
queue->level_buffers, queue->size_buffers);
while (queue->level_buffers == queue->size_buffers) {
/* if there's a pending state change for this queue or its manager, switch */
/* back to iterator so bottom half of state change executes */
while (GST_STATE_PENDING (queue) != GST_STATE_VOID_PENDING) {
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
g_mutex_unlock (queue->qlock);
if (gst_element_interrupt (GST_ELEMENT (queue)))
return;
}
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_full, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_full, level:%d/%d",
+ queue->level_buffers, queue->size_buffers);
if (queue->writer)
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple writers on queue!\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple writers on queue!");
queue->writer = TRUE;
g_cond_wait (queue->not_full, queue->qlock);
queue->writer = FALSE;
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_full signal\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_full signal");
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post full wait, level:%d/%d\n",
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post full wait, level:%d/%d",
queue->level_buffers, queue->size_buffers);
}
queue->level_buffers++;
queue->level_bytes += GST_BUFFER_SIZE(buf);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)+ level:%d/%d\n",
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)+ level:%d/%d",
GST_DEBUG_PAD_NAME(pad),
queue->level_buffers, queue->size_buffers);
if (reader)
{
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_empty\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_empty");
g_cond_signal (queue->not_empty);
}
}
restart:
/* have to lock for thread-safety */
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld\n", pthread_self ());
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld", pthread_self ());
g_mutex_lock (queue->qlock);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld %p\n", pthread_self (), queue->not_empty);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld %p", pthread_self (), queue->not_empty);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d", queue->level_buffers, queue->size_buffers);
while (queue->level_buffers == 0) {
/* if there's a pending state change for this queue or its manager, switch
* back to iterator so bottom half of state change executes
*/
while (GST_STATE_PENDING (queue) != GST_STATE_VOID_PENDING) {
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
g_mutex_unlock (queue->qlock);
if (gst_element_interrupt (GST_ELEMENT (queue)))
return NULL;
}
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_empty, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_empty, level:%d/%d", queue->level_buffers, queue->size_buffers);
if (queue->reader)
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple readers on queue!\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple readers on queue!");
queue->reader = TRUE;
g_cond_wait (queue->not_empty, queue->qlock);
queue->reader = FALSE;
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_empty signal\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_empty signal");
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post empty wait, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post empty wait, level:%d/%d", queue->level_buffers, queue->size_buffers);
front = queue->queue;
buf = (GstBuffer *)(front->data);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "retrieved buffer %p from queue\n", buf);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "retrieved buffer %p from queue", buf);
queue->queue = g_list_remove_link (queue->queue, front);
g_list_free (front);
queue->level_buffers--;
queue->level_bytes -= GST_BUFFER_SIZE(buf);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)- level:%d/%d\n",
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)- level:%d/%d",
GST_DEBUG_PAD_NAME(pad),
queue->level_buffers, queue->size_buffers);
if (writer)
{
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_full\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_full");
g_cond_signal (queue->not_full);
}
GstEvent *event = GST_EVENT(buf);
switch (GST_EVENT_TYPE(event)) {
case GST_EVENT_EOS:
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos\n", GST_ELEMENT_NAME (queue));
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos", GST_ELEMENT_NAME (queue));
gst_element_set_eos (GST_ELEMENT (queue));
break;
default:
void gst_scheduler_pad_connect (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
void gst_scheduler_pad_disconnect (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
GstPad* gst_scheduler_pad_select (GstScheduler *sched, GList *padlist);
-GstClock* gst_scheduler_get_clock (GstScheduler *sched);
-GstClock* gst_scheduler_get_clock (GstScheduler *sched);
GstClockReturn gst_scheduler_clock_wait (GstScheduler *sched, GstElement *element,
GstClock *clock, GstClockTime time);
gboolean gst_scheduler_iterate (GstScheduler *sched);
if (pthread_equal (self, thread->thread_id)) {
GST_DEBUG (GST_CAT_THREAD,
- "no sync(" GST_DEBUG_THREAD_FORMAT "): setting own thread's state to spinning\n",
+ "no sync(" GST_DEBUG_THREAD_FORMAT "): setting own thread's state to spinning",
GST_DEBUG_THREAD_ARGS (thread->pid));
return gst_thread_update_state (thread);
}
/* set the state to idle */
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
- THR_DEBUG ("creating thread \"%s\"\n", GST_ELEMENT_NAME (element));
+ THR_DEBUG ("creating thread \"%s\"", GST_ELEMENT_NAME (element));
g_mutex_lock (thread->lock);
pthread_create (&thread->thread_id, NULL, gst_thread_main_loop, thread);
/* wait for it to 'spin up' */
- THR_DEBUG ("waiting for child thread spinup\n");
+ THR_DEBUG ("waiting for child thread spinup");
g_cond_wait (thread->cond, thread->lock);
- THR_DEBUG ("thread claims to be up\n");
+ THR_DEBUG ("thread claims to be up");
g_mutex_unlock (thread->lock);
break;
case GST_STATE_READY_TO_PAUSED:
THR_INFO ("readying thread");
g_mutex_lock (thread->lock);
- THR_DEBUG ("signaling\n");
+ THR_DEBUG ("signaling");
g_cond_signal (thread->cond);
- THR_DEBUG ("waiting for ack\n");
+ THR_DEBUG ("waiting for ack");
g_cond_wait (thread->cond, thread->lock);
- THR_DEBUG ("got ack\n");
+ THR_DEBUG ("got ack");
g_mutex_unlock (thread->lock);
break;
case GST_STATE_PAUSED_TO_PLAYING:
- THR_DEBUG ("telling thread to start spinning\n");
+ THR_DEBUG ("telling thread to start spinning");
g_mutex_lock (thread->lock);
- THR_DEBUG ("signaling\n");
+ THR_DEBUG ("signaling");
g_cond_signal (thread->cond);
- THR_DEBUG ("waiting for ack\n");
+ THR_DEBUG ("waiting for ack");
g_cond_wait (thread->cond, thread->lock);
- THR_DEBUG ("got ack\n");
+ THR_DEBUG ("got ack");
g_mutex_unlock (thread->lock);
break;
case GST_STATE_PLAYING_TO_PAUSED:
GstElement *element = GST_ELEMENT (elements->data);
g_assert (element);
- THR_DEBUG (" element \"%s\"\n", GST_ELEMENT_NAME (element));
+ THR_DEBUG (" element \"%s\"", GST_ELEMENT_NAME (element));
elements = g_list_next (elements);
if (GST_IS_QUEUE (element)) {
GstQueue *queue = GST_QUEUE (element);
* FIXME on up- or down-stream side)
* FIXME also make this more efficient by keeping list of managed queues
*/
- THR_DEBUG ("waking queue \"%s\"\n", GST_ELEMENT_NAME (element));
+ THR_DEBUG ("waking queue \"%s\"", GST_ELEMENT_NAME (element));
g_mutex_lock (queue->qlock);
GST_STATE_PENDING (element) = GST_STATE_PAUSED;
g_cond_signal (queue->not_full);
if (GST_ELEMENT_SCHED (peerelement) != GST_ELEMENT_SCHED (thread)) {
GstQueue *queue = GST_QUEUE (peerelement);
- THR_DEBUG (" element \"%s\" has pad cross sched boundary\n", GST_ELEMENT_NAME (element));
+ THR_DEBUG (" element \"%s\" has pad cross sched boundary", GST_ELEMENT_NAME (element));
/* FIXME!! */
g_mutex_lock (queue->qlock);
g_cond_signal (queue->not_full);
}
}
}
- THR_DEBUG ("telling thread to pause, signaling\n");
+ THR_DEBUG ("telling thread to pause, signaling");
g_cond_signal (thread->cond);
- THR_DEBUG ("waiting for ack\n");
+ THR_DEBUG ("waiting for ack");
g_cond_wait (thread->cond, thread->lock);
- THR_DEBUG ("got ack\n");
+ THR_DEBUG ("got ack");
g_mutex_unlock (thread->lock);
break;
}
case GST_STATE_READY_TO_NULL:
- THR_DEBUG ("telling thread to pause (null) - and joining\n");
+ THR_DEBUG ("telling thread to pause (null) - and joining");
/* MattH FIXME revisit */
g_mutex_lock (thread->lock);
- THR_DEBUG ("signaling\n");
+ THR_DEBUG ("signaling");
g_cond_signal (thread->cond);
- THR_DEBUG ("waiting for ack\n");
+ THR_DEBUG ("waiting for ack");
g_cond_wait (thread->cond, thread->lock);
- THR_DEBUG ("got ack\n");
+ THR_DEBUG ("got ack");
pthread_join (thread->thread_id, NULL);
thread->thread_id = -1;
g_mutex_unlock (thread->lock);
break;
case GST_STATE_PAUSED_TO_READY:
- THR_DEBUG ("telling thread to stop spinning\n");
+ THR_DEBUG ("telling thread to stop spinning");
g_mutex_lock (thread->lock);
- THR_DEBUG ("signaling\n");
+ THR_DEBUG ("signaling");
g_cond_signal (thread->cond);
- THR_DEBUG ("waiting for ack\n");
+ THR_DEBUG ("waiting for ack");
g_cond_wait (thread->cond, thread->lock);
- THR_DEBUG ("got ack\n");
+ THR_DEBUG ("got ack");
g_mutex_unlock (thread->lock);
break;
default:
- GST_DEBUG_ELEMENT (GST_CAT_THREAD, element, "UNHANDLED STATE CHANGE! %x\n", transition);
+ GST_DEBUG_ELEMENT (GST_CAT_THREAD, element, "UNHANDLED STATE CHANGE! %x", transition);
break;
}
stateset = GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT(thread));
if (stateset != GST_STATE_SUCCESS) {
- THR_DEBUG_MAIN ("state change of children failed\n");
+ THR_DEBUG_MAIN ("state change of children failed");
}
}
- THR_DEBUG_MAIN ("indicating spinup\n");
+ THR_DEBUG_MAIN ("indicating spinup");
g_cond_signal (thread->cond);
/* don't unlock the mutex because we hold it into the top of the while loop */
- THR_DEBUG_MAIN ("thread has indicated spinup to parent process\n");
+ THR_DEBUG_MAIN ("thread has indicated spinup to parent process");
/***** THREAD IS NOW IN READY STATE *****/
/* NOTE: cannot be in NULL, we're not running in that state at all */
case GST_STATE_READY:
/* wait to be set to either the NULL or PAUSED states */
- THR_DEBUG_MAIN ("thread in %s state, waiting for either %s or %s\n",
+ THR_DEBUG_MAIN ("thread in %s state, waiting for either %s or %s",
gst_element_statename (GST_STATE_READY),
gst_element_statename (GST_STATE_NULL),
gst_element_statename (GST_STATE_PAUSED));
/* been signaled, we need to state transition now and signal back */
gst_thread_update_state (thread);
- THR_DEBUG_MAIN ("done with state transition, signaling back to parent process\n");
+ THR_DEBUG_MAIN ("done with state transition, signaling back to parent process");
g_cond_signal (thread->cond);
/* now we decide what to do next */
if (GST_STATE (thread) == GST_STATE_NULL) {
continue;
case GST_STATE_PAUSED:
/* wait to be set to either the READY or PLAYING states */
- THR_DEBUG_MAIN("thread in %s state, waiting for either %s or %s\n",
+ THR_DEBUG_MAIN("thread in %s state, waiting for either %s or %s",
gst_element_statename (GST_STATE_PAUSED),
gst_element_statename (GST_STATE_READY),
gst_element_statename (GST_STATE_PLAYING));
gst_thread_update_state (thread);
}
/* once we're here, SPINNING has stopped, we should signal that we're done */
- THR_DEBUG_MAIN ("SPINNING stopped, signaling back to parent process\n");
+ THR_DEBUG_MAIN ("SPINNING stopped, signaling back to parent process");
g_cond_signal (thread->cond);
/* now we can wait for PAUSED */
continue;
}
case GST_STATE_PLAYING:
/* wait to be set to PAUSED */
- THR_DEBUG_MAIN ("thread in %s state, waiting for %s\n",
+ THR_DEBUG_MAIN ("thread in %s state, waiting for %s",
gst_element_statename(GST_STATE_PLAYING),
gst_element_statename(GST_STATE_PAUSED));
g_cond_wait (thread->cond,thread->lock);
/* there's only PAUSED, we we just wait for it */
continue;
case GST_STATE_NULL:
- THR_DEBUG_MAIN ("thread in %s state, preparing to die\n",
+ THR_DEBUG_MAIN ("thread in %s state, preparing to die",
gst_element_statename(GST_STATE_NULL));
GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
break;
return gst_pad_get_bufferpool (identity->srcpad);
}
+static GstCaps*
+gst_identity_getcaps (GstPad *pad, GstCaps *caps)
+{
+ GstIdentity *identity;
+ GstPad *otherpad;
+
+ identity = GST_IDENTITY (gst_pad_get_parent (pad));
+ otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
+
+ return gst_pad_get_allowed_caps (otherpad);
+}
+
static GstPadConnectReturn
gst_identity_connect (GstPad *pad, GstCaps *caps)
{
gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain));
gst_pad_set_bufferpool_function (identity->sinkpad, gst_identity_get_bufferpool);
gst_pad_set_connect_function (identity->sinkpad, gst_identity_connect);
+ gst_pad_set_getcaps_function (identity->sinkpad, gst_identity_getcaps);
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
gst_pad_set_connect_function (identity->srcpad, gst_identity_connect);
+ gst_pad_set_getcaps_function (identity->srcpad, gst_identity_getcaps);
identity->loop_based = FALSE;
identity->sleep_time = 0;
queue->writer = FALSE;
queue->not_empty = g_cond_new ();
queue->not_full = g_cond_new ();
- GST_DEBUG_ELEMENT (GST_CAT_THREAD, queue, "initialized queue's not_empty & not_full conditions\n");
+ GST_DEBUG_ELEMENT (GST_CAT_THREAD, queue, "initialized queue's not_empty & not_full conditions");
}
static void
static void
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
{
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p\n", data);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p", data);
if (GST_IS_BUFFER (data)) {
gst_buffer_unref (GST_BUFFER (data));
restart:
/* we have to lock the queue since we span threads */
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld\n", pthread_self ());
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld", pthread_self ());
g_mutex_lock (queue->qlock);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld\n", pthread_self ());
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld", pthread_self ());
if (GST_IS_EVENT (buf)) {
switch (GST_EVENT_TYPE (buf)) {
}
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d\n",buf,GST_BUFFER_SIZE(buf));
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d",buf,GST_BUFFER_SIZE(buf));
if (queue->level_buffers == queue->size_buffers) {
/* if this is a leaky queue... */
/* FIXME don't want to leak events! */
/* if we leak on the upstream side, drop the current buffer */
if (queue->leaky == GST_QUEUE_LEAK_UPSTREAM) {
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end");
if (GST_IS_EVENT (buf))
fprintf(stderr, "Error: queue [%s] leaked an event, type:%d\n",
GST_ELEMENT_NAME(GST_ELEMENT(queue)),
GST_EVENT_TYPE(GST_EVENT(buf)));
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end");
gst_buffer_unref(buf);
/* now we have to clean up and exit right away */
g_mutex_unlock (queue->qlock);
else {
GList *front;
GstBuffer *leakbuf;
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on downstream end\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on downstream end");
front = queue->queue;
leakbuf = (GstBuffer *)(front->data);
if (GST_IS_EVENT (leakbuf))
}
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d\n",
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d",
queue->level_buffers, queue->size_buffers);
while (queue->level_buffers == queue->size_buffers) {
/* if there's a pending state change for this queue or its manager, switch */
/* back to iterator so bottom half of state change executes */
while (GST_STATE_PENDING (queue) != GST_STATE_VOID_PENDING) {
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
g_mutex_unlock (queue->qlock);
if (gst_element_interrupt (GST_ELEMENT (queue)))
return;
}
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_full, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_full, level:%d/%d",
+ queue->level_buffers, queue->size_buffers);
if (queue->writer)
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple writers on queue!\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple writers on queue!");
queue->writer = TRUE;
g_cond_wait (queue->not_full, queue->qlock);
queue->writer = FALSE;
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_full signal\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_full signal");
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post full wait, level:%d/%d\n",
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post full wait, level:%d/%d",
queue->level_buffers, queue->size_buffers);
}
queue->level_buffers++;
queue->level_bytes += GST_BUFFER_SIZE(buf);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)+ level:%d/%d\n",
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)+ level:%d/%d",
GST_DEBUG_PAD_NAME(pad),
queue->level_buffers, queue->size_buffers);
if (reader)
{
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_empty\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_empty");
g_cond_signal (queue->not_empty);
}
}
restart:
/* have to lock for thread-safety */
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld\n", pthread_self ());
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld", pthread_self ());
g_mutex_lock (queue->qlock);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld %p\n", pthread_self (), queue->not_empty);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld %p", pthread_self (), queue->not_empty);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d", queue->level_buffers, queue->size_buffers);
while (queue->level_buffers == 0) {
/* if there's a pending state change for this queue or its manager, switch
* back to iterator so bottom half of state change executes
*/
while (GST_STATE_PENDING (queue) != GST_STATE_VOID_PENDING) {
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
g_mutex_unlock (queue->qlock);
if (gst_element_interrupt (GST_ELEMENT (queue)))
return NULL;
}
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_empty, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_empty, level:%d/%d", queue->level_buffers, queue->size_buffers);
if (queue->reader)
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple readers on queue!\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple readers on queue!");
queue->reader = TRUE;
g_cond_wait (queue->not_empty, queue->qlock);
queue->reader = FALSE;
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_empty signal\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_empty signal");
}
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post empty wait, level:%d/%d\n", queue->level_buffers, queue->size_buffers);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post empty wait, level:%d/%d", queue->level_buffers, queue->size_buffers);
front = queue->queue;
buf = (GstBuffer *)(front->data);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "retrieved buffer %p from queue\n", buf);
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "retrieved buffer %p from queue", buf);
queue->queue = g_list_remove_link (queue->queue, front);
g_list_free (front);
queue->level_buffers--;
queue->level_bytes -= GST_BUFFER_SIZE(buf);
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)- level:%d/%d\n",
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)- level:%d/%d",
GST_DEBUG_PAD_NAME(pad),
queue->level_buffers, queue->size_buffers);
if (writer)
{
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_full\n");
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_full");
g_cond_signal (queue->not_full);
}
GstEvent *event = GST_EVENT(buf);
switch (GST_EVENT_TYPE(event)) {
case GST_EVENT_EOS:
- GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos\n", GST_ELEMENT_NAME (queue));
+ GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos", GST_ELEMENT_NAME (queue));
gst_element_set_eos (GST_ELEMENT (queue));
break;
default: