GtkMediaStream duration is never updated on GTK 4 from org.gnome.Sdk//master
Unfortunately somehow it doesn't reproduce if I run gtk4-demo
, but it reproduces in my Video Trimmer app: the duration
property is never set after the file is opened.
Here's what I see in the debugger. I set a breakpoint at gtk_media_stream_prepared()
, then on first call I go up and check media_info
:
> p *media_info
$1 = {parent = {g_type_instance = {g_class = 0x5555569586c0 [g_type: GstPlayerMediaInfo]}, ref_count = 1, qdata = 0x0}, uri = 0x555556311a20 "file:///run/user/1000/doc/2f794059/Animations.mp4", title = 0x0, container = 0x555556317b60 "ISO MP4/M4A", seekable = 1, is_live = 0, tags = 0x7fff8c0060a0 [GstTagList], image_sample = 0x0, stream_list = 0x7fffe8018500 = {0x7fffe80dc360}, audio_stream_list = 0x0, video_stream_list = 0x7fffe80bb580 = {0x7fffe80dc360}, subtitle_stream_list = 0x0, duration = 0 [0:00:00.000000000]}
You can see the duration is 0 right now on the first call. So the stream is marked as prepared with 0 duration.
Then I set a breakpoint on gtk_gst_media_file_media_info_updated_cb()
. At this point the duration is known:
> p *gst_player_get_media_info (self->player)
$2 = {parent = {g_type_instance = {g_class = 0x5555569586c0 [g_type: GstPlayerMediaInfo]}, ref_count = 1, qdata = 0x0}, uri = 0x555556311a20 "file:///run/user/1000/doc/2f794059/Animations.mp4", title = 0x0, container = 0x555556317b60 "ISO MP4/M4A", seekable = 1, is_live = 0, tags = 0x7fff8c0060a0 [GstTagList], image_sample = 0x0, stream_list = 0x555556800630 = {0x7fffe80d52a0}, audio_stream_list = 0x0, video_stream_list = 0x7fffe809cae0 = {0x7fffe80d52a0}, subtitle_stream_list = 0x0, duration = 47984000000 [0:00:47.984000000]}
However rather than updating the duration, it calls gtk_gst_media_file_ensure_prepared()
which does nothing since the stream is already prepared.
(Also worth noting that gtk_gst_media_file_media_info_updated_cb()
has a wrong parameter type: it should be GstPlayerMediaInfo
not GstClockTime
)