From dbb9aa329a7c3e1b78c8410f515bc24ffce7b338 Mon Sep 17 00:00:00 2001 From: Shpoike Date: Fri, 11 Aug 2023 14:47:53 +0100 Subject: [PATCH] Be more agressive about using our ffmpeg plugin instead of it just failing outright. --- engine/client/cl_parse.c | 16 ++++++++++++++++ engine/common/fs.c | 2 +- engine/server/sv_ccmds.c | 1 + plugins/avplug/avdecode.c | 9 +++++++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 3efcc9314..e7beb2d60 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -3723,6 +3723,22 @@ static void CLQ2_ParseServerData (void) { // playing a cinematic or showing a pic, not a level SCR_EndLoadingPlaque(); CL_MakeActive("Quake2"); + if (!COM_FCheckExists(str) && !COM_FCheckExists(va("video/%s", str))) + { + int i; + char basename[64], *t; + char *exts[] = {".ogv", ".roq", ".cin"}; + COM_StripExtension(COM_SkipPath(str), basename, sizeof(basename)); + for(i = 0; i < countof(exts); i++) + { + t = va("video/%s%s", basename, exts[i]); + if (COM_FCheckExists(t)) + { + str = t; + break; + } + } + } if (!Media_PlayFilm(str, false)) { CL_SendClientCommand(true, "nextserver %i", cl.servercount); diff --git a/engine/common/fs.c b/engine/common/fs.c index cae33ce97..aedcf7077 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -1554,7 +1554,7 @@ static int QDECL COM_Dir_List(const char *name, qofs_t size, time_t mtime, void Q_snprintfz(link, sizeof(link), "\\tip\\Play Demo\\demo\\%s", name); colour = "^4"; //disconnects } - else if (!Q_strcasecmp(ext, "roq") || !Q_strcasecmp(ext, "cin") || !Q_strcasecmp(ext, "avi") || !Q_strcasecmp(ext, "mp4") || !Q_strcasecmp(ext, "mkv")) + else if (!Q_strcasecmp(ext, "roq") || !Q_strcasecmp(ext, "cin") || !Q_strcasecmp(ext, "avi") || !Q_strcasecmp(ext, "mp4") || !Q_strcasecmp(ext, "mkv") || !Q_strcasecmp(ext, "ogv")) Q_snprintfz(link, sizeof(link), "\\tip\\Play Film\\film\\%s", name); else if (!Q_strcasecmp(ext, "wav") || !Q_strcasecmp(ext, "ogg") || !Q_strcasecmp(ext, "mp3") || !Q_strcasecmp(ext, "opus") || !Q_strcasecmp(ext, "flac")) Q_snprintfz(link, sizeof(link), "\\tip\\Play Audio\\playaudio\\%s", name); diff --git a/engine/server/sv_ccmds.c b/engine/server/sv_ccmds.c index e039dea25..36f99d124 100644 --- a/engine/server/sv_ccmds.c +++ b/engine/server/sv_ccmds.c @@ -887,6 +887,7 @@ void SV_Map_f (void) if (strlen(level) > 4 && (!strcmp(level + strlen(level)-4, ".cin") || !strcmp(level + strlen(level)-4, ".roq") || + !strcmp(level + strlen(level)-4, ".ogv") || !strcmp(level + strlen(level)-4, ".pcx") || !strcmp(level + strlen(level)-4, ".avi"))) { diff --git a/plugins/avplug/avdecode.c b/plugins/avplug/avdecode.c index c5c9eb3dd..cd65c5e8a 100644 --- a/plugins/avplug/avdecode.c +++ b/plugins/avplug/avdecode.c @@ -149,6 +149,7 @@ static void *AVDec_Create(const char *medianame) unsigned int i; AVCodec *pCodec; qboolean useioctx = false; +// const char *extension = strrchr(medianame, '.'); /*always respond to av: media prefixes*/ if (!strncmp(medianame, "av:", 3) || !strncmp(medianame, "ff:", 3)) @@ -163,8 +164,10 @@ static void *AVDec_Create(const char *medianame) } else if (strchr(medianame, ':')) //block other types of url/prefix. return NULL; - else //if (!strcasecmp(extension, ".roq") || !strcasecmp(extension, ".roq")) - return NULL; //roq+cin should be played back via the engine instead. +// else if (!strcasecmp(extension, ".roq") || !strcasecmp(extension, ".roq") || !strcasecmp(extension, ".cin")) +// return NULL; //roq+cin should be played back via the engine instead... + else + useioctx = true; ctx = malloc(sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx)); @@ -179,6 +182,8 @@ static void *AVDec_Create(const char *medianame) AVIOContext *ioctx; ctx->file = filefuncs->OpenVFS(medianame, "rb", FS_GAME); + if (!ctx->file) + ctx->file = filefuncs->OpenVFS(va("video/%s", medianame), "rb", FS_GAME); if (!ctx->file) { Con_Printf("Unable to open %s\n", medianame);