Commit a144690a authored by Brendan Long's avatar Brendan Long

Merge pull request #5 from cablelabs/seek-secs-added

Added cmd line arg "seek_secs" to perform a singled time based seek.  Go...
parents b547b253 6acab3db
......@@ -49,8 +49,7 @@ static gboolean g_handle_buffering = FALSE;
static gboolean g_use_dtcp = FALSE;
static gboolean g_format_bytes = FALSE;
static gboolean g_do_query = FALSE;
static gboolean g_do_seek = FALSE;
static gint g_seek_secs = 0;
static gboolean g_zero_position = FALSE;
static gboolean g_positions = FALSE;
......@@ -379,10 +378,6 @@ static gboolean process_cmd_line_args(int argc, char *argv[])
else
{
g_print("Set requested rate change to %4.1f\n", g_requested_rate);
g_do_seek = TRUE;
g_print("Setting do seek flag to TRUE\n");
g_do_query = TRUE;
g_print("Setting do query flag to TRUE\n");
}
}
else if (strstr(argv[i], "wait=") != NULL)
......@@ -469,11 +464,6 @@ static gboolean process_cmd_line_args(int argc, char *argv[])
g_test_uri_switch = TRUE;
g_print("Set to test uri switching\n");
}
else if (strstr(argv[i], "query") != NULL)
{
g_do_query = TRUE;
g_print("Set to query position\n");
}
else if (strstr(argv[i], "zero") != NULL)
{
g_zero_position = TRUE;
......@@ -539,6 +529,18 @@ static gboolean process_cmd_line_args(int argc, char *argv[])
g_handle_buffering = TRUE;
g_print("Set to handle buffering\n");
}
else if (strstr(argv[i], "seek_secs=") != NULL)
{
if (sscanf(argv[i], "seek_secs=%d", &g_seek_secs) != 1)
{
g_printerr("Invalid seek secs arg specified: %s\n", argv[i]);
return FALSE;
}
else
{
g_print("Set requested seek secs to %d\n", g_seek_secs);
}
}
else
{
g_printerr("Invalid option: %s\n", argv[i]);
......@@ -557,9 +559,9 @@ static gboolean process_cmd_line_args(int argc, char *argv[])
g_printerr("\t manual_elements \t\t build manual pipeline using decode elements\n");
g_printerr("\t playspeeds \t\t allow changing of playspeeds from keyboard\n");
g_printerr("\t position \t\t test positioning of seeks\n");
g_printerr("\t query \t\t perform seek using current position + 10\n");
g_printerr("\t rate=y \t\t where y is desired rate\n");
g_printerr("\t rrid=i \t\t where i is cds recording id\n");
g_printerr("\t seek_secs \t\t perform seek to specified seconds\n");
g_printerr("\t simple \t\t create simple pipeline rather than playbin\n");
g_printerr("\t states \t\t test state changes\n");
g_printerr("\t switch \t\t play for wait secs then switch uri\n");
......@@ -1418,6 +1420,11 @@ static void perform_test(CustomData* data)
{
perform_test_playspeeds(data);
}
else if (g_seek_secs != 0)
{
g_usleep(g_wait_secs * 1000000L);
perform_test_seek(data, g_seek_secs*GST_SECOND, GST_FORMAT_TIME, 1);
}
// Wait until error or EOS
bus = gst_element_get_bus (data->pipeline);
......@@ -1466,33 +1473,19 @@ static gboolean perform_test_rate_change(CustomData* data)
__FUNCTION__, gst_format_get_name(format));
// Query current position, duration and rate
if (g_do_query)
if (!perform_test_query(data, &position, format))
{
if (!perform_test_query(data, &position, format))
{
g_printerr("%s - Problems with query associated with test.\n",
g_printerr("%s - Problems with query associated with test.\n",
__FUNCTION__);
return FALSE;
}
}
else
{
g_print("%s - Not performing query\n", __FUNCTION__);
return FALSE;
}
// Initiate seek to perform test
if (g_do_seek)
if (!perform_test_seek(data, position, format, rate))
{
if (!perform_test_seek(data, position, format, rate))
{
g_printerr("%s - Problems with seek associated with test.\n",
g_printerr("%s - Problems with seek associated with test.\n",
__FUNCTION__);
return FALSE;
}
}
else
{
g_print("%s - Not performing seek\n", __FUNCTION__);
return FALSE;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment