mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
Compare commits
52 Commits
new-sink
...
gluploader
Author | SHA1 | Date | |
---|---|---|---|
|
5e40079480 | ||
|
4b93d4d132 | ||
|
b7b99c20cf | ||
|
5775738f67 | ||
|
7159459160 | ||
|
00650a596f | ||
|
6a995e2143 | ||
|
01b3feb213 | ||
|
5b9e7eacba | ||
|
b37ab432d7 | ||
|
0410c6e9b5 | ||
|
3e0a0e0555 | ||
|
5b7b7085e4 | ||
|
044710f97e | ||
|
b83d500352 | ||
|
3fadf13125 | ||
|
f8fe49a809 | ||
|
264f0abb64 | ||
|
b330aa1ccd | ||
|
de8ecb8f82 | ||
|
a2bb927502 | ||
|
df728f383b | ||
|
c80d2e9fd6 | ||
|
5a00301935 | ||
|
46b5a6df96 | ||
|
f771e0320c | ||
|
72a64a41d9 | ||
|
2818d3c91b | ||
|
ffb481b52b | ||
|
c5c289d466 | ||
|
3074051b3d | ||
|
980e1d9e1a | ||
|
045e4fc2c4 | ||
|
4f27739287 | ||
|
52aa7710dc | ||
|
0e49eaec7e | ||
|
62a923a3c1 | ||
|
f59b937316 | ||
|
8c914d0555 | ||
|
d2fab16093 | ||
|
67e877af0f | ||
|
c825649a71 | ||
|
5101fce5a7 | ||
|
e0daf8435a | ||
|
9f18295728 | ||
|
8ce977505e | ||
|
8ac839c9aa | ||
|
8fa2036265 | ||
|
1d5bb1e6aa | ||
|
9ec87c1b58 | ||
|
16c0f8baae | ||
|
c94d21fc53 |
8
.github/workflows/flatpak-nightly.yml
vendored
8
.github/workflows/flatpak-nightly.yml
vendored
@@ -1,4 +1,5 @@
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
name: "Flatpak Nightly"
|
||||
@@ -6,6 +7,7 @@ jobs:
|
||||
flatpak:
|
||||
name: "Flatpak"
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 600
|
||||
container:
|
||||
image: bilelmoussaoui/flatpak-github-actions:gnome-nightly
|
||||
options: --privileged
|
||||
@@ -25,8 +27,12 @@ jobs:
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: arm64
|
||||
- name: Prepare Runtime
|
||||
run: |
|
||||
flatpak --system install -y --noninteractive flathub org.freedesktop.Sdk.Extension.rust-nightly/${{ matrix.arch }}/21.08
|
||||
flatpak --system install -y --noninteractive flathub org.freedesktop.Sdk.Extension.llvm13/${{ matrix.arch }}/21.08
|
||||
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
|
||||
name: "Build"
|
||||
name: Build
|
||||
with:
|
||||
bundle: com.github.rafostar.Clapper.flatpak
|
||||
manifest-path: pkgs/flatpak/com.github.rafostar.Clapper-nightly.json
|
||||
|
4
.github/workflows/flatpak.yml
vendored
4
.github/workflows/flatpak.yml
vendored
@@ -1,4 +1,5 @@
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@@ -10,8 +11,9 @@ jobs:
|
||||
flatpak:
|
||||
name: "Flatpak"
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 600
|
||||
container:
|
||||
image: bilelmoussaoui/flatpak-github-actions:gnome-41
|
||||
image: bilelmoussaoui/flatpak-github-actions:gnome-42
|
||||
options: --privileged
|
||||
strategy:
|
||||
matrix:
|
||||
|
10
.obs/workflows.yml
Normal file
10
.obs/workflows.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
rebuild_master:
|
||||
steps:
|
||||
- trigger_services:
|
||||
project: home:Rafostar
|
||||
package: clapper
|
||||
filters:
|
||||
event: push
|
||||
branches:
|
||||
only:
|
||||
- master
|
16
README.md
16
README.md
@@ -2,6 +2,8 @@
|
||||
[](https://github.com/Rafostar/clapper/actions/workflows/flatpak.yml)
|
||||
[](https://github.com/Rafostar/clapper/actions/workflows/flatpak-nightly.yml)
|
||||
[](https://crowdin.com/project/clapper)
|
||||
[](https://matrix.to/#/#clapper-player:matrix.org)
|
||||
[](https://liberapay.com/Clapper)
|
||||
|
||||
A GNOME media player built using [GJS](https://gitlab.gnome.org/GNOME/gjs) with [GTK4](https://www.gtk.org) toolkit.
|
||||
The media player uses [GStreamer](https://gstreamer.freedesktop.org/) as a media backend and renders everything via [OpenGL](https://www.opengl.org).
|
||||
@@ -38,17 +40,13 @@ List of patches used in this version can be found [here](https://github.com/Rafo
|
||||
<img width='240' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-en.png'/>
|
||||
</a>
|
||||
|
||||
## Packages
|
||||
#### Fedora & openSUSE
|
||||
Pre-built packages are available in [my repo](https://software.opensuse.org//download.html?project=home%3ARafostar&package=clapper) ([see status](https://build.opensuse.org/package/show/home:Rafostar/clapper)).<br>
|
||||
Those are automatically built on each git commit, and are thus considered unstable.
|
||||
## Packages in Linux Distributions
|
||||
[](https://repology.org/project/clapper/versions)
|
||||
|
||||
#### Arch Linux
|
||||
You can get Clapper from the AUR:
|
||||
* [clapper](https://aur.archlinux.org/packages/clapper) (stable version)
|
||||
* [clapper-git](https://aur.archlinux.org/packages/clapper-git)
|
||||
Pre-built RPM packages are also available in [my repo](https://software.opensuse.org//download.html?project=home%3ARafostar&package=clapper) ([see status](https://build.opensuse.org/package/show/home:Rafostar/clapper)).<br>
|
||||
Those are automatically built on each git commit, thus are considered unstable.
|
||||
|
||||
## Installation from source code
|
||||
## Installation from Source Code
|
||||
```sh
|
||||
meson builddir --prefix=/usr/local
|
||||
sudo meson install -C builddir
|
||||
|
4
lib/gst/clapper/gstclapper.c
vendored
4
lib/gst/clapper/gstclapper.c
vendored
@@ -3222,6 +3222,10 @@ gst_clapper_main (gpointer data)
|
||||
|
||||
_update_from_env (&self->use_playbin3, "GST_CLAPPER_USE_PLAYBIN3");
|
||||
|
||||
/* Takes precedence over `GST_CLAPPER_USE_PLAYBIN3` as it
|
||||
* influences element factory behavior */
|
||||
_update_from_env (&self->use_playbin3, "USE_PLAYBIN3");
|
||||
|
||||
if (self->use_playbin3) {
|
||||
GST_DEBUG_OBJECT (self, "playbin3 enabled");
|
||||
self->playbin = gst_element_factory_make ("playbin3", "playbin3");
|
||||
|
31
lib/gst/clapper/meson.build
vendored
31
lib/gst/clapper/meson.build
vendored
@@ -34,13 +34,36 @@ gstclapper_defines = [
|
||||
'-DGST_USE_UNSTABLE_API',
|
||||
'-DHAVE_GTK_GL',
|
||||
]
|
||||
gtk_deps = [gstgl_dep, gstglproto_dep]
|
||||
have_gtk_gl_windowing = false
|
||||
|
||||
if not get_option('lib')
|
||||
subdir_done()
|
||||
gtk4_dep = dependency('gtk4', required: true)
|
||||
|
||||
if not gtk4_dep.version().version_compare('>=4.0.0')
|
||||
error('GTK4 version on this system is too old')
|
||||
endif
|
||||
|
||||
if not gir.found()
|
||||
error('Clapper lib requires GI bindings to be compiled')
|
||||
if gst_gl_have_window_x11 and (gst_gl_have_platform_egl or gst_gl_have_platform_glx)
|
||||
gtk_x11_dep = dependency('gtk4-x11', required: false)
|
||||
if gtk_x11_dep.found()
|
||||
gtk_deps += gtk_x11_dep
|
||||
if gst_gl_have_platform_glx
|
||||
gtk_deps += gstglx11_dep
|
||||
endif
|
||||
have_gtk_gl_windowing = true
|
||||
endif
|
||||
endif
|
||||
|
||||
if gst_gl_have_window_wayland and gst_gl_have_platform_egl
|
||||
gtk_wayland_dep = dependency('gtk4-wayland', required: false)
|
||||
if gtk_wayland_dep.found()
|
||||
gtk_deps += [gtk_wayland_dep, gstglwayland_dep]
|
||||
have_gtk_gl_windowing = true
|
||||
endif
|
||||
endif
|
||||
|
||||
if gst_gl_have_platform_egl
|
||||
gtk_deps += gstglegl_dep
|
||||
endif
|
||||
|
||||
if not have_gtk_gl_windowing
|
||||
|
5
lib/gst/meson.build
vendored
5
lib/gst/meson.build
vendored
@@ -1,2 +1,5 @@
|
||||
subdir('clapper')
|
||||
if get_option('lib')
|
||||
subdir('clapper')
|
||||
endif
|
||||
|
||||
subdir('plugin')
|
||||
|
439
lib/gst/plugin/gstclapperimporter.c
vendored
Normal file
439
lib/gst/plugin/gstclapperimporter.c
vendored
Normal file
@@ -0,0 +1,439 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstclapperimporter.h"
|
||||
#include "gstgtkutils.h"
|
||||
|
||||
#define GST_CAT_DEFAULT gst_clapper_importer_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||
|
||||
#define parent_class gst_clapper_importer_parent_class
|
||||
G_DEFINE_TYPE (GstClapperImporter, gst_clapper_importer, GST_TYPE_OBJECT);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GstVideoOverlayRectangle *rectangle;
|
||||
|
||||
gint x, y;
|
||||
guint width, height;
|
||||
|
||||
gint index;
|
||||
gatomicrefcount ref_count;
|
||||
} GstClapperGdkOverlay;
|
||||
|
||||
static GstClapperGdkOverlay *
|
||||
gst_clapper_gdk_overlay_new (GdkTexture *texture, GstVideoOverlayRectangle *rectangle,
|
||||
gint x, gint y, guint width, guint height, guint index)
|
||||
{
|
||||
GstClapperGdkOverlay *overlay = g_slice_new (GstClapperGdkOverlay);
|
||||
|
||||
overlay->texture = g_object_ref (texture);
|
||||
overlay->rectangle = gst_video_overlay_rectangle_ref (rectangle);
|
||||
overlay->x = x;
|
||||
overlay->y = y;
|
||||
overlay->width = width;
|
||||
overlay->height = height;
|
||||
overlay->index = index;
|
||||
|
||||
g_atomic_ref_count_init (&overlay->ref_count);
|
||||
|
||||
return overlay;
|
||||
}
|
||||
|
||||
static GstClapperGdkOverlay *
|
||||
gst_clapper_gdk_overlay_ref (GstClapperGdkOverlay *overlay)
|
||||
{
|
||||
g_atomic_ref_count_inc (&overlay->ref_count);
|
||||
|
||||
return overlay;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gdk_overlay_unref (GstClapperGdkOverlay *overlay)
|
||||
{
|
||||
if (g_atomic_ref_count_dec (&overlay->ref_count)) {
|
||||
GST_TRACE ("Freeing overlay: %" GST_PTR_FORMAT, overlay);
|
||||
|
||||
g_object_unref (overlay->texture);
|
||||
gst_video_overlay_rectangle_unref (overlay->rectangle);
|
||||
g_slice_free (GstClapperGdkOverlay, overlay);
|
||||
}
|
||||
}
|
||||
|
||||
static GstBufferPool *
|
||||
_default_create_pool (GstClapperImporter *self, GstStructure **config)
|
||||
{
|
||||
GST_FIXME_OBJECT (self, "Need to create buffer pool");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
_default_generate_texture (GstClapperImporter *self,
|
||||
GstBuffer *buffer, GstVideoInfo *v_info)
|
||||
{
|
||||
GST_FIXME_OBJECT (self, "GdkTexture generation not implemented");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_importer_init (GstClapperImporter *self)
|
||||
{
|
||||
gst_video_info_init (&self->pending_v_info);
|
||||
gst_video_info_init (&self->v_info);
|
||||
|
||||
self->pending_overlays = g_ptr_array_new_with_free_func (
|
||||
(GDestroyNotify) gst_clapper_gdk_overlay_unref);
|
||||
self->overlays = g_ptr_array_new_with_free_func (
|
||||
(GDestroyNotify) gst_clapper_gdk_overlay_unref);
|
||||
|
||||
gdk_rgba_parse (&self->bg, "black");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_importer_finalize (GObject *object)
|
||||
{
|
||||
GstClapperImporter *self = GST_CLAPPER_IMPORTER_CAST (object);
|
||||
|
||||
GST_TRACE ("Finalize");
|
||||
|
||||
gst_clear_buffer (&self->pending_buffer);
|
||||
gst_clear_buffer (&self->buffer);
|
||||
|
||||
g_ptr_array_unref (self->pending_overlays);
|
||||
g_ptr_array_unref (self->overlays);
|
||||
|
||||
g_clear_object (&self->texture);
|
||||
|
||||
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_importer_class_init (GstClapperImporterClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstClapperImporterClass *importer_class = (GstClapperImporterClass *) klass;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clapperimporter", 0,
|
||||
"Clapper Importer");
|
||||
|
||||
gobject_class->finalize = gst_clapper_importer_finalize;
|
||||
|
||||
importer_class->create_pool = _default_create_pool;
|
||||
importer_class->generate_texture = _default_generate_texture;
|
||||
}
|
||||
|
||||
static GstClapperGdkOverlay *
|
||||
_get_cached_overlay (GPtrArray *overlays, GstVideoOverlayRectangle *rectangle)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < overlays->len; i++) {
|
||||
GstClapperGdkOverlay *overlay = g_ptr_array_index (overlays, i);
|
||||
|
||||
if (overlay->rectangle == rectangle)
|
||||
return overlay;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gint
|
||||
_sort_overlays_cb (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
GstClapperGdkOverlay *overlay_a, *overlay_b;
|
||||
|
||||
overlay_a = *((GstClapperGdkOverlay **) a);
|
||||
overlay_b = *((GstClapperGdkOverlay **) b);
|
||||
|
||||
return (overlay_a->index - overlay_b->index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepares overlays to show with the next rendered buffer.
|
||||
*
|
||||
* In order for overlays caching to work correctly, this should be called for
|
||||
* every received buffer (even if its going to be disgarded), also must be
|
||||
* called together with pending buffer replacement within a single importer
|
||||
* locking, to make sure prepared overlays always match the pending buffer.
|
||||
*/
|
||||
static void
|
||||
gst_clapper_importer_prepare_overlays_locked (GstClapperImporter *self)
|
||||
{
|
||||
GstVideoOverlayCompositionMeta *comp_meta;
|
||||
guint num_overlays, i;
|
||||
|
||||
if (G_UNLIKELY (!self->pending_buffer)
|
||||
|| !(comp_meta = gst_buffer_get_video_overlay_composition_meta (self->pending_buffer))) {
|
||||
guint n_pending = self->pending_overlays->len;
|
||||
|
||||
/* Remove all cached overlays if new buffer does not have any */
|
||||
if (n_pending > 0) {
|
||||
GST_TRACE ("No overlays in buffer, removing all cached ones");
|
||||
g_ptr_array_remove_range (self->pending_overlays, 0, n_pending);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (self, "Preparing overlays...");
|
||||
|
||||
/* Mark all old overlays as unused by giving them negative index */
|
||||
for (i = 0; i < self->pending_overlays->len; i++) {
|
||||
GstClapperGdkOverlay *overlay = g_ptr_array_index (self->pending_overlays, i);
|
||||
overlay->index = -1;
|
||||
}
|
||||
|
||||
num_overlays = gst_video_overlay_composition_n_rectangles (comp_meta->overlay);
|
||||
|
||||
for (i = 0; i < num_overlays; i++) {
|
||||
GdkTexture *texture;
|
||||
GstBuffer *comp_buffer;
|
||||
GstVideoFrame comp_frame;
|
||||
GstVideoMeta *v_meta;
|
||||
GstVideoInfo v_info;
|
||||
GstVideoOverlayRectangle *rectangle;
|
||||
GstClapperGdkOverlay *overlay;
|
||||
GstVideoOverlayFormatFlags flags, alpha_flags = 0;
|
||||
gint comp_x, comp_y;
|
||||
guint comp_width, comp_height;
|
||||
|
||||
rectangle = gst_video_overlay_composition_get_rectangle (comp_meta->overlay, i);
|
||||
|
||||
if ((overlay = _get_cached_overlay (self->pending_overlays, rectangle))) {
|
||||
overlay->index = i;
|
||||
|
||||
GST_TRACE ("Reusing cached overlay: %" GST_PTR_FORMAT, overlay);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (!gst_video_overlay_rectangle_get_render_rectangle (rectangle,
|
||||
&comp_x, &comp_y, &comp_width, &comp_height))) {
|
||||
GST_WARNING ("Invalid overlay rectangle dimensions: %" GST_PTR_FORMAT, rectangle);
|
||||
continue;
|
||||
}
|
||||
|
||||
flags = gst_video_overlay_rectangle_get_flags (rectangle);
|
||||
|
||||
if (flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA)
|
||||
alpha_flags |= GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA;
|
||||
|
||||
comp_buffer = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rectangle, alpha_flags);
|
||||
|
||||
/* Update overlay video info from video meta */
|
||||
if ((v_meta = gst_buffer_get_video_meta (comp_buffer))) {
|
||||
gst_video_info_set_format (&v_info, v_meta->format, v_meta->width, v_meta->height);
|
||||
v_info.stride[0] = v_meta->stride[0];
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (!gst_video_frame_map (&comp_frame, &v_info, comp_buffer, GST_MAP_READ)))
|
||||
return;
|
||||
|
||||
if ((texture = gst_video_frame_into_gdk_texture (&comp_frame))) {
|
||||
overlay = gst_clapper_gdk_overlay_new (texture, rectangle, comp_x, comp_y,
|
||||
comp_width, comp_height, i);
|
||||
g_object_unref (texture);
|
||||
|
||||
GST_TRACE_OBJECT (self, "Created overlay: %"
|
||||
GST_PTR_FORMAT ", x: %i, y: %i, width: %u, height: %u",
|
||||
overlay, overlay->x, overlay->y, overlay->width, overlay->height);
|
||||
|
||||
g_ptr_array_insert (self->pending_overlays, i, overlay);
|
||||
}
|
||||
|
||||
gst_video_frame_unmap (&comp_frame);
|
||||
}
|
||||
|
||||
/* Remove all overlays that are not going to be used */
|
||||
for (i = self->pending_overlays->len; i > 0; i--) {
|
||||
GstClapperGdkOverlay *overlay = g_ptr_array_index (self->pending_overlays, i - 1);
|
||||
|
||||
if (overlay->index < 0) {
|
||||
GST_TRACE ("Removing unused cached overlay: %" GST_PTR_FORMAT, overlay);
|
||||
g_ptr_array_remove (self->pending_overlays, overlay);
|
||||
}
|
||||
}
|
||||
|
||||
/* Sort remaining overlays */
|
||||
if (self->pending_overlays->len > 1) {
|
||||
GST_LOG_OBJECT (self, "Sorting overlays");
|
||||
g_ptr_array_sort (self->pending_overlays, (GCompareFunc) _sort_overlays_cb);
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (num_overlays != self->pending_overlays->len)) {
|
||||
GST_WARNING_OBJECT (self, "Some overlays could not be prepared, %u != %u",
|
||||
num_overlays, self->pending_overlays->len);
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (self, "Prepared overlays: %u", self->pending_overlays->len);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_clapper_importer_prepare (GstClapperImporter *self)
|
||||
{
|
||||
GstClapperImporterClass *importer_class = GST_CLAPPER_IMPORTER_GET_CLASS (self);
|
||||
|
||||
if (importer_class->prepare) {
|
||||
if (!importer_class->prepare (self))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Importer prepared");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_importer_share_data (GstClapperImporter *self, GstClapperImporter *dest)
|
||||
{
|
||||
GstClapperImporterClass *importer_class = GST_CLAPPER_IMPORTER_GET_CLASS (self);
|
||||
|
||||
if (importer_class->share_data)
|
||||
importer_class->share_data (self, dest);
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_importer_set_caps (GstClapperImporter *self, GstCaps *caps)
|
||||
{
|
||||
GstClapperImporterClass *importer_class = GST_CLAPPER_IMPORTER_GET_CLASS (self);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
self->has_pending_v_info = gst_video_info_from_caps (&self->pending_v_info, caps);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
if (importer_class->set_caps)
|
||||
importer_class->set_caps (self, caps);
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_importer_set_buffer (GstClapperImporter *self, GstBuffer *buffer)
|
||||
{
|
||||
/* Both overlays and pending buffer must be
|
||||
* set within a single importer locking */
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
gst_buffer_replace (&self->pending_buffer, buffer);
|
||||
gst_clapper_importer_prepare_overlays_locked (self);
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
}
|
||||
|
||||
GstBufferPool *
|
||||
gst_clapper_importer_create_pool (GstClapperImporter *self, GstStructure **config)
|
||||
{
|
||||
GstClapperImporterClass *importer_class = GST_CLAPPER_IMPORTER_GET_CLASS (self);
|
||||
|
||||
return importer_class->create_pool (self, config);
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_importer_add_allocation_metas (GstClapperImporter *self, GstQuery *query)
|
||||
{
|
||||
GstClapperImporterClass *importer_class = GST_CLAPPER_IMPORTER_GET_CLASS (self);
|
||||
|
||||
if (importer_class->add_allocation_metas)
|
||||
importer_class->add_allocation_metas (self, query);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_clapper_importer_handle_context_query (GstClapperImporter *self,
|
||||
GstBaseSink *bsink, GstQuery *query)
|
||||
{
|
||||
GstClapperImporterClass *importer_class = GST_CLAPPER_IMPORTER_GET_CLASS (self);
|
||||
|
||||
if (!importer_class->handle_context_query)
|
||||
return FALSE;
|
||||
|
||||
return importer_class->handle_context_query (self, bsink, query);
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_importer_snapshot (GstClapperImporter *self, GdkSnapshot *snapshot,
|
||||
gdouble width, gdouble height, gfloat scale_x, gfloat scale_y)
|
||||
{
|
||||
guint i;
|
||||
gboolean buffer_changed;
|
||||
|
||||
/* Collect all data that we need to snapshot pending buffer,
|
||||
* lock ourselves to make sure everything matches */
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
buffer_changed = gst_buffer_replace (&self->buffer, self->pending_buffer);
|
||||
|
||||
/* Only replace v_info when buffer changed, this way
|
||||
* we still use old (correct) v_info when resizing */
|
||||
if (buffer_changed && self->has_pending_v_info) {
|
||||
self->v_info = self->pending_v_info;
|
||||
self->has_pending_v_info = FALSE;
|
||||
}
|
||||
|
||||
/* Ref overlays associated with current buffer */
|
||||
for (i = 0; i < self->pending_overlays->len; i++) {
|
||||
GstClapperGdkOverlay *overlay = g_ptr_array_index (self->pending_overlays, i);
|
||||
|
||||
g_ptr_array_insert (self->overlays, i, gst_clapper_gdk_overlay_ref (overlay));
|
||||
}
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
/* Draw black BG when no buffer or imported format has alpha */
|
||||
if (!self->buffer || GST_VIDEO_INFO_HAS_ALPHA (&self->v_info))
|
||||
gtk_snapshot_append_color (snapshot, &self->bg, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
if (self->buffer) {
|
||||
if (buffer_changed || !self->texture) {
|
||||
GstClapperImporterClass *importer_class = GST_CLAPPER_IMPORTER_GET_CLASS (self);
|
||||
|
||||
GST_TRACE_OBJECT (self, "Importing %" GST_PTR_FORMAT, self->buffer);
|
||||
|
||||
g_clear_object (&self->texture);
|
||||
self->texture = importer_class->generate_texture (self, self->buffer, &self->v_info);
|
||||
} else {
|
||||
GST_TRACE_OBJECT (self, "Reusing texture from %" GST_PTR_FORMAT, self->buffer);
|
||||
}
|
||||
|
||||
if (G_LIKELY (self->texture)) {
|
||||
gtk_snapshot_append_texture (snapshot, self->texture, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
for (i = 0; i < self->overlays->len; i++) {
|
||||
GstClapperGdkOverlay *overlay = g_ptr_array_index (self->overlays, i);
|
||||
|
||||
gtk_snapshot_append_texture (snapshot, overlay->texture,
|
||||
&GRAPHENE_RECT_INIT (overlay->x * scale_x, overlay->y * scale_y,
|
||||
overlay->width * scale_x, overlay->height * scale_y));
|
||||
}
|
||||
} else {
|
||||
GST_ERROR_OBJECT (self, "Failed import of %" GST_PTR_FORMAT, self->buffer);
|
||||
|
||||
/* Draw black instead of texture on failure if not drawn already */
|
||||
if (!GST_VIDEO_INFO_HAS_ALPHA (&self->v_info))
|
||||
gtk_snapshot_append_color (snapshot, &self->bg, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
}
|
||||
}
|
||||
|
||||
/* Unref all used overlays */
|
||||
if (self->overlays->len > 0)
|
||||
g_ptr_array_remove_range (self->overlays, 0, self->overlays->len);
|
||||
}
|
102
lib/gst/plugin/gstclapperimporter.h
vendored
Normal file
102
lib/gst/plugin/gstclapperimporter.h
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_CLAPPER_IMPORTER (gst_clapper_importer_get_type())
|
||||
#define GST_IS_CLAPPER_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CLAPPER_IMPORTER))
|
||||
#define GST_IS_CLAPPER_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CLAPPER_IMPORTER))
|
||||
#define GST_CLAPPER_IMPORTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CLAPPER_IMPORTER, GstClapperImporterClass))
|
||||
#define GST_CLAPPER_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CLAPPER_IMPORTER, GstClapperImporter))
|
||||
#define GST_CLAPPER_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CLAPPER_IMPORTER, GstClapperImporterClass))
|
||||
#define GST_CLAPPER_IMPORTER_CAST(obj) ((GstClapperImporter *)(obj))
|
||||
|
||||
#define GST_CLAPPER_IMPORTER_DEFINE(camel,lower,type) \
|
||||
G_DEFINE_TYPE (camel, lower, type) \
|
||||
G_MODULE_EXPORT GstClapperImporter *make_importer (void); \
|
||||
G_MODULE_EXPORT GstCaps *make_caps (GstRank *rank, GStrv *context_types);
|
||||
|
||||
typedef struct _GstClapperImporter GstClapperImporter;
|
||||
typedef struct _GstClapperImporterClass GstClapperImporterClass;
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GstClapperImporter, gst_object_unref)
|
||||
#endif
|
||||
|
||||
struct _GstClapperImporter
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
GstBuffer *pending_buffer, *buffer;
|
||||
GPtrArray *pending_overlays, *overlays;
|
||||
GstVideoInfo pending_v_info, v_info;
|
||||
gboolean has_pending_v_info;
|
||||
|
||||
GdkTexture *texture;
|
||||
|
||||
GdkRGBA bg;
|
||||
};
|
||||
|
||||
struct _GstClapperImporterClass
|
||||
{
|
||||
GstObjectClass parent_class;
|
||||
|
||||
gboolean (* prepare) (GstClapperImporter *importer);
|
||||
|
||||
void (* share_data) (GstClapperImporter *src,
|
||||
GstClapperImporter *dest);
|
||||
|
||||
void (* set_caps) (GstClapperImporter *importer,
|
||||
GstCaps *caps);
|
||||
|
||||
gboolean (* handle_context_query) (GstClapperImporter *importer,
|
||||
GstBaseSink *bsink,
|
||||
GstQuery *query);
|
||||
|
||||
GstBufferPool * (* create_pool) (GstClapperImporter *importer,
|
||||
GstStructure **config);
|
||||
|
||||
void (* add_allocation_metas) (GstClapperImporter *importer,
|
||||
GstQuery *query);
|
||||
|
||||
GdkTexture * (* generate_texture) (GstClapperImporter *importer,
|
||||
GstBuffer *buffer,
|
||||
GstVideoInfo *v_info);
|
||||
};
|
||||
|
||||
GType gst_clapper_importer_get_type (void);
|
||||
|
||||
gboolean gst_clapper_importer_prepare (GstClapperImporter *importer);
|
||||
void gst_clapper_importer_share_data (GstClapperImporter *importer, GstClapperImporter *dest);
|
||||
gboolean gst_clapper_importer_handle_context_query (GstClapperImporter *importer, GstBaseSink *bsink, GstQuery *query);
|
||||
GstBufferPool * gst_clapper_importer_create_pool (GstClapperImporter *importer, GstStructure **config);
|
||||
void gst_clapper_importer_add_allocation_metas (GstClapperImporter *importer, GstQuery *query);
|
||||
|
||||
void gst_clapper_importer_set_caps (GstClapperImporter *importer, GstCaps *caps);
|
||||
void gst_clapper_importer_set_buffer (GstClapperImporter *importer, GstBuffer *buffer);
|
||||
|
||||
void gst_clapper_importer_snapshot (GstClapperImporter *importer, GdkSnapshot *snapshot, gdouble width, gdouble height, gfloat scale_x, gfloat scale_y);
|
||||
|
||||
G_END_DECLS
|
417
lib/gst/plugin/gstclapperimporterloader.c
vendored
Normal file
417
lib/gst/plugin/gstclapperimporterloader.c
vendored
Normal file
@@ -0,0 +1,417 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
#include "gstclapperimporterloader.h"
|
||||
#include "gstclapperimporter.h"
|
||||
|
||||
#define GST_CAT_DEFAULT gst_clapper_importer_loader_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||
|
||||
typedef GstClapperImporter* (* MakeImporter) (void);
|
||||
typedef GstCaps* (* MakeCaps) (GstRank *rank, GStrv *context_types);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *module_path;
|
||||
GModule *open_module;
|
||||
GstCaps *caps;
|
||||
GstRank rank;
|
||||
GStrv context_types;
|
||||
} GstClapperImporterData;
|
||||
|
||||
static void
|
||||
gst_clapper_importer_data_free (GstClapperImporterData *data)
|
||||
{
|
||||
g_free (data->module_path);
|
||||
|
||||
if (data->open_module)
|
||||
g_module_close (data->open_module);
|
||||
|
||||
gst_clear_caps (&data->caps);
|
||||
g_strfreev (data->context_types);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_open_importer (GstClapperImporterData *data)
|
||||
{
|
||||
g_return_val_if_fail (data && data->module_path, FALSE);
|
||||
|
||||
/* Already open */
|
||||
if (data->open_module)
|
||||
return TRUE;
|
||||
|
||||
GST_DEBUG ("Opening module: %s", data->module_path);
|
||||
data->open_module = g_module_open (data->module_path, G_MODULE_BIND_LAZY);
|
||||
|
||||
if (!data->open_module) {
|
||||
GST_WARNING ("Could not load importer: %s, reason: %s",
|
||||
data->module_path, g_module_error ());
|
||||
return FALSE;
|
||||
}
|
||||
GST_DEBUG ("Opened importer module");
|
||||
|
||||
/* Make sure module stays loaded. Seems to be needed for
|
||||
* reusing exported symbols from the same module again */
|
||||
g_module_make_resident (data->open_module);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_close_importer (GstClapperImporterData *data)
|
||||
{
|
||||
if (!data || !data->open_module)
|
||||
return;
|
||||
|
||||
if (G_LIKELY (g_module_close (data->open_module)))
|
||||
GST_DEBUG ("Closed module: %s", data->module_path);
|
||||
else
|
||||
GST_WARNING ("Could not close importer module");
|
||||
|
||||
data->open_module = NULL;
|
||||
}
|
||||
|
||||
static GstClapperImporter *
|
||||
_obtain_importer_internal (GstClapperImporterData *data)
|
||||
{
|
||||
MakeImporter make_importer;
|
||||
GstClapperImporter *importer = NULL;
|
||||
|
||||
if (!_open_importer (data))
|
||||
goto finish;
|
||||
|
||||
if (!g_module_symbol (data->open_module, "make_importer", (gpointer *) &make_importer)
|
||||
|| make_importer == NULL) {
|
||||
GST_WARNING ("Make function missing in importer");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Do not close the module, we are gonna continue using it */
|
||||
if ((importer = make_importer ()))
|
||||
goto finish;
|
||||
|
||||
fail:
|
||||
_close_importer (data);
|
||||
|
||||
finish:
|
||||
return importer;
|
||||
}
|
||||
|
||||
static GstClapperImporterData *
|
||||
_fill_importer_data (const gchar *module_path)
|
||||
{
|
||||
MakeCaps make_caps;
|
||||
GstClapperImporterData *data;
|
||||
|
||||
data = g_new0 (GstClapperImporterData, 1);
|
||||
data->module_path = g_strdup (module_path);
|
||||
data->open_module = g_module_open (data->module_path, G_MODULE_BIND_LAZY);
|
||||
|
||||
if (!data->open_module)
|
||||
goto fail;
|
||||
|
||||
if (!g_module_symbol (data->open_module, "make_caps", (gpointer *) &make_caps)
|
||||
|| make_caps == NULL) {
|
||||
GST_WARNING ("Make caps function missing in importer");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
data->caps = make_caps (&data->rank, &data->context_types);
|
||||
GST_DEBUG ("Caps reading %ssuccessful", data->caps ? "" : "un");
|
||||
|
||||
if (!data->caps)
|
||||
goto fail;
|
||||
|
||||
/* Once we obtain importer data, close module afterwards */
|
||||
_close_importer (data);
|
||||
|
||||
return data;
|
||||
|
||||
fail:
|
||||
gst_clapper_importer_data_free (data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gint
|
||||
_sort_importers_cb (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
GstClapperImporterData *data_a, *data_b;
|
||||
|
||||
data_a = *((GstClapperImporterData **) a);
|
||||
data_b = *((GstClapperImporterData **) b);
|
||||
|
||||
return (data_b->rank - data_a->rank);
|
||||
}
|
||||
|
||||
static gpointer
|
||||
_obtain_available_importers (G_GNUC_UNUSED gpointer data)
|
||||
{
|
||||
GPtrArray *importers;
|
||||
GFile *dir;
|
||||
GFileEnumerator *dir_enum;
|
||||
GError *error = NULL;
|
||||
|
||||
importers = g_ptr_array_new_with_free_func (
|
||||
(GDestroyNotify) gst_clapper_importer_data_free);
|
||||
|
||||
GST_INFO ("Checking available clapper sink importers");
|
||||
|
||||
dir = g_file_new_for_path (CLAPPER_SINK_IMPORTER_PATH);
|
||||
|
||||
if ((dir_enum = g_file_enumerate_children (dir,
|
||||
G_FILE_ATTRIBUTE_STANDARD_NAME,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error))) {
|
||||
while (TRUE) {
|
||||
GFileInfo *info = NULL;
|
||||
GstClapperImporterData *data;
|
||||
gchar *module_path;
|
||||
const gchar *module_name;
|
||||
|
||||
if (!g_file_enumerator_iterate (dir_enum, &info,
|
||||
NULL, NULL, &error) || !info)
|
||||
break;
|
||||
|
||||
module_name = g_file_info_get_name (info);
|
||||
|
||||
if (!g_str_has_suffix (module_name, G_MODULE_SUFFIX))
|
||||
continue;
|
||||
|
||||
module_path = g_module_build_path (CLAPPER_SINK_IMPORTER_PATH, module_name);
|
||||
data = _fill_importer_data (module_path);
|
||||
g_free (module_path);
|
||||
|
||||
if (!data) {
|
||||
GST_WARNING ("Could not read importer data: %s", module_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
GST_INFO ("Found importer: %s, caps: %" GST_PTR_FORMAT, module_name, data->caps);
|
||||
g_ptr_array_add (importers, data);
|
||||
}
|
||||
|
||||
g_object_unref (dir_enum);
|
||||
}
|
||||
|
||||
g_object_unref (dir);
|
||||
|
||||
if (error) {
|
||||
GST_ERROR ("Could not load importer, reason: %s",
|
||||
(error->message) ? error->message : "unknown");
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_ptr_array_sort (importers, (GCompareFunc) _sort_importers_cb);
|
||||
|
||||
return importers;
|
||||
}
|
||||
|
||||
static const GPtrArray *
|
||||
gst_clapper_importer_loader_get_available_importers (void)
|
||||
{
|
||||
static GOnce once = G_ONCE_INIT;
|
||||
|
||||
g_once (&once, _obtain_available_importers, NULL);
|
||||
return (const GPtrArray *) once.retval;
|
||||
}
|
||||
|
||||
static GstClapperImporterData *
|
||||
_find_open_importer_data (const GPtrArray *importers)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < importers->len; i++) {
|
||||
GstClapperImporterData *data = g_ptr_array_index (importers, i);
|
||||
|
||||
if (data->open_module)
|
||||
return data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GstClapperImporterData *
|
||||
_get_importer_data_for_caps (const GPtrArray *importers, const GstCaps *caps)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < importers->len; i++) {
|
||||
GstClapperImporterData *data = g_ptr_array_index (importers, i);
|
||||
|
||||
if (!gst_caps_is_always_compatible (caps, data->caps))
|
||||
continue;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GstClapperImporterData *
|
||||
_get_importer_data_for_context_type (const GPtrArray *importers, const gchar *context_type)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < importers->len; i++) {
|
||||
GstClapperImporterData *data = g_ptr_array_index (importers, i);
|
||||
guint j;
|
||||
|
||||
if (!data->context_types)
|
||||
continue;
|
||||
|
||||
for (j = 0; data->context_types[j]; j++) {
|
||||
if (strcmp (context_type, data->context_types[j]))
|
||||
continue;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_importer_loader_unload_all (void)
|
||||
{
|
||||
const GPtrArray *importers;
|
||||
guint i;
|
||||
|
||||
importers = gst_clapper_importer_loader_get_available_importers ();
|
||||
GST_TRACE ("Unloading all open modules");
|
||||
|
||||
for (i = 0; i < importers->len; i++) {
|
||||
GstClapperImporterData *data = g_ptr_array_index (importers, i);
|
||||
|
||||
_close_importer (data);
|
||||
}
|
||||
}
|
||||
|
||||
GstPadTemplate *
|
||||
gst_clapper_importer_loader_make_sink_pad_template (void)
|
||||
{
|
||||
const GPtrArray *importers;
|
||||
GstCaps *sink_caps;
|
||||
GstPadTemplate *templ;
|
||||
guint i;
|
||||
|
||||
/* This is only called once from sink class init function */
|
||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clapperimporterloader", 0,
|
||||
"Clapper Importer Loader");
|
||||
|
||||
importers = gst_clapper_importer_loader_get_available_importers ();
|
||||
sink_caps = gst_caps_new_empty ();
|
||||
|
||||
for (i = 0; i < importers->len; i++) {
|
||||
GstClapperImporterData *data = g_ptr_array_index (importers, i);
|
||||
GstCaps *copied_caps;
|
||||
|
||||
copied_caps = gst_caps_copy (data->caps);
|
||||
gst_caps_append (sink_caps, copied_caps);
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (gst_caps_is_empty (sink_caps)))
|
||||
gst_caps_append (sink_caps, gst_caps_new_any ());
|
||||
|
||||
templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, sink_caps);
|
||||
gst_caps_unref (sink_caps);
|
||||
|
||||
return templ;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_find_importer_internal (GstCaps *caps, GstQuery *query, GstClapperImporter **importer)
|
||||
{
|
||||
const GPtrArray *importers;
|
||||
GstClapperImporterData *old_data = NULL, *new_data = NULL;
|
||||
GstClapperImporter *found_importer = NULL;
|
||||
|
||||
importers = gst_clapper_importer_loader_get_available_importers ();
|
||||
old_data = _find_open_importer_data (importers);
|
||||
|
||||
if (caps) {
|
||||
GST_DEBUG ("Requested importer for caps: %" GST_PTR_FORMAT, caps);
|
||||
new_data = _get_importer_data_for_caps (importers, caps);
|
||||
} else if (query) {
|
||||
const gchar *context_type;
|
||||
|
||||
gst_query_parse_context_type (query, &context_type);
|
||||
|
||||
GST_DEBUG ("Requested importer for context: %s", context_type);
|
||||
new_data = _get_importer_data_for_context_type (importers, context_type);
|
||||
|
||||
/* In case missing importer for context query, leave the old one.
|
||||
* We should allow some queries to go through unresponded */
|
||||
if (!new_data)
|
||||
new_data = old_data;
|
||||
}
|
||||
GST_LOG ("Old importer path: %s, new path: %s",
|
||||
(old_data != NULL) ? old_data->module_path : NULL,
|
||||
(new_data != NULL) ? new_data->module_path : NULL);
|
||||
|
||||
if (old_data == new_data) {
|
||||
GST_DEBUG ("No importer change");
|
||||
|
||||
if (*importer && caps)
|
||||
gst_clapper_importer_set_caps (*importer, caps);
|
||||
|
||||
return (*importer != NULL);
|
||||
}
|
||||
|
||||
if (new_data) {
|
||||
found_importer = _obtain_importer_internal (new_data);
|
||||
|
||||
if (*importer && found_importer)
|
||||
gst_clapper_importer_share_data (*importer, found_importer);
|
||||
}
|
||||
|
||||
gst_clear_object (importer);
|
||||
_close_importer (old_data);
|
||||
|
||||
if (found_importer && gst_clapper_importer_prepare (found_importer)) {
|
||||
if (caps)
|
||||
gst_clapper_importer_set_caps (found_importer, caps);
|
||||
|
||||
*importer = found_importer;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gst_clear_object (&found_importer);
|
||||
_close_importer (new_data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_clapper_importer_loader_find_importer_for_caps (GstCaps *caps, GstClapperImporter **importer)
|
||||
{
|
||||
return _find_importer_internal (caps, NULL, importer);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_clapper_importer_loader_find_importer_for_context_query (GstQuery *query, GstClapperImporter **importer)
|
||||
{
|
||||
return _find_importer_internal (NULL, query, importer);
|
||||
}
|
36
lib/gst/plugin/gstclapperimporterloader.h
vendored
Normal file
36
lib/gst/plugin/gstclapperimporterloader.h
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "gstclapperimporter.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GstPadTemplate * gst_clapper_importer_loader_make_sink_pad_template (void);
|
||||
|
||||
gboolean gst_clapper_importer_loader_find_importer_for_caps (GstCaps *caps, GstClapperImporter **importer);
|
||||
|
||||
gboolean gst_clapper_importer_loader_find_importer_for_context_query (GstQuery *query, GstClapperImporter **importer);
|
||||
|
||||
void gst_clapper_importer_loader_unload_all (void);
|
||||
|
||||
G_END_DECLS
|
428
lib/gst/plugin/gstclapperpaintable.c
vendored
Normal file
428
lib/gst/plugin/gstclapperpaintable.c
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstclapperpaintable.h"
|
||||
|
||||
#define DEFAULT_PAR_N 1
|
||||
#define DEFAULT_PAR_D 1
|
||||
|
||||
#define GST_CAT_DEFAULT gst_clapper_paintable_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||
|
||||
static void gst_clapper_paintable_iface_init (GdkPaintableInterface *iface);
|
||||
static void gst_clapper_paintable_dispose (GObject *object);
|
||||
static void gst_clapper_paintable_finalize (GObject *object);
|
||||
|
||||
#define parent_class gst_clapper_paintable_parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstClapperPaintable, gst_clapper_paintable, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
gst_clapper_paintable_iface_init));
|
||||
|
||||
static void
|
||||
gst_clapper_paintable_class_init (GstClapperPaintableClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clapperpaintable", 0,
|
||||
"Clapper Paintable");
|
||||
|
||||
gobject_class->dispose = gst_clapper_paintable_dispose;
|
||||
gobject_class->finalize = gst_clapper_paintable_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_paintable_init (GstClapperPaintable *self)
|
||||
{
|
||||
self->par_n = DEFAULT_PAR_N;
|
||||
self->par_d = DEFAULT_PAR_D;
|
||||
self->pixel_aspect = ((gdouble) self->par_d / self->par_n);
|
||||
|
||||
g_mutex_init (&self->lock);
|
||||
gst_video_info_init (&self->v_info);
|
||||
g_weak_ref_init (&self->widget, NULL);
|
||||
g_weak_ref_init (&self->importer, NULL);
|
||||
|
||||
gdk_rgba_parse (&self->bg, "black");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_paintable_dispose (GObject *object)
|
||||
{
|
||||
GstClapperPaintable *self = GST_CLAPPER_PAINTABLE (object);
|
||||
|
||||
GST_CLAPPER_PAINTABLE_LOCK (self);
|
||||
|
||||
if (self->draw_id > 0) {
|
||||
g_source_remove (self->draw_id);
|
||||
self->draw_id = 0;
|
||||
}
|
||||
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
|
||||
GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_paintable_finalize (GObject *object)
|
||||
{
|
||||
GstClapperPaintable *self = GST_CLAPPER_PAINTABLE (object);
|
||||
|
||||
GST_TRACE ("Finalize");
|
||||
|
||||
g_weak_ref_clear (&self->widget);
|
||||
g_weak_ref_clear (&self->importer);
|
||||
g_mutex_clear (&self->lock);
|
||||
|
||||
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
calculate_display_par (GstClapperPaintable *self, const GstVideoInfo *info)
|
||||
{
|
||||
gint width, height, par_n, par_d, req_par_n, req_par_d;
|
||||
gboolean success;
|
||||
|
||||
width = GST_VIDEO_INFO_WIDTH (info);
|
||||
height = GST_VIDEO_INFO_HEIGHT (info);
|
||||
|
||||
/* Cannot apply aspect ratio if there is no video */
|
||||
if (width == 0 || height == 0)
|
||||
return FALSE;
|
||||
|
||||
par_n = GST_VIDEO_INFO_PAR_N (info);
|
||||
par_d = GST_VIDEO_INFO_PAR_D (info);
|
||||
|
||||
req_par_n = self->par_n;
|
||||
req_par_d = self->par_d;
|
||||
|
||||
if (par_n == 0)
|
||||
par_n = 1;
|
||||
|
||||
/* Use defaults if user set zero */
|
||||
if (req_par_n == 0 || req_par_d == 0) {
|
||||
req_par_n = DEFAULT_PAR_N;
|
||||
req_par_d = DEFAULT_PAR_D;
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (self, "PAR: %u/%u, DAR: %u/%u", par_n, par_d, req_par_n, req_par_d);
|
||||
|
||||
if (!(success = gst_video_calculate_display_ratio (&self->display_ratio_num,
|
||||
&self->display_ratio_den, width, height, par_n, par_d,
|
||||
req_par_n, req_par_d))) {
|
||||
GST_ERROR_OBJECT (self, "Could not calculate display ratio values");
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
invalidate_paintable_size_internal (GstClapperPaintable *self)
|
||||
{
|
||||
gint video_width, video_height;
|
||||
guint display_ratio_num, display_ratio_den;
|
||||
|
||||
GST_CLAPPER_PAINTABLE_LOCK (self);
|
||||
|
||||
video_width = GST_VIDEO_INFO_WIDTH (&self->v_info);
|
||||
video_height = GST_VIDEO_INFO_HEIGHT (&self->v_info);
|
||||
|
||||
display_ratio_num = self->display_ratio_num;
|
||||
display_ratio_den = self->display_ratio_den;
|
||||
|
||||
self->pixel_aspect = ((gdouble) self->par_d / self->par_n);
|
||||
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
|
||||
if (video_height % display_ratio_den == 0) {
|
||||
GST_LOG ("Keeping video height");
|
||||
|
||||
self->display_width = (guint)
|
||||
gst_util_uint64_scale_int (video_height, display_ratio_num, display_ratio_den);
|
||||
self->display_height = video_height;
|
||||
} else if (video_width % display_ratio_num == 0) {
|
||||
GST_LOG ("Keeping video width");
|
||||
|
||||
self->display_width = video_width;
|
||||
self->display_height = (guint)
|
||||
gst_util_uint64_scale_int (video_width, display_ratio_den, display_ratio_num);
|
||||
} else {
|
||||
GST_LOG ("Approximating while keeping video height");
|
||||
|
||||
self->display_width = (guint)
|
||||
gst_util_uint64_scale_int (video_height, display_ratio_num, display_ratio_den);
|
||||
self->display_height = video_height;
|
||||
}
|
||||
|
||||
self->display_aspect_ratio = ((gdouble) self->display_width
|
||||
/ (gdouble) self->display_height);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Invalidate paintable size, display: %dx%d",
|
||||
self->display_width, self->display_height);
|
||||
gdk_paintable_invalidate_size ((GdkPaintable *) self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
invalidate_paintable_size_on_main_cb (GstClapperPaintable *self)
|
||||
{
|
||||
GST_CLAPPER_PAINTABLE_LOCK (self);
|
||||
self->draw_id = 0;
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
|
||||
invalidate_paintable_size_internal (self);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_paintable_on_main_cb (GstClapperPaintable *self)
|
||||
{
|
||||
gboolean size_changed;
|
||||
|
||||
GST_CLAPPER_PAINTABLE_LOCK (self);
|
||||
|
||||
/* Check if we will need to invalidate size */
|
||||
if ((size_changed = self->pending_resize))
|
||||
self->pending_resize = FALSE;
|
||||
|
||||
self->draw_id = 0;
|
||||
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
|
||||
if (size_changed)
|
||||
invalidate_paintable_size_internal (self);
|
||||
|
||||
GST_LOG_OBJECT (self, "Invalidate paintable contents");
|
||||
gdk_paintable_invalidate_contents ((GdkPaintable *) self);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
GstClapperPaintable *
|
||||
gst_clapper_paintable_new (void)
|
||||
{
|
||||
return g_object_new (GST_TYPE_CLAPPER_PAINTABLE, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_paintable_set_widget (GstClapperPaintable *self, GtkWidget *widget)
|
||||
{
|
||||
g_weak_ref_set (&self->widget, widget);
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_paintable_set_importer (GstClapperPaintable *self, GstClapperImporter *importer)
|
||||
{
|
||||
g_weak_ref_set (&self->importer, importer);
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_paintable_queue_draw (GstClapperPaintable *self)
|
||||
{
|
||||
GST_CLAPPER_PAINTABLE_LOCK (self);
|
||||
|
||||
if (self->draw_id > 0) {
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
GST_TRACE ("Already have pending draw");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
self->draw_id = g_idle_add_full (G_PRIORITY_DEFAULT,
|
||||
(GSourceFunc) update_paintable_on_main_cb, self, NULL);
|
||||
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_clapper_paintable_set_video_info (GstClapperPaintable *self, const GstVideoInfo *v_info)
|
||||
{
|
||||
GST_CLAPPER_PAINTABLE_LOCK (self);
|
||||
|
||||
if (gst_video_info_is_equal (&self->v_info, v_info)) {
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Reject info if values would cause integer overflow */
|
||||
if (G_UNLIKELY (!calculate_display_par (self, v_info))) {
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->pending_resize = TRUE;
|
||||
self->v_info = *v_info;
|
||||
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gst_clapper_paintable_set_pixel_aspect_ratio (GstClapperPaintable *self,
|
||||
gint par_n, gint par_d)
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
GST_CLAPPER_PAINTABLE_LOCK (self);
|
||||
|
||||
/* No change */
|
||||
if (self->par_n == par_n && self->par_d == par_d) {
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
return;
|
||||
}
|
||||
|
||||
self->par_n = par_n;
|
||||
self->par_d = par_d;
|
||||
|
||||
/* Check if we can accept new values. This will update
|
||||
* display `ratio_num` and `ratio_den` only when successful */
|
||||
success = calculate_display_par (self, &self->v_info);
|
||||
|
||||
/* If paintable update is queued, wait for it, otherwise invalidate
|
||||
* size only for change to be applied even when paused */
|
||||
if (!success || self->draw_id > 0) {
|
||||
self->pending_resize = success;
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
self->draw_id = g_idle_add_full (G_PRIORITY_DEFAULT,
|
||||
(GSourceFunc) invalidate_paintable_size_on_main_cb, self, NULL);
|
||||
|
||||
GST_CLAPPER_PAINTABLE_UNLOCK (self);
|
||||
}
|
||||
|
||||
/*
|
||||
* GdkPaintableInterface
|
||||
*/
|
||||
static void
|
||||
gst_clapper_paintable_snapshot_internal (GstClapperPaintable *self,
|
||||
GdkSnapshot *snapshot, gdouble width, gdouble height,
|
||||
gint widget_width, gint widget_height)
|
||||
{
|
||||
GstClapperImporter *importer;
|
||||
gfloat scale_x, scale_y;
|
||||
|
||||
GST_LOG_OBJECT (self, "Snapshot");
|
||||
|
||||
scale_x = (gfloat) width / self->display_width;
|
||||
scale_y = (gfloat) height / self->display_height;
|
||||
|
||||
/* Apply black borders when keeping aspect ratio */
|
||||
if (scale_x == scale_y || abs (scale_x - scale_y) <= FLT_EPSILON) {
|
||||
if (widget_height - height > 0) {
|
||||
/* XXX: Top uses integer to work with GTK rounding (not going offscreen) */
|
||||
gint top_bar_height = (widget_height - height) / 2;
|
||||
gdouble bottom_bar_height = (widget_height - top_bar_height - height);
|
||||
|
||||
gtk_snapshot_append_color (snapshot, &self->bg, &GRAPHENE_RECT_INIT (0, 0, width, -top_bar_height));
|
||||
gtk_snapshot_append_color (snapshot, &self->bg, &GRAPHENE_RECT_INIT (0, height, width, bottom_bar_height));
|
||||
} else if (widget_width - width > 0) {
|
||||
gint left_bar_width = (widget_width - width) / 2;
|
||||
gdouble right_bar_width = (widget_width - left_bar_width - width);
|
||||
|
||||
gtk_snapshot_append_color (snapshot, &self->bg, &GRAPHENE_RECT_INIT (0, 0, -left_bar_width, height));
|
||||
gtk_snapshot_append_color (snapshot, &self->bg, &GRAPHENE_RECT_INIT (width, 0, right_bar_width, height));
|
||||
}
|
||||
}
|
||||
|
||||
if ((importer = g_weak_ref_get (&self->importer))) {
|
||||
gst_clapper_importer_snapshot (importer, snapshot, width, height,
|
||||
scale_x * self->pixel_aspect, scale_y);
|
||||
g_object_unref (importer);
|
||||
} else {
|
||||
GST_LOG_OBJECT (self, "No texture importer, drawing black");
|
||||
gtk_snapshot_append_color (snapshot, &self->bg, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot, gdouble width, gdouble height)
|
||||
{
|
||||
GstClapperPaintable *self = GST_CLAPPER_PAINTABLE_CAST (paintable);
|
||||
GtkWidget *widget;
|
||||
gint widget_width = 0, widget_height = 0;
|
||||
|
||||
if ((widget = g_weak_ref_get (&self->widget))) {
|
||||
gint scale_factor;
|
||||
|
||||
scale_factor = gtk_widget_get_scale_factor (widget);
|
||||
widget_width = gtk_widget_get_width (widget) * scale_factor;
|
||||
widget_height = gtk_widget_get_height (widget) * scale_factor;
|
||||
|
||||
g_object_unref (widget);
|
||||
}
|
||||
|
||||
gst_clapper_paintable_snapshot_internal (self, snapshot,
|
||||
width, height, widget_width, widget_height);
|
||||
}
|
||||
|
||||
static GdkPaintable *
|
||||
gst_clapper_paintable_get_current_image (GdkPaintable *paintable)
|
||||
{
|
||||
GstClapperPaintable *self = GST_CLAPPER_PAINTABLE_CAST (paintable);
|
||||
GtkSnapshot *snapshot = gtk_snapshot_new ();
|
||||
|
||||
/* Snapshot without widget size in order to get
|
||||
* paintable without black borders */
|
||||
gst_clapper_paintable_snapshot_internal (self, snapshot,
|
||||
self->display_width, self->display_height, 0, 0);
|
||||
|
||||
return gtk_snapshot_free_to_paintable (snapshot, NULL);
|
||||
}
|
||||
|
||||
static gint
|
||||
gst_clapper_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
GstClapperPaintable *self = GST_CLAPPER_PAINTABLE_CAST (paintable);
|
||||
|
||||
return self->display_width;
|
||||
}
|
||||
|
||||
static gint
|
||||
gst_clapper_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
GstClapperPaintable *self = GST_CLAPPER_PAINTABLE_CAST (paintable);
|
||||
|
||||
return self->display_height;
|
||||
}
|
||||
|
||||
static gdouble
|
||||
gst_clapper_paintable_get_intrinsic_aspect_ratio (GdkPaintable *paintable)
|
||||
{
|
||||
GstClapperPaintable *self = GST_CLAPPER_PAINTABLE_CAST (paintable);
|
||||
|
||||
return self->display_aspect_ratio;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_paintable_iface_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = gst_clapper_paintable_snapshot;
|
||||
iface->get_current_image = gst_clapper_paintable_get_current_image;
|
||||
iface->get_intrinsic_width = gst_clapper_paintable_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = gst_clapper_paintable_get_intrinsic_height;
|
||||
iface->get_intrinsic_aspect_ratio = gst_clapper_paintable_get_intrinsic_aspect_ratio;
|
||||
}
|
78
lib/gst/plugin/gstclapperpaintable.h
vendored
Normal file
78
lib/gst/plugin/gstclapperpaintable.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
|
||||
#include "gstclapperimporter.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_CLAPPER_PAINTABLE (gst_clapper_paintable_get_type())
|
||||
G_DECLARE_FINAL_TYPE (GstClapperPaintable, gst_clapper_paintable, GST, CLAPPER_PAINTABLE, GObject)
|
||||
|
||||
#define GST_CLAPPER_PAINTABLE_CAST(obj) ((GstClapperPaintable *)(obj))
|
||||
|
||||
#define GST_CLAPPER_PAINTABLE_GET_LOCK(obj) (&GST_CLAPPER_PAINTABLE_CAST(obj)->lock)
|
||||
#define GST_CLAPPER_PAINTABLE_LOCK(obj) g_mutex_lock (GST_CLAPPER_PAINTABLE_GET_LOCK(obj))
|
||||
#define GST_CLAPPER_PAINTABLE_UNLOCK(obj) g_mutex_unlock (GST_CLAPPER_PAINTABLE_GET_LOCK(obj))
|
||||
|
||||
struct _GstClapperPaintable
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
GMutex lock;
|
||||
|
||||
GstVideoInfo v_info;
|
||||
|
||||
GdkRGBA bg;
|
||||
|
||||
GWeakRef widget, importer;
|
||||
|
||||
/* Sink properties */
|
||||
gint par_n, par_d;
|
||||
|
||||
/* For drawing overlays */
|
||||
gdouble pixel_aspect;
|
||||
|
||||
/* Resize */
|
||||
gboolean pending_resize;
|
||||
guint display_ratio_num;
|
||||
guint display_ratio_den;
|
||||
|
||||
/* GdkPaintableInterface */
|
||||
gint display_width;
|
||||
gint display_height;
|
||||
gdouble display_aspect_ratio;
|
||||
|
||||
/* Pending draw signal id */
|
||||
guint draw_id;
|
||||
};
|
||||
|
||||
GstClapperPaintable * gst_clapper_paintable_new (void);
|
||||
void gst_clapper_paintable_queue_draw (GstClapperPaintable *paintable);
|
||||
void gst_clapper_paintable_set_widget (GstClapperPaintable *paintable, GtkWidget *widget);
|
||||
void gst_clapper_paintable_set_importer (GstClapperPaintable *paintable, GstClapperImporter *importer);
|
||||
gboolean gst_clapper_paintable_set_video_info (GstClapperPaintable *paintable, const GstVideoInfo *v_info);
|
||||
void gst_clapper_paintable_set_pixel_aspect_ratio (GstClapperPaintable *paintable, gint par_n, gint par_d);
|
||||
|
||||
G_END_DECLS
|
1395
lib/gst/plugin/gstclappersink.c
vendored
1395
lib/gst/plugin/gstclappersink.c
vendored
File diff suppressed because it is too large
Load Diff
52
lib/gst/plugin/gstclappersink.h
vendored
52
lib/gst/plugin/gstclappersink.h
vendored
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* GStreamer
|
||||
* Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
|
||||
* Copyright (C) 2020-2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@@ -10,7 +8,7 @@
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
@@ -26,49 +24,49 @@
|
||||
#include <gst/video/gstvideosink.h>
|
||||
#include <gst/video/video.h>
|
||||
|
||||
#include "gtkclapperobject.h"
|
||||
#include "gstclapperpaintable.h"
|
||||
#include "gstclapperimporter.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_CLAPPER_SINK (gst_clapper_sink_get_type ())
|
||||
#define GST_IS_CLAPPER_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CLAPPER_SINK))
|
||||
#define GST_IS_CLAPPER_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CLAPPER_SINK))
|
||||
#define GST_CLAPPER_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CLAPPER_SINK, GstClapperSinkClass))
|
||||
#define GST_CLAPPER_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CLAPPER_SINK, GstClapperSinkClass))
|
||||
#define GST_CLAPPER_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CLAPPER_SINK, GstClapperSink))
|
||||
#define GST_CLAPPER_SINK_CAST(obj) ((GstClapperSink*)(obj))
|
||||
#define GST_TYPE_CLAPPER_SINK (gst_clapper_sink_get_type())
|
||||
G_DECLARE_FINAL_TYPE (GstClapperSink, gst_clapper_sink, GST, CLAPPER_SINK, GstVideoSink)
|
||||
|
||||
typedef struct _GstClapperSink GstClapperSink;
|
||||
typedef struct _GstClapperSinkClass GstClapperSinkClass;
|
||||
#define GST_CLAPPER_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CLAPPER_SINK, GstClapperSinkClass))
|
||||
#define GST_CLAPPER_SINK_CAST(obj) ((GstClapperSink *)(obj))
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GstClapperSink, gst_object_unref)
|
||||
#endif
|
||||
#define GST_CLAPPER_SINK_GET_LOCK(obj) (&GST_CLAPPER_SINK_CAST(obj)->lock)
|
||||
#define GST_CLAPPER_SINK_LOCK(obj) g_mutex_lock (GST_CLAPPER_SINK_GET_LOCK(obj))
|
||||
#define GST_CLAPPER_SINK_UNLOCK(obj) g_mutex_unlock (GST_CLAPPER_SINK_GET_LOCK(obj))
|
||||
|
||||
struct _GstClapperSink
|
||||
{
|
||||
GstVideoSink parent;
|
||||
|
||||
GMutex lock;
|
||||
|
||||
GstClapperPaintable *paintable;
|
||||
GstClapperImporter *importer;
|
||||
GstVideoInfo v_info;
|
||||
|
||||
GtkClapperObject *obj;
|
||||
GtkWidget *widget;
|
||||
GtkWindow *window;
|
||||
|
||||
/* properties */
|
||||
gboolean presented_window;
|
||||
|
||||
/* Properties */
|
||||
gboolean force_aspect_ratio;
|
||||
gint par_n, par_d;
|
||||
gboolean keep_last_frame;
|
||||
|
||||
gint display_width, display_height;
|
||||
gulong widget_destroy_id, window_destroy_id;
|
||||
};
|
||||
/* Position coords */
|
||||
gdouble last_pos_x;
|
||||
gdouble last_pos_y;
|
||||
|
||||
struct _GstClapperSinkClass
|
||||
{
|
||||
GstVideoSinkClass parent_class;
|
||||
gulong widget_destroy_id;
|
||||
gulong window_destroy_id;
|
||||
};
|
||||
|
||||
GST_ELEMENT_REGISTER_DECLARE (clappersink);
|
||||
|
||||
GType gst_clapper_sink_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
37
lib/gst/plugin/gstgdkformats.h
vendored
Normal file
37
lib/gst/plugin/gstgdkformats.h
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
#define GST_GDK_MEMORY_ENDIAN_FORMATS "RGBA64_LE"
|
||||
#define GST_GDK_GL_TEXTURE_ENDIAN_FORMATS "RGBA64_LE"
|
||||
#elif G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
#define GST_GDK_MEMORY_ENDIAN_FORMATS "RGBA64_BE"
|
||||
#define GST_GDK_GL_TEXTURE_ENDIAN_FORMATS "RGBA64_BE"
|
||||
#endif
|
||||
|
||||
#define GST_GDK_MEMORY_FORMATS \
|
||||
GST_GDK_MEMORY_ENDIAN_FORMATS ", " \
|
||||
"ABGR, BGRA, ARGB, RGBA, BGRx, RGBx, BGR, RGB"
|
||||
|
||||
/* Formats that `GdkGLTexture` supports */
|
||||
#define GST_GDK_GL_TEXTURE_FORMATS \
|
||||
GST_GDK_GL_TEXTURE_ENDIAN_FORMATS ", " \
|
||||
"RGBA, RGBx, RGB"
|
61
lib/gst/plugin/gstgtkutils.c
vendored
61
lib/gst/plugin/gstgtkutils.c
vendored
@@ -2,6 +2,7 @@
|
||||
* GStreamer
|
||||
* Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
|
||||
* Copyright (C) 2015 Thibault Saunier <tsaunier@gnome.org>
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@@ -69,3 +70,63 @@ gst_gtk_invoke_on_main (GThreadFunc func, gpointer data)
|
||||
|
||||
return info.res;
|
||||
}
|
||||
|
||||
/* For use with `GdkMemoryTexture` only! */
|
||||
GdkMemoryFormat
|
||||
gst_video_format_to_gdk_memory_format (GstVideoFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case GST_VIDEO_FORMAT_RGBA64_LE:
|
||||
case GST_VIDEO_FORMAT_RGBA64_BE:
|
||||
return GDK_MEMORY_R16G16B16A16_PREMULTIPLIED;
|
||||
case GST_VIDEO_FORMAT_RGBA:
|
||||
return GDK_MEMORY_R8G8B8A8;
|
||||
case GST_VIDEO_FORMAT_BGRA:
|
||||
return GDK_MEMORY_B8G8R8A8;
|
||||
case GST_VIDEO_FORMAT_ARGB:
|
||||
return GDK_MEMORY_A8R8G8B8;
|
||||
case GST_VIDEO_FORMAT_ABGR:
|
||||
return GDK_MEMORY_A8B8G8R8;
|
||||
case GST_VIDEO_FORMAT_RGBx:
|
||||
return GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||
case GST_VIDEO_FORMAT_BGRx:
|
||||
return GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||
case GST_VIDEO_FORMAT_RGB:
|
||||
return GDK_MEMORY_R8G8B8;
|
||||
case GST_VIDEO_FORMAT_BGR:
|
||||
return GDK_MEMORY_B8G8R8;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* This should never happen as long as above switch statement
|
||||
* is updated when new formats are added to caps */
|
||||
g_assert_not_reached ();
|
||||
|
||||
/* Fallback format */
|
||||
return GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gst_video_frame_into_gdk_texture (GstVideoFrame *frame)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GBytes *bytes;
|
||||
|
||||
bytes = g_bytes_new_with_free_func (
|
||||
GST_VIDEO_FRAME_PLANE_DATA (frame, 0),
|
||||
GST_VIDEO_FRAME_HEIGHT (frame) * GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0),
|
||||
(GDestroyNotify) gst_buffer_unref,
|
||||
gst_buffer_ref (frame->buffer));
|
||||
|
||||
texture = gdk_memory_texture_new (
|
||||
GST_VIDEO_FRAME_WIDTH (frame),
|
||||
GST_VIDEO_FRAME_HEIGHT (frame),
|
||||
gst_video_format_to_gdk_memory_format (GST_VIDEO_FRAME_FORMAT (frame)),
|
||||
bytes,
|
||||
GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0));
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
13
lib/gst/plugin/gstgtkutils.h
vendored
13
lib/gst/plugin/gstgtkutils.h
vendored
@@ -2,6 +2,7 @@
|
||||
* GStreamer
|
||||
* Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
|
||||
* Copyright (C) 2015 Thibault Saunier <tsaunier@gnome.org>
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@@ -22,5 +23,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gst/video/video.h>
|
||||
|
||||
gpointer gst_gtk_invoke_on_main (GThreadFunc func, gpointer data);
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gpointer gst_gtk_invoke_on_main (GThreadFunc func, gpointer data);
|
||||
|
||||
GdkMemoryFormat gst_video_format_to_gdk_memory_format (GstVideoFormat format);
|
||||
|
||||
GdkTexture * gst_video_frame_into_gdk_texture (GstVideoFrame *frame);
|
||||
|
||||
G_END_DECLS
|
||||
|
11
lib/gst/plugin/gstplugin.c
vendored
11
lib/gst/plugin/gstplugin.c
vendored
@@ -21,16 +21,21 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
#include "gstclappersink.h"
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin *plugin)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
if (!g_module_supported ())
|
||||
return FALSE;
|
||||
|
||||
res |= GST_ELEMENT_REGISTER (clappersink, plugin);
|
||||
gst_plugin_add_dependency_simple (plugin,
|
||||
NULL, CLAPPER_SINK_IMPORTER_PATH, NULL,
|
||||
GST_PLUGIN_DEPENDENCY_FLAG_NONE);
|
||||
|
||||
return res;
|
||||
return GST_ELEMENT_REGISTER (clappersink, plugin);
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
|
||||
|
960
lib/gst/plugin/gtkclapperobject.c
vendored
960
lib/gst/plugin/gtkclapperobject.c
vendored
@@ -1,960 +0,0 @@
|
||||
/*
|
||||
* GStreamer
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gl/gstglfuncs.h>
|
||||
#include <gst/allocators/gstdmabuf.h>
|
||||
|
||||
#include "gtkclapperobject.h"
|
||||
#include "gstgtkutils.h"
|
||||
|
||||
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#if GST_GL_HAVE_PLATFORM_EGL
|
||||
#include <gst/gl/egl/gstgldisplay_egl.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND)
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#include <gst/gl/wayland/gstgldisplay_wayland.h>
|
||||
#endif
|
||||
|
||||
#if GST_GL_HAVE_PLATFORM_EGL
|
||||
#include <gst/gl/egl/gsteglimage.h>
|
||||
#endif
|
||||
|
||||
GST_DEBUG_CATEGORY (gst_debug_clapper_object);
|
||||
#define GST_CAT_DEFAULT gst_debug_clapper_object
|
||||
|
||||
static void gtk_clapper_object_paintable_iface_init (GdkPaintableInterface *iface);
|
||||
static void gtk_clapper_object_finalize (GObject *object);
|
||||
|
||||
static const GLfloat vertices[] = {
|
||||
1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
|
||||
-1.0f, 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
-1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
|
||||
1.0f, -1.0f, 0.0f, 1.0f, 1.0f
|
||||
};
|
||||
static const GLushort indices[] = {
|
||||
0, 1, 2, 0, 2, 3
|
||||
};
|
||||
|
||||
/* GTK4 renders things upside down ¯\_(ツ)_/¯ */
|
||||
static const gfloat vertical_flip_matrix[] = {
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, -1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
};
|
||||
|
||||
#define gtk_clapper_object_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkClapperObject, gtk_clapper_object, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
gtk_clapper_object_paintable_iface_init)
|
||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "gtkclapperobject", 0,
|
||||
"GTK Clapper Object"));
|
||||
|
||||
static void
|
||||
gtk_clapper_object_class_init (GtkClapperObjectClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
|
||||
gobject_class->finalize = gtk_clapper_object_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_clapper_object_init (GtkClapperObject *self)
|
||||
{
|
||||
self->last_pos_x = 0;
|
||||
self->last_pos_y = 0;
|
||||
|
||||
self->picture = (GtkPicture *) gtk_picture_new ();
|
||||
|
||||
/* We cannot do textures of 0x0px size */
|
||||
gtk_widget_set_size_request (GTK_WIDGET (self->picture), 1, 1);
|
||||
|
||||
/* Center instead of fill to not draw empty space into framebuffer */
|
||||
gtk_widget_set_halign (GTK_WIDGET (self->picture), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (GTK_WIDGET (self->picture), GTK_ALIGN_CENTER);
|
||||
|
||||
gtk_picture_set_paintable (self->picture, GDK_PAINTABLE (self));
|
||||
|
||||
gst_video_info_init (&self->v_info);
|
||||
gst_video_info_init (&self->pending_v_info);
|
||||
|
||||
g_weak_ref_init (&self->element, NULL);
|
||||
g_mutex_init (&self->lock);
|
||||
|
||||
self->gst_tex_target = GST_GL_TEXTURE_TARGET_EXTERNAL_OES;
|
||||
self->gl_tex_target = gst_gl_texture_target_to_gl (self->gst_tex_target);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_clapper_object_finalize (GObject *object)
|
||||
{
|
||||
GtkClapperObject *self = GTK_CLAPPER_OBJECT (object);
|
||||
|
||||
if (self->draw_id)
|
||||
g_source_remove (self->draw_id);
|
||||
|
||||
gst_buffer_replace (&self->pending_buffer, NULL);
|
||||
gst_buffer_replace (&self->buffer, NULL);
|
||||
|
||||
g_mutex_clear (&self->lock);
|
||||
g_weak_ref_clear (&self->element);
|
||||
|
||||
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_gl_context_set_active (GtkClapperObject *self, gboolean activate)
|
||||
{
|
||||
/* We wrap around a GDK context, so we need to make
|
||||
* both GTK and GStreamer aware of its active state */
|
||||
if (activate) {
|
||||
gdk_gl_context_make_current (self->gdk_context);
|
||||
gst_gl_context_activate (self->wrapped_context, TRUE);
|
||||
} else {
|
||||
gst_gl_context_activate (self->wrapped_context, FALSE);
|
||||
gdk_gl_context_clear_current ();
|
||||
}
|
||||
}
|
||||
|
||||
static GdkMemoryFormat
|
||||
video_format_to_gdk_memory_format (GstVideoFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case GST_VIDEO_FORMAT_BGR:
|
||||
return GDK_MEMORY_B8G8R8;
|
||||
case GST_VIDEO_FORMAT_RGB:
|
||||
return GDK_MEMORY_R8G8B8;
|
||||
case GST_VIDEO_FORMAT_BGRA:
|
||||
return GDK_MEMORY_B8G8R8A8;
|
||||
case GST_VIDEO_FORMAT_RGBA:
|
||||
return GDK_MEMORY_R8G8B8A8;
|
||||
case GST_VIDEO_FORMAT_ABGR:
|
||||
return GDK_MEMORY_A8B8G8R8;
|
||||
case GST_VIDEO_FORMAT_ARGB:
|
||||
return GDK_MEMORY_A8R8G8B8;
|
||||
case GST_VIDEO_FORMAT_BGRx:
|
||||
return GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||
case GST_VIDEO_FORMAT_RGBx:
|
||||
return GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||
case GST_VIDEO_FORMAT_RGBA64_LE:
|
||||
case GST_VIDEO_FORMAT_RGBA64_BE:
|
||||
return GDK_MEMORY_R16G16B16A16_PREMULTIPLIED;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* Number not belonging to any format */
|
||||
return GDK_MEMORY_N_FORMATS;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_clapper_object_bind_buffer (GtkClapperObject *self)
|
||||
{
|
||||
const GstGLFuncs *gl = self->wrapped_context->gl_vtable;
|
||||
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, self->vertex_buffer);
|
||||
|
||||
/* Load the vertex position */
|
||||
gl->VertexAttribPointer (self->attr_position, 3, GL_FLOAT, GL_FALSE,
|
||||
5 * sizeof (GLfloat), (void *) 0);
|
||||
|
||||
/* Load the texture coordinate */
|
||||
gl->VertexAttribPointer (self->attr_texture, 2, GL_FLOAT, GL_FALSE,
|
||||
5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
|
||||
|
||||
gl->EnableVertexAttribArray (self->attr_position);
|
||||
gl->EnableVertexAttribArray (self->attr_texture);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_clapper_object_unbind_buffer (GtkClapperObject *self)
|
||||
{
|
||||
const GstGLFuncs *gl = self->wrapped_context->gl_vtable;
|
||||
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
gl->DisableVertexAttribArray (self->attr_position);
|
||||
gl->DisableVertexAttribArray (self->attr_texture);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_clapper_object_init_redisplay (GtkClapperObject *self)
|
||||
{
|
||||
GstGLSLStage *frag_stage, *vert_stage;
|
||||
GError *error = NULL;
|
||||
gchar *frag_str;
|
||||
const GstGLFuncs *gl;
|
||||
|
||||
if (self->gst_tex_target != GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
|
||||
return;
|
||||
|
||||
if (!((vert_stage = gst_glsl_stage_new_with_string (self->wrapped_context,
|
||||
GL_VERTEX_SHADER, GST_GLSL_VERSION_NONE,
|
||||
GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY,
|
||||
gst_gl_shader_string_vertex_mat4_vertex_transform)))) {
|
||||
GST_ERROR ("Failed to retrieve vertex shader for texture target");
|
||||
return;
|
||||
}
|
||||
|
||||
frag_str = gst_gl_shader_string_fragment_external_oes_get_default (
|
||||
self->wrapped_context, GST_GLSL_VERSION_NONE,
|
||||
GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY);
|
||||
frag_stage = gst_glsl_stage_new_with_string (self->wrapped_context,
|
||||
GL_FRAGMENT_SHADER, GST_GLSL_VERSION_NONE,
|
||||
GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY, frag_str);
|
||||
|
||||
g_free (frag_str);
|
||||
|
||||
if (!frag_stage) {
|
||||
GST_ERROR ("Failed to retrieve fragment shader for texture target");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!((self->shader = gst_gl_shader_new_link_with_stages (self->wrapped_context,
|
||||
&error, vert_stage, frag_stage, NULL)))) {
|
||||
GST_ERROR ("Failed to initialize shader: %s", error->message);
|
||||
|
||||
g_clear_error (&error);
|
||||
gst_object_unref (vert_stage);
|
||||
gst_object_unref (frag_stage);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
self->attr_position =
|
||||
gst_gl_shader_get_attribute_location (self->shader, "a_position");
|
||||
self->attr_texture =
|
||||
gst_gl_shader_get_attribute_location (self->shader, "a_texcoord");
|
||||
|
||||
gl = self->wrapped_context->gl_vtable;
|
||||
|
||||
if (gl->GenVertexArrays) {
|
||||
gl->GenVertexArrays (1, &self->vao);
|
||||
gl->BindVertexArray (self->vao);
|
||||
}
|
||||
|
||||
gl->GenBuffers (1, &self->vertex_buffer);
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, self->vertex_buffer);
|
||||
gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices, GL_STATIC_DRAW);
|
||||
|
||||
if (gl->GenVertexArrays) {
|
||||
gtk_clapper_object_bind_buffer (self);
|
||||
gl->BindVertexArray (0);
|
||||
}
|
||||
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
self->initiated = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_dmabuf_into_texture (GtkClapperObject *self, gint *fds, gsize *offsets)
|
||||
{
|
||||
GstEGLImage *image;
|
||||
const GstGLFuncs *gl;
|
||||
|
||||
image = gst_egl_image_from_dmabuf_direct_target (self->wrapped_context,
|
||||
fds, offsets, &self->v_info, self->gst_tex_target);
|
||||
|
||||
/* If HW colorspace conversion failed and there is only one
|
||||
* plane, we can just make it into single EGLImage as is */
|
||||
if (!image && GST_VIDEO_INFO_N_PLANES (&self->v_info) == 1)
|
||||
image = gst_egl_image_from_dmabuf (self->wrapped_context,
|
||||
fds[0], &self->v_info, 0, offsets[0]);
|
||||
|
||||
/* Still no image? Give up then */
|
||||
if (!image)
|
||||
return FALSE;
|
||||
|
||||
gl = self->wrapped_context->gl_vtable;
|
||||
|
||||
if (!self->texture_id)
|
||||
gl->GenTextures (1, &self->texture_id);
|
||||
|
||||
gl->BindTexture (self->gl_tex_target, self->texture_id);
|
||||
|
||||
gl->TexParameteri (self->gl_tex_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
gl->TexParameteri (self->gl_tex_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
gl->TexParameteri (self->gl_tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
gl->TexParameteri (self->gl_tex_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
gl->EGLImageTargetTexture2D (self->gl_tex_target, gst_egl_image_get_image (image));
|
||||
|
||||
gl->BindTexture (GL_TEXTURE_2D, 0);
|
||||
gst_egl_image_unref (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_ext_texture_into_2d (GtkClapperObject *self, guint tex_width, guint tex_height)
|
||||
{
|
||||
GLuint framebuffer, new_texture_id;
|
||||
GLenum status;
|
||||
const GstGLFuncs *gl;
|
||||
|
||||
if (!self->initiated)
|
||||
gtk_clapper_object_init_redisplay (self);
|
||||
|
||||
gl = self->wrapped_context->gl_vtable;
|
||||
|
||||
gl->GenFramebuffers (1, &framebuffer);
|
||||
gl->BindFramebuffer (GL_FRAMEBUFFER, framebuffer);
|
||||
|
||||
gl->GenTextures (1, &new_texture_id);
|
||||
gl->BindTexture (GL_TEXTURE_2D, new_texture_id);
|
||||
|
||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, tex_width, tex_height, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_TEXTURE_2D, new_texture_id, 0);
|
||||
|
||||
status = gl->CheckFramebufferStatus (GL_FRAMEBUFFER);
|
||||
if (G_UNLIKELY (status != GL_FRAMEBUFFER_COMPLETE)) {
|
||||
GST_ERROR ("Invalid framebuffer status: %u", status);
|
||||
|
||||
gl->BindTexture (GL_TEXTURE_2D, 0);
|
||||
gl->DeleteTextures (1, &new_texture_id);
|
||||
|
||||
gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
gl->DeleteFramebuffers (1, &framebuffer);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gl->Viewport (0, 0, tex_width, tex_height);
|
||||
|
||||
gst_gl_shader_use (self->shader);
|
||||
|
||||
if (gl->BindVertexArray)
|
||||
gl->BindVertexArray (self->vao);
|
||||
|
||||
gtk_clapper_object_bind_buffer (self);
|
||||
|
||||
gl->ActiveTexture (GL_TEXTURE0);
|
||||
gl->BindTexture (self->gl_tex_target, self->texture_id);
|
||||
|
||||
gst_gl_shader_set_uniform_1i (self->shader, "tex", 0);
|
||||
gst_gl_shader_set_uniform_matrix_4fv (self->shader,
|
||||
"u_transformation", 1, FALSE, vertical_flip_matrix);
|
||||
|
||||
gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
|
||||
|
||||
if (gl->BindVertexArray)
|
||||
gl->BindVertexArray (0);
|
||||
else
|
||||
gtk_clapper_object_unbind_buffer (self);
|
||||
|
||||
gl->BindTexture (self->gl_tex_target, 0);
|
||||
|
||||
/* Replace external OES texture with new 2D one */
|
||||
gl->DeleteTextures (1, &self->texture_id);
|
||||
self->texture_id = new_texture_id;
|
||||
|
||||
gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
gl->DeleteFramebuffers (1, &framebuffer);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
gtk_clapper_object_import_dmabuf (GtkClapperObject *self, gint *fds, gsize *offsets)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
guint tex_width, tex_height;
|
||||
|
||||
_gdk_gl_context_set_active (self, TRUE);
|
||||
|
||||
if (!_dmabuf_into_texture (self, fds, offsets)) {
|
||||
_gdk_gl_context_set_active (self, FALSE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (self->gst_tex_target) {
|
||||
case GST_GL_TEXTURE_TARGET_2D:
|
||||
tex_width = GST_VIDEO_INFO_WIDTH (&self->v_info);
|
||||
tex_height = GST_VIDEO_INFO_HEIGHT (&self->v_info);
|
||||
break;
|
||||
case GST_GL_TEXTURE_TARGET_EXTERNAL_OES:{
|
||||
GtkWidget *widget = (GtkWidget *) self->picture;
|
||||
gint scale;
|
||||
|
||||
scale = gtk_widget_get_scale_factor (widget);
|
||||
tex_width = gtk_widget_get_width (widget) * scale;
|
||||
tex_height = gtk_widget_get_height (widget) * scale;
|
||||
|
||||
if (G_LIKELY (_ext_texture_into_2d (self, tex_width, tex_height)))
|
||||
break;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
texture = gdk_gl_texture_new (self->gdk_context,
|
||||
self->texture_id, tex_width, tex_height, NULL, NULL);
|
||||
|
||||
_gdk_gl_context_set_active (self, FALSE);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
typedef gboolean (*MemTypeCheckFunc) (gpointer data);
|
||||
|
||||
static gboolean
|
||||
buffer_memory_type_check (GstBuffer *buffer, MemTypeCheckFunc func)
|
||||
{
|
||||
guint i, n_mems;
|
||||
|
||||
n_mems = gst_buffer_n_memory (buffer);
|
||||
|
||||
for (i = 0; i < n_mems; i++) {
|
||||
if (!func (gst_buffer_peek_memory (buffer, i)))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return n_mems > 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify_dmabuf_memory (GtkClapperObject *self, guint n_planes,
|
||||
gint *fds, gsize *offsets)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < n_planes; i++) {
|
||||
GstMemory *memory;
|
||||
gsize plane_size, mem_skip;
|
||||
guint mem_idx, length;
|
||||
|
||||
plane_size = gst_gl_get_plane_data_size (&self->v_info, NULL, i);
|
||||
|
||||
if (!gst_buffer_find_memory (self->buffer,
|
||||
GST_VIDEO_INFO_PLANE_OFFSET (&self->v_info, i),
|
||||
plane_size, &mem_idx, &length, &mem_skip)) {
|
||||
GST_DEBUG_OBJECT (self, "Could not find memory %u", i);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* We can't have more then one DMABuf per plane */
|
||||
if (length != 1) {
|
||||
GST_DEBUG_OBJECT (self, "Data for plane %u spans %u memories",
|
||||
i, length);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
memory = gst_buffer_peek_memory (self->buffer, mem_idx);
|
||||
|
||||
offsets[i] = memory->offset + mem_skip;
|
||||
fds[i] = gst_dmabuf_memory_get_fd (memory);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
obtain_texture_from_current_buffer (GtkClapperObject *self)
|
||||
{
|
||||
GdkTexture *texture = NULL;
|
||||
GstVideoFrame frame;
|
||||
|
||||
/* DMABuf */
|
||||
if (buffer_memory_type_check (self->buffer, (MemTypeCheckFunc) gst_is_dmabuf_memory)) {
|
||||
gsize offsets[GST_VIDEO_MAX_PLANES];
|
||||
gint fds[GST_VIDEO_MAX_PLANES];
|
||||
guint n_planes;
|
||||
|
||||
n_planes = GST_VIDEO_INFO_N_PLANES (&self->v_info);
|
||||
|
||||
if (!verify_dmabuf_memory (self, n_planes, fds, offsets)) {
|
||||
GST_ERROR ("DMABuf memory is invalid");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!((texture = gtk_clapper_object_import_dmabuf (self, fds, offsets))))
|
||||
GST_ERROR ("Could not create texture from DMABuf");
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
/* GL Memory */
|
||||
if (buffer_memory_type_check (self->buffer, (MemTypeCheckFunc) gst_is_gl_memory)) {
|
||||
if (gst_video_frame_map (&frame, &self->v_info, self->buffer, GST_MAP_READ | GST_MAP_GL)) {
|
||||
|
||||
GST_FIXME_OBJECT (self, "Handle GstGLMemory");
|
||||
|
||||
texture = gdk_gl_texture_new (
|
||||
self->gdk_context,
|
||||
*(guint *) GST_VIDEO_FRAME_PLANE_DATA (&frame, 0),
|
||||
GST_VIDEO_FRAME_WIDTH (&frame),
|
||||
GST_VIDEO_FRAME_HEIGHT (&frame),
|
||||
NULL, NULL);
|
||||
|
||||
gst_video_frame_unmap (&frame);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
/* RAW */
|
||||
if (gst_video_frame_map (&frame, &self->v_info, self->buffer, GST_MAP_READ)) {
|
||||
GBytes *bytes;
|
||||
|
||||
/* Our ref on a buffer together with 2 buffers pool ensures that
|
||||
* current buffer will not be freed while another one is prepared */
|
||||
bytes = g_bytes_new_with_free_func (
|
||||
GST_VIDEO_FRAME_PLANE_DATA (&frame, 0),
|
||||
GST_VIDEO_FRAME_HEIGHT (&frame) * GST_VIDEO_FRAME_PLANE_STRIDE (&frame, 0),
|
||||
NULL, NULL);
|
||||
|
||||
texture = gdk_memory_texture_new (
|
||||
GST_VIDEO_FRAME_WIDTH (&frame),
|
||||
GST_VIDEO_FRAME_HEIGHT (&frame),
|
||||
video_format_to_gdk_memory_format (GST_VIDEO_FRAME_FORMAT (&frame)),
|
||||
bytes,
|
||||
GST_VIDEO_FRAME_PLANE_STRIDE (&frame, 0));
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
gst_video_frame_unmap (&frame);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
calculate_display_par (GtkClapperObject *self, GstVideoInfo *info)
|
||||
{
|
||||
gboolean success;
|
||||
gint width, height;
|
||||
gint par_n, par_d;
|
||||
gint display_par_n, display_par_d;
|
||||
|
||||
width = GST_VIDEO_INFO_WIDTH (info);
|
||||
height = GST_VIDEO_INFO_HEIGHT (info);
|
||||
|
||||
par_n = GST_VIDEO_INFO_PAR_N (info);
|
||||
par_d = GST_VIDEO_INFO_PAR_D (info);
|
||||
|
||||
if (!par_n)
|
||||
par_n = 1;
|
||||
|
||||
/* User set props */
|
||||
if (self->par_n != 0 && self->par_d != 0) {
|
||||
display_par_n = self->par_n;
|
||||
display_par_d = self->par_d;
|
||||
} else {
|
||||
display_par_n = 1;
|
||||
display_par_d = 1;
|
||||
}
|
||||
|
||||
if ((success = gst_video_calculate_display_ratio (&self->display_ratio_num,
|
||||
&self->display_ratio_den, width, height, par_n, par_d, display_par_n,
|
||||
display_par_d))) {
|
||||
GST_LOG ("PAR: %u/%u, DAR: %u/%u", par_n, par_d, display_par_n, display_par_d);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
update_display_size (GtkClapperObject *self)
|
||||
{
|
||||
guint display_ratio_num, display_ratio_den;
|
||||
gint width, height;
|
||||
|
||||
display_ratio_num = self->display_ratio_num;
|
||||
display_ratio_den = self->display_ratio_den;
|
||||
|
||||
width = GST_VIDEO_INFO_WIDTH (&self->v_info);
|
||||
height = GST_VIDEO_INFO_HEIGHT (&self->v_info);
|
||||
|
||||
if (height % display_ratio_den == 0) {
|
||||
GST_DEBUG ("Keeping video height");
|
||||
|
||||
self->display_width = (guint)
|
||||
gst_util_uint64_scale_int (height, display_ratio_num, display_ratio_den);
|
||||
self->display_height = height;
|
||||
} else if (width % display_ratio_num == 0) {
|
||||
GST_DEBUG ("Keeping video width");
|
||||
|
||||
self->display_width = width;
|
||||
self->display_height = (guint)
|
||||
gst_util_uint64_scale_int (width, display_ratio_den, display_ratio_num);
|
||||
} else {
|
||||
GST_DEBUG ("Approximating while keeping video height");
|
||||
|
||||
self->display_width = (guint)
|
||||
gst_util_uint64_scale_int (height, display_ratio_num, display_ratio_den);
|
||||
self->display_height = height;
|
||||
}
|
||||
|
||||
self->display_aspect_ratio = ((gdouble) self->display_width
|
||||
/ (gdouble) self->display_height);
|
||||
GST_DEBUG ("Scaling to %dx%d", self->display_width, self->display_height);
|
||||
}
|
||||
|
||||
static void
|
||||
update_paintable (GtkClapperObject *self, GdkPaintable *paintable)
|
||||
{
|
||||
/* No change, so discard the new one */
|
||||
if (self->paintable == paintable) {
|
||||
if (paintable)
|
||||
g_object_unref (paintable);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->paintable)
|
||||
g_object_unref (self->paintable);
|
||||
|
||||
self->paintable = paintable;
|
||||
|
||||
if (self->pending_resize) {
|
||||
update_display_size (self);
|
||||
gdk_paintable_invalidate_size ((GdkPaintable *) self);
|
||||
|
||||
self->pending_resize = FALSE;
|
||||
}
|
||||
|
||||
gdk_paintable_invalidate_contents ((GdkPaintable *) self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
draw_on_main_cb (GtkClapperObject *self)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
|
||||
GTK_CLAPPER_OBJECT_LOCK (self);
|
||||
|
||||
/* Replace used buffer and set matching v_info */
|
||||
gst_buffer_replace (&self->buffer, self->pending_buffer);
|
||||
self->v_info = self->pending_v_info;
|
||||
|
||||
texture = obtain_texture_from_current_buffer (self);
|
||||
if (texture)
|
||||
update_paintable (self, (GdkPaintable *) texture);
|
||||
|
||||
self->draw_id = 0;
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_clapper_object_set_element (GtkClapperObject *self, GstElement *element)
|
||||
{
|
||||
g_weak_ref_set (&self->element, element);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_clapper_object_set_format (GtkClapperObject *self, GstVideoInfo *v_info)
|
||||
{
|
||||
GTK_CLAPPER_OBJECT_LOCK (self);
|
||||
|
||||
if (gst_video_info_is_equal (&self->pending_v_info, v_info)) {
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!calculate_display_par (self, v_info)) {
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->pending_resize = TRUE;
|
||||
self->pending_v_info = *v_info;
|
||||
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_clapper_object_set_buffer (GtkClapperObject *self, GstBuffer *buffer)
|
||||
{
|
||||
GstVideoMeta *meta = NULL;
|
||||
|
||||
GTK_CLAPPER_OBJECT_LOCK (self);
|
||||
|
||||
gst_buffer_replace (&self->pending_buffer, buffer);
|
||||
|
||||
if (self->draw_id) {
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->pending_buffer)
|
||||
meta = gst_buffer_get_video_meta (self->pending_buffer);
|
||||
|
||||
/* Update pending info from video meta */
|
||||
if (meta) {
|
||||
guint i;
|
||||
|
||||
GST_VIDEO_INFO_WIDTH (&self->pending_v_info) = meta->width;
|
||||
GST_VIDEO_INFO_HEIGHT (&self->pending_v_info) = meta->height;
|
||||
|
||||
for (i = 0; i < meta->n_planes; i++) {
|
||||
GST_VIDEO_INFO_PLANE_OFFSET (&self->pending_v_info, i) = meta->offset[i];
|
||||
GST_VIDEO_INFO_PLANE_STRIDE (&self->pending_v_info, i) = meta->stride[i];
|
||||
}
|
||||
}
|
||||
|
||||
self->draw_id = g_idle_add_full (G_PRIORITY_DEFAULT,
|
||||
(GSourceFunc) draw_on_main_cb, self, NULL);
|
||||
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
}
|
||||
|
||||
GtkClapperObject *
|
||||
gtk_clapper_object_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_CLAPPER_OBJECT, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_clapper_object_get_widget (GtkClapperObject *self)
|
||||
{
|
||||
return (GtkWidget *) self->picture;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wrap_current_gl (GstGLDisplay *display, GstGLPlatform platform, GstGLContext **context)
|
||||
{
|
||||
GstGLAPI gl_api = GST_GL_API_NONE;
|
||||
guint gl_major = 0, gl_minor = 0;
|
||||
|
||||
gl_api = gst_gl_context_get_current_gl_api (platform, &gl_major, &gl_minor);
|
||||
|
||||
if (gl_api) {
|
||||
const gboolean is_es = gl_api & (GST_GL_API_GLES1 | GST_GL_API_GLES2);
|
||||
gchar *gl_api_str = gst_gl_api_to_string (gl_api);
|
||||
guintptr gl_handle = 0;
|
||||
|
||||
GST_INFO ("Using GL API: %s, ver: %d.%d", gl_api_str, gl_major, gl_minor);
|
||||
g_free (gl_api_str);
|
||||
|
||||
if (is_es && platform == GST_GL_PLATFORM_EGL && !g_getenv ("GST_GL_API")) {
|
||||
GST_DEBUG ("No GST_GL_API env and GTK is using EGL GLES2, enforcing it");
|
||||
gst_gl_display_filter_gl_api (display, GST_GL_API_GLES2);
|
||||
}
|
||||
|
||||
gl_handle = gst_gl_context_get_current_gl_context (platform);
|
||||
if (gl_handle) {
|
||||
if ((*context = gst_gl_context_new_wrapped (display,
|
||||
gl_handle, platform, gl_api)))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
retrieve_gl_context_on_main (GtkClapperObject *self)
|
||||
{
|
||||
GdkDisplay *gdk_display;
|
||||
GstGLPlatform platform = GST_GL_PLATFORM_NONE;
|
||||
GError *error = NULL;
|
||||
|
||||
gst_clear_object (&self->wrapped_context);
|
||||
g_clear_object (&self->gdk_context);
|
||||
|
||||
gtk_widget_realize (GTK_WIDGET (self->picture));
|
||||
if (!((self->gdk_context = gdk_surface_create_gl_context (gtk_native_get_surface (
|
||||
gtk_widget_get_native (GTK_WIDGET (self->picture))), &error)))) {
|
||||
GST_ERROR_OBJECT (self, "Error creating Gdk GL context: %s",
|
||||
error ? error->message : "No error set by Gdk");
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
|
||||
//gdk_gl_context_set_use_es (self->gdk_context, TRUE);
|
||||
//gdk_gl_context_realize (self->gdk_context, &error);
|
||||
|
||||
gdk_display = gdk_gl_context_get_display (self->gdk_context);
|
||||
|
||||
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
|
||||
if (GDK_IS_X11_DISPLAY (gdk_display)) {
|
||||
gpointer display_ptr;
|
||||
#if GST_GL_HAVE_PLATFORM_EGL && GTK_CHECK_VERSION(4,3,1)
|
||||
display_ptr = gdk_x11_display_get_egl_display (gdk_display);
|
||||
if (display_ptr)
|
||||
self->display = (GstGLDisplay *)
|
||||
gst_gl_display_egl_new_with_egl_display (display_ptr);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND)
|
||||
if (GDK_IS_WAYLAND_DISPLAY (gdk_display)) {
|
||||
struct wl_display *wayland_display =
|
||||
gdk_wayland_display_get_wl_display (gdk_display);
|
||||
self->display = (GstGLDisplay *)
|
||||
gst_gl_display_wayland_new_with_display (wayland_display);
|
||||
}
|
||||
#endif
|
||||
if (G_UNLIKELY (!self->display)) {
|
||||
GST_WARNING_OBJECT (self, "Unknown Gdk display!");
|
||||
self->display = gst_gl_display_new ();
|
||||
}
|
||||
|
||||
#if GST_GL_HAVE_PLATFORM_EGL
|
||||
#if GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND)
|
||||
if (GST_IS_GL_DISPLAY_WAYLAND (self->display)) {
|
||||
platform = GST_GL_PLATFORM_EGL;
|
||||
GST_DEBUG ("Using EGL on Wayland");
|
||||
goto have_platform;
|
||||
}
|
||||
#endif
|
||||
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
|
||||
if (GST_IS_GL_DISPLAY_EGL (self->display)) {
|
||||
platform = GST_GL_PLATFORM_EGL;
|
||||
GST_DEBUG ("Using EGL on x11");
|
||||
goto have_platform;
|
||||
}
|
||||
#endif
|
||||
#endif /* GST_GL_HAVE_PLATFORM_EGL */
|
||||
|
||||
GST_ERROR ("Unsupported GL platform");
|
||||
return;
|
||||
|
||||
have_platform:
|
||||
g_object_ref (self->gdk_context);
|
||||
gdk_gl_context_make_current (self->gdk_context);
|
||||
|
||||
if (!wrap_current_gl (self->display, platform, &self->wrapped_context)) {
|
||||
GST_WARNING ("Could not retrieve Gdk OpenGL context");
|
||||
return;
|
||||
}
|
||||
|
||||
GST_INFO ("Retrieved Gdk OpenGL context %" GST_PTR_FORMAT, self->wrapped_context);
|
||||
gst_gl_context_activate (self->wrapped_context, TRUE);
|
||||
|
||||
if (!gst_gl_context_fill_info (self->wrapped_context, &error)) {
|
||||
GST_ERROR ("Failed to retrieve Gdk context info: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
g_clear_object (&self->wrapped_context);
|
||||
}
|
||||
|
||||
/* Deactivate in both places */
|
||||
_gdk_gl_context_set_active (self, FALSE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_clapper_object_init_winsys (GtkClapperObject *self)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
GTK_CLAPPER_OBJECT_LOCK (self);
|
||||
|
||||
if (self->display && self->gdk_context && self->wrapped_context) {
|
||||
GST_TRACE ("Have already initialized contexts");
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!self->wrapped_context) {
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
gst_gtk_invoke_on_main ((GThreadFunc) (GCallback) retrieve_gl_context_on_main, self);
|
||||
GTK_CLAPPER_OBJECT_LOCK (self);
|
||||
}
|
||||
|
||||
if (!GST_IS_GL_CONTEXT (self->wrapped_context)) {
|
||||
GST_FIXME ("Could not retrieve Gdk GL context");
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GTK_CLAPPER_OBJECT_UNLOCK (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* GdkPaintableInterface
|
||||
*/
|
||||
static void
|
||||
gtk_clapper_object_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot, gdouble width, gdouble height)
|
||||
{
|
||||
GtkClapperObject *self = GTK_CLAPPER_OBJECT_CAST (paintable);
|
||||
|
||||
if (self->paintable)
|
||||
gdk_paintable_snapshot (self->paintable, snapshot, width, height);
|
||||
}
|
||||
|
||||
static GdkPaintable *
|
||||
gtk_clapper_object_paintable_get_current_image (GdkPaintable *paintable)
|
||||
{
|
||||
GtkClapperObject *self = GTK_CLAPPER_OBJECT_CAST (paintable);
|
||||
|
||||
return (self->paintable)
|
||||
? g_object_ref (self->paintable)
|
||||
: gdk_paintable_new_empty (0, 0);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_clapper_object_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
GtkClapperObject *self = GTK_CLAPPER_OBJECT_CAST (paintable);
|
||||
|
||||
return self->display_width;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_clapper_object_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
GtkClapperObject *self = GTK_CLAPPER_OBJECT_CAST (paintable);
|
||||
|
||||
return self->display_height;
|
||||
}
|
||||
|
||||
static gdouble
|
||||
gtk_clapper_object_paintable_get_intrinsic_aspect_ratio (GdkPaintable *paintable)
|
||||
{
|
||||
GtkClapperObject *self = GTK_CLAPPER_OBJECT_CAST (paintable);
|
||||
|
||||
return self->display_aspect_ratio;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_clapper_object_paintable_iface_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = gtk_clapper_object_paintable_snapshot;
|
||||
iface->get_current_image = gtk_clapper_object_paintable_get_current_image;
|
||||
iface->get_intrinsic_width = gtk_clapper_object_paintable_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = gtk_clapper_object_paintable_get_intrinsic_height;
|
||||
iface->get_intrinsic_aspect_ratio = gtk_clapper_object_paintable_get_intrinsic_aspect_ratio;
|
||||
}
|
139
lib/gst/plugin/gtkclapperobject.h
vendored
139
lib/gst/plugin/gtkclapperobject.h
vendored
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* GStreamer
|
||||
* Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
|
||||
* Copyright (C) 2020-2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/gl/gl.h>
|
||||
|
||||
#include <gst/gl/gstglfuncs.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_CLAPPER_OBJECT (gtk_clapper_object_get_type ())
|
||||
#define GTK_IS_CLAPPER_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CLAPPER_OBJECT))
|
||||
#define GTK_IS_CLAPPER_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CLAPPER_OBJECT))
|
||||
#define GTK_CLAPPER_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CLAPPER_OBJECT, GtkClapperObjectClass))
|
||||
#define GTK_CLAPPER_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CLAPPER_OBJECT, GtkClapperObjectClass))
|
||||
#define GTK_CLAPPER_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CLAPPER_OBJECT, GtkClapperObject))
|
||||
#define GTK_CLAPPER_OBJECT_CAST(obj) ((GtkClapperObject*)(obj))
|
||||
|
||||
#define GTK_CLAPPER_OBJECT_LOCK(w) g_mutex_lock(&((GtkClapperObject*)(w))->lock)
|
||||
#define GTK_CLAPPER_OBJECT_UNLOCK(w) g_mutex_unlock(&((GtkClapperObject*)(w))->lock)
|
||||
|
||||
typedef struct _GtkClapperObject GtkClapperObject;
|
||||
typedef struct _GtkClapperObjectClass GtkClapperObjectClass;
|
||||
|
||||
struct _GtkClapperObject
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
GtkPicture *picture;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
GstGLDisplay *display;
|
||||
GdkGLContext *gdk_context;
|
||||
GstGLContext *wrapped_context;
|
||||
GstGLContext *gst_context;
|
||||
|
||||
/* properties */
|
||||
gboolean force_aspect_ratio;
|
||||
gint par_n, par_d;
|
||||
gboolean keep_last_frame;
|
||||
|
||||
gint display_width;
|
||||
gint display_height;
|
||||
gdouble display_aspect_ratio;
|
||||
|
||||
/* Object dimensions */
|
||||
gint scaled_width;
|
||||
gint scaled_height;
|
||||
|
||||
/* Position coords */
|
||||
gdouble last_pos_x;
|
||||
gdouble last_pos_y;
|
||||
|
||||
gboolean negotiated;
|
||||
gboolean ignore_buffers;
|
||||
|
||||
GstBuffer *pending_buffer;
|
||||
GstBuffer *buffer;
|
||||
|
||||
GstVideoInfo pending_v_info;
|
||||
GstVideoInfo v_info;
|
||||
|
||||
guint texture_id, oes_texture_id, next_texture_id;
|
||||
|
||||
/* resize */
|
||||
gboolean pending_resize;
|
||||
guint display_ratio_num;
|
||||
guint display_ratio_den;
|
||||
|
||||
/*< private >*/
|
||||
GMutex lock;
|
||||
GWeakRef element;
|
||||
|
||||
/* event controllers */
|
||||
GtkEventController *key_controller;
|
||||
GtkEventController *motion_controller;
|
||||
GtkGesture *click_gesture;
|
||||
|
||||
/* Pending draw idles callback */
|
||||
guint draw_id;
|
||||
|
||||
|
||||
|
||||
|
||||
GstGLTextureTarget gst_tex_target;
|
||||
guint gl_tex_target;
|
||||
|
||||
|
||||
GstGLShader *shader;
|
||||
|
||||
GLuint vao;
|
||||
GLuint vertex_buffer;
|
||||
GLint attr_position;
|
||||
GLint attr_texture;
|
||||
|
||||
gboolean initiated;
|
||||
|
||||
|
||||
guint frame_buffer;
|
||||
};
|
||||
|
||||
struct _GtkClapperObjectClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType gtk_clapper_object_get_type (void);
|
||||
GtkClapperObject * gtk_clapper_object_new (void);
|
||||
GtkWidget * gtk_clapper_object_get_widget (GtkClapperObject *object);
|
||||
|
||||
gboolean gtk_clapper_object_init_winsys (GtkClapperObject *object);
|
||||
|
||||
gboolean gtk_clapper_object_set_format (GtkClapperObject *object, GstVideoInfo *v_info);
|
||||
void gtk_clapper_object_set_buffer (GtkClapperObject *object, GstBuffer *buffer);
|
||||
void gtk_clapper_object_set_element (GtkClapperObject *object, GstElement *element);
|
||||
|
||||
G_END_DECLS
|
549
lib/gst/plugin/importers/gstclapperglbaseimporter.c
vendored
Normal file
549
lib/gst/plugin/importers/gstclapperglbaseimporter.c
vendored
Normal file
@@ -0,0 +1,549 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstclapperglbaseimporter.h"
|
||||
#include "gst/plugin/gstgdkformats.h"
|
||||
#include "gst/plugin/gstgtkutils.h"
|
||||
|
||||
#include <gst/gl/gstglfuncs.h>
|
||||
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WAYLAND
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#include <gst/gl/wayland/gstgldisplay_wayland.h>
|
||||
#endif
|
||||
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#endif
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_GLX
|
||||
#include <gst/gl/x11/gstgldisplay_x11.h>
|
||||
#endif
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_EGL
|
||||
#include <gst/gl/egl/gstgldisplay_egl.h>
|
||||
#endif
|
||||
|
||||
#define GST_CAT_DEFAULT gst_clapper_gl_base_importer_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||
|
||||
#define parent_class gst_clapper_gl_base_importer_parent_class
|
||||
G_DEFINE_TYPE (GstClapperGLBaseImporter, gst_clapper_gl_base_importer, GST_TYPE_CLAPPER_IMPORTER);
|
||||
|
||||
static GstGLContext *
|
||||
wrap_current_gl (GstGLDisplay *display, GdkGLAPI gdk_gl_api, GstGLPlatform platform)
|
||||
{
|
||||
GstGLAPI gst_gl_api = GST_GL_API_NONE;
|
||||
|
||||
switch (gdk_gl_api) {
|
||||
case GDK_GL_API_GL:
|
||||
gst_gl_api = GST_GL_API_OPENGL | GST_GL_API_OPENGL3;
|
||||
break;
|
||||
case GDK_GL_API_GLES:
|
||||
gst_gl_api = GST_GL_API_GLES2;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (gst_gl_api != GST_GL_API_NONE) {
|
||||
guintptr gl_handle;
|
||||
|
||||
gst_gl_display_filter_gl_api (display, gst_gl_api);
|
||||
|
||||
if ((gl_handle = gst_gl_context_get_current_gl_context (platform)))
|
||||
return gst_gl_context_new_wrapped (display, gl_handle, platform, gst_gl_api);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
retrieve_gl_context_on_main (GstClapperGLBaseImporter *self)
|
||||
{
|
||||
GstClapperGLBaseImporterClass *gl_bi_class = GST_CLAPPER_GL_BASE_IMPORTER_GET_CLASS (self);
|
||||
GdkDisplay *gdk_display;
|
||||
GdkGLContext *gdk_context;
|
||||
GError *error = NULL;
|
||||
GdkGLAPI gdk_gl_api;
|
||||
GstGLPlatform platform = GST_GL_PLATFORM_NONE;
|
||||
gint gl_major = 0, gl_minor = 0;
|
||||
|
||||
if (!gtk_init_check ()) {
|
||||
GST_ERROR_OBJECT (self, "Could not ensure GTK initialization");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Make sure we are clean here, otherwise data sharing
|
||||
* between GL-based importers may lead to leaks */
|
||||
gst_clear_object (&self->wrapped_context);
|
||||
g_clear_object (&self->gdk_context);
|
||||
gst_clear_object (&self->gst_display);
|
||||
|
||||
gdk_display = gdk_display_get_default ();
|
||||
|
||||
if (!(gdk_context = gdk_display_create_gl_context (gdk_display, &error))) {
|
||||
GST_ERROR_OBJECT (self, "Error creating Gdk GL context: %s",
|
||||
error ? error->message : "No error set by Gdk");
|
||||
g_clear_error (&error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gl_bi_class->gdk_context_realize (self, gdk_context)) {
|
||||
GST_ERROR_OBJECT (self, "Could not realize Gdk context: %" GST_PTR_FORMAT,
|
||||
gdk_context);
|
||||
g_object_unref (gdk_context);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
gdk_gl_api = gdk_gl_context_get_api (gdk_context);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
self->gdk_context = gdk_context;
|
||||
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (gdk_display)) {
|
||||
struct wl_display *wayland_display =
|
||||
gdk_wayland_display_get_wl_display (gdk_display);
|
||||
self->gst_display = (GstGLDisplay *)
|
||||
gst_gl_display_wayland_new_with_display (wayland_display);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11
|
||||
if (GDK_IS_X11_DISPLAY (gdk_display)) {
|
||||
gpointer display_ptr;
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_EGL
|
||||
display_ptr = gdk_x11_display_get_egl_display (gdk_display);
|
||||
if (display_ptr) {
|
||||
self->gst_display = (GstGLDisplay *)
|
||||
gst_gl_display_egl_new_with_egl_display (display_ptr);
|
||||
}
|
||||
#endif
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_GLX
|
||||
if (!self->gst_display) {
|
||||
display_ptr = gdk_x11_display_get_xdisplay (gdk_display);
|
||||
self->gst_display = (GstGLDisplay *)
|
||||
gst_gl_display_x11_new_with_display (display_ptr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Fallback to generic display */
|
||||
if (G_UNLIKELY (!self->gst_display)) {
|
||||
GST_WARNING_OBJECT (self, "Unknown Gdk display!");
|
||||
self->gst_display = gst_gl_display_new ();
|
||||
}
|
||||
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WAYLAND
|
||||
if (GST_IS_GL_DISPLAY_WAYLAND (self->gst_display)) {
|
||||
platform = GST_GL_PLATFORM_EGL;
|
||||
GST_INFO_OBJECT (self, "Using EGL on Wayland");
|
||||
goto have_display;
|
||||
}
|
||||
#endif
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_EGL
|
||||
if (GST_IS_GL_DISPLAY_EGL (self->gst_display)) {
|
||||
platform = GST_GL_PLATFORM_EGL;
|
||||
GST_INFO_OBJECT (self, "Using EGL on x11");
|
||||
goto have_display;
|
||||
}
|
||||
#endif
|
||||
#if GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_GLX
|
||||
if (GST_IS_GL_DISPLAY_X11 (self->gst_display)) {
|
||||
platform = GST_GL_PLATFORM_GLX;
|
||||
GST_INFO_OBJECT (self, "Using GLX on x11");
|
||||
goto have_display;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_clear_object (&self->gdk_context);
|
||||
gst_clear_object (&self->gst_display);
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
GST_ERROR_OBJECT (self, "Unsupported GL platform");
|
||||
return FALSE;
|
||||
|
||||
have_display:
|
||||
gdk_gl_context_make_current (self->gdk_context);
|
||||
|
||||
self->wrapped_context = wrap_current_gl (self->gst_display, gdk_gl_api, platform);
|
||||
if (!self->wrapped_context) {
|
||||
GST_ERROR ("Could not retrieve Gdk OpenGL context");
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
g_clear_object (&self->gdk_context);
|
||||
gst_clear_object (&self->gst_display);
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_INFO ("Retrieved Gdk OpenGL context %" GST_PTR_FORMAT, self->wrapped_context);
|
||||
gst_gl_context_activate (self->wrapped_context, TRUE);
|
||||
|
||||
if (!gst_gl_context_fill_info (self->wrapped_context, &error)) {
|
||||
GST_ERROR ("Failed to fill Gdk context info: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
gst_gl_context_activate (self->wrapped_context, FALSE);
|
||||
|
||||
gst_clear_object (&self->wrapped_context);
|
||||
g_clear_object (&self->gdk_context);
|
||||
gst_clear_object (&self->gst_display);
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_gl_context_get_gl_version (self->wrapped_context, &gl_major, &gl_minor);
|
||||
GST_INFO ("Using OpenGL%s %i.%i", (gdk_gl_api == GDK_GL_API_GLES) ? " ES" : "",
|
||||
gl_major, gl_minor);
|
||||
|
||||
/* Deactivate in both places */
|
||||
gst_gl_context_activate (self->wrapped_context, FALSE);
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
retrieve_gst_context (GstClapperGLBaseImporter *self)
|
||||
{
|
||||
GstGLDisplay *gst_display = NULL;
|
||||
GstGLContext *gst_context = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
gst_display = gst_object_ref (self->gst_display);
|
||||
|
||||
/* GstGLDisplay operations require display object lock to be held */
|
||||
GST_OBJECT_LOCK (gst_display);
|
||||
|
||||
if (!self->gst_context) {
|
||||
GST_TRACE_OBJECT (self, "Creating new GstGLContext");
|
||||
|
||||
if (!gst_gl_display_create_context (gst_display, self->wrapped_context,
|
||||
&self->gst_context, &error)) {
|
||||
GST_WARNING ("Could not create OpenGL context: %s",
|
||||
error ? error->message : "Unknown");
|
||||
g_clear_error (&error);
|
||||
|
||||
GST_OBJECT_UNLOCK (gst_display);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
gst_context = gst_object_ref (self->gst_context);
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
gst_gl_display_add_context (gst_display, gst_context);
|
||||
|
||||
GST_OBJECT_UNLOCK (gst_display);
|
||||
|
||||
gst_object_unref (gst_display);
|
||||
gst_object_unref (gst_context);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_clapper_gl_base_importer_prepare (GstClapperImporter *importer)
|
||||
{
|
||||
GstClapperGLBaseImporter *self = GST_CLAPPER_GL_BASE_IMPORTER_CAST (importer);
|
||||
gboolean need_invoke;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
need_invoke = (!self->gdk_context || !self->gst_display || !self->wrapped_context);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
if (need_invoke) {
|
||||
if (!(! !gst_gtk_invoke_on_main ((GThreadFunc) (GCallback)
|
||||
retrieve_gl_context_on_main, self)))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!retrieve_gst_context (self))
|
||||
return FALSE;
|
||||
|
||||
if (!GST_CLAPPER_IMPORTER_CLASS (parent_class)->prepare)
|
||||
return TRUE;
|
||||
|
||||
return GST_CLAPPER_IMPORTER_CLASS (parent_class)->prepare (importer);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_base_importer_share_data (GstClapperImporter *importer, GstClapperImporter *dest_importer)
|
||||
{
|
||||
GstClapperGLBaseImporter *self = GST_CLAPPER_GL_BASE_IMPORTER (importer);
|
||||
|
||||
if (GST_IS_CLAPPER_GL_BASE_IMPORTER (dest_importer)) {
|
||||
GstClapperGLBaseImporter *dest = GST_CLAPPER_GL_BASE_IMPORTER (dest_importer);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
GST_OBJECT_LOCK (dest);
|
||||
|
||||
/* Successfully prepared GL importer should have all three */
|
||||
if (self->gdk_context && self->gst_display && self->wrapped_context) {
|
||||
g_clear_object (&dest->gdk_context);
|
||||
dest->gdk_context = g_object_ref (self->gdk_context);
|
||||
|
||||
gst_clear_object (&dest->gst_display);
|
||||
dest->gst_display = gst_object_ref (self->gst_display);
|
||||
|
||||
gst_clear_object (&dest->wrapped_context);
|
||||
dest->wrapped_context = gst_object_ref (self->wrapped_context);
|
||||
}
|
||||
|
||||
/* This context is not required, we can create it ourselves
|
||||
* using gst_display and wrapped_context */
|
||||
if (self->gst_context) {
|
||||
gst_clear_object (&dest->gst_context);
|
||||
dest->gst_context = gst_object_ref (self->gst_context);
|
||||
}
|
||||
|
||||
GST_OBJECT_UNLOCK (dest);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
}
|
||||
|
||||
if (GST_CLAPPER_IMPORTER_CLASS (parent_class)->share_data)
|
||||
GST_CLAPPER_IMPORTER_CLASS (parent_class)->share_data (importer, dest_importer);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_clapper_gl_base_importer_handle_context_query (GstClapperImporter *importer,
|
||||
GstBaseSink *bsink, GstQuery *query)
|
||||
{
|
||||
GstClapperGLBaseImporter *self = GST_CLAPPER_GL_BASE_IMPORTER_CAST (importer);
|
||||
gboolean res;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
res = gst_gl_handle_context_query (GST_ELEMENT_CAST (bsink), query,
|
||||
self->gst_display, self->gst_context, self->wrapped_context);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstBufferPool *
|
||||
gst_clapper_gl_base_importer_create_pool (GstClapperImporter *importer, GstStructure **config)
|
||||
{
|
||||
GstClapperGLBaseImporter *self = GST_CLAPPER_GL_BASE_IMPORTER_CAST (importer);
|
||||
GstBufferPool *pool;
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Creating new GL buffer pool");
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
pool = gst_gl_buffer_pool_new (self->gst_context);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
*config = gst_buffer_pool_get_config (pool);
|
||||
|
||||
gst_buffer_pool_config_add_option (*config, GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||
gst_buffer_pool_config_add_option (*config, GST_BUFFER_POOL_OPTION_GL_SYNC_META);
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_base_importer_add_allocation_metas (GstClapperImporter *importer, GstQuery *query)
|
||||
{
|
||||
GstClapperGLBaseImporter *self = GST_CLAPPER_GL_BASE_IMPORTER_CAST (importer);
|
||||
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, NULL);
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (self->gst_context->gl_vtable->FenceSync)
|
||||
gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, NULL);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_clapper_gl_base_importer_gdk_context_realize (GstClapperGLBaseImporter *self, GdkGLContext *gdk_context)
|
||||
{
|
||||
GdkGLAPI allowed_apis;
|
||||
GError *error = NULL;
|
||||
const gchar *gl_env;
|
||||
gboolean success;
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Realizing GdkGLContext with default implementation");
|
||||
|
||||
/* Use single "GST_GL_API" env to also influence Gdk GL selection */
|
||||
gl_env = g_getenv ("GST_GL_API");
|
||||
allowed_apis = (!gl_env || g_str_has_prefix (gl_env, "gles"))
|
||||
? GDK_GL_API_GLES
|
||||
: (g_str_has_prefix (gl_env, "opengl"))
|
||||
? GDK_GL_API_GL
|
||||
: GDK_GL_API_GL | GDK_GL_API_GLES;
|
||||
|
||||
gdk_gl_context_set_allowed_apis (gdk_context, allowed_apis);
|
||||
if (!(success = gdk_gl_context_realize (gdk_context, &error))) {
|
||||
GST_WARNING_OBJECT (self, "Could not realize Gdk context with %s: %s",
|
||||
(allowed_apis & GDK_GL_API_GL) ? "GL" : "GLES", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
if (!success && !gl_env) {
|
||||
gdk_gl_context_set_allowed_apis (gdk_context, GDK_GL_API_GL);
|
||||
if (!(success = gdk_gl_context_realize (gdk_context, &error))) {
|
||||
GST_WARNING_OBJECT (self, "Could not realize Gdk context with GL: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_base_importer_init (GstClapperGLBaseImporter *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_base_importer_finalize (GObject *object)
|
||||
{
|
||||
GstClapperGLBaseImporter *self = GST_CLAPPER_GL_BASE_IMPORTER_CAST (object);
|
||||
|
||||
g_clear_object (&self->gdk_context);
|
||||
|
||||
gst_clear_object (&self->gst_display);
|
||||
gst_clear_object (&self->wrapped_context);
|
||||
gst_clear_object (&self->gst_context);
|
||||
|
||||
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_base_importer_class_init (GstClapperGLBaseImporterClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstClapperImporterClass *importer_class = (GstClapperImporterClass *) klass;
|
||||
GstClapperGLBaseImporterClass *gl_bi_class = (GstClapperGLBaseImporterClass *) klass;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clapperglbaseimporter", 0,
|
||||
"Clapper GL Base Importer");
|
||||
|
||||
gobject_class->finalize = gst_clapper_gl_base_importer_finalize;
|
||||
|
||||
importer_class->prepare = gst_clapper_gl_base_importer_prepare;
|
||||
importer_class->share_data = gst_clapper_gl_base_importer_share_data;
|
||||
importer_class->handle_context_query = gst_clapper_gl_base_importer_handle_context_query;
|
||||
importer_class->create_pool = gst_clapper_gl_base_importer_create_pool;
|
||||
importer_class->add_allocation_metas = gst_clapper_gl_base_importer_add_allocation_metas;
|
||||
|
||||
gl_bi_class->gdk_context_realize = gst_clapper_gl_base_importer_gdk_context_realize;
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
gst_clapper_gl_base_importer_make_supported_gdk_gl_caps (void)
|
||||
{
|
||||
GstCaps *caps, *tmp;
|
||||
|
||||
tmp = gst_caps_from_string (
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
|
||||
"{ " GST_GDK_GL_TEXTURE_FORMATS " }") ", "
|
||||
"texture-target = (string) { " GST_GL_TEXTURE_TARGET_2D_STR " }");
|
||||
|
||||
caps = gst_caps_copy (tmp);
|
||||
gst_caps_set_features_simple (caps, gst_caps_features_new (
|
||||
GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
|
||||
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, NULL));
|
||||
|
||||
gst_caps_append (caps, tmp);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
GStrv
|
||||
gst_clapper_gl_base_importer_make_gl_context_types (void)
|
||||
{
|
||||
GStrv context_types;
|
||||
GStrvBuilder *builder = g_strv_builder_new ();
|
||||
|
||||
g_strv_builder_add (builder, GST_GL_DISPLAY_CONTEXT_TYPE);
|
||||
g_strv_builder_add (builder, "gst.gl.app_context");
|
||||
g_strv_builder_add (builder, "gst.gl.local_context");
|
||||
|
||||
context_types = g_strv_builder_end (builder);
|
||||
g_strv_builder_unref (builder);
|
||||
|
||||
return context_types;
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gst_clapper_gl_base_importer_make_gl_texture (GstClapperGLBaseImporter *self,
|
||||
GstBuffer *buffer, GstVideoInfo *v_info)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GstGLSyncMeta *sync_meta;
|
||||
GstVideoFrame frame;
|
||||
|
||||
if (G_UNLIKELY (!gst_video_frame_map (&frame, v_info, buffer, GST_MAP_READ | GST_MAP_GL))) {
|
||||
GST_ERROR_OBJECT (self, "Could not map input buffer for reading");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
/* Must have context active here for both sync meta
|
||||
* and Gdk texture format auto-detection to work */
|
||||
gdk_gl_context_make_current (self->gdk_context);
|
||||
gst_gl_context_activate (self->wrapped_context, TRUE);
|
||||
|
||||
sync_meta = gst_buffer_get_gl_sync_meta (buffer);
|
||||
|
||||
/* Wait for all previous OpenGL commands to complete,
|
||||
* before we start using the input texture */
|
||||
if (sync_meta) {
|
||||
gst_gl_sync_meta_set_sync_point (sync_meta, self->gst_context);
|
||||
gst_gl_sync_meta_wait (sync_meta, self->wrapped_context);
|
||||
}
|
||||
|
||||
texture = gdk_gl_texture_new (
|
||||
self->gdk_context,
|
||||
*(guint *) GST_VIDEO_FRAME_PLANE_DATA (&frame, 0),
|
||||
GST_VIDEO_FRAME_WIDTH (&frame),
|
||||
GST_VIDEO_FRAME_HEIGHT (&frame),
|
||||
(GDestroyNotify) gst_buffer_unref,
|
||||
gst_buffer_ref (buffer));
|
||||
|
||||
gst_gl_context_activate (self->wrapped_context, FALSE);
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
gst_video_frame_unmap (&frame);
|
||||
|
||||
return texture;
|
||||
}
|
75
lib/gst/plugin/importers/gstclapperglbaseimporter.h
vendored
Normal file
75
lib/gst/plugin/importers/gstclapperglbaseimporter.h
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gl/gl.h>
|
||||
|
||||
#include "gst/plugin/gstclapperimporter.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_CLAPPER_GL_BASE_IMPORTER (gst_clapper_gl_base_importer_get_type())
|
||||
#define GST_IS_CLAPPER_GL_BASE_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CLAPPER_GL_BASE_IMPORTER))
|
||||
#define GST_IS_CLAPPER_GL_BASE_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CLAPPER_GL_BASE_IMPORTER))
|
||||
#define GST_CLAPPER_GL_BASE_IMPORTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CLAPPER_GL_BASE_IMPORTER, GstClapperGLBaseImporterClass))
|
||||
#define GST_CLAPPER_GL_BASE_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CLAPPER_GL_BASE_IMPORTER, GstClapperGLBaseImporter))
|
||||
#define GST_CLAPPER_GL_BASE_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CLAPPER_GL_BASE_IMPORTER, GstClapperGLBaseImporterClass))
|
||||
#define GST_CLAPPER_GL_BASE_IMPORTER_CAST(obj) ((GstClapperGLBaseImporter *)(obj))
|
||||
|
||||
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_WAYLAND (GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND))
|
||||
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11 (GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11))
|
||||
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_GLX (GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11 && GST_GL_HAVE_PLATFORM_GLX)
|
||||
#define GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11_EGL (GST_CLAPPER_GL_BASE_IMPORTER_HAVE_X11 && GST_GL_HAVE_PLATFORM_EGL)
|
||||
|
||||
typedef struct _GstClapperGLBaseImporter GstClapperGLBaseImporter;
|
||||
typedef struct _GstClapperGLBaseImporterClass GstClapperGLBaseImporterClass;
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GstClapperGLBaseImporter, gst_object_unref)
|
||||
#endif
|
||||
|
||||
struct _GstClapperGLBaseImporter
|
||||
{
|
||||
GstClapperImporter parent;
|
||||
|
||||
GdkGLContext *gdk_context;
|
||||
|
||||
GstGLDisplay *gst_display;
|
||||
GstGLContext *wrapped_context;
|
||||
GstGLContext *gst_context;
|
||||
};
|
||||
|
||||
struct _GstClapperGLBaseImporterClass
|
||||
{
|
||||
GstClapperImporterClass parent_class;
|
||||
|
||||
gboolean (* gdk_context_realize) (GstClapperGLBaseImporter *gl_bi,
|
||||
GdkGLContext *gdk_context);
|
||||
};
|
||||
|
||||
GType gst_clapper_gl_base_importer_get_type (void);
|
||||
|
||||
GstCaps * gst_clapper_gl_base_importer_make_supported_gdk_gl_caps (void);
|
||||
|
||||
GStrv gst_clapper_gl_base_importer_make_gl_context_types (void);
|
||||
|
||||
GdkTexture * gst_clapper_gl_base_importer_make_gl_texture (GstClapperGLBaseImporter *self, GstBuffer *buffer, GstVideoInfo *v_info);
|
||||
|
||||
G_END_DECLS
|
70
lib/gst/plugin/importers/gstclapperglimporter.c
vendored
Normal file
70
lib/gst/plugin/importers/gstclapperglimporter.c
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstclapperglimporter.h"
|
||||
|
||||
#define GST_CAT_DEFAULT gst_clapper_gl_importer_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||
|
||||
#define parent_class gst_clapper_gl_importer_parent_class
|
||||
GST_CLAPPER_IMPORTER_DEFINE (GstClapperGLImporter, gst_clapper_gl_importer, GST_TYPE_CLAPPER_GL_BASE_IMPORTER);
|
||||
|
||||
static GdkTexture *
|
||||
gst_clapper_gl_importer_generate_texture (GstClapperImporter *importer,
|
||||
GstBuffer *buffer, GstVideoInfo *v_info)
|
||||
{
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (importer);
|
||||
|
||||
return gst_clapper_gl_base_importer_make_gl_texture (gl_bi, buffer, v_info);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_importer_init (GstClapperGLImporter *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_importer_class_init (GstClapperGLImporterClass *klass)
|
||||
{
|
||||
GstClapperImporterClass *importer_class = (GstClapperImporterClass *) klass;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clapperglimporter", 0,
|
||||
"Clapper GL Importer");
|
||||
|
||||
importer_class->generate_texture = gst_clapper_gl_importer_generate_texture;
|
||||
}
|
||||
|
||||
GstClapperImporter *
|
||||
make_importer (void)
|
||||
{
|
||||
return g_object_new (GST_TYPE_CLAPPER_GL_IMPORTER, NULL);
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
make_caps (GstRank *rank, GStrv *context_types)
|
||||
{
|
||||
*rank = GST_RANK_SECONDARY;
|
||||
*context_types = gst_clapper_gl_base_importer_make_gl_context_types ();
|
||||
|
||||
return gst_clapper_gl_base_importer_make_supported_gdk_gl_caps ();
|
||||
}
|
36
lib/gst/plugin/importers/gstclapperglimporter.h
vendored
Normal file
36
lib/gst/plugin/importers/gstclapperglimporter.h
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gstclapperglbaseimporter.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_CLAPPER_GL_IMPORTER (gst_clapper_gl_importer_get_type())
|
||||
G_DECLARE_FINAL_TYPE (GstClapperGLImporter, gst_clapper_gl_importer, GST, CLAPPER_GL_IMPORTER, GstClapperGLBaseImporter)
|
||||
|
||||
#define GST_CLAPPER_GL_IMPORTER_CAST(obj) ((GstClapperGLImporter *)(obj))
|
||||
|
||||
struct _GstClapperGLImporter
|
||||
{
|
||||
GstClapperGLBaseImporter parent;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
646
lib/gst/plugin/importers/gstclappergluploader.c
vendored
Normal file
646
lib/gst/plugin/importers/gstclappergluploader.c
vendored
Normal file
@@ -0,0 +1,646 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstclappergluploader.h"
|
||||
#include "gst/plugin/gstgtkutils.h"
|
||||
|
||||
#include <gst/gl/egl/gsteglimage.h>
|
||||
#include <gst/allocators/gstdmabuf.h>
|
||||
|
||||
static const GLfloat vertices[] = {
|
||||
1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
|
||||
-1.0f, 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
-1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
|
||||
1.0f, -1.0f, 0.0f, 1.0f, 1.0f
|
||||
};
|
||||
static const GLushort indices[] = {
|
||||
0, 1, 2, 0, 2, 3
|
||||
};
|
||||
|
||||
/* GTK4 renders things upside down ¯\_(ツ)_/¯ */
|
||||
static const gfloat vertical_flip_matrix[] = {
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, -1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GstClapperGLUploader *dmabuf_bi;
|
||||
GLuint id;
|
||||
guint width;
|
||||
guint height;
|
||||
} GstClapperDmabufTexData;
|
||||
|
||||
#define GST_CAT_DEFAULT gst_clapper_gl_uploader_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||
|
||||
#define parent_class gst_clapper_gl_uploader_parent_class
|
||||
GST_CLAPPER_IMPORTER_DEFINE (GstClapperGLUploader, gst_clapper_gl_uploader, GST_TYPE_CLAPPER_GL_BASE_IMPORTER);
|
||||
|
||||
static void
|
||||
gst_clapper_gl_uploader_bind_buffer (GstClapperGLUploader *self)
|
||||
{
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (self);
|
||||
const GstGLFuncs *gl = gl_bi->gst_context->gl_vtable;
|
||||
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, self->vertex_buffer);
|
||||
|
||||
/* Load the vertex position */
|
||||
gl->VertexAttribPointer (self->attr_position, 3, GL_FLOAT, GL_FALSE,
|
||||
5 * sizeof (GLfloat), (void *) 0);
|
||||
|
||||
/* Load the texture coordinate */
|
||||
gl->VertexAttribPointer (self->attr_texture, 2, GL_FLOAT, GL_FALSE,
|
||||
5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
|
||||
|
||||
gl->EnableVertexAttribArray (self->attr_position);
|
||||
gl->EnableVertexAttribArray (self->attr_texture);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_uploader_unbind_buffer (GstClapperGLUploader *self)
|
||||
{
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (self);
|
||||
const GstGLFuncs *gl = gl_bi->gst_context->gl_vtable;
|
||||
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
gl->DisableVertexAttribArray (self->attr_position);
|
||||
gl->DisableVertexAttribArray (self->attr_texture);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
prepare_dmabuf_support_on_main (GstClapperGLUploader *self)
|
||||
{
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (self);
|
||||
GstGLSLStage *frag_stage, *vert_stage;
|
||||
GError *error = NULL;
|
||||
gchar *frag_str;
|
||||
const GstGLFuncs *gl;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
/* FIXME: Return if already prepared */
|
||||
|
||||
gdk_gl_context_make_current (gl_bi->gdk_context);
|
||||
gst_gl_context_activate (gl_bi->gst_context, TRUE);
|
||||
|
||||
if (!((vert_stage = gst_glsl_stage_new_with_string (gl_bi->gst_context,
|
||||
GL_VERTEX_SHADER, GST_GLSL_VERSION_NONE,
|
||||
GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY,
|
||||
gst_gl_shader_string_vertex_mat4_vertex_transform)))) {
|
||||
gdk_gl_context_make_current (gl_bi->gdk_context);
|
||||
gst_gl_context_activate (gl_bi->gst_context, TRUE);
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
GST_ERROR ("Failed to retrieve vertex shader for texture target");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
frag_str = gst_gl_shader_string_fragment_external_oes_get_default (
|
||||
gl_bi->gst_context, GST_GLSL_VERSION_NONE,
|
||||
GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY);
|
||||
frag_stage = gst_glsl_stage_new_with_string (gl_bi->gst_context,
|
||||
GL_FRAGMENT_SHADER, GST_GLSL_VERSION_NONE,
|
||||
GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY, frag_str);
|
||||
|
||||
g_free (frag_str);
|
||||
|
||||
if (!frag_stage) {
|
||||
gst_gl_context_activate (gl_bi->gst_context, FALSE);
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
GST_ERROR ("Failed to retrieve fragment shader for texture target");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!((self->shader = gst_gl_shader_new_link_with_stages (gl_bi->gst_context,
|
||||
&error, vert_stage, frag_stage, NULL)))) {
|
||||
gst_gl_context_activate (gl_bi->gst_context, FALSE);
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
GST_ERROR ("Failed to initialize shader: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->attr_position =
|
||||
gst_gl_shader_get_attribute_location (self->shader, "a_position");
|
||||
self->attr_texture =
|
||||
gst_gl_shader_get_attribute_location (self->shader, "a_texcoord");
|
||||
|
||||
gl = gl_bi->gst_context->gl_vtable;
|
||||
|
||||
if (gl->GenVertexArrays) {
|
||||
gl->GenVertexArrays (1, &self->vao);
|
||||
gl->BindVertexArray (self->vao);
|
||||
}
|
||||
|
||||
gl->GenBuffers (1, &self->vertex_buffer);
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, self->vertex_buffer);
|
||||
gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices, GL_STATIC_DRAW);
|
||||
|
||||
if (gl->GenVertexArrays) {
|
||||
gst_clapper_gl_uploader_bind_buffer (self);
|
||||
gl->BindVertexArray (0);
|
||||
}
|
||||
|
||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||
//self->prepared = TRUE;
|
||||
|
||||
gst_gl_context_activate (gl_bi->gst_context, FALSE);
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_tex_data_free (GstClapperDmabufTexData *tex_data)
|
||||
{
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (tex_data->dmabuf_bi);
|
||||
|
||||
if (G_LIKELY (tex_data->id > 0)) {
|
||||
const GstGLFuncs *gl;
|
||||
|
||||
GST_OBJECT_LOCK (gl_bi);
|
||||
|
||||
gl = gl_bi->gst_context->gl_vtable;
|
||||
|
||||
gdk_gl_context_make_current (gl_bi->gdk_context);
|
||||
gst_gl_context_activate (gl_bi->gst_context, TRUE);
|
||||
|
||||
gl->DeleteTextures (1, &tex_data->id);
|
||||
|
||||
gst_gl_context_activate (gl_bi->gst_context, FALSE);
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
GST_OBJECT_UNLOCK (gl_bi);
|
||||
}
|
||||
|
||||
gst_object_unref (tex_data->dmabuf_bi);
|
||||
g_slice_free (GstClapperDmabufTexData, tex_data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_dmabuf_into_texture (GstClapperGLUploader *self, gint *fds, GstVideoInfo *v_info,
|
||||
gsize *offsets, GstClapperDmabufTexData *tex_data)
|
||||
{
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (self);
|
||||
GstEGLImage *image;
|
||||
const GstGLFuncs *gl;
|
||||
|
||||
image = gst_egl_image_from_dmabuf_direct_target (gl_bi->gst_context,
|
||||
fds, offsets, v_info, self->gst_tex_target);
|
||||
|
||||
/* If HW colorspace conversion failed and there is only one
|
||||
* plane, we can just make it into single EGLImage as is */
|
||||
if (!image && GST_VIDEO_INFO_N_PLANES (v_info) == 1)
|
||||
image = gst_egl_image_from_dmabuf (gl_bi->gst_context,
|
||||
fds[0], v_info, 0, offsets[0]);
|
||||
|
||||
if (!image)
|
||||
return FALSE;
|
||||
|
||||
gl = gl_bi->gst_context->gl_vtable;
|
||||
|
||||
gl->GenTextures (1, &tex_data->id);
|
||||
tex_data->width = GST_VIDEO_INFO_WIDTH (v_info);
|
||||
tex_data->height = GST_VIDEO_INFO_HEIGHT (v_info);
|
||||
|
||||
gl->BindTexture (self->gl_tex_target, tex_data->id);
|
||||
|
||||
gl->TexParameteri (self->gl_tex_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
gl->TexParameteri (self->gl_tex_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
gl->TexParameteri (self->gl_tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
gl->TexParameteri (self->gl_tex_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
gl->EGLImageTargetTexture2D (self->gl_tex_target, gst_egl_image_get_image (image));
|
||||
|
||||
gl->BindTexture (GL_TEXTURE_2D, 0);
|
||||
gst_egl_image_unref (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_oes_texture_into_2d (GstClapperGLUploader *self, GstClapperDmabufTexData *tex_data)
|
||||
{
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (self);
|
||||
GLuint framebuffer, tex_id;
|
||||
GLenum status;
|
||||
const GstGLFuncs *gl;
|
||||
|
||||
gl = gl_bi->gst_context->gl_vtable;
|
||||
|
||||
gl->GenFramebuffers (1, &framebuffer);
|
||||
gl->BindFramebuffer (GL_FRAMEBUFFER, framebuffer);
|
||||
|
||||
gl->GenTextures (1, &tex_id);
|
||||
gl->BindTexture (GL_TEXTURE_2D, tex_id);
|
||||
|
||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, tex_data->width, tex_data->height, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_TEXTURE_2D, tex_id, 0);
|
||||
|
||||
status = gl->CheckFramebufferStatus (GL_FRAMEBUFFER);
|
||||
if (G_UNLIKELY (status != GL_FRAMEBUFFER_COMPLETE)) {
|
||||
GST_ERROR ("Invalid framebuffer status: %u", status);
|
||||
|
||||
gl->BindTexture (GL_TEXTURE_2D, 0);
|
||||
gl->DeleteTextures (1, &tex_id);
|
||||
|
||||
gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
gl->DeleteFramebuffers (1, &framebuffer);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gl->Viewport (0, 0, tex_data->width, tex_data->height);
|
||||
|
||||
gst_gl_shader_use (self->shader);
|
||||
|
||||
if (gl->BindVertexArray)
|
||||
gl->BindVertexArray (self->vao);
|
||||
|
||||
gst_clapper_gl_uploader_bind_buffer (self);
|
||||
|
||||
gl->ActiveTexture (GL_TEXTURE0);
|
||||
gl->BindTexture (self->gl_tex_target, tex_data->id);
|
||||
|
||||
gst_gl_shader_set_uniform_1i (self->shader, "tex", 0);
|
||||
gst_gl_shader_set_uniform_matrix_4fv (self->shader,
|
||||
"u_transformation", 1, FALSE, vertical_flip_matrix);
|
||||
|
||||
gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
|
||||
|
||||
if (gl->BindVertexArray)
|
||||
gl->BindVertexArray (0);
|
||||
else
|
||||
gst_clapper_gl_uploader_unbind_buffer (self);
|
||||
|
||||
gl->BindTexture (self->gl_tex_target, 0);
|
||||
|
||||
/* Replace External OES texture with newly created 2D */
|
||||
gl->DeleteTextures (1, &tex_data->id);
|
||||
tex_data->id = tex_id;
|
||||
|
||||
gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
gl->DeleteFramebuffers (1, &framebuffer);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
dmabuf_into_gdk_texture (GstClapperGLUploader *self, GstVideoInfo *v_info, gint *fds, gsize *offsets)
|
||||
{
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (self);
|
||||
GdkTexture *texture = NULL;
|
||||
GstClapperDmabufTexData *tex_data;
|
||||
|
||||
tex_data = g_slice_new (GstClapperDmabufTexData);
|
||||
tex_data->dmabuf_bi = gst_object_ref (self);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
gdk_gl_context_make_current (gl_bi->gdk_context);
|
||||
gst_gl_context_activate (gl_bi->gst_context, TRUE);
|
||||
|
||||
if (!_dmabuf_into_texture (self, fds, v_info, offsets, tex_data))
|
||||
goto finish;
|
||||
|
||||
/* GTK4 does not support External OES textures.
|
||||
* Make it into 2D using framebuffer + shader */
|
||||
if (self->gst_tex_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) {
|
||||
if (G_UNLIKELY (!_oes_texture_into_2d (self, tex_data)))
|
||||
goto finish;
|
||||
}
|
||||
|
||||
texture = gdk_gl_texture_new (gl_bi->gdk_context,
|
||||
tex_data->id,
|
||||
tex_data->width,
|
||||
tex_data->height,
|
||||
(GDestroyNotify) _tex_data_free,
|
||||
tex_data);
|
||||
|
||||
finish:
|
||||
gst_gl_context_activate (gl_bi->gst_context, FALSE);
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify_dmabuf_memory (GstBuffer *buffer, GstVideoInfo *info, gint *fds, gsize *offsets)
|
||||
{
|
||||
guint i, n_planes = GST_VIDEO_INFO_N_PLANES (info);
|
||||
|
||||
for (i = 0; i < n_planes; i++) {
|
||||
GstMemory *memory;
|
||||
gsize plane_size, mem_skip;
|
||||
guint mem_idx, length;
|
||||
|
||||
plane_size = gst_gl_get_plane_data_size (info, NULL, i);
|
||||
|
||||
if (!gst_buffer_find_memory (buffer,
|
||||
GST_VIDEO_INFO_PLANE_OFFSET (info, i),
|
||||
plane_size, &mem_idx, &length, &mem_skip)) {
|
||||
GST_DEBUG ("Could not find memory %u", i);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* We cannot have more then one DMABuf per plane */
|
||||
if (length != 1) {
|
||||
GST_DEBUG ("Data for plane %u spans %u memories", i, length);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
memory = gst_buffer_peek_memory (buffer, mem_idx);
|
||||
|
||||
offsets[i] = memory->offset + mem_skip;
|
||||
fds[i] = gst_dmabuf_memory_get_fd (memory);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_update_elements_caps_locked (GstClapperGLUploader *self, GstCaps *upload_sink_caps)
|
||||
{
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (self);
|
||||
GstCaps *upload_src_caps, *color_sink_caps, *color_src_caps, *gdk_sink_caps;
|
||||
|
||||
GST_INFO_OBJECT (self, "Input caps: %" GST_PTR_FORMAT, upload_sink_caps);
|
||||
|
||||
upload_src_caps = gst_gl_upload_transform_caps (self->upload, gl_bi->gst_context,
|
||||
GST_PAD_SINK, upload_sink_caps, NULL);
|
||||
upload_src_caps = gst_caps_fixate (upload_src_caps);
|
||||
|
||||
GST_INFO_OBJECT (self, "GLUpload caps: %" GST_PTR_FORMAT, upload_src_caps);
|
||||
gst_gl_upload_set_caps (self->upload, upload_sink_caps, upload_src_caps);
|
||||
|
||||
gdk_sink_caps = gst_clapper_gl_base_importer_make_supported_gdk_gl_caps ();
|
||||
color_sink_caps = gst_gl_color_convert_transform_caps (gl_bi->gst_context,
|
||||
GST_PAD_SRC, upload_src_caps, gdk_sink_caps);
|
||||
gst_caps_unref (gdk_sink_caps);
|
||||
|
||||
/* Second caps arg is transfer-full */
|
||||
color_src_caps = gst_gl_color_convert_fixate_caps (gl_bi->gst_context,
|
||||
GST_PAD_SINK, upload_src_caps, color_sink_caps);
|
||||
|
||||
GST_INFO_OBJECT (self, "GLColorConvert caps: %" GST_PTR_FORMAT, color_src_caps);
|
||||
gst_gl_color_convert_set_caps (self->color_convert, upload_src_caps, color_src_caps);
|
||||
|
||||
self->has_pending_v_info = gst_video_info_from_caps (&self->pending_v_info, color_src_caps);
|
||||
|
||||
gst_caps_unref (upload_src_caps);
|
||||
gst_caps_unref (color_src_caps);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_uploader_set_caps (GstClapperImporter *importer, GstCaps *caps)
|
||||
{
|
||||
GstClapperGLUploader *self = GST_CLAPPER_GL_UPLOADER_CAST (importer);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
_update_elements_caps_locked (self, caps);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
}
|
||||
|
||||
static void
|
||||
_uploader_reconfigure_locked (GstClapperGLUploader *self)
|
||||
{
|
||||
GstCaps *in_caps = NULL;
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Reconfiguring upload");
|
||||
|
||||
gst_gl_upload_get_caps (self->upload, &in_caps, NULL);
|
||||
|
||||
if (G_LIKELY (in_caps)) {
|
||||
_update_elements_caps_locked (self, in_caps);
|
||||
gst_caps_unref (in_caps);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_clapper_gl_uploader_prepare (GstClapperImporter *importer)
|
||||
{
|
||||
gboolean res = GST_CLAPPER_IMPORTER_CLASS (parent_class)->prepare (importer);
|
||||
|
||||
if (res) {
|
||||
GstClapperGLUploader *self = GST_CLAPPER_GL_UPLOADER_CAST (importer);
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (importer);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
if (!self->upload)
|
||||
self->upload = gst_gl_upload_new (gl_bi->gst_context);
|
||||
if (!self->color_convert)
|
||||
self->color_convert = gst_gl_color_convert_new (gl_bi->gst_context);
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
if (!(! !gst_gtk_invoke_on_main (
|
||||
(GThreadFunc) (GCallback) prepare_dmabuf_support_on_main, self))) {
|
||||
GST_WARNING_OBJECT (self, "Could not prepare DMABuf support");
|
||||
|
||||
/* FIXME: Continue to allow using glupload/cc as fallback */
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
_upload_perform_locked (GstClapperGLUploader *self, GstBuffer *buffer)
|
||||
{
|
||||
GstBuffer *upload_buf = NULL;
|
||||
GstGLUploadReturn ret;
|
||||
|
||||
ret = gst_gl_upload_perform_with_buffer (self->upload, buffer, &upload_buf);
|
||||
|
||||
if (G_UNLIKELY (ret != GST_GL_UPLOAD_DONE)) {
|
||||
switch (ret) {
|
||||
case GST_GL_UPLOAD_RECONFIGURE:
|
||||
_uploader_reconfigure_locked (self);
|
||||
/* Retry with the same buffer after reconfiguring */
|
||||
return _upload_perform_locked (self, buffer);
|
||||
default:
|
||||
GST_ERROR_OBJECT (self, "Could not upload input buffer, returned: %i", ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return upload_buf;
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
gst_clapper_gl_uploader_generate_texture (GstClapperImporter *importer,
|
||||
GstBuffer *buffer, GstVideoInfo *v_info)
|
||||
{
|
||||
GstClapperGLUploader *self = GST_CLAPPER_GL_UPLOADER_CAST (importer);
|
||||
GstClapperGLBaseImporter *gl_bi = GST_CLAPPER_GL_BASE_IMPORTER_CAST (importer);
|
||||
GstBuffer *upload_buf, *color_buf;
|
||||
GstVideoMeta *meta;
|
||||
GdkTexture *texture;
|
||||
|
||||
/* XXX: We both upload and perform color conversion here, thus we skip
|
||||
* upload for buffers that are not going to be shown and gain more free
|
||||
* CPU time to prepare the next one. Improves performance on weak HW. */
|
||||
|
||||
if ((meta = gst_buffer_get_video_meta (buffer))) {
|
||||
guint i;
|
||||
|
||||
GST_VIDEO_INFO_WIDTH (v_info) = meta->width;
|
||||
GST_VIDEO_INFO_HEIGHT (v_info) = meta->height;
|
||||
|
||||
for (i = 0; i < meta->n_planes; i++) {
|
||||
GST_VIDEO_INFO_PLANE_OFFSET (v_info, i) = meta->offset[i];
|
||||
GST_VIDEO_INFO_PLANE_STRIDE (v_info, i) = meta->stride[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: if can do dmabuf and seems like we have dmabuf here */
|
||||
{
|
||||
gint fds[GST_VIDEO_MAX_PLANES];
|
||||
gsize offsets[GST_VIDEO_MAX_PLANES];
|
||||
|
||||
if (verify_dmabuf_memory (buffer, v_info, fds, offsets)) {
|
||||
if ((texture = dmabuf_into_gdk_texture (self, v_info, fds, offsets))) {
|
||||
GST_TRACE_OBJECT (self, "Got texture from DMABuf, skipping upload of %" GST_PTR_FORMAT, buffer);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (self, "Uploading %" GST_PTR_FORMAT, buffer);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
upload_buf = _upload_perform_locked (self, buffer);
|
||||
|
||||
if (G_UNLIKELY (!upload_buf)) {
|
||||
GST_ERROR_OBJECT (self, "Could not perform upload on input buffer");
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
GST_LOG_OBJECT (self, "Uploaded into %" GST_PTR_FORMAT, upload_buf);
|
||||
|
||||
color_buf = gst_gl_color_convert_perform (self->color_convert, upload_buf);
|
||||
gst_buffer_unref (upload_buf);
|
||||
|
||||
/* Use video info associated with converted buffer */
|
||||
if (self->has_pending_v_info) {
|
||||
self->v_info = self->pending_v_info;
|
||||
self->has_pending_v_info = FALSE;
|
||||
}
|
||||
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
if (G_UNLIKELY (!color_buf)) {
|
||||
GST_ERROR_OBJECT (self, "Could not perform color conversion on input buffer");
|
||||
return NULL;
|
||||
}
|
||||
GST_LOG_OBJECT (self, "Color converted into %" GST_PTR_FORMAT, color_buf);
|
||||
|
||||
texture = gst_clapper_gl_base_importer_make_gl_texture (gl_bi, color_buf, &self->v_info);
|
||||
gst_buffer_unref (color_buf);
|
||||
|
||||
done:
|
||||
return texture;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_uploader_init (GstClapperGLUploader *self)
|
||||
{
|
||||
gst_video_info_init (&self->pending_v_info);
|
||||
gst_video_info_init (&self->v_info);
|
||||
|
||||
self->gst_tex_target = GST_GL_TEXTURE_TARGET_EXTERNAL_OES;
|
||||
self->gl_tex_target = gst_gl_texture_target_to_gl (self->gst_tex_target);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_uploader_finalize (GObject *object)
|
||||
{
|
||||
GstClapperGLUploader *self = GST_CLAPPER_GL_UPLOADER_CAST (object);
|
||||
|
||||
gst_clear_object (&self->upload);
|
||||
gst_clear_object (&self->color_convert);
|
||||
|
||||
gst_clear_object (&self->shader);
|
||||
|
||||
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_gl_uploader_class_init (GstClapperGLUploaderClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstClapperImporterClass *importer_class = (GstClapperImporterClass *) klass;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clappergluploader", 0,
|
||||
"Clapper GL Uploader");
|
||||
|
||||
gobject_class->finalize = gst_clapper_gl_uploader_finalize;
|
||||
|
||||
importer_class->prepare = gst_clapper_gl_uploader_prepare;
|
||||
importer_class->set_caps = gst_clapper_gl_uploader_set_caps;
|
||||
importer_class->generate_texture = gst_clapper_gl_uploader_generate_texture;
|
||||
}
|
||||
|
||||
GstClapperImporter *
|
||||
make_importer (void)
|
||||
{
|
||||
return g_object_new (GST_TYPE_CLAPPER_GL_UPLOADER, NULL);
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
make_caps (GstRank *rank, GStrv *context_types)
|
||||
{
|
||||
*rank = GST_RANK_MARGINAL + 1;
|
||||
*context_types = gst_clapper_gl_base_importer_make_gl_context_types ();
|
||||
|
||||
return gst_gl_upload_get_input_template_caps ();
|
||||
}
|
55
lib/gst/plugin/importers/gstclappergluploader.h
vendored
Normal file
55
lib/gst/plugin/importers/gstclappergluploader.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gstclapperglbaseimporter.h"
|
||||
|
||||
#include <gst/gl/gstglfuncs.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_CLAPPER_GL_UPLOADER (gst_clapper_gl_uploader_get_type())
|
||||
G_DECLARE_FINAL_TYPE (GstClapperGLUploader, gst_clapper_gl_uploader, GST, CLAPPER_GL_UPLOADER, GstClapperGLBaseImporter)
|
||||
|
||||
#define GST_CLAPPER_GL_UPLOADER_CAST(obj) ((GstClapperGLUploader *)(obj))
|
||||
|
||||
struct _GstClapperGLUploader
|
||||
{
|
||||
GstClapperGLBaseImporter parent;
|
||||
|
||||
GstGLUpload *upload;
|
||||
GstGLColorConvert *color_convert;
|
||||
|
||||
GstVideoInfo pending_v_info, v_info;
|
||||
gboolean has_pending_v_info;
|
||||
|
||||
/* DMABuf fast-path */
|
||||
GstGLTextureTarget gst_tex_target;
|
||||
guint gl_tex_target;
|
||||
|
||||
GstGLShader *shader;
|
||||
|
||||
GLuint vao;
|
||||
GLuint vertex_buffer;
|
||||
GLint attr_position;
|
||||
GLint attr_texture;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
111
lib/gst/plugin/importers/gstclapperrawimporter.c
vendored
Normal file
111
lib/gst/plugin/importers/gstclapperrawimporter.c
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstclapperrawimporter.h"
|
||||
#include "gst/plugin/gstgtkutils.h"
|
||||
#include "gst/plugin/gstgdkformats.h"
|
||||
|
||||
#define GST_CAT_DEFAULT gst_clapper_raw_importer_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||
|
||||
#define parent_class gst_clapper_raw_importer_parent_class
|
||||
GST_CLAPPER_IMPORTER_DEFINE (GstClapperRawImporter, gst_clapper_raw_importer, GST_TYPE_CLAPPER_IMPORTER);
|
||||
|
||||
static GstBufferPool *
|
||||
gst_clapper_raw_importer_create_pool (GstClapperImporter *importer, GstStructure **config)
|
||||
{
|
||||
GstClapperRawImporter *self = GST_CLAPPER_RAW_IMPORTER_CAST (importer);
|
||||
GstBufferPool *pool;
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Creating new buffer pool");
|
||||
|
||||
pool = gst_video_buffer_pool_new ();
|
||||
*config = gst_buffer_pool_get_config (pool);
|
||||
|
||||
gst_buffer_pool_config_add_option (*config, GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_raw_importer_add_allocation_metas (GstClapperImporter *importer, GstQuery *query)
|
||||
{
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, NULL);
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
gst_clapper_raw_importer_generate_texture (GstClapperImporter *importer,
|
||||
GstBuffer *buffer, GstVideoInfo *v_info)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GstVideoFrame frame;
|
||||
|
||||
if (G_UNLIKELY (!gst_video_frame_map (&frame, v_info, buffer, GST_MAP_READ))) {
|
||||
GST_ERROR_OBJECT (importer, "Could not map input buffer for reading");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
texture = gst_video_frame_into_gdk_texture (&frame);
|
||||
gst_video_frame_unmap (&frame);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_raw_importer_init (GstClapperRawImporter *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clapper_raw_importer_class_init (GstClapperRawImporterClass *klass)
|
||||
{
|
||||
GstClapperImporterClass *importer_class = (GstClapperImporterClass *) klass;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clapperrawimporter", 0,
|
||||
"Clapper RAW Importer");
|
||||
|
||||
importer_class->create_pool = gst_clapper_raw_importer_create_pool;
|
||||
importer_class->add_allocation_metas = gst_clapper_raw_importer_add_allocation_metas;
|
||||
importer_class->generate_texture = gst_clapper_raw_importer_generate_texture;
|
||||
}
|
||||
|
||||
GstClapperImporter *
|
||||
make_importer (void)
|
||||
{
|
||||
return g_object_new (GST_TYPE_CLAPPER_RAW_IMPORTER, NULL);
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
make_caps (GstRank *rank, GStrv *context_types)
|
||||
{
|
||||
*rank = GST_RANK_MARGINAL;
|
||||
|
||||
return gst_caps_from_string (
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY ", "
|
||||
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
|
||||
"{ " GST_GDK_MEMORY_FORMATS " }")
|
||||
"; "
|
||||
GST_VIDEO_CAPS_MAKE (
|
||||
"{ " GST_GDK_MEMORY_FORMATS " }"));
|
||||
}
|
36
lib/gst/plugin/importers/gstclapperrawimporter.h
vendored
Normal file
36
lib/gst/plugin/importers/gstclapperrawimporter.h
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gst/plugin/gstclapperimporter.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_CLAPPER_RAW_IMPORTER (gst_clapper_raw_importer_get_type())
|
||||
G_DECLARE_FINAL_TYPE (GstClapperRawImporter, gst_clapper_raw_importer, GST, CLAPPER_RAW_IMPORTER, GstClapperImporter)
|
||||
|
||||
#define GST_CLAPPER_RAW_IMPORTER_CAST(obj) ((GstClapperRawImporter *)(obj))
|
||||
|
||||
struct _GstClapperRawImporter
|
||||
{
|
||||
GstClapperImporter parent;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
146
lib/gst/plugin/importers/meson.build
vendored
Normal file
146
lib/gst/plugin/importers/meson.build
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
gst_clapper_gl_base_importer_dep = dependency('', required: false)
|
||||
|
||||
all_importers = [
|
||||
'glimporter',
|
||||
'gluploader',
|
||||
'rawimporter',
|
||||
]
|
||||
|
||||
build_glbase = (
|
||||
not get_option('glimporter').disabled()
|
||||
or not get_option('gluploader').disabled()
|
||||
)
|
||||
gl_support_required = (
|
||||
get_option('glimporter').enabled()
|
||||
or get_option('gluploader').enabled()
|
||||
)
|
||||
|
||||
# We cannot build any importers without sink that they depend on
|
||||
if not gst_clapper_sink_dep.found()
|
||||
foreach imp : all_importers
|
||||
if get_option(imp).enabled()
|
||||
error('"@0@" option was enabled, but it requires building gstreamer plugin'.format(imp))
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
|
||||
gst_plugin_gl_base_deps = [gst_clapper_sink_dep, gstgl_dep, gstglproto_dep]
|
||||
have_gtk_gl_windowing = false
|
||||
|
||||
if gst_gl_have_window_x11 and (gst_gl_have_platform_egl or gst_gl_have_platform_glx)
|
||||
gtk_x11_dep = dependency('gtk4-x11', required: false)
|
||||
if gtk_x11_dep.found()
|
||||
gst_plugin_gl_base_deps += gtk_x11_dep
|
||||
if gst_gl_have_platform_glx
|
||||
gst_plugin_gl_base_deps += gstglx11_dep
|
||||
endif
|
||||
have_gtk_gl_windowing = true
|
||||
endif
|
||||
endif
|
||||
|
||||
if gst_gl_have_window_wayland and gst_gl_have_platform_egl
|
||||
gtk_wayland_dep = dependency('gtk4-wayland', required: false)
|
||||
if gtk_wayland_dep.found()
|
||||
gst_plugin_gl_base_deps += [gtk_wayland_dep, gstglwayland_dep]
|
||||
have_gtk_gl_windowing = true
|
||||
endif
|
||||
endif
|
||||
|
||||
if gl_support_required and not have_gtk_gl_windowing
|
||||
error('GL-based importer was enabled, but support for current GL windowing is missing')
|
||||
endif
|
||||
|
||||
if gst_gl_have_platform_egl
|
||||
gst_plugin_gl_base_deps += gstglegl_dep
|
||||
endif
|
||||
|
||||
foreach dep : gst_plugin_gl_base_deps
|
||||
if not dep.found()
|
||||
if gl_support_required
|
||||
error('GL-based importer was enabled, but required dependencies were not found')
|
||||
endif
|
||||
build_glbase = false
|
||||
endif
|
||||
endforeach
|
||||
|
||||
if build_glbase
|
||||
gst_clapper_gl_base_importer_dep = declare_dependency(
|
||||
link_with: library('gstclapperglbaseimporter',
|
||||
'gstclapperglbaseimporter.c',
|
||||
c_args: gst_clapper_plugin_args,
|
||||
include_directories: configinc,
|
||||
dependencies: gst_plugin_gl_base_deps,
|
||||
version: libversion,
|
||||
install: true,
|
||||
),
|
||||
include_directories: configinc,
|
||||
dependencies: gst_plugin_gl_base_deps,
|
||||
)
|
||||
endif
|
||||
|
||||
build_glimporter = (
|
||||
not get_option('glimporter').disabled()
|
||||
and gst_clapper_gl_base_importer_dep.found()
|
||||
)
|
||||
|
||||
if build_glimporter
|
||||
library(
|
||||
'gstclapperglimporter',
|
||||
'gstclapperglimporter.c',
|
||||
dependencies: gst_clapper_gl_base_importer_dep,
|
||||
include_directories: configinc,
|
||||
c_args: gst_clapper_plugin_args,
|
||||
install: true,
|
||||
install_dir: gst_clapper_importers_libdir,
|
||||
)
|
||||
endif
|
||||
|
||||
build_gluploader = (
|
||||
not get_option('gluploader').disabled()
|
||||
and gst_clapper_gl_base_importer_dep.found()
|
||||
)
|
||||
|
||||
gluploader_deps = [
|
||||
gst_clapper_gl_base_importer_dep,
|
||||
gstallocators_dep,
|
||||
]
|
||||
|
||||
foreach dep : gluploader_deps
|
||||
if not dep.found()
|
||||
if get_option('gluploader').enabled()
|
||||
error('GL uploader was enabled, but required dependencies were not found')
|
||||
endif
|
||||
build_gluploader = false
|
||||
endif
|
||||
endforeach
|
||||
|
||||
if build_gluploader
|
||||
library(
|
||||
'gstclappergluploader',
|
||||
'gstclappergluploader.c',
|
||||
dependencies: gluploader_deps,
|
||||
include_directories: configinc,
|
||||
c_args: gst_clapper_plugin_args,
|
||||
install: true,
|
||||
install_dir: gst_clapper_importers_libdir,
|
||||
)
|
||||
endif
|
||||
|
||||
# No need to auto build rawimporter if we are building gluploader
|
||||
build_rawimporter = (
|
||||
not get_option('rawimporter').disabled()
|
||||
and (not build_gluploader or get_option('rawimporter').enabled())
|
||||
and gst_clapper_sink_dep.found()
|
||||
)
|
||||
|
||||
if build_rawimporter
|
||||
library(
|
||||
'gstclapperrawimporter',
|
||||
'gstclapperrawimporter.c',
|
||||
dependencies: gst_clapper_sink_dep,
|
||||
include_directories: configinc,
|
||||
c_args: gst_clapper_plugin_args,
|
||||
install: true,
|
||||
install_dir: gst_clapper_importers_libdir,
|
||||
)
|
||||
endif
|
80
lib/gst/plugin/meson.build
vendored
80
lib/gst/plugin/meson.build
vendored
@@ -4,60 +4,60 @@ gst_clapper_plugin_args = [
|
||||
'-DHAVE_CONFIG_H',
|
||||
'-DGST_USE_UNSTABLE_API',
|
||||
]
|
||||
|
||||
gst_clapper_sink_dep = dependency('', required: false)
|
||||
gtk4_dep = dependency('gtk4', version: '>=4.6.0', required: false)
|
||||
|
||||
gmodule_dep = dependency('gmodule-2.0',
|
||||
version: glib_req,
|
||||
required: false,
|
||||
fallback: ['glib', 'libgmodule_dep'],
|
||||
)
|
||||
|
||||
gst_clapper_plugin_deps = [
|
||||
gtk4_dep,
|
||||
gst_dep,
|
||||
gstbase_dep,
|
||||
gstvideo_dep,
|
||||
gstallocators_dep,
|
||||
gmodule_dep,
|
||||
]
|
||||
|
||||
build_gst_plugin = not get_option('gst-plugin').disabled()
|
||||
foreach dep : gst_clapper_plugin_deps
|
||||
if not dep.found()
|
||||
if get_option('gst-plugin').enabled()
|
||||
error('GStreamer plugin was enabled, but required dependencies were not found')
|
||||
endif
|
||||
build_gst_plugin = false
|
||||
endif
|
||||
endforeach
|
||||
|
||||
if get_option('default_library') == 'static'
|
||||
gst_clapper_plugin_args += ['-DGST_STATIC_COMPILATION']
|
||||
endif
|
||||
|
||||
gst_clapper_plugin_option = get_option('gst-plugin')
|
||||
if gst_clapper_plugin_option.disabled()
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
foreach dep : gst_clapper_plugin_deps
|
||||
if not dep.found()
|
||||
if gst_clapper_plugin_option.enabled()
|
||||
error('GStreamer plugin was enabled, but required dependencies were not found')
|
||||
endif
|
||||
subdir_done()
|
||||
endif
|
||||
endforeach
|
||||
|
||||
if not have_gtk_gl_windowing
|
||||
if gst_clapper_plugin_option.enabled()
|
||||
error('GTK4 widget requires GL windowing')
|
||||
else
|
||||
subdir_done()
|
||||
endif
|
||||
endif
|
||||
|
||||
if not gtk4_dep.version().version_compare('>=4.6.0')
|
||||
if gst_clapper_plugin_option.enabled()
|
||||
error('GTK4 version on this system is too old, plugin needs 4.6.0+')
|
||||
else
|
||||
subdir_done()
|
||||
endif
|
||||
endif
|
||||
|
||||
gst_clapper_plugin_sources = [
|
||||
'gstclappersink.c',
|
||||
'gtkclapperobject.c',
|
||||
'gstclapperpaintable.c',
|
||||
'gstgtkutils.c',
|
||||
'gstplugin.c',
|
||||
'gstclapperimporter.c',
|
||||
'gstclapperimporterloader.c',
|
||||
]
|
||||
|
||||
library('gstclapper',
|
||||
gst_clapper_plugin_sources,
|
||||
c_args: gst_clapper_plugin_args,
|
||||
include_directories: configinc,
|
||||
dependencies: gst_clapper_plugin_deps + gtk_deps,
|
||||
install: true,
|
||||
install_dir: gst_plugins_libdir,
|
||||
)
|
||||
if build_gst_plugin
|
||||
gst_clapper_sink_dep = declare_dependency(
|
||||
link_with: library('gstclapper',
|
||||
gst_clapper_plugin_sources,
|
||||
c_args: gst_clapper_plugin_args,
|
||||
include_directories: configinc,
|
||||
dependencies: gst_clapper_plugin_deps,
|
||||
install: true,
|
||||
install_dir: gst_plugins_libdir,
|
||||
),
|
||||
include_directories: configinc,
|
||||
dependencies: gst_clapper_plugin_deps,
|
||||
)
|
||||
endif
|
||||
|
||||
subdir('importers')
|
||||
|
46
lib/meson.build
vendored
46
lib/meson.build
vendored
@@ -1,5 +1,5 @@
|
||||
glib_req = '>= 2.56.0'
|
||||
gst_req = '>= 1.19.1'
|
||||
glib_req = '>= 2.68.0'
|
||||
gst_req = '>= 1.20.0'
|
||||
|
||||
api_version = '1.0'
|
||||
libversion = meson.project_version()
|
||||
@@ -42,10 +42,6 @@ endif
|
||||
# Symbol visibility
|
||||
if cc.get_id() == 'msvc'
|
||||
export_define = '__declspec(dllexport) extern'
|
||||
elif cc.has_argument('-fvisibility=hidden')
|
||||
add_project_arguments('-fvisibility=hidden', language: 'c')
|
||||
add_project_arguments('-fvisibility=hidden', language: 'cpp')
|
||||
export_define = 'extern __attribute__ ((visibility ("default")))'
|
||||
else
|
||||
export_define = 'extern'
|
||||
endif
|
||||
@@ -132,7 +128,7 @@ cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
|
||||
cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
|
||||
|
||||
cdata.set_quoted('VERSION', libversion)
|
||||
cdata.set_quoted('PACKAGE', 'gst-plugins-clapper')
|
||||
cdata.set_quoted('PACKAGE', 'clapper')
|
||||
cdata.set_quoted('PACKAGE_VERSION', libversion)
|
||||
cdata.set_quoted('PACKAGE_BUGREPORT', 'https://github.com/Rafostar/clapper/issues/new')
|
||||
cdata.set_quoted('PACKAGE_NAME', 'GStreamer Clapper Libs')
|
||||
@@ -184,7 +180,7 @@ foreach extra_arg : warning_flags
|
||||
endif
|
||||
endforeach
|
||||
|
||||
cdata.set_quoted('GST_PACKAGE_NAME', 'GStreamer Plugins Clapper')
|
||||
cdata.set_quoted('GST_PACKAGE_NAME', 'gst-plugin-clapper')
|
||||
cdata.set_quoted('GST_PACKAGE_ORIGIN', 'https://github.com/Rafostar/clapper')
|
||||
|
||||
# Mandatory GST deps
|
||||
@@ -265,37 +261,9 @@ gir_init_section = ['--add-init-section=extern void gst_init(gint*,gchar**);' +
|
||||
'gst_init(NULL,NULL);', '--quiet'
|
||||
]
|
||||
|
||||
gtk_deps = [gstgl_dep, gstglproto_dep]
|
||||
have_gtk_gl_windowing = false
|
||||
|
||||
gtk4_dep = dependency('gtk4', required: true)
|
||||
|
||||
if not gtk4_dep.version().version_compare('>=4.0.0')
|
||||
error('GTK4 version on this system is too old')
|
||||
endif
|
||||
|
||||
if gst_gl_have_window_x11 and (gst_gl_have_platform_egl or gst_gl_have_platform_glx)
|
||||
gtk_x11_dep = dependency('gtk4-x11', required: false)
|
||||
if gtk_x11_dep.found()
|
||||
gtk_deps += gtk_x11_dep
|
||||
if gst_gl_have_platform_glx
|
||||
gtk_deps += gstglx11_dep
|
||||
endif
|
||||
have_gtk_gl_windowing = true
|
||||
endif
|
||||
endif
|
||||
|
||||
if gst_gl_have_window_wayland and gst_gl_have_platform_egl
|
||||
gtk_wayland_dep = dependency('gtk4-wayland', required: false)
|
||||
if gtk_wayland_dep.found()
|
||||
gtk_deps += [gtk_wayland_dep, gstglwayland_dep]
|
||||
have_gtk_gl_windowing = true
|
||||
endif
|
||||
endif
|
||||
|
||||
if gst_gl_have_platform_egl
|
||||
gtk_deps += gstglegl_dep
|
||||
endif
|
||||
gst_clapper_plugin_libdir = join_paths(get_option('prefix'), libdir, 'clapper-@0@'.format(api_version), 'gst', 'plugin')
|
||||
gst_clapper_importers_libdir = join_paths(gst_clapper_plugin_libdir, 'importers')
|
||||
cdata.set_quoted('CLAPPER_SINK_IMPORTER_PATH', gst_clapper_importers_libdir)
|
||||
|
||||
subdir('gst')
|
||||
configure_file(output: 'config.h', configuration: cdata)
|
||||
|
@@ -19,9 +19,7 @@ datadir = join_paths(get_option('prefix'), get_option('datadir'))
|
||||
pkglibdir = join_paths(libdir, meson.project_name())
|
||||
pkgdatadir = join_paths(datadir, meson.project_name())
|
||||
|
||||
if get_option('lib') or not get_option('gst-plugin').disabled()
|
||||
subdir('lib')
|
||||
endif
|
||||
subdir('lib')
|
||||
|
||||
if get_option('player')
|
||||
subdir('bin')
|
||||
|
@@ -13,6 +13,23 @@ option('gst-plugin',
|
||||
value: 'enabled',
|
||||
description: 'Build GStreamer plugin (includes GTK video sink element)'
|
||||
)
|
||||
|
||||
option('glimporter',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Build GL memory importer for clappersink'
|
||||
)
|
||||
option('gluploader',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Build GL uploader for clappersink'
|
||||
)
|
||||
option('rawimporter',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Build RAW system memory importer for clappersink'
|
||||
)
|
||||
|
||||
option('devel-checks',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
|
@@ -3,6 +3,10 @@
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "master",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"sdk-extensions": [
|
||||
"org.freedesktop.Sdk.Extension.rust-nightly",
|
||||
"org.freedesktop.Sdk.Extension.llvm13"
|
||||
],
|
||||
"command": "com.github.rafostar.Clapper",
|
||||
"finish-args": [
|
||||
"--share=ipc",
|
||||
@@ -19,6 +23,10 @@
|
||||
"--env=GST_PLUGIN_SYSTEM_PATH=/app/lib/gstreamer-1.0",
|
||||
"--env=GST_VAAPI_ALL_DRIVERS=1"
|
||||
],
|
||||
"build-options": {
|
||||
"append-path": "/usr/lib/sdk/rust-nightly/bin:/usr/lib/sdk/llvm13/bin",
|
||||
"prepend-ld-library-path": "/usr/lib/sdk/llvm13/lib"
|
||||
},
|
||||
"modules": [
|
||||
"flathub/shared-modules/gudev/gudev.json",
|
||||
"flathub/lib/libsass.json",
|
||||
@@ -32,8 +40,8 @@
|
||||
"flathub/lib/libdvdnav.json",
|
||||
"flathub/lib/libass.json",
|
||||
"flathub/lib/ffmpeg.json",
|
||||
"testing/libsoup3.json",
|
||||
"testing/gstreamer.json",
|
||||
"testing/gst-plugins-rs.json",
|
||||
"testing/gtuber.json",
|
||||
{
|
||||
"name": "clapper",
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"app-id": "com.github.rafostar.Clapper",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "41",
|
||||
"runtime-version": "42",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"command": "com.github.rafostar.Clapper",
|
||||
"finish-args": [
|
||||
@@ -21,7 +21,6 @@
|
||||
],
|
||||
"modules": [
|
||||
"flathub/shared-modules/gudev/gudev.json",
|
||||
"flathub/lib/pango.json",
|
||||
"flathub/lib/libsass.json",
|
||||
"flathub/lib/sassc.json",
|
||||
"flathub/lib/liba52.json",
|
||||
@@ -33,9 +32,8 @@
|
||||
"flathub/lib/libass.json",
|
||||
"flathub/lib/ffmpeg.json",
|
||||
"flathub/lib/uchardet.json",
|
||||
"testing/libsoup3.json",
|
||||
"flathub/gstreamer-1.0/gstreamer.json",
|
||||
"flathub/lib/gtk4.json",
|
||||
"testing/gtk4.json",
|
||||
"flathub/lib/libadwaita.json",
|
||||
"testing/gtuber.json",
|
||||
{
|
||||
|
Submodule pkgs/flatpak/flathub updated: 4b3bdfab8c...4f3bee93b7
23
pkgs/flatpak/testing/gst-plugins-rs.json
Normal file
23
pkgs/flatpak/testing/gst-plugins-rs.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "gst-plugins-rs",
|
||||
"buildsystem": "simple",
|
||||
"build-options": {
|
||||
"build-args": [
|
||||
"--share=network"
|
||||
],
|
||||
"env": {
|
||||
"CARGO_HOME": "/run/build/gst-plugins-rs/cargo"
|
||||
}
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git",
|
||||
"branch": "main"
|
||||
}
|
||||
],
|
||||
"build-commands": [
|
||||
"cargo install cargo-c",
|
||||
"cargo cinstall --prefix=/app -p gst-plugin-dav1d"
|
||||
]
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
"name": "gstreamer",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"--wrap-mode=nofallback",
|
||||
"--wrap-mode=nodownload",
|
||||
|
||||
"-Dbase=enabled",
|
||||
"-Dgood=enabled",
|
||||
@@ -26,26 +26,12 @@
|
||||
"-Dgpl=enabled",
|
||||
|
||||
"-Dgstreamer:benchmarks=disabled",
|
||||
"-Dgstreamer:gobject-cast-checks=disabled",
|
||||
"-Dgstreamer:glib-asserts=disabled",
|
||||
"-Dgstreamer:glib-checks=disabled",
|
||||
"-Dgstreamer:extra-checks=disabled",
|
||||
|
||||
"-Dgst-plugins-base:gobject-cast-checks=disabled",
|
||||
"-Dgst-plugins-base:glib-asserts=disabled",
|
||||
"-Dgst-plugins-base:glib-checks=disabled",
|
||||
"-Dgst-plugins-base:gl_api=opengl,gles2",
|
||||
"-Dgst-plugins-base:gl_platform=egl,glx",
|
||||
|
||||
"-Dgst-plugins-good:gobject-cast-checks=disabled",
|
||||
"-Dgst-plugins-good:glib-asserts=disabled",
|
||||
"-Dgst-plugins-good:glib-checks=disabled",
|
||||
"-Dgst-plugins-good:gtk3=disabled",
|
||||
|
||||
"-Dgst-plugins-bad:gobject-cast-checks=disabled",
|
||||
"-Dgst-plugins-bad:glib-asserts=disabled",
|
||||
"-Dgst-plugins-bad:glib-checks=disabled",
|
||||
"-Dgst-plugins-bad:extra-checks=disabled",
|
||||
"-Dgst-plugins-bad:vulkan=disabled",
|
||||
"-Dgst-plugins-bad:webrtc=disabled",
|
||||
"-Dgst-plugins-bad:wasapi=disabled",
|
||||
@@ -57,16 +43,14 @@
|
||||
"-Dgst-plugins-bad:v4l2codecs=enabled",
|
||||
"-Dgst-plugins-bad:va=enabled",
|
||||
|
||||
"-Dgst-plugins-ugly:gobject-cast-checks=disabled",
|
||||
"-Dgst-plugins-ugly:glib-asserts=disabled",
|
||||
"-Dgst-plugins-ugly:glib-checks=disabled",
|
||||
"-Dgst-plugins-ugly:mpeg2dec=enabled"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.freedesktop.org/gstreamer/gstreamer.git",
|
||||
"branch": "main"
|
||||
"branch": "main",
|
||||
"disable-submodules": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
31
pkgs/flatpak/testing/gtk4-popover-unrealize.patch
Normal file
31
pkgs/flatpak/testing/gtk4-popover-unrealize.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From b413ee2c7d458c7005d3d3d1da8822cd86893ac0 Mon Sep 17 00:00:00 2001
|
||||
From: Rafostar <40623528+Rafostar@users.noreply.github.com>
|
||||
Date: Fri, 4 Dec 2020 19:25:34 +0100
|
||||
Subject: [PATCH] popover: Call unrealize on hide
|
||||
|
||||
When popover is shown "realize" method is called which creates a new
|
||||
surface for popup. Unfortunately this causes performance drop on Wayland until that
|
||||
surface is destroyed what happens inside "unrealize" method during popover destruction.
|
||||
|
||||
This commit changes default behavior in a way that surface will be destroyed
|
||||
when popover is closed and app will ragain the performance it lost when
|
||||
popover was shown.
|
||||
---
|
||||
gtk/gtkpopover.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
|
||||
index 504dcd6cc1..a7a764d483 100644
|
||||
--- a/gtk/gtkpopover.c
|
||||
+++ b/gtk/gtkpopover.c
|
||||
@@ -951,6 +951,7 @@ gtk_popover_hide (GtkWidget *widget)
|
||||
|
||||
gtk_popover_set_mnemonics_visible (GTK_POPOVER (widget), FALSE);
|
||||
_gtk_widget_set_visible_flag (widget, FALSE);
|
||||
+ gtk_widget_unrealize (widget);
|
||||
gtk_widget_unmap (widget);
|
||||
g_signal_emit (widget, signals[CLOSED], 0);
|
||||
}
|
||||
--
|
||||
GitLab
|
||||
|
37
pkgs/flatpak/testing/gtk4.json
Normal file
37
pkgs/flatpak/testing/gtk4.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "gtk",
|
||||
"buildsystem": "meson",
|
||||
"build-options": {
|
||||
"build-args": [
|
||||
"--share=network"
|
||||
]
|
||||
},
|
||||
"config-opts": [
|
||||
"--buildtype=release",
|
||||
|
||||
"-Dwin32-backend=false",
|
||||
"-Dmacos-backend=false",
|
||||
"-Dmedia-ffmpeg=disabled",
|
||||
"-Dprint-cups=disabled",
|
||||
"-Dintrospection=enabled",
|
||||
"-Ddemos=false",
|
||||
"-Dbuild-examples=false",
|
||||
"-Dbuild-tests=false"
|
||||
],
|
||||
"cleanup": [
|
||||
"/bin/gtk4-builder-tool",
|
||||
"/bin/gtk4-encode-symbolic-svg"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.gnome.org/GNOME/gtk.git",
|
||||
"tag": "4.6.2",
|
||||
"commit": "aec7ca82007dbe07faee6be084d20758ebac2b91"
|
||||
},
|
||||
{
|
||||
"type": "patch",
|
||||
"path": "gtk4-popover-unrealize.patch"
|
||||
}
|
||||
]
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "libsoup3",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [
|
||||
"-Dintrospection=enabled",
|
||||
"-Dvapi=disabled",
|
||||
"-Dtests=false",
|
||||
"-Dsysprof=disabled",
|
||||
"-Dhttp2_tests=disabled",
|
||||
"-Dpkcs11_tests=disabled"
|
||||
],
|
||||
"cleanup": [
|
||||
"/include",
|
||||
"/lib/pkgconfig"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.gnome.org/GNOME/libsoup.git",
|
||||
"tag": "3.0.4",
|
||||
"commit": "25a728020c4b53b5db4c4c675070e92f947fbd4d"
|
||||
}
|
||||
]
|
||||
}
|
3
pkgs/rpm/.gitignore
vendored
3
pkgs/rpm/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
.osc/
|
||||
clapper/
|
||||
.lock
|
@@ -1 +0,0 @@
|
||||
addFilter("explicit-lib-dependency")
|
@@ -1,193 +0,0 @@
|
||||
#
|
||||
# spec file for package clapper
|
||||
#
|
||||
# Copyright (C) 2020 sp1rit
|
||||
# Copyright (C) 2020-21 Rafostar
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
%define debug_package %{nil}
|
||||
|
||||
%global appname com.github.rafostar.Clapper
|
||||
%global gst_version 1.18.0
|
||||
%global gtk4_version 4.0.0
|
||||
%global meson_version 0.50
|
||||
%global glib2_version 2.56.0
|
||||
%global soup_version 3.0.0
|
||||
|
||||
Name: clapper
|
||||
Version: 0.4.1
|
||||
Release: 1%{?dist}
|
||||
Summary: Simple and modern GNOME media player
|
||||
|
||||
License: GPL-3.0
|
||||
URL: https://github.com/Rafostar/clapper
|
||||
BuildRoot: %{_builddir}/%{name}-%{version}-build
|
||||
Source0: _service
|
||||
|
||||
BuildRequires: meson >= %{meson_version}
|
||||
BuildRequires: gtk4-devel >= %{gtk4_version}
|
||||
BuildRequires: glib2-devel >= %{glib2_version}
|
||||
BuildRequires: gobject-introspection-devel
|
||||
BuildRequires: gjs
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: desktop-file-utils
|
||||
BuildRequires: hicolor-icon-theme
|
||||
|
||||
Requires: gjs
|
||||
Requires: gtk4 >= %{gtk4_version}
|
||||
Requires: libadwaita
|
||||
Requires: hicolor-icon-theme
|
||||
|
||||
%if 0%{?suse_version}
|
||||
# SUSE recommends group tag, while Fedora discourages their use
|
||||
Group: Productivity/Multimedia/Video/Players
|
||||
|
||||
BuildRequires: update-desktop-files
|
||||
BuildRequires: gstreamer-devel >= %{gst_version}
|
||||
BuildRequires: gstreamer-plugins-base-devel >= %{gst_version}
|
||||
BuildRequires: Mesa-libGLESv2-devel
|
||||
BuildRequires: Mesa-libGLESv3-devel
|
||||
|
||||
Requires: libsoup-devel >= %{soup_version}
|
||||
Requires: gstreamer >= %{gst_version}
|
||||
Requires: gstreamer-plugins-base >= %{gst_version}
|
||||
Requires: gstreamer-plugins-good >= %{gst_version}
|
||||
Requires: gstreamer-plugins-bad >= %{gst_version}
|
||||
|
||||
# Popular video decoders
|
||||
Recommends: gstreamer-plugins-libav >= %{gst_version}
|
||||
|
||||
# CD Playback
|
||||
Suggests: gstreamer-plugins-ugly
|
||||
# Intel/AMD video acceleration
|
||||
Suggests: gstreamer-plugins-vaapi
|
||||
%else
|
||||
BuildRequires: glibc-all-langpacks
|
||||
BuildRequires: gstreamer1-devel >= %{gst_version}
|
||||
BuildRequires: gstreamer1-plugins-base-devel >= %{gst_version}
|
||||
BuildRequires: mesa-libGL-devel
|
||||
BuildRequires: mesa-libGLES-devel
|
||||
BuildRequires: mesa-libGLU-devel
|
||||
BuildRequires: mesa-libEGL-devel
|
||||
|
||||
Requires: libsoup3-devel
|
||||
Requires: gstreamer1 >= %{gst_version}
|
||||
Requires: gstreamer1-plugins-base >= %{gst_version}
|
||||
Requires: gstreamer1-plugins-good >= %{gst_version}
|
||||
Requires: gstreamer1-plugins-bad-free >= %{gst_version}
|
||||
|
||||
# ASS subtitles (assrender)
|
||||
Recommends: gstreamer1-plugins-bad-free-extras >= %{gst_version}
|
||||
|
||||
# CD Playback
|
||||
Suggests: gstreamer1-plugins-ugly-free
|
||||
# Intel/AMD video acceleration
|
||||
Suggests: gstreamer1-vaapi
|
||||
%endif
|
||||
|
||||
%description
|
||||
A GNOME media player built using GJS with GTK4 toolkit and powered by GStreamer with OpenGL rendering.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{_sourcedir}/%{name}-%{version} -T -D
|
||||
|
||||
%build
|
||||
%meson
|
||||
%meson_build
|
||||
|
||||
%install
|
||||
%meson_install
|
||||
%if 0%{?suse_version}
|
||||
%suse_update_desktop_file %{appname}
|
||||
%endif
|
||||
|
||||
%check
|
||||
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
|
||||
|
||||
%files
|
||||
%license COPYING
|
||||
%doc README.md
|
||||
%{_bindir}/%{appname}*
|
||||
%{_bindir}/clapper
|
||||
%{_datadir}/%{appname}/
|
||||
%{_datadir}/icons/hicolor/*/apps/*.svg
|
||||
%{_datadir}/glib-2.0/schemas/%{appname}.gschema.xml
|
||||
%{_datadir}/mime/packages/%{appname}.xml
|
||||
%{_datadir}/applications/*.desktop
|
||||
%{_datadir}/metainfo/*.metainfo.xml
|
||||
%{_datadir}/gir-1.0/GstClapper-1.0.gir
|
||||
%{_datadir}/locale/*/LC_MESSAGES/%{appname}.mo
|
||||
%{_libdir}/%{appname}/
|
||||
|
||||
%changelog
|
||||
* Thu Feb 17 2022 Rafostar <rafostar.github@gmail.com> - 0.4.1-2
|
||||
- Require libsoup3
|
||||
|
||||
* Mon Dec 20 2021 Rafostar <rafostar.github@gmail.com> - 0.4.1-1
|
||||
- New version
|
||||
|
||||
* Sun Sep 12 2021 Rafostar <rafostar.github@gmail.com> - 0.4.0-1
|
||||
- New version
|
||||
|
||||
* Thu Aug 26 2021 Rafostar <rafostar.github@gmail.com> - 0.3.0-4
|
||||
- Install translations
|
||||
|
||||
* Thu Aug 26 2021 Rafostar <rafostar.github@gmail.com> - 0.3.0-3
|
||||
- Install clapper symlink
|
||||
|
||||
* Mon Aug 23 2021 Rafostar <rafostar.github@gmail.com> - 0.3.0-2
|
||||
- Require libadwaita
|
||||
|
||||
* Fri Jun 18 2021 Rafostar <rafostar.github@gmail.com> - 0.3.0-1
|
||||
- New version
|
||||
|
||||
* Mon Apr 19 2021 Rafostar <rafostar.github@gmail.com> - 0.2.1-1
|
||||
- New version
|
||||
|
||||
* Tue Apr 13 2021 Rafostar <rafostar.github@gmail.com> - 0.2.0-1
|
||||
- New version
|
||||
|
||||
* Fri Feb 26 2021 Rafostar <rafostar.github@gmail.com> - 0.1.0-1
|
||||
- New version
|
||||
|
||||
* Sun Feb 7 2021 Rafostar <rafostar.github@gmail.com> - 0.0.0-10
|
||||
- Install gstclapper libs to app named subdirectory
|
||||
|
||||
* Fri Feb 5 2021 Rafostar <rafostar.github@gmail.com> - 0.0.0-9
|
||||
- Update build with gstclapper libs support
|
||||
|
||||
* Thu Jan 21 2021 Rafostar <rafostar.github@gmail.com> - 0.0.0-8
|
||||
- Use metainfo instead of deprecated appdata
|
||||
|
||||
* Mon Jan 18 2021 Rafostar <rafostar.github@gmail.com> - 0.0.0-7
|
||||
- Remove gjs-1.0 files
|
||||
|
||||
* Sun Dec 20 2020 Rafostar <rafostar.github@gmail.com> - 0.0.0-6
|
||||
- Include additional app binaries
|
||||
|
||||
* Sat Oct 31 2020 Rafostar <rafostar.github@gmail.com> - 0.0.0-5
|
||||
- Added metainfo
|
||||
|
||||
* Sun Oct 25 2020 Rafostar <rafostar.github@gmail.com> - 0.0.0-4
|
||||
- Added gschema
|
||||
|
||||
* Wed Oct 14 2020 Rafostar <rafostar.github@gmail.com> - 0.0.0-3
|
||||
- Update to GTK4
|
||||
|
||||
* Sat Sep 19 22:02:00 CEST 2020 sp1rit - 0.0.0-2
|
||||
- Added suse_update_desktop_file macro for SuSE packages
|
||||
|
||||
* Fri Sep 18 2020 Rafostar <rafostar.github@gmail.com> - 0.0.0-1
|
||||
- Initial package
|
@@ -1 +1 @@
|
||||
ca cs de es fr hu it nl pl pt pt_BR ru sv zh_CN
|
||||
ar ca cs de es eu fr hu it ja nl pl pt pt_BR ru sv tr zh_CN
|
||||
|
218
po/ar.po
218
po/ar.po
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: clapper\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-09-14 16:35+0200\n"
|
||||
"PO-Revision-Date: 2021-09-14 15:25\n"
|
||||
"PO-Revision-Date: 2022-03-26 13:37\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Arabic\n"
|
||||
"Language: ar_SA\n"
|
||||
@@ -19,441 +19,441 @@ msgstr ""
|
||||
|
||||
#: ui/clapper.ui:6
|
||||
msgid "Open Files…"
|
||||
msgstr ""
|
||||
msgstr "فتح الملفات…"
|
||||
|
||||
#: ui/clapper.ui:10
|
||||
msgid "Open URI…"
|
||||
msgstr ""
|
||||
msgstr "فتح عنوان URL…"
|
||||
|
||||
#: ui/clapper.ui:16 ui/preferences-window.ui:4
|
||||
msgid "Preferences"
|
||||
msgstr ""
|
||||
msgstr "الإعدادات"
|
||||
|
||||
#: ui/clapper.ui:20
|
||||
msgid "Shortcuts"
|
||||
msgstr ""
|
||||
msgstr "الاختصارات"
|
||||
|
||||
#: ui/clapper.ui:26
|
||||
msgid "About Clapper"
|
||||
msgstr ""
|
||||
msgstr "حول Clapper"
|
||||
|
||||
#: ui/elapsed-time-button.ui:27
|
||||
msgid "Speed"
|
||||
msgstr ""
|
||||
msgstr "السرعة"
|
||||
|
||||
#: ui/elapsed-time-button.ui:41 ui/preferences-window.ui:83
|
||||
#: ui/preferences-window.ui:215
|
||||
msgid "Normal"
|
||||
msgstr ""
|
||||
msgstr "عادي"
|
||||
|
||||
#: ui/help-overlay.ui:10 ui/preferences-window.ui:12
|
||||
msgid "General"
|
||||
msgstr ""
|
||||
msgstr "عام"
|
||||
|
||||
#: ui/help-overlay.ui:13
|
||||
msgid "Show shortcuts"
|
||||
msgstr ""
|
||||
msgstr "إظهار الاختصارات"
|
||||
|
||||
#: ui/help-overlay.ui:19
|
||||
msgid "Toggle fullscreen"
|
||||
msgstr ""
|
||||
msgstr "تبديل ملء الشاشة"
|
||||
|
||||
#: ui/help-overlay.ui:20
|
||||
msgid "Double tap | Double click"
|
||||
msgstr ""
|
||||
msgstr "نقرة مزدوجة"
|
||||
|
||||
#: ui/help-overlay.ui:26
|
||||
msgid "Leave fullscreen"
|
||||
msgstr ""
|
||||
msgstr "مغادرة ملء الشاشة"
|
||||
|
||||
#: ui/help-overlay.ui:32
|
||||
msgid "Reveal OSD (fullscreen only)"
|
||||
msgstr ""
|
||||
msgstr "إظهار المعلومات (ملء الشاشة فقط)"
|
||||
|
||||
#: ui/help-overlay.ui:33
|
||||
msgid "Tap"
|
||||
msgstr ""
|
||||
msgstr "نقرة"
|
||||
|
||||
#: ui/help-overlay.ui:39
|
||||
msgid "Quit"
|
||||
msgstr ""
|
||||
msgstr "خروج"
|
||||
|
||||
#: ui/help-overlay.ui:47
|
||||
msgid "Media"
|
||||
msgstr ""
|
||||
msgstr "الوسائط"
|
||||
|
||||
#: ui/help-overlay.ui:50
|
||||
msgid "Open files"
|
||||
msgstr ""
|
||||
msgstr "افتح ملفًا"
|
||||
|
||||
#: ui/help-overlay.ui:56 src/dialogs.js:137
|
||||
msgid "Open URI"
|
||||
msgstr ""
|
||||
msgstr "فتح عنوان URL"
|
||||
|
||||
#: ui/help-overlay.ui:64
|
||||
msgid "Playlist"
|
||||
msgstr ""
|
||||
msgstr "قوائم التشغيل"
|
||||
|
||||
#: ui/help-overlay.ui:67
|
||||
msgid "Next item"
|
||||
msgstr ""
|
||||
msgstr "المحتوى التالي"
|
||||
|
||||
#: ui/help-overlay.ui:68
|
||||
msgid "Double tap (right side)"
|
||||
msgstr ""
|
||||
msgstr "نقر مزدوج (الجانب الأيمن)"
|
||||
|
||||
#: ui/help-overlay.ui:74
|
||||
msgid "Previous item"
|
||||
msgstr ""
|
||||
msgstr "المحتوى السابق"
|
||||
|
||||
#: ui/help-overlay.ui:75
|
||||
msgid "Double tap (left side)"
|
||||
msgstr ""
|
||||
msgstr "نقر مزدوج (الجانب الأيسر)"
|
||||
|
||||
#: ui/help-overlay.ui:81
|
||||
msgid "Change repeat mode"
|
||||
msgstr ""
|
||||
msgstr "تغيير وضع التكرار"
|
||||
|
||||
#: ui/help-overlay.ui:87
|
||||
msgid "Export to file"
|
||||
msgstr ""
|
||||
msgstr "التصدير إلى مِلَفّ"
|
||||
|
||||
#: ui/help-overlay.ui:95 ui/preferences-window.ui:119
|
||||
msgid "Playback"
|
||||
msgstr ""
|
||||
msgstr "المشغل"
|
||||
|
||||
#: ui/help-overlay.ui:98
|
||||
msgid "Toggle play"
|
||||
msgstr ""
|
||||
msgstr "بَدْءّ / إيقاف"
|
||||
|
||||
#: ui/help-overlay.ui:99
|
||||
msgid "Long press | Right click"
|
||||
msgstr ""
|
||||
msgstr "اضغط مطولاً | انقر بزر الفائرة الأيمن"
|
||||
|
||||
#: ui/help-overlay.ui:105
|
||||
msgid "Seek forward"
|
||||
msgstr ""
|
||||
msgstr "التقدم للأمام"
|
||||
|
||||
#: ui/help-overlay.ui:106
|
||||
msgid "Swipe right | Scroll right"
|
||||
msgstr ""
|
||||
msgstr "مرر لليمين"
|
||||
|
||||
#: ui/help-overlay.ui:112
|
||||
msgid "Seek backward"
|
||||
msgstr ""
|
||||
msgstr "الرجوع للوراء"
|
||||
|
||||
#: ui/help-overlay.ui:113
|
||||
msgid "Swipe left | Scroll left"
|
||||
msgstr ""
|
||||
msgstr "مرر لليسار"
|
||||
|
||||
#: ui/help-overlay.ui:119
|
||||
msgid "Volume up"
|
||||
msgstr ""
|
||||
msgstr "رفع مستوى الصوت"
|
||||
|
||||
#: ui/help-overlay.ui:120
|
||||
msgid "Swipe up | Scroll up"
|
||||
msgstr ""
|
||||
msgstr "مرر لأعلى"
|
||||
|
||||
#: ui/help-overlay.ui:126
|
||||
msgid "Volume down"
|
||||
msgstr ""
|
||||
msgstr "خفض مستوى الصوت"
|
||||
|
||||
#: ui/help-overlay.ui:127
|
||||
msgid "Swipe down | Scroll down"
|
||||
msgstr ""
|
||||
msgstr "مرر لأسفل"
|
||||
|
||||
#: ui/help-overlay.ui:133
|
||||
msgid "Toggle mute"
|
||||
msgstr ""
|
||||
msgstr "كتم الصوت"
|
||||
|
||||
#: ui/help-overlay.ui:139
|
||||
msgid "Next chapter"
|
||||
msgstr ""
|
||||
msgstr "الفصل التالي"
|
||||
|
||||
#: ui/help-overlay.ui:145
|
||||
msgid "Previous chapter"
|
||||
msgstr ""
|
||||
msgstr "الفصل السابق"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:11
|
||||
msgid "Decoders"
|
||||
msgstr ""
|
||||
msgstr "برامج فك التشفير"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:18
|
||||
msgid "Return to the preferences"
|
||||
msgstr ""
|
||||
msgstr "العودة إلى الإعدادات"
|
||||
|
||||
#: ui/preferences-window.ui:16
|
||||
msgid "Behavior"
|
||||
msgstr ""
|
||||
msgstr "السلوك"
|
||||
|
||||
#: ui/preferences-window.ui:19
|
||||
msgid "Auto fullscreen"
|
||||
msgstr ""
|
||||
msgstr "ملء الشاشة تلقائياً"
|
||||
|
||||
#: ui/preferences-window.ui:20
|
||||
msgid "Enter fullscreen when playlist is replaced except floating mode"
|
||||
msgstr ""
|
||||
msgstr "أدخل ملء الشاشة عند استبدال قائمة التشغيل باستثناء الوضع العائم"
|
||||
|
||||
#: ui/preferences-window.ui:26
|
||||
msgid "Ask to resume recent media"
|
||||
msgstr ""
|
||||
msgstr "اطلب استئناف الوسائط السابقة"
|
||||
|
||||
#: ui/preferences-window.ui:32
|
||||
msgid "Float on all workspaces"
|
||||
msgstr ""
|
||||
msgstr "عائم في جميع مساحات العمل"
|
||||
|
||||
#: ui/preferences-window.ui:33
|
||||
msgid "This option only works on GNOME"
|
||||
msgstr ""
|
||||
msgstr "هذا الخِيار يعمل فقط على GNOME"
|
||||
|
||||
#: ui/preferences-window.ui:39
|
||||
msgid "After playback"
|
||||
msgstr ""
|
||||
msgstr "بعد انتهاء"
|
||||
|
||||
#: ui/preferences-window.ui:44
|
||||
msgid "Do nothing"
|
||||
msgstr ""
|
||||
msgstr "لا تفعل شيئًا"
|
||||
|
||||
#: ui/preferences-window.ui:45
|
||||
msgid "Freeze last frame"
|
||||
msgstr ""
|
||||
msgstr "تجميد الأخر لقطة"
|
||||
|
||||
#: ui/preferences-window.ui:46
|
||||
msgid "Close the app"
|
||||
msgstr ""
|
||||
msgstr "أغلق التطبيق"
|
||||
|
||||
#: ui/preferences-window.ui:56
|
||||
msgid "Volume"
|
||||
msgstr ""
|
||||
msgstr "الصوت"
|
||||
|
||||
#: ui/preferences-window.ui:59
|
||||
msgid "Custom initial value"
|
||||
msgstr ""
|
||||
msgstr "قيمة الافتراضية مخصصة"
|
||||
|
||||
#: ui/preferences-window.ui:60
|
||||
msgid "Set custom volume at startup instead of restoring it"
|
||||
msgstr ""
|
||||
msgstr "تعيين مستوى صوت مخصص عند بَدْء التشغيل بدلاً من إعادته"
|
||||
|
||||
#: ui/preferences-window.ui:64
|
||||
msgid "Volume percentage"
|
||||
msgstr ""
|
||||
msgstr "حجم الصوت"
|
||||
|
||||
#: ui/preferences-window.ui:75
|
||||
msgid "Seeking"
|
||||
msgstr ""
|
||||
msgstr "الوضع"
|
||||
|
||||
#: ui/preferences-window.ui:78
|
||||
msgid "Mode"
|
||||
msgstr ""
|
||||
msgstr "النمط"
|
||||
|
||||
#: ui/preferences-window.ui:84
|
||||
msgid "Accurate"
|
||||
msgstr ""
|
||||
msgstr "دَقيق"
|
||||
|
||||
#: ui/preferences-window.ui:85
|
||||
msgid "Fast"
|
||||
msgstr ""
|
||||
msgstr "سريع"
|
||||
|
||||
#: ui/preferences-window.ui:93
|
||||
msgid "Unit"
|
||||
msgstr ""
|
||||
msgstr "الوحدة"
|
||||
|
||||
#: ui/preferences-window.ui:98
|
||||
msgid "Second"
|
||||
msgstr ""
|
||||
msgstr "ثواني"
|
||||
|
||||
#: ui/preferences-window.ui:99
|
||||
msgid "Minute"
|
||||
msgstr ""
|
||||
msgstr "دقائق"
|
||||
|
||||
#: ui/preferences-window.ui:100
|
||||
msgid "Percentage"
|
||||
msgstr ""
|
||||
msgstr "النسبة المئوية"
|
||||
|
||||
#: ui/preferences-window.ui:108
|
||||
msgid "Value"
|
||||
msgstr ""
|
||||
msgstr "القيمة"
|
||||
|
||||
#: ui/preferences-window.ui:123
|
||||
msgid "Audio"
|
||||
msgstr ""
|
||||
msgstr "الصوت"
|
||||
|
||||
#: ui/preferences-window.ui:126
|
||||
msgid "Offset in milliseconds"
|
||||
msgstr ""
|
||||
msgstr "إزاحة بالمللي ثانية"
|
||||
|
||||
#: ui/preferences-window.ui:133
|
||||
msgid "Only native audio formats"
|
||||
msgstr ""
|
||||
msgstr "تنسيقات الصوت الأصلية فقط"
|
||||
|
||||
#: ui/preferences-window.ui:141
|
||||
msgid "Subtitles"
|
||||
msgstr ""
|
||||
msgstr "التَّرْجَمَةً"
|
||||
|
||||
#: ui/preferences-window.ui:144
|
||||
msgid "Default font"
|
||||
msgstr ""
|
||||
msgstr "الخط الافتراضي"
|
||||
|
||||
#: ui/preferences-window.ui:154
|
||||
msgid "Network"
|
||||
msgstr ""
|
||||
msgstr "الشبكة"
|
||||
|
||||
#: ui/preferences-window.ui:158
|
||||
msgid "Client"
|
||||
msgstr ""
|
||||
msgstr "العميل"
|
||||
|
||||
#: ui/preferences-window.ui:161
|
||||
msgid "Progressive download buffering"
|
||||
msgstr ""
|
||||
msgstr "التخزين المؤقت للتنزيل بالتدريج"
|
||||
|
||||
#: ui/preferences-window.ui:169
|
||||
msgid "Server"
|
||||
msgstr ""
|
||||
msgstr "الخادم"
|
||||
|
||||
#: ui/preferences-window.ui:172
|
||||
msgid "Control player remotely"
|
||||
msgstr ""
|
||||
msgstr "التحكم بالوسائط عن بعد"
|
||||
|
||||
#: ui/preferences-window.ui:176
|
||||
msgid "Listening port"
|
||||
msgstr ""
|
||||
msgstr "منفذ الاستماع"
|
||||
|
||||
#: ui/preferences-window.ui:183
|
||||
msgid "Run web application in background"
|
||||
msgstr ""
|
||||
msgstr "تشغيل تطبيق الويب في الخلفية"
|
||||
|
||||
#: ui/preferences-window.ui:184
|
||||
msgid "Requires GTK compiled with Broadway backend"
|
||||
msgstr ""
|
||||
msgstr "يتطلب GTK مجمعة مع Broadway backend"
|
||||
|
||||
#: ui/preferences-window.ui:190
|
||||
msgid "Web application port"
|
||||
msgstr ""
|
||||
msgstr "منفذ تطبيق الويب"
|
||||
|
||||
#: ui/preferences-window.ui:204
|
||||
msgid "Prefer adaptive streaming"
|
||||
msgstr ""
|
||||
msgstr "تفضيل البث التكيفي"
|
||||
|
||||
#: ui/preferences-window.ui:210
|
||||
msgid "Max quality"
|
||||
msgstr ""
|
||||
msgstr "الأعلى جودة"
|
||||
|
||||
#: ui/preferences-window.ui:228
|
||||
msgid "Tweaks"
|
||||
msgstr ""
|
||||
msgstr "تعديلات"
|
||||
|
||||
#: ui/preferences-window.ui:232
|
||||
msgid "Appearance"
|
||||
msgstr ""
|
||||
msgstr "إعدادات المظهر"
|
||||
|
||||
#: ui/preferences-window.ui:235
|
||||
msgid "Dark theme"
|
||||
msgstr ""
|
||||
msgstr "المظهر الداكن"
|
||||
|
||||
#: ui/preferences-window.ui:241
|
||||
msgid "Render window shadows"
|
||||
msgstr ""
|
||||
msgstr "عرض ظلال النافذة"
|
||||
|
||||
#: ui/preferences-window.ui:242
|
||||
msgid "Disable to increase performance when windowed"
|
||||
msgstr ""
|
||||
msgstr "تعطيل لزيادة الأداء عند وضع النافذة"
|
||||
|
||||
#: ui/preferences-window.ui:253
|
||||
msgid "Plugin ranking"
|
||||
msgstr ""
|
||||
msgstr "أعدادات الإضافات"
|
||||
|
||||
#: ui/preferences-window.ui:254
|
||||
msgid "Alter default ranks of GStreamer plugins"
|
||||
msgstr ""
|
||||
msgstr "تغيير الأعدادات الافتراضية للأضافات GStreamer"
|
||||
|
||||
#: ui/preferences-window.ui:259
|
||||
msgid "Use playbin3"
|
||||
msgstr ""
|
||||
msgstr "استخدام playbin3"
|
||||
|
||||
#: ui/preferences-window.ui:260 ui/preferences-window.ui:269
|
||||
msgid "Requires player restart"
|
||||
msgstr ""
|
||||
msgstr "يتطلب إعادة التشغيل"
|
||||
|
||||
#: ui/preferences-window.ui:262 ui/preferences-window.ui:271
|
||||
msgid "Experimental"
|
||||
msgstr ""
|
||||
msgstr "تجريبية"
|
||||
|
||||
#: ui/preferences-window.ui:268
|
||||
msgid "Use PipeWire for audio output"
|
||||
msgstr ""
|
||||
msgstr "استخدام PipeWire لإخراج الصوت"
|
||||
|
||||
#: src/buttons.js:201
|
||||
#, javascript-format
|
||||
msgid "Decoder: %s"
|
||||
msgstr ""
|
||||
msgstr "فك التشفير: %s"
|
||||
|
||||
#: src/dialogs.js:152
|
||||
msgid "Enter or drop URI here"
|
||||
msgstr ""
|
||||
msgstr "أدخل أو الصق URI هنا"
|
||||
|
||||
#: src/dialogs.js:157
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
msgstr "إلغاء"
|
||||
|
||||
#: src/dialogs.js:158
|
||||
msgid "Open"
|
||||
msgstr ""
|
||||
msgstr "فتح"
|
||||
|
||||
#: src/dialogs.js:226
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
msgstr "العنوان"
|
||||
|
||||
#: src/dialogs.js:227
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
msgstr "تم مشاهدة"
|
||||
|
||||
#: src/dialogs.js:235
|
||||
msgid "Resume playback?"
|
||||
msgstr ""
|
||||
msgstr "استئناف التشغيل؟"
|
||||
|
||||
#: src/dialogs.js:289
|
||||
#, javascript-format
|
||||
msgid "GTK version: %s"
|
||||
msgstr ""
|
||||
msgstr "إصدار GTK: %s"
|
||||
|
||||
#: src/dialogs.js:290
|
||||
#, javascript-format
|
||||
msgid "Adwaita version: %s"
|
||||
msgstr ""
|
||||
msgstr "إصدار Adwaita: %s"
|
||||
|
||||
#: src/dialogs.js:291
|
||||
#, javascript-format
|
||||
msgid "GStreamer version: %s"
|
||||
msgstr ""
|
||||
msgstr "إصدار GStreamer: %s"
|
||||
|
||||
#: src/dialogs.js:292
|
||||
#, javascript-format
|
||||
msgid "GJS version: %s"
|
||||
msgstr ""
|
||||
msgstr "إصدار GJS: %s"
|
||||
|
||||
#: src/dialogs.js:300
|
||||
msgid "A GNOME media player powered by GStreamer"
|
||||
msgstr ""
|
||||
msgstr "مشغل وسائط GNOME مدعوم من GStreamer"
|
||||
|
||||
#. TRANSLATORS: Put your name(s) here for credits or leave untranslated
|
||||
#: src/dialogs.js:305
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
msgstr "Yousef Fawaz"
|
||||
|
||||
#: src/revealers.js:170
|
||||
#, javascript-format
|
||||
msgid "Ends at: %s"
|
||||
msgstr ""
|
||||
msgstr "ينتهي في: %s"
|
||||
|
||||
#: src/widget.js:227 src/widget.js:236 src/widget.js:242 src/widget.js:248
|
||||
msgid "Undetermined"
|
||||
msgstr ""
|
||||
msgstr "غير محدّد"
|
||||
|
||||
#: src/widget.js:243
|
||||
msgid "Channels"
|
||||
msgstr ""
|
||||
msgstr "قنوات"
|
||||
|
||||
#: src/widget.js:261
|
||||
msgid "Disabled"
|
||||
msgstr ""
|
||||
msgstr "مُعطّل"
|
||||
|
||||
|
218
po/eu.po
218
po/eu.po
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: clapper\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-09-14 16:35+0200\n"
|
||||
"PO-Revision-Date: 2022-01-16 16:58\n"
|
||||
"PO-Revision-Date: 2022-03-25 16:45\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Basque\n"
|
||||
"Language: eu_ES\n"
|
||||
@@ -19,441 +19,441 @@ msgstr ""
|
||||
|
||||
#: ui/clapper.ui:6
|
||||
msgid "Open Files…"
|
||||
msgstr ""
|
||||
msgstr "Artxiboak ireki…"
|
||||
|
||||
#: ui/clapper.ui:10
|
||||
msgid "Open URI…"
|
||||
msgstr ""
|
||||
msgstr "Ireki URI…"
|
||||
|
||||
#: ui/clapper.ui:16 ui/preferences-window.ui:4
|
||||
msgid "Preferences"
|
||||
msgstr ""
|
||||
msgstr "Hobespenak"
|
||||
|
||||
#: ui/clapper.ui:20
|
||||
msgid "Shortcuts"
|
||||
msgstr ""
|
||||
msgstr "Lasterbideak"
|
||||
|
||||
#: ui/clapper.ui:26
|
||||
msgid "About Clapper"
|
||||
msgstr ""
|
||||
msgstr "Clapperi buruz"
|
||||
|
||||
#: ui/elapsed-time-button.ui:27
|
||||
msgid "Speed"
|
||||
msgstr ""
|
||||
msgstr "Abiadura"
|
||||
|
||||
#: ui/elapsed-time-button.ui:41 ui/preferences-window.ui:83
|
||||
#: ui/preferences-window.ui:215
|
||||
msgid "Normal"
|
||||
msgstr ""
|
||||
msgstr "Normala"
|
||||
|
||||
#: ui/help-overlay.ui:10 ui/preferences-window.ui:12
|
||||
msgid "General"
|
||||
msgstr ""
|
||||
msgstr "Orokorra"
|
||||
|
||||
#: ui/help-overlay.ui:13
|
||||
msgid "Show shortcuts"
|
||||
msgstr ""
|
||||
msgstr "Erakutsi lasterbideak"
|
||||
|
||||
#: ui/help-overlay.ui:19
|
||||
msgid "Toggle fullscreen"
|
||||
msgstr ""
|
||||
msgstr "Aktibatu pantaila osoa"
|
||||
|
||||
#: ui/help-overlay.ui:20
|
||||
msgid "Double tap | Double click"
|
||||
msgstr ""
|
||||
msgstr "Ukitu bikoitza / Bikoitza klik"
|
||||
|
||||
#: ui/help-overlay.ui:26
|
||||
msgid "Leave fullscreen"
|
||||
msgstr ""
|
||||
msgstr "Pantaila osoa utzi"
|
||||
|
||||
#: ui/help-overlay.ui:32
|
||||
msgid "Reveal OSD (fullscreen only)"
|
||||
msgstr ""
|
||||
msgstr "OSD errebelatu (pantaila osoan bakarrik)"
|
||||
|
||||
#: ui/help-overlay.ui:33
|
||||
msgid "Tap"
|
||||
msgstr ""
|
||||
msgstr "Ukitu"
|
||||
|
||||
#: ui/help-overlay.ui:39
|
||||
msgid "Quit"
|
||||
msgstr ""
|
||||
msgstr "Irten"
|
||||
|
||||
#: ui/help-overlay.ui:47
|
||||
msgid "Media"
|
||||
msgstr ""
|
||||
msgstr "Media"
|
||||
|
||||
#: ui/help-overlay.ui:50
|
||||
msgid "Open files"
|
||||
msgstr ""
|
||||
msgstr "Artxiboak ireki"
|
||||
|
||||
#: ui/help-overlay.ui:56 src/dialogs.js:137
|
||||
msgid "Open URI"
|
||||
msgstr ""
|
||||
msgstr "Ireki URI"
|
||||
|
||||
#: ui/help-overlay.ui:64
|
||||
msgid "Playlist"
|
||||
msgstr ""
|
||||
msgstr "Erreprodukzio-zerrenda"
|
||||
|
||||
#: ui/help-overlay.ui:67
|
||||
msgid "Next item"
|
||||
msgstr ""
|
||||
msgstr "Hurrengo elementua"
|
||||
|
||||
#: ui/help-overlay.ui:68
|
||||
msgid "Double tap (right side)"
|
||||
msgstr ""
|
||||
msgstr "Ukitu bikoitza (eskuineko aldea)"
|
||||
|
||||
#: ui/help-overlay.ui:74
|
||||
msgid "Previous item"
|
||||
msgstr ""
|
||||
msgstr "Aurreko elementua"
|
||||
|
||||
#: ui/help-overlay.ui:75
|
||||
msgid "Double tap (left side)"
|
||||
msgstr ""
|
||||
msgstr "Ukitu bikoitza (ezkerreko aldea)"
|
||||
|
||||
#: ui/help-overlay.ui:81
|
||||
msgid "Change repeat mode"
|
||||
msgstr ""
|
||||
msgstr "Errepikapen modua aldatu"
|
||||
|
||||
#: ui/help-overlay.ui:87
|
||||
msgid "Export to file"
|
||||
msgstr ""
|
||||
msgstr "Esportatu fitxategira"
|
||||
|
||||
#: ui/help-overlay.ui:95 ui/preferences-window.ui:119
|
||||
msgid "Playback"
|
||||
msgstr ""
|
||||
msgstr "Erreprodukzioa"
|
||||
|
||||
#: ui/help-overlay.ui:98
|
||||
msgid "Toggle play"
|
||||
msgstr ""
|
||||
msgstr "Erreprodukzioa aktibatu"
|
||||
|
||||
#: ui/help-overlay.ui:99
|
||||
msgid "Long press | Right click"
|
||||
msgstr ""
|
||||
msgstr "Pultsazio luzea / Eskuineko klik"
|
||||
|
||||
#: ui/help-overlay.ui:105
|
||||
msgid "Seek forward"
|
||||
msgstr ""
|
||||
msgstr "Aurrerapena bilatu"
|
||||
|
||||
#: ui/help-overlay.ui:106
|
||||
msgid "Swipe right | Scroll right"
|
||||
msgstr ""
|
||||
msgstr "Eskuinera irristatu / Eskuinera joan"
|
||||
|
||||
#: ui/help-overlay.ui:112
|
||||
msgid "Seek backward"
|
||||
msgstr ""
|
||||
msgstr "Atzerantz bilatu"
|
||||
|
||||
#: ui/help-overlay.ui:113
|
||||
msgid "Swipe left | Scroll left"
|
||||
msgstr ""
|
||||
msgstr "Ezkerrera irristatu / Ezkerrera mugitu"
|
||||
|
||||
#: ui/help-overlay.ui:119
|
||||
msgid "Volume up"
|
||||
msgstr ""
|
||||
msgstr "Bolumena igo"
|
||||
|
||||
#: ui/help-overlay.ui:120
|
||||
msgid "Swipe up | Scroll up"
|
||||
msgstr ""
|
||||
msgstr "Gorantz irristatu / Gorantz mugitu"
|
||||
|
||||
#: ui/help-overlay.ui:126
|
||||
msgid "Volume down"
|
||||
msgstr ""
|
||||
msgstr "Bolumena jeitsi"
|
||||
|
||||
#: ui/help-overlay.ui:127
|
||||
msgid "Swipe down | Scroll down"
|
||||
msgstr ""
|
||||
msgstr "Beherantz irristatu / Beherantz mugitu"
|
||||
|
||||
#: ui/help-overlay.ui:133
|
||||
msgid "Toggle mute"
|
||||
msgstr ""
|
||||
msgstr "Aktibatu isiltasuna"
|
||||
|
||||
#: ui/help-overlay.ui:139
|
||||
msgid "Next chapter"
|
||||
msgstr ""
|
||||
msgstr "Hurrengo kapitulua"
|
||||
|
||||
#: ui/help-overlay.ui:145
|
||||
msgid "Previous chapter"
|
||||
msgstr ""
|
||||
msgstr "Aurreko kapitulua"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:11
|
||||
msgid "Decoders"
|
||||
msgstr ""
|
||||
msgstr "Deskodetzaileak"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:18
|
||||
msgid "Return to the preferences"
|
||||
msgstr ""
|
||||
msgstr "Itzuli ezarpenetara"
|
||||
|
||||
#: ui/preferences-window.ui:16
|
||||
msgid "Behavior"
|
||||
msgstr ""
|
||||
msgstr "Portaera"
|
||||
|
||||
#: ui/preferences-window.ui:19
|
||||
msgid "Auto fullscreen"
|
||||
msgstr ""
|
||||
msgstr "Pantaila osoa automatikoa"
|
||||
|
||||
#: ui/preferences-window.ui:20
|
||||
msgid "Enter fullscreen when playlist is replaced except floating mode"
|
||||
msgstr ""
|
||||
msgstr "Pantaila osoan sartu erreprodukzio-zerrenda ordezten denean, flotatzeko modua izan ezik"
|
||||
|
||||
#: ui/preferences-window.ui:26
|
||||
msgid "Ask to resume recent media"
|
||||
msgstr ""
|
||||
msgstr "Azkenaldiko media berriro ekiteko eskatzea"
|
||||
|
||||
#: ui/preferences-window.ui:32
|
||||
msgid "Float on all workspaces"
|
||||
msgstr ""
|
||||
msgstr "Laneko espazio guztietan flotatzea"
|
||||
|
||||
#: ui/preferences-window.ui:33
|
||||
msgid "This option only works on GNOME"
|
||||
msgstr ""
|
||||
msgstr "Aukera honek GNOMEn bakarrik funtzionatzen du"
|
||||
|
||||
#: ui/preferences-window.ui:39
|
||||
msgid "After playback"
|
||||
msgstr ""
|
||||
msgstr "Erreprodukzioaren ondoren"
|
||||
|
||||
#: ui/preferences-window.ui:44
|
||||
msgid "Do nothing"
|
||||
msgstr ""
|
||||
msgstr "Ez egin ezer"
|
||||
|
||||
#: ui/preferences-window.ui:45
|
||||
msgid "Freeze last frame"
|
||||
msgstr ""
|
||||
msgstr "Izoztu azken fotograma"
|
||||
|
||||
#: ui/preferences-window.ui:46
|
||||
msgid "Close the app"
|
||||
msgstr ""
|
||||
msgstr "Aplikazioa itxi"
|
||||
|
||||
#: ui/preferences-window.ui:56
|
||||
msgid "Volume"
|
||||
msgstr ""
|
||||
msgstr "Bolumena"
|
||||
|
||||
#: ui/preferences-window.ui:59
|
||||
msgid "Custom initial value"
|
||||
msgstr ""
|
||||
msgstr "Hasierako balio pertsonalizatua"
|
||||
|
||||
#: ui/preferences-window.ui:60
|
||||
msgid "Set custom volume at startup instead of restoring it"
|
||||
msgstr ""
|
||||
msgstr "Hasieran bolumen pertsonalizatua ezartzea, lehengoratu beharrean"
|
||||
|
||||
#: ui/preferences-window.ui:64
|
||||
msgid "Volume percentage"
|
||||
msgstr ""
|
||||
msgstr "Bolumenaren ehunekoa"
|
||||
|
||||
#: ui/preferences-window.ui:75
|
||||
msgid "Seeking"
|
||||
msgstr ""
|
||||
msgstr "Bilaketa"
|
||||
|
||||
#: ui/preferences-window.ui:78
|
||||
msgid "Mode"
|
||||
msgstr ""
|
||||
msgstr "Modua"
|
||||
|
||||
#: ui/preferences-window.ui:84
|
||||
msgid "Accurate"
|
||||
msgstr ""
|
||||
msgstr "Zehatza"
|
||||
|
||||
#: ui/preferences-window.ui:85
|
||||
msgid "Fast"
|
||||
msgstr ""
|
||||
msgstr "Azkarra"
|
||||
|
||||
#: ui/preferences-window.ui:93
|
||||
msgid "Unit"
|
||||
msgstr ""
|
||||
msgstr "Unitatea"
|
||||
|
||||
#: ui/preferences-window.ui:98
|
||||
msgid "Second"
|
||||
msgstr ""
|
||||
msgstr "Segundu"
|
||||
|
||||
#: ui/preferences-window.ui:99
|
||||
msgid "Minute"
|
||||
msgstr ""
|
||||
msgstr "Minutu"
|
||||
|
||||
#: ui/preferences-window.ui:100
|
||||
msgid "Percentage"
|
||||
msgstr ""
|
||||
msgstr "Ehunekoa"
|
||||
|
||||
#: ui/preferences-window.ui:108
|
||||
msgid "Value"
|
||||
msgstr ""
|
||||
msgstr "Balioa"
|
||||
|
||||
#: ui/preferences-window.ui:123
|
||||
msgid "Audio"
|
||||
msgstr ""
|
||||
msgstr "Audioa"
|
||||
|
||||
#: ui/preferences-window.ui:126
|
||||
msgid "Offset in milliseconds"
|
||||
msgstr ""
|
||||
msgstr "Desplazamendua milisegundotan"
|
||||
|
||||
#: ui/preferences-window.ui:133
|
||||
msgid "Only native audio formats"
|
||||
msgstr ""
|
||||
msgstr "Jatorrizko audio-formatuak bakarrik"
|
||||
|
||||
#: ui/preferences-window.ui:141
|
||||
msgid "Subtitles"
|
||||
msgstr ""
|
||||
msgstr "Azpitituluak"
|
||||
|
||||
#: ui/preferences-window.ui:144
|
||||
msgid "Default font"
|
||||
msgstr ""
|
||||
msgstr "Hizki lehenetsia"
|
||||
|
||||
#: ui/preferences-window.ui:154
|
||||
msgid "Network"
|
||||
msgstr ""
|
||||
msgstr "Sarea"
|
||||
|
||||
#: ui/preferences-window.ui:158
|
||||
msgid "Client"
|
||||
msgstr ""
|
||||
msgstr "Bezeroa"
|
||||
|
||||
#: ui/preferences-window.ui:161
|
||||
msgid "Progressive download buffering"
|
||||
msgstr ""
|
||||
msgstr "Deskargak pixkanaka bufferizatzea"
|
||||
|
||||
#: ui/preferences-window.ui:169
|
||||
msgid "Server"
|
||||
msgstr ""
|
||||
msgstr "Zerbitzaria"
|
||||
|
||||
#: ui/preferences-window.ui:172
|
||||
msgid "Control player remotely"
|
||||
msgstr ""
|
||||
msgstr "Urrutiko erreproduzitzailea kontrolatzea"
|
||||
|
||||
#: ui/preferences-window.ui:176
|
||||
msgid "Listening port"
|
||||
msgstr ""
|
||||
msgstr "Entzuteko ataka"
|
||||
|
||||
#: ui/preferences-window.ui:183
|
||||
msgid "Run web application in background"
|
||||
msgstr ""
|
||||
msgstr "Web-aplikazioa bigarren planoan exekutatzea"
|
||||
|
||||
#: ui/preferences-window.ui:184
|
||||
msgid "Requires GTK compiled with Broadway backend"
|
||||
msgstr ""
|
||||
msgstr "GTK Broadwayko backend-arekin konpilatzea eskatzen du"
|
||||
|
||||
#: ui/preferences-window.ui:190
|
||||
msgid "Web application port"
|
||||
msgstr ""
|
||||
msgstr "Web aplikazioaren ataka"
|
||||
|
||||
#: ui/preferences-window.ui:204
|
||||
msgid "Prefer adaptive streaming"
|
||||
msgstr ""
|
||||
msgstr "Transmisio moldagarria lehenestea"
|
||||
|
||||
#: ui/preferences-window.ui:210
|
||||
msgid "Max quality"
|
||||
msgstr ""
|
||||
msgstr "Gehieneko kalitatea"
|
||||
|
||||
#: ui/preferences-window.ui:228
|
||||
msgid "Tweaks"
|
||||
msgstr ""
|
||||
msgstr "Ukituak"
|
||||
|
||||
#: ui/preferences-window.ui:232
|
||||
msgid "Appearance"
|
||||
msgstr ""
|
||||
msgstr "Itxura"
|
||||
|
||||
#: ui/preferences-window.ui:235
|
||||
msgid "Dark theme"
|
||||
msgstr ""
|
||||
msgstr "Gai iluna"
|
||||
|
||||
#: ui/preferences-window.ui:241
|
||||
msgid "Render window shadows"
|
||||
msgstr ""
|
||||
msgstr "Leihoetako itzalak errenderizatzea"
|
||||
|
||||
#: ui/preferences-window.ui:242
|
||||
msgid "Disable to increase performance when windowed"
|
||||
msgstr ""
|
||||
msgstr "Desaktibatu leihoa erabiltzen denean errendimendua handitzeko"
|
||||
|
||||
#: ui/preferences-window.ui:253
|
||||
msgid "Plugin ranking"
|
||||
msgstr ""
|
||||
msgstr "Pluginen sailkapena"
|
||||
|
||||
#: ui/preferences-window.ui:254
|
||||
msgid "Alter default ranks of GStreamer plugins"
|
||||
msgstr ""
|
||||
msgstr "Aldatu GStreamer-en pluginen lehenetsitako mailak"
|
||||
|
||||
#: ui/preferences-window.ui:259
|
||||
msgid "Use playbin3"
|
||||
msgstr ""
|
||||
msgstr "Playbin3 erabili"
|
||||
|
||||
#: ui/preferences-window.ui:260 ui/preferences-window.ui:269
|
||||
msgid "Requires player restart"
|
||||
msgstr ""
|
||||
msgstr "Berrabiaraztea eskatzen du"
|
||||
|
||||
#: ui/preferences-window.ui:262 ui/preferences-window.ui:271
|
||||
msgid "Experimental"
|
||||
msgstr ""
|
||||
msgstr "Esperimentala"
|
||||
|
||||
#: ui/preferences-window.ui:268
|
||||
msgid "Use PipeWire for audio output"
|
||||
msgstr ""
|
||||
msgstr "Erabili PipeWire audio-irteerarako"
|
||||
|
||||
#: src/buttons.js:201
|
||||
#, javascript-format
|
||||
msgid "Decoder: %s"
|
||||
msgstr ""
|
||||
msgstr "Deskodetzailea: %s"
|
||||
|
||||
#: src/dialogs.js:152
|
||||
msgid "Enter or drop URI here"
|
||||
msgstr ""
|
||||
msgstr "Sartu edo utzi URIa erortzen hemen"
|
||||
|
||||
#: src/dialogs.js:157
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
msgstr "Ezeztatu"
|
||||
|
||||
#: src/dialogs.js:158
|
||||
msgid "Open"
|
||||
msgstr ""
|
||||
msgstr "Ireki"
|
||||
|
||||
#: src/dialogs.js:226
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
msgstr "Titulua"
|
||||
|
||||
#: src/dialogs.js:227
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
msgstr "Osatuta"
|
||||
|
||||
#: src/dialogs.js:235
|
||||
msgid "Resume playback?"
|
||||
msgstr ""
|
||||
msgstr "Jarraitu erreprodukzioarekin?"
|
||||
|
||||
#: src/dialogs.js:289
|
||||
#, javascript-format
|
||||
msgid "GTK version: %s"
|
||||
msgstr ""
|
||||
msgstr "GTK bertsioa: %s"
|
||||
|
||||
#: src/dialogs.js:290
|
||||
#, javascript-format
|
||||
msgid "Adwaita version: %s"
|
||||
msgstr ""
|
||||
msgstr "Adwaitaren bertsioa: %s"
|
||||
|
||||
#: src/dialogs.js:291
|
||||
#, javascript-format
|
||||
msgid "GStreamer version: %s"
|
||||
msgstr ""
|
||||
msgstr "GStreamer-en bertsioa: %s"
|
||||
|
||||
#: src/dialogs.js:292
|
||||
#, javascript-format
|
||||
msgid "GJS version: %s"
|
||||
msgstr ""
|
||||
msgstr "GJS bertsioa: %s"
|
||||
|
||||
#: src/dialogs.js:300
|
||||
msgid "A GNOME media player powered by GStreamer"
|
||||
msgstr ""
|
||||
msgstr "GNOMEren multimedia erreproduzitzaile bat GStreamer-ekin"
|
||||
|
||||
#. TRANSLATORS: Put your name(s) here for credits or leave untranslated
|
||||
#: src/dialogs.js:305
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
msgstr "Sergio Varela (@IngrownMink4)"
|
||||
|
||||
#: src/revealers.js:170
|
||||
#, javascript-format
|
||||
msgid "Ends at: %s"
|
||||
msgstr ""
|
||||
msgstr "Amaiera: %s"
|
||||
|
||||
#: src/widget.js:227 src/widget.js:236 src/widget.js:242 src/widget.js:248
|
||||
msgid "Undetermined"
|
||||
msgstr ""
|
||||
msgstr "Zehaztugabea"
|
||||
|
||||
#: src/widget.js:243
|
||||
msgid "Channels"
|
||||
msgstr ""
|
||||
msgstr "Kanalak"
|
||||
|
||||
#: src/widget.js:261
|
||||
msgid "Disabled"
|
||||
msgstr ""
|
||||
msgstr "Desgaituta"
|
||||
|
||||
|
218
po/ja.po
218
po/ja.po
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: clapper\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-09-14 16:35+0200\n"
|
||||
"PO-Revision-Date: 2021-09-14 15:25\n"
|
||||
"PO-Revision-Date: 2022-04-01 09:06\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Japanese\n"
|
||||
"Language: ja_JP\n"
|
||||
@@ -19,441 +19,441 @@ msgstr ""
|
||||
|
||||
#: ui/clapper.ui:6
|
||||
msgid "Open Files…"
|
||||
msgstr ""
|
||||
msgstr "ファイルを開く…"
|
||||
|
||||
#: ui/clapper.ui:10
|
||||
msgid "Open URI…"
|
||||
msgstr ""
|
||||
msgstr "URIを開く…"
|
||||
|
||||
#: ui/clapper.ui:16 ui/preferences-window.ui:4
|
||||
msgid "Preferences"
|
||||
msgstr ""
|
||||
msgstr "設定"
|
||||
|
||||
#: ui/clapper.ui:20
|
||||
msgid "Shortcuts"
|
||||
msgstr ""
|
||||
msgstr "ショートカット"
|
||||
|
||||
#: ui/clapper.ui:26
|
||||
msgid "About Clapper"
|
||||
msgstr ""
|
||||
msgstr "Clapperについて"
|
||||
|
||||
#: ui/elapsed-time-button.ui:27
|
||||
msgid "Speed"
|
||||
msgstr ""
|
||||
msgstr "速度"
|
||||
|
||||
#: ui/elapsed-time-button.ui:41 ui/preferences-window.ui:83
|
||||
#: ui/preferences-window.ui:215
|
||||
msgid "Normal"
|
||||
msgstr ""
|
||||
msgstr "標準"
|
||||
|
||||
#: ui/help-overlay.ui:10 ui/preferences-window.ui:12
|
||||
msgid "General"
|
||||
msgstr ""
|
||||
msgstr "一般"
|
||||
|
||||
#: ui/help-overlay.ui:13
|
||||
msgid "Show shortcuts"
|
||||
msgstr ""
|
||||
msgstr "ショートカットを表示する"
|
||||
|
||||
#: ui/help-overlay.ui:19
|
||||
msgid "Toggle fullscreen"
|
||||
msgstr ""
|
||||
msgstr "フルスクリーン切り替え"
|
||||
|
||||
#: ui/help-overlay.ui:20
|
||||
msgid "Double tap | Double click"
|
||||
msgstr ""
|
||||
msgstr "ダブルタップ | ダブルクリック"
|
||||
|
||||
#: ui/help-overlay.ui:26
|
||||
msgid "Leave fullscreen"
|
||||
msgstr ""
|
||||
msgstr "フルスクリーンを終了"
|
||||
|
||||
#: ui/help-overlay.ui:32
|
||||
msgid "Reveal OSD (fullscreen only)"
|
||||
msgstr ""
|
||||
msgstr "OSDを表示 (全画面表示の場合のみ)"
|
||||
|
||||
#: ui/help-overlay.ui:33
|
||||
msgid "Tap"
|
||||
msgstr ""
|
||||
msgstr "タップ"
|
||||
|
||||
#: ui/help-overlay.ui:39
|
||||
msgid "Quit"
|
||||
msgstr ""
|
||||
msgstr "終了"
|
||||
|
||||
#: ui/help-overlay.ui:47
|
||||
msgid "Media"
|
||||
msgstr ""
|
||||
msgstr "メディア"
|
||||
|
||||
#: ui/help-overlay.ui:50
|
||||
msgid "Open files"
|
||||
msgstr ""
|
||||
msgstr "ファイルを開く"
|
||||
|
||||
#: ui/help-overlay.ui:56 src/dialogs.js:137
|
||||
msgid "Open URI"
|
||||
msgstr ""
|
||||
msgstr "URIを開く"
|
||||
|
||||
#: ui/help-overlay.ui:64
|
||||
msgid "Playlist"
|
||||
msgstr ""
|
||||
msgstr "プレイリスト"
|
||||
|
||||
#: ui/help-overlay.ui:67
|
||||
msgid "Next item"
|
||||
msgstr ""
|
||||
msgstr "次の項目"
|
||||
|
||||
#: ui/help-overlay.ui:68
|
||||
msgid "Double tap (right side)"
|
||||
msgstr ""
|
||||
msgstr "ダブルタップ(右端)"
|
||||
|
||||
#: ui/help-overlay.ui:74
|
||||
msgid "Previous item"
|
||||
msgstr ""
|
||||
msgstr "前の項目"
|
||||
|
||||
#: ui/help-overlay.ui:75
|
||||
msgid "Double tap (left side)"
|
||||
msgstr ""
|
||||
msgstr "ダブルタップ(左端)"
|
||||
|
||||
#: ui/help-overlay.ui:81
|
||||
msgid "Change repeat mode"
|
||||
msgstr ""
|
||||
msgstr "リピートモードを変更"
|
||||
|
||||
#: ui/help-overlay.ui:87
|
||||
msgid "Export to file"
|
||||
msgstr ""
|
||||
msgstr "ファイルへエクスポート"
|
||||
|
||||
#: ui/help-overlay.ui:95 ui/preferences-window.ui:119
|
||||
msgid "Playback"
|
||||
msgstr ""
|
||||
msgstr "プレイバック"
|
||||
|
||||
#: ui/help-overlay.ui:98
|
||||
msgid "Toggle play"
|
||||
msgstr ""
|
||||
msgstr "一時停止・再生"
|
||||
|
||||
#: ui/help-overlay.ui:99
|
||||
msgid "Long press | Right click"
|
||||
msgstr ""
|
||||
msgstr "Long press | Right click"
|
||||
|
||||
#: ui/help-overlay.ui:105
|
||||
msgid "Seek forward"
|
||||
msgstr ""
|
||||
msgstr "早送り"
|
||||
|
||||
#: ui/help-overlay.ui:106
|
||||
msgid "Swipe right | Scroll right"
|
||||
msgstr ""
|
||||
msgstr "右スワイプ | 右スクロール"
|
||||
|
||||
#: ui/help-overlay.ui:112
|
||||
msgid "Seek backward"
|
||||
msgstr ""
|
||||
msgstr "巻き戻し"
|
||||
|
||||
#: ui/help-overlay.ui:113
|
||||
msgid "Swipe left | Scroll left"
|
||||
msgstr ""
|
||||
msgstr "左スワイプ | 左スクロール"
|
||||
|
||||
#: ui/help-overlay.ui:119
|
||||
msgid "Volume up"
|
||||
msgstr ""
|
||||
msgstr "音量を上げる"
|
||||
|
||||
#: ui/help-overlay.ui:120
|
||||
msgid "Swipe up | Scroll up"
|
||||
msgstr ""
|
||||
msgstr "上スワイプ | 上スクロール"
|
||||
|
||||
#: ui/help-overlay.ui:126
|
||||
msgid "Volume down"
|
||||
msgstr ""
|
||||
msgstr "音量を下げる"
|
||||
|
||||
#: ui/help-overlay.ui:127
|
||||
msgid "Swipe down | Scroll down"
|
||||
msgstr ""
|
||||
msgstr "下スワイプ | 下スクロール"
|
||||
|
||||
#: ui/help-overlay.ui:133
|
||||
msgid "Toggle mute"
|
||||
msgstr ""
|
||||
msgstr "ミュート切り替え"
|
||||
|
||||
#: ui/help-overlay.ui:139
|
||||
msgid "Next chapter"
|
||||
msgstr ""
|
||||
msgstr "次のチャプターへ"
|
||||
|
||||
#: ui/help-overlay.ui:145
|
||||
msgid "Previous chapter"
|
||||
msgstr ""
|
||||
msgstr "前のチャプターへ\""
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:11
|
||||
msgid "Decoders"
|
||||
msgstr ""
|
||||
msgstr "デコーダー"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:18
|
||||
msgid "Return to the preferences"
|
||||
msgstr ""
|
||||
msgstr "設定へ戻る"
|
||||
|
||||
#: ui/preferences-window.ui:16
|
||||
msgid "Behavior"
|
||||
msgstr ""
|
||||
msgstr "挙動"
|
||||
|
||||
#: ui/preferences-window.ui:19
|
||||
msgid "Auto fullscreen"
|
||||
msgstr ""
|
||||
msgstr "自動的にフルスクリーンに切り替える"
|
||||
|
||||
#: ui/preferences-window.ui:20
|
||||
msgid "Enter fullscreen when playlist is replaced except floating mode"
|
||||
msgstr ""
|
||||
msgstr "フローティングモードを除き、プレイリストを入れ替えた場合に自動的にフルスクリーンにする"
|
||||
|
||||
#: ui/preferences-window.ui:26
|
||||
msgid "Ask to resume recent media"
|
||||
msgstr ""
|
||||
msgstr "前回再生したメディアを続きから再生するか尋ねる"
|
||||
|
||||
#: ui/preferences-window.ui:32
|
||||
msgid "Float on all workspaces"
|
||||
msgstr ""
|
||||
msgstr "すべてのワークスペースにフロートを配置する"
|
||||
|
||||
#: ui/preferences-window.ui:33
|
||||
msgid "This option only works on GNOME"
|
||||
msgstr ""
|
||||
msgstr "このオプションはGnomeでのみ機能します"
|
||||
|
||||
#: ui/preferences-window.ui:39
|
||||
msgid "After playback"
|
||||
msgstr ""
|
||||
msgstr "再生終了後"
|
||||
|
||||
#: ui/preferences-window.ui:44
|
||||
msgid "Do nothing"
|
||||
msgstr ""
|
||||
msgstr "何もしない"
|
||||
|
||||
#: ui/preferences-window.ui:45
|
||||
msgid "Freeze last frame"
|
||||
msgstr ""
|
||||
msgstr "最後のフレームで停止する"
|
||||
|
||||
#: ui/preferences-window.ui:46
|
||||
msgid "Close the app"
|
||||
msgstr ""
|
||||
msgstr "アプリを閉じる"
|
||||
|
||||
#: ui/preferences-window.ui:56
|
||||
msgid "Volume"
|
||||
msgstr ""
|
||||
msgstr "音量"
|
||||
|
||||
#: ui/preferences-window.ui:59
|
||||
msgid "Custom initial value"
|
||||
msgstr ""
|
||||
msgstr "初期音量を設定する"
|
||||
|
||||
#: ui/preferences-window.ui:60
|
||||
msgid "Set custom volume at startup instead of restoring it"
|
||||
msgstr ""
|
||||
msgstr "前回使用した音量を使用するのではなく、起動時に音量をカスタム値に設定します"
|
||||
|
||||
#: ui/preferences-window.ui:64
|
||||
msgid "Volume percentage"
|
||||
msgstr ""
|
||||
msgstr "音量(%)"
|
||||
|
||||
#: ui/preferences-window.ui:75
|
||||
msgid "Seeking"
|
||||
msgstr ""
|
||||
msgstr "シーキング"
|
||||
|
||||
#: ui/preferences-window.ui:78
|
||||
msgid "Mode"
|
||||
msgstr ""
|
||||
msgstr "モード"
|
||||
|
||||
#: ui/preferences-window.ui:84
|
||||
msgid "Accurate"
|
||||
msgstr ""
|
||||
msgstr "精密"
|
||||
|
||||
#: ui/preferences-window.ui:85
|
||||
msgid "Fast"
|
||||
msgstr ""
|
||||
msgstr "高速"
|
||||
|
||||
#: ui/preferences-window.ui:93
|
||||
msgid "Unit"
|
||||
msgstr ""
|
||||
msgstr "ユニット"
|
||||
|
||||
#: ui/preferences-window.ui:98
|
||||
msgid "Second"
|
||||
msgstr ""
|
||||
msgstr "秒"
|
||||
|
||||
#: ui/preferences-window.ui:99
|
||||
msgid "Minute"
|
||||
msgstr ""
|
||||
msgstr "分"
|
||||
|
||||
#: ui/preferences-window.ui:100
|
||||
msgid "Percentage"
|
||||
msgstr ""
|
||||
msgstr "パーセント"
|
||||
|
||||
#: ui/preferences-window.ui:108
|
||||
msgid "Value"
|
||||
msgstr ""
|
||||
msgstr "値"
|
||||
|
||||
#: ui/preferences-window.ui:123
|
||||
msgid "Audio"
|
||||
msgstr ""
|
||||
msgstr "オ−ディオ"
|
||||
|
||||
#: ui/preferences-window.ui:126
|
||||
msgid "Offset in milliseconds"
|
||||
msgstr ""
|
||||
msgstr "オフセット(ミリ秒)"
|
||||
|
||||
#: ui/preferences-window.ui:133
|
||||
msgid "Only native audio formats"
|
||||
msgstr ""
|
||||
msgstr "ネイティブオーディオフォーマットのみを使用する"
|
||||
|
||||
#: ui/preferences-window.ui:141
|
||||
msgid "Subtitles"
|
||||
msgstr ""
|
||||
msgstr "字幕"
|
||||
|
||||
#: ui/preferences-window.ui:144
|
||||
msgid "Default font"
|
||||
msgstr ""
|
||||
msgstr "既定のフォント"
|
||||
|
||||
#: ui/preferences-window.ui:154
|
||||
msgid "Network"
|
||||
msgstr ""
|
||||
msgstr "ネットワーク"
|
||||
|
||||
#: ui/preferences-window.ui:158
|
||||
msgid "Client"
|
||||
msgstr ""
|
||||
msgstr "クライアント"
|
||||
|
||||
#: ui/preferences-window.ui:161
|
||||
msgid "Progressive download buffering"
|
||||
msgstr ""
|
||||
msgstr "プログレッシブなバッファリングを使用する"
|
||||
|
||||
#: ui/preferences-window.ui:169
|
||||
msgid "Server"
|
||||
msgstr ""
|
||||
msgstr "サーバー"
|
||||
|
||||
#: ui/preferences-window.ui:172
|
||||
msgid "Control player remotely"
|
||||
msgstr ""
|
||||
msgstr "プレーヤーをリモートでコントロールする"
|
||||
|
||||
#: ui/preferences-window.ui:176
|
||||
msgid "Listening port"
|
||||
msgstr ""
|
||||
msgstr "待ち受けポート"
|
||||
|
||||
#: ui/preferences-window.ui:183
|
||||
msgid "Run web application in background"
|
||||
msgstr ""
|
||||
msgstr "Webアプリケーションをバックグラウンドで実行する"
|
||||
|
||||
#: ui/preferences-window.ui:184
|
||||
msgid "Requires GTK compiled with Broadway backend"
|
||||
msgstr ""
|
||||
msgstr "Broadwayバックエンドでコンパイルされた GTK が必要です"
|
||||
|
||||
#: ui/preferences-window.ui:190
|
||||
msgid "Web application port"
|
||||
msgstr ""
|
||||
msgstr "Webアプリケーションのポート"
|
||||
|
||||
#: ui/preferences-window.ui:204
|
||||
msgid "Prefer adaptive streaming"
|
||||
msgstr ""
|
||||
msgstr "アダプティブストリーミングを優先する"
|
||||
|
||||
#: ui/preferences-window.ui:210
|
||||
msgid "Max quality"
|
||||
msgstr ""
|
||||
msgstr "Max quality"
|
||||
|
||||
#: ui/preferences-window.ui:228
|
||||
msgid "Tweaks"
|
||||
msgstr ""
|
||||
msgstr "詳細設定"
|
||||
|
||||
#: ui/preferences-window.ui:232
|
||||
msgid "Appearance"
|
||||
msgstr ""
|
||||
msgstr "外観"
|
||||
|
||||
#: ui/preferences-window.ui:235
|
||||
msgid "Dark theme"
|
||||
msgstr ""
|
||||
msgstr "ダークテーマ"
|
||||
|
||||
#: ui/preferences-window.ui:241
|
||||
msgid "Render window shadows"
|
||||
msgstr ""
|
||||
msgstr "ウィンドウの影をレンダリングする"
|
||||
|
||||
#: ui/preferences-window.ui:242
|
||||
msgid "Disable to increase performance when windowed"
|
||||
msgstr ""
|
||||
msgstr "無効化するとウィンドウモードでのパフォーマンスが向上します"
|
||||
|
||||
#: ui/preferences-window.ui:253
|
||||
msgid "Plugin ranking"
|
||||
msgstr ""
|
||||
msgstr "プライグインの優先順位"
|
||||
|
||||
#: ui/preferences-window.ui:254
|
||||
msgid "Alter default ranks of GStreamer plugins"
|
||||
msgstr ""
|
||||
msgstr "GStreamerプラグインの優先順位を変更します"
|
||||
|
||||
#: ui/preferences-window.ui:259
|
||||
msgid "Use playbin3"
|
||||
msgstr ""
|
||||
msgstr "playbin3を使用"
|
||||
|
||||
#: ui/preferences-window.ui:260 ui/preferences-window.ui:269
|
||||
msgid "Requires player restart"
|
||||
msgstr ""
|
||||
msgstr "プレイヤーの再起動が必要です"
|
||||
|
||||
#: ui/preferences-window.ui:262 ui/preferences-window.ui:271
|
||||
msgid "Experimental"
|
||||
msgstr ""
|
||||
msgstr "試験運用機能"
|
||||
|
||||
#: ui/preferences-window.ui:268
|
||||
msgid "Use PipeWire for audio output"
|
||||
msgstr ""
|
||||
msgstr "オーディオ出力にPipeWireを使用する"
|
||||
|
||||
#: src/buttons.js:201
|
||||
#, javascript-format
|
||||
msgid "Decoder: %s"
|
||||
msgstr ""
|
||||
msgstr "デコーダー: %s"
|
||||
|
||||
#: src/dialogs.js:152
|
||||
msgid "Enter or drop URI here"
|
||||
msgstr ""
|
||||
msgstr "ここにURIを入力またはドロップ"
|
||||
|
||||
#: src/dialogs.js:157
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
msgstr "キャンセル"
|
||||
|
||||
#: src/dialogs.js:158
|
||||
msgid "Open"
|
||||
msgstr ""
|
||||
msgstr "開く"
|
||||
|
||||
#: src/dialogs.js:226
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
msgstr "タイトル"
|
||||
|
||||
#: src/dialogs.js:227
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
msgstr "再生済み"
|
||||
|
||||
#: src/dialogs.js:235
|
||||
msgid "Resume playback?"
|
||||
msgstr ""
|
||||
msgstr "前回の続きから再生しますか?"
|
||||
|
||||
#: src/dialogs.js:289
|
||||
#, javascript-format
|
||||
msgid "GTK version: %s"
|
||||
msgstr ""
|
||||
msgstr "GTKバージョン: %s"
|
||||
|
||||
#: src/dialogs.js:290
|
||||
#, javascript-format
|
||||
msgid "Adwaita version: %s"
|
||||
msgstr ""
|
||||
msgstr "Adwaitaバージョン: %s"
|
||||
|
||||
#: src/dialogs.js:291
|
||||
#, javascript-format
|
||||
msgid "GStreamer version: %s"
|
||||
msgstr ""
|
||||
msgstr "GStreamer バージョン: %s"
|
||||
|
||||
#: src/dialogs.js:292
|
||||
#, javascript-format
|
||||
msgid "GJS version: %s"
|
||||
msgstr ""
|
||||
msgstr "GJS バージョン: %s"
|
||||
|
||||
#: src/dialogs.js:300
|
||||
msgid "A GNOME media player powered by GStreamer"
|
||||
msgstr ""
|
||||
msgstr "GStreamerを使用したGNOME向けのメディアプレーヤー"
|
||||
|
||||
#. TRANSLATORS: Put your name(s) here for credits or leave untranslated
|
||||
#: src/dialogs.js:305
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
msgstr "翻訳者"
|
||||
|
||||
#: src/revealers.js:170
|
||||
#, javascript-format
|
||||
msgid "Ends at: %s"
|
||||
msgstr ""
|
||||
msgstr "再生終了時刻: %s"
|
||||
|
||||
#: src/widget.js:227 src/widget.js:236 src/widget.js:242 src/widget.js:248
|
||||
msgid "Undetermined"
|
||||
msgstr ""
|
||||
msgstr "不明"
|
||||
|
||||
#: src/widget.js:243
|
||||
msgid "Channels"
|
||||
msgstr ""
|
||||
msgstr "チャンネル"
|
||||
|
||||
#: src/widget.js:261
|
||||
msgid "Disabled"
|
||||
msgstr ""
|
||||
msgstr "Disabled"
|
||||
|
||||
|
44
po/nl.po
44
po/nl.po
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: clapper\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-09-14 16:35+0200\n"
|
||||
"PO-Revision-Date: 2021-09-14 16:21\n"
|
||||
"PO-Revision-Date: 2022-04-08 16:14\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Dutch\n"
|
||||
"Language: nl_NL\n"
|
||||
@@ -39,7 +39,7 @@ msgstr "Over Clapper"
|
||||
|
||||
#: ui/elapsed-time-button.ui:27
|
||||
msgid "Speed"
|
||||
msgstr ""
|
||||
msgstr "Snelheid"
|
||||
|
||||
#: ui/elapsed-time-button.ui:41 ui/preferences-window.ui:83
|
||||
#: ui/preferences-window.ui:215
|
||||
@@ -164,7 +164,7 @@ msgstr "Omlaag vegen/scrollen"
|
||||
|
||||
#: ui/help-overlay.ui:133
|
||||
msgid "Toggle mute"
|
||||
msgstr ""
|
||||
msgstr "Geluid dempen"
|
||||
|
||||
#: ui/help-overlay.ui:139
|
||||
msgid "Next chapter"
|
||||
@@ -368,72 +368,72 @@ msgstr "Pas de standaardvolgorde van GStreamer-plug-ins aan"
|
||||
|
||||
#: ui/preferences-window.ui:259
|
||||
msgid "Use playbin3"
|
||||
msgstr ""
|
||||
msgstr "playbin3 gebruiken"
|
||||
|
||||
#: ui/preferences-window.ui:260 ui/preferences-window.ui:269
|
||||
msgid "Requires player restart"
|
||||
msgstr ""
|
||||
msgstr "Herstart de speler om de wijziging toe te passen"
|
||||
|
||||
#: ui/preferences-window.ui:262 ui/preferences-window.ui:271
|
||||
msgid "Experimental"
|
||||
msgstr ""
|
||||
msgstr "Experimenteel"
|
||||
|
||||
#: ui/preferences-window.ui:268
|
||||
msgid "Use PipeWire for audio output"
|
||||
msgstr ""
|
||||
msgstr "PipeWire gebruiken voor audio-uitvoer"
|
||||
|
||||
#: src/buttons.js:201
|
||||
#, javascript-format
|
||||
msgid "Decoder: %s"
|
||||
msgstr ""
|
||||
msgstr "Decoder: %s"
|
||||
|
||||
#: src/dialogs.js:152
|
||||
msgid "Enter or drop URI here"
|
||||
msgstr ""
|
||||
msgstr "Voer een uri in of sleep een uri hierheen"
|
||||
|
||||
#: src/dialogs.js:157
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
msgstr "Annuleren"
|
||||
|
||||
#: src/dialogs.js:158
|
||||
msgid "Open"
|
||||
msgstr ""
|
||||
msgstr "Openen"
|
||||
|
||||
#: src/dialogs.js:226
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
msgstr "Titel"
|
||||
|
||||
#: src/dialogs.js:227
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
msgstr "Voltooid"
|
||||
|
||||
#: src/dialogs.js:235
|
||||
msgid "Resume playback?"
|
||||
msgstr ""
|
||||
msgstr "Afspelen hervatten?"
|
||||
|
||||
#: src/dialogs.js:289
|
||||
#, javascript-format
|
||||
msgid "GTK version: %s"
|
||||
msgstr ""
|
||||
msgstr "GTK versie: %s"
|
||||
|
||||
#: src/dialogs.js:290
|
||||
#, javascript-format
|
||||
msgid "Adwaita version: %s"
|
||||
msgstr ""
|
||||
msgstr "Adwaita-versie: %s"
|
||||
|
||||
#: src/dialogs.js:291
|
||||
#, javascript-format
|
||||
msgid "GStreamer version: %s"
|
||||
msgstr ""
|
||||
msgstr "GStreamer-versie: %s"
|
||||
|
||||
#: src/dialogs.js:292
|
||||
#, javascript-format
|
||||
msgid "GJS version: %s"
|
||||
msgstr ""
|
||||
msgstr "GJS-versie: %s"
|
||||
|
||||
#: src/dialogs.js:300
|
||||
msgid "A GNOME media player powered by GStreamer"
|
||||
msgstr ""
|
||||
msgstr "Een door GStreamer aangedreven GNOME-mediaspeler"
|
||||
|
||||
#. TRANSLATORS: Put your name(s) here for credits or leave untranslated
|
||||
#: src/dialogs.js:305
|
||||
@@ -447,13 +447,13 @@ msgstr "Eindigt op: %s"
|
||||
|
||||
#: src/widget.js:227 src/widget.js:236 src/widget.js:242 src/widget.js:248
|
||||
msgid "Undetermined"
|
||||
msgstr ""
|
||||
msgstr "onbekend"
|
||||
|
||||
#: src/widget.js:243
|
||||
msgid "Channels"
|
||||
msgstr ""
|
||||
msgstr "Kanalen"
|
||||
|
||||
#: src/widget.js:261
|
||||
msgid "Disabled"
|
||||
msgstr ""
|
||||
msgstr "Uitgeschakeld"
|
||||
|
||||
|
178
po/pt.po
178
po/pt.po
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: clapper\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-09-14 16:35+0200\n"
|
||||
"PO-Revision-Date: 2021-10-21 00:29\n"
|
||||
"PO-Revision-Date: 2022-05-01 18:43\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Portuguese\n"
|
||||
"Language: pt_PT\n"
|
||||
@@ -19,7 +19,7 @@ msgstr ""
|
||||
|
||||
#: ui/clapper.ui:6
|
||||
msgid "Open Files…"
|
||||
msgstr "Abrir Arquivos…"
|
||||
msgstr "Abrir ficheiros…"
|
||||
|
||||
#: ui/clapper.ui:10
|
||||
msgid "Open URI…"
|
||||
@@ -104,356 +104,356 @@ msgstr "Toque duplo (lado direito)"
|
||||
|
||||
#: ui/help-overlay.ui:74
|
||||
msgid "Previous item"
|
||||
msgstr ""
|
||||
msgstr "Item anterior"
|
||||
|
||||
#: ui/help-overlay.ui:75
|
||||
msgid "Double tap (left side)"
|
||||
msgstr ""
|
||||
msgstr "Toque duplo (lado esquerdo)"
|
||||
|
||||
#: ui/help-overlay.ui:81
|
||||
msgid "Change repeat mode"
|
||||
msgstr ""
|
||||
msgstr "Alterar modo de repetição"
|
||||
|
||||
#: ui/help-overlay.ui:87
|
||||
msgid "Export to file"
|
||||
msgstr ""
|
||||
msgstr "Exportar para ficheiro"
|
||||
|
||||
#: ui/help-overlay.ui:95 ui/preferences-window.ui:119
|
||||
msgid "Playback"
|
||||
msgstr ""
|
||||
msgstr "Reproduzir"
|
||||
|
||||
#: ui/help-overlay.ui:98
|
||||
msgid "Toggle play"
|
||||
msgstr ""
|
||||
msgstr "Alternar reprodução"
|
||||
|
||||
#: ui/help-overlay.ui:99
|
||||
msgid "Long press | Right click"
|
||||
msgstr ""
|
||||
msgstr "Toque longo | Clique com o botão direito"
|
||||
|
||||
#: ui/help-overlay.ui:105
|
||||
msgid "Seek forward"
|
||||
msgstr ""
|
||||
msgstr "Procurar para a frente"
|
||||
|
||||
#: ui/help-overlay.ui:106
|
||||
msgid "Swipe right | Scroll right"
|
||||
msgstr ""
|
||||
msgstr "Deslizar para a direita | Deslocar para direita"
|
||||
|
||||
#: ui/help-overlay.ui:112
|
||||
msgid "Seek backward"
|
||||
msgstr ""
|
||||
msgstr "Procurar para trás"
|
||||
|
||||
#: ui/help-overlay.ui:113
|
||||
msgid "Swipe left | Scroll left"
|
||||
msgstr ""
|
||||
msgstr "Deslizar para a esquerda | Deslocar para a esquerda"
|
||||
|
||||
#: ui/help-overlay.ui:119
|
||||
msgid "Volume up"
|
||||
msgstr ""
|
||||
msgstr "Aumentar o volume"
|
||||
|
||||
#: ui/help-overlay.ui:120
|
||||
msgid "Swipe up | Scroll up"
|
||||
msgstr ""
|
||||
msgstr "Deslizar para cima | Deslocar para cima"
|
||||
|
||||
#: ui/help-overlay.ui:126
|
||||
msgid "Volume down"
|
||||
msgstr ""
|
||||
msgstr "Diminuir o volume"
|
||||
|
||||
#: ui/help-overlay.ui:127
|
||||
msgid "Swipe down | Scroll down"
|
||||
msgstr ""
|
||||
msgstr "Deslizar para baixo | Deslocar para baixo"
|
||||
|
||||
#: ui/help-overlay.ui:133
|
||||
msgid "Toggle mute"
|
||||
msgstr ""
|
||||
msgstr "Ativar/Desativar Som"
|
||||
|
||||
#: ui/help-overlay.ui:139
|
||||
msgid "Next chapter"
|
||||
msgstr ""
|
||||
msgstr "Capítulo seguinte"
|
||||
|
||||
#: ui/help-overlay.ui:145
|
||||
msgid "Previous chapter"
|
||||
msgstr ""
|
||||
msgstr "Capítulo anterior"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:11
|
||||
msgid "Decoders"
|
||||
msgstr ""
|
||||
msgstr "Descodificadores"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:18
|
||||
msgid "Return to the preferences"
|
||||
msgstr ""
|
||||
msgstr "Voltar para as preferências"
|
||||
|
||||
#: ui/preferences-window.ui:16
|
||||
msgid "Behavior"
|
||||
msgstr ""
|
||||
msgstr "Comportamento"
|
||||
|
||||
#: ui/preferences-window.ui:19
|
||||
msgid "Auto fullscreen"
|
||||
msgstr ""
|
||||
msgstr "Ecrã inteiro automático"
|
||||
|
||||
#: ui/preferences-window.ui:20
|
||||
msgid "Enter fullscreen when playlist is replaced except floating mode"
|
||||
msgstr ""
|
||||
msgstr "Entrar em ecrã inteiro quando a lista de reprodução é substituída, excepto no modo flutuante"
|
||||
|
||||
#: ui/preferences-window.ui:26
|
||||
msgid "Ask to resume recent media"
|
||||
msgstr ""
|
||||
msgstr "Pedir para retomar o ficheiro recente"
|
||||
|
||||
#: ui/preferences-window.ui:32
|
||||
msgid "Float on all workspaces"
|
||||
msgstr ""
|
||||
msgstr "Flutuar em todas as áreas de trabalho"
|
||||
|
||||
#: ui/preferences-window.ui:33
|
||||
msgid "This option only works on GNOME"
|
||||
msgstr ""
|
||||
msgstr "Esta opção apenas funciona no GNOME"
|
||||
|
||||
#: ui/preferences-window.ui:39
|
||||
msgid "After playback"
|
||||
msgstr ""
|
||||
msgstr "Após reprodução"
|
||||
|
||||
#: ui/preferences-window.ui:44
|
||||
msgid "Do nothing"
|
||||
msgstr ""
|
||||
msgstr "Não fazer nada"
|
||||
|
||||
#: ui/preferences-window.ui:45
|
||||
msgid "Freeze last frame"
|
||||
msgstr ""
|
||||
msgstr "Suster o fotograma"
|
||||
|
||||
#: ui/preferences-window.ui:46
|
||||
msgid "Close the app"
|
||||
msgstr ""
|
||||
msgstr "Fechar a aplicação"
|
||||
|
||||
#: ui/preferences-window.ui:56
|
||||
msgid "Volume"
|
||||
msgstr ""
|
||||
msgstr "Volume"
|
||||
|
||||
#: ui/preferences-window.ui:59
|
||||
msgid "Custom initial value"
|
||||
msgstr ""
|
||||
msgstr "Valor inicial personalizado"
|
||||
|
||||
#: ui/preferences-window.ui:60
|
||||
msgid "Set custom volume at startup instead of restoring it"
|
||||
msgstr ""
|
||||
msgstr "Definir volume personalizado no arranque ao invés de restaurá-lo"
|
||||
|
||||
#: ui/preferences-window.ui:64
|
||||
msgid "Volume percentage"
|
||||
msgstr ""
|
||||
msgstr "Percentagem de volume"
|
||||
|
||||
#: ui/preferences-window.ui:75
|
||||
msgid "Seeking"
|
||||
msgstr ""
|
||||
msgstr "Procurando"
|
||||
|
||||
#: ui/preferences-window.ui:78
|
||||
msgid "Mode"
|
||||
msgstr ""
|
||||
msgstr "Modo"
|
||||
|
||||
#: ui/preferences-window.ui:84
|
||||
msgid "Accurate"
|
||||
msgstr ""
|
||||
msgstr "Preciso"
|
||||
|
||||
#: ui/preferences-window.ui:85
|
||||
msgid "Fast"
|
||||
msgstr ""
|
||||
msgstr "Rápido"
|
||||
|
||||
#: ui/preferences-window.ui:93
|
||||
msgid "Unit"
|
||||
msgstr ""
|
||||
msgstr "Unidade"
|
||||
|
||||
#: ui/preferences-window.ui:98
|
||||
msgid "Second"
|
||||
msgstr ""
|
||||
msgstr "Segundo"
|
||||
|
||||
#: ui/preferences-window.ui:99
|
||||
msgid "Minute"
|
||||
msgstr ""
|
||||
msgstr "Minuto"
|
||||
|
||||
#: ui/preferences-window.ui:100
|
||||
msgid "Percentage"
|
||||
msgstr ""
|
||||
msgstr "Percentagem"
|
||||
|
||||
#: ui/preferences-window.ui:108
|
||||
msgid "Value"
|
||||
msgstr ""
|
||||
msgstr "Valor"
|
||||
|
||||
#: ui/preferences-window.ui:123
|
||||
msgid "Audio"
|
||||
msgstr ""
|
||||
msgstr "Áudio"
|
||||
|
||||
#: ui/preferences-window.ui:126
|
||||
msgid "Offset in milliseconds"
|
||||
msgstr ""
|
||||
msgstr "Deslocamento em milissegundos"
|
||||
|
||||
#: ui/preferences-window.ui:133
|
||||
msgid "Only native audio formats"
|
||||
msgstr ""
|
||||
msgstr "Apenas formatos de áudio nativos"
|
||||
|
||||
#: ui/preferences-window.ui:141
|
||||
msgid "Subtitles"
|
||||
msgstr ""
|
||||
msgstr "Legendas"
|
||||
|
||||
#: ui/preferences-window.ui:144
|
||||
msgid "Default font"
|
||||
msgstr ""
|
||||
msgstr "Tipo de letra predefinida"
|
||||
|
||||
#: ui/preferences-window.ui:154
|
||||
msgid "Network"
|
||||
msgstr ""
|
||||
msgstr "Rede"
|
||||
|
||||
#: ui/preferences-window.ui:158
|
||||
msgid "Client"
|
||||
msgstr ""
|
||||
msgstr "Cliente"
|
||||
|
||||
#: ui/preferences-window.ui:161
|
||||
msgid "Progressive download buffering"
|
||||
msgstr ""
|
||||
msgstr "Buffering de transferência progressiva"
|
||||
|
||||
#: ui/preferences-window.ui:169
|
||||
msgid "Server"
|
||||
msgstr ""
|
||||
msgstr "Servidor"
|
||||
|
||||
#: ui/preferences-window.ui:172
|
||||
msgid "Control player remotely"
|
||||
msgstr ""
|
||||
msgstr "Controlar reprodutor remotamente"
|
||||
|
||||
#: ui/preferences-window.ui:176
|
||||
msgid "Listening port"
|
||||
msgstr ""
|
||||
msgstr "Porta de escuta"
|
||||
|
||||
#: ui/preferences-window.ui:183
|
||||
msgid "Run web application in background"
|
||||
msgstr ""
|
||||
msgstr "Executar aplicação web em segundo plano"
|
||||
|
||||
#: ui/preferences-window.ui:184
|
||||
msgid "Requires GTK compiled with Broadway backend"
|
||||
msgstr ""
|
||||
msgstr "Requer GTK compilado com backend Broadway"
|
||||
|
||||
#: ui/preferences-window.ui:190
|
||||
msgid "Web application port"
|
||||
msgstr ""
|
||||
msgstr "Porta de aplicação Web"
|
||||
|
||||
#: ui/preferences-window.ui:204
|
||||
msgid "Prefer adaptive streaming"
|
||||
msgstr ""
|
||||
msgstr "Preferir transmissão adaptável"
|
||||
|
||||
#: ui/preferences-window.ui:210
|
||||
msgid "Max quality"
|
||||
msgstr ""
|
||||
msgstr "Qualidade máxima"
|
||||
|
||||
#: ui/preferences-window.ui:228
|
||||
msgid "Tweaks"
|
||||
msgstr ""
|
||||
msgstr "Ajustes"
|
||||
|
||||
#: ui/preferences-window.ui:232
|
||||
msgid "Appearance"
|
||||
msgstr ""
|
||||
msgstr "Aparência"
|
||||
|
||||
#: ui/preferences-window.ui:235
|
||||
msgid "Dark theme"
|
||||
msgstr ""
|
||||
msgstr "Tema escuro"
|
||||
|
||||
#: ui/preferences-window.ui:241
|
||||
msgid "Render window shadows"
|
||||
msgstr ""
|
||||
msgstr "Renderizar sombras das janelas"
|
||||
|
||||
#: ui/preferences-window.ui:242
|
||||
msgid "Disable to increase performance when windowed"
|
||||
msgstr ""
|
||||
msgstr "Desativar para aumentar o desempenho quando em janela"
|
||||
|
||||
#: ui/preferences-window.ui:253
|
||||
msgid "Plugin ranking"
|
||||
msgstr ""
|
||||
msgstr "Classificação do plugin"
|
||||
|
||||
#: ui/preferences-window.ui:254
|
||||
msgid "Alter default ranks of GStreamer plugins"
|
||||
msgstr ""
|
||||
msgstr "Altera as classificações predefinidas dos plugins GStreamer"
|
||||
|
||||
#: ui/preferences-window.ui:259
|
||||
msgid "Use playbin3"
|
||||
msgstr ""
|
||||
msgstr "Usar playbin3"
|
||||
|
||||
#: ui/preferences-window.ui:260 ui/preferences-window.ui:269
|
||||
msgid "Requires player restart"
|
||||
msgstr ""
|
||||
msgstr "Requer o reinício do reprodutor"
|
||||
|
||||
#: ui/preferences-window.ui:262 ui/preferences-window.ui:271
|
||||
msgid "Experimental"
|
||||
msgstr ""
|
||||
msgstr "Experimental"
|
||||
|
||||
#: ui/preferences-window.ui:268
|
||||
msgid "Use PipeWire for audio output"
|
||||
msgstr ""
|
||||
msgstr "Usar o PipeWire para a saída áudio"
|
||||
|
||||
#: src/buttons.js:201
|
||||
#, javascript-format
|
||||
msgid "Decoder: %s"
|
||||
msgstr ""
|
||||
msgstr "Descodificador: %s"
|
||||
|
||||
#: src/dialogs.js:152
|
||||
msgid "Enter or drop URI here"
|
||||
msgstr ""
|
||||
msgstr "Introduzir ou largar o URI aqui"
|
||||
|
||||
#: src/dialogs.js:157
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: src/dialogs.js:158
|
||||
msgid "Open"
|
||||
msgstr ""
|
||||
msgstr "Abrir"
|
||||
|
||||
#: src/dialogs.js:226
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
msgstr "Título"
|
||||
|
||||
#: src/dialogs.js:227
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
msgstr "Concluído"
|
||||
|
||||
#: src/dialogs.js:235
|
||||
msgid "Resume playback?"
|
||||
msgstr ""
|
||||
msgstr "Retomar a reprodução?"
|
||||
|
||||
#: src/dialogs.js:289
|
||||
#, javascript-format
|
||||
msgid "GTK version: %s"
|
||||
msgstr ""
|
||||
msgstr "Versão do GTK: %s"
|
||||
|
||||
#: src/dialogs.js:290
|
||||
#, javascript-format
|
||||
msgid "Adwaita version: %s"
|
||||
msgstr ""
|
||||
msgstr "Versão do Adwaita: %s"
|
||||
|
||||
#: src/dialogs.js:291
|
||||
#, javascript-format
|
||||
msgid "GStreamer version: %s"
|
||||
msgstr ""
|
||||
msgstr "Versão do GStreamer: %s"
|
||||
|
||||
#: src/dialogs.js:292
|
||||
#, javascript-format
|
||||
msgid "GJS version: %s"
|
||||
msgstr ""
|
||||
msgstr "Versão do GJS: %s"
|
||||
|
||||
#: src/dialogs.js:300
|
||||
msgid "A GNOME media player powered by GStreamer"
|
||||
msgstr ""
|
||||
msgstr "Um reprodutor multimédia GNOME desenvolvido por GStreamer"
|
||||
|
||||
#. TRANSLATORS: Put your name(s) here for credits or leave untranslated
|
||||
#: src/dialogs.js:305
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
msgstr "Hugo Carvalho <hugokarvalho@hotmail.com>"
|
||||
|
||||
#: src/revealers.js:170
|
||||
#, javascript-format
|
||||
msgid "Ends at: %s"
|
||||
msgstr ""
|
||||
msgstr "Termina às: %s"
|
||||
|
||||
#: src/widget.js:227 src/widget.js:236 src/widget.js:242 src/widget.js:248
|
||||
msgid "Undetermined"
|
||||
msgstr ""
|
||||
msgstr "Indeterminado"
|
||||
|
||||
#: src/widget.js:243
|
||||
msgid "Channels"
|
||||
msgstr ""
|
||||
msgstr "Canais"
|
||||
|
||||
#: src/widget.js:261
|
||||
msgid "Disabled"
|
||||
msgstr ""
|
||||
msgstr "Desativado"
|
||||
|
||||
|
88
po/tr.po
88
po/tr.po
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: clapper\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-09-14 16:35+0200\n"
|
||||
"PO-Revision-Date: 2021-09-14 15:24\n"
|
||||
"PO-Revision-Date: 2022-04-02 01:43\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Turkish\n"
|
||||
"Language: tr_TR\n"
|
||||
@@ -19,176 +19,176 @@ msgstr ""
|
||||
|
||||
#: ui/clapper.ui:6
|
||||
msgid "Open Files…"
|
||||
msgstr ""
|
||||
msgstr "Dosya Aç…"
|
||||
|
||||
#: ui/clapper.ui:10
|
||||
msgid "Open URI…"
|
||||
msgstr ""
|
||||
msgstr "URL Aç…"
|
||||
|
||||
#: ui/clapper.ui:16 ui/preferences-window.ui:4
|
||||
msgid "Preferences"
|
||||
msgstr ""
|
||||
msgstr "Tercihler"
|
||||
|
||||
#: ui/clapper.ui:20
|
||||
msgid "Shortcuts"
|
||||
msgstr ""
|
||||
msgstr "Kısayollar"
|
||||
|
||||
#: ui/clapper.ui:26
|
||||
msgid "About Clapper"
|
||||
msgstr ""
|
||||
msgstr "Clapper Hakkında"
|
||||
|
||||
#: ui/elapsed-time-button.ui:27
|
||||
msgid "Speed"
|
||||
msgstr ""
|
||||
msgstr "Hız"
|
||||
|
||||
#: ui/elapsed-time-button.ui:41 ui/preferences-window.ui:83
|
||||
#: ui/preferences-window.ui:215
|
||||
msgid "Normal"
|
||||
msgstr ""
|
||||
msgstr "Normal"
|
||||
|
||||
#: ui/help-overlay.ui:10 ui/preferences-window.ui:12
|
||||
msgid "General"
|
||||
msgstr ""
|
||||
msgstr "Genel"
|
||||
|
||||
#: ui/help-overlay.ui:13
|
||||
msgid "Show shortcuts"
|
||||
msgstr ""
|
||||
msgstr "Kısayolları göster"
|
||||
|
||||
#: ui/help-overlay.ui:19
|
||||
msgid "Toggle fullscreen"
|
||||
msgstr ""
|
||||
msgstr "Tam ekran"
|
||||
|
||||
#: ui/help-overlay.ui:20
|
||||
msgid "Double tap | Double click"
|
||||
msgstr ""
|
||||
msgstr "Çift dokun | Çift tıkla"
|
||||
|
||||
#: ui/help-overlay.ui:26
|
||||
msgid "Leave fullscreen"
|
||||
msgstr ""
|
||||
msgstr "Tam ekrandan çık"
|
||||
|
||||
#: ui/help-overlay.ui:32
|
||||
msgid "Reveal OSD (fullscreen only)"
|
||||
msgstr ""
|
||||
msgstr "Pencere Düğmelerini Göster (yalnızca tam ekran)"
|
||||
|
||||
#: ui/help-overlay.ui:33
|
||||
msgid "Tap"
|
||||
msgstr ""
|
||||
msgstr "Dokun"
|
||||
|
||||
#: ui/help-overlay.ui:39
|
||||
msgid "Quit"
|
||||
msgstr ""
|
||||
msgstr "Çık"
|
||||
|
||||
#: ui/help-overlay.ui:47
|
||||
msgid "Media"
|
||||
msgstr ""
|
||||
msgstr "Ortam"
|
||||
|
||||
#: ui/help-overlay.ui:50
|
||||
msgid "Open files"
|
||||
msgstr ""
|
||||
msgstr "Dosyaları Aç"
|
||||
|
||||
#: ui/help-overlay.ui:56 src/dialogs.js:137
|
||||
msgid "Open URI"
|
||||
msgstr ""
|
||||
msgstr "URL Aç"
|
||||
|
||||
#: ui/help-overlay.ui:64
|
||||
msgid "Playlist"
|
||||
msgstr ""
|
||||
msgstr "Oynatma listesi"
|
||||
|
||||
#: ui/help-overlay.ui:67
|
||||
msgid "Next item"
|
||||
msgstr ""
|
||||
msgstr "Sonraki öğe"
|
||||
|
||||
#: ui/help-overlay.ui:68
|
||||
msgid "Double tap (right side)"
|
||||
msgstr ""
|
||||
msgstr "Çift tıkla (sağ tarafa)"
|
||||
|
||||
#: ui/help-overlay.ui:74
|
||||
msgid "Previous item"
|
||||
msgstr ""
|
||||
msgstr "Önceki öğe"
|
||||
|
||||
#: ui/help-overlay.ui:75
|
||||
msgid "Double tap (left side)"
|
||||
msgstr ""
|
||||
msgstr "Çift tıkla (sol tarafa)"
|
||||
|
||||
#: ui/help-overlay.ui:81
|
||||
msgid "Change repeat mode"
|
||||
msgstr ""
|
||||
msgstr "Tekrarlı oynatma modunu değiştir"
|
||||
|
||||
#: ui/help-overlay.ui:87
|
||||
msgid "Export to file"
|
||||
msgstr ""
|
||||
msgstr "Dosyaya aktar"
|
||||
|
||||
#: ui/help-overlay.ui:95 ui/preferences-window.ui:119
|
||||
msgid "Playback"
|
||||
msgstr ""
|
||||
msgstr "Oynatma"
|
||||
|
||||
#: ui/help-overlay.ui:98
|
||||
msgid "Toggle play"
|
||||
msgstr ""
|
||||
msgstr "Oynatmayı başlat"
|
||||
|
||||
#: ui/help-overlay.ui:99
|
||||
msgid "Long press | Right click"
|
||||
msgstr ""
|
||||
msgstr "Uzun bas | Sağ tıkla"
|
||||
|
||||
#: ui/help-overlay.ui:105
|
||||
msgid "Seek forward"
|
||||
msgstr ""
|
||||
msgstr "İleri sar"
|
||||
|
||||
#: ui/help-overlay.ui:106
|
||||
msgid "Swipe right | Scroll right"
|
||||
msgstr ""
|
||||
msgstr "Sağa sürükle | Sağa kaydır"
|
||||
|
||||
#: ui/help-overlay.ui:112
|
||||
msgid "Seek backward"
|
||||
msgstr ""
|
||||
msgstr "Geri sar"
|
||||
|
||||
#: ui/help-overlay.ui:113
|
||||
msgid "Swipe left | Scroll left"
|
||||
msgstr ""
|
||||
msgstr "Sola sürükle | Sola kaydır"
|
||||
|
||||
#: ui/help-overlay.ui:119
|
||||
msgid "Volume up"
|
||||
msgstr ""
|
||||
msgstr "Sesi artır"
|
||||
|
||||
#: ui/help-overlay.ui:120
|
||||
msgid "Swipe up | Scroll up"
|
||||
msgstr ""
|
||||
msgstr "Yukarı sürükle | Yukarı kaydır"
|
||||
|
||||
#: ui/help-overlay.ui:126
|
||||
msgid "Volume down"
|
||||
msgstr ""
|
||||
msgstr "Sesi kıs"
|
||||
|
||||
#: ui/help-overlay.ui:127
|
||||
msgid "Swipe down | Scroll down"
|
||||
msgstr ""
|
||||
msgstr "Aşağı sürükle | Aşağı kaydır"
|
||||
|
||||
#: ui/help-overlay.ui:133
|
||||
msgid "Toggle mute"
|
||||
msgstr ""
|
||||
msgstr "Sesi kapat"
|
||||
|
||||
#: ui/help-overlay.ui:139
|
||||
msgid "Next chapter"
|
||||
msgstr ""
|
||||
msgstr "Sonraki parça"
|
||||
|
||||
#: ui/help-overlay.ui:145
|
||||
msgid "Previous chapter"
|
||||
msgstr ""
|
||||
msgstr "Önceki parça"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:11
|
||||
msgid "Decoders"
|
||||
msgstr ""
|
||||
msgstr "Çözücüler"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:18
|
||||
msgid "Return to the preferences"
|
||||
msgstr ""
|
||||
msgstr "Tercihlere geri dön"
|
||||
|
||||
#: ui/preferences-window.ui:16
|
||||
msgid "Behavior"
|
||||
msgstr ""
|
||||
msgstr "Davranış"
|
||||
|
||||
#: ui/preferences-window.ui:19
|
||||
msgid "Auto fullscreen"
|
||||
msgstr ""
|
||||
msgstr "Otomatik tam ekran"
|
||||
|
||||
#: ui/preferences-window.ui:20
|
||||
msgid "Enter fullscreen when playlist is replaced except floating mode"
|
||||
|
18
po/zh_CN.po
18
po/zh_CN.po
@@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: clapper\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-09-14 16:35+0200\n"
|
||||
"PO-Revision-Date: 2022-01-16 14:15\n"
|
||||
"PO-Revision-Date: 2022-04-20 18:10\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Chinese Simplified\n"
|
||||
"Language: zh_CN\n"
|
||||
@@ -52,11 +52,11 @@ msgstr "常规"
|
||||
|
||||
#: ui/help-overlay.ui:13
|
||||
msgid "Show shortcuts"
|
||||
msgstr ""
|
||||
msgstr "显示快捷键"
|
||||
|
||||
#: ui/help-overlay.ui:19
|
||||
msgid "Toggle fullscreen"
|
||||
msgstr ""
|
||||
msgstr "切换全屏"
|
||||
|
||||
#: ui/help-overlay.ui:20
|
||||
msgid "Double tap | Double click"
|
||||
@@ -116,11 +116,11 @@ msgstr "更改循环模式"
|
||||
|
||||
#: ui/help-overlay.ui:87
|
||||
msgid "Export to file"
|
||||
msgstr ""
|
||||
msgstr "导出至文件"
|
||||
|
||||
#: ui/help-overlay.ui:95 ui/preferences-window.ui:119
|
||||
msgid "Playback"
|
||||
msgstr ""
|
||||
msgstr "播放"
|
||||
|
||||
#: ui/help-overlay.ui:98
|
||||
msgid "Toggle play"
|
||||
@@ -164,7 +164,7 @@ msgstr "向下滑动 | 向下滚动"
|
||||
|
||||
#: ui/help-overlay.ui:133
|
||||
msgid "Toggle mute"
|
||||
msgstr ""
|
||||
msgstr "切换静音"
|
||||
|
||||
#: ui/help-overlay.ui:139
|
||||
msgid "Next chapter"
|
||||
@@ -180,7 +180,7 @@ msgstr "解码器"
|
||||
|
||||
#: ui/preferences-plugin-ranking-subpage.ui:18
|
||||
msgid "Return to the preferences"
|
||||
msgstr ""
|
||||
msgstr "返回首选项"
|
||||
|
||||
#: ui/preferences-window.ui:16
|
||||
msgid "Behavior"
|
||||
@@ -340,7 +340,7 @@ msgstr ""
|
||||
|
||||
#: ui/preferences-window.ui:228
|
||||
msgid "Tweaks"
|
||||
msgstr "微调"
|
||||
msgstr "调整"
|
||||
|
||||
#: ui/preferences-window.ui:232
|
||||
msgid "Appearance"
|
||||
@@ -438,7 +438,7 @@ msgstr ""
|
||||
#. TRANSLATORS: Put your name(s) here for credits or leave untranslated
|
||||
#: src/dialogs.js:305
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
msgstr "刘韬"
|
||||
|
||||
#: src/revealers.js:170
|
||||
#, javascript-format
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const { Adw, Gdk, Gio, GObject, Gst, GstClapper, Gtk } = imports.gi;
|
||||
const { Adw, Gdk, Gio, GLib, GObject, Gst, GstClapper, Gtk } = imports.gi;
|
||||
const ByteArray = imports.byteArray;
|
||||
const Debug = imports.src.debug;
|
||||
const Misc = imports.src.misc;
|
||||
@@ -16,14 +16,28 @@ class ClapperPlayer extends GstClapper.Clapper
|
||||
{
|
||||
_init()
|
||||
{
|
||||
const gtk4plugin = new GstClapper.ClapperGtk4Plugin();
|
||||
const glsinkbin = Gst.ElementFactory.make('glsinkbin', null);
|
||||
glsinkbin.sink = gtk4plugin.video_sink;
|
||||
let vsink = null;
|
||||
const use_legacy_sink = GLib.getenv('CLAPPER_USE_LEGACY_SINK');
|
||||
|
||||
if(!use_legacy_sink || use_legacy_sink != '1') {
|
||||
vsink = Gst.ElementFactory.make('clappersink', null);
|
||||
this.clappersink = vsink;
|
||||
}
|
||||
|
||||
if(!vsink) {
|
||||
vsink = Gst.ElementFactory.make('glsinkbin', null);
|
||||
const gtk4plugin = new GstClapper.ClapperGtk4Plugin();
|
||||
|
||||
warn('using legacy video sink');
|
||||
|
||||
this.clappersink = gtk4plugin.video_sink;
|
||||
vsink.sink = this.clappersink;
|
||||
}
|
||||
|
||||
super._init({
|
||||
signal_dispatcher: new GstClapper.ClapperGMainContextSignalDispatcher(),
|
||||
video_renderer: new GstClapper.ClapperVideoOverlayVideoRenderer({
|
||||
video_sink: glsinkbin,
|
||||
video_sink: vsink,
|
||||
}),
|
||||
mpris: new GstClapper.ClapperMpris({
|
||||
own_name: `org.mpris.MediaPlayer2.${Misc.appName}`,
|
||||
@@ -36,7 +50,7 @@ class ClapperPlayer extends GstClapper.Clapper
|
||||
use_pipewire: settings.get_boolean('use-pipewire'),
|
||||
});
|
||||
|
||||
this.widget = gtk4plugin.video_sink.widget;
|
||||
this.widget = this.clappersink.widget;
|
||||
this.widget.add_css_class('videowidget');
|
||||
|
||||
this.visualization_enabled = false;
|
||||
@@ -615,7 +629,7 @@ class ClapperPlayer extends GstClapper.Clapper
|
||||
|
||||
switch(key) {
|
||||
case 'after-playback':
|
||||
this.widget.keep_last_frame = (settings.get_int(key) === 1);
|
||||
this.clappersink.keep_last_frame = (settings.get_int(key) === 1);
|
||||
break;
|
||||
case 'seeking-mode':
|
||||
switch(settings.get_int(key)) {
|
||||
|
@@ -345,7 +345,8 @@ class ClapperWidget extends Gtk.Grid
|
||||
|
||||
const currTime = GLib.DateTime.new_now_local();
|
||||
const endTime = currTime.add_seconds(
|
||||
this.controls.positionAdjustment.get_upper() - this.controls.currentPosition
|
||||
(this.controls.positionAdjustment.get_upper() - this.controls.currentPosition)
|
||||
/ this.controls.elapsedButton.speedScale.get_value()
|
||||
);
|
||||
const nextUpdate = this.revealerTop.setTimes(currTime, endTime, this.isSeekable);
|
||||
|
||||
|
Reference in New Issue
Block a user