Be more agressive about using our ffmpeg plugin instead of it just failing outright.

This commit is contained in:
Shpoike 2023-08-11 14:47:53 +01:00
parent eb6490aa43
commit dbb9aa329a
4 changed files with 25 additions and 3 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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")))
{

View file

@ -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);