Lots of path and file name issues resolved.
This commit is contained in:
parent
fc859dc05c
commit
1a176f2270
10 changed files with 182 additions and 49 deletions
|
@ -91,6 +91,7 @@ doBuild Singe-Windows-x86_64 mingw 64 .exe
|
||||||
rm /tmp/icon.ico
|
rm /tmp/icon.ico
|
||||||
rm /tmp/icon.png
|
rm /tmp/icon.png
|
||||||
rm /tmp/singe.res
|
rm /tmp/singe.res
|
||||||
|
#cp ../build/mingw/64/Singe-Windows-x86_64.exe ../test/.
|
||||||
|
|
||||||
# 32 Bit Raspbian
|
# 32 Bit Raspbian
|
||||||
echo -e "${G_L}\nLinux armv6\n${G_L}"
|
echo -e "${G_L}\nLinux armv6\n${G_L}"
|
||||||
|
|
|
@ -125,7 +125,7 @@ int32_t frameFileLoad(char *filename, char *indexPath, bool stretchVideo, SDL_Re
|
||||||
// Get path where video files live
|
// Get path where video files live
|
||||||
path = utilReadLine(data, bytes, &offset);
|
path = utilReadLine(data, bytes, &offset);
|
||||||
if (!path) utilDie("Cannot read video path from framefile!");
|
if (!path) utilDie("Cannot read video path from framefile!");
|
||||||
utilFixPathSeparators(&path);
|
utilFixPathSeparators(&path, true);
|
||||||
|
|
||||||
// If it's not an absolute path, pre-pend the path to the framefile
|
// If it's not an absolute path, pre-pend the path to the framefile
|
||||||
if ((path[0] != utilGetPathSeparator()) && (path[1] != ':')) {
|
if ((path[0] != utilGetPathSeparator()) && (path[1] != ':')) {
|
||||||
|
@ -136,7 +136,7 @@ int32_t frameFileLoad(char *filename, char *indexPath, bool stretchVideo, SDL_Re
|
||||||
memcpy(&path[count], temp, strlen(temp));
|
memcpy(&path[count], temp, strlen(temp));
|
||||||
path[count + strlen(temp)] = 0;
|
path[count + strlen(temp)] = 0;
|
||||||
free(temp);
|
free(temp);
|
||||||
utilFixPathSeparators(&path);
|
utilFixPathSeparators(&path, true);
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
singe/indexing.xcf
(Stored with Git LFS)
BIN
singe/indexing.xcf
(Stored with Git LFS)
Binary file not shown.
BIN
singe/magnifyingGlass.xcf
(Stored with Git LFS)
BIN
singe/magnifyingGlass.xcf
(Stored with Git LFS)
Binary file not shown.
11
singe/main.c
11
singe/main.c
|
@ -326,6 +326,7 @@ int main(int argc, char *argv[]) {
|
||||||
// Did we get a filename or path to open?
|
// Did we get a filename or path to open?
|
||||||
if ((argc - argCount) != 1) showUsage(exeName, "No script file specified.");
|
if ((argc - argCount) != 1) showUsage(exeName, "No script file specified.");
|
||||||
_confScriptFile = strdup(argv[argCount]);
|
_confScriptFile = strdup(argv[argCount]);
|
||||||
|
utilFixPathSeparators(&_confScriptFile, false);
|
||||||
// Exists?
|
// Exists?
|
||||||
if (!utilFileExists(_confScriptFile)) {
|
if (!utilFileExists(_confScriptFile)) {
|
||||||
// Missing. Is a path?
|
// Missing. Is a path?
|
||||||
|
@ -352,6 +353,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// Do we need to generate a video name?
|
// Do we need to generate a video name?
|
||||||
if (_confVideoFile) {
|
if (_confVideoFile) {
|
||||||
|
utilFixPathSeparators(&_confVideoFile, false);
|
||||||
if (!utilFileExists(_confVideoFile)) {
|
if (!utilFileExists(_confVideoFile)) {
|
||||||
free(_confVideoFile);
|
free(_confVideoFile);
|
||||||
_confVideoFile = NULL;
|
_confVideoFile = NULL;
|
||||||
|
@ -392,6 +394,10 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// Do we need to generate a data directory name?
|
// Do we need to generate a data directory name?
|
||||||
if (_confDataDir) {
|
if (_confDataDir) {
|
||||||
|
utilFixPathSeparators(&_confDataDir, false);
|
||||||
|
// Try to create data directory to ensure it exists.
|
||||||
|
utilMkDirP(_confDataDir, 0777);
|
||||||
|
// Does it exist?
|
||||||
if (!utilPathExists(_confDataDir)) {
|
if (!utilPathExists(_confDataDir)) {
|
||||||
free(_confDataDir);
|
free(_confDataDir);
|
||||||
_confDataDir = NULL;
|
_confDataDir = NULL;
|
||||||
|
@ -402,9 +408,6 @@ int main(int argc, char *argv[]) {
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
// All this temp nonsense here...
|
|
||||||
// I had just jammed a zero into _confDataDir at 'x' but then if utilFixPathSeparators
|
|
||||||
// calls realloc() it pooches things up. Weird.
|
|
||||||
temp = strdup(_confScriptFile);
|
temp = strdup(_confScriptFile);
|
||||||
temp[x] = 0;
|
temp[x] = 0;
|
||||||
_confDataDir = strdup(temp);
|
_confDataDir = strdup(temp);
|
||||||
|
@ -412,7 +415,7 @@ int main(int argc, char *argv[]) {
|
||||||
temp = NULL;
|
temp = NULL;
|
||||||
}
|
}
|
||||||
if (!_confDataDir) showUsage(exeName, "Unable to locate data directory.");
|
if (!_confDataDir) showUsage(exeName, "Unable to locate data directory.");
|
||||||
utilFixPathSeparators(&_confDataDir);
|
utilFixPathSeparators(&_confDataDir, true);
|
||||||
|
|
||||||
// Do they want tracing?
|
// Do they want tracing?
|
||||||
if (tracing) {
|
if (tracing) {
|
||||||
|
|
|
@ -1927,6 +1927,7 @@ void doIndexDisplay(int32_t percent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display animation
|
// Display animation
|
||||||
|
SDL_RenderSetLogicalSize(_renderer, screenW, screenH);
|
||||||
SDL_SetRenderDrawColor(_renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(_renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderClear(_renderer);
|
SDL_RenderClear(_renderer);
|
||||||
|
|
||||||
|
@ -1954,8 +1955,9 @@ void doIndexDisplay(int32_t percent) {
|
||||||
|
|
||||||
// Update animation
|
// Update animation
|
||||||
if (SDL_GetTicks() > nextUpdate) {
|
if (SDL_GetTicks() > nextUpdate) {
|
||||||
|
//angle += (SDL_GetTicks() - nextUpdate) / updateTicks;
|
||||||
angle++;
|
angle++;
|
||||||
if (angle > 359) angle = 0;
|
if (angle > 359) angle -= 360;
|
||||||
nextUpdate = SDL_GetTicks() + updateTicks;
|
nextUpdate = SDL_GetTicks() + updateTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2390,6 +2392,8 @@ void singe(SDL_Window *window, SDL_Renderer *renderer) {
|
||||||
|
|
||||||
// Mouse setup
|
// Mouse setup
|
||||||
_mouseCount = ManyMouse_Init();
|
_mouseCount = ManyMouse_Init();
|
||||||
|
//utilSay("***DEBUG*** Mouse Driver: %s", ManyMouse_DriverName());
|
||||||
|
//utilSay("***DEBUG*** Mice Found: %d", _mouseCount);
|
||||||
if (_mouseCount < 1) utilDie("No mice detected.");
|
if (_mouseCount < 1) utilDie("No mice detected.");
|
||||||
if (_mouseCount > MAX_MICE) {
|
if (_mouseCount > MAX_MICE) {
|
||||||
_mouseCount = MAX_MICE;
|
_mouseCount = MAX_MICE;
|
||||||
|
@ -2401,6 +2405,7 @@ void singe(SDL_Window *window, SDL_Renderer *renderer) {
|
||||||
_mice[x].name[sizeof(_mice[x].name) - 1] = 0;
|
_mice[x].name[sizeof(_mice[x].name) - 1] = 0;
|
||||||
_mice[x].x = (int32_t)(videoGetWidth(_videoHandle) * _overlayScaleX);
|
_mice[x].x = (int32_t)(videoGetWidth(_videoHandle) * _overlayScaleX);
|
||||||
_mice[x].y = (int32_t)(videoGetHeight(_videoHandle) * _overlayScaleY);
|
_mice[x].y = (int32_t)(videoGetHeight(_videoHandle) * _overlayScaleY);
|
||||||
|
//utilSay("***DEBUG*** Mouse %d: %s", x, _mice[x].name);
|
||||||
}
|
}
|
||||||
SDL_SetWindowGrab(_window, SDL_TRUE);
|
SDL_SetWindowGrab(_window, SDL_TRUE);
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
|
|
@ -55,15 +55,21 @@ platformPi:PLATFORM="pi"
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BUILDTHIRDARGS = \"$$PWD/thirdparty\" \"$$OUT_PWD/../thirdparty-build\" $$BITNESS $$PLATFORM $$LIBTYPE
|
BUILDTHIRDARGS = \"$$PWD/thirdparty\" \"$$OUT_PWD/../thirdparty-build\" $$BITNESS $$PLATFORM $$LIBTYPE
|
||||||
win32 {
|
|
||||||
# Placeholder - doesn't work
|
platformLinux {
|
||||||
BUILDTHIRD.commands = cmd.exe /c $$PWD\\preBuild.bat $$BUILDTHIRDARGS
|
|
||||||
} else {
|
|
||||||
BUILDTHIRD.commands = bash $$PWD/preBuild.sh $$BUILDTHIRDARGS
|
BUILDTHIRD.commands = bash $$PWD/preBuild.sh $$BUILDTHIRDARGS
|
||||||
}
|
|
||||||
BUILDTHIRD.target = this
|
BUILDTHIRD.target = this
|
||||||
PRE_TARGETDEPS += this
|
PRE_TARGETDEPS += this
|
||||||
QMAKE_EXTRA_TARGETS += BUILDTHIRD
|
QMAKE_EXTRA_TARGETS += BUILDTHIRD
|
||||||
|
}
|
||||||
|
|
||||||
|
platformPi {
|
||||||
|
message("No Pi support for building prereqs - yet.")
|
||||||
|
}
|
||||||
|
|
||||||
|
platformMingw {
|
||||||
|
message("No Windows support for building prereqs - yet.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# === Arg_Parser ===
|
# === Arg_Parser ===
|
||||||
|
@ -101,9 +107,17 @@ QMAKE_CFLAGS += \
|
||||||
-isystem $$PWD/../thirdparty-build/$$PLATFORM/$$BITNESS/installed/include
|
-isystem $$PWD/../thirdparty-build/$$PLATFORM/$$BITNESS/installed/include
|
||||||
|
|
||||||
dynamic {
|
dynamic {
|
||||||
|
platformLinux {
|
||||||
|
message("No Linux support for building dynamically.")
|
||||||
|
}
|
||||||
|
|
||||||
platformPi {
|
platformPi {
|
||||||
QMAKE_CFLAGS += -I/usr/include/lua5.3
|
QMAKE_CFLAGS += -I/usr/include/lua5.3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platformMingw {
|
||||||
|
message("No Windows support for building dynamically.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
@ -136,16 +150,46 @@ SOURCES += \
|
||||||
LIBS += \
|
LIBS += \
|
||||||
-L$$PWD/../thirdparty-build/$$PLATFORM/$$BITNESS/installed/lib \
|
-L$$PWD/../thirdparty-build/$$PLATFORM/$$BITNESS/installed/lib \
|
||||||
-lpthread \
|
-lpthread \
|
||||||
-lXv \
|
-lm
|
||||||
-lX11 \
|
|
||||||
-lXext \
|
|
||||||
-lm \
|
|
||||||
-ldl \
|
|
||||||
-lrt
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
LIBS += \
|
LIBS += \
|
||||||
-l:everything.a
|
-l:everything.a
|
||||||
|
|
||||||
|
platformLinux {
|
||||||
|
LIBS += \
|
||||||
|
-lXv \
|
||||||
|
-lX11 \
|
||||||
|
-lXext \
|
||||||
|
-ldl \
|
||||||
|
-lrt
|
||||||
|
}
|
||||||
|
|
||||||
|
platformPi {
|
||||||
|
message("No direct Pi support yet.")
|
||||||
|
}
|
||||||
|
|
||||||
|
platformMingw {
|
||||||
|
LIBS += \
|
||||||
|
-mwindows \
|
||||||
|
-static \
|
||||||
|
-lmingw32 \
|
||||||
|
-lbcrypt \
|
||||||
|
-ldinput8 \
|
||||||
|
-ldxguid \
|
||||||
|
-ldxerr8 \
|
||||||
|
-luser32 \
|
||||||
|
-lgdi32 \
|
||||||
|
-lwinmm \
|
||||||
|
-limm32 \
|
||||||
|
-lole32 \
|
||||||
|
-loleaut32 \
|
||||||
|
-lshell32 \
|
||||||
|
-lsetupapi \
|
||||||
|
-lversion \
|
||||||
|
-luuid \
|
||||||
|
-Dmain=SDL_main
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic {
|
dynamic {
|
||||||
|
@ -189,15 +233,16 @@ OTHER_FILES += \
|
||||||
buildRelease.sh \
|
buildRelease.sh \
|
||||||
singe.rc
|
singe.rc
|
||||||
|
|
||||||
|
platformLinux {
|
||||||
|
#QMAKE_POST_LINK += bash $$PWD/postLink.sh "$$PWD" "$$DESTDIR" "$$TARGET"
|
||||||
|
|
||||||
#linux:QMAKE_POST_LINK += bash $$PWD/postLink.sh "$$PWD" "$$DESTDIR" "$$TARGET"
|
# === Generate some data for our buildRelease script ===
|
||||||
|
|
||||||
# === Generate some data for our buildRelease script ===
|
FILEINFO = "SOURCES=\"$$SOURCES\"" \
|
||||||
|
|
||||||
FILEINFO = "SOURCES=\"$$SOURCES\"" \
|
|
||||||
"HEADERS=\"$$HEADERS\"" \
|
"HEADERS=\"$$HEADERS\"" \
|
||||||
"LINUX_LIBS=\"$$LIBS\"" \
|
"LINUX_LIBS=\"$$LIBS\"" \
|
||||||
"SOURCE_DIR=\"$$PWD\"" \
|
"SOURCE_DIR=\"$$PWD\"" \
|
||||||
"QMAKE_CFLAGS=\"$$QMAKE_CFLAGS\""
|
"QMAKE_CFLAGS=\"$$QMAKE_CFLAGS\""
|
||||||
|
|
||||||
write_file("source.inc.sh", FILEINFO)
|
write_file("source.inc.sh", FILEINFO)
|
||||||
|
}
|
||||||
|
|
95
singe/util.c
95
singe/util.c
|
@ -26,7 +26,11 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
|
#define ourMkdir(p,m) mkdir(p)
|
||||||
|
|
||||||
static const int CONSOLE_LINES = 1000;
|
static const int CONSOLE_LINES = 1000;
|
||||||
|
#else
|
||||||
|
#define ourMkdir mkdir
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,27 +105,35 @@ bool utilFileExists(char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void utilFixPathSeparators(char **path) {
|
void utilFixPathSeparators(char **path, bool slash) {
|
||||||
|
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
char *temp = *path;
|
char *work = *path;
|
||||||
|
char *temp = NULL;
|
||||||
|
|
||||||
// Flip path separators to whatever our OS wants
|
// Flip path separators to whatever our OS wants
|
||||||
while (temp[i] != 0) {
|
while (work[i] != 0) {
|
||||||
if (temp[i] == '\\' || temp[i] == '/') {
|
if (work[i] == '\\' || work[i] == '/') {
|
||||||
temp[i] = utilGetPathSeparator();
|
work[i] = utilGetPathSeparator();
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (slash) {
|
||||||
// Does this string end with a path separator?
|
// Does this string end with a path separator?
|
||||||
if (temp[strlen(temp) - 1] != utilGetPathSeparator()) {
|
if (work[strlen(work) - 1] != utilGetPathSeparator()) {
|
||||||
// No - append one.
|
// No - append one.
|
||||||
temp = realloc(temp, sizeof(char) * (strlen(temp) + 1));
|
temp = strdup(work);
|
||||||
temp[strlen(temp)] = utilGetPathSeparator();
|
free(work);
|
||||||
temp[strlen(temp) + 1] = 0;
|
work = malloc(sizeof(char) * (strlen(temp) + 1));
|
||||||
*path = temp;
|
strcpy(work, temp);
|
||||||
|
work[strlen(temp)] = utilGetPathSeparator();
|
||||||
|
work[strlen(temp) + 1] = 0;
|
||||||
|
free(temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*path = work;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,6 +180,67 @@ char utilGetPathSeparator(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool utilMkDirP(const char *dir, const mode_t mode) {
|
||||||
|
char tmp[UTIL_PATH_MAX];
|
||||||
|
char *p = NULL;
|
||||||
|
struct stat sb;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
// Make copy of dir.
|
||||||
|
len = strnlen(dir, UTIL_PATH_MAX);
|
||||||
|
if (len == 0 || len == UTIL_PATH_MAX) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
memcpy(tmp, dir, len);
|
||||||
|
tmp[len] = '\0';
|
||||||
|
|
||||||
|
// Remove trailing slash.
|
||||||
|
if (tmp[len - 1] == utilGetPathSeparator()) {
|
||||||
|
tmp[len - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Does it already exist?
|
||||||
|
if (stat(tmp, &sb) == 0) {
|
||||||
|
if (S_ISDIR (sb.st_mode)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recursive mkdir.
|
||||||
|
for (p = tmp + 1; *p; p++) {
|
||||||
|
if (*p == utilGetPathSeparator()) {
|
||||||
|
*p = 0;
|
||||||
|
if (stat(tmp, &sb) != 0) {
|
||||||
|
// Does not exist - create it.
|
||||||
|
if (ourMkdir(tmp, mode) < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!S_ISDIR(sb.st_mode)) {
|
||||||
|
// Not a directory
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*p = utilGetPathSeparator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Check path
|
||||||
|
if (stat(tmp, &sb) != 0) {
|
||||||
|
// Does not exist - create it.
|
||||||
|
if (ourMkdir(tmp, mode) < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!S_ISDIR(sb.st_mode)) {
|
||||||
|
// Not a directory
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool utilPathExists(char *pathname) {
|
bool utilPathExists(char *pathname) {
|
||||||
DIR *dir = opendir(pathname);
|
DIR *dir = opendir(pathname);
|
||||||
if (dir) {
|
if (dir) {
|
||||||
|
@ -183,6 +256,8 @@ char *utilReadFile(char *filename, size_t *bytes) {
|
||||||
FILE *in = fopen(filename, "rb");
|
FILE *in = fopen(filename, "rb");
|
||||||
size_t read = 0;
|
size_t read = 0;
|
||||||
|
|
||||||
|
(void)read;
|
||||||
|
|
||||||
*bytes = 0;
|
*bytes = 0;
|
||||||
|
|
||||||
if (in) {
|
if (in) {
|
||||||
|
|
|
@ -26,11 +26,15 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define UTIL_PATH_MAX 1024
|
||||||
|
|
||||||
|
|
||||||
extern FILE *utilTraceFile;
|
extern FILE *utilTraceFile;
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,10 +42,11 @@ char *utilCreateString(char *format, ...);
|
||||||
char *utilCreateStringVArgs(char *format, va_list args);
|
char *utilCreateStringVArgs(char *format, va_list args);
|
||||||
void utilDie(char *fmt, ...);
|
void utilDie(char *fmt, ...);
|
||||||
bool utilFileExists(char *filename);
|
bool utilFileExists(char *filename);
|
||||||
void utilFixPathSeparators(char **path);
|
void utilFixPathSeparators(char **path, bool slash);
|
||||||
char *utilGetFileExtension(char *filename);
|
char *utilGetFileExtension(char *filename);
|
||||||
char *utilGetLastPathComponent(char *pathname);
|
char *utilGetLastPathComponent(char *pathname);
|
||||||
char utilGetPathSeparator(void);
|
char utilGetPathSeparator(void);
|
||||||
|
bool utilMkDirP(const char *dir, const mode_t mode);
|
||||||
bool utilPathExists(char *pathname);
|
bool utilPathExists(char *pathname);
|
||||||
char *utilReadFile(char *filename, size_t *bytes);
|
char *utilReadFile(char *filename, size_t *bytes);
|
||||||
char *utilReadLine(char *haystack, size_t length, char **offset);
|
char *utilReadLine(char *haystack, size_t length, char **offset);
|
||||||
|
|
|
@ -148,7 +148,6 @@ int FFMS_CC _indexCallBack(int64_t current, int64_t total, void *ICPrivate) {
|
||||||
thisPercent = (int32_t)((double)current / (double)total * 100.0);
|
thisPercent = (int32_t)((double)current / (double)total * 100.0);
|
||||||
if (thisPercent != lastPercent) {
|
if (thisPercent != lastPercent) {
|
||||||
lastPercent = thisPercent;
|
lastPercent = thisPercent;
|
||||||
//utilSay("Indexing: %d%%", thisPercent);
|
|
||||||
// GUI
|
// GUI
|
||||||
if (_indexingFunction) {
|
if (_indexingFunction) {
|
||||||
_indexingFunction(thisPercent);
|
_indexingFunction(thisPercent);
|
||||||
|
@ -175,7 +174,6 @@ FFMS_Index *_createIndex(char *filename, char *indexPath, bool hasVideo, bool ha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!index) {
|
if (!index) {
|
||||||
//utilSay("Creating new index.");
|
|
||||||
indexer = FFMS_CreateIndexer(filename, &v->errInfo);
|
indexer = FFMS_CreateIndexer(filename, &v->errInfo);
|
||||||
if (indexer == NULL) utilDie("%s", v->errInfo.Buffer);
|
if (indexer == NULL) utilDie("%s", v->errInfo.Buffer);
|
||||||
if (hasAudio) FFMS_TrackTypeIndexSettings(indexer, FFMS_TYPE_AUDIO, 1, 0);
|
if (hasAudio) FFMS_TrackTypeIndexSettings(indexer, FFMS_TYPE_AUDIO, 1, 0);
|
||||||
|
@ -224,7 +222,7 @@ int32_t _loadVideoAndAudio(char *vFilename, char *aFilename, char *indexPath, bo
|
||||||
// Find video track
|
// Find video track
|
||||||
v->videoTrack = FFMS_GetFirstTrackOfType(vIndex, FFMS_TYPE_VIDEO, &v->errInfo);
|
v->videoTrack = FFMS_GetFirstTrackOfType(vIndex, FFMS_TYPE_VIDEO, &v->errInfo);
|
||||||
if (v->videoTrack < 0) utilDie("%s", v->errInfo.Buffer);
|
if (v->videoTrack < 0) utilDie("%s", v->errInfo.Buffer);
|
||||||
v->videoSource = FFMS_CreateVideoSource(vFilename, v->videoTrack, vIndex, 1, FFMS_SEEK_NORMAL, &v->errInfo);
|
v->videoSource = FFMS_CreateVideoSource(vFilename, v->videoTrack, vIndex, -1, FFMS_SEEK_NORMAL, &v->errInfo);
|
||||||
if (v->videoSource == NULL) utilDie("%s", v->errInfo.Buffer);
|
if (v->videoSource == NULL) utilDie("%s", v->errInfo.Buffer);
|
||||||
|
|
||||||
// Get video properties
|
// Get video properties
|
||||||
|
@ -260,6 +258,7 @@ int32_t _loadVideoAndAudio(char *vFilename, char *aFilename, char *indexPath, bo
|
||||||
v->videoTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_BGRA32, SDL_TEXTUREACCESS_TARGET, v->propFrame->EncodedWidth, v->propFrame->EncodedHeight);
|
v->videoTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_BGRA32, SDL_TEXTUREACCESS_TARGET, v->propFrame->EncodedWidth, v->propFrame->EncodedHeight);
|
||||||
if (v->videoTexture == NULL) utilDie("%s", SDL_GetError());
|
if (v->videoTexture == NULL) utilDie("%s", SDL_GetError());
|
||||||
if (!stretchVideo) {
|
if (!stretchVideo) {
|
||||||
|
//***TODO*** Is this the best place for this? What if we have videos of multiple sizes?
|
||||||
SDL_RenderSetLogicalSize(renderer, v->propFrame->EncodedWidth, v->propFrame->EncodedHeight);
|
SDL_RenderSetLogicalSize(renderer, v->propFrame->EncodedWidth, v->propFrame->EncodedHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue