Hi All,
I am implementing seek within playback using gstreamer playbin2 element. Following is code snippet:
// --------------- Main Function ----------------//
g_object_set (playbin2, "uri", "file:///tmp/sample.ogv", NULL);
GstBus *bus = NULL;
bus = gst_element_get_bus (playbin2);
gst_bus_add_watch (bus, my_bus_callback, NULL); // Call back function to handle messages
gst_object_unref (bus);
GStaticRecMutex my_mutex = G_STATIC_REC_MUTEX_INIT;
GstTask *InputTask = gst_task_create(InputTaskFunction,NULL); // Function to interact with playbin2
gst_task_set_lock(InputTask,&my_mutex);
/* Start playing */
ret = gst_element_set_state (playbin2, GST_STATE_PLAYING);
if (ret == GST_STATE_CHANGE_FAILURE) {
g_printerr ("Unable to set the pipeline to the playing state.\n");
gst_object_unref (playbin2);
return -1;
}
start = 1;
gst_task_set_state(InputTask,GST_TASK_STARTED);
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
// ----------------------------- End Main ----------------------------//
// -------------- Interaction function -----------------//
void InputTaskFunction (void *data)
{
while (start){
char ch;
g_print("waiting for input\n"); // Accepting input from console (stdin)
scanf("%c",&ch);
switch (ch) {
case 'q':
gst_element_set_state (GST_ELEMENT (playbin2), GST_STATE_NULL);
start = 0;
g_main_loop_quit (loop);
break;
case 's':
{ // Seeking to 10th second of video file
gst_element_seek (playbin2, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET,
10*GST_SECOND, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
}
break;
default:
g_print("Invalid Operation.\n");
}
}
}
I have tested same code on desktop machine, where this works fine, resuming playback from 10th seconds of video file whenever user inputs 's' (seek) through console.
But when I tested same code on dm814x EVM board, the video got frizzed as soon as you send seek event (EZSDK-5.03.01.15).
Am I missing any configuration on EVM, which is causing this issue?
Also I observer high CPU and my gstreamer application stops working whenever I tried increasing gstreamer debug level more than 0 (using GST_DEBUG environment variable). How one can increase gst debug level on EVM board?
Thanks,
Rajnikant