Imported Upstream version 0.10.23
[profile/ivi/gst-plugins-bad.git] / sys / applemedia / plugin.m
1 /*
2  * Copyright (C) 2009-2010 Ole André Vadla Ravnås <oravnas@cisco.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 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif
23
24 #ifdef HAVE_IOS
25 #include "avfvideosrc.h"
26 #include "celvideosrc.h"
27 #else
28 #include "qtkitvideosrc.h"
29 #include "miovideosrc.h"
30 #include <Foundation/Foundation.h>
31 #endif
32 #include "vth264decbin.h"
33 #include "vth264encbin.h"
34 #include "vtenc.h"
35 #include "vtdec.h"
36
37 #ifndef HAVE_IOS
38 static void
39 enable_mt_mode (void)
40 {
41   NSThread * th = [[NSThread alloc] init];
42   [th start];
43   [th release];
44   g_assert ([NSThread isMultiThreaded]);
45 }
46 #endif
47
48 static gboolean
49 plugin_init (GstPlugin * plugin)
50 {
51   gboolean res = TRUE;
52
53 #ifdef HAVE_IOS
54   res = gst_element_register (plugin, "avfvideosrc", GST_RANK_NONE,
55       GST_TYPE_AVF_VIDEO_SRC);
56   res &= gst_element_register (plugin, "celvideosrc", GST_RANK_NONE,
57       GST_TYPE_CEL_VIDEO_SRC);
58 #else
59   enable_mt_mode ();
60
61   res = gst_element_register (plugin, "qtkitvideosrc", GST_RANK_PRIMARY,
62       GST_TYPE_QTKIT_VIDEO_SRC);
63   res &= gst_element_register (plugin, "miovideosrc", GST_RANK_NONE,
64       GST_TYPE_MIO_VIDEO_SRC);
65 #endif
66
67   res &= gst_element_register (plugin, "vth264decbin", GST_RANK_NONE,
68       GST_TYPE_VT_H264_DEC_BIN);
69   res &= gst_element_register (plugin, "vth264encbin", GST_RANK_NONE,
70       GST_TYPE_VT_H264_ENC_BIN);
71
72   gst_vtenc_register_elements (plugin);
73   gst_vtdec_register_elements (plugin);
74
75   return res;
76 }
77
78 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
79     GST_VERSION_MINOR,
80     "applemedia",
81     "Elements for capture and codec access on Apple OS X and iOS",
82     plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")