<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi everyone, <br>
    I am trying to change the location uri for the souphttpsrc on
    android and this is the code I have written (based on tutorial5 for
    android):<br>
    <br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <blockquote>
      <pre style="background-color:#ffffff;color:#000000;font-family:'DejaVu Sans Mono';font-size:9,0pt;"><small><span style="color:#808080;font-style:italic;">/* Set playbin2's URI */
</span><span style="color:#000080;font-weight:bold;">void </span>gst_native_set_uri (JNIEnv* env, jobject thiz, jstring uri) {

    CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id);
    <span style="color:#000080;font-weight:bold;">if </span>(!data || !data->pipeline) <span style="color:#000080;font-weight:bold;">return</span>;
    <span style="color:#000080;font-weight:bold;">const </span>jbyte *char_uri = (*env)->GetStringUTFChars (env, uri, NULL);
    GstElement *http_src;<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>gchar *location;<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>gchar *next_location = g_strdup(char_uri);
    http_src = gst_bin_get_by_name (GST_BIN(data->pipeline), <span style="color:#008000;font-weight:bold;">"http_src"</span>);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span><span style="color:#000080;font-weight:bold;">if</span>(!http_src)</small><small><span style="color:#808080;font-style:italic;">//mod</span></small><small><span style="color:#808080;font-style:italic;"><small><span style="color:#808080;font-style:italic;"></span></small></span>
        GST_DEBUG(<span style="color:#008000;font-weight:bold;">"GstElement http_src ERROR!"</span>);</small><small><span style="color:#808080;font-style:italic;">//mod</span>
    <span style="color:#000080;font-weight:bold;">else</span></small><small><span style="color:#000080;font-weight:bold;"><span style="color:#808080;font-style:italic;">//mod</span>
</span><span style="color:#000080;font-weight:bold;">        </span>GST_DEBUG(<span style="color:#008000;font-weight:bold;">"GstElement http_src OK"</span>);</small><small><span style="color:#808080;font-style:italic;">//mod</span>
    GST_DEBUG (<span style="color:#008000;font-weight:bold;">"Setting URI to %s"</span>, char_uri);
<span style="color:#808080;font-style:italic;">
</span><span style="color:#808080;font-style:italic;">    /*This the modified part of the function*/
</span><span style="color:#808080;font-style:italic;">    </span>data->target_state = GST_STATE_READY;<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>gst_element_set_state(data->pipeline, GST_STATE_READY);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>GST_DEBUG(<span style="color:#008000;font-weight:bold;">"Pipeline state: READY"</span>);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">
</span><span style="color:#808080;font-style:italic;">    </span>g_object_get(G_OBJECT(http_src), <span style="color:#008000;font-weight:bold;">"location"</span>, &location, NULL);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>g_print(<span style="color:#008000;font-weight:bold;">"Current http-src location: %s"</span>, location);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>g_object_set(G_OBJECT(http_src), <span style="color:#008000;font-weight:bold;">"location"</span>, char_uri, NULL);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>g_object_get(G_OBJECT(http_src), <span style="color:#008000;font-weight:bold;">"location"</span>, &location, NULL);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>g_print(<span style="color:#008000;font-weight:bold;">"Current http-src location: %s"</span>, location);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">
</span><span style="color:#808080;font-style:italic;">    </span>data->target_state = GST_STATE_PLAYING;<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>gst_element_set_state(data->pipeline, GST_STATE_PLAYING);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    </span>GST_DEBUG(<span style="color:#008000;font-weight:bold;">"Pipeline state: PLAYING"</span>);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">
</span><span style="color:#808080;font-style:italic;">    </span>gst_object_unref (http_src);<span style="color:#808080;font-style:italic;">//mod
</span><span style="color:#808080;font-style:italic;">    /*End of modified code*/

</span><span style="color:#808080;font-style:italic;">    </span>(*env)->ReleaseStringUTFChars (env, uri, char_uri);
    data->duration = GST_CLOCK_TIME_NONE;
    data->is_live = (gst_element_set_state (data->pipeline, data->target_state) == GST_STATE_CHANGE_NO_PREROLL);

}</small></pre>
    </blockquote>
    <br>
    So as this function is called, when it used to be a playbin, just by
    adding the GST_STATE_READY and the g_object_set() for the uri worked
    fine. Now I have a working pipeline with a checked .ts and it
    initially works, but not when this function is called. The debug
    logs for the location property gets changed but what happens is that
    the app gets paused (no crash at all) with the outdated video. The
    initially working pipeline -using gst_parse_launch()- is:<br>
    <br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <blockquote>
      <pre style="background-color:#ffffff;color:#000000;font-family:'DejaVu Sans Mono';font-size:9,0pt;"><small><span style="color:#808080;font-style:italic;">souphttpsrc name=http_src location=<a class="moz-txt-link-freetext" href="http://192.168.0.32/videos/sintel.ts">http://192.168.0.32/videos/sintel.ts</a> ! queue ! tsdemux name=demux 
demux. ! queue ! h264parse ! avdec_h264 ! videoconvert ! glimagesink name=video_sink 
demux. ! queue ! aacparse ! faad ! audioconvert ! autoaudiosink name=audio_sink</span></small></pre>
    </blockquote>
    <br>
    <br>
    The related log is:<br>
    <br>
    <blockquote><small>05-17 11:04:54.500 19858-19924/com.sample.app
        W/GStreamer+basesrc: 0:00:11.130733339 0x9e012490
        gstbasesrc.c:2943:gst_base_src_loop:<http_src> error:
        Internal data flow error.</small><br>
      <small>05-17 11:04:54.500 19858-19924/com.sample.app
        W/GStreamer+basesrc: 0:00:11.130925589 0x9e012490
        gstbasesrc.c:2943:gst_base_src_loop:<http_src> error:
        streaming task paused, reason not-negotiated (-4)</small><br>
      <small>05-17 11:04:54.500 19858-19924/com.sample.app
        W/GStreamer+queue: 0:00:11.131194839 0x9e012490
        gstqueue.c:968:gst_queue_handle_sink_event:<queue3> error:
        Internal data flow error.</small><br>
      <small>05-17 11:04:54.500 19858-19924/com.sample.app
        W/GStreamer+queue: 0:00:11.131370672 0x9e012490
        gstqueue.c:968:gst_queue_handle_sink_event:<queue3> error:
        streaming task paused, reason not-negotiated (-4)<br>
        <br>
      </small></blockquote>
    Can anyone give a clue for what I am missing?<br>
    <br>
    Thanks in advance, <br>
    <br>
    Dani<br>
  </body>
</html>