How to pass the IP adress of TCP server to the pipeline in the C code of Android application

Kenairod doriank at hotmail.fr
Thu Mar 27 04:25:26 PDT 2014


Well, I've tried an other way which seems to work better, but I still got an
error.
Here is the code I changed :
const gchar * serverIpAddress;


// .....


/* Main method for the native code. This is executed on its own thread. */
static void *app_function (void *userdata) {
 

// .....


  /* Build pipeline */
  const gchar * part1 = "tcpclientsrc host=";
  gchar* pipeline_definition;
  pipeline_definition = malloc(109); //Number of characters in the pipeline
definition
  strcpy(pipeline_definition, part1); // copy the part 1 into the new var
  strcat(pipeline_definition, serverIpAddress); // add the ip address
  const gchar *  part2 = " port=5000 ! gdpdepay ! rtph264depay ! ffdec_h264
! autovideosink sync=false";
  strcat(pipeline_definition, part2);

  data->pipeline = gst_parse_launch(pipeline_definition, &error);
  if (error) {
    gchar *message = g_strdup_printf("Unable to build pipeline: %s",
error->message);
    g_clear_error (&error);
    set_ui_message(message, data);
    g_free (message);
    return NULL;
  }

 
// .....


}


JNIEXPORT void JNICALL
Java_com_gst_sdk_tutorials_tutorial_3_Tutorial3_nativeSetIpserver(JNIEnv *
env, jobject obj, jstring ipAddress)
{
	const char *temp = (*env)->GetStringUTFChars(env, ipAddress, 0);
	serverIpAddress = temp;
	(*env)->ReleaseStringUTFChars(env, ipAddress, temp);
}

/* List of implemented native methods */
static JNINativeMethod native_methods[] = {

	// .....

  { "nativeSetIpserver", "(Ljava/lang/String;)V", (void *)
Java_com_gst_sdk_tutorials_tutorial_3_Tutorial3_nativeSetIpserver}
};


And here is the error I get in LogCat during the execution on the android
device :
03-26 12:28:43.405: E/GStreamer+GST_PIPELINE(32471): 0:00:00.924521542
0x5f17dcc0 ./grammar.y:463:gst_parse_element_set could not set property
"host" in element "tcpclientsrc0" to "?�@ؑ@/OutputStreamWriter;"


I hope someone will have a clue 




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-pass-the-IP-adress-of-TCP-server-to-the-pipeline-in-the-C-code-of-Android-application-tp4666082p4666146.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list