<font color='black' size='2' face='arial'>
<div style="font-family:helvetica,arial;font-size:10pt;color:black">
<div id="AOLMsgPart_2_aaac7f72-1e46-41a3-9446-dfd32472a681">
<font color="black" size="2" face="arial">
<div>
<div><font size="2">Hi all,</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2">I'm working with GStreamer 1.4.5 on iOS and am having problems with appsrc and appsink. I'm using appsrc and appsink to pass data between two pipes that work independently; pipelineA will always be playing while pipelineB may change states based on user input, network conditions, etc.... My basis for testing is the following pipeline:</font></div>
<div><font size="2"><br>
</font></div>
<div>
<div><font size="2">-----------------------------------</font></div>
</div>
<div><font size="2"> pipeline1 = gst_parse_launch("videotestsrc is-live=true"</font></div>
<div><font size="2"> " !video/x-raw,format=(string)RGB,width=(int)640,height=(int)480,framerate=(fraction)30/1"</font></div>
<div><font size="2"> " !videoconvert"</font></div>
<div><font size="2"> " !autovideosink"</font></div>
<div><font size="2"> , &error);</font></div>
<div><font size="2"> gst_element_set_state(pipeline1, GST_STATE_READY);</font></div>
<div>
<div><font size="2">-----------------------------------</font></div>
</div>
<div><font size="2"><br>
</font></div>
<div><font size="2">Obviously I've trimmed down the code from what's there, but this is the essence of it. I handle the pipeline state change to GST_STATE_READY callback by setting state to GST_STATE_PLAYING. This works as expected, i.e. I see the test pattern. What I want to do is create two pipelines and add appsrc & appsink between the two:</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2">-----------------------------------</font></div>
<div><font size="2">init()</font></div>
<div><font size="2">{</font></div>
<div><font size="2"> pipelineA = gst_parse_launch("videotestsrc is-live=true"</font></div>
<div><font size="2"> " !video/x-raw,format=(string)RGB,width=(int)640,height=(int)480,framerate=(fraction)30/1"</font></div>
<div><font size="2"> " !appsink name=myappsink"</font></div>
<div><font size="2"> , &error);</font></div>
<div><font size="2"> pipelineB = gst_parse_launch(" appsrc name=myappsrc format=3 is-live=true"</font></div>
<div><font size="2"> " !videoconvert"</font></div>
<div><font size="2"> " !autovideosink"</font></div>
<div><font size="2"> , &error);</font></div>
<div><font size="2"> appSink = gst_bin_get_by_name(GST_BIN(pipelinA), "mayappsink");</font></div>
<div><font size="2"> memset(&callbacks, 0, sizeof(callbacks));</font></div>
<div><font size="2"> callbacks.new_sample = newPacket;</font></div>
<div><font size="2"> gst_app_sink_set_callbacks((GstAppSink *)(appSink), &callbacks, NULL, NULL);</font></div>
<div><font size="2"> global_appSrc = gst_bin_get_by_name(GST_BIN(pipelineB), "myappsrc");</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2"> gst_element_set_state(pipelineA, GST_STATE_READY);</font></div>
<div><font size="2"> gst_element_set_state(pipelineB, GST_STATE_READY);</font></div>
<div><font size="2">}</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2">static GstFlowReturn newPacket(GstAppSink *appsink, gpointer data)</font></div>
<div><font size="2">{</font></div>
<div><font size="2"> static bool firstSample=YES;</font></div>
<div><font size="2"> GstFlowReturn retval = GST_FLOW_OK;</font></div>
<div><font size="2"> if (gst_app_sink_is_eos(appsink) == FALSE)</font></div>
<div><font size="2"> {</font></div>
<div><font size="2"> GstSample *sample = gst_app_sink_pull_sample(appsink);</font></div>
<div><font size="2"> if (NULL != sample)</font></div>
<div><font size="2"> {</font></div>
<div><font size="2"> if (YES == firstSample)</font></div>
<div><font size="2"> {</font></div>
<div><font size="2"> GstCaps *caps = gst_sample_get_caps(sample);</font></div>
<div><font size="2"> gst_caps_ref(caps);</font></div>
<div><font size="2"> gst_app_src_set_caps((GstAppSrc *)global_appSrc, caps);</font></div>
<div><font size="2"> firstSample = NO;</font></div>
<div><font size="2"> }</font></div>
<div><font size="2"> GstBuffer *buffer = gst_sample_get_buffer(sample);</font></div>
<div><font size="2"> if (NULL != buffer)</font></div>
<div><font size="2"> {</font></div>
<div><font size="2"> if (((GST_STATE_PLAYING == global_pipelineBState) || (GST_STATE_PAUSED == global_pipelineBState)))</font></div>
<div><font size="2"> {</font></div>
<div><font size="2"> retval = gst_app_src_push_buffer((GstAppSrc *)global_appSrc, gst_buffer_ref(buffer));</font></div>
<div><font size="2"><span class="Apple-tab-span" style="white-space:pre"> </span> NSLog(@"retval = %d", retval);</font></div>
<div><font size="2"> }</font></div>
<div><font size="2"> }</font></div>
<div><font size="2"> gst_sample_unref(sample);</font></div>
<div><font size="2"> }</font></div>
<div><font size="2"> }</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2"> return retval;</font></div>
<div><font size="2">}</font></div>
</div>
<div><font size="2">------------------------------------------------------</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2">Again, I've trimmed the code quite a bit but I believe all the important bits are there. As before,</font><span style="font-size: small;"> I handle the pipeline state changes to GST_STATE_READY callback by setting the states to GST_STATE_PLAYING.</span></div>
<div><span style="font-size: small;"><br>
</span></div>
<div><span style="font-size: small;">This pair of pipelines do not work. "not work" means I see no errors (I am registering for error, eos, state-changed, and clock-lost callbacks) but I also see no test pattern, just a blank screen. I see the samples and buffers being handled by newPacket(), as there is a continuous stream of debug output. I've tried various permutations, including adding the same caps line in pipleineB, i.e.:</span></div>
<div><font size="2"><br>
</font></div>
<div>
<div><font size="2">------------------------------------------------------</font></div>
</div>
<div>
<div><font size="2"> pipelineB = gst_parse_launch(" appsrc name=myappsrc format=3 is-live=true"</font></div>
<div>
<div><font size="2"> " !video/x-raw,format=(string)RGB,width=(int)640,height=(int)480,framerate=(fraction)30/1"</font></div>
</div>
<div><font size="2"> " !videoconvert"</font></div>
<div><font size="2"> " !autovideosink"</font></div>
<div><font size="2"> , &error);</font></div>
</div>
<div>
<div><font size="2">------------------------------------------------------</font></div>
</div>
<div><font size="2"><br>
</font></div>
<div><font size="2">But I get the same results: no error but also no video.</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2">Any thoughts on what I'm doing wrong here?</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2">Thanks,</font></div>
<div><font size="2">Michael</font></div>
</font>
</div>
</div>
</font>