QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
parse.cpp
1 /*
2  Copyright (C) 2010 George Kiagiadakis <kiagiadakis.george@gmail.com>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as published
6  by the Free Software Foundation; either version 2.1 of the License, or
7  (at your option) any later version.
8 
9  This program 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
12  GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #include "parse.h"
18 #include "element.h"
19 #include "../QGlib/error.h"
20 #include <gst/gst.h>
21 
22 namespace QGst {
23 namespace Parse {
24 
25 ElementPtr launch(const char* description)
26 {
27  GError *error = NULL;
28  GstElement *e = gst_parse_launch_full(description, NULL, GST_PARSE_FLAG_FATAL_ERRORS, &error);
29  if (error) {
30  throw QGlib::Error(error);
31  }
32  if (e) {
33  gst_object_ref_sink(e);
34  }
35  return ElementPtr::wrap(e, false);
36 }
37 
38 ElementPtr launch(const char *argv[])
39 {
40  GError *error = NULL;
41  GstElement *e = gst_parse_launchv_full(argv, NULL, GST_PARSE_FLAG_FATAL_ERRORS, &error);
42  if (error) {
43  throw QGlib::Error(error);
44  }
45  if (e) {
46  gst_object_ref_sink(e);
47  }
48  return ElementPtr::wrap(e, false);
49 }
50 
51 } //namespace Parse
52 } //namespace QGst
static RefPointer< Element > wrap(typename Element::CType *nativePtr, bool increaseRef=true)
ElementPtr launch(const char *description)
Definition: parse.cpp:25
Wrapper class for GError.
Definition: error.h:30