|
Packit |
971217 |
/* GStreamer appsink benchmark
|
|
Packit |
971217 |
* Copyright (C) 2018 Tim-Philipp Müller <tim centricular com>
|
|
Packit |
971217 |
|
|
Packit |
971217 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
971217 |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
971217 |
* License as published by the Free Software Foundation; either
|
|
Packit |
971217 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
971217 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
971217 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
971217 |
* Library General Public License for more details.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
971217 |
* License along with this library; if not, write to the
|
|
Packit |
971217 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
Packit |
971217 |
* Boston, MA 02110-1301, USA.
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
|
|
Packit |
971217 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
971217 |
#include "config.h"
|
|
Packit |
971217 |
#endif
|
|
Packit |
971217 |
#include <gst/gst.h>
|
|
Packit |
971217 |
#include <gst/app/app.h>
|
|
Packit |
971217 |
|
|
Packit |
971217 |
#define NUM_BUFFERS 10000000
|
|
Packit |
971217 |
|
|
Packit |
971217 |
int
|
|
Packit |
971217 |
main (int argc, char **argv)
|
|
Packit |
971217 |
{
|
|
Packit |
971217 |
GstElement *src, *sink, *pipeline;
|
|
Packit |
971217 |
GstSample *sample;
|
|
Packit |
971217 |
|
|
Packit |
971217 |
gst_init (&argc, &argv);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
pipeline = gst_pipeline_new (NULL);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
src = gst_element_factory_make ("fakesrc", NULL);
|
|
Packit |
971217 |
g_object_set (src, "num-buffers", NUM_BUFFERS, NULL);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
sink = gst_element_factory_make ("appsink", NULL);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
Packit |
971217 |
gst_element_link_many (src, sink, NULL);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
Packit |
971217 |
while ((sample = gst_app_sink_pull_sample (GST_APP_SINK (sink))))
|
|
Packit |
971217 |
gst_sample_unref (sample);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
return 0;
|
|
Packit |
971217 |
}
|