mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
examples: Add basic examples of asset
This commit is contained in:
parent
a7280fb59d
commit
a1b946ab92
2 changed files with 71 additions and 0 deletions
|
@ -15,6 +15,7 @@ noinst_PROGRAMS = \
|
|||
thumbnails \
|
||||
overlays \
|
||||
text_properties \
|
||||
assets \
|
||||
$(graphical)
|
||||
|
||||
AM_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_CFLAGS) $(GTK_CFLAGS)
|
||||
|
|
70
tests/examples/assets.c
Normal file
70
tests/examples/assets.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
/* GStreamer Editing Services
|
||||
* Copyright (C) 2012 Volodymyr Rudyi<vladimir.rudoy@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <ges/ges.h>
|
||||
#include <ges/ges-asset-file-source.h>
|
||||
#include <gst/pbutils/encoding-profile.h>
|
||||
#include <gst/pbutils/gstdiscoverer.h>
|
||||
#include <ges/ges-internal.h>
|
||||
|
||||
static void
|
||||
asset_loaded_cb (GObject * source, GAsyncResult * res, GMainLoop * mainloop)
|
||||
{
|
||||
GESAssetFileSource *mfs =
|
||||
GES_ASSET_FILESOURCE (ges_asset_request_finish (res, NULL));
|
||||
GstDiscovererInfo *discoverer_info = NULL;
|
||||
discoverer_info = ges_asset_filesource_get_info (mfs);
|
||||
|
||||
GST_DEBUG ("Result is %d", gst_discoverer_info_get_result (discoverer_info));
|
||||
GST_DEBUG ("Info type is %s", G_OBJECT_TYPE_NAME (mfs));
|
||||
GST_DEBUG ("Duration is %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (ges_asset_filesource_get_duration (mfs)));
|
||||
|
||||
g_object_unref (mfs);
|
||||
|
||||
g_main_loop_quit (mainloop);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar ** argv)
|
||||
{
|
||||
GMainLoop *mainloop;
|
||||
|
||||
if (argc != 2) {
|
||||
return 1;
|
||||
}
|
||||
/* Initialize GStreamer (this will parse environment variables and commandline
|
||||
* arguments. */
|
||||
gst_init (NULL, NULL);
|
||||
|
||||
/* Initialize the GStreamer Editing Services */
|
||||
ges_init ();
|
||||
|
||||
/* ... and we start a GMainLoop. GES **REQUIRES** a GMainLoop to be running in
|
||||
* order to function properly ! */
|
||||
mainloop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
ges_asset_request_async (GES_TYPE_TIMELINE_FILE_SOURCE, argv[1], NULL,
|
||||
(GAsyncReadyCallback) asset_loaded_cb, mainloop);
|
||||
|
||||
g_main_loop_run (mainloop);
|
||||
g_main_loop_unref (mainloop);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue