v0.2.1 c0399be

gtkmediastream.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gdk"
12	"github.com/bnema/puregotk/v4/glib"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15)
16
17type MediaStreamClass struct {
18	_ structs.HostLayout
19
20	ParentClass gobject.ObjectClass
21
22	xPlay uintptr
23
24	xPause uintptr
25
26	xSeek uintptr
27
28	xUpdateAudio uintptr
29
30	xRealize uintptr
31
32	xUnrealize uintptr
33
34	xGtkReserved1 uintptr
35
36	xGtkReserved2 uintptr
37
38	xGtkReserved3 uintptr
39
40	xGtkReserved4 uintptr
41
42	xGtkReserved5 uintptr
43
44	xGtkReserved6 uintptr
45
46	xGtkReserved7 uintptr
47
48	xGtkReserved8 uintptr
49}
50
51func (x *MediaStreamClass) GoPointer() uintptr {
52	return uintptr(unsafe.Pointer(x))
53}
54
55// OverridePlay sets the "play" callback function.
56func (x *MediaStreamClass) OverridePlay(cb func(*MediaStream) bool) {
57	if cb == nil {
58		x.xPlay = 0
59	} else {
60		x.xPlay = purego.NewCallback(func(SelfVarp uintptr) bool {
61			return cb(MediaStreamNewFromInternalPtr(SelfVarp))
62		})
63	}
64}
65
66// GetPlay gets the "play" callback function.
67func (x *MediaStreamClass) GetPlay() func(*MediaStream) bool {
68	if x.xPlay == 0 {
69		return nil
70	}
71	var rawCallback func(SelfVarp uintptr) bool
72	purego.RegisterFunc(&rawCallback, x.xPlay)
73	return func(SelfVar *MediaStream) bool {
74		return rawCallback(SelfVar.GoPointer())
75	}
76}
77
78// OverridePause sets the "pause" callback function.
79func (x *MediaStreamClass) OverridePause(cb func(*MediaStream)) {
80	if cb == nil {
81		x.xPause = 0
82	} else {
83		x.xPause = purego.NewCallback(func(SelfVarp uintptr) {
84			cb(MediaStreamNewFromInternalPtr(SelfVarp))
85		})
86	}
87}
88
89// GetPause gets the "pause" callback function.
90func (x *MediaStreamClass) GetPause() func(*MediaStream) {
91	if x.xPause == 0 {
92		return nil
93	}
94	var rawCallback func(SelfVarp uintptr)
95	purego.RegisterFunc(&rawCallback, x.xPause)
96	return func(SelfVar *MediaStream) {
97		rawCallback(SelfVar.GoPointer())
98	}
99}
100
101// OverrideSeek sets the "seek" callback function.
102func (x *MediaStreamClass) OverrideSeek(cb func(*MediaStream, int64)) {
103	if cb == nil {
104		x.xSeek = 0
105	} else {
106		x.xSeek = purego.NewCallback(func(SelfVarp uintptr, TimestampVarp int64) {
107			cb(MediaStreamNewFromInternalPtr(SelfVarp), TimestampVarp)
108		})
109	}
110}
111
112// GetSeek gets the "seek" callback function.
113func (x *MediaStreamClass) GetSeek() func(*MediaStream, int64) {
114	if x.xSeek == 0 {
115		return nil
116	}
117	var rawCallback func(SelfVarp uintptr, TimestampVarp int64)
118	purego.RegisterFunc(&rawCallback, x.xSeek)
119	return func(SelfVar *MediaStream, TimestampVar int64) {
120		rawCallback(SelfVar.GoPointer(), TimestampVar)
121	}
122}
123
124// OverrideUpdateAudio sets the "update_audio" callback function.
125func (x *MediaStreamClass) OverrideUpdateAudio(cb func(*MediaStream, bool, float64)) {
126	if cb == nil {
127		x.xUpdateAudio = 0
128	} else {
129		x.xUpdateAudio = purego.NewCallback(func(SelfVarp uintptr, MutedVarp bool, VolumeVarp float64) {
130			cb(MediaStreamNewFromInternalPtr(SelfVarp), MutedVarp, VolumeVarp)
131		})
132	}
133}
134
135// GetUpdateAudio gets the "update_audio" callback function.
136func (x *MediaStreamClass) GetUpdateAudio() func(*MediaStream, bool, float64) {
137	if x.xUpdateAudio == 0 {
138		return nil
139	}
140	var rawCallback func(SelfVarp uintptr, MutedVarp bool, VolumeVarp float64)
141	purego.RegisterFunc(&rawCallback, x.xUpdateAudio)
142	return func(SelfVar *MediaStream, MutedVar bool, VolumeVar float64) {
143		rawCallback(SelfVar.GoPointer(), MutedVar, VolumeVar)
144	}
145}
146
147// OverrideRealize sets the "realize" callback function.
148func (x *MediaStreamClass) OverrideRealize(cb func(*MediaStream, *gdk.Surface)) {
149	if cb == nil {
150		x.xRealize = 0
151	} else {
152		x.xRealize = purego.NewCallback(func(SelfVarp uintptr, SurfaceVarp uintptr) {
153			cb(MediaStreamNewFromInternalPtr(SelfVarp), gdk.SurfaceNewFromInternalPtr(SurfaceVarp))
154		})
155	}
156}
157
158// GetRealize gets the "realize" callback function.
159func (x *MediaStreamClass) GetRealize() func(*MediaStream, *gdk.Surface) {
160	if x.xRealize == 0 {
161		return nil
162	}
163	var rawCallback func(SelfVarp uintptr, SurfaceVarp uintptr)
164	purego.RegisterFunc(&rawCallback, x.xRealize)
165	return func(SelfVar *MediaStream, SurfaceVar *gdk.Surface) {
166		rawCallback(SelfVar.GoPointer(), SurfaceVar.GoPointer())
167	}
168}
169
170// OverrideUnrealize sets the "unrealize" callback function.
171func (x *MediaStreamClass) OverrideUnrealize(cb func(*MediaStream, *gdk.Surface)) {
172	if cb == nil {
173		x.xUnrealize = 0
174	} else {
175		x.xUnrealize = purego.NewCallback(func(SelfVarp uintptr, SurfaceVarp uintptr) {
176			cb(MediaStreamNewFromInternalPtr(SelfVarp), gdk.SurfaceNewFromInternalPtr(SurfaceVarp))
177		})
178	}
179}
180
181// GetUnrealize gets the "unrealize" callback function.
182func (x *MediaStreamClass) GetUnrealize() func(*MediaStream, *gdk.Surface) {
183	if x.xUnrealize == 0 {
184		return nil
185	}
186	var rawCallback func(SelfVarp uintptr, SurfaceVarp uintptr)
187	purego.RegisterFunc(&rawCallback, x.xUnrealize)
188	return func(SelfVar *MediaStream, SurfaceVar *gdk.Surface) {
189		rawCallback(SelfVar.GoPointer(), SurfaceVar.GoPointer())
190	}
191}
192
193// OverrideGtkReserved1 sets the "_gtk_reserved1" callback function.
194func (x *MediaStreamClass) OverrideGtkReserved1(cb func()) {
195	if cb == nil {
196		x.xGtkReserved1 = 0
197	} else {
198		x.xGtkReserved1 = purego.NewCallback(func() {
199			cb()
200		})
201	}
202}
203
204// GetGtkReserved1 gets the "_gtk_reserved1" callback function.
205func (x *MediaStreamClass) GetGtkReserved1() func() {
206	if x.xGtkReserved1 == 0 {
207		return nil
208	}
209	var rawCallback func()
210	purego.RegisterFunc(&rawCallback, x.xGtkReserved1)
211	return func() {
212		rawCallback()
213	}
214}
215
216// OverrideGtkReserved2 sets the "_gtk_reserved2" callback function.
217func (x *MediaStreamClass) OverrideGtkReserved2(cb func()) {
218	if cb == nil {
219		x.xGtkReserved2 = 0
220	} else {
221		x.xGtkReserved2 = purego.NewCallback(func() {
222			cb()
223		})
224	}
225}
226
227// GetGtkReserved2 gets the "_gtk_reserved2" callback function.
228func (x *MediaStreamClass) GetGtkReserved2() func() {
229	if x.xGtkReserved2 == 0 {
230		return nil
231	}
232	var rawCallback func()
233	purego.RegisterFunc(&rawCallback, x.xGtkReserved2)
234	return func() {
235		rawCallback()
236	}
237}
238
239// OverrideGtkReserved3 sets the "_gtk_reserved3" callback function.
240func (x *MediaStreamClass) OverrideGtkReserved3(cb func()) {
241	if cb == nil {
242		x.xGtkReserved3 = 0
243	} else {
244		x.xGtkReserved3 = purego.NewCallback(func() {
245			cb()
246		})
247	}
248}
249
250// GetGtkReserved3 gets the "_gtk_reserved3" callback function.
251func (x *MediaStreamClass) GetGtkReserved3() func() {
252	if x.xGtkReserved3 == 0 {
253		return nil
254	}
255	var rawCallback func()
256	purego.RegisterFunc(&rawCallback, x.xGtkReserved3)
257	return func() {
258		rawCallback()
259	}
260}
261
262// OverrideGtkReserved4 sets the "_gtk_reserved4" callback function.
263func (x *MediaStreamClass) OverrideGtkReserved4(cb func()) {
264	if cb == nil {
265		x.xGtkReserved4 = 0
266	} else {
267		x.xGtkReserved4 = purego.NewCallback(func() {
268			cb()
269		})
270	}
271}
272
273// GetGtkReserved4 gets the "_gtk_reserved4" callback function.
274func (x *MediaStreamClass) GetGtkReserved4() func() {
275	if x.xGtkReserved4 == 0 {
276		return nil
277	}
278	var rawCallback func()
279	purego.RegisterFunc(&rawCallback, x.xGtkReserved4)
280	return func() {
281		rawCallback()
282	}
283}
284
285// OverrideGtkReserved5 sets the "_gtk_reserved5" callback function.
286func (x *MediaStreamClass) OverrideGtkReserved5(cb func()) {
287	if cb == nil {
288		x.xGtkReserved5 = 0
289	} else {
290		x.xGtkReserved5 = purego.NewCallback(func() {
291			cb()
292		})
293	}
294}
295
296// GetGtkReserved5 gets the "_gtk_reserved5" callback function.
297func (x *MediaStreamClass) GetGtkReserved5() func() {
298	if x.xGtkReserved5 == 0 {
299		return nil
300	}
301	var rawCallback func()
302	purego.RegisterFunc(&rawCallback, x.xGtkReserved5)
303	return func() {
304		rawCallback()
305	}
306}
307
308// OverrideGtkReserved6 sets the "_gtk_reserved6" callback function.
309func (x *MediaStreamClass) OverrideGtkReserved6(cb func()) {
310	if cb == nil {
311		x.xGtkReserved6 = 0
312	} else {
313		x.xGtkReserved6 = purego.NewCallback(func() {
314			cb()
315		})
316	}
317}
318
319// GetGtkReserved6 gets the "_gtk_reserved6" callback function.
320func (x *MediaStreamClass) GetGtkReserved6() func() {
321	if x.xGtkReserved6 == 0 {
322		return nil
323	}
324	var rawCallback func()
325	purego.RegisterFunc(&rawCallback, x.xGtkReserved6)
326	return func() {
327		rawCallback()
328	}
329}
330
331// OverrideGtkReserved7 sets the "_gtk_reserved7" callback function.
332func (x *MediaStreamClass) OverrideGtkReserved7(cb func()) {
333	if cb == nil {
334		x.xGtkReserved7 = 0
335	} else {
336		x.xGtkReserved7 = purego.NewCallback(func() {
337			cb()
338		})
339	}
340}
341
342// GetGtkReserved7 gets the "_gtk_reserved7" callback function.
343func (x *MediaStreamClass) GetGtkReserved7() func() {
344	if x.xGtkReserved7 == 0 {
345		return nil
346	}
347	var rawCallback func()
348	purego.RegisterFunc(&rawCallback, x.xGtkReserved7)
349	return func() {
350		rawCallback()
351	}
352}
353
354// OverrideGtkReserved8 sets the "_gtk_reserved8" callback function.
355func (x *MediaStreamClass) OverrideGtkReserved8(cb func()) {
356	if cb == nil {
357		x.xGtkReserved8 = 0
358	} else {
359		x.xGtkReserved8 = purego.NewCallback(func() {
360			cb()
361		})
362	}
363}
364
365// GetGtkReserved8 gets the "_gtk_reserved8" callback function.
366func (x *MediaStreamClass) GetGtkReserved8() func() {
367	if x.xGtkReserved8 == 0 {
368		return nil
369	}
370	var rawCallback func()
371	purego.RegisterFunc(&rawCallback, x.xGtkReserved8)
372	return func() {
373		rawCallback()
374	}
375}
376
377// The integration point for media playback inside GTK.
378//
379// GTK provides an implementation of the `GtkMediaStream` interface that
380// is called [class@Gtk.MediaFile].
381//
382// Apart from application-facing API for stream playback, `GtkMediaStream`
383// has a number of APIs that are only useful for implementations and should
384// not be used in applications:
385// [method@Gtk.MediaStream.prepared],
386// [method@Gtk.MediaStream.unprepared],
387// [method@Gtk.MediaStream.update],
388// [method@Gtk.MediaStream.ended],
389// [method@Gtk.MediaStream.seek_success],
390// [method@Gtk.MediaStream.seek_failed],
391// [method@Gtk.MediaStream.gerror],
392// [method@Gtk.MediaStream.error],
393// [method@Gtk.MediaStream.error_valist].
394type MediaStream struct {
395	gobject.Object
396}
397
398var xMediaStreamGLibType func() types.GType
399
400func MediaStreamGLibType() types.GType {
401	return xMediaStreamGLibType()
402}
403
404func MediaStreamNewFromInternalPtr(ptr uintptr) *MediaStream {
405	cls := &MediaStream{}
406	cls.Ptr = ptr
407	return cls
408}
409
410var xMediaStreamEnded func(uintptr)
411
412// Pauses the media stream and marks it as ended.
413//
414// This is a hint only, calls to [method@Gtk.MediaStream.play]
415// may still happen.
416//
417// The media stream must be prepared when this function is called.
418func (x *MediaStream) Ended() {
419
420	xMediaStreamEnded(x.GoPointer())
421
422}
423
424var xMediaStreamError func(uintptr, glib.Quark, int, string, ...interface{})
425
426// Sets @self into an error state using a printf()-style format string.
427//
428// This is a utility function that calls [method@Gtk.MediaStream.gerror].
429// See that function for details.
430func (x *MediaStream) Error(DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{}) {
431
432	xMediaStreamError(x.GoPointer(), DomainVar, CodeVar, FormatVar, varArgs...)
433
434}
435
436var xMediaStreamErrorValist func(uintptr, glib.Quark, int, string, []interface{})
437
438// Sets @self into an error state using a printf()-style format string.
439//
440// This is a utility function that calls [method@Gtk.MediaStream.gerror].
441// See that function for details.
442func (x *MediaStream) ErrorValist(DomainVar glib.Quark, CodeVar int, FormatVar string, ArgsVar []interface{}) {
443
444	xMediaStreamErrorValist(x.GoPointer(), DomainVar, CodeVar, FormatVar, ArgsVar)
445
446}
447
448var xMediaStreamGerror func(uintptr, *glib.Error)
449
450// Sets @self into an error state.
451//
452// This will pause the stream (you can check for an error
453// via [method@Gtk.MediaStream.get_error] in your
454// GtkMediaStream.pause() implementation), abort pending
455// seeks and mark the stream as prepared.
456//
457// if the stream is already in an error state, this call
458// will be ignored and the existing error will be retained.
459//
460// To unset an error, the stream must be reset via a call to
461// [method@Gtk.MediaStream.unprepared].
462func (x *MediaStream) Gerror(ErrorVar *glib.Error) {
463
464	xMediaStreamGerror(x.GoPointer(), ErrorVar)
465
466}
467
468var xMediaStreamGetDuration func(uintptr) int64
469
470// Gets the duration of the stream.
471//
472// If the duration is not known, 0 will be returned.
473func (x *MediaStream) GetDuration() int64 {
474
475	cret := xMediaStreamGetDuration(x.GoPointer())
476	return cret
477}
478
479var xMediaStreamGetEnded func(uintptr) bool
480
481// Returns whether the streams playback is finished.
482func (x *MediaStream) GetEnded() bool {
483
484	cret := xMediaStreamGetEnded(x.GoPointer())
485	return cret
486}
487
488var xMediaStreamGetError func(uintptr) *glib.Error
489
490// If the stream is in an error state, returns the `GError`
491// explaining that state.
492//
493// Any type of error can be reported here depending on the
494// implementation of the media stream.
495//
496// A media stream in an error cannot be operated on, calls
497// like [method@Gtk.MediaStream.play] or
498// [method@Gtk.MediaStream.seek] will not have any effect.
499//
500// `GtkMediaStream` itself does not provide a way to unset
501// an error, but implementations may provide options. For example,
502// a [class@Gtk.MediaFile] will unset errors when a new source is
503// set, e.g. with [method@Gtk.MediaFile.set_file].
504func (x *MediaStream) GetError() *glib.Error {
505
506	cret := xMediaStreamGetError(x.GoPointer())
507	return cret
508}
509
510var xMediaStreamGetLoop func(uintptr) bool
511
512// Returns whether the stream is set to loop.
513//
514// See [method@Gtk.MediaStream.set_loop] for details.
515func (x *MediaStream) GetLoop() bool {
516
517	cret := xMediaStreamGetLoop(x.GoPointer())
518	return cret
519}
520
521var xMediaStreamGetMuted func(uintptr) bool
522
523// Returns whether the audio for the stream is muted.
524//
525// See [method@Gtk.MediaStream.set_muted] for details.
526func (x *MediaStream) GetMuted() bool {
527
528	cret := xMediaStreamGetMuted(x.GoPointer())
529	return cret
530}
531
532var xMediaStreamGetPlaying func(uintptr) bool
533
534// Return whether the stream is currently playing.
535func (x *MediaStream) GetPlaying() bool {
536
537	cret := xMediaStreamGetPlaying(x.GoPointer())
538	return cret
539}
540
541var xMediaStreamGetTimestamp func(uintptr) int64
542
543// Returns the current presentation timestamp in microseconds.
544func (x *MediaStream) GetTimestamp() int64 {
545
546	cret := xMediaStreamGetTimestamp(x.GoPointer())
547	return cret
548}
549
550var xMediaStreamGetVolume func(uintptr) float64
551
552// Returns the volume of the audio for the stream.
553//
554// See [method@Gtk.MediaStream.set_volume] for details.
555func (x *MediaStream) GetVolume() float64 {
556
557	cret := xMediaStreamGetVolume(x.GoPointer())
558	return cret
559}
560
561var xMediaStreamHasAudio func(uintptr) bool
562
563// Returns whether the stream has audio.
564func (x *MediaStream) HasAudio() bool {
565
566	cret := xMediaStreamHasAudio(x.GoPointer())
567	return cret
568}
569
570var xMediaStreamHasVideo func(uintptr) bool
571
572// Returns whether the stream has video.
573func (x *MediaStream) HasVideo() bool {
574
575	cret := xMediaStreamHasVideo(x.GoPointer())
576	return cret
577}
578
579var xMediaStreamIsPrepared func(uintptr) bool
580
581// Returns whether the stream has finished initializing.
582//
583// At this point the existence of audio and video is known.
584func (x *MediaStream) IsPrepared() bool {
585
586	cret := xMediaStreamIsPrepared(x.GoPointer())
587	return cret
588}
589
590var xMediaStreamIsSeekable func(uintptr) bool
591
592// Checks if a stream may be seekable.
593//
594// This is meant to be a hint. Streams may not allow seeking even if
595// this function returns %TRUE. However, if this function returns
596// %FALSE, streams are guaranteed to not be seekable and user interfaces
597// may hide controls that allow seeking.
598//
599// It is allowed to call [method@Gtk.MediaStream.seek] on a non-seekable
600// stream, though it will not do anything.
601func (x *MediaStream) IsSeekable() bool {
602
603	cret := xMediaStreamIsSeekable(x.GoPointer())
604	return cret
605}
606
607var xMediaStreamIsSeeking func(uintptr) bool
608
609// Checks if there is currently a seek operation going on.
610func (x *MediaStream) IsSeeking() bool {
611
612	cret := xMediaStreamIsSeeking(x.GoPointer())
613	return cret
614}
615
616var xMediaStreamPause func(uintptr)
617
618// Pauses playback of the stream.
619//
620// If the stream is not playing, do nothing.
621func (x *MediaStream) Pause() {
622
623	xMediaStreamPause(x.GoPointer())
624
625}
626
627var xMediaStreamPlay func(uintptr)
628
629// Starts playing the stream.
630//
631// If the stream is in error or already playing, do nothing.
632func (x *MediaStream) Play() {
633
634	xMediaStreamPlay(x.GoPointer())
635
636}
637
638var xMediaStreamPrepared func(uintptr, bool, bool, bool, int64)
639
640// Same as gtk_media_stream_stream_prepared().
641func (x *MediaStream) Prepared(HasAudioVar bool, HasVideoVar bool, SeekableVar bool, DurationVar int64) {
642
643	xMediaStreamPrepared(x.GoPointer(), HasAudioVar, HasVideoVar, SeekableVar, DurationVar)
644
645}
646
647var xMediaStreamRealize func(uintptr, uintptr)
648
649// Called by users to attach the media stream to a `GdkSurface` they manage.
650//
651// The stream can then access the resources of @surface for its
652// rendering purposes. In particular, media streams might want to
653// create a `GdkGLContext` or sync to the `GdkFrameClock`.
654//
655// Whoever calls this function is responsible for calling
656// [method@Gtk.MediaStream.unrealize] before either the stream
657// or @surface get destroyed.
658//
659// Multiple calls to this function may happen from different
660// users of the video, even with the same @surface. Each of these
661// calls must be followed by its own call to
662// [method@Gtk.MediaStream.unrealize].
663//
664// It is not required to call this function to make a media stream work.
665func (x *MediaStream) Realize(SurfaceVar *gdk.Surface) {
666
667	xMediaStreamRealize(x.GoPointer(), SurfaceVar.GoPointer())
668
669}
670
671var xMediaStreamSeek func(uintptr, int64)
672
673// Start a seek operation on @self to @timestamp.
674//
675// If @timestamp is out of range, it will be clamped.
676//
677// Seek operations may not finish instantly. While a
678// seek operation is in process, the [property@Gtk.MediaStream:seeking]
679// property will be set.
680//
681// When calling gtk_media_stream_seek() during an
682// ongoing seek operation, the new seek will override
683// any pending seek.
684func (x *MediaStream) Seek(TimestampVar int64) {
685
686	xMediaStreamSeek(x.GoPointer(), TimestampVar)
687
688}
689
690var xMediaStreamSeekFailed func(uintptr)
691
692// Ends a seek operation started via GtkMediaStream.seek() as a failure.
693//
694// This will not cause an error on the stream and will assume that
695// playback continues as if no seek had happened.
696//
697// See [method@Gtk.MediaStream.seek_success] for the other way of
698// ending a seek.
699func (x *MediaStream) SeekFailed() {
700
701	xMediaStreamSeekFailed(x.GoPointer())
702
703}
704
705var xMediaStreamSeekSuccess func(uintptr)
706
707// Ends a seek operation started via GtkMediaStream.seek() successfully.
708//
709// This function will unset the GtkMediaStream:ended property
710// if it was set.
711//
712// See [method@Gtk.MediaStream.seek_failed] for the other way of
713// ending a seek.
714func (x *MediaStream) SeekSuccess() {
715
716	xMediaStreamSeekSuccess(x.GoPointer())
717
718}
719
720var xMediaStreamSetLoop func(uintptr, bool)
721
722// Sets whether the stream should loop.
723//
724// In this case, it will attempt to restart playback
725// from the beginning instead of stopping at the end.
726//
727// Not all streams may support looping, in particular
728// non-seekable streams. Those streams will ignore the
729// loop setting and just end.
730func (x *MediaStream) SetLoop(LoopVar bool) {
731
732	xMediaStreamSetLoop(x.GoPointer(), LoopVar)
733
734}
735
736var xMediaStreamSetMuted func(uintptr, bool)
737
738// Sets whether the audio stream should be muted.
739//
740// Muting a stream will cause no audio to be played, but it
741// does not modify the volume. This means that muting and
742// then unmuting the stream will restore the volume settings.
743//
744// If the stream has no audio, calling this function will
745// still work but it will not have an audible effect.
746func (x *MediaStream) SetMuted(MutedVar bool) {
747
748	xMediaStreamSetMuted(x.GoPointer(), MutedVar)
749
750}
751
752var xMediaStreamSetPlaying func(uintptr, bool)
753
754// Starts or pauses playback of the stream.
755func (x *MediaStream) SetPlaying(PlayingVar bool) {
756
757	xMediaStreamSetPlaying(x.GoPointer(), PlayingVar)
758
759}
760
761var xMediaStreamSetVolume func(uintptr, float64)
762
763// Sets the volume of the audio stream.
764//
765// This function call will work even if the stream is muted.
766//
767// The given @volume should range from 0.0 for silence to 1.0
768// for as loud as possible. Values outside of this range will
769// be clamped to the nearest value.
770//
771// If the stream has no audio or is muted, calling this function
772// will still work but it will not have an immediate audible effect.
773// When the stream is unmuted, the new volume setting will take effect.
774func (x *MediaStream) SetVolume(VolumeVar float64) {
775
776	xMediaStreamSetVolume(x.GoPointer(), VolumeVar)
777
778}
779
780var xMediaStreamStreamEnded func(uintptr)
781
782// Pauses the media stream and marks it as ended.
783//
784// This is a hint only, calls to [method@Gtk.MediaStream.play]
785// may still happen.
786//
787// The media stream must be prepared when this function is called.
788func (x *MediaStream) StreamEnded() {
789
790	xMediaStreamStreamEnded(x.GoPointer())
791
792}
793
794var xMediaStreamStreamPrepared func(uintptr, bool, bool, bool, int64)
795
796// Called by `GtkMediaStream` implementations to advertise the stream
797// being ready to play and providing details about the stream.
798//
799// Note that the arguments are hints. If the stream implementation
800// cannot determine the correct values, it is better to err on the
801// side of caution and return %TRUE. User interfaces will use those
802// values to determine what controls to show.
803//
804// This function may not be called again until the stream has been
805// reset via [method@Gtk.MediaStream.stream_unprepared].
806func (x *MediaStream) StreamPrepared(HasAudioVar bool, HasVideoVar bool, SeekableVar bool, DurationVar int64) {
807
808	xMediaStreamStreamPrepared(x.GoPointer(), HasAudioVar, HasVideoVar, SeekableVar, DurationVar)
809
810}
811
812var xMediaStreamStreamUnprepared func(uintptr)
813
814// Resets a given media stream implementation.
815//
816// [method@Gtk.MediaStream.stream_prepared] can then be called again.
817//
818// This function will also reset any error state the stream was in.
819func (x *MediaStream) StreamUnprepared() {
820
821	xMediaStreamStreamUnprepared(x.GoPointer())
822
823}
824
825var xMediaStreamUnprepared func(uintptr)
826
827// Same as gtk_media_stream_stream_unprepared().
828func (x *MediaStream) Unprepared() {
829
830	xMediaStreamUnprepared(x.GoPointer())
831
832}
833
834var xMediaStreamUnrealize func(uintptr, uintptr)
835
836// Undoes a previous call to gtk_media_stream_realize().
837//
838// This causes the stream to release all resources it had
839// allocated from @surface.
840func (x *MediaStream) Unrealize(SurfaceVar *gdk.Surface) {
841
842	xMediaStreamUnrealize(x.GoPointer(), SurfaceVar.GoPointer())
843
844}
845
846var xMediaStreamUpdate func(uintptr, int64)
847
848// Media stream implementations should regularly call this
849// function to update the timestamp reported by the stream.
850//
851// It is up to implementations to call this at the frequency
852// they deem appropriate.
853//
854// The media stream must be prepared when this function is called.
855func (x *MediaStream) Update(TimestampVar int64) {
856
857	xMediaStreamUpdate(x.GoPointer(), TimestampVar)
858
859}
860
861func (c *MediaStream) GoPointer() uintptr {
862	if c == nil {
863		return 0
864	}
865	return c.Ptr
866}
867
868func (c *MediaStream) SetGoPointer(ptr uintptr) {
869	c.Ptr = ptr
870}
871
872// GetPropertyDuration gets the "duration" property.
873// The stream's duration in microseconds or 0 if unknown.
874func (x *MediaStream) GetPropertyDuration() int64 {
875	var v gobject.Value
876	x.GetProperty("duration", &v)
877	return v.GetInt64()
878}
879
880// GetPropertyEnded gets the "ended" property.
881// Set when playback has finished.
882func (x *MediaStream) GetPropertyEnded() bool {
883	var v gobject.Value
884	x.GetProperty("ended", &v)
885	return v.GetBoolean()
886}
887
888// GetPropertyError gets the "error" property.
889// %NULL for a properly working stream or the `GError`
890// that the stream is in.
891func (x *MediaStream) GetPropertyError() uintptr {
892	var v gobject.Value
893	x.GetProperty("error", &v)
894	return v.GetPointer()
895}
896
897// GetPropertyHasAudio gets the "has-audio" property.
898// Whether the stream contains audio.
899func (x *MediaStream) GetPropertyHasAudio() bool {
900	var v gobject.Value
901	x.GetProperty("has-audio", &v)
902	return v.GetBoolean()
903}
904
905// GetPropertyHasVideo gets the "has-video" property.
906// Whether the stream contains video.
907func (x *MediaStream) GetPropertyHasVideo() bool {
908	var v gobject.Value
909	x.GetProperty("has-video", &v)
910	return v.GetBoolean()
911}
912
913// SetPropertyLoop sets the "loop" property.
914// Try to restart the media from the beginning once it ended.
915func (x *MediaStream) SetPropertyLoop(value bool) {
916	var v gobject.Value
917	v.Init(gobject.TypeBooleanVal)
918	v.SetBoolean(value)
919	x.SetProperty("loop", &v)
920}
921
922// GetPropertyLoop gets the "loop" property.
923// Try to restart the media from the beginning once it ended.
924func (x *MediaStream) GetPropertyLoop() bool {
925	var v gobject.Value
926	x.GetProperty("loop", &v)
927	return v.GetBoolean()
928}
929
930// SetPropertyMuted sets the "muted" property.
931// Whether the audio stream should be muted.
932func (x *MediaStream) SetPropertyMuted(value bool) {
933	var v gobject.Value
934	v.Init(gobject.TypeBooleanVal)
935	v.SetBoolean(value)
936	x.SetProperty("muted", &v)
937}
938
939// GetPropertyMuted gets the "muted" property.
940// Whether the audio stream should be muted.
941func (x *MediaStream) GetPropertyMuted() bool {
942	var v gobject.Value
943	x.GetProperty("muted", &v)
944	return v.GetBoolean()
945}
946
947// SetPropertyPlaying sets the "playing" property.
948// Whether the stream is currently playing.
949func (x *MediaStream) SetPropertyPlaying(value bool) {
950	var v gobject.Value
951	v.Init(gobject.TypeBooleanVal)
952	v.SetBoolean(value)
953	x.SetProperty("playing", &v)
954}
955
956// GetPropertyPlaying gets the "playing" property.
957// Whether the stream is currently playing.
958func (x *MediaStream) GetPropertyPlaying() bool {
959	var v gobject.Value
960	x.GetProperty("playing", &v)
961	return v.GetBoolean()
962}
963
964// GetPropertyPrepared gets the "prepared" property.
965// Whether the stream has finished initializing and existence of
966// audio and video is known.
967func (x *MediaStream) GetPropertyPrepared() bool {
968	var v gobject.Value
969	x.GetProperty("prepared", &v)
970	return v.GetBoolean()
971}
972
973// GetPropertySeekable gets the "seekable" property.
974// Set unless the stream is known to not support seeking.
975func (x *MediaStream) GetPropertySeekable() bool {
976	var v gobject.Value
977	x.GetProperty("seekable", &v)
978	return v.GetBoolean()
979}
980
981// GetPropertySeeking gets the "seeking" property.
982// Set while a seek is in progress.
983func (x *MediaStream) GetPropertySeeking() bool {
984	var v gobject.Value
985	x.GetProperty("seeking", &v)
986	return v.GetBoolean()
987}
988
989// GetPropertyTimestamp gets the "timestamp" property.
990// The current presentation timestamp in microseconds.
991func (x *MediaStream) GetPropertyTimestamp() int64 {
992	var v gobject.Value
993	x.GetProperty("timestamp", &v)
994	return v.GetInt64()
995}
996
997// SetPropertyVolume sets the "volume" property.
998// Volume of the audio stream.
999func (x *MediaStream) SetPropertyVolume(value float64) {
1000	var v gobject.Value
1001	v.Init(gobject.TypeDoubleVal)
1002	v.SetDouble(value)
1003	x.SetProperty("volume", &v)
1004}
1005
1006// GetPropertyVolume gets the "volume" property.
1007// Volume of the audio stream.
1008func (x *MediaStream) GetPropertyVolume() float64 {
1009	var v gobject.Value
1010	x.GetProperty("volume", &v)
1011	return v.GetDouble()
1012}
1013
1014// Compute a concrete size for the `GdkPaintable`.
1015//
1016// Applies the sizing algorithm outlined in the
1017// [CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing)
1018// to the given @paintable. See that link for more details.
1019//
1020// It is not necessary to call this function when both @specified_width
1021// and @specified_height are known, but it is useful to call this
1022// function in GtkWidget:measure implementations to compute the
1023// other dimension when only one dimension is given.
1024func (x *MediaStream) ComputeConcreteSize(SpecifiedWidthVar float64, SpecifiedHeightVar float64, DefaultWidthVar float64, DefaultHeightVar float64, ConcreteWidthVar *float64, ConcreteHeightVar *float64) {
1025
1026	gdk.XGdkPaintableComputeConcreteSize(x.GoPointer(), SpecifiedWidthVar, SpecifiedHeightVar, DefaultWidthVar, DefaultHeightVar, ConcreteWidthVar, ConcreteHeightVar)
1027
1028}
1029
1030// Gets an immutable paintable for the current contents displayed by @paintable.
1031//
1032// This is useful when you want to retain the current state of an animation,
1033// for example to take a screenshot of a running animation.
1034//
1035// If the @paintable is already immutable, it will return itself.
1036func (x *MediaStream) GetCurrentImage() *gdk.PaintableBase {
1037	var cls *gdk.PaintableBase
1038
1039	cret := gdk.XGdkPaintableGetCurrentImage(x.GoPointer())
1040
1041	if cret == 0 {
1042		return nil
1043	}
1044	cls = &gdk.PaintableBase{}
1045	cls.Ptr = cret
1046	return cls
1047}
1048
1049// Get flags for the paintable.
1050//
1051// This is oftentimes useful for optimizations.
1052//
1053// See [flags@Gdk.PaintableFlags] for the flags and what they mean.
1054func (x *MediaStream) GetFlags() gdk.PaintableFlags {
1055
1056	cret := gdk.XGdkPaintableGetFlags(x.GoPointer())
1057	return cret
1058}
1059
1060// Gets the preferred aspect ratio the @paintable would like to be displayed at.
1061//
1062// The aspect ratio is the width divided by the height, so a value of 0.5
1063// means that the @paintable prefers to be displayed twice as high as it
1064// is wide. Consumers of this interface can use this to preserve aspect
1065// ratio when displaying the paintable.
1066//
1067// This is a purely informational value and does not in any way limit the
1068// values that may be passed to [method@Gdk.Paintable.snapshot].
1069//
1070// Usually when a @paintable returns nonzero values from
1071// [method@Gdk.Paintable.get_intrinsic_width] and
1072// [method@Gdk.Paintable.get_intrinsic_height] the aspect ratio
1073// should conform to those values, though that is not required.
1074//
1075// If the @paintable does not have a preferred aspect ratio,
1076// it returns 0. Negative values are never returned.
1077func (x *MediaStream) GetIntrinsicAspectRatio() float64 {
1078
1079	cret := gdk.XGdkPaintableGetIntrinsicAspectRatio(x.GoPointer())
1080	return cret
1081}
1082
1083// Gets the preferred height the @paintable would like to be displayed at.
1084//
1085// Consumers of this interface can use this to reserve enough space to draw
1086// the paintable.
1087//
1088// This is a purely informational value and does not in any way limit the
1089// values that may be passed to [method@Gdk.Paintable.snapshot].
1090//
1091// If the @paintable does not have a preferred height, it returns 0.
1092// Negative values are never returned.
1093func (x *MediaStream) GetIntrinsicHeight() int {
1094
1095	cret := gdk.XGdkPaintableGetIntrinsicHeight(x.GoPointer())
1096	return cret
1097}
1098
1099// Gets the preferred width the @paintable would like to be displayed at.
1100//
1101// Consumers of this interface can use this to reserve enough space to draw
1102// the paintable.
1103//
1104// This is a purely informational value and does not in any way limit the
1105// values that may be passed to [method@Gdk.Paintable.snapshot].
1106//
1107// If the @paintable does not have a preferred width, it returns 0.
1108// Negative values are never returned.
1109func (x *MediaStream) GetIntrinsicWidth() int {
1110
1111	cret := gdk.XGdkPaintableGetIntrinsicWidth(x.GoPointer())
1112	return cret
1113}
1114
1115// Called by implementations of `GdkPaintable` to invalidate their contents.
1116//
1117// Unless the contents are invalidated, implementations must guarantee that
1118// multiple calls of [method@Gdk.Paintable.snapshot] produce the same output.
1119//
1120// This function will emit the [signal@Gdk.Paintable::invalidate-contents]
1121// signal.
1122//
1123// If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag,
1124// it must not call this function.
1125func (x *MediaStream) InvalidateContents() {
1126
1127	gdk.XGdkPaintableInvalidateContents(x.GoPointer())
1128
1129}
1130
1131// Called by implementations of `GdkPaintable` to invalidate their size.
1132//
1133// As long as the size is not invalidated, @paintable must return the same
1134// values for its intrinsic width, height and aspect ratio.
1135//
1136// This function will emit the [signal@Gdk.Paintable::invalidate-size]
1137// signal.
1138//
1139// If a @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag,
1140// it must not call this function.
1141func (x *MediaStream) InvalidateSize() {
1142
1143	gdk.XGdkPaintableInvalidateSize(x.GoPointer())
1144
1145}
1146
1147// Snapshots the given paintable with the given @width and @height.
1148//
1149// The paintable is drawn at the current (0,0) offset of the @snapshot.
1150// If @width and @height are not larger than zero, this function will
1151// do nothing.
1152func (x *MediaStream) Snapshot(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64) {
1153
1154	gdk.XGdkPaintableSnapshot(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar)
1155
1156}
1157
1158func init() {
1159	core.SetPackageName("GTK", "gtk4")
1160	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
1161	var libs []uintptr
1162	for _, libPath := range core.GetPaths("GTK") {
1163		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1164		if err != nil {
1165			panic(err)
1166		}
1167		libs = append(libs, lib)
1168	}
1169
1170	core.PuregoSafeRegister(&xMediaStreamGLibType, libs, "gtk_media_stream_get_type")
1171
1172	core.PuregoSafeRegister(&xMediaStreamEnded, libs, "gtk_media_stream_ended")
1173	core.PuregoSafeRegister(&xMediaStreamError, libs, "gtk_media_stream_error")
1174	core.PuregoSafeRegister(&xMediaStreamErrorValist, libs, "gtk_media_stream_error_valist")
1175	core.PuregoSafeRegister(&xMediaStreamGerror, libs, "gtk_media_stream_gerror")
1176	core.PuregoSafeRegister(&xMediaStreamGetDuration, libs, "gtk_media_stream_get_duration")
1177	core.PuregoSafeRegister(&xMediaStreamGetEnded, libs, "gtk_media_stream_get_ended")
1178	core.PuregoSafeRegister(&xMediaStreamGetError, libs, "gtk_media_stream_get_error")
1179	core.PuregoSafeRegister(&xMediaStreamGetLoop, libs, "gtk_media_stream_get_loop")
1180	core.PuregoSafeRegister(&xMediaStreamGetMuted, libs, "gtk_media_stream_get_muted")
1181	core.PuregoSafeRegister(&xMediaStreamGetPlaying, libs, "gtk_media_stream_get_playing")
1182	core.PuregoSafeRegister(&xMediaStreamGetTimestamp, libs, "gtk_media_stream_get_timestamp")
1183	core.PuregoSafeRegister(&xMediaStreamGetVolume, libs, "gtk_media_stream_get_volume")
1184	core.PuregoSafeRegister(&xMediaStreamHasAudio, libs, "gtk_media_stream_has_audio")
1185	core.PuregoSafeRegister(&xMediaStreamHasVideo, libs, "gtk_media_stream_has_video")
1186	core.PuregoSafeRegister(&xMediaStreamIsPrepared, libs, "gtk_media_stream_is_prepared")
1187	core.PuregoSafeRegister(&xMediaStreamIsSeekable, libs, "gtk_media_stream_is_seekable")
1188	core.PuregoSafeRegister(&xMediaStreamIsSeeking, libs, "gtk_media_stream_is_seeking")
1189	core.PuregoSafeRegister(&xMediaStreamPause, libs, "gtk_media_stream_pause")
1190	core.PuregoSafeRegister(&xMediaStreamPlay, libs, "gtk_media_stream_play")
1191	core.PuregoSafeRegister(&xMediaStreamPrepared, libs, "gtk_media_stream_prepared")
1192	core.PuregoSafeRegister(&xMediaStreamRealize, libs, "gtk_media_stream_realize")
1193	core.PuregoSafeRegister(&xMediaStreamSeek, libs, "gtk_media_stream_seek")
1194	core.PuregoSafeRegister(&xMediaStreamSeekFailed, libs, "gtk_media_stream_seek_failed")
1195	core.PuregoSafeRegister(&xMediaStreamSeekSuccess, libs, "gtk_media_stream_seek_success")
1196	core.PuregoSafeRegister(&xMediaStreamSetLoop, libs, "gtk_media_stream_set_loop")
1197	core.PuregoSafeRegister(&xMediaStreamSetMuted, libs, "gtk_media_stream_set_muted")
1198	core.PuregoSafeRegister(&xMediaStreamSetPlaying, libs, "gtk_media_stream_set_playing")
1199	core.PuregoSafeRegister(&xMediaStreamSetVolume, libs, "gtk_media_stream_set_volume")
1200	core.PuregoSafeRegister(&xMediaStreamStreamEnded, libs, "gtk_media_stream_stream_ended")
1201	core.PuregoSafeRegister(&xMediaStreamStreamPrepared, libs, "gtk_media_stream_stream_prepared")
1202	core.PuregoSafeRegister(&xMediaStreamStreamUnprepared, libs, "gtk_media_stream_stream_unprepared")
1203	core.PuregoSafeRegister(&xMediaStreamUnprepared, libs, "gtk_media_stream_unprepared")
1204	core.PuregoSafeRegister(&xMediaStreamUnrealize, libs, "gtk_media_stream_unrealize")
1205	core.PuregoSafeRegister(&xMediaStreamUpdate, libs, "gtk_media_stream_update")
1206
1207}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close