X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=cap_ogg.c;h=3318c356c4119bb34e0465ed7307d3c4de7aa568;hb=74dac8aaaa13944b2e0908e9b9888ba9b8e90754;hp=bc25d2ded76174ba4e3b2cbe28c52a7e16e99397;hpb=100b264f202fa71c35a7c89782a280fc55dda284;p=xonotic%2Fdarkplaces.git diff --git a/cap_ogg.c b/cap_ogg.c index bc25d2de..3318c356 100644 --- a/cap_ogg.c +++ b/cap_ogg.c @@ -16,7 +16,7 @@ static cvar_t cl_capturevideo_ogg_theora_keyframe_mininterval = {CVAR_SAVE, "cl_ static cvar_t cl_capturevideo_ogg_theora_keyframe_auto_threshold = {CVAR_SAVE, "cl_capturevideo_ogg_theora_keyframe_auto_threshold", "80", "threshold for key frame decision (0 to 100)"}; static cvar_t cl_capturevideo_ogg_theora_noise_sensitivity = {CVAR_SAVE, "cl_capturevideo_ogg_theora_noise_sensitivity", "1", "video noise sensitivity (0 to 6); lower is better"}; static cvar_t cl_capturevideo_ogg_theora_sharpness = {CVAR_SAVE, "cl_capturevideo_ogg_theora_sharpness", "0", "sharpness (0 to 2); lower is sharper"}; -static cvar_t cl_capturevideo_ogg_vorbis_quality = {CVAR_SAVE, "cl_capturevideo_ogg_vorbis_quality", "1", "audio quality (-1 to 10); higher is better"}; +static cvar_t cl_capturevideo_ogg_vorbis_quality = {CVAR_SAVE, "cl_capturevideo_ogg_vorbis_quality", "3", "audio quality (-1 to 10); higher is better"}; // ogg.h stuff #ifdef _MSC_VER @@ -345,7 +345,7 @@ typedef enum { OC_PF_420, /**< Chroma subsampling by 2 in each direction (4:2:0) */ OC_PF_RSVD, /**< Reserved value */ OC_PF_422, /**< Horizonatal chroma subsampling by 2 (4:2:2) */ - OC_PF_444, /**< No chroma subsampling at all (4:4:4) */ + OC_PF_444 /**< No chroma subsampling at all (4:4:4) */ } theora_pixelformat; /** * Theora bitstream info. @@ -517,13 +517,12 @@ static dllfunction_t theorafuncs[] = static dllhandle_t og_dll = NULL, vo_dll = NULL, ve_dll = NULL, th_dll = NULL; -qboolean SCR_CaptureVideo_Ogg_OpenLibrary() +qboolean SCR_CaptureVideo_Ogg_OpenLibrary(void) { const char* dllnames_og [] = { -#if defined(WIN64) - "libogg64.dll", -#elif defined(WIN32) +#if defined(WIN32) + "libogg-0.dll", "libogg.dll", "ogg.dll", #elif defined(MACOSX) @@ -536,9 +535,8 @@ qboolean SCR_CaptureVideo_Ogg_OpenLibrary() }; const char* dllnames_vo [] = { -#if defined(WIN64) - "libvorbis64.dll", -#elif defined(WIN32) +#if defined(WIN32) + "libvorbis-0.dll", "libvorbis.dll", "vorbis.dll", #elif defined(MACOSX) @@ -551,9 +549,8 @@ qboolean SCR_CaptureVideo_Ogg_OpenLibrary() }; const char* dllnames_ve [] = { -#if defined(WIN64) - "libvorbisenc64.dll", -#elif defined(WIN32) +#if defined(WIN32) + "libvorbisenc-2.dll", "libvorbisenc.dll", "vorbisenc.dll", #elif defined(MACOSX) @@ -566,9 +563,8 @@ qboolean SCR_CaptureVideo_Ogg_OpenLibrary() }; const char* dllnames_th [] = { -#if defined(WIN64) - "libtheora64.dll", -#elif defined(WIN32) +#if defined(WIN32) + "libtheora-0.dll", "libtheora.dll", "theora.dll", #elif defined(MACOSX) @@ -590,7 +586,7 @@ qboolean SCR_CaptureVideo_Ogg_OpenLibrary() Sys_LoadLibrary (dllnames_ve, &ve_dll, vorbisencfuncs); } -void SCR_CaptureVideo_Ogg_Init() +void SCR_CaptureVideo_Ogg_Init(void) { SCR_CaptureVideo_Ogg_OpenLibrary(); @@ -604,12 +600,12 @@ void SCR_CaptureVideo_Ogg_Init() Cvar_RegisterVariable(&cl_capturevideo_ogg_vorbis_quality); } -qboolean SCR_CaptureVideo_Ogg_Available() +qboolean SCR_CaptureVideo_Ogg_Available(void) { return og_dll && th_dll && vo_dll && ve_dll; } -void SCR_CaptureVideo_Ogg_CloseDLL() +void SCR_CaptureVideo_Ogg_CloseDLL(void) { Sys_UnloadLibrary (&ve_dll); Sys_UnloadLibrary (&vo_dll); @@ -650,7 +646,7 @@ typedef struct capturevideostate_ogg_formatspecific_s capturevideostate_ogg_formatspecific_t; #define LOAD_FORMATSPECIFIC_OGG() capturevideostate_ogg_formatspecific_t *format = (capturevideostate_ogg_formatspecific_t *) cls.capturevideo.formatspecific -static void SCR_CaptureVideo_Ogg_Interleave() +static void SCR_CaptureVideo_Ogg_Interleave(void) { LOAD_FORMATSPECIFIC_OGG(); ogg_page pg; @@ -708,7 +704,7 @@ static void SCR_CaptureVideo_Ogg_Interleave() } } -static void SCR_CaptureVideo_Ogg_FlushInterleaving() +static void SCR_CaptureVideo_Ogg_FlushInterleaving(void) { LOAD_FORMATSPECIFIC_OGG(); @@ -726,7 +722,7 @@ static void SCR_CaptureVideo_Ogg_FlushInterleaving() } } -static void SCR_CaptureVideo_Ogg_EndVideo() +static void SCR_CaptureVideo_Ogg_EndVideo(void) { LOAD_FORMATSPECIFIC_OGG(); ogg_page pg; @@ -819,7 +815,7 @@ static void SCR_CaptureVideo_Ogg_EndVideo() cls.capturevideo.videofile = NULL; } -static void SCR_CaptureVideo_Ogg_ConvertFrame_BGRA_to_YUV() +static void SCR_CaptureVideo_Ogg_ConvertFrame_BGRA_to_YUV(void) { LOAD_FORMATSPECIFIC_OGG(); yuv_buffer *yuv; @@ -896,10 +892,10 @@ channelmapping_t mapping[8] = { 0, 1, -1, -1, -1, -1, -1, -1 }, // stereo { 0, 1, 2, -1, -1, -1, -1, -1 }, // L C R { 0, 1, 2, 3, -1, -1, -1, -1 }, // surround40 - { 0, 4, 1, 2, 3, -1, -1, -1 }, // FL FC FR RL RR - { 0, 4, 1, 2, 3, 5, -1, -1 }, // surround51 - { 0, 4, 1, 2, 3, 5, 6, -1 }, // (not defined by vorbis spec) - { 0, 4, 1, 2, 3, 5, 6, 7 } // surround71 (not defined by vorbis spec) + { 0, 2, 3, 4, 1, -1, -1, -1 }, // FL FC FR RL RR + { 0, 2, 3, 4, 1, 5, -1, -1 }, // surround51 + { 0, 2, 3, 4, 1, 5, 6, -1 }, // (not defined by vorbis spec) + { 0, 2, 3, 4, 1, 5, 6, 7 } // surround71 (not defined by vorbis spec) }; static void SCR_CaptureVideo_Ogg_SoundFrame(const portable_sampleframe_t *paintbuffer, size_t length) @@ -932,7 +928,7 @@ static void SCR_CaptureVideo_Ogg_SoundFrame(const portable_sampleframe_t *paintb SCR_CaptureVideo_Ogg_Interleave(); } -void SCR_CaptureVideo_Ogg_BeginVideo() +void SCR_CaptureVideo_Ogg_BeginVideo(void) { cls.capturevideo.format = CAPTUREVIDEOFORMAT_OGG_VORBIS_THEORA; cls.capturevideo.formatextension = "ogv"; @@ -981,13 +977,13 @@ void SCR_CaptureVideo_Ogg_BeginVideo() format->yuv[i].uv_width = ti.width / 2; format->yuv[i].uv_height = ti.height / 2; format->yuv[i].uv_stride = ti.width / 2; - format->yuv[i].y = Mem_Alloc(tempmempool, format->yuv[i].y_stride * format->yuv[i].y_height); - format->yuv[i].u = Mem_Alloc(tempmempool, format->yuv[i].uv_stride * format->yuv[i].uv_height); - format->yuv[i].v = Mem_Alloc(tempmempool, format->yuv[i].uv_stride * format->yuv[i].uv_height); + format->yuv[i].y = (unsigned char *) Mem_Alloc(tempmempool, format->yuv[i].y_stride * format->yuv[i].y_height); + format->yuv[i].u = (unsigned char *) Mem_Alloc(tempmempool, format->yuv[i].uv_stride * format->yuv[i].uv_height); + format->yuv[i].v = (unsigned char *) Mem_Alloc(tempmempool, format->yuv[i].uv_stride * format->yuv[i].uv_height); } format->yuvi = -1; // -1: no frame valid yet, write into 0 - FindFraction(cls.capturevideo.framerate, &num, &denom, 1001); + FindFraction(cls.capturevideo.framerate / cls.capturevideo.framestep, &num, &denom, 1001); ti.fps_numerator = num; ti.fps_denominator = denom; @@ -1009,13 +1005,13 @@ void SCR_CaptureVideo_Ogg_BeginVideo() if(ti.quality < 0) { ti.target_bitrate = -1; - ti.keyframe_data_target_bitrate = -1; + ti.keyframe_data_target_bitrate = (unsigned int)-1; ti.quality = 63; } else { ti.target_bitrate = -1; - ti.keyframe_data_target_bitrate = -1; + ti.keyframe_data_target_bitrate = (unsigned int)-1; ti.quality = bound(0, ti.quality, 63); } } @@ -1024,13 +1020,13 @@ void SCR_CaptureVideo_Ogg_BeginVideo() if(ti.quality < 0) { ti.target_bitrate = bound(45000, ti.target_bitrate, 2000000); - ti.keyframe_data_target_bitrate = ti.target_bitrate * max(1, cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier.value); + ti.keyframe_data_target_bitrate = (int) (ti.target_bitrate * max(1, cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier.value)); ti.quality = -1; } else { ti.target_bitrate = bound(45000, ti.target_bitrate, 2000000); - ti.keyframe_data_target_bitrate = ti.target_bitrate * max(1, cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier.value); + ti.keyframe_data_target_bitrate = (int) (ti.target_bitrate * max(1, cl_capturevideo_ogg_theora_keyframe_bitrate_multiplier.value)); ti.quality = -1; } }