lgi-devs / lgi-devs/lgi

Cannot override GES.SourceClip virtual method

Open
#268 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
491
Forks
81
PR merge metrics
No merged PRs in 30d

Description

I am attempting to make a simple video editor, using GES (GStreamer Editing Services) and Löve. One of my goals is to be able to run Lua code, which draws using Löve, and pushes buffers into a GES Pipeline.

Looking at the GES source code (and this very similar attempt in Python (code, discussion), but which seems to fail for different reasons), it seems the way to do that would be to draw into an Gst.AppSrc, wrap that into a subclass of GES.VideoSource, then wrap that into a subclass of GES.SourceClip.

GES.SourceClip has a create_track_element virtual method inherited from GES.Clip, which is where the custom VideoSource would be created.

The problem is that, when I override the virtual method as described in the guide, and make GES call it (via an add_clip call, see below), the resulting Clip does not work at all, and setting GST_DEBUG=1 reveals an error like the following:

0:00:00.040232023 441673 0x55a2eb5a7ef0 ERROR
ges ges-clip.c:898:ges_clip_create_track_element: No 'create_track_element' implementation available fo [sic] type MyTestMySourceClip

And of course, the method I defined is never called. Snooping inside the lgi code, it looks like the virtual method is simply not known to it. Any ideas why that might be, or how I might investigate this?

Feel free to close this issue if you think there are better places to ask about this problem.

Here is a minimal program reproducing the problem:

local lgi = require('lgi.init')
local GES = lgi.GES
GES.init()

local MyTest = lgi.package('MyTest')
MyTest:class('MySourceClip', GES.SourceClip)
function MyTest.MySourceClip.do_create_track_element(type)
	print('do_create_track_element was called!')
end

local timeline = GES.Timeline.new_audio_video()
local layer = timeline:append_layer()
local clip = MyTest.MySourceClip()
local res = layer:add_clip(clip)
assert(res)

I have tried this using Löve's LuaJIT 5.1 interpreter and a standard CLua 5.3 interpreter. I am running GStreamer v1.16.2 on Ubuntu 20.04.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal Lua reproducer and the GES.Clip create_track_element virtual method described in the issue, then inspect the lgi binding behavior for GES.SourceClip. Done means the override is recognized, the method is called during layer:add_clip, and the resulting clip works without the reported GST_DEBUG error.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.