diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llmedia/llmediaimplgstreamervidplug.cpp | 83 |
1 files changed, 37 insertions, 46 deletions
diff --git a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp b/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp index c95ef36..eaf2c84 100644 --- a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp | |||
@@ -37,8 +37,6 @@ | |||
37 | #include <gst/video/video.h> | 37 | #include <gst/video/video.h> |
38 | #include <gst/video/gstvideosink.h> | 38 | #include <gst/video/gstvideosink.h> |
39 | 39 | ||
40 | #include "llmediaimplgstreamer_syms.h" | ||
41 | |||
42 | #include "llthread.h" | 40 | #include "llthread.h" |
43 | 41 | ||
44 | #include "llmediaimplgstreamervidplug.h" | 42 | #include "llmediaimplgstreamervidplug.h" |
@@ -88,9 +86,9 @@ gst_slvideo_base_init (gpointer gclass) | |||
88 | }; | 86 | }; |
89 | GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); | 87 | GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); |
90 | 88 | ||
91 | llgst_element_class_add_pad_template (element_class, | 89 | gst_element_class_add_pad_template (element_class, |
92 | llgst_static_pad_template_get (&sink_factory)); | 90 | gst_static_pad_template_get (&sink_factory)); |
93 | llgst_element_class_set_details (element_class, &element_details); | 91 | gst_element_class_set_details (element_class, &element_details); |
94 | } | 92 | } |
95 | 93 | ||
96 | 94 | ||
@@ -101,7 +99,7 @@ gst_slvideo_finalize (GObject * object) | |||
101 | slvideo = GST_SLVIDEO (object); | 99 | slvideo = GST_SLVIDEO (object); |
102 | if (slvideo->caps) | 100 | if (slvideo->caps) |
103 | { | 101 | { |
104 | llgst_caps_unref(slvideo->caps); | 102 | gst_caps_unref(slvideo->caps); |
105 | } | 103 | } |
106 | 104 | ||
107 | G_OBJECT_CLASS(parent_class)->finalize (object); | 105 | G_OBJECT_CLASS(parent_class)->finalize (object); |
@@ -112,7 +110,7 @@ static GstFlowReturn | |||
112 | gst_slvideo_show_frame (GstBaseSink * bsink, GstBuffer * buf) | 110 | gst_slvideo_show_frame (GstBaseSink * bsink, GstBuffer * buf) |
113 | { | 111 | { |
114 | GstSLVideo *slvideo; | 112 | GstSLVideo *slvideo; |
115 | llg_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); | 113 | g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); |
116 | 114 | ||
117 | slvideo = GST_SLVIDEO(bsink); | 115 | slvideo = GST_SLVIDEO(bsink); |
118 | 116 | ||
@@ -205,7 +203,7 @@ gst_slvideo_get_caps (GstBaseSink * bsink) | |||
205 | GstSLVideo *slvideo; | 203 | GstSLVideo *slvideo; |
206 | slvideo = GST_SLVIDEO(bsink); | 204 | slvideo = GST_SLVIDEO(bsink); |
207 | 205 | ||
208 | return llgst_caps_ref (slvideo->caps); | 206 | return gst_caps_ref (slvideo->caps); |
209 | } | 207 | } |
210 | 208 | ||
211 | 209 | ||
@@ -221,36 +219,36 @@ gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps) | |||
221 | 219 | ||
222 | filter = GST_SLVIDEO(bsink); | 220 | filter = GST_SLVIDEO(bsink); |
223 | 221 | ||
224 | intersection = llgst_caps_intersect (filter->caps, caps); | 222 | intersection = gst_caps_intersect (filter->caps, caps); |
225 | if (llgst_caps_is_empty (intersection)) | 223 | if (gst_caps_is_empty (intersection)) |
226 | { | 224 | { |
227 | // no overlap between our caps and requested caps | 225 | // no overlap between our caps and requested caps |
228 | return FALSE; | 226 | return FALSE; |
229 | } | 227 | } |
230 | llgst_caps_unref(intersection); | 228 | gst_caps_unref(intersection); |
231 | 229 | ||
232 | int width = 0; | 230 | int width = 0; |
233 | int height = 0; | 231 | int height = 0; |
234 | gboolean ret; | 232 | gboolean ret; |
235 | const GValue *fps; | 233 | const GValue *fps; |
236 | const GValue *par; | 234 | const GValue *par; |
237 | structure = llgst_caps_get_structure (caps, 0); | 235 | structure = gst_caps_get_structure (caps, 0); |
238 | ret = llgst_structure_get_int (structure, "width", &width); | 236 | ret = gst_structure_get_int (structure, "width", &width); |
239 | ret = ret && llgst_structure_get_int (structure, "height", &height); | 237 | ret = ret && gst_structure_get_int (structure, "height", &height); |
240 | fps = llgst_structure_get_value (structure, "framerate"); | 238 | fps = gst_structure_get_value (structure, "framerate"); |
241 | ret = ret && (fps != NULL); | 239 | ret = ret && (fps != NULL); |
242 | par = llgst_structure_get_value (structure, "pixel-aspect-ratio"); | 240 | par = gst_structure_get_value (structure, "pixel-aspect-ratio"); |
243 | if (!ret) | 241 | if (!ret) |
244 | return FALSE; | 242 | return FALSE; |
245 | 243 | ||
246 | filter->width = width; | 244 | filter->width = width; |
247 | filter->height = height; | 245 | filter->height = height; |
248 | filter->fps_n = llgst_value_get_fraction_numerator(fps); | 246 | filter->fps_n = gst_value_get_fraction_numerator(fps); |
249 | filter->fps_d = llgst_value_get_fraction_denominator(fps); | 247 | filter->fps_d = gst_value_get_fraction_denominator(fps); |
250 | if (par) | 248 | if (par) |
251 | { | 249 | { |
252 | filter->par_n = llgst_value_get_fraction_numerator(par); | 250 | filter->par_n = gst_value_get_fraction_numerator(par); |
253 | filter->par_d = llgst_value_get_fraction_denominator(par); | 251 | filter->par_d = gst_value_get_fraction_denominator(par); |
254 | } | 252 | } |
255 | else | 253 | else |
256 | { | 254 | { |
@@ -261,15 +259,15 @@ gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps) | |||
261 | GST_VIDEO_SINK_HEIGHT(filter) = height; | 259 | GST_VIDEO_SINK_HEIGHT(filter) = height; |
262 | 260 | ||
263 | filter->format = SLV_PF_UNKNOWN; | 261 | filter->format = SLV_PF_UNKNOWN; |
264 | if (0 == strcmp(llgst_structure_get_name(structure), | 262 | if (0 == strcmp(gst_structure_get_name(structure), |
265 | "video/x-raw-rgb")) | 263 | "video/x-raw-rgb")) |
266 | { | 264 | { |
267 | int red_mask; | 265 | int red_mask; |
268 | int green_mask; | 266 | int green_mask; |
269 | int blue_mask; | 267 | int blue_mask; |
270 | llgst_structure_get_int(structure, "red_mask", &red_mask); | 268 | gst_structure_get_int(structure, "red_mask", &red_mask); |
271 | llgst_structure_get_int(structure, "green_mask", &green_mask); | 269 | gst_structure_get_int(structure, "green_mask", &green_mask); |
272 | llgst_structure_get_int(structure, "blue_mask", &blue_mask); | 270 | gst_structure_get_int(structure, "blue_mask", &blue_mask); |
273 | if ((unsigned int)red_mask == 0xFF000000 && | 271 | if ((unsigned int)red_mask == 0xFF000000 && |
274 | (unsigned int)green_mask == 0x00FF0000 && | 272 | (unsigned int)green_mask == 0x00FF0000 && |
275 | (unsigned int)blue_mask == 0x0000FF00) | 273 | (unsigned int)blue_mask == 0x0000FF00) |
@@ -366,9 +364,9 @@ gst_slvideo_update_caps (GstSLVideo * slvideo) | |||
366 | // GStreamer will automatically convert colourspace if necessary. | 364 | // GStreamer will automatically convert colourspace if necessary. |
367 | // GStreamer will automatically resize media to one of these enumerated | 365 | // GStreamer will automatically resize media to one of these enumerated |
368 | // powers-of-two that we ask for (yay GStreamer!) | 366 | // powers-of-two that we ask for (yay GStreamer!) |
369 | caps = llgst_caps_from_string (SLV_ALLCAPS); | 367 | caps = gst_caps_from_string (SLV_ALLCAPS); |
370 | 368 | ||
371 | llgst_caps_replace (&slvideo->caps, caps); | 369 | gst_caps_replace (&slvideo->caps, caps); |
372 | } | 370 | } |
373 | 371 | ||
374 | 372 | ||
@@ -401,7 +399,7 @@ static void | |||
401 | gst_slvideo_set_property (GObject * object, guint prop_id, | 399 | gst_slvideo_set_property (GObject * object, guint prop_id, |
402 | const GValue * value, GParamSpec * pspec) | 400 | const GValue * value, GParamSpec * pspec) |
403 | { | 401 | { |
404 | llg_return_if_fail (GST_IS_SLVIDEO (object)); | 402 | g_return_if_fail (GST_IS_SLVIDEO (object)); |
405 | 403 | ||
406 | if (prop_id) { | 404 | if (prop_id) { |
407 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 405 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
@@ -412,7 +410,7 @@ static void | |||
412 | gst_slvideo_get_property (GObject * object, guint prop_id, | 410 | gst_slvideo_get_property (GObject * object, guint prop_id, |
413 | GValue * value, GParamSpec * pspec) | 411 | GValue * value, GParamSpec * pspec) |
414 | { | 412 | { |
415 | llg_return_if_fail (GST_IS_SLVIDEO (object)); | 413 | g_return_if_fail (GST_IS_SLVIDEO (object)); |
416 | 414 | ||
417 | if (prop_id) { | 415 | if (prop_id) { |
418 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 416 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
@@ -433,30 +431,23 @@ plugin_init (GstPlugin * plugin) | |||
433 | GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, "private-slvideo-plugin", | 431 | GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, "private-slvideo-plugin", |
434 | 0, "Second Life Video Sink"); | 432 | 0, "Second Life Video Sink"); |
435 | 433 | ||
436 | return llgst_element_register (plugin, "private-slvideo", | 434 | return gst_element_register (plugin, "private-slvideo", |
437 | GST_RANK_NONE, GST_TYPE_SLVIDEO); | 435 | GST_RANK_NONE, GST_TYPE_SLVIDEO); |
438 | } | 436 | } |
439 | 437 | ||
440 | /* this is the structure that gstreamer looks for to register plugins | ||
441 | */ | ||
442 | /* NOTE: Can't rely upon GST_PLUGIN_DEFINE_STATIC to self-register, since | ||
443 | some g++ versions buggily avoid __attribute__((constructor)) functions - | ||
444 | so we provide an explicit plugin init function. | ||
445 | */ | ||
446 | #define PACKAGE "packagehack" | ||
447 | GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, | ||
448 | GST_VERSION_MINOR, | ||
449 | "private-slvideoplugin", | ||
450 | "SL Video sink plugin", | ||
451 | plugin_init, "0.1", GST_LICENSE_UNKNOWN, | ||
452 | "Second Life", | ||
453 | "http://www.secondlife.com/"); | ||
454 | #undef PACKAGE | ||
455 | 438 | ||
456 | void gst_slvideo_init_class (void) | 439 | void gst_slvideo_init_class (void) |
457 | { | 440 | { |
458 | ll_gst_plugin_register_static (&gst_plugin_desc); | 441 | gst_plugin_register_static( GST_VERSION_MAJOR, |
459 | //fprintf(stderr, "\n\n\nCLASS INIT\n\n\n"); | 442 | GST_VERSION_MINOR, |
443 | "private-slvideoplugin", | ||
444 | "SL Video sink plugin", | ||
445 | plugin_init, | ||
446 | "0.1", | ||
447 | GST_LICENSE_UNKNOWN, | ||
448 | "Second Life", | ||
449 | "Second Life", | ||
450 | "http://www.secondlife.com/" ); | ||
460 | } | 451 | } |
461 | 452 | ||
462 | ///#endif // LL_GSTREAMER_ENABLED | 453 | ///#endif // LL_GSTREAMER_ENABLED |