1 /* GStreamer Editing Services
2  * Copyright (C) 2012 Volodymyr Rudyi<vladimir.rudoy@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #include <ges/ges.h>
21 #include <ges/ges-uri-asset.h>
22 #include <gst/pbutils/encoding-profile.h>
23 #include <gst/pbutils/gstdiscoverer.h>
24 
25 static void
asset_loaded_cb(GObject * source,GAsyncResult * res,GMainLoop * mainloop)26 asset_loaded_cb (GObject * source, GAsyncResult * res, GMainLoop * mainloop)
27 {
28   GESUriClipAsset *mfs =
29       GES_URI_CLIP_ASSET (ges_asset_request_finish (res, NULL));
30   GstDiscovererInfo *discoverer_info = NULL;
31   discoverer_info = ges_uri_clip_asset_get_info (mfs);
32 
33   GST_DEBUG ("Result is %d", gst_discoverer_info_get_result (discoverer_info));
34   GST_DEBUG ("Info type is %s", G_OBJECT_TYPE_NAME (mfs));
35   GST_DEBUG ("Duration is %" GST_TIME_FORMAT,
36       GST_TIME_ARGS (ges_uri_clip_asset_get_duration (mfs)));
37 
38   gst_object_unref (mfs);
39 
40   g_main_loop_quit (mainloop);
41 }
42 
43 int
main(int argc,gchar ** argv)44 main (int argc, gchar ** argv)
45 {
46   GMainLoop *mainloop;
47 
48   if (argc != 2) {
49     return 1;
50   }
51   /* Initialize GStreamer (this will parse environment variables and commandline
52    * arguments. */
53   gst_init (NULL, NULL);
54 
55   /* Initialize the GStreamer Editing Services */
56   ges_init ();
57 
58   /* ... and we start a GMainLoop. GES **REQUIRES** a GMainLoop to be running in
59    * order to function properly ! */
60   mainloop = g_main_loop_new (NULL, FALSE);
61 
62   ges_asset_request_async (GES_TYPE_URI_CLIP, argv[1], NULL,
63       (GAsyncReadyCallback) asset_loaded_cb, mainloop);
64 
65   g_main_loop_run (mainloop);
66   g_main_loop_unref (mainloop);
67 
68   return 0;
69 }
70