Bug 22803 - Make header conform to implementation
[swfdec.git] / swfdec / swfdec_init.c
blob91e14e8791945b9fed171d4a3bd0ae5777aebb3b
1 /* Swfdec
2 * Copyright (C) 2006-2008 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
24 #include <errno.h>
25 #include <stdlib.h>
26 #ifdef HAVE_GST
27 #include <gst/gst.h>
28 #include <gst/pbutils/pbutils.h>
29 #include "swfdec_audio_decoder_gst.h"
30 #include "swfdec_video_decoder_gst.h"
31 #endif
32 #include <liboil/liboil.h>
34 #include "swfdec_audio_decoder_adpcm.h"
35 #include "swfdec_audio_decoder_uncompressed.h"
36 #include "swfdec_debug.h"
37 #include "swfdec_video_decoder_screen.h"
38 #include "swfdec_video_decoder_vp6_alpha.h"
40 /**
41 * swfdec_init:
43 * Initializes the Swfdec library.
44 **/
45 void
46 swfdec_init (void)
48 static gboolean _inited = FALSE;
49 const char *s;
51 if (_inited)
52 return;
54 _inited = TRUE;
56 /* initialize all types */
57 if (!g_thread_supported ())
58 g_thread_init (NULL);
59 g_type_init ();
60 oil_init ();
61 #ifdef HAVE_GST
62 gst_init (NULL, NULL);
63 gst_pb_utils_init ();
64 #endif
66 /* setup debugging */
67 s = g_getenv ("SWFDEC_DEBUG");
68 if (s && s[0]) {
69 char *end;
70 int level;
72 level = strtoul (s, &end, 0);
73 if (end[0] == 0) {
74 swfdec_debug_set_level (level);
78 /* Setup audio and video decoders.
79 * NB: The order is important! */
80 swfdec_audio_decoder_register (SWFDEC_TYPE_AUDIO_DECODER_UNCOMPRESSED);
81 swfdec_audio_decoder_register (SWFDEC_TYPE_AUDIO_DECODER_ADPCM);
82 swfdec_video_decoder_register (SWFDEC_TYPE_VIDEO_DECODER_SCREEN);
83 swfdec_video_decoder_register (SWFDEC_TYPE_VIDEO_DECODER_VP6_ALPHA);
84 #ifdef HAVE_GST
85 swfdec_audio_decoder_register (SWFDEC_TYPE_AUDIO_DECODER_GST);
86 swfdec_video_decoder_register (SWFDEC_TYPE_VIDEO_DECODER_GST);
87 #endif