Skip to content

Commit

Permalink
Pil to QTImage conversion fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kanehekili committed Aug 26, 2023
1 parent 5ceccbb commit 3d28983
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 15 deletions.
4 changes: 2 additions & 2 deletions build/DEB-template/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Source: videocut
Maintainer: kanehekili <[email protected]>
Section: video
Priority: optional
Build-Depends: python3, debhelper, python3-pyqt5, libc6-dev, libavcodec-dev, libavformat-dev
Build-Depends: debhelper, libc6-dev, libavcodec-dev, libavformat-dev
Standards-Version: 2.0.0



Architecture: all
Depends: python3, ffmpeg, python3-pyqt5, python3-pil, libmpv1,python3-pyqt5.qtopengl,${shlibs:Depends}, ${misc:Depends}
Depends: @xlibsx@, ${shlibs:Depends}, ${misc:Depends}
Description: Fast and lossless videocutter for mp2,mp4,mkv,av-1 and more
Section: video
Package: videocut
Expand Down
10 changes: 5 additions & 5 deletions build/build.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version=2.2.0
ubu0=bionic
ubu1=focal
ubu2=jammy
pkgrelease=1
version=2.2.1
ubu0=focal
ubu1=jammy
ubu2=lunar
pkgrelease=2
58 changes: 55 additions & 3 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<property name="srcffmpeg" value="${source}/ffmpeg"/>
<property name="srcdata" value="${source}/data"/>
<property name="srcmpv" value="${source}/lib"/>
<property name="srcmpvlegacy" value="${source}/lib/focal"/>

<!-- get currentt yt-dlp via wget or curl -->
<exec dir="." executable="/bin/bash" os="Linux">
Expand Down Expand Up @@ -119,6 +120,55 @@
<tstamp>
<format property="time.stamp" pattern="EEE, d LLL yyyy HH:mm:ss"/>
</tstamp>

<!-- DEBBUILD ubu0-->
<copy todir="${ubu0Target}">
<fileset dir="DEB-template"/>
<filterset>
<filter token="ubu" value="${ubu0}"/>
<filter token="xxx" value="${version}"/>
<filter token="xpkgrelx" value="${pkgrelease}"/>
<filter token="xtsx" value="${time.stamp}"/>
<filter token="xlibsx" value=" python3, ffmpeg, python3-pyqt5, python3-pil, qt5-style-plugins, libmpv1, python3-pyqt5.qtopengl"/>
</filterset>
</copy>

<mkdir dir="${ubu0Target}/addons"/>
<mkdir dir="${ubu0Target}/debian"/>
<mkdir dir="${ubu0Target}/src"/>
<mkdir dir="${ubu0Target}/src/ffmpeg/bin/V4"/>
<copy todir="${ubu0Target}/src/icons">
<fileset dir="${srcIcons}">
</fileset>
</copy>
<copy todir="${ubu0Target}/src/data">
<fileset file="${srcdata}\countryIso639.json"/>
</copy>
<copy todir="${ubu0Target}/src/ffmpeg/src">
<fileset file="${srcffmpeg}/src/remux5.c"/>
</copy>
<copy todir="${ubu0Target}/src/lib">
<fileset file="${srcmpvlegacy}\mpv.py"/>
</copy>
<copy todir="${ubu0Target}/src">
<fileset file="${source}/*.py" />
<filterset>
<filter token="xxx" value="${version}"/>
</filterset>
</copy>

<chmod file="${ubu0Target}/src/VideoCut.py" perm="ug+rwx"/>

<copy todir="${ubu0Target}/addons">
<fileset file="*.desktop"/>
</copy>
<exec executable="tar" output="/dev/null" os="Linux">
<arg value="-cp"/>
<arg value="--file=${debTarget}/${ubu0Build}.tar"/>
<arg value="--directory=${stage}"/>
<arg value="${ubu0Build}"/>
</exec>


<!-- DEBBUILD ubu1-->
<copy todir="${ubu1Target}">
Expand All @@ -127,7 +177,8 @@
<filter token="ubu" value="${ubu1}"/>
<filter token="xxx" value="${version}"/>
<filter token="xpkgrelx" value="${pkgrelease}"/>
<filter token="xtsx" value="${time.stamp}"/>
<filter token="xtsx" value="${time.stamp}"/>
<filter token="xlibsx" value=" python3, ffmpeg, python3-pyqt5, python3-pil, qt5-style-plugins, libmpv1, python3-pyqt5.qtopengl"/>
</filterset>
</copy>

Expand All @@ -146,7 +197,7 @@
<fileset file="${srcffmpeg}/src/remux5.c"/>
</copy>
<copy todir="${ubu1Target}/src/lib">
<fileset file="${srcmpv}\mpv.py"/>
<fileset file="${srcmpvlegacy}\mpv.py"/>
</copy>
<copy todir="${ubu1Target}/src">
<fileset file="${source}/*.py" />
Expand Down Expand Up @@ -175,7 +226,8 @@
<filter token="ubu" value="${ubu2}"/>
<filter token="xxx" value="${version}"/>
<filter token="xpkgrelx" value="${pkgrelease}"/>
<filter token="xtsx" value="${time.stamp}"/>
<filter token="xtsx" value="${time.stamp}"/>
<filter token="xlibsx" value="python3, ffmpeg, python3-pyqt5, python3-pil, qt5-style-plugins, libmpv2, python3-pyqt5.qtopengl"/>
</filterset>

</copy>
Expand Down
13 changes: 12 additions & 1 deletion src/MpvPlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,18 @@ def screenshotAtFrame(self,frameNumber):

def screenshotImage(self):
im=self.mediaPlayer.screenshot_raw(includes="video")
return ImageQt(im)#scale? ==QImage
temp = im.convert('RGBA')
return QtGui.QImage(
temp.tobytes('raw', "RGBA"),
temp.size[0],
temp.size[1],
QtGui.QImage.Format.Format_RGBA8888)

#empty
#data=im.tobytes("raw","RGBA")
#qim = QtGui.QImage(data, im.size[0], im.size[1], QtGui.QImage.Format_ARGB32)
#return qim
#return ImageQt(im)#scale? ==QImage

def takeScreenShot(self,path):
self.mediaPlayer.screenshot_to_file(path,includes="video")
Expand Down
15 changes: 11 additions & 4 deletions src/lib/mpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#
# You can find copies of the GPLv2 and LGPLv2.1 licenses in the project repository's LICENSE.GPL and LICENSE.LGPL files.

__version__ = '1.0.3'

from ctypes import *
import ctypes.util
import threading
Expand Down Expand Up @@ -441,9 +443,14 @@ def text(self):
return lazy_decoder(self._text)

class MpvEventEndFile(Structure):
_fields_ = [('reason', c_int),
('error', c_int)]

_fields_ = [
('reason', c_int),
('error', c_int),
('playlist_entry_id', c_ulonglong),
('playlist_insert_id', c_ulonglong),
('playlist_insert_num_entries', c_int),
]

EOF = 0
RESTARTED = 1
ABORTED = 2
Expand Down Expand Up @@ -1446,7 +1453,7 @@ def discnav(self, command):
"""Mapped mpv discnav command, see man mpv(1)."""
self.command('discnav', command)

def mouse(x, y, button=None, mode='single'):
def mouse(self, x, y, button=None, mode='single'):
"""Mapped mpv mouse command, see man mpv(1)."""
if button is None:
self.command('mouse', x, y, mode)
Expand Down

0 comments on commit 3d28983

Please sign in to comment.