]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Make cl_video_libavw.c a regular C file like the rest. Create a .h counterpart
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 4 Jul 2020 14:09:36 +0000 (14:09 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 4 Jul 2020 14:09:36 +0000 (14:09 +0000)
Also updated some variables since anything before MSVC 2013 is pretty
much obsolete, and the rationale for not using stdint.h is therefore out
of date.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12784 d7cf8633-e32d-0410-b094-e92efae38249

cl_video.c
cl_video_libavw.c
cl_video_libavw.h [new file with mode: 0644]
darkplaces-sdl2-vs2017.vcxproj
darkplaces-sdl2-vs2019.vcxproj
makefile.inc

index dd29ee7d9b2a95176c61daa3b054feffabd79aff..e9d5e21b59faa381e0597ce64c7533a7780172de 100644 (file)
@@ -20,7 +20,7 @@ cvar_t v_glslgamma_video = {CVAR_CLIENT | CVAR_SAVE, "v_glslgamma_video", "1", "
 #include "dpvsimpledecode.h"
 
 // VorteX: libavcodec implementation
-#include "cl_video_libavw.c"
+#include "cl_video_libavw.h"
 
 // JAM video decoder used by Blood Omnicide
 #ifdef JAMVIDEO
index 422af8a9bd2a3f663700eeb1637d0c78438097cd..abdc2e2cd46623b24bea02bc17fb86508bab598d 100644 (file)
 */
 
 // LadyHavoc: for some reason this is being #include'd rather than treated as its own file...
-// LadyHavoc: adapted to not require stdint.h as this is not available on MSVC++, using unsigned char instead of uint8_t and fs_offset_t instead of int64_t.
+
+#include "quakedef.h"
+#include "client.h"
+#include "cl_video.h"
+#include "cl_video_libavw.h"
 
 // scaler type
 #define LIBAVW_SCALER_BILINEAR  0
@@ -45,9 +49,9 @@
 #define LIBAVW_PRINT_PANIC   4
 // exported callback functions:
 typedef void    avwCallbackPrint(int, const char *);
-typedef int     avwCallbackIoRead(void *, unsigned char *, int);
-typedef fs_offset_t avwCallbackIoSeek(void *, fs_offset_t, int);
-typedef fs_offset_t avwCallbackIoSeekSize(void *);
+typedef int     avwCallbackIoRead(void *, uint8_t *, int);
+typedef uint64_t avwCallbackIoSeek(void *, uint64_t, int);
+typedef uint64_t avwCallbackIoSeekSize(void *);
 // exported functions:
 int         (*qLibAvW_Init)(avwCallbackPrint *printfunction); // init library, returns error code
 const char *(*qLibAvW_ErrorString)(int errorcode); // get string for error code
@@ -85,12 +89,11 @@ static dllfunction_t libavwfuncs[] =
 const char* dllnames_libavw[] =
 {
 #if defined(WIN32)
-               "libavw.dll",
+               "libavcodec.dll",
 #elif defined(MACOSX)
-               "libavw.dylib",
+               "libavcodec.dylib",
 #else
-               "libavw.so.1",
-               "libavw.so",
+               "libavcodec.so",
 #endif
                NULL
 };
@@ -232,21 +235,21 @@ void libavw_close(void *stream)
 }
 
 // IO wrapper
-static int LibAvW_FS_Read(void *opaque, unsigned char *buf, int buf_size)
+static int LibAvW_FS_Read(void *opaque, uint8_t *buf, int buf_size)
 {
        return FS_Read((qfile_t *)opaque, buf, buf_size);
 }
-static fs_offset_t LibAvW_FS_Seek(void *opaque, fs_offset_t pos, int whence)
+static uint64_t LibAvW_FS_Seek(void *opaque, uint64_t pos, int whence)
 {
-       return (fs_offset_t)FS_Seek((qfile_t *)opaque, pos, whence);
+       return (uint64_t)FS_Seek((qfile_t *)opaque, pos, whence);
 }
-static fs_offset_t LibAvW_FS_SeekSize(void *opaque)
+static uint64_t LibAvW_FS_SeekSize(void *opaque)
 {
-       return (fs_offset_t)FS_FileSize((qfile_t *)opaque);
+       return (uint64_t)FS_FileSize((qfile_t *)opaque);
 }
 
 // open as DP video stream
-static void *LibAvW_OpenVideo(clvideo_t *video, char *filename, const char **errorstring)
+void *LibAvW_OpenVideo(clvideo_t *video, char *filename, const char **errorstring)
 {
        libavwstream_t *s;
        char filebase[MAX_OSPATH], check[MAX_OSPATH];
@@ -352,7 +355,7 @@ static void libavw_message(int level, const char *message)
                Con_Printf(CON_ERROR "LibAvcodec panic: %s\n", message);
 }
 
-static qboolean LibAvW_OpenLibrary(void)
+qboolean LibAvW_OpenLibrary(void)
 {
        int errorcode;
 
@@ -379,8 +382,7 @@ static qboolean LibAvW_OpenLibrary(void)
        return true;
 }
 
-static void LibAvW_CloseLibrary(void)
+void LibAvW_CloseLibrary(void)
 {
        Sys_UnloadLibrary(&libavw_dll);
 }
-
diff --git a/cl_video_libavw.h b/cl_video_libavw.h
new file mode 100644 (file)
index 0000000..53006a9
--- /dev/null
@@ -0,0 +1,7 @@
+#include "quakedef.h"
+#include "cl_video.h"
+
+void libavw_close(void *stream);
+void *LibAvW_OpenVideo(clvideo_t *video, char *filename, const char **errorstring);
+qboolean LibAvW_OpenLibrary(void);
+void LibAvW_CloseLibrary(void);
\ No newline at end of file
index 1a5ff3df9807ae879aa77545f94c538545c396c9..aef166ed4485cbf8e2cdfb01d27460e82892dd85 100644 (file)
     <ClCompile Include="cl_particles.c" />\r
     <ClCompile Include="cl_screen.c" />\r
     <ClCompile Include="cl_video.c" />\r
+       <ClCompile Include="cl_video_libavw.c" />\r
     <ClCompile Include="clvm_cmds.c" />\r
     <ClCompile Include="cmd.c" />\r
     <ClCompile Include="collision.c" />\r
     <ClInclude Include="cl_gecko.h" />\r
     <ClInclude Include="cl_screen.h" />\r
     <ClInclude Include="cl_video.h" />\r
+    <ClInclude Include="cl_video_libavw.h" />\r
     <ClInclude Include="client.h" />\r
     <ClInclude Include="clprogdefs.h" />\r
     <ClInclude Include="clvm_cmds.h" />\r
index ff42b1c65f72339960dcb04b3f6c2b65b6ec57b3..884ed4b69d81b3c110083c10d19086bd614e2865 100644 (file)
     <ClCompile Include="cl_particles.c" />\r
     <ClCompile Include="cl_screen.c" />\r
     <ClCompile Include="cl_video.c" />\r
+       <ClCompile Include="cl_video_libavw.c" />\r
     <ClCompile Include="clvm_cmds.c" />\r
     <ClCompile Include="cmd.c" />\r
     <ClCompile Include="collision.c" />\r
     <ClInclude Include="cl_gecko.h" />\r
     <ClInclude Include="cl_screen.h" />\r
     <ClInclude Include="cl_video.h" />\r
+    <ClInclude Include="cl_video_libavw.h" />\r
     <ClInclude Include="client.h" />\r
     <ClInclude Include="clprogdefs.h" />\r
     <ClInclude Include="clvm_cmds.h" />\r
index d35e6bdc26b322fc278b1e370ff413649b55bc92..f903bef183c9439d200a69d49c3df2763f17c3f8 100644 (file)
@@ -93,6 +93,7 @@ OBJ_COMMON= \
        cl_particles.o \
        cl_screen.o \
        cl_video.o \
+       cl_video_libavw.o \
        clvm_cmds.o \
        cmd.o \
        collision.o \