hedgewars/uVideoRec.pas
changeset 10309 e338ccbbe100
parent 10306 4fca8bcfaff0
child 10633 2f062fac5791
equal deleted inserted replaced
10308:7350be35b335 10309:e338ccbbe100
    46 
    46 
    47 procedure initModule;
    47 procedure initModule;
    48 procedure freeModule;
    48 procedure freeModule;
    49 
    49 
    50 implementation
    50 implementation
    51 uses uVariables, uUtils, GLunit, SDLh, SysUtils, uIO, uMisc, uTypes;
    51 uses uVariables, uUtils, GLunit, SDLh, SysUtils, uIO, uMisc, uTypes, uDebug;
    52 
    52 
    53 type TAddFileLogRaw = procedure (s: pchar); cdecl;
    53 type TAddFileLogRaw = procedure (s: pchar); cdecl;
    54 const AvwrapperLibName = 'libavwrapper';
    54 const AvwrapperLibName = 'libavwrapper';
    55 
    55 
    56 function AVWrapper_Init(
    56 function AVWrapper_Init(
   107     desc:= desc + 'prefix[' + RecPrefix + ']prefix';
   107     desc:= desc + 'prefix[' + RecPrefix + ']prefix';
   108 
   108 
   109     filename:= UserPathPrefix + '/VideoTemp/' + RecPrefix;
   109     filename:= UserPathPrefix + '/VideoTemp/' + RecPrefix;
   110     soundFilePath:= UserPathPrefix + '/VideoTemp/' + RecPrefix + '.sw';
   110     soundFilePath:= UserPathPrefix + '/VideoTemp/' + RecPrefix + '.sw';
   111 
   111 
   112     if AVWrapper_Init(@AddFileLogRaw
   112     TryDo(AVWrapper_Init(@AddFileLogRaw
   113         , PChar(ansistring(filename))
   113         , PChar(ansistring(filename))
   114         , PChar(ansistring(desc))
   114         , PChar(ansistring(desc))
   115         , PChar(ansistring(soundFilePath))
   115         , PChar(ansistring(soundFilePath))
   116         , PChar(ansistring(cAVFormat))
   116         , PChar(ansistring(cAVFormat))
   117         , PChar(ansistring(cVideoCodec))
   117         , PChar(ansistring(cVideoCodec))
   118         , PChar(ansistring(cAudioCodec))
   118         , PChar(ansistring(cAudioCodec))
   119         , cScreenWidth, cScreenHeight, cVideoFramerateNum, cVideoFramerateDen, cVideoQuality) < 0 then
   119         , cScreenWidth, cScreenHeight, cVideoFramerateNum, cVideoFramerateDen, cVideoQuality) >= 0,
   120         halt(HaltFatalError);
   120         'AVWrapper_Init failed',
       
   121         true);
   121 
   122 
   122     numPixels:= cScreenWidth*cScreenHeight;
   123     numPixels:= cScreenWidth*cScreenHeight;
   123     YCbCr_Planes[0]:= GetMem(numPixels);
   124     YCbCr_Planes[0]:= GetMem(numPixels);
   124     YCbCr_Planes[1]:= GetMem(numPixels div 4);
   125     YCbCr_Planes[1]:= GetMem(numPixels div 4);
   125     YCbCr_Planes[2]:= GetMem(numPixels div 4);
   126     YCbCr_Planes[2]:= GetMem(numPixels div 4);