I am compiling a default example of mlt++ using C++20, specifically the Playlist example (scroll down), but also tried the default Consumer + Producer example.
I compiled the example fine. Running with ./program file1 file2 ...
outputs Segmentation fault (core dumped)
.
Running with debugger lldb
outputs some more details: issue appears to be in c.connect(p);
, but I don't know what to do next.
Basic repro and debugging details:
* thread #1, name = 'SimplePodcastMa', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x38)
frame #0: 0x00007ffff7bc0ec0 libmlt-7.so.7`mlt_service_connect_producer + 34
libmlt-7.so.7`mlt_service_connect_producer:
-> 0x7ffff7bc0ec0 <+34>: movq 0x38(%rax), %rax
0x7ffff7bc0ec4 <+38>: movq %rax, -0x10(%rbp)
0x7ffff7bc0ec8 <+42>: cmpl $-0x1, -0x34(%rbp)
0x7ffff7bc0ecc <+46>: jne 0x7ffff7bc0ed5 ; <+55>
(lldb) up
frame #1: 0x00007ffff7f8fc00 libmlt++-7.so.7`Mlt::Service::connect_producer(Mlt::Service&, int) + 92
libmlt++-7.so.7`Mlt::Service::connect_producer:
-> 0x7ffff7f8fc00 <+92>: movq -0x8(%rbp), %rbx
0x7ffff7f8fc04 <+96>: leave
0x7ffff7f8fc05 <+97>: retq
libmlt++-7.so.7`Mlt::Service::insert_producer:
0x7ffff7f8fc06 <+0>: endbr64
(lldb) up
frame #2: 0x00007ffff7f85cf6 libmlt++-7.so.7`Mlt::Consumer::connect(Mlt::Service&) + 44
libmlt++-7.so.7`Mlt::Consumer::connect:
-> 0x7ffff7f85cf6 <+44>: leave
0x7ffff7f85cf7 <+45>: retq
libmlt++-7.so.7`Mlt::Consumer::start:
0x7ffff7f85cf8 <+0>: endbr64
0x7ffff7f85cfc <+4>: pushq %rbp
(lldb) up
frame #3: 0x0000555555555634 SimplePodcastMaker`main(argc=1, argv=0x00007fffffffdc78) at main.cpp:47:14
44 Profile profile;
45 Producer p( profile, "pango:", "Hello World" );
46 Consumer c( profile, "sdl" );
-> 47 c.connect( p );
48 c.run( );
49 return 0;
50 }
#include <mlt++/Mlt.h>
using namespace std;
using namespace Mlt;
int main(int argc, char **argv)
{
Factory::init( );
Profile profile;
Producer p( profile, "pango:", "Hello World" );
Consumer c( profile, "sdl" );
c.connect( p );
c.run( );
return 0;
}
Repro at git repo https://gitlab.com/kaixoo/simple-video-podcast-maker, branch cpp-mlp-api
This usually happens because you do not actually have the producer or consumer you have requested. The simple example does not have error checking. For example, in mlt++ you use object.is_valid()
to see if underlying C pointer is not null. Run melt -query producers
and melt -query consumers
to see what you have on your system. Then, adjust the example according to which you have. For example, you might have built with the modern, preferred sdl2
corresponding the SDL version 2 library.