Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
pygobject
pygobject
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 242
    • Issues 242
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 12
    • Merge Requests 12
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GNOME
  • pygobjectpygobject
  • Issues
  • #360

Closed
Open
Opened Sep 05, 2019 by Tyler Compton@velovix

Unable to create working instance of subclassed GStreamer objects

When I try to subclass the Gst.Bin class to, for example, add custom signal handling code, I can no longer create new instances of it with new.

With the code:

import gi

gi.require_version("Gst", "1.0")

from gi.repository import Gst, GLib

Gst.init()

class SubclassBin(Gst.Bin):
    pass

subclass_bin = SubclassBin.new("mybin")

main_loop = GLib.MainLoop.new(context=None, is_running=False)
main_loop.run()

I get the following exception:

TypeError: Bin constructor cannot be used to create instances of a subclass SubclassBin

The message leads me to believe that this is expected behavior, but then it isn't clear to me how to create a new instance of my SubclassBin type. I assume that just using SubclassBin() isn't sufficient, and in my testing it doesn't appear to be.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/pygobject#360