// Set screenresolution static PyObject* pympav_set_resolution(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "iii", &width, &height, &cinema)) return (PyObject*)NULL; if(init == 1) { goom_set_resolution(width, height, cinema); } // See http://sdldoc.csn.ul.ie/sdlcreatergbsurface.php SDL_Surface* s = SDL_CreateRGBSurface(0, width, height, 32, 0, 0, 0, 0); if (s) { // deallocate if there is one already if (pysurf) { Py_XDECREF(pysurf); } pysurf = (PySurfaceObject*) PySurface_New(s); Py_XINCREF(pysurf); if (pysurf) { RETURN_NONE; } else { RAISE(PyExc_ValueError, "Error creating pygame surface"); } } RAISE(PyExc_ValueError, "Error creating sdl surface"); }
static gboolean gst_goom_src_setcaps (GstPad * pad, GstCaps * caps) { GstGoom *goom; GstStructure *structure; goom = GST_GOOM (GST_PAD_PARENT (pad)); structure = gst_caps_get_structure (caps, 0); if (!gst_structure_get_int (structure, "width", &goom->width) || !gst_structure_get_int (structure, "height", &goom->height) || !gst_structure_get_fraction (structure, "framerate", &goom->fps_n, &goom->fps_d)) return FALSE; goom_set_resolution (goom->plugin, goom->width, goom->height); /* size of the output buffer in bytes, depth is always 4 bytes */ goom->outsize = goom->width * goom->height * 4; goom->duration = gst_util_uint64_scale_int (GST_SECOND, goom->fps_d, goom->fps_n); goom->spf = gst_util_uint64_scale_int (goom->rate, goom->fps_d, goom->fps_n); goom->bpf = goom->spf * goom->bps; GST_DEBUG_OBJECT (goom, "dimension %dx%d, framerate %d/%d, spf %d", goom->width, goom->height, goom->fps_n, goom->fps_d, goom->spf); return TRUE; }
static int lv_goom_resize (VisPluginData *plugin, int width, int height) { GoomPrivate *priv = visual_object_get_private (VISUAL_OBJECT (plugin)); goom_set_resolution (priv->goominfo, width, height); return 0; }
static gboolean gst_goom2k1_setup (GstAudioVisualizer * base) { GstGoom2k1 *goom = GST_GOOM2K1 (base); goom->width = GST_VIDEO_INFO_WIDTH (&base->vinfo); goom->height = GST_VIDEO_INFO_HEIGHT (&base->vinfo); goom_set_resolution (&(goom->goomdata), goom->width, goom->height); return TRUE; }
// Set screenresolution static PyObject* pygoom_set_resolution(PyObject *self, PyObject *args) { int cinema = 0; if (!PyArg_ParseTuple(args, "iii", &width, &height, &cinema)) { return NULL; } if (init == 1) { goom_set_resolution(goomInfo, width, height); surf = SDL_CreateRGBSurface(0, width, height, 32, 0, 0, 0, 0); if (!surf) { return RAISE(PyExc_ValueError, "Surface error"); } } RETURN_NONE; }
static PyObject * PyGoom_resolution(PyGoomObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "ii:resolution", &self->width, &self->height)) { return NULL; } if (self->surface) { SDL_FreeSurface(self->surface); } goom_set_resolution(self->goominfo, self->width, self->height); self->surface = SDL_CreateRGBSurface(0, self->width, self->height, 32, 0, 0, 0, 0); if (! self->surface) { return RAISE(PyExc_ValueError, "Cannot create surface"); } Py_INCREF(Py_None); return Py_None; }
static gboolean gst_goom_src_setcaps (GstGoom * goom, GstCaps * caps) { GstStructure *structure; gboolean res; structure = gst_caps_get_structure (caps, 0); if (!gst_structure_get_int (structure, "width", &goom->width) || !gst_structure_get_int (structure, "height", &goom->height) || !gst_structure_get_fraction (structure, "framerate", &goom->fps_n, &goom->fps_d)) goto error; goom_set_resolution (goom->plugin, goom->width, goom->height); /* size of the output buffer in bytes, depth is always 4 bytes */ goom->outsize = goom->width * goom->height * 4; goom->duration = gst_util_uint64_scale_int (GST_SECOND, goom->fps_d, goom->fps_n); goom->spf = gst_util_uint64_scale_int (goom->rate, goom->fps_d, goom->fps_n); goom->bpf = goom->spf * goom->bps; GST_DEBUG_OBJECT (goom, "dimension %dx%d, framerate %d/%d, spf %d", goom->width, goom->height, goom->fps_n, goom->fps_d, goom->spf); res = gst_pad_set_caps (goom->srcpad, caps); return res; /* ERRORS */ error: { GST_DEBUG_OBJECT (goom, "error parsing caps"); return FALSE; } }