aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer_syms.cpp188
1 files changed, 0 insertions, 188 deletions
diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp b/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp
deleted file mode 100644
index fb1949a..0000000
--- a/linden/indra/llmedia/llmediaimplgstreamer_syms.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
1/**
2 * @file llmediaimplgstreamer_syms.cpp
3 * @brief dynamic GStreamer symbol-grabbing code
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32///#if LL_GSTREAMER_ENABLED
33
34extern "C" {
35#include <gst/gst.h>
36
37#include "apr_pools.h"
38#include "apr_dso.h"
39}
40
41#include "llmediaimplgstreamer.h"
42
43#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) RTN (*ll##GSTSYM)(__VA_ARGS__) = NULL
44#include "llmediaimplgstreamer_syms_raw.inc"
45#include "llmediaimplgstreamer_syms_rawa.inc"
46#include "llmediaimplgstreamer_syms_rawv.inc"
47#undef LL_GST_SYM
48
49
50static bool sSymsGrabbed = false;
51static apr_pool_t *sSymGSTDSOMemoryPool = NULL;
52static apr_dso_handle_t *sSymGSTDSOHandleG = NULL;
53static apr_dso_handle_t *sSymGSTDSOHandleV = NULL;
54static apr_dso_handle_t *sSymGSTDSOHandleA = NULL;
55
56
57bool grab_gst_syms(std::string gst_dso_name,
58 std::string gst_dso_name_vid,
59 std::string gst_dso_name_aud)
60{
61 if (sSymsGrabbed)
62 {
63 // already have grabbed good syms
64 return TRUE;
65 }
66
67 bool sym_error = false;
68 bool rtn = false;
69 apr_status_t rv;
70 apr_dso_handle_t *sSymGSTDSOHandle = NULL;
71
72#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##GSTSYM, sSymGSTDSOHandle, #GSTSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #GSTSYM); if (REQ) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #GSTSYM, (void*)ll##GSTSYM);}while(0)
73
74 //attempt to load the shared libraries
75 apr_pool_create(&sSymGSTDSOMemoryPool, NULL);
76
77 if ( APR_SUCCESS == (rv = apr_dso_load(&sSymGSTDSOHandle,
78 gst_dso_name.c_str(),
79 sSymGSTDSOMemoryPool) ))
80 {
81 INFOMSG("Found DSO: %s", gst_dso_name.c_str());
82#include "llmediaimplgstreamer_syms_raw.inc"
83
84 if ( sSymGSTDSOHandle )
85 {
86 sSymGSTDSOHandleG = sSymGSTDSOHandle;
87 sSymGSTDSOHandle = NULL;
88 }
89
90 if ( APR_SUCCESS == (rv = apr_dso_load(&sSymGSTDSOHandle,
91 gst_dso_name_aud.c_str(),
92 sSymGSTDSOMemoryPool) ))
93 {
94 INFOMSG("Found DSO: %s", gst_dso_name_aud.c_str());
95#include "llmediaimplgstreamer_syms_rawa.inc"
96
97 if ( sSymGSTDSOHandle )
98 {
99 sSymGSTDSOHandleA = sSymGSTDSOHandle;
100 sSymGSTDSOHandle = NULL;
101 }
102
103 if ( APR_SUCCESS ==
104 (rv = apr_dso_load(&sSymGSTDSOHandle,
105 gst_dso_name_vid.c_str(),
106 sSymGSTDSOMemoryPool) ))
107 {
108 INFOMSG("Found DSO: %s", gst_dso_name_vid.c_str());
109#include "llmediaimplgstreamer_syms_rawv.inc"
110 }
111 else
112 {
113 INFOMSG("Couldn't load DSO: %s", gst_dso_name_vid.c_str());
114 rtn = false; // failure
115 }
116 }
117 else
118 {
119 INFOMSG("Couldn't load DSO: %s", gst_dso_name_aud.c_str());
120 rtn = false; // failure
121 }
122
123 rtn = !sym_error;
124 }
125 else
126 {
127 INFOMSG("Couldn't load DSO: %s", gst_dso_name.c_str());
128 rtn = false; // failure
129 }
130
131 if (sym_error)
132 {
133 WARNMSG("Failed to find necessary symbols in GStreamer libraries.");
134 }
135
136 if ( sSymGSTDSOHandle )
137 {
138 sSymGSTDSOHandleV = sSymGSTDSOHandle;
139 sSymGSTDSOHandle = NULL;
140 }
141#undef LL_GST_SYM
142
143 sSymsGrabbed = !!rtn;
144 return rtn;
145}
146
147
148void ungrab_gst_syms()
149{
150 // should be safe to call regardless of whether we've
151 // actually grabbed syms.
152
153 if ( sSymGSTDSOHandleG )
154 {
155 apr_dso_unload(sSymGSTDSOHandleG);
156 sSymGSTDSOHandleG = NULL;
157 }
158
159 if ( sSymGSTDSOHandleA )
160 {
161 apr_dso_unload(sSymGSTDSOHandleA);
162 sSymGSTDSOHandleA = NULL;
163 }
164
165 if ( sSymGSTDSOHandleV )
166 {
167 apr_dso_unload(sSymGSTDSOHandleV);
168 sSymGSTDSOHandleV = NULL;
169 }
170
171 if ( sSymGSTDSOMemoryPool )
172 {
173 apr_pool_destroy(sSymGSTDSOMemoryPool);
174 sSymGSTDSOMemoryPool = NULL;
175 }
176
177 // NULL-out all of the symbols we'd grabbed
178#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) do{ll##GSTSYM = NULL;}while(0)
179#include "llmediaimplgstreamer_syms_raw.inc"
180#include "llmediaimplgstreamer_syms_rawa.inc"
181#include "llmediaimplgstreamer_syms_rawv.inc"
182#undef LL_GST_SYM
183
184 sSymsGrabbed = false;
185}
186
187
188///#endif // LL_GSTREAMER_ENABLED