]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_video_libavw.c
Consolidate FS_Init and associated code
[xonotic/darkplaces.git] / cl_video_libavw.c
index 206b9c6998ad9c8a4de8faa7940db9f5f74765ee..7fa50d81c0c25cf5844417f21fa0293bb45e4422 100644 (file)
@@ -21,8 +21,8 @@
 
 */
 
-// LordHavoc: for some reason this is being #include'd rather than treated as its own file...
-// LordHavoc: 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.
+// 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.
 
 // scaler type
 #define LIBAVW_SCALER_BILINEAR  0
@@ -175,7 +175,7 @@ static int libavw_decodeframe(void *stream, void *imagedata, unsigned int Rmask,
                // got error or file end
                errorcode = qLibAvW_StreamGetError(s->stream);
                if (errorcode)
-                       Con_Printf("LibAvW: %s\n", qLibAvW_ErrorString(errorcode));
+                       Con_Errorf("LibAvW: %s\n", qLibAvW_ErrorString(errorcode));
                return 1;
        }
 
@@ -186,11 +186,11 @@ static int libavw_decodeframe(void *stream, void *imagedata, unsigned int Rmask,
                pixel_format = LIBAVW_PIXEL_FORMAT_BGR;
        else
        {
-               Con_Printf("LibAvW: cannot determine pixel format for bpp %i\n", bytesperpixel);
+               Con_Errorf("LibAvW: cannot determine pixel format for bpp %i\n", bytesperpixel);
                return 1;
        }
        if (!qLibAvW_PlayGetFrameImage(s->stream, pixel_format, imagedata, s->info_imagewidth, s->info_imageheight, min(9, max(0, cl_video_libavw_scaler.integer))))
-               Con_Printf("LibAvW: %s\n", qLibAvW_ErrorString(qLibAvW_StreamGetError(s->stream)));
+               Con_Errorf("LibAvW: %s\n", qLibAvW_ErrorString(qLibAvW_StreamGetError(s->stream)));
        return 0;
 }
 
@@ -260,13 +260,13 @@ static void *LibAvW_OpenVideo(clvideo_t *video, char *filename, const char **err
 
        // allocate stream
        s = (libavwstream_t *)Z_Malloc(sizeof(libavwstream_t));
-       s->sndchan = -1;
-       memset(s, 0, sizeof(libavwstream_t));
        if (s == NULL)
        {
                *errorstring = "unable to allocate memory for stream info structure";
                return NULL;
        }
+       memset(s, 0, sizeof(libavwstream_t));
+       s->sndchan = -1;
 
        // open file
        s->file = FS_OpenVirtualFile(filename, true);
@@ -343,13 +343,13 @@ static void *LibAvW_OpenVideo(clvideo_t *video, char *filename, const char **err
 static void libavw_message(int level, const char *message)
 {
        if (level == LIBAVW_PRINT_WARNING)
-               Con_Printf("LibAvcodec warning: %s\n", message);
+               Con_Warnf("LibAvcodec warning: %s\n", message);
        else if (level == LIBAVW_PRINT_ERROR)
-               Con_Printf("LibAvcodec error: %s\n", message);
+               Con_Errorf("LibAvcodec error: %s\n", message);
        else if (level == LIBAVW_PRINT_FATAL)
-               Con_Printf("LibAvcodec fatal error: %s\n", message);
+               Con_Errorf("LibAvcodec fatal error: %s\n", message);
        else
-               Con_Printf("LibAvcodec panic: %s\n", message);
+               Con_Errorf("LibAvcodec panic: %s\n", message);
 }
 
 static qboolean LibAvW_OpenLibrary(void)
@@ -368,7 +368,7 @@ static qboolean LibAvW_OpenLibrary(void)
        // initialize libav wrapper
        if ((errorcode = qLibAvW_Init(&libavw_message)))
        {
-               Con_Printf("LibAvW failed to initialize: %s\n", qLibAvW_ErrorString(errorcode));
+               Con_Errorf("LibAvW failed to initialize: %s\n", qLibAvW_ErrorString(errorcode));
                Sys_UnloadLibrary(&libavw_dll);
        }