v0.2.1 c0399be

gtkmediafile.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/gio"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15)
16
17type MediaFileClass struct {
18	_ structs.HostLayout
19
20	ParentClass MediaStreamClass
21
22	xOpen uintptr
23
24	xClose uintptr
25
26	xGtkReserved1 uintptr
27
28	xGtkReserved2 uintptr
29
30	xGtkReserved3 uintptr
31
32	xGtkReserved4 uintptr
33}
34
35func (x *MediaFileClass) GoPointer() uintptr {
36	return uintptr(unsafe.Pointer(x))
37}
38
39// OverrideOpen sets the "open" callback function.
40func (x *MediaFileClass) OverrideOpen(cb func(*MediaFile)) {
41	if cb == nil {
42		x.xOpen = 0
43	} else {
44		x.xOpen = purego.NewCallback(func(SelfVarp uintptr) {
45			cb(MediaFileNewFromInternalPtr(SelfVarp))
46		})
47	}
48}
49
50// GetOpen gets the "open" callback function.
51func (x *MediaFileClass) GetOpen() func(*MediaFile) {
52	if x.xOpen == 0 {
53		return nil
54	}
55	var rawCallback func(SelfVarp uintptr)
56	purego.RegisterFunc(&rawCallback, x.xOpen)
57	return func(SelfVar *MediaFile) {
58		rawCallback(SelfVar.GoPointer())
59	}
60}
61
62// OverrideClose sets the "close" callback function.
63func (x *MediaFileClass) OverrideClose(cb func(*MediaFile)) {
64	if cb == nil {
65		x.xClose = 0
66	} else {
67		x.xClose = purego.NewCallback(func(SelfVarp uintptr) {
68			cb(MediaFileNewFromInternalPtr(SelfVarp))
69		})
70	}
71}
72
73// GetClose gets the "close" callback function.
74func (x *MediaFileClass) GetClose() func(*MediaFile) {
75	if x.xClose == 0 {
76		return nil
77	}
78	var rawCallback func(SelfVarp uintptr)
79	purego.RegisterFunc(&rawCallback, x.xClose)
80	return func(SelfVar *MediaFile) {
81		rawCallback(SelfVar.GoPointer())
82	}
83}
84
85// OverrideGtkReserved1 sets the "_gtk_reserved1" callback function.
86func (x *MediaFileClass) OverrideGtkReserved1(cb func()) {
87	if cb == nil {
88		x.xGtkReserved1 = 0
89	} else {
90		x.xGtkReserved1 = purego.NewCallback(func() {
91			cb()
92		})
93	}
94}
95
96// GetGtkReserved1 gets the "_gtk_reserved1" callback function.
97func (x *MediaFileClass) GetGtkReserved1() func() {
98	if x.xGtkReserved1 == 0 {
99		return nil
100	}
101	var rawCallback func()
102	purego.RegisterFunc(&rawCallback, x.xGtkReserved1)
103	return func() {
104		rawCallback()
105	}
106}
107
108// OverrideGtkReserved2 sets the "_gtk_reserved2" callback function.
109func (x *MediaFileClass) OverrideGtkReserved2(cb func()) {
110	if cb == nil {
111		x.xGtkReserved2 = 0
112	} else {
113		x.xGtkReserved2 = purego.NewCallback(func() {
114			cb()
115		})
116	}
117}
118
119// GetGtkReserved2 gets the "_gtk_reserved2" callback function.
120func (x *MediaFileClass) GetGtkReserved2() func() {
121	if x.xGtkReserved2 == 0 {
122		return nil
123	}
124	var rawCallback func()
125	purego.RegisterFunc(&rawCallback, x.xGtkReserved2)
126	return func() {
127		rawCallback()
128	}
129}
130
131// OverrideGtkReserved3 sets the "_gtk_reserved3" callback function.
132func (x *MediaFileClass) OverrideGtkReserved3(cb func()) {
133	if cb == nil {
134		x.xGtkReserved3 = 0
135	} else {
136		x.xGtkReserved3 = purego.NewCallback(func() {
137			cb()
138		})
139	}
140}
141
142// GetGtkReserved3 gets the "_gtk_reserved3" callback function.
143func (x *MediaFileClass) GetGtkReserved3() func() {
144	if x.xGtkReserved3 == 0 {
145		return nil
146	}
147	var rawCallback func()
148	purego.RegisterFunc(&rawCallback, x.xGtkReserved3)
149	return func() {
150		rawCallback()
151	}
152}
153
154// OverrideGtkReserved4 sets the "_gtk_reserved4" callback function.
155func (x *MediaFileClass) OverrideGtkReserved4(cb func()) {
156	if cb == nil {
157		x.xGtkReserved4 = 0
158	} else {
159		x.xGtkReserved4 = purego.NewCallback(func() {
160			cb()
161		})
162	}
163}
164
165// GetGtkReserved4 gets the "_gtk_reserved4" callback function.
166func (x *MediaFileClass) GetGtkReserved4() func() {
167	if x.xGtkReserved4 == 0 {
168		return nil
169	}
170	var rawCallback func()
171	purego.RegisterFunc(&rawCallback, x.xGtkReserved4)
172	return func() {
173		rawCallback()
174	}
175}
176
177const (
178	// The default extension point name for media file.
179	MEDIA_FILE_EXTENSION_POINT_NAME string = "gtk-media-file"
180)
181
182// Implements the `GtkMediaStream` interface for files.
183//
184// This provides a simple way to play back video files with GTK.
185//
186// GTK provides a GIO extension point for `GtkMediaFile` implementations
187// to allow for external implementations using various media frameworks.
188//
189// GTK itself includes an implementation using GStreamer.
190type MediaFile struct {
191	MediaStream
192}
193
194var xMediaFileGLibType func() types.GType
195
196func MediaFileGLibType() types.GType {
197	return xMediaFileGLibType()
198}
199
200func MediaFileNewFromInternalPtr(ptr uintptr) *MediaFile {
201	cls := &MediaFile{}
202	cls.Ptr = ptr
203	return cls
204}
205
206var xNewMediaFile func() uintptr
207
208// Creates a new empty media file.
209func NewMediaFile() *MediaFile {
210	var cls *MediaFile
211
212	cret := xNewMediaFile()
213
214	if cret == 0 {
215		return nil
216	}
217	cls = &MediaFile{}
218	cls.Ptr = cret
219	return cls
220}
221
222var xNewMediaFileForFile func(uintptr) uintptr
223
224// Creates a new media file to play @file.
225func NewMediaFileForFile(FileVar gio.File) *MediaFile {
226	var cls *MediaFile
227
228	cret := xNewMediaFileForFile(FileVar.GoPointer())
229
230	if cret == 0 {
231		return nil
232	}
233	cls = &MediaFile{}
234	cls.Ptr = cret
235	return cls
236}
237
238var xNewMediaFileForFilename func(string) uintptr
239
240// Creates a new media file for the given filename.
241//
242// This is a utility function that converts the given @filename
243// to a `GFile` and calls [ctor@Gtk.MediaFile.new_for_file].
244func NewMediaFileForFilename(FilenameVar string) *MediaFile {
245	var cls *MediaFile
246
247	cret := xNewMediaFileForFilename(FilenameVar)
248
249	if cret == 0 {
250		return nil
251	}
252	cls = &MediaFile{}
253	cls.Ptr = cret
254	return cls
255}
256
257var xNewMediaFileForInputStream func(uintptr) uintptr
258
259// Creates a new media file to play @stream.
260//
261// If you want the resulting media to be seekable,
262// the stream should implement the `GSeekable` interface.
263func NewMediaFileForInputStream(StreamVar *gio.InputStream) *MediaFile {
264	var cls *MediaFile
265
266	cret := xNewMediaFileForInputStream(StreamVar.GoPointer())
267
268	if cret == 0 {
269		return nil
270	}
271	cls = &MediaFile{}
272	cls.Ptr = cret
273	return cls
274}
275
276var xNewMediaFileForResource func(string) uintptr
277
278// Creates a new new media file for the given resource.
279//
280// This is a utility function that converts the given @resource
281// to a `GFile` and calls [ctor@Gtk.MediaFile.new_for_file].
282func NewMediaFileForResource(ResourcePathVar string) *MediaFile {
283	var cls *MediaFile
284
285	cret := xNewMediaFileForResource(ResourcePathVar)
286
287	if cret == 0 {
288		return nil
289	}
290	cls = &MediaFile{}
291	cls.Ptr = cret
292	return cls
293}
294
295var xMediaFileClear func(uintptr)
296
297// Resets the media file to be empty.
298func (x *MediaFile) Clear() {
299
300	xMediaFileClear(x.GoPointer())
301
302}
303
304var xMediaFileGetFile func(uintptr) uintptr
305
306// Returns the file that @self is currently playing from.
307//
308// When @self is not playing or not playing from a file,
309// %NULL is returned.
310func (x *MediaFile) GetFile() *gio.FileBase {
311	var cls *gio.FileBase
312
313	cret := xMediaFileGetFile(x.GoPointer())
314
315	if cret == 0 {
316		return nil
317	}
318	gobject.IncreaseRef(cret)
319	cls = &gio.FileBase{}
320	cls.Ptr = cret
321	return cls
322}
323
324var xMediaFileGetInputStream func(uintptr) uintptr
325
326// Returns the stream that @self is currently playing from.
327//
328// When @self is not playing or not playing from a stream,
329// %NULL is returned.
330func (x *MediaFile) GetInputStream() *gio.InputStream {
331	var cls *gio.InputStream
332
333	cret := xMediaFileGetInputStream(x.GoPointer())
334
335	if cret == 0 {
336		return nil
337	}
338	gobject.IncreaseRef(cret)
339	cls = &gio.InputStream{}
340	cls.Ptr = cret
341	return cls
342}
343
344var xMediaFileSetFile func(uintptr, uintptr)
345
346// Sets the `GtkMediaFile` to play the given file.
347//
348// If any file is still playing, stop playing it.
349func (x *MediaFile) SetFile(FileVar gio.File) {
350
351	xMediaFileSetFile(x.GoPointer(), FileVar.GoPointer())
352
353}
354
355var xMediaFileSetFilename func(uintptr, uintptr)
356
357// Sets the `GtkMediaFile` to play the given file.
358//
359// This is a utility function that converts the given @filename
360// to a `GFile` and calls [method@Gtk.MediaFile.set_file].
361func (x *MediaFile) SetFilename(FilenameVar *string) {
362
363	FilenameVarPtr := core.GStrdupNullable(FilenameVar)
364	defer core.GFreeNullable(FilenameVarPtr)
365
366	xMediaFileSetFilename(x.GoPointer(), FilenameVarPtr)
367
368}
369
370var xMediaFileSetInputStream func(uintptr, uintptr)
371
372// Sets the `GtkMediaFile` to play the given stream.
373//
374// If anything is still playing, stop playing it.
375//
376// Full control about the @stream is assumed for the duration of
377// playback. The stream will not be closed.
378func (x *MediaFile) SetInputStream(StreamVar *gio.InputStream) {
379
380	xMediaFileSetInputStream(x.GoPointer(), StreamVar.GoPointer())
381
382}
383
384var xMediaFileSetResource func(uintptr, uintptr)
385
386// Sets the `GtkMediaFile` to play the given resource.
387//
388// This is a utility function that converts the given @resource_path
389// to a `GFile` and calls [method@Gtk.MediaFile.set_file].
390func (x *MediaFile) SetResource(ResourcePathVar *string) {
391
392	ResourcePathVarPtr := core.GStrdupNullable(ResourcePathVar)
393	defer core.GFreeNullable(ResourcePathVarPtr)
394
395	xMediaFileSetResource(x.GoPointer(), ResourcePathVarPtr)
396
397}
398
399func (c *MediaFile) GoPointer() uintptr {
400	if c == nil {
401		return 0
402	}
403	return c.Ptr
404}
405
406func (c *MediaFile) SetGoPointer(ptr uintptr) {
407	c.Ptr = ptr
408}
409
410// Compute a concrete size for the `GdkPaintable`.
411//
412// Applies the sizing algorithm outlined in the
413// [CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing)
414// to the given @paintable. See that link for more details.
415//
416// It is not necessary to call this function when both @specified_width
417// and @specified_height are known, but it is useful to call this
418// function in GtkWidget:measure implementations to compute the
419// other dimension when only one dimension is given.
420func (x *MediaFile) ComputeConcreteSize(SpecifiedWidthVar float64, SpecifiedHeightVar float64, DefaultWidthVar float64, DefaultHeightVar float64, ConcreteWidthVar *float64, ConcreteHeightVar *float64) {
421
422	gdk.XGdkPaintableComputeConcreteSize(x.GoPointer(), SpecifiedWidthVar, SpecifiedHeightVar, DefaultWidthVar, DefaultHeightVar, ConcreteWidthVar, ConcreteHeightVar)
423
424}
425
426// Gets an immutable paintable for the current contents displayed by @paintable.
427//
428// This is useful when you want to retain the current state of an animation,
429// for example to take a screenshot of a running animation.
430//
431// If the @paintable is already immutable, it will return itself.
432func (x *MediaFile) GetCurrentImage() *gdk.PaintableBase {
433	var cls *gdk.PaintableBase
434
435	cret := gdk.XGdkPaintableGetCurrentImage(x.GoPointer())
436
437	if cret == 0 {
438		return nil
439	}
440	cls = &gdk.PaintableBase{}
441	cls.Ptr = cret
442	return cls
443}
444
445// Get flags for the paintable.
446//
447// This is oftentimes useful for optimizations.
448//
449// See [flags@Gdk.PaintableFlags] for the flags and what they mean.
450func (x *MediaFile) GetFlags() gdk.PaintableFlags {
451
452	cret := gdk.XGdkPaintableGetFlags(x.GoPointer())
453	return cret
454}
455
456// Gets the preferred aspect ratio the @paintable would like to be displayed at.
457//
458// The aspect ratio is the width divided by the height, so a value of 0.5
459// means that the @paintable prefers to be displayed twice as high as it
460// is wide. Consumers of this interface can use this to preserve aspect
461// ratio when displaying the paintable.
462//
463// This is a purely informational value and does not in any way limit the
464// values that may be passed to [method@Gdk.Paintable.snapshot].
465//
466// Usually when a @paintable returns nonzero values from
467// [method@Gdk.Paintable.get_intrinsic_width] and
468// [method@Gdk.Paintable.get_intrinsic_height] the aspect ratio
469// should conform to those values, though that is not required.
470//
471// If the @paintable does not have a preferred aspect ratio,
472// it returns 0. Negative values are never returned.
473func (x *MediaFile) GetIntrinsicAspectRatio() float64 {
474
475	cret := gdk.XGdkPaintableGetIntrinsicAspectRatio(x.GoPointer())
476	return cret
477}
478
479// Gets the preferred height the @paintable would like to be displayed at.
480//
481// Consumers of this interface can use this to reserve enough space to draw
482// the paintable.
483//
484// This is a purely informational value and does not in any way limit the
485// values that may be passed to [method@Gdk.Paintable.snapshot].
486//
487// If the @paintable does not have a preferred height, it returns 0.
488// Negative values are never returned.
489func (x *MediaFile) GetIntrinsicHeight() int {
490
491	cret := gdk.XGdkPaintableGetIntrinsicHeight(x.GoPointer())
492	return cret
493}
494
495// Gets the preferred width the @paintable would like to be displayed at.
496//
497// Consumers of this interface can use this to reserve enough space to draw
498// the paintable.
499//
500// This is a purely informational value and does not in any way limit the
501// values that may be passed to [method@Gdk.Paintable.snapshot].
502//
503// If the @paintable does not have a preferred width, it returns 0.
504// Negative values are never returned.
505func (x *MediaFile) GetIntrinsicWidth() int {
506
507	cret := gdk.XGdkPaintableGetIntrinsicWidth(x.GoPointer())
508	return cret
509}
510
511// Called by implementations of `GdkPaintable` to invalidate their contents.
512//
513// Unless the contents are invalidated, implementations must guarantee that
514// multiple calls of [method@Gdk.Paintable.snapshot] produce the same output.
515//
516// This function will emit the [signal@Gdk.Paintable::invalidate-contents]
517// signal.
518//
519// If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag,
520// it must not call this function.
521func (x *MediaFile) InvalidateContents() {
522
523	gdk.XGdkPaintableInvalidateContents(x.GoPointer())
524
525}
526
527// Called by implementations of `GdkPaintable` to invalidate their size.
528//
529// As long as the size is not invalidated, @paintable must return the same
530// values for its intrinsic width, height and aspect ratio.
531//
532// This function will emit the [signal@Gdk.Paintable::invalidate-size]
533// signal.
534//
535// If a @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag,
536// it must not call this function.
537func (x *MediaFile) InvalidateSize() {
538
539	gdk.XGdkPaintableInvalidateSize(x.GoPointer())
540
541}
542
543// Snapshots the given paintable with the given @width and @height.
544//
545// The paintable is drawn at the current (0,0) offset of the @snapshot.
546// If @width and @height are not larger than zero, this function will
547// do nothing.
548func (x *MediaFile) Snapshot(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64) {
549
550	gdk.XGdkPaintableSnapshot(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar)
551
552}
553
554func init() {
555	core.SetPackageName("GTK", "gtk4")
556	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
557	var libs []uintptr
558	for _, libPath := range core.GetPaths("GTK") {
559		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
560		if err != nil {
561			panic(err)
562		}
563		libs = append(libs, lib)
564	}
565
566	core.PuregoSafeRegister(&xMediaFileGLibType, libs, "gtk_media_file_get_type")
567
568	core.PuregoSafeRegister(&xNewMediaFile, libs, "gtk_media_file_new")
569	core.PuregoSafeRegister(&xNewMediaFileForFile, libs, "gtk_media_file_new_for_file")
570	core.PuregoSafeRegister(&xNewMediaFileForFilename, libs, "gtk_media_file_new_for_filename")
571	core.PuregoSafeRegister(&xNewMediaFileForInputStream, libs, "gtk_media_file_new_for_input_stream")
572	core.PuregoSafeRegister(&xNewMediaFileForResource, libs, "gtk_media_file_new_for_resource")
573
574	core.PuregoSafeRegister(&xMediaFileClear, libs, "gtk_media_file_clear")
575	core.PuregoSafeRegister(&xMediaFileGetFile, libs, "gtk_media_file_get_file")
576	core.PuregoSafeRegister(&xMediaFileGetInputStream, libs, "gtk_media_file_get_input_stream")
577	core.PuregoSafeRegister(&xMediaFileSetFile, libs, "gtk_media_file_set_file")
578	core.PuregoSafeRegister(&xMediaFileSetFilename, libs, "gtk_media_file_set_filename")
579	core.PuregoSafeRegister(&xMediaFileSetInputStream, libs, "gtk_media_file_set_input_stream")
580	core.PuregoSafeRegister(&xMediaFileSetResource, libs, "gtk_media_file_set_resource")
581
582}

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