Skip to content

Retrieve a obs_source_info from a obs_source_t? #30

@ggregoire

Description

@ggregoire

Hi!

I was wondering if you could maybe help me with this.

I'm trying to retrieve a obs_source_info from a obs_source_t but can't figure how to. Both types are documented on the same page so I guess they are related. I can't access the obs_source_info's attributes directly on obs_source_t (i.e. AttributeError: 'SwigPyObject' object has no attribute '…') but I can't find any method like get_source_info either.

I am especially interested in the media_get_time attribute from obs_source_info.

Here is the code I have so far.

I retrieve the source of a scene item (i.e. obs_source_t) and I'd would like to get its obs_source_info:

import obspython as obs

current_scene = obs.obs_frontend_get_current_scene() 

print("current_scene", current_scene) # <Swig Object of type 'obs_source_t *' at 0x12...>

if current_scene:
    scene = obs.obs_scene_from_source(current_scene)
    scene_item = obs.obs_scene_find_source(scene, "stream_source")

    print("scene_item", scene_item) # <Swig Object of type 'obs_sceneitem_t *' at 0x12...>

    if scene_item:
        source = obs.obs_sceneitem_get_source(scene_item)

        print("source", source) # <Swig Object of type 'obs_source_t *' at 0x12...>
        print("source media_get_time", source.media_get_time)  # AttributeError: 'SwigPyObject' object has no attribute 'media_get_time'

		# How to get a obs_source_info then?

		# …

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions