Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
luzpaz
gstreamer
Commits
4e12c452
Commit
4e12c452
authored
Jun 20, 2014
by
Tim-Philipp Müller
🐠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
benchmark: capsnego: use GOptionContext for option parsing
parent
4043fc3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
41 deletions
+36
-41
tests/benchmarks/capsnego.c
tests/benchmarks/capsnego.c
+36
-41
No files found.
tests/benchmarks/capsnego.c
View file @
4e12c452
...
...
@@ -19,13 +19,15 @@
* Boston, MA 02110-1301, USA.
*/
/* this benchmark recursively builds a pipeline and measures the time to go
* from ready to paused.
* The graph size and type can be controlled with a few commandline args:
/* This benchmark recursively builds a pipeline and measures the time to go
* from READY to PAUSED state.
*
* The graph size and type can be controlled with a few command line options:
*
* -d depth: is the depth of the tree
* -c children: is the number of branches on each level
* -f <flavour>: can be a
=
udio
/v=
ideo and is cont
t
rolling the kind of
elements
* that are used.
* -f <flavour>: can be
"
audio
" or "v
ideo
"
and is controlling the kind of
*
elements
that are used.
*/
#include <gst/gst.h>
...
...
@@ -195,52 +197,45 @@ event_loop (GstElement * bin, GstClockTime start)
gst_object_unref
(
bus
);
}
gint
main
(
gint
argc
,
gchar
*
argv
[])
{
/* default parameters */
const
gchar
*
flavour_str
=
"audio"
;
gint
flavour
=
FLAVOUR_AUDIO
;
gint
children
=
3
;
gint
depth
=
4
;
GOptionContext
*
ctx
;
GOptionEntry
options
[]
=
{
{
"children"
,
'c'
,
0
,
G_OPTION_ARG_INT
,
&
children
,
"Number of children (branches on each level) (default: 3)"
,
NULL
},
{
"depth"
,
'd'
,
0
,
G_OPTION_ARG_INT
,
&
depth
,
"Depth of pipeline hierarchy tree (default: 4)"
,
NULL
},
{
"flavour"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
flavour_str
,
"Flavour (video|audio) controlling the kind of elements used "
"(default: audio)"
,
NULL
},
{
NULL
}
};
GError
*
err
=
NULL
;
GstBin
*
bin
;
GstClockTime
start
,
end
;
GstElement
*
sink
,
*
new_sink
;
/* default parameters */
gint
depth
=
4
;
gint
children
=
3
;
gint
flavour
=
FLAVOUR_AUDIO
;
const
gchar
*
flavour_str
=
"audio"
;
gst_init
(
&
argc
,
&
argv
);
g_set_prgname
(
"capsnego"
);
/* check command line options */
if
(
argc
)
{
gint
arg
;
for
(
arg
=
0
;
arg
<
argc
;
arg
++
)
{
if
(
!
strcmp
(
argv
[
arg
],
"-d"
))
{
arg
++
;
if
(
arg
<
argc
)
depth
=
atoi
(
argv
[
arg
]);
}
else
if
(
!
strcmp
(
argv
[
arg
],
"-c"
))
{
arg
++
;
if
(
arg
<
argc
)
children
=
atoi
(
argv
[
arg
]);
}
else
if
(
!
strcmp
(
argv
[
arg
],
"-f"
))
{
arg
++
;
if
(
arg
<
argc
)
{
flavour_str
=
argv
[
arg
];
switch
(
*
flavour_str
)
{
case
'a'
:
flavour
=
FLAVOUR_AUDIO
;
break
;
case
'v'
:
flavour
=
FLAVOUR_VIDEO
;
break
;
default:
break
;
}
}
}
}
ctx
=
g_option_context_new
(
""
);
g_option_context_add_main_entries
(
ctx
,
options
,
NULL
);
g_option_context_add_group
(
ctx
,
gst_init_get_option_group
());
if
(
!
g_option_context_parse
(
ctx
,
&
argc
,
&
argv
,
&
err
))
{
g_print
(
"Error initializing: %s
\n
"
,
GST_STR_NULL
(
err
->
message
));
return
1
;
}
g_option_context_free
(
ctx
);
if
(
strcmp
(
flavour_str
,
"video"
)
==
0
)
flavour
=
FLAVOUR_VIDEO
;
/* build pipeline */
g_print
(
"building %s pipeline with depth = %d and children = %d
\n
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment