bool EGLDevice::attachWindow(GnashDevice::native_window_t window) { GNASH_REPORT_FUNCTION; if (!window) { throw GnashException("bogus window handle!"); } else { _nativeWindow = static_cast<EGLNativeWindowType>(window); } if (_eglSurface != EGL_NO_SURFACE) { eglDestroySurface(_eglDisplay, _eglSurface); } log_debug("Initializing EGL Surface"); if (_eglDisplay && _eglConfig) { _eglSurface = eglCreateWindowSurface(_eglDisplay, _eglConfig, _nativeWindow, surface_attributes); } if (EGL_NO_SURFACE == _eglSurface) { log_error("eglCreateWindowSurface failed (error %s)", getErrorString(eglGetError())); } else { printEGLSurface(_eglSurface); } // step5 - create a context _eglContext = eglCreateContext(_eglDisplay, _eglConfig, EGL_NO_CONTEXT, NULL); if (EGL_NO_CONTEXT == _eglContext) { // At least on Ubuntu 10.10, this returns a successful error string // with LibeMesa's OpenVG 1.0 implementation. With OpenVG 1.1 on // an ARM board, this works fine. Even the libMesa examples fail // the same way. boost::format fmt = boost::format( _("eglCreateContext failed (error %s)") ) % getErrorString(eglGetError()); throw GnashException(fmt.str()); } else { printEGLContext(_eglContext); } // step6 - make the context and surface current if (EGL_FALSE == eglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _eglContext)) { // If for some reason we get a context, but can't make it current, // nothing else will work anyway, so don't continue. boost::format fmt = boost::format( _("eglMakeCurrent failed (error %s)") ) % getErrorString(eglGetError()); throw GnashException(fmt.str()); } // begin user code return true; }
void MediaParserGst::link_to_fakesink(GstPad* pad) { GstElement* fakesink = gst_element_factory_make("fakesink", NULL); if (!fakesink) { throw MediaException(_("MediaParserGst Failed to create fakesink.")); } gboolean success = gst_bin_add(GST_BIN(_bin), fakesink); if (!success) { gst_object_unref(fakesink); throw MediaException(_("MediaParserGst Failed to create fakesink.")); } GstPad* sinkpad = gst_element_get_static_pad (fakesink, "sink"); if (!sinkpad) { gst_object_unref(fakesink); throw MediaException(_("MediaParserGst: couldn't get the fakesink " "src element.")); } GstPadLinkReturn ret = gst_pad_link(pad, sinkpad); if (!GST_PAD_LINK_SUCCESSFUL(ret)) { gst_object_unref(fakesink); gst_object_unref(sinkpad); throw MediaException(_("MediaParserGst: couln't link fakesink")); } if (!gst_element_set_state (_bin, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS) { throw GnashException(_("MediaParserGst could not change element state")); } }
Renderer* GtkAggGlue::createRenderHandler() { GdkVisual* wvisual = gdk_drawable_get_visual(_drawing_area->window); GdkImage* tmpimage = gdk_image_new (GDK_IMAGE_FASTEST, wvisual, 1, 1); const GdkVisual* visual = tmpimage->visual; // FIXME: we use bpp instead of depth, because depth doesn't appear to // include the padding byte(s) the GdkImage actually has. const char *pixelformat = agg_detect_pixel_format( visual->red_shift, visual->red_prec, visual->green_shift, visual->green_prec, visual->blue_shift, visual->blue_prec, tmpimage->bpp * 8); gdk_image_destroy(tmpimage); _agg_renderer = create_Renderer_agg(pixelformat); if (! _agg_renderer) { boost::format fmt = boost::format( _("Could not create AGG renderer with pixelformat %s") ) % pixelformat; throw GnashException(fmt.str()); } return _agg_renderer; }
Renderer* HaikuAggGlue::createRenderHandler(int bpp) { _bpp = bpp; assert(_bpp == 32); // XXX const char *pixelformat = ""; switch (_bpp) { case 32: pixelformat = "BGRA32"; // other choices include RGBA32 break; case 24: pixelformat = "RGB24"; break; case 16: pixelformat = "RGBA16"; break; default: log_error (_("AGG's bit depth must be 16, 24 or 32 bits, not %d."), _bpp); abort(); } _agg_renderer = create_Renderer_agg(pixelformat); if ( ! _agg_renderer ) { boost::format fmt = boost::format( _("Could not create AGG renderer with pixelformat %s") ) % pixelformat; throw GnashException(fmt.str()); } return _agg_renderer; }
Renderer* GtkOvgGlue::createRenderHandler() { GNASH_REPORT_FUNCTION; if (!_drawing_area) { log_error("No area to draw in!"); return 0; } GdkVisual* wvisual = gdk_drawable_get_visual(_drawing_area->window); GdkImage* tmpimage = gdk_image_new (GDK_IMAGE_FASTEST, wvisual, 1, 1); // const GdkVisual* visual = tmpimage->visual; gdk_image_destroy(tmpimage); _renderer.reset(reinterpret_cast<renderer::openvg::Renderer_ovg *> (renderer::openvg::create_handler(0))); if (!_renderer) { boost::format fmt = boost::format( _("Could not create OPENVG renderer")); throw GnashException(fmt.str()); } return reinterpret_cast<Renderer *>(_renderer.get()); }
Renderer* FltkAggGlue::createRenderHandler() { _renderer = create_Renderer_agg("RGB24"); if (_renderer == NULL) throw GnashException(_("Could not create AGG renderer with pixelformat RGB24")); return _renderer; }
Renderer* Qt4OglGlue::createRenderHandler() { _renderer = renderer::opengl::create_handler(); if ( ! _renderer ) { throw GnashException("Could not create OpenGL renderer"); } return _renderer; }
// static void MediaParserGst::cb_typefound(GstElement* typefind, guint /*probability*/, GstCaps* caps, gpointer data) { print_caps(caps); MediaParserGst* parser = static_cast<MediaParserGst*>(data); GstElementFactory* demuxfactory = swfdec_gst_get_demuxer_factory(caps); if (!demuxfactory) { GstPad* srcpad = gst_element_get_static_pad(typefind, "src"); if (!srcpad) { throw MediaException(_("MediaParserGst: couldn't get the typefind " "src element.")); } cb_pad_added(typefind, srcpad, parser); gst_object_unref(GST_OBJECT(srcpad)); parser->_demux_probe_ended = true; return; } // We have a factory, so create the demuxer. GstElement* demuxer = gst_element_factory_create(demuxfactory, "demuxer"); gst_object_unref(GST_OBJECT(demuxfactory)); if (!demuxer) { throw MediaException(_("MediaParserGst: couldn't create the " "demuxer")); } gboolean success = gst_bin_add(GST_BIN(parser->_bin), demuxer); if (!success) { log_error(_("MediaParserGst: failed adding demuxer to bin.")); } success = gst_element_link(typefind, demuxer); if (!success) { throw MediaException(_("MediaParserGst: failed adding demuxer " "to bin.")); } g_signal_connect(demuxer, "pad-added", G_CALLBACK(MediaParserGst::cb_pad_added), parser); g_signal_connect(demuxer, "no-more-pads", G_CALLBACK(MediaParserGst::cb_no_more_pads), parser); if (!gst_element_set_state(parser->_bin, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS) { throw GnashException(_("MediaParserGst could not change " "element state")); } }
Renderer* Qt4AggGlue::createRenderHandler() { _renderer = create_Renderer_agg("BGRA32"); if ( ! _renderer ) { throw GnashException(_("Could not create AGG renderer with pixelformat ABGR32")); } return _renderer; }
Renderer* FBOvgGlue::createRenderHandler() { // GNASH_REPORT_FUNCTION; // Create the renderer _renderer.reset(renderer::openvg::create_handler(0)); // Print the description if (!_renderer->description().empty()) { log_debug("Renderer is: %s", _renderer->description()); } if (!_renderer) { boost::format fmt = boost::format( _("Could not create OpenVG renderer")); throw GnashException(fmt.str()); } return _renderer.get(); }
std::auto_ptr<Gui> createAOS4Gui(unsigned long , float, bool, RunResourcesfloat , bool , unsigned int ) { throw GnashException("Support for AOS4 gui was not compiled in"); }
std::unique_ptr<Gui> createHaikuGui(unsigned long , float, bool, RunResourcesfloat , bool , unsigned int ) { throw GnashException("Support for Haiku gui was not compiled in"); }
std::auto_ptr<Gui> createSDLGui(unsigned long , float , bool , unsigned int ) { throw GnashException("Support for SDL gui was not compiled in"); }