Full-screen Pi 4 is working.
This commit is contained in:
parent
15bf492127
commit
7cba775e18
9 changed files with 114 additions and 84 deletions
|
@ -23,11 +23,17 @@ sudo cp -ax /tmp/mnt-${DIST}/. ${DIST}/
|
|||
sudo chown -R ${MY_UID}:${MY_GID} ${DIST}
|
||||
sudo umount /tmp/mnt-${DIST}
|
||||
|
||||
sed -i 's/#deb/deb/g' buster/etc/apt/sources.list
|
||||
sed -i 's/#deb/deb/g' buster/etc/apt/sources.list.d/raspi.list
|
||||
|
||||
proot -S ${DIST} -q qemu-arm apt-get -y update
|
||||
proot -S ${DIST} -q qemu-arm apt-get -y upgrade
|
||||
proot -S ${DIST} -q qemu-arm apt-get -y install libxv-dev libx11-dev libxext-dev libxi-dev
|
||||
proot -S ${DIST} -q qemu-arm apt-get -y install libomxil-bellagio-bin libomxil-bellagio-dev libraspberrypi-dev
|
||||
proot -S ${DIST} -q qemu-arm apt-get -y install libopenal-dev libasound2-dev
|
||||
proot -S ${DIST} -q qemu-arm apt-get -y build-dep libsdl2 libsdl2-image libsdl2-mixer libsdl2-ttf ffmpeg
|
||||
proot -S ${DIST} -q qemu-arm apt-get -y install libdrm-deb libgbm-dev
|
||||
|
||||
#proot -S ${DIST} -q qemu-arm apt-get -y install libxv-dev libx11-dev libxext-dev libxi-dev
|
||||
#proot -S ${DIST} -q qemu-arm apt-get -y install libomxil-bellagio-bin libomxil-bellagio-dev libraspberrypi-dev
|
||||
#proot -S ${DIST} -q qemu-arm apt-get -y install libopenal-dev libasound2-dev
|
||||
|
||||
touch ${DIST}/usr/include/immintrin.h
|
||||
|
||||
|
|
|
@ -65,17 +65,16 @@ function doBuild() {
|
|||
popd
|
||||
}
|
||||
|
||||
:<<SKIP
|
||||
# 64 Bit Linux
|
||||
CROSS="x86_64-linux-gnu"
|
||||
EXTRA_CFLAGS=""
|
||||
EXTRA_CFLAGS="-O2"
|
||||
EXTRA_OFILES=""
|
||||
EXTRA_LD_FLAGS="-l:everything.a -lpthread -lXv -lX11 -lXext -lm -ldl -lrt"
|
||||
doBuild Singe-Linux-x86_64 linux 64
|
||||
|
||||
# 64 Bit Windows
|
||||
CROSS="x86_64-w64-mingw32"
|
||||
EXTRA_CFLAGS=""
|
||||
EXTRA_CFLAGS="-O2"
|
||||
EXTRA_OFILES="/tmp/singe.res"
|
||||
EXTRA_LD_FLAGS="-mwindows -static -lmingw32 -l:everything.a -lm -lbcrypt -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -Dmain=SDL_main"
|
||||
icotool -c -o /tmp/icon.ico icon.png
|
||||
|
@ -83,12 +82,11 @@ x86_64-w64-mingw32-windres singe.rc -O coff -o /tmp/singe.res
|
|||
doBuild Singe-Windows-x86_64 mingw 64 .exe
|
||||
rm /tmp/icon.ico
|
||||
rm /tmp/singe.res
|
||||
SKIP
|
||||
|
||||
# 32 Bit Raspbian
|
||||
# 32 Bit Raspbian - ***TODO*** Should we provide libsamplerate ourselves?
|
||||
SYSROOT="/opt/cross/pi/buster"
|
||||
CROSS="/opt/cross/pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf"
|
||||
EXTRA_CFLAGS="--sysroot ${SYSROOT}"
|
||||
EXTRA_CFLAGS="-O2 --sysroot ${SYSROOT}"
|
||||
EXTRA_OFILES=""
|
||||
EXTRA_LD_FLAGS="--sysroot ${SYSROOT} -l:everything.a -Wl,-rpath-link,${SYSROOT}/opt/vc/lib -L${SYSROOT}/opt/vc/lib -lbcm_host -lasound -lpthread -lXv -lX11 -lXext -lXi -lm -ldl -lrt -lsndio -lXcursor -lXinerama -lXrandr -lXss -lXxf86vm -lmmal_core -lmmal_util -lmmal_vc_client -lvdpau"
|
||||
EXTRA_LD_FLAGS="--sysroot ${SYSROOT} -l:everything.a -Wl,-rpath-link,${SYSROOT}/opt/vc/lib -L${SYSROOT}/opt/vc/lib -lbcm_host -lasound -lpthread -lXv -lX11 -lXext -lXi -lm -ldl -lrt -lsndio -lXcursor -lXinerama -lXrandr -lXss -lXxf86vm -lmmal_core -lmmal_util -lmmal_vc_client -lvdpau -ldrm -lgbm -lsamplerate"
|
||||
doBuild Singe-Pi-armv6 pi 32
|
||||
|
|
|
@ -342,10 +342,7 @@ autoBuild libtiff.a SDL2_image/external/tiff-4.1.0
|
|||
autoBuild libwebp.a SDL2_image/external/libwebp-1.0.3
|
||||
|
||||
# === PNG ===
|
||||
#O_PNG_COPTS=${PNG_COPTS}
|
||||
#export PNG_COPTS="-I${G_INSTALLED}/include"
|
||||
autoBuild libpng.a SDL2_image/external/libpng-1.6.37 "--with-zlib-prefix=\"${G_INSTALLED}\""
|
||||
#export PNG_COPTS=${O_PNG_COPTS}
|
||||
|
||||
# === JPEG ===
|
||||
autoBuild libjpeg.a SDL2_image/external/jpeg-9c
|
||||
|
@ -408,7 +405,9 @@ autoBuild libharfbuzz.a harfbuzz "--with-glib=no --with-icu=builtin --with-cairo
|
|||
if [[ "${G_PLATFORM}" == "pi" ]]; then
|
||||
MORE_CFLAGS="-I${G_SYSROOT}/opt/vc/include -I${G_SYSROOT}/usr/include -I${G_SYSROOT}/opt/vc/include/interface/vcos/pthreads -I${G_SYSROOT}/opt/vc/include/interface/vmcs_host/linux"
|
||||
MORE_LIBS="-Wl,-rpath-link,${G_SYSROOT}/opt/vc/lib -L${G_SYSROOT}/opt/vc/lib -lbcm_host -lpthread -lm -ldl -lrt"
|
||||
autoBuild libSDL2.a SDL2 "--disable-pulseaudio --disable-esd --disable-video-wayland --enable-video-rpi --enable-alsa"
|
||||
PKG_CONFIG_PATH="${G_SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig" \
|
||||
PKG_CONFIG_SYSROOT_DIR="${G_SYSROOT}" \
|
||||
autoBuild libSDL2.a SDL2 "--enable-video-kmsdrm" # --disable-video-x11 --disable-video-rpi --disable-video-opengl"
|
||||
else
|
||||
autoBuild libSDL2.a SDL2
|
||||
fi
|
||||
|
|
|
@ -27,9 +27,9 @@ CONFIG -= qt
|
|||
# Target Settings
|
||||
|
||||
TARGET = singeEmu
|
||||
CONFIG += platformPi # linux, pi, or mingw
|
||||
CONFIG += bits32 # bits32 or bits64
|
||||
CONFIG += dynamic # dyanmic or static
|
||||
CONFIG += platformLinux # linux, pi, or mingw
|
||||
CONFIG += bits64 # bits32 or bits64
|
||||
CONFIG += static # dyanmic or static
|
||||
|
||||
# Keep binaries to themselves
|
||||
|
||||
|
@ -42,13 +42,19 @@ bits64 {
|
|||
} else {
|
||||
BITNESS="32"
|
||||
}
|
||||
static {
|
||||
LIBTYPE="static"
|
||||
} else {
|
||||
LIBTYPE="dynamic"
|
||||
}
|
||||
platformLinux:PLATFORM="linux"
|
||||
platformMingw:PLATFORM="mingw"
|
||||
platformPi:PLATFORM="pi"
|
||||
|
||||
# === Third Party Builds ===
|
||||
|
||||
static {
|
||||
# === Third Party Builds ===
|
||||
BUILDTHIRDARGS = \"$$PWD/thirdparty\" \"$$OUT_PWD/../thirdparty-build\" $$BITNESS $$PLATFORM
|
||||
BUILDTHIRDARGS = \"$$PWD/thirdparty\" \"$$OUT_PWD/../thirdparty-build\" $$BITNESS $$PLATFORM $$LIBTYPE
|
||||
win32 {
|
||||
# Placeholder - doesn't work
|
||||
BUILDTHIRD.commands = cmd.exe /c $$PWD\\preBuild.bat $$BUILDTHIRDARGS
|
||||
|
|
|
@ -667,9 +667,9 @@ distclean-generic:
|
|||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
@FLaC__HAS_DOXYGEN_FALSE@distclean-local:
|
||||
@FLaC__HAS_DOXYGEN_FALSE@uninstall-local:
|
||||
@FLaC__HAS_DOXYGEN_FALSE@install-data-local:
|
||||
@FLaC__HAS_DOXYGEN_FALSE@distclean-local:
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
|
|
@ -394,8 +394,8 @@ distclean-generic:
|
|||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
@HAVE_DOXYGEN_FALSE@clean-local:
|
||||
@HAVE_DOXYGEN_FALSE@uninstall-local:
|
||||
@HAVE_DOXYGEN_FALSE@clean-local:
|
||||
@HAVE_DOXYGEN_FALSE@install-data-local:
|
||||
clean: clean-am
|
||||
|
||||
|
|
|
@ -1018,9 +1018,9 @@ distclean-generic:
|
|||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
@HAVE_DOXYGEN_FALSE@clean-local:
|
||||
@HAVE_DOXYGEN_FALSE@install-data-local:
|
||||
@HAVE_DOXYGEN_FALSE@uninstall-local:
|
||||
@HAVE_DOXYGEN_FALSE@clean-local:
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
|
||||
|
|
|
@ -181,6 +181,7 @@ bool utilPathExists(char *pathname) {
|
|||
char *utilReadFile(char *filename, size_t *bytes) {
|
||||
char *data = NULL;
|
||||
FILE *in = fopen(filename, "rb");
|
||||
size_t read = 0;
|
||||
|
||||
*bytes = 0;
|
||||
|
||||
|
@ -189,7 +190,7 @@ char *utilReadFile(char *filename, size_t *bytes) {
|
|||
*bytes = ftell(in);
|
||||
fseek(in, 0, SEEK_SET);
|
||||
data = malloc(sizeof(char) * (*bytes));
|
||||
fread(data, sizeof(char), *bytes, in);
|
||||
read = fread(data, sizeof(char), *bytes, in);
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,9 +58,11 @@ typedef struct VideoPlayerS {
|
|||
int64_t timestamp;
|
||||
int64_t audioDelta;
|
||||
int64_t audioPosition;
|
||||
int64_t framesPlayed;
|
||||
Uint16 audioFormat;
|
||||
Uint32 lastTickTime;
|
||||
Uint32 audioSilenceSize;
|
||||
double audioAdjustment;
|
||||
Mix_Chunk *silenceChunk;
|
||||
SDL_AudioStream *audioStream;
|
||||
SDL_Texture *videoTexture;
|
||||
|
@ -541,6 +543,7 @@ int32_t videoUnload(int32_t playerHandle) {
|
|||
int32_t videoUpdate(int32_t playerHandle, SDL_Texture **texture) {
|
||||
int32_t result = -1;
|
||||
int64_t count = 0;
|
||||
int64_t threshold = 0;
|
||||
VideoPlayerT *v = NULL;
|
||||
|
||||
|
||||
|
@ -548,8 +551,11 @@ int32_t videoUpdate(int32_t playerHandle, SDL_Texture **texture) {
|
|||
HASH_FIND_INT(_videoPlayerHash, &playerHandle, v);
|
||||
if (!v) utilDie("No video player at index %d in videoUpdate.", playerHandle);
|
||||
|
||||
// Audio drift limit
|
||||
threshold = (v->audioProps->SampleRate / 2);
|
||||
|
||||
// Handle video frames (and time)
|
||||
if ((SDL_GetTicks() - v->lastTickTime >= v->frameDeltaTime) || (v->audioDelta > (v->audioProps->SampleRate / 2)) || v->resetTime) {
|
||||
if ((SDL_GetTicks() - v->lastTickTime >= v->frameDeltaTime) || (v->audioDelta > threshold) || v->resetTime) {
|
||||
|
||||
v->lastTickTime = SDL_GetTicks();
|
||||
|
||||
|
@ -559,15 +565,28 @@ int32_t videoUpdate(int32_t playerHandle, SDL_Texture **texture) {
|
|||
|
||||
*texture = v->videoTexture;
|
||||
result = v->frame;
|
||||
v->framesPlayed++;
|
||||
|
||||
// Did we trip the audio sync compensation?
|
||||
if (v->audioDelta > threshold) {
|
||||
// Adjust frame rate to try and match
|
||||
if (v->audioDelta > 0) {
|
||||
v->audioAdjustment += 0.000001;
|
||||
} else {
|
||||
v->audioAdjustment -= 0.000001;
|
||||
}
|
||||
}
|
||||
|
||||
// Used to determine if we should play two frames rapidly to catch up to audio
|
||||
v->audioDelta = v->audioPosition - (int64_t)((double)v->timestamp * 0.001 * (double)v->audioProps->SampleRate);
|
||||
v->audioDelta = labs(v->audioPosition - (int64_t)((double)v->timestamp * 0.001 * (double)v->audioProps->SampleRate));
|
||||
|
||||
utilSay("D %ld T %ld A %f", v->audioDelta, threshold, v->audioAdjustment);
|
||||
|
||||
v->frameData = FFMS_GetFrame(v->videoSource, v->frame, &v->errInfo);
|
||||
if (v->frameData == NULL) utilDie("%s", v->errInfo.Buffer);
|
||||
v->frameInfo = FFMS_GetFrameInfo(FFMS_GetTrackFromVideo(v->videoSource), v->frame);
|
||||
v->timestamp = (int64_t)((double)v->frameInfo->PTS * (double)v->videoTimeBase->Num / (double)v->videoTimeBase->Den); // Convert to milliseconds
|
||||
v->frameDeltaTime = v->timestamp - v->lastFrameTime;
|
||||
v->frameDeltaTime = (v->timestamp - v->lastFrameTime); // - (v->audioAdjustment * v->framesPlayed);
|
||||
v->lastFrameTime = v->timestamp;
|
||||
|
||||
if (v->playing) {
|
||||
|
@ -585,6 +604,7 @@ int32_t videoUpdate(int32_t playerHandle, SDL_Texture **texture) {
|
|||
v->audioPosition = (int64_t)((double)v->timestamp * 0.001 * (double)v->audioProps->SampleRate);
|
||||
v->resetTime = false;
|
||||
v->audioDelta = 0;
|
||||
v->framesPlayed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue