Compare commits

...

23 Commits

Author SHA1 Message Date
0ec8b77554 pve 2025-10-24 05:26:42 +02:00
b6196c1d46 pve, pygl 2025-10-21 13:18:23 +02:00
fff635f5c2 pve, pygl 2025-10-21 11:08:13 +02:00
be3b56856d pyui 2025-10-18 05:47:01 +02:00
e803956d75 cleanup 2025-10-12 04:11:18 +02:00
d8ff18387f gl canvas and context 2025-10-12 03:31:39 +02:00
26fbdce569 ui 2025-10-10 05:47:12 +02:00
6b5d7de5b2 cleanup 2025-10-04 18:13:23 +02:00
639a20bca9 decoder multithreading 2025-10-04 17:39:37 +02:00
04448df101 codec struct 2025-10-04 14:52:27 +02:00
e0124c0ff3 test 2025-10-04 14:22:39 +02:00
7e14afcb84 cleanup 2025-10-04 14:22:11 +02:00
7ea498edc8 build scripts 2025-10-04 13:51:41 +02:00
2b4ece9bee build scripts 2025-10-04 12:58:55 +02:00
8929fc9bac remove x265 2025-10-04 12:43:40 +02:00
83029fbc44 configure and build scripts for ffmpeg 2025-10-04 10:53:14 +02:00
6fd5286b15 configure and build scripts for x264 and x265 2025-10-04 09:14:51 +02:00
fb07373122 shallow submodules 2025-10-04 05:13:44 +02:00
51fa25809d add x265 submodule 2025-10-04 04:54:22 +02:00
de6c3a4e7f x264 submodule 2025-10-04 04:52:37 +02:00
2ed4c7b6d8 ffmpeg submodule 2025-10-04 04:33:40 +02:00
4afaf287bb avframe fields 2025-10-04 04:27:51 +02:00
5825c67f30 cleanup 2025-10-04 04:27:24 +02:00
38 changed files with 2525 additions and 52 deletions

5
.gitignore vendored
View File

@ -6,10 +6,11 @@ __pycache__/
# C extensions
*.so
*.so.*
# Distribution / packaging
.Python
build/
/build/
develop-eggs/
dist/
downloads/
@ -173,4 +174,6 @@ cython_debug/
# PyPI configuration file
.pypirc
# PVE
/test.mp4

10
.gitmodules vendored Normal file
View File

@ -0,0 +1,10 @@
[submodule "ffmpeg"]
path = ffmpeg
url = https://git.ffmpeg.org/ffmpeg.git
branch = release/8.0
shallow = true
[submodule "codecs/x264"]
path = codecs/x264
url = https://code.videolan.org/videolan/x264.git
branch = stable
shallow = true

1
codecs/x264 Submodule

Submodule codecs/x264 added at b35605ace3

1
ffmpeg Submodule

Submodule ffmpeg added at d8605a6b55

63
make/configure-ffmpeg.sh Executable file
View File

@ -0,0 +1,63 @@
#!/bin/sh
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
source_directory="ffmpeg"
include_directory="build/include"
lib_directory="build/lib"
build_directory="build/${source_directory}"
install_directory="build"
install_library_directory="pyav/libav"
mkdir -p ${build_directory}
mkdir -p ${install_directory}
absolute_source_directory=$(realpath ${source_directory})
absolute_include_directory=$(realpath ${include_directory})
absolute_lib_directory=$(realpath ${lib_directory})
absolute_build_directory=$(realpath ${build_directory})
absolute_install_directory=$(realpath ${install_directory})
absolute_install_library_directory=$(realpath ${install_library_directory})
cd "${absolute_build_directory}"
PKG_CONFIG_PATH="${absolute_lib_directory}/pkgconfig" \
${absolute_source_directory}/configure \
--prefix=${absolute_install_directory} \
--pkg-config-flags="--static" \
--extra-libs="-lpthread -lm" \
--extra-cflags="-I${absolute_include_directory}" \
--extra-ldflags="-L${absolute_lib_directory}" \
--disable-static \
--enable-shared \
--enable-rpath \
--shlibdir=${absolute_install_library_directory} \
--disable-programs \
--disable-avdevice \
--disable-avfilter \
--disable-swresample \
--disable-swscale \
--disable-network \
--disable-manpages \
--disable-podpages \
--disable-txtpages \
--enable-gpl \
--enable-libx264 \
--disable-xlib \
--disable-libxcb \
--disable-libxcb-shm \
--disable-alsa \
--disable-iconv

44
make/configure-x264.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
source_directory="codecs/x264"
build_directory="build/${source_directory}"
install_directory="build"
mkdir -p ${build_directory}
mkdir -p ${install_directory}
absolute_source_directory=$(realpath ${source_directory})
absolute_build_directory=$(realpath ${build_directory})
absolute_install_directory=$(realpath ${install_directory})
cd "${absolute_build_directory}"
${absolute_source_directory}/configure \
--prefix=${absolute_install_directory} \
--disable-cli \
--enable-static \
--enable-shared \
--disable-bashcompletion \
--bit-depth=all \
--chroma-format=all \
--enable-lto \
--disable-avs \
--disable-swscale \
--disable-lavf \
--disable-ffms \
--disable-gpac \
--disable-lsmash

19
make/make-all.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
./make/make-x264.sh
./make/make-ffmpeg.sh

26
make/make-ffmpeg.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
source_directory="ffmpeg"
build_directory="build/${source_directory}"
if ! [ -d ${build_directory} ] ; then
./make/configure-ffmpeg.sh || exit 1
fi
cd ${build_directory}
make && make install

26
make/make-x264.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
source_directory="codecs/x264"
build_directory="build/${source_directory}"
if ! [ -d ${build_directory} ] ; then
./make/configure-x264.sh || exit 1
fi
cd ${build_directory}
make && make install

100
pve/node.py Normal file
View File

@ -0,0 +1,100 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from weakref import ref
class Node:
__slots__ = 'parent', 'children', 'state', '__weakref__'
STATE_NEW = 0
STATE_MODIFIED = 1
STATE_BUILT = 2
def __init__(self, parent = None, children = None):
self.parent = None
self.children = None
self.state = Node.STATE_NEW
if children is not None:
self.add_children(children)
if parent is not None:
parent.add_child(self)
def __del__(self):
if self.parent is not None:
self.parent().remove_child(self)
def add_child(self, child: Node):
assert child.parent is None
child.parent = ref(self)
if self.children is None:
self.children = [child]
else:
self.children.append(child)
child.state = Node.STATE_NEW
self.set_modified()
def add_children(self, children):
for child in children:
self.add_child(child)
def remove_child(self, child: Node):
assert child.parent is self
child.parent = None
self.children.remove(child)
self.set_modified()
def remove_children(self, children):
for child in children:
self.remove_child(child)
def is_new(self):
return self.state == Node.STATE_NEW
def needs_rebuilding(self):
return self.state != Node.STATE_BUILT
def set_modified(self):
if self.needs_rebuilding():
return
self.state = Node.STATE_MODIFIED
if self.parent is not None:
self.set_parent_modified(self.parent())
def set_parent_modified(self, parent):
parent.set_modified()
def rebuild(self):
if not self.needs_rebuilding():
return True
if self.children is not None:
if not self.rebuild_children(self.children):
return False
if not self.build():
return False
self.state = Node.STATE_BUILT
return True
def rebuild_children(self, children):
for child in children:
if not self.rebuild_child(child):
return False
return True
def rebuild_child(self, child):
return child.rebuild()
def build(self):
return True

131
pve/pixmap.py Normal file
View File

@ -0,0 +1,131 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from fractions import Fraction
class Geometry:
__slots__ = '_width', '_height', '_ratio', '_size'
def __init__(self, width = 0, height = 0, ratio = None):
if width > 0 and height > 0:
assert ratio is None
self._width = width
self._height = height
self._ratio = Fraction(width, height).limit_denominator()
self._size = width * height
elif width > 0 and ratio:
self._width = width
self._height = round((width * ratio.numerator) / ratio.denominator)
self._ratio = ratio
self._size = width * self._height
elif height > 0 and ratio:
self._width = round((height * ratio.denominator) / ratio.numerator)
self._height = height
self._ratio = ratio
self._size = self._width * height
else:
raise ValueError
def __ge__(self, other):
return (self._width >= other._width and self._height >= other._height)
@property
def width(self):
return self._width
@property
def height(self):
return self._height
@property
def ratio(self):
return self._ratio
class Format:
__slots__ = '_channels', '_depth', '_type', '_size'
def __init__(self, channels, depth):
self._channels = channels
self._depth = depth
if depth == 8:
self._type = 'B'
self._size = channels
elif depth == 16:
self._type = 'H'
self._size = channels * 2
else:
raise ValueError
def __eq__(self, other):
return (self._channels == other._channels and self._depth == other._depth)
@property
def channels(self):
return self._channels
@property
def depth(self):
return self._depth
class Pixmap:
__slots__ = '_geometry', '_format', '_line_size', '_bytes', '_view'
def __init__(self, geometry, format):
self._geometry = geometry
self._format = format
self._line_size = geometry._width * format._size
self._bytes = bytearray(geometry._size * format._size)
self._view = memoryview(self._bytes)
def __del__(self):
del self._view
del self._bytes
@property
def geometry(self):
return self._geometry
@property
def width(self):
return self._geometry._width
@property
def height(self):
return self._geometry._height
@property
def ratio(self):
return self._geometry._ratio
@property
def format(self):
return self._format
@property
def channels(self):
return self._format._channels
@property
def depth(self):
return self._format._depth
@property
def line_size(self):
return self._line_size
@property
def view(self):
return self._view

107
pve/polygon.py Normal file
View File

@ -0,0 +1,107 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from array import array
from .node import Node
from .vector import Vector2
class Point:
__slots__ = 'position', 'mapping'
def __init__(self, xy = Vector2(), uv = Vector2()):
assert isinstance(xy, Vector2) and isinstance(uv, Vector2)
self.position = xy
self.mapping = uv
class Polygon(Node):
__slots__ = '_positions', '_mappings', '_len'
@classmethod
def rectangle(cls, geometry):
tl = Vector2(0.0, 0.0)
tr = Vector2(geometry._width, 0.0)
br = Vector2(geometry._width, geometry._height)
bl = Vector2(0.0, geometry._height)
return cls(points = (
Point(tl, tl),
Point(tr, tr),
Point(br, br),
Point(bl, bl)))
def __init__(self, parent = None, children = None, size = 0, points = None):
Node.__init__(self, parent, children)
self.clear_points()
self.add_points(size, points)
def __len__(self):
return self._len
def __getitem__(self, index):
begin = index * 2
end = begin + 2
return Point(
Vector2(*self._positions[begin:end]),
Vector2(*self._mappings[begin:end]))
def __setitem__(self, index, point):
begin = index * 2
end = begin + 2
self._positions[begin:end] = array(Vector2.TYPE, point.position)
self._mappings[begin:end] = array(Vector2.TYPE, point.mapping)
def add_child(self, child):
assert isinstance(child, Polygon)
Node.add_child(self, child)
def add_points(self, count = 0, points = None):
assert (count > 0) ^ len(points)
if count:
initializer = bytes(count * Vector2.SIZE)
self._positions.frombytes(initializer)
self._mappings.frombytes(initializer)
self._len += count
else:
for point in points:
self._positions.extend(point.position)
self._mappings.extend(point.mapping)
self._len += len(points)
def insert_points(self, index, count = 0, points = None):
assert (count == 0) ^ (points is None)
index *= 2
if count:
initializer = array(Vector2.TYPE, bytes(count * Vector2.SIZE))
self._positions[index:index] = initializer
self._mappings[index:index] = initializer
self._len += count
else:
polygon = Polygon(points = points)
self._positions[index:index] = polygon._positions
self._mappings[index:index] = polygon._mappings
self._len += polygon._len
def remove_points(self, index, count = 1):
begin = index * 2
end = begin + count * 2
del self._positions[begin:end]
del self._mappings[begin:end]
self._len -= count
def clear_points(self):
self._positions = array(Vector2.TYPE)
self._mappings = array(Vector2.TYPE)
self._len = 0

View File

@ -14,16 +14,13 @@
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
class Codec:
__slots__ = '_ref'
from .node import Node
def __init__(self, ref):
self._ref = ref
class Shape(Node):
@property
def _as_parameter_(self):
return self._ref
def __init__(self, parent = None, children = None):
Node.__init__(self, parent, children)
@property
def name(self):
return self._ref.contents.name.decode("utf-8")
def rebuild(self):
#TODO
raise NotImplementedError

29
pve/vector.py Normal file
View File

@ -0,0 +1,29 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
class Vector2:
__slots__ = 'x', 'y'
TYPE = 'f'
SIZE = 8
def __init__(self, x = 0.0, y = 0.0):
assert isinstance(x, float) and isinstance(y, float)
self.x = x
self.y = y
def __iter__(self):
return iter((self.x, self.y))

58
pve_editor.py Normal file
View File

@ -0,0 +1,58 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from pyui.application import Application
application = Application()
application.MainLoop()
# import multiprocessing
# import cProfile
#
# from pyav.demuxer import Demuxer
# from pyav.decoder import Decoder
#
# demuxer = Demuxer('test.mp4')
#
# print(f"nb_streams = {demuxer.nb_streams}")
# print(f"video codec = {demuxer.video_stream.codec.description()}")
# print(f"audio codec = {demuxer.audio_stream.codec.description()}")
#
# cpu_count = multiprocessing.cpu_count()
#
# print(f"using {cpu_count} threads for video decoding")
#
# video_decoder = Decoder(demuxer.video_stream, cpu_count)
# audio_decoder = Decoder(demuxer.audio_stream, 1)
#
# num_video_frames = 0
# num_audio_frames = 0
#
# with cProfile.Profile() as pr:
# while True:
# packet = demuxer.read_packet()
# eof = (packet is None)
# if eof or demuxer.video_stream.contains(packet):
# video_frames = video_decoder.decode(packet)
# num_video_frames += len(video_frames)
# if eof or demuxer.audio_stream.contains(packet):
# audio_frames = audio_decoder.decode(packet)
# num_audio_frames += len(audio_frames)
# if eof:
# break
#
# print(f"num video frames: {num_video_frames}, audio frames: {num_audio_frames}")
# pr.print_stats()

22
pve_editor.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
shared_library_path="./pyav/libav"
absolute_shared_library_path=$(realpath ${shared_library_path})
LD_LIBRARY_PATH=${absolute_shared_library_path} \
python3 pve_editor.py

15
pyav/__init__.py Normal file
View File

@ -0,0 +1,15 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.

View File

@ -14,26 +14,29 @@
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from mp4.demuxer import Demuxer
from mp4.decoder import Decoder
class Codec:
__slots__ = '_ref'
demuxer = Demuxer('test.mp4')
def __init__(self, ref):
self._ref = ref
print(f"nb_streams = {demuxer.nb_streams}")
print(f"video codec = {demuxer.video_stream.codec.name}")
print(f"audio codec = {demuxer.audio_stream.codec.name}")
@property
def _as_parameter_(self):
return self._ref
video_decoder = Decoder(demuxer.video_stream)
audio_decoder = Decoder(demuxer.audio_stream)
@property
def name(self):
return self._ref.contents.name.decode("utf-8")
while True:
packet = demuxer.read_packet()
eof = (packet is None)
if eof or demuxer.video_stream.contains(packet):
video_frames = video_decoder.decode(packet)
print(f"decoded {len(video_frames)} video frames")
if eof or demuxer.audio_stream.contains(packet):
audio_frames = audio_decoder.decode(packet)
print(f"decoded {len(audio_frames)} audio frames")
if eof:
break
@property
def long_name(self):
return self._ref.contents.long_name.decode("utf-8")
@property
def wrapper_name(self):
if self._ref.contents.wrapper_name is not None:
return self._ref.contents.wrapper_name.decode("utf-8")
return "<None>"
def description(self):
return f"{self.name} / {self.long_name} / {self.wrapper_name}"

View File

@ -21,7 +21,7 @@ from .frame import Frame
class Decoder:
__slots__ = '_context'
def __init__(self, stream):
def __init__(self, stream, thread_count):
self._context = libav.codec_alloc_context(stream.codec)
if not self._context:
raise MemoryError
@ -29,6 +29,9 @@ class Decoder:
if errcode < 0:
libav.codec_free_context(self._context)
raise Exception("Failed to set context parameters")
if thread_count > 1:
self._context.contents.thread_count = thread_count
self._context.contents.thread_type = libav.FF_THREAD_FRAME
errcode = libav.codec_open(self._context, stream.codec)
if errcode < 0:
libav.codec_free_context(self._context)
@ -38,7 +41,13 @@ class Decoder:
if self._context:
libav.codec_free_context(self._context)
def _receive(self):
def decode(self, packet):
if not self._context:
return None
errcode = libav.codec_send_packet(self._context, packet)
if errcode < 0:
errstring = libav.strerror(errcode)
raise Exception(f"Failed to send packet: {errstring}")
frames = []
while True:
frame = Frame()
@ -50,12 +59,3 @@ class Decoder:
raise Exception(f"Failed to receive frame: {errstring}")
frames.append(frame)
return frames
def decode(self, packet):
if not self._context:
return None
errcode = libav.codec_send_packet(self._context, packet)
if errcode < 0:
errstring = libav.strerror(errcode)
raise Exception(f"Failed to send packet: {errstring}")
return self._receive()

View File

@ -16,10 +16,17 @@
import errno
import ctypes
from pathlib import PurePath
_avutil = ctypes.cdll.LoadLibrary('libavutil.so')
_avformat = ctypes.cdll.LoadLibrary('libavformat.so')
_avcodec = ctypes.cdll.LoadLibrary('libavcodec.so')
shared_library_path = PurePath(__file__).parent
def load_shared_library(name):
path = str(shared_library_path / ("lib" + name + ".so"))
return ctypes.cdll.LoadLibrary(path)
_avutil = load_shared_library("avutil")
_avformat = load_shared_library("avformat")
_avcodec = load_shared_library("avcodec")
def _errtag(a, b, c, d):
return -(ord(a) | (ord(b) << 8) | (ord(c) << 16) | (ord(d) << 24))
@ -40,8 +47,35 @@ AVMEDIA_TYPE_DATA = 2
AVMEDIA_TYPE_SUBTITLE = 3
AVMEDIA_TYPE_ATTACHMENT = 4
AV_NUM_DATA_POINTERS = 8
FF_THREAD_FRAME = 1
FF_THREAD_SLICE = 2
c_uint8_p = ctypes.POINTER(ctypes.c_uint8)
c_uint8_pp = ctypes.POINTER(c_uint8_p)
class AVRational(ctypes.Structure):
_fields_ = [
("num", ctypes.c_int),
("den", ctypes.c_int)]
class AVFrame(ctypes.Structure):
pass
_fields_ = [
("data", c_uint8_p * AV_NUM_DATA_POINTERS),
("linesize", ctypes.c_int * AV_NUM_DATA_POINTERS),
("extended_data", c_uint8_pp),
("width", ctypes.c_int),
("height", ctypes.c_int),
("nb_samples", ctypes.c_int),
("format", ctypes.c_int),
("key_frame", ctypes.c_int),
("pict_type", ctypes.c_int),
("sample_aspect_ratio", AVRational),
("pts", ctypes.c_int64),
("pkt_dts", ctypes.c_int64),
("time_base", AVRational)]
# ...
AVFrame_p = ctypes.POINTER(AVFrame)
AVFrame_pp = ctypes.POINTER(AVFrame_p)
@ -51,11 +85,6 @@ class AVCodecParameters(ctypes.Structure):
AVCodecParameters_p = ctypes.POINTER(AVCodecParameters)
class AVRational(ctypes.Structure):
_fields_ = [
("num", ctypes.c_int),
("den", ctypes.c_int)]
class AVStream(ctypes.Structure):
_fields_ = [
("av_class", ctypes.c_void_p),
@ -100,14 +129,156 @@ AVPacket_pp = ctypes.POINTER(AVPacket_p)
class AVCodec(ctypes.Structure):
_fields_ = [
("name", ctypes.c_char_p),
("long_name", ctypes.c_char_p)]
("long_name", ctypes.c_char_p),
("type", ctypes.c_int), # AVMediaType
("id", ctypes.c_int), # AVCodecID
("capabilities", ctypes.c_int), # AV_CODEC_CAP_*
("max_lowres", ctypes.c_uint8),
("deprecated_supported_framerates", ctypes.c_void_p),
("deprecated_pix_fmts", ctypes.c_void_p),
("deprecated_supported_samplerates", ctypes.c_void_p),
("deprecated_sample_fmts", ctypes.c_void_p),
("priv_class", ctypes.c_void_p),
("profiles", ctypes.c_void_p), # AVProfile
("wrapper_name", ctypes.c_char_p)]
# ...
AVCodec_p = ctypes.POINTER(AVCodec)
AVCodec_pp = ctypes.POINTER(AVCodec_p)
class AVChannelLayout_u(ctypes.Union):
_fields_ = [
("mask", ctypes.c_uint64),
("map", ctypes.c_void_p)] # AVChannelCustom
class AVChannelLayout(ctypes.Structure):
_fields_ = [
("order", ctypes.c_int), # AVChannelOrder
("nb_channels", ctypes.c_int),
("u", AVChannelLayout_u),
("opaque", ctypes.c_void_p)]
class AVCodecContext(ctypes.Structure):
pass
_fields_ = [
("av_class", ctypes.c_void_p),
("log_level_offset", ctypes.c_int),
("codec_type", ctypes.c_int),
("codec", AVCodec_p),
("codec_id", ctypes.c_int),
("codec_tag", ctypes.c_uint),
("priv_data", ctypes.c_void_p),
("internal", ctypes.c_void_p), # AVCodecInternal
("opaque", ctypes.c_void_p),
("bit_rate", ctypes.c_int64),
("flags", ctypes.c_int),
("flags2", ctypes.c_int),
("extradata", ctypes.POINTER(ctypes.c_uint8)),
("extradata_size", ctypes.c_int),
("time_base", AVRational),
("pkt_timebase", AVRational),
("framerate", AVRational),
("delay", ctypes.c_int),
("width", ctypes.c_int),
("height", ctypes.c_int),
("coded_width", ctypes.c_int),
("coded_height", ctypes.c_int),
("sample_aspect_ratio", AVRational),
("pix_fmt", ctypes.c_int), # AVPixelFormat
("sw_pix_fmt", ctypes.c_int), # AVPixelFormat
("color_primaries", ctypes.c_int), # AVColorPrimaries
("color_trc", ctypes.c_int), # AVColorTransferCharacteristic
("colorspace", ctypes.c_int), # AVColorSpace
("color_range", ctypes.c_int), # AVColorRange
("chroma_sample_location", ctypes.c_int), # AVChromaLocation
("field_order", ctypes.c_int), # AVFieldOrder
("refs", ctypes.c_int),
("has_b_frames", ctypes.c_int),
("slice_flags", ctypes.c_int),
("draw_horiz_band", ctypes.c_void_p),
("get_format", ctypes.c_void_p),
("max_b_frames", ctypes.c_int),
("b_quant_factor", ctypes.c_float),
("b_quant_offset", ctypes.c_float),
("i_quant_factor", ctypes.c_float),
("i_quant_offset", ctypes.c_float),
("lumi_masking", ctypes.c_float),
("temporal_cplx_masking", ctypes.c_float),
("spatial_cplx_masking", ctypes.c_float),
("p_masking", ctypes.c_float),
("dark_masking", ctypes.c_float),
("nsse_weight", ctypes.c_int),
("me_cmp", ctypes.c_int),
("me_sub_cmp", ctypes.c_int),
("mb_cmp", ctypes.c_int),
("ildct_cmp", ctypes.c_int),
("dia_size", ctypes.c_int),
("last_predictor_count", ctypes.c_int),
("me_pre_cmp", ctypes.c_int),
("pre_dia_size", ctypes.c_int),
("me_subpel_quality", ctypes.c_int),
("me_range", ctypes.c_int),
("mb_decision", ctypes.c_int),
("intra_matrix", ctypes.POINTER(ctypes.c_uint16)),
("inter_matrix", ctypes.POINTER(ctypes.c_uint16)),
("chroma_intra_matrix", ctypes.POINTER(ctypes.c_uint16)),
("intra_dc_precision", ctypes.c_int),
("mb_lmin", ctypes.c_int),
("mb_lmax", ctypes.c_int),
("bidir_refine", ctypes.c_int),
("keyint_min", ctypes.c_int),
("gop_size", ctypes.c_int),
("mv0_threshold", ctypes.c_int),
("slices", ctypes.c_int),
("sample_rate", ctypes.c_int),
("sample_fmt", ctypes.c_int), # AVSampleFormat
("ch_layout", AVChannelLayout),
("frame_size", ctypes.c_int),
("block_align", ctypes.c_int),
("cutoff", ctypes.c_int),
("audio_service_type", ctypes.c_int), # AVAudioServiceType
("request_sample_fmt", ctypes.c_int), # AVSampleFormat
("initial_padding", ctypes.c_int),
("trailing_padding", ctypes.c_int),
("seek_preroll", ctypes.c_int),
("get_buffer2", ctypes.c_void_p),
("bit_rate_tolerance", ctypes.c_int),
("global_quality", ctypes.c_int),
("compression_level", ctypes.c_int),
("qcompress", ctypes.c_float),
("qblur", ctypes.c_float),
("qmin", ctypes.c_int),
("qmax", ctypes.c_int),
("max_qdiff", ctypes.c_int),
("rc_buffer_size", ctypes.c_int),
("rc_override_count", ctypes.c_int),
("rc_override", ctypes.c_void_p), # RcOverride
("rc_max_rate", ctypes.c_int64),
("rc_min_rate", ctypes.c_int64),
("rc_max_available_vbv_use", ctypes.c_float),
("rc_min_vbv_overflow_use", ctypes.c_float),
("rc_initial_buffer_occupancy", ctypes.c_int),
("trellis", ctypes.c_int),
("stats_out", ctypes.c_char_p),
("stats_in", ctypes.c_char_p),
("workaround_bugs", ctypes.c_int),
("strict_std_compliance", ctypes.c_int),
("error_concealment", ctypes.c_int),
("debug", ctypes.c_int),
("err_recognition", ctypes.c_int),
("hwaccel", ctypes.c_void_p), # AVHWAccel
("hwaccel_context", ctypes.c_void_p),
("hw_frames_ctx", ctypes.c_void_p), # AVBufferRef
("hw_device_ctx", ctypes.c_void_p), # AVBufferRef
("hwaccel_flags", ctypes.c_int),
("extra_hw_frames", ctypes.c_int),
("error", ctypes.c_uint64 * AV_NUM_DATA_POINTERS),
("dct_algo", ctypes.c_int),
("idct_algo", ctypes.c_int),
("bits_per_coded_sample", ctypes.c_int),
("bits_per_raw_sample", ctypes.c_int),
("thread_count", ctypes.c_int),
("thread_type", ctypes.c_int)]
# ...
AVCodecContext_p = ctypes.POINTER(AVCodecContext)
AVCodecContext_pp = ctypes.POINTER(AVCodecContext_p)

15
pygl/__init__.py Normal file
View File

@ -0,0 +1,15 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.

41
pygl/libgl/__init__.py Normal file
View File

@ -0,0 +1,41 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
import ctypes
Texture_p = ctypes.c_void_p
VertexBuffer_p = ctypes.c_void_p
def create_texture(width, height, channels, depth):
return None
def delete_texture(texture):
pass
def upload_texture(texture, view, line_size):
pass
def dowload_texture(texture, view, line_size):
pass
def create_vertex_buffer(size, channels, elems):
return None
def delete_vertex_buffer(buffer):
pass
def upload_vertex_buffer(buffer, views, size):
pass

66
pygl/texture.py Normal file
View File

@ -0,0 +1,66 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from . import libgl
class Texture:
__slots__ = '_geometry', '_format', '_texture'
def __init__(self, geometry, format):
self._geometry = geometry
self._format = format
self._texture = libgl.create_texture(geometry.width, geometry.height, format.channels, format.depth)
def __del__(self):
libgl.delete_texture(self._texture)
@property
def geometry(self):
return self._geometry
@property
def width(self):
return self._geometry._width
@property
def height(self):
return self._geometry._height
@property
def ratio(self):
return self._geometry._ratio
@property
def format(self):
return self._format
@property
def channels(self):
return self._format._channels
@property
def depth(self):
return self._format._depth
def upload(self, pixmap):
assert (self._format == pixmap.format)
assert (self._geometry >= pixmap.geometry)
return libgl.upload_texture(self._texture, pixmap.view, pixmap.line_size)
def download(self, pixmap):
assert (self._format == pixmap.format)
assert (self._geometry >= pixmap.geometry)
return libgl.upload_texture(self._texture, pixmap.view, pixmap.line_size)

35
pygl/vertexbuffer.py Normal file
View File

@ -0,0 +1,35 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from . import libgl
class VertexBuffer:
__slots__ = '_buffer', '_size'
def __init__(self, size, channels, elems):
self._buffer = libgl.create_vertex_buffer(size, channels, elems)
self._size = size
def __del__(self):
libgl.delete_vertex_buffer(self._buffer)
@property
def size(self):
return self._size
def upload(self, mesh):
assert (self._size >= mesh.size)
return libgl.upload_vertex_buffer(self._buffer, mesh.views, mesh.size)

0
pyui/__init__.py Normal file
View File

33
pyui/application.py Normal file
View File

@ -0,0 +1,33 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
import wx
from .mainframe import MainFrame
class Application(wx.App):
def __init__(self):
wx.App.__init__(self, 0)
def OnInit(self):
self.frame = MainFrame(None)
self.SetTopWindow(self.frame)
self.frame.Show()
return True
def main():
application = Application(0)
application.MainLoop()

28
pyui/mainframe.py Normal file
View File

@ -0,0 +1,28 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from . import mainframe_generated
class MainFrame(mainframe_generated.MainFrame):
__slots__ = 'media_panel', 'preview_panel', 'navigation_panel', 'filter_panel', 'timeline_panel'
def __init__(self, parent):
mainframe_generated.MainFrame.__init__(self, parent)
self.media_panel = self._media_panel
self.preview_panel = self._preview_panel
self.navigation_panel = self._navigation_panel
self.filter_panel = self._filter_panel
self.timeline_panel = self._timeline_panel

139
pyui/mainframe_generated.py Normal file
View File

@ -0,0 +1,139 @@
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version 4.2.1-5faebfea)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################
from .preview import PreviewPanel
import wx
import wx.xrc
import gettext
_ = gettext.gettext
###########################################################################
## Class MainFrame
###########################################################################
class MainFrame ( wx.Frame ):
def __init__( self, parent ):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"People's Video Editor"), pos = wx.DefaultPosition, size = wx.Size( 710,432 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
self.mainmenu = wx.MenuBar( 0 )
self.mainmenu_file = wx.Menu()
self.mainmenu_file_quit = wx.MenuItem( self.mainmenu_file, wx.ID_ANY, _(u"Quit"), wx.EmptyString, wx.ITEM_NORMAL )
self.mainmenu_file.Append( self.mainmenu_file_quit )
self.mainmenu.Append( self.mainmenu_file, _(u"File") )
self.SetMenuBar( self.mainmenu )
main_sizer = wx.BoxSizer( wx.VERTICAL )
self.timeline_splitter = wx.SplitterWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_3D )
self.timeline_splitter.SetSashGravity( 1 )
self.timeline_splitter.Bind( wx.EVT_IDLE, self.timeline_splitterOnIdle )
self.timeline_splitter.SetMinimumPaneSize( 100 )
self.top_panel = wx.Panel( self.timeline_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
top_sizer = wx.BoxSizer( wx.HORIZONTAL )
self.media_splitter = wx.SplitterWindow( self.top_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_3D )
self.media_splitter.Bind( wx.EVT_IDLE, self.media_splitterOnIdle )
self.media_splitter.SetMinimumPaneSize( 100 )
self._media_panel = wx.Panel( self.media_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.right_panel = wx.Panel( self.media_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
right_sizer = wx.BoxSizer( wx.HORIZONTAL )
self.filter_splitter = wx.SplitterWindow( self.right_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_3D )
self.filter_splitter.SetSashGravity( 1 )
self.filter_splitter.Bind( wx.EVT_IDLE, self.filter_splitterOnIdle )
self.filter_splitter.SetMinimumPaneSize( 100 )
self.center_panel = wx.Panel( self.filter_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
center_sizer = wx.BoxSizer( wx.VERTICAL )
self._preview_panel = PreviewPanel( self.center_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
center_sizer.Add( self._preview_panel, 1, wx.EXPAND | wx.ALL, 5 )
self._navigation_panel = wx.Panel( self.center_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
navigation_sizer = wx.BoxSizer( wx.VERTICAL )
scrubber_sizer = wx.BoxSizer( wx.HORIZONTAL )
self.scrubber_slider = wx.Slider( self._navigation_panel, wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL )
scrubber_sizer.Add( self.scrubber_slider, 1, wx.ALL, 5 )
navigation_sizer.Add( scrubber_sizer, 0, wx.EXPAND, 5 )
control_sizer = wx.BoxSizer( wx.HORIZONTAL )
self.control_toolbar = wx.ToolBar( self._navigation_panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL )
self.m_tool1 = self.control_toolbar.AddTool( wx.ID_ANY, _(u"tool"), wx.NullBitmap, wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None )
self.control_toolbar.Realize()
control_sizer.Add( self.control_toolbar, 0, wx.EXPAND, 5 )
navigation_sizer.Add( control_sizer, 0, wx.EXPAND, 5 )
self._navigation_panel.SetSizer( navigation_sizer )
self._navigation_panel.Layout()
navigation_sizer.Fit( self._navigation_panel )
center_sizer.Add( self._navigation_panel, 0, wx.EXPAND | wx.ALL, 5 )
self.center_panel.SetSizer( center_sizer )
self.center_panel.Layout()
center_sizer.Fit( self.center_panel )
self._filter_panel = wx.Panel( self.filter_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.filter_splitter.SplitVertically( self.center_panel, self._filter_panel, -200 )
right_sizer.Add( self.filter_splitter, 1, wx.EXPAND, 5 )
self.right_panel.SetSizer( right_sizer )
self.right_panel.Layout()
right_sizer.Fit( self.right_panel )
self.media_splitter.SplitVertically( self._media_panel, self.right_panel, 200 )
top_sizer.Add( self.media_splitter, 1, wx.EXPAND, 5 )
self.top_panel.SetSizer( top_sizer )
self.top_panel.Layout()
top_sizer.Fit( self.top_panel )
self._timeline_panel = wx.Panel( self.timeline_splitter, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.timeline_splitter.SplitHorizontally( self.top_panel, self._timeline_panel, -100 )
main_sizer.Add( self.timeline_splitter, 1, wx.EXPAND, 5 )
self.SetSizer( main_sizer )
self.Layout()
self.Centre( wx.BOTH )
def __del__( self ):
pass
def timeline_splitterOnIdle( self, event ):
self.timeline_splitter.SetSashPosition( -100 )
self.timeline_splitter.Unbind( wx.EVT_IDLE )
def media_splitterOnIdle( self, event ):
self.media_splitter.SetSashPosition( 200 )
self.media_splitter.Unbind( wx.EVT_IDLE )
def filter_splitterOnIdle( self, event ):
self.filter_splitter.SetSashPosition( -200 )
self.filter_splitter.Unbind( wx.EVT_IDLE )

30
pyui/preview.py Normal file
View File

@ -0,0 +1,30 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from . import preview_generated
class PreviewPanel(preview_generated.PreviewPanel):
__slots__ = 'video_canvas'
def __init__(self, parent, id, pos, size, style):
preview_generated.PreviewPanel.__init__(self, parent, id = id, pos = pos, size = size, style = style)
self.video_canvas = self._video_canvas
def initdialog_event_handler(self, event):
self.video_canvas.SetCurrent(self.video_canvas.context)
def size_event_handler(self, event):
pass

82
pyui/preview_generated.py Normal file
View File

@ -0,0 +1,82 @@
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version 4.2.1-5faebfea)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################
from .video import VideoCanvas
import wx
import wx.xrc
import gettext
_ = gettext.gettext
###########################################################################
## Class PreviewPanel
###########################################################################
class PreviewPanel ( wx.Panel ):
def __init__( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 800,450 ), style = wx.BORDER_NONE|wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL, name = wx.EmptyString ):
wx.Panel.__init__ ( self, parent, id = id, pos = pos, size = size, style = style, name = name )
self.DragAcceptFiles( True )
centering_sizer = wx.FlexGridSizer( 3, 3, 0, 0 )
centering_sizer.AddGrowableCol( 0 )
centering_sizer.AddGrowableCol( 2 )
centering_sizer.AddGrowableRow( 0 )
centering_sizer.AddGrowableRow( 2 )
centering_sizer.SetFlexibleDirection( wx.BOTH )
centering_sizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
self._video_canvas = VideoCanvas( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 400,300 ), wx.BORDER_NONE|wx.FULL_REPAINT_ON_RESIZE|wx.TAB_TRAVERSAL )
centering_sizer.Add( self._video_canvas, 0, wx.EXPAND, 5 )
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
centering_sizer.Add( ( 0, 0), 1, wx.EXPAND, 5 )
self.SetSizer( centering_sizer )
self.Layout()
# Connect Events
self.Bind( wx.EVT_INIT_DIALOG, self.initdialog_event_handler )
self.Bind( wx.EVT_SIZE, self.size_event_handler )
def __del__( self ):
pass
# Virtual event handlers, override them in your derived class
def initdialog_event_handler( self, event ):
pass
def size_event_handler( self, event ):
pass

View File

@ -0,0 +1,936 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="19"/>
<object class="Project" expanded="true">
<property name="code_generation">Python</property>
<property name="cpp_class_decoration">; </property>
<property name="cpp_disconnect_events">0</property>
<property name="cpp_event_generation">connect</property>
<property name="cpp_help_provider">none</property>
<property name="cpp_namespace"></property>
<property name="cpp_precompiled_header"></property>
<property name="cpp_use_array_enum">0</property>
<property name="cpp_use_enum">1</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="file">mainframe_generated</property>
<property name="first_id">6000</property>
<property name="internationalize">1</property>
<property name="lua_skip_events">1</property>
<property name="lua_ui_table">UI</property>
<property name="name">MainFrame</property>
<property name="path">/home/roz/Dev/rk/rk_pve/pyui</property>
<property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property>
<property name="python_disconnect_events">0</property>
<property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces">1</property>
<property name="python_skip_events">0</property>
<property name="relative_path">1</property>
<property name="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property>
<object class="Frame" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">MainFrame</property>
<property name="pos"></property>
<property name="size">710,432</property>
<property name="style">wxDEFAULT_FRAME_STYLE</property>
<property name="subclass">; ; forward_declare</property>
<property name="title">People&apos;s Video Editor</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<property name="xrc_skip_sizer">1</property>
<object class="wxMenuBar" expanded="true">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">mainmenu</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="wxMenu" expanded="true">
<property name="label">File</property>
<property name="name">mainmenu_file</property>
<property name="permission">protected</property>
<object class="wxMenuItem" expanded="true">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Quit</property>
<property name="name">mainmenu_file_quit</property>
<property name="permission">none</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
</object>
</object>
</object>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">main_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxSplitterWindow" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_pane_size">100</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">timeline_splitter</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="sashgravity">1</property>
<property name="sashpos">-100</property>
<property name="sashsize">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="splitmode">wxSPLIT_HORIZONTAL</property>
<property name="style">wxSP_3D</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="splitteritem" expanded="true">
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">top_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">top_sizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxSplitterWindow" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_pane_size">100</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">media_splitter</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="sashgravity">0.0</property>
<property name="sashpos">200</property>
<property name="sashsize">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="splitmode">wxSPLIT_VERTICAL</property>
<property name="style">wxSP_3D</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="splitteritem" expanded="false">
<object class="wxPanel" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">_media_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
</object>
</object>
<object class="splitteritem" expanded="true">
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">right_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">right_sizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxSplitterWindow" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_pane_size">100</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">filter_splitter</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="sashgravity">1</property>
<property name="sashpos">-200</property>
<property name="sashsize">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="splitmode">wxSPLIT_VERTICAL</property>
<property name="style">wxSP_3D</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="splitteritem" expanded="true">
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">center_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">center_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">_preview_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">PreviewPanel; .preview; </property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">_navigation_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">navigation_sizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">scrubber_sizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">1</property>
<object class="wxSlider" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maxValue">100</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minValue">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">scrubber_slider</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSL_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">50</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">control_sizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxToolBar" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmapsize"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="margins"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">control_toolbar</property>
<property name="packing">1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="separation">5</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTB_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="tool" expanded="true">
<property name="bitmap"></property>
<property name="context_menu">0</property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">tool</property>
<property name="name">m_tool1</property>
<property name="permission">protected</property>
<property name="statusbar"></property>
<property name="tooltip"></property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="splitteritem" expanded="false">
<object class="wxPanel" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">_filter_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="splitteritem" expanded="true">
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">_timeline_panel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

213
pyui/resources/preview.fbp Normal file
View File

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="19"/>
<object class="Project" expanded="true">
<property name="code_generation">Python</property>
<property name="cpp_class_decoration">; </property>
<property name="cpp_disconnect_events">0</property>
<property name="cpp_event_generation">connect</property>
<property name="cpp_help_provider">none</property>
<property name="cpp_namespace"></property>
<property name="cpp_precompiled_header"></property>
<property name="cpp_use_array_enum">0</property>
<property name="cpp_use_enum">1</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="file">preview_generated</property>
<property name="first_id">6000</property>
<property name="internationalize">1</property>
<property name="lua_skip_events">1</property>
<property name="lua_ui_table">UI</property>
<property name="name">preview</property>
<property name="path">/home/roz/Dev/rk/rk_pve/pyui</property>
<property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property>
<property name="python_disconnect_events">0</property>
<property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces">1</property>
<property name="python_skip_events">0</property>
<property name="relative_path">1</property>
<property name="use_microsoft_bom">0</property>
<property name="use_native_eol">0</property>
<object class="Panel" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">PreviewPanel</property>
<property name="pos"></property>
<property name="size">800,450</property>
<property name="subclass">; ; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL</property>
<event name="OnInitDialog">initdialog_event_handler</event>
<event name="OnSize">size_event_handler</event>
<object class="wxFlexGridSizer" expanded="true">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">0,2</property>
<property name="growablerows">0,2</property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">centering_sizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">3</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">_video_canvas</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">400,300</property>
<property name="subclass">VideoCanvas; .video; </property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

29
pyui/video.py Normal file
View File

@ -0,0 +1,29 @@
# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor 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.
#
# People's Video Editor 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 People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
import wx
import wx.glcanvas
class VideoCanvas(wx.glcanvas.GLCanvas):
__slots__ = 'context'
def __init__(self, parent, id, pos, size, style):
wx.glcanvas.GLCanvas.__init__(self, parent, id = id, pos = pos, size = size, style = style, attribList =
wx.glcanvas.GLAttributes().PlatformDefaults().RGBA().FrameBuffersRGB().DoubleBuffer().EndList())
self.context = wx.glcanvas.GLContext(self, ctxAttrs =
wx.glcanvas.GLContextAttrs().CoreProfile().OGLVersion(4,6).EndList())
if not self.context.IsOK()):
raise RuntimeError("Failed to create GL Context")