mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-05 06:58:49 +00:00
check for md5sink in pipeline
Original commit message from CVS: check for md5sink in pipeline
This commit is contained in:
parent
2b881623ff
commit
2e7fa817e4
2 changed files with 61 additions and 12 deletions
|
@ -16,9 +16,11 @@ should print out the same checksum as
|
||||||
|
|
||||||
md5sum music.mp3
|
md5sum music.mp3
|
||||||
|
|
||||||
The pipeline should be incomplete, that is, a final sink element
|
If the pipeline contains an md5sink element, gst-md5sum will query it
|
||||||
should be omitted, so that gst\-md5sum can connect the pipeline to
|
for the md5sum at the end of pipeline iteration.
|
||||||
an md5sink element.
|
|
||||||
|
If it doesn't contain an md5sink element, gst-md5sum will automatically
|
||||||
|
connect an md5sink to the right hand side of the given pipeline.
|
||||||
|
|
||||||
See the man page for gst\-launch or the GStreamer docuementation for
|
See the man page for gst\-launch or the GStreamer docuementation for
|
||||||
more information on how to create a PARTIAL\-PIPELINE\-DESCRIPTION.
|
more information on how to create a PARTIAL\-PIPELINE\-DESCRIPTION.
|
||||||
|
@ -52,3 +54,27 @@ Add directories separated with ':' to the plugin search path
|
||||||
.BR gst\-launch (1)
|
.BR gst\-launch (1)
|
||||||
.SH "AUTHOR"
|
.SH "AUTHOR"
|
||||||
The GStreamer team at http://gstreamer.net/
|
The GStreamer team at http://gstreamer.net/
|
||||||
|
***************
|
||||||
|
*** 16,24 ****
|
||||||
|
|
||||||
|
md5sum music.mp3
|
||||||
|
|
||||||
|
The pipeline should be incomplete, that is, a final sink element
|
||||||
|
- should be omitted, so that gst\-md5sum can connect the pipeline to
|
||||||
|
- an md5sink element.
|
||||||
|
|
||||||
|
See the man page for gst\-launch or the GStreamer docuementation for
|
||||||
|
more information on how to create a PARTIAL\-PIPELINE\-DESCRIPTION.
|
||||||
|
--- 16,27 ----
|
||||||
|
|
||||||
|
md5sum music.mp3
|
||||||
|
|
||||||
|
+ If the pipeline contains an md5sink element, gst-md5sum will query it
|
||||||
|
+ for the md5sum at the end of pipeline iteration.
|
||||||
|
+
|
||||||
|
+ If it doesn't contain an md5sink element, gst-md5sum will automatically
|
||||||
|
+ connect an md5sink to the right hand side of the given pipeline.
|
||||||
|
The pipeline should be incomplete, that is, a final sink element
|
||||||
|
|
||||||
|
See the man page for gst\-launch or the GStreamer docuementation for
|
||||||
|
more information on how to create a PARTIAL\-PIPELINE\-DESCRIPTION.
|
||||||
|
|
|
@ -59,7 +59,7 @@ main (int argc, char *argv[])
|
||||||
POPT_TABLEEND
|
POPT_TABLEEND
|
||||||
};
|
};
|
||||||
|
|
||||||
GstElement *pipeline;
|
GstElement *pipeline = NULL;
|
||||||
gchar **argvn;
|
gchar **argvn;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GstElement *md5sink;
|
GstElement *md5sink;
|
||||||
|
@ -71,15 +71,38 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
gst_init_with_popt_table (&argc, &argv, options);
|
gst_init_with_popt_table (&argc, &argv, options);
|
||||||
|
|
||||||
|
/* make a parseable argvn array */
|
||||||
|
argvn = g_new0 (char *, argc);
|
||||||
|
memcpy (argvn, argv + 1, sizeof (char *) * (argc - 1));
|
||||||
|
|
||||||
|
/* Check if we have an element already that is called md5sink0
|
||||||
|
in the pipeline; if not, add one */
|
||||||
|
pipeline = (GstElement*) gst_parse_launchv ((const gchar**) argvn, &error);
|
||||||
|
if (!pipeline) {
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
g_warning ("pipeline could not be constructed: %s\n", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_warning ("pipeline could not be constructed\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
md5sink = gst_bin_get_by_name (GST_BIN (pipeline), "md5sink0");
|
||||||
|
if (md5sink == NULL)
|
||||||
|
{
|
||||||
|
g_print ("adding an md5sink element to the pipeline\n");
|
||||||
/* make a null-terminated version of argv with ! md5sink appended
|
/* make a null-terminated version of argv with ! md5sink appended
|
||||||
* ! is stored in argvn[argc - 1], md5sink in argvn[argc],
|
* ! is stored in argvn[argc - 1], md5sink in argvn[argc],
|
||||||
* NULL pointer in argvn[argc + 1] */
|
* NULL pointer in argvn[argc + 1] */
|
||||||
|
g_free (argvn);
|
||||||
argvn = g_new0 (char *, argc + 2);
|
argvn = g_new0 (char *, argc + 2);
|
||||||
memcpy (argvn, argv + 1, sizeof (char *) * (argc - 1));
|
memcpy (argvn, argv + 1, sizeof (char *) * (argc - 1));
|
||||||
argvn[argc - 1] = g_strdup_printf ("!");
|
argvn[argc - 1] = g_strdup_printf ("!");
|
||||||
argvn[argc] = g_strdup_printf ("md5sink");
|
argvn[argc] = g_strdup_printf ("md5sink");
|
||||||
|
|
||||||
pipeline = (GstElement*) gst_parse_launchv ((const gchar**) argvn, &error);
|
pipeline = (GstElement*) gst_parse_launchv ((const gchar**) argvn, &error);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pipeline) {
|
if (!pipeline) {
|
||||||
if (error)
|
if (error)
|
||||||
|
|
Loading…
Reference in a new issue