├── .gitignore ├── Bin ├── x64 │ ├── avcodec-56.dll │ ├── avdevice-56.dll │ ├── avfilter-5.dll │ ├── avformat-56.dll │ ├── avutil-54.dll │ ├── ffmpeg.exe │ ├── ffplay.exe │ ├── ffprobe.exe │ ├── postproc-53.dll │ ├── swresample-1.dll │ └── swscale-3.dll └── x86 │ ├── avcodec-56.dll │ ├── avdevice-56.dll │ ├── avfilter-5.dll │ ├── avformat-56.dll │ ├── avutil-54.dll │ ├── ffmpeg.exe │ ├── ffplay.exe │ ├── ffprobe.exe │ ├── postproc-53.dll │ ├── swresample-1.dll │ └── swscale-3.dll ├── C └── ffmpeg-2.8.6.tar.gz ├── Documentation ├── .gitkeep └── pts-dts.pdf ├── Examples ├── +avfilter_register │ ├── vf_test.pas │ ├── vf_test_project.dpr │ └── vf_test_project.dproj ├── +dump-frame │ ├── dumpframe.dpr │ ├── dumpframe.dproj │ └── dumpframe.res ├── +mediainfo │ ├── MediaInfo.dpr │ ├── MediaInfo.dproj │ └── MediaInfo.res ├── +simple-sdl2-player │ ├── Project1.dpr │ ├── Project1.dproj │ ├── Project1.res │ ├── Unit1.dfm │ └── Unit1.pas ├── ffmpeg-examples │ ├── +avio_reading │ │ ├── Project1.dpr │ │ └── Project1.dproj │ ├── +avlog │ │ ├── av_log.dpr │ │ └── av_log.dproj │ ├── +demuxing_decoding │ │ ├── demuxing.dpr │ │ └── demuxing.dproj │ ├── +filtering_video │ │ ├── filtering_video.dpr │ │ └── filtering_video.dproj │ ├── +metadata │ │ ├── Project1.dpr │ │ └── Project1.dproj │ ├── +muxing │ │ ├── Project1.dpr │ │ └── Project1.dproj │ ├── +overlay_video │ │ ├── overlay_video.dpr │ │ └── overlay_video.dproj │ ├── +remuxing │ │ ├── remuxing.dpr │ │ └── remuxing.dproj │ └── +version │ │ ├── Project1.dpr │ │ ├── Project1.dproj │ │ └── Project1.res └── ffmpeg-tutorial │ ├── tutorial01.dpr │ ├── tutorial01.dproj │ ├── tutorial01.res │ ├── tutorial02.dpr │ ├── tutorial02.dproj │ ├── tutorial02.res │ ├── tutorial03.dpr │ ├── tutorial03.dproj │ ├── tutorial03.res │ ├── tutorial04.dpr │ ├── tutorial04.dproj │ ├── tutorial04.res │ ├── tutorial05.dpr │ ├── tutorial05.dproj │ ├── tutorial05.res │ ├── tutorial06.dpr │ ├── tutorial06.dproj │ ├── tutorial06.res │ ├── tutorial07.dpr │ ├── tutorial07.dproj │ └── tutorial07.res ├── Include ├── FH.FFMPEG.PROBE.pas ├── libavcodec │ ├── avcodec.pas │ ├── old_codec_ids.pas │ └── version.pas ├── libavdevice │ ├── avdevice.pas │ └── version.pas ├── libavfilter │ ├── asrc_abuffer.pas │ ├── avcodec_filter.pas │ ├── avfilter.pas │ ├── buffersink.pas │ ├── buffersrc.pas │ └── version.pas ├── libavformat │ ├── avformat.pas │ ├── avio.pas │ ├── url.pas │ └── version.pas ├── libavresample │ ├── avresample.pas │ └── version.pas ├── libavutil │ ├── avutil.pas │ ├── buffer.pas │ ├── channel_layout.pas │ ├── common.pas │ ├── cpu.pas │ ├── crc.pas │ ├── dict.pas │ ├── error.pas │ ├── fifo.pas │ ├── file.pas │ ├── frame.pas │ ├── imgutils.pas │ ├── log.pas │ ├── mathematics.pas │ ├── mem.pas │ ├── old_pix_fmts.pas │ ├── opt.pas │ ├── parseutils.pas │ ├── pixdesc.pas │ ├── pixfmt.pas │ ├── rational.pas │ ├── samplefmt.pas │ ├── time.pas │ ├── timecode.pas │ ├── timestamp.pas │ └── version.pas ├── libpostproc │ ├── postprocess.pas │ └── version.pas ├── libswresample │ ├── audioconvert.pas │ ├── resample.pas │ ├── swresample.pas │ ├── swresample_internal.pas │ └── version.pas └── libswscale │ ├── swscale.pas │ └── version.pas └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | # Delphi compiler-generated binaries (safe to delete) 30 | *.exe 31 | *.dll 32 | *.bpl 33 | *.bpi 34 | *.dcp 35 | *.so 36 | *.apk 37 | *.drc 38 | *.map 39 | *.dres 40 | *.rsm 41 | *.tds 42 | *.dcu 43 | *.lib 44 | *.a 45 | *.o 46 | *.ocx 47 | 48 | # Delphi autogenerated files (duplicated info) 49 | *.cfg 50 | *.hpp 51 | *Resource.rc 52 | 53 | # Delphi local files (user-specific info) 54 | *.local 55 | *.identcache 56 | *.projdata 57 | *.tvsconfig 58 | *.dsk 59 | 60 | # Delphi history and backups 61 | __history/ 62 | __recovery/ 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | 68 | !/Bin/**/* 69 | -------------------------------------------------------------------------------- /Bin/x64/avcodec-56.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/avcodec-56.dll -------------------------------------------------------------------------------- /Bin/x64/avdevice-56.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/avdevice-56.dll -------------------------------------------------------------------------------- /Bin/x64/avfilter-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/avfilter-5.dll -------------------------------------------------------------------------------- /Bin/x64/avformat-56.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/avformat-56.dll -------------------------------------------------------------------------------- /Bin/x64/avutil-54.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/avutil-54.dll -------------------------------------------------------------------------------- /Bin/x64/ffmpeg.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/ffmpeg.exe -------------------------------------------------------------------------------- /Bin/x64/ffplay.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/ffplay.exe -------------------------------------------------------------------------------- /Bin/x64/ffprobe.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/ffprobe.exe -------------------------------------------------------------------------------- /Bin/x64/postproc-53.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/postproc-53.dll -------------------------------------------------------------------------------- /Bin/x64/swresample-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/swresample-1.dll -------------------------------------------------------------------------------- /Bin/x64/swscale-3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x64/swscale-3.dll -------------------------------------------------------------------------------- /Bin/x86/avcodec-56.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/avcodec-56.dll -------------------------------------------------------------------------------- /Bin/x86/avdevice-56.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/avdevice-56.dll -------------------------------------------------------------------------------- /Bin/x86/avfilter-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/avfilter-5.dll -------------------------------------------------------------------------------- /Bin/x86/avformat-56.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/avformat-56.dll -------------------------------------------------------------------------------- /Bin/x86/avutil-54.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/avutil-54.dll -------------------------------------------------------------------------------- /Bin/x86/ffmpeg.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/ffmpeg.exe -------------------------------------------------------------------------------- /Bin/x86/ffplay.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/ffplay.exe -------------------------------------------------------------------------------- /Bin/x86/ffprobe.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/ffprobe.exe -------------------------------------------------------------------------------- /Bin/x86/postproc-53.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/postproc-53.dll -------------------------------------------------------------------------------- /Bin/x86/swresample-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/swresample-1.dll -------------------------------------------------------------------------------- /Bin/x86/swscale-3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Bin/x86/swscale-3.dll -------------------------------------------------------------------------------- /C/ffmpeg-2.8.6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/C/ffmpeg-2.8.6.tar.gz -------------------------------------------------------------------------------- /Documentation/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Documentation/.gitkeep -------------------------------------------------------------------------------- /Documentation/pts-dts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Documentation/pts-dts.pdf -------------------------------------------------------------------------------- /Examples/+avfilter_register/vf_test.pas: -------------------------------------------------------------------------------- 1 | unit vf_test; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | avutil, 8 | avcodec, 9 | avfilter; 10 | 11 | {$MINENUMSIZE 4} 12 | 13 | type 14 | PTestFilterContext = ^TTestFilterContext; 15 | TTestFilterContext = record 16 | class_ : PAVClass; 17 | opt1 : PAnsiChar; 18 | opt2 : PAnsiChar; 19 | end; 20 | 21 | function vf_test_register: integer; 22 | function config_props_input(link: PAVFilterLink): Integer; cdecl; 23 | function filter_frame_input(inlink: PAVFilterLink; in_ : PAVFrame): Integer; cdecl; 24 | 25 | var 26 | FTestInputs : array of TAVFilterPad; 27 | FTestOutputs : array of TAVFilterPad; 28 | FTestFilter : TAVFilter; 29 | FTestFilterClass : TAVClass; 30 | LTestFilterOptions : array of TAVOption; 31 | 32 | implementation 33 | 34 | 35 | 36 | function filter_frame_input(inlink: PAVFilterLink; in_ : PAVFrame): Integer; cdecl; 37 | var 38 | LTestFilterContext : PTestFilterContext; 39 | begin 40 | LTestFilterContext := PTestFilterContext(inlink^.dst^.priv); 41 | result := 0; 42 | end; 43 | 44 | function config_props_input(link: PAVFilterLink): Integer; cdecl; 45 | var 46 | LTestFilterContext : PTestFilterContext; 47 | begin 48 | LTestFilterContext := PTestFilterContext(link^.dst^.priv); 49 | writeln('config_props_input'); 50 | result := 0; 51 | end; 52 | 53 | 54 | 55 | function vf_test_register: integer; 56 | var 57 | LTestFilterContext : TTestFilterContext; 58 | begin 59 | 60 | setLength(LTestFilterOptions, 2); 61 | fillchar(LTestFilterOptions[0], sizeof(TAVOption), #0); 62 | LTestFilterOptions[0].name := PAnsiChar('opt1'); 63 | LTestFilterOptions[0].help := PAnsiChar('Options1 description'); 64 | LTestFilterOptions[0].offset := Integer(@LTestFilterContext.opt1) - Integer(@LTestFilterContext); 65 | LTestFilterOptions[0].type_ := AV_OPT_TYPE_STRING; 66 | LTestFilterOptions[0].default_val.str := PAnsiChar('test'); 67 | LTestFilterOptions[0].min := 0; 68 | LTestFilterOptions[0].max := 0; 69 | LTestFilterOptions[0].flags := AV_OPT_FLAG_FILTERING_PARAM; 70 | 71 | fillchar(LTestFilterOptions[1], sizeof(TAVOption), #0); 72 | LTestFilterOptions[1].name := PAnsiChar('opt2'); 73 | LTestFilterOptions[1].help := PAnsiChar('Options2 description'); 74 | LTestFilterOptions[1].offset := Integer(@LTestFilterContext.opt2) - Integer(@LTestFilterContext); 75 | LTestFilterOptions[1].type_ := AV_OPT_TYPE_STRING; 76 | LTestFilterOptions[1].default_val.str := PAnsiChar('test'); 77 | LTestFilterOptions[1].min := 0; 78 | LTestFilterOptions[1].max := 0; 79 | LTestFilterOptions[1].flags := AV_OPT_FLAG_FILTERING_PARAM; 80 | 81 | 82 | fillchar(FTestFilterClass, sizeof(TAVClass), #0); 83 | FTestFilterClass.class_name := PAnsiChar('TestFilterClass'); 84 | FTestFilterClass.item_name := av_default_item_name; 85 | FTestFilterClass.option := @LTestFilterOptions[0]; 86 | FTestFilterClass.version := LIBAVUTIL_VERSION_INT; 87 | 88 | setLength(FTestInputs, 1); 89 | fillchar(FTestInputs[0], sizeof(TAVFilterPad), #0); 90 | FTestInputs[0].name := PAnsiChar('default'); 91 | FTestInputs[0].type_ := AVMEDIA_TYPE_VIDEO; 92 | FTestInputs[0].filter_frame := filter_frame_input; 93 | FTestInputs[0].config_props := config_props_input; 94 | 95 | setLength(FTestOutputs, 1); 96 | fillchar(FTestOutputs[0], sizeof(TAVFilterPad), #0); 97 | FTestOutputs[0].name := PAnsiChar('default'); 98 | FTestOutputs[0].type_ := AVMEDIA_TYPE_VIDEO; 99 | 100 | fillchar(FTestFilter, sizeof(TAVFilter), #0); 101 | FTestFilter.name := PAnsiChar('fh-test'); 102 | FTestFilter.description := PAnsiChar('Test filter descrition'); 103 | FTestFilter.priv_size := sizeof(TTestFilterContext); 104 | FTestFilter.priv_class := @FTestFilterClass; 105 | FTestFilter.inputs := @FTestInputs[0]; 106 | FTestFilter.outputs := @FTestOutputs[0]; 107 | 108 | result := avfilter_register(@FTestFilter); 109 | end; 110 | 111 | end. 112 | -------------------------------------------------------------------------------- /Examples/+dump-frame/dumpframe.dpr: -------------------------------------------------------------------------------- 1 | program dumpframe; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | WinApi.Windows, 9 | System.SysUtils, 10 | System.Classes, 11 | VCL.Graphics, 12 | Vcl.Imaging.jpeg, 13 | avutil in '../../include/libavutil/avutil.pas', 14 | avcodec in '../../include/libavcodec/avcodec.pas', 15 | avformat in '../../include/libavformat/avformat.pas', 16 | avfilter in '../../include/libavfilter/avfilter.pas', 17 | swresample in '../../include/libswresample/swresample.pas', 18 | postprocess in '../../include/libpostproc/postprocess.pas', 19 | avdevice in '../../include/libavdevice/avdevice.pas', 20 | swscale in '../../include/libswscale/swscale.pas'; 21 | 22 | function PPtrIdx(P: PPAVStream; I: Integer): PAVStream; 23 | begin 24 | Inc(P, I); 25 | Result := P^; 26 | end; 27 | 28 | procedure usage(); 29 | begin 30 | writeln(format('Usage: %s -i [filename] -o [frame number] -save [filename]', [ParamStr(0)])); 31 | end; 32 | 33 | procedure SaveToBitmap(frame_rgba: PAVFrame; width: integer; height: integer; var bitmap: TBitmap); 34 | var 35 | i : integer; 36 | begin 37 | bitmap.PixelFormat := pf32bit; 38 | bitmap.Width := width; 39 | bitmap.Height := height; 40 | for i := 0 to bitmap.Height - 1 do 41 | CopyMemory ( bitmap.ScanLine [i], pointer (integer (frame_rgba.data [0]) + bitmap.Width * 4 * i), bitmap.Width * 4 ); 42 | end; 43 | 44 | var 45 | ret : integer = 0; 46 | pkt : TAVPacket; 47 | fmt_ctx : PAVFormatContext = nil; 48 | input_file : string; 49 | st : PAVStream = nil; 50 | codec_ctx : PAVCodecContext = nil; 51 | codec : PAVCodec = nil; 52 | frame : PAVFrame = nil; 53 | frame_rgba : PAVFrame = nil; 54 | scale_ctx : PSwsContext = nil; 55 | 56 | video_dst_data : array[0..3] of PByte = (nil, nil, nil, nil); 57 | video_dst_linesize : array[0..3] of Integer; 58 | video_dst_bufsize : Integer; 59 | 60 | frame_index : integer; 61 | read_frames : integer; 62 | frameFinished : integer; 63 | 64 | arg_o : string; 65 | jpeg_filename : string; 66 | 67 | frame_bitmap : TBitmap; 68 | frame_jpeg : TJPEGImage; 69 | begin 70 | try 71 | ReportMemoryLeaksOnShutdown := true; 72 | 73 | 74 | if (ParamCount < 3 ) then 75 | begin 76 | usage(); 77 | exit; 78 | end; 79 | 80 | if not FindCmdLineSwitch('i', input_file, True) then 81 | begin 82 | usage(); 83 | exit; 84 | end; 85 | 86 | if FindCmdLineSwitch('o', arg_o, True) then 87 | begin 88 | frame_index := strtoint(arg_o); 89 | end; 90 | 91 | if not FindCmdLineSwitch('save', jpeg_filename, True) then 92 | begin 93 | jpeg_filename := '.\dump.jpeg'; 94 | end; 95 | 96 | (* register codecs and formats and other lavf/lavc components *) 97 | av_register_all(); 98 | av_log_set_level(AV_LOG_DEBUG); 99 | 100 | fmt_ctx := avformat_alloc_context(); 101 | if not assigned(fmt_ctx) then 102 | begin 103 | raise Exception.Create('Error allocate avformat context'); 104 | end; 105 | 106 | ret := avformat_open_input(fmt_ctx, PAnsiChar(ansistring(input_file)), nil, nil); 107 | if (ret < 0) then 108 | begin 109 | raise Exception.Create('Could not open input'); 110 | end; 111 | 112 | ret := avformat_find_stream_info(fmt_ctx, nil); 113 | if (ret < 0) then 114 | begin 115 | raise Exception.Create('Could not find stream information'); 116 | end; 117 | 118 | av_dump_format(fmt_ctx, 0, PAnsiChar(ansistring(input_file)), 0); 119 | 120 | ret := av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, nil, 0); 121 | if ret < 0 then 122 | begin 123 | raise Exception.CreateFmt('Could not find %s stream', [string(ansistring(av_get_media_type_string(AVMEDIA_TYPE_VIDEO)))]); 124 | end; 125 | 126 | // get main video stram 127 | st := PPtrIdx(fmt_ctx^.streams, ret); 128 | codec_ctx := st.codec; 129 | 130 | (* find decoder for the stream *) 131 | codec := avcodec_find_decoder(codec_ctx.codec_id); 132 | if not Assigned(codec) then 133 | begin 134 | raise Exception.CreateFmt('Failed to find %s codec', [PAnsiChar(@st^.codec.codec_name[0])]); 135 | end; 136 | 137 | (* Init the decoders*) 138 | ret := avcodec_open2(codec_ctx, codec, nil); 139 | if ret < 0 then 140 | begin 141 | raise Exception.CreateFmt('Failed to open %s codec', [PAnsiChar(@st^.codec.codec_name[0])]); 142 | end; 143 | 144 | frame := av_frame_alloc(); 145 | if not Assigned(frame) then 146 | begin 147 | raise Exception.Create('Could not allocate frame'); 148 | end; 149 | 150 | frame_rgba := av_frame_alloc(); 151 | if not Assigned(frame) then 152 | begin 153 | raise Exception.Create('Could not allocate frame'); 154 | end; 155 | avpicture_alloc(PAVPicture(frame_rgba), PIX_FMT_RGB32, codec_ctx.width, codec_ctx.height ); 156 | 157 | scale_ctx := sws_getContext(codec_ctx.width, codec_ctx.height, codec_ctx.pix_fmt, 158 | codec_ctx.width, codec_ctx.height, PIX_FMT_RGB32, SWS_BICUBIC, nil, nil, nil ); 159 | 160 | ret := av_seek_frame(fmt_ctx, st.index, frame_index, AVSEEK_FLAG_FRAME); 161 | if( ret < 0) then 162 | begin 163 | raise Exception.CreateFmt('Error seeking to frame', [frame_index]); 164 | end; 165 | 166 | read_frames := 0; 167 | av_init_packet(@pkt); 168 | pkt.data := nil; 169 | pkt.size := 0; 170 | while av_read_frame(fmt_ctx, @pkt) >= 0 do 171 | begin 172 | if pkt.stream_index = st.index then 173 | begin 174 | if codec_ctx^.codec_type = AVMEDIA_TYPE_VIDEO then 175 | begin 176 | ret := avcodec_decode_video2(codec_ctx, frame, frameFinished, @pkt); 177 | if ret < 0 then 178 | begin 179 | raise Exception.CreateFmt('Error decoding video frame (%s)', [string(av_err2str(ret))]); 180 | end; 181 | 182 | if frameFinished > 0 then 183 | begin 184 | sws_scale(scale_ctx, @frame.data, @frame.linesize, 0, codec_ctx.height, @frame_rgba.data, @frame_rgba.linesize ); 185 | 186 | frame_bitmap := TBitmap.Create; 187 | try 188 | SaveToBitmap(frame_rgba, codec_ctx.width, codec_ctx.height, frame_bitmap); 189 | frame_jpeg := TJPEGImage.Create; 190 | try 191 | frame_jpeg.Assign(frame_bitmap); 192 | frame_jpeg.CompressionQuality := 90; 193 | frame_jpeg.Compress; 194 | frame_jpeg.SaveToFile(jpeg_filename); 195 | finally 196 | FreeAndNil(frame_jpeg); 197 | end; 198 | finally 199 | FreeAndNil(frame_bitmap); 200 | end; 201 | 202 | break; 203 | end; 204 | end; 205 | end; 206 | av_free_packet(@pkt); 207 | end; 208 | 209 | 210 | avcodec_close(codec_ctx); 211 | avformat_close_input(fmt_ctx); 212 | av_frame_free(frame); 213 | av_frame_free(frame_rgba); 214 | 215 | readln; 216 | except 217 | on E: Exception do 218 | Writeln(E.ClassName, ': ', E.Message); 219 | end; 220 | end. 221 | -------------------------------------------------------------------------------- /Examples/+dump-frame/dumpframe.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/+dump-frame/dumpframe.res -------------------------------------------------------------------------------- /Examples/+mediainfo/MediaInfo.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2012 Stefano Sabatini 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *) 22 | 23 | (** 24 | * @file 25 | * Demuxing and decoding example. 26 | * 27 | * Show how to use the libavformat and libavcodec API to demux and 28 | * decode audio and video data. 29 | * @example demuxing_decoding.c 30 | *) 31 | 32 | 33 | program MediaInfo; 34 | 35 | {$APPTYPE CONSOLE} 36 | 37 | {$R *.res} 38 | 39 | uses 40 | WinApi.Windows, 41 | System.Rtti, 42 | System.SysUtils, 43 | System.JSON, 44 | System.Classes, 45 | avutil in '../../Include/libavutil/avutil.pas', 46 | avcodec in '../../Include/libavcodec/avcodec.pas', 47 | avformat in '../../Include/libavformat/avformat.pas', 48 | avfilter in '../../Include/libavfilter/avfilter.pas', 49 | swresample in '../../Include/libswresample/swresample.pas', 50 | postprocess in '../../Include/libpostproc/postprocess.pas', 51 | avdevice in '../../Include/libavdevice/avdevice.pas', 52 | swscale in '../../Include/libswscale/swscale.pas', 53 | FH.FFMPEG.PROBE in '../../Include/FH.FFMPEG.PROBE.pas'; 54 | 55 | 56 | procedure usage(); 57 | begin 58 | writeln(format('Usage: %s -i [filename] -probe', [ParamStr(0)])); 59 | writeln(format('Usage: %s -i [filename] -s [stream index] -o [offset packet] -dump [filename]', [ParamStr(0)])); 60 | writeln(format('Usage: %s -i [filename] -s [stream index] -o [offset packet] -decode -dump [filename]', [ParamStr(0)])); 61 | end; 62 | 63 | label 64 | finish; 65 | 66 | 67 | var 68 | 69 | sample_flag : integer; 70 | sample_size : integer; 71 | 72 | video_dst_data: array[0..3] of PByte = (nil, nil, nil, nil); 73 | video_dst_linesize: array[0..3] of Integer; 74 | video_dst_bufsize: Integer; 75 | 76 | i : integer; 77 | j : integer; 78 | ret : integer = 0; 79 | pkt : TAVPacket; 80 | fmt_ctx : PAVFormatContext = nil; 81 | opt_dic : PAVDictionary = nil; 82 | st : PAVStream = nil; 83 | codec_ctx : PAVCodecContext = nil; 84 | codec : PAVCodec = nil; 85 | video_dst_file : TFileStream; 86 | frame : PAVFrame = nil; 87 | input_file : string; 88 | stream_index : integer; 89 | offset_packet : integer; 90 | cur_offset_packet : integer = 0; 91 | dump_file : string; 92 | is_probe : boolean = false; 93 | is_debug : boolean = false; 94 | temp_str : string; 95 | 96 | LJSONObject : TJSONObject; 97 | begin 98 | try 99 | ReportMemoryLeaksOnShutdown := true; 100 | 101 | stream_index := 0; 102 | offset_packet := 0; 103 | 104 | if (ParamCount < 1 ) then 105 | begin 106 | usage(); 107 | exit; 108 | end; 109 | 110 | if not FindCmdLineSwitch('i', input_file, True) then 111 | begin 112 | usage(); 113 | exit; 114 | end; 115 | 116 | if FindCmdLineSwitch('probe', True) then 117 | is_probe := true; 118 | 119 | if FindCmdLineSwitch('debug', True) then 120 | is_debug := true; 121 | 122 | if (ParamCount > 3) then 123 | begin 124 | if FindCmdLineSwitch('s', temp_str, True) then 125 | begin 126 | stream_index := strtoint(temp_str); 127 | end; 128 | if FindCmdLineSwitch('o', temp_str, True) then 129 | begin 130 | offset_packet := strtoint(temp_str); 131 | end; 132 | if not FindCmdLineSwitch('dump', dump_file, True) then 133 | begin 134 | dump_file := 'dump.raw'; 135 | end; 136 | end else 137 | is_probe := true; 138 | 139 | TMediaInfo.Create(input_file).SetAsync(false).Error( 140 | procedure(const Sender: TObject; AMessage: string) 141 | begin 142 | SetConsoleTextAttribute(GetStdHandle( STD_OUTPUT_HANDLE), 7); 143 | SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED); 144 | Writeln(AMessage); 145 | end).Probe( 146 | procedure(const Sender: TObject; const JSONObject : TJSONObject) 147 | begin 148 | SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7); 149 | Writeln(JSONObject.ToJSON); 150 | end); 151 | 152 | readln; 153 | except 154 | on E: Exception do 155 | Writeln(E.ClassName, ': ', E.Message); 156 | end; 157 | end. 158 | -------------------------------------------------------------------------------- /Examples/+mediainfo/MediaInfo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/+mediainfo/MediaInfo.res -------------------------------------------------------------------------------- /Examples/+simple-sdl2-player/Project1.dpr: -------------------------------------------------------------------------------- 1 | program Project1; 2 | 3 | uses 4 | Vcl.Forms, 5 | SDL2 in '../../../../svn/uses/trunk/Pascal-SDL-2-Headers-master/SDL2.pas', 6 | avutil in '../../Include/libavutil/avutil.pas', 7 | avcodec in '../../Include/libavcodec/avcodec.pas', 8 | avformat in '../../Include/libavformat/avformat.pas', 9 | swresample in '../../Include/libswresample/swresample.pas', 10 | postprocess in '../../Include/libpostproc/postprocess.pas', 11 | avdevice in '../../Include/libavdevice/avdevice.pas', 12 | swscale in '../../Include/libswscale/swscale.pas', 13 | Unit1 in 'Unit1.pas' {Form1}, 14 | Vcl.Themes, 15 | Vcl.Styles; 16 | 17 | {$R *.res} 18 | 19 | begin 20 | Application.Initialize; 21 | Application.MainFormOnTaskbar := True; 22 | Application.CreateForm(TForm1, Form1); 23 | Application.Run; 24 | end. 25 | -------------------------------------------------------------------------------- /Examples/+simple-sdl2-player/Project1.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/+simple-sdl2-player/Project1.res -------------------------------------------------------------------------------- /Examples/+simple-sdl2-player/Unit1.dfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'FFMPEG PLAY - DELPHI VCL DEMO' 5 | ClientHeight = 613 6 | ClientWidth = 829 7 | Color = clBtnFace 8 | DoubleBuffered = True 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -13 12 | Font.Name = 'Tahoma' 13 | Font.Style = [] 14 | Menu = MainMenu1 15 | OldCreateOrder = False 16 | Scaled = False 17 | OnClose = FormClose 18 | OnCreate = FormCreate 19 | OnDestroy = FormDestroy 20 | OnKeyDown = FormKeyDown 21 | OnResize = FormResize 22 | OnShow = FormShow 23 | PixelsPerInch = 96 24 | TextHeight = 16 25 | object Panel2: TPanel 26 | Left = 0 27 | Top = 538 28 | Width = 829 29 | Height = 75 30 | Margins.Left = 4 31 | Margins.Top = 4 32 | Margins.Right = 4 33 | Margins.Bottom = 4 34 | Align = alBottom 35 | BevelOuter = bvNone 36 | TabOrder = 0 37 | ExplicitTop = 432 38 | ExplicitWidth = 1046 39 | object StatusBar1: TStatusBar 40 | Left = 0 41 | Top = 56 42 | Width = 829 43 | Height = 19 44 | Panels = <> 45 | ExplicitLeft = 952 46 | ExplicitTop = 16 47 | ExplicitWidth = 0 48 | end 49 | object Button1: TButton 50 | Left = 8 51 | Top = 16 52 | Width = 75 53 | Height = 25 54 | Caption = 'Play' 55 | TabOrder = 1 56 | OnClick = Button1Click 57 | end 58 | object Button2: TButton 59 | Left = 103 60 | Top = 16 61 | Width = 75 62 | Height = 25 63 | Caption = 'Pause' 64 | TabOrder = 2 65 | OnClick = Button2Click 66 | end 67 | object Button3: TButton 68 | Left = 200 69 | Top = 17 70 | Width = 75 71 | Height = 25 72 | Caption = 'Stop' 73 | TabOrder = 3 74 | OnClick = Button3Click 75 | end 76 | end 77 | object Panel3: TPanel 78 | Left = 0 79 | Top = 0 80 | Width = 829 81 | Height = 538 82 | Margins.Left = 0 83 | Margins.Top = 0 84 | Margins.Right = 0 85 | Margins.Bottom = 0 86 | Align = alClient 87 | BevelOuter = bvNone 88 | Color = 3355443 89 | Padding.Left = 1 90 | Padding.Top = 1 91 | Padding.Right = 1 92 | Padding.Bottom = 1 93 | ParentBackground = False 94 | TabOrder = 1 95 | ExplicitLeft = 632 96 | ExplicitTop = 160 97 | ExplicitWidth = 185 98 | ExplicitHeight = 185 99 | object Panel1: TPanel 100 | Left = 1 101 | Top = 1 102 | Width = 827 103 | Height = 536 104 | Margins.Left = 0 105 | Margins.Top = 0 106 | Margins.Right = 0 107 | Margins.Bottom = 0 108 | Align = alClient 109 | BevelOuter = bvNone 110 | BiDiMode = bdLeftToRight 111 | Color = 8947848 112 | ParentBiDiMode = False 113 | ParentBackground = False 114 | TabOrder = 0 115 | ExplicitLeft = 0 116 | ExplicitTop = 0 117 | ExplicitWidth = 185 118 | ExplicitHeight = 41 119 | end 120 | end 121 | object OpenDialog1: TOpenDialog 122 | Left = 96 123 | Top = 312 124 | end 125 | object MainMenu1: TMainMenu 126 | Left = 160 127 | Top = 320 128 | object File1: TMenuItem 129 | Caption = 'File' 130 | object Open1: TMenuItem 131 | Caption = 'Open' 132 | OnClick = Open1Click 133 | end 134 | object Savesa1: TMenuItem 135 | Caption = 'Save as' 136 | end 137 | object N2: TMenuItem 138 | Caption = '-' 139 | end 140 | object Exit1: TMenuItem 141 | Caption = 'Exit' 142 | end 143 | end 144 | object N1: TMenuItem 145 | Caption = '?' 146 | end 147 | end 148 | end 149 | -------------------------------------------------------------------------------- /Examples/ffmpeg-examples/+avio_reading/Project1.dpr: -------------------------------------------------------------------------------- 1 | program Project1; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | avutil in '../../../libavutil/avutil.pas', 10 | avcodec in '../../../libavcodec/avcodec.pas', 11 | avformat in '../../../libavformat/avformat.pas', 12 | avfilter in '../../../libavfilter/avfilter.pas', 13 | swresample in '../../../libswresample/swresample.pas', 14 | postprocess in '../../../libpostproc/postprocess.pas', 15 | avdevice in '../../../libavdevice/avdevice.pas', 16 | swscale in '../../../libswscale/swscale.pas'; 17 | 18 | {$MINENUMSIZE 4} 19 | 20 | type 21 | PBuffer_data = ^TBuffer_data; 22 | TBuffer_data = record 23 | ptr : Pointer; 24 | size : integer; ///< size left in the buffer 25 | end; 26 | 27 | function read_packet(opaque: Pointer; buf: PByte; buf_size: integer): integer; stdcall; 28 | var 29 | bd : pBuffer_data; 30 | begin 31 | bd := opaque; 32 | buf_size := FFMIN(buf_size, bd^.size); 33 | writeln(format('ptr:%p size:%d', [bd^.ptr, bd^.size])); 34 | 35 | (* copy internal buffer data to buf *) 36 | move(PByte(bd^.ptr)^, buf^, buf_size); 37 | inc(PByte(bd^.ptr), buf_size); 38 | dec(bd^.size, buf_size); 39 | 40 | result := buf_size; 41 | end; 42 | 43 | 44 | label 45 | finish; 46 | 47 | var 48 | fmt_ctx : PAVFormatContext; 49 | avio_ctx : PAVIOContext; 50 | buffer : PByte; 51 | avio_ctx_buffer : PByte; 52 | buffer_size : integer; 53 | avio_ctx_buffer_size : integer; 54 | input_filename : PAnsiChar; 55 | ret : integer; 56 | bd : TBuffer_data; 57 | begin 58 | try 59 | fmt_ctx := nil; 60 | avio_ctx := nil; 61 | buffer := nil; 62 | avio_ctx_buffer := nil; 63 | buffer_size := 0; 64 | avio_ctx_buffer_size := 4096; 65 | input_filename := nil; 66 | ret := 0; 67 | fillchar(bd, sizeof(TBuffer_data), #0); 68 | 69 | if (ParamCount <> 1) then 70 | begin 71 | writeln(format('Usage: %s [filename]', [ParamStr(0)])); 72 | writeln('API example program to show how to read from a custom buffer'); 73 | writeln('accessed through AVIOContext.'); 74 | readln; 75 | exit; 76 | end; 77 | 78 | input_filename := PAnsiChar(ansistring(ParamStr(1))); 79 | 80 | (* register codecs and formats and other lavf/lavc components *) 81 | av_register_all(); 82 | (* slurp file content into buffer *) 83 | ret := av_file_map(input_filename, buffer, buffer_size, 0, nil); 84 | if (ret < 0) then 85 | goto finish; 86 | 87 | (* fill opaque structure used by the AVIOContext read callback *) 88 | bd.ptr := buffer; 89 | bd.size := buffer_size; 90 | 91 | 92 | fmt_ctx := avformat_alloc_context(); 93 | if not assigned(fmt_ctx) then 94 | begin 95 | ret := ENOMEM; 96 | goto finish; 97 | end; 98 | 99 | avio_ctx_buffer := av_malloc(avio_ctx_buffer_size); 100 | if not assigned(avio_ctx_buffer) then 101 | begin 102 | ret := ENOMEM; 103 | goto finish; 104 | end; 105 | avio_ctx := avio_alloc_context(PAnsiChar(avio_ctx_buffer), avio_ctx_buffer_size, 0, @bd, @read_packet, nil, nil); 106 | if not assigned(avio_ctx) then 107 | begin 108 | ret := ENOMEM; 109 | goto finish; 110 | end; 111 | fmt_ctx^.pb := avio_ctx; 112 | 113 | ret := avformat_open_input(fmt_ctx, nil, nil, nil); 114 | if (ret < 0) then 115 | begin 116 | writeln('Could not open input'); 117 | goto finish; 118 | end; 119 | 120 | ret := avformat_find_stream_info(fmt_ctx, nil); 121 | if (ret < 0) then 122 | begin 123 | writeln('Could not find stream information'); 124 | goto finish; 125 | end; 126 | 127 | av_dump_format(fmt_ctx, 0, input_filename, 0); 128 | 129 | finish: 130 | begin 131 | avformat_close_input(fmt_ctx); 132 | (* note: the internal buffer could have changed, and be != avio_ctx_buffer *) 133 | if assigned(avio_ctx) then 134 | begin 135 | av_freep(@avio_ctx^.buffer); 136 | av_freep(@avio_ctx); 137 | end; 138 | av_file_unmap(buffer, buffer_size); 139 | 140 | if (ret <> 0) then 141 | begin 142 | writeln(Format('Error occurred: %s', [av_err2str(ret)])); 143 | end; 144 | end; 145 | 146 | readln; 147 | 148 | except 149 | on E: Exception do 150 | Writeln(E.ClassName, ': ', E.Message); 151 | end; 152 | end. 153 | -------------------------------------------------------------------------------- /Examples/ffmpeg-examples/+avlog/av_log.dpr: -------------------------------------------------------------------------------- 1 | program av_log; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | avutil in '../../../libavutil/avutil.pas', 10 | avcodec in '../../../libavcodec/avcodec.pas', 11 | avformat in '../../../libavformat/avformat.pas', 12 | swresample in '../../../libswresample/swresample.pas', 13 | postprocess in '../../../libpostproc/postprocess.pas', 14 | avdevice in '../../../libavdevice/avdevice.pas', 15 | swscale in '../../../libswscale/swscale.pas'; 16 | 17 | 18 | function vsnprintf(const format_: PAnsiChar; const arg: va_list): string; 19 | var 20 | i, va_count, offset : integer; 21 | ConstArray : array of TVarRec; 22 | format_str: string; 23 | temp_extended : extended; 24 | temp_string : string; 25 | format_type : string; 26 | begin 27 | format_str := string(format_); 28 | va_count := 0; 29 | for i := 1 to length(format_str) do 30 | if format_str[i] = '%' then inc(va_count); 31 | 32 | SetLength(ConstArray, va_count); 33 | 34 | offset:=0; 35 | for I := 0 to va_count-1 do 36 | begin 37 | offset:=pos('%', format_str, offset+1); 38 | if format_str[offset+1]='.' then 39 | format_type:=copy(format_str,offset,4) 40 | else 41 | if format_str[offset+2]='.' then 42 | format_type:=copy(format_str,offset,5) 43 | else 44 | if ((format_str[offset+1]='I') and (format_str[offset+2]='6') 45 | and (format_str[offset+3]='4') and (format_str[offset+4]='d'))then 46 | begin 47 | format_type:='%d'; 48 | format_str:=StringReplace(format_, '%I64d', '%d', [rfReplaceAll, rfIgnoreCase]) 49 | end else 50 | format_type:=copy(format_str,offset,2); 51 | (* STRING *) 52 | if (((format_type[1]='%') and (format_type[2]='s')) 53 | or ((format_type[1]='%') and (format_type[4]='s')) 54 | or ((format_type[1]='%') and (format_type[5]='s')))then 55 | begin 56 | //str:=StuffString(str, offset, 2, PAnsiChar(vl[i])); 57 | ConstArray[I].VType := vtPChar; 58 | New(ConstArray[i].VPChar); 59 | if not assigned(arg[i]) then 60 | begin 61 | ConstArray[I].VPChar:= ''; 62 | continue; 63 | end; 64 | ConstArray[I].VPChar := PAnsiChar(arg[i]); 65 | //ConstArray[i].VPChar^ := ; 66 | end; 67 | 68 | (* d = Decimal (integer) 69 | u = Unsigned decimal 70 | x = Hexadecimal} 71 | *) 72 | 73 | if (((format_type[1]='%') and (format_type[2]='d')) 74 | or ((format_type[1]='%') and (format_type[4]='d')) 75 | or ((format_type[1]='%') and (format_type[5]='d')))then 76 | begin 77 | //str:=StuffString(str, offset, 2, inttostr(Integer(vl[i]))); 78 | ConstArray[I].VType := vtInteger; 79 | if not assigned(arg[i]) then 80 | begin 81 | ConstArray[I].VInteger:= 0; 82 | continue; 83 | end; 84 | try 85 | //ConstArray[I].VInteger:= StrToInt(PansiChar(vl[i])); 86 | ConstArray[I].VInteger:= Integer(arg[i]); 87 | except 88 | ConstArray[I].VInteger:= 0; 89 | end; 90 | end; 91 | 92 | (* e = Scientific 93 | f = Fixed 94 | g = General 95 | m = Money 96 | n = Number (floating) 97 | *) 98 | if (((format_type[1]='%') and (format_type[2]='f')) 99 | or ((format_type[1]='%') and (format_type[4]='f')) 100 | or ((format_type[1]='%') and (format_type[5]='f')))then 101 | begin 102 | //str:=StuffString(str, offset, 2, floattostr(extended(vl[i]))); 103 | ConstArray[I].VType := vtExtended; 104 | new(ConstArray[I].vExtended); 105 | if not assigned(arg[i]) then 106 | begin 107 | ConstArray[I].vExtended:= 0; 108 | continue; 109 | end; 110 | temp_extended:=extended(arg[i]); 111 | try 112 | ConstArray[I].vExtended:= @temp_extended; 113 | except 114 | ConstArray[I].vExtended:= 0; 115 | end; 116 | end; 117 | 118 | (* p = Pointer 119 | *) 120 | if (((format_type[1]='%') and (format_type[2]='p')) 121 | or ((format_type[1]='%') and (format_type[4]='p')) 122 | or ((format_type[1]='%') and (format_type[5]='p')))then 123 | begin 124 | //str:=StuffString(str, offset, 2, inttostr(Integer(vl[i]))); 125 | ConstArray[I].VType := vtPointer; 126 | if not assigned(arg[i]) then 127 | begin 128 | ConstArray[I].VPointer:= nil; 129 | continue; 130 | end; 131 | try 132 | //ConstArray[I].VInteger:= StrToInt(PansiChar(vl[i])); 133 | ConstArray[I].VPointer:= addr(arg[i]); 134 | except 135 | ConstArray[I].VPointer:= nil; 136 | end; 137 | end; 138 | 139 | end; 140 | 141 | try 142 | result:=format(format_str, ConstArray); 143 | except 144 | result:=format_; 145 | end; 146 | 147 | end; 148 | 149 | 150 | 151 | Procedure av_log_callback(ptr: pointer; level: integer; const fmt: PAnsiChar; const Args: array of const); stdcall; 152 | begin 153 | writeln('AV_LOG: '+format(fmt, Args)); 154 | // writeln('AV_LOG: '+vsnprintf(fmt, vl)); 155 | end; 156 | 157 | label 158 | read; 159 | 160 | var 161 | av_log_level_str : string; 162 | av_log_level_int : integer; 163 | vl: va_list; 164 | msg : ansistring; 165 | begin 166 | try 167 | if (ParamCount <> 1) then 168 | begin 169 | writeln(format('usage: %s LOG_LEVL'+#10#13+ 170 | ' ** '+#10#13+ 171 | ' * AV_LOG_QUIET '+#10#13+ 172 | ' ** '+#10#13+ 173 | ' * Something went really wrong and we will crash now. '+#10#13+ 174 | ' * AV_LOG_PANIC '+#10#13+ 175 | ' ** '+#10#13+ 176 | ' * Something went wrong and recovery is not possible. '+#10#13+ 177 | ' * For example, no header was found for a format which depends '+#10#13+ 178 | ' * on headers or an illegal combination of parameters is used. '+#10#13+ 179 | ' * AV_LOG_FATAL '+#10#13+ 180 | ' ** '+#10#13+ 181 | ' * Something went wrong and cannot losslessly be recovered. '+#10#13+ 182 | ' * However, not all future data is affected. '+#10#13+ 183 | ' * AV_LOG_ERROR '+#10#13+ 184 | ' ** '+#10#13+ 185 | ' * Something somehow does not look correct. This may or may not '+#10#13+ 186 | ' * lead to problems. An example would be the use of "-vstrict -2". '+#10#13+ 187 | ' * AV_LOG_WARNING '+#10#13+ 188 | ' * AV_LOG_INFO '+#10#13+ 189 | ' * AV_LOG_VERBOSE '+#10#13+ 190 | ' ** '+#10#13+ 191 | ' * Stuff which is only useful for libav* developers. '+#10#13+ 192 | ' * AV_LOG_DEBUG; '+#10#13, [extractfilename(ParamStr(0))])); 193 | readln; 194 | exit; 195 | end; 196 | 197 | av_log_level_str:=PansiChar(AnsiString(ParamStr(1))); 198 | 199 | av_register_all(); 200 | 201 | av_log_set_callback(@av_log_callback); 202 | 203 | if sametext(av_log_level_str, 'AV_LOG_DEBUG') then 204 | av_log_set_level(AV_LOG_DEBUG) else 205 | if sametext(av_log_level_str, 'AV_LOG_VERBOSE') then 206 | av_log_set_level(AV_LOG_VERBOSE) else 207 | if sametext(av_log_level_str, 'AV_LOG_INFO') then 208 | av_log_set_level(AV_LOG_INFO) else 209 | if sametext(av_log_level_str, 'AV_LOG_WARNING') then 210 | av_log_set_level(AV_LOG_WARNING) else 211 | if sametext(av_log_level_str, 'AV_LOG_ERROR') then 212 | av_log_set_level(AV_LOG_ERROR) else 213 | if sametext(av_log_level_str, 'AV_LOG_FATAL') then 214 | av_log_set_level(AV_LOG_FATAL) else 215 | if sametext(av_log_level_str, 'AV_LOG_PANIC') then 216 | av_log_set_level(AV_LOG_PANIC) else 217 | if sametext(av_log_level_str, 'AV_LOG_QUIET') then 218 | av_log_set_level(AV_LOG_QUIET); 219 | 220 | 221 | case av_log_get_level of 222 | AV_LOG_QUIET: writeln('SET LEVEL: AV_LOG_QUIET'); 223 | AV_LOG_PANIC: writeln('SET LEVEL: AV_LOG_PANIC'); 224 | AV_LOG_FATAL: writeln('SET LEVEL: AV_LOG_FATAL'); 225 | AV_LOG_ERROR: writeln('SET LEVEL: AV_LOG_ERROR'); 226 | AV_LOG_WARNING: writeln('SET LEVEL: AV_LOG_WARNING'); 227 | AV_LOG_INFO: writeln('SET LEVEL: AV_LOG_INFO'); 228 | AV_LOG_VERBOSE: writeln('SET LEVEL: AV_LOG_VERBOSE'); 229 | AV_LOG_DEBUG: writeln('SET LEVEL: AV_LOG_DEBUG'); 230 | end; 231 | 232 | 233 | read: 234 | begin 235 | readln(msg); 236 | av_vlog(nil, AV_LOG_ERROR, PAnsiChar(msg), []); 237 | goto read; 238 | end; 239 | 240 | except 241 | on E: Exception do 242 | Writeln(E.ClassName, ': ', E.Message); 243 | end; 244 | end. 245 | -------------------------------------------------------------------------------- /Examples/ffmpeg-examples/+metadata/Project1.dpr: -------------------------------------------------------------------------------- 1 | program Project1; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | avutil in '../../../libavutil/avutil.pas', 10 | avcodec in '../../../libavcodec/avcodec.pas', 11 | avformat in '../../../libavformat/avformat.pas', 12 | swresample in '../../../libswresample/swresample.pas', 13 | postprocess in '../../../libpostproc/postprocess.pas', 14 | avdevice in '../../../libavdevice/avdevice.pas', 15 | swscale in '../../../libswscale/swscale.pas'; 16 | 17 | label 18 | usage, version; 19 | 20 | var 21 | fmt_ctx : PAVFormatContext; 22 | tag : PAVDictionaryEntry; 23 | d : PAVDictionary; 24 | k, v : PAnsiChar; 25 | i : integer; 26 | ret : integer; 27 | errorstr : string; 28 | begin 29 | try 30 | fmt_ctx := nil; 31 | tag := nil; 32 | d:=nil; 33 | if ParamCount<=0 then 34 | begin 35 | goto usage; 36 | end; 37 | 38 | if SameText(ParamStr(1), '--version') or 39 | SameText(ParamStr(1), '-version') or 40 | SameText(ParamStr(1), '--v') or 41 | SameText(ParamStr(1), '-v')then 42 | begin 43 | goto version; 44 | end; 45 | 46 | if not fileexists(ParamStr(1)) then 47 | begin 48 | writeln(Format('error: %s not find.', [ParamStr(1)])); 49 | exit; 50 | end; 51 | 52 | writeln(Format('%s %s', [extractfilename(ParamStr(0)), ParamStr(1)])); 53 | 54 | av_register_all(); 55 | ret:=avformat_open_input(fmt_ctx, PAnsiChar(AnsiString(ParamStr(1))), nil, nil); 56 | if ret < 0 then 57 | begin 58 | av_strerror(ret, PAnsiChar(errorstr), 1024); 59 | writeln(Format('error: [avformat_open_input][%s]', [errorstr])); 60 | exit; 61 | end; 62 | 63 | // "create" an empty dictionary 64 | av_dict_set(fmt_ctx^.metadata, 'test1', 'value', 0); // add an entry 65 | k := av_strdup('test2'); // if your strings are already allocated, 66 | v := av_strdup('value'); // you can avoid copying them like this 67 | av_dict_set(fmt_ctx^.metadata, k, v, AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL); 68 | 69 | writeln('Metadata:'); 70 | repeat 71 | tag := av_dict_get(fmt_ctx^.metadata, '', tag, AV_DICT_IGNORE_SUFFIX); 72 | if assigned(tag) then writeln(format(' %s=%s', [tag^.key, tag^.value])); 73 | until not assigned(tag); 74 | 75 | avformat_close_input(fmt_ctx); 76 | readln; 77 | exit; 78 | 79 | usage : 80 | begin 81 | writeln(Format('Usage: %s [file]', [extractfilename(ParamStr(0))])); 82 | writeln('Example:'); 83 | writeln(Format(' %s test.mov', [extractfilename(ParamStr(0))])); 84 | exit; 85 | end; 86 | 87 | version : 88 | begin 89 | writeln('/*'); 90 | writeln(' * Copyright (c) 2011 Reinhard Tartler'); 91 | writeln(' * '); 92 | writeln(' * Permission is hereby granted, free of charge, to any person obtaining a copy'); 93 | writeln(' * of this software and associated documentation files (the "Software"), to deal'); 94 | writeln(' * in the Software without restriction, including without limitation the rights'); 95 | writeln(' * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell'); 96 | writeln(' * copies of the Software, and to permit persons to whom the Software is'); 97 | writeln(' * furnished to do so, subject to the following conditions:'); 98 | writeln(' * '); 99 | writeln(' * The above copyright notice and this permission notice shall be included in'); 100 | writeln(' * all copies or substantial portions of the Software.'); 101 | writeln(' * '); 102 | writeln(' * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR'); 103 | writeln(' * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,'); 104 | writeln(' * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL'); 105 | writeln(' * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER'); 106 | writeln(' * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,'); 107 | writeln(' * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN'); 108 | writeln(' * THE SOFTWARE.'); 109 | writeln(' *'); 110 | writeln(' * Conversion to Pascal Copyright 2013 (c) Oleksandr Nazaruk '); 111 | writeln(' *'); 112 | writeln(' */'); 113 | exit; 114 | end; 115 | 116 | except 117 | on E: Exception do 118 | Writeln(E.ClassName, ': ', E.Message); 119 | end; 120 | end. 121 | -------------------------------------------------------------------------------- /Examples/ffmpeg-examples/+remuxing/remuxing.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2013 Stefano Sabatini 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | *) 22 | 23 | (** 24 | * Ported to Pascal by Oleksandr Nazaruk 2016-02-04 25 | * 26 | *) 27 | 28 | (** 29 | * @file 30 | * libavformat/libavcodec demuxing and muxing API example. 31 | * 32 | * Remux streams from one container format to another. 33 | * @example remuxing.c 34 | *) 35 | program remuxing; 36 | 37 | {$APPTYPE CONSOLE} 38 | 39 | {$R *.res} 40 | 41 | uses 42 | System.SysUtils, 43 | avutil in '../../libavutil/avutil.pas', 44 | avcodec in '../../libavcodec/avcodec.pas', 45 | avformat in '../../libavformat/avformat.pas', 46 | avfilter in '../../libavfilter/avfilter.pas', 47 | swresample in '../../libswresample/swresample.pas', 48 | postprocess in '../../libpostproc/postprocess.pas', 49 | avdevice in '../../libavdevice/avdevice.pas', 50 | swscale in '../../libswscale/swscale.pas'; 51 | 52 | function PPtrIdx(P: PPAVStream; I: Integer): PAVStream; 53 | begin 54 | Inc(P, I); 55 | Result := P^; 56 | end; 57 | 58 | procedure log_packet(const fmt_ctx: PAVFormatContext; const pkt: PAVPacket; const tag: PAnsiChar); 59 | var 60 | time_base: PAVRational; 61 | begin 62 | time_base := @PAVStream(PPtrIdx(fmt_ctx.streams, pkt.stream_index)).time_base; 63 | 64 | writeln(Format('%s: pts:%s pts_time:%s dts:%s dts_time:%s duration:%s duration_time:%s stream_index:%d', 65 | [tag, 66 | av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, time_base), 67 | av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, time_base), 68 | av_ts2str(pkt.duration), av_ts2timestr(pkt.duration, time_base), 69 | pkt.stream_index])); 70 | end; 71 | 72 | var 73 | ofmt: PAVOutputFormat; 74 | ifmt_ctx, ofmt_ctx: PAVFormatContext; 75 | pkt: TAVPacket; 76 | in_filename, out_filename: string; 77 | ret, i: Integer; 78 | in_stream: PAVStream; 79 | out_stream: PAVStream; 80 | 81 | label 82 | _end; 83 | 84 | begin 85 | ReportMemoryLeaksOnShutdown := true; 86 | try 87 | ofmt := nil; 88 | ifmt_ctx := nil; 89 | ofmt_ctx := nil; 90 | 91 | 92 | if ParamCount < 4 then 93 | begin 94 | Writeln(ErrOutput, Format('usage: %s -i [input file] -o [output file]' + sLineBreak + 95 | 'API example program to remux a media file with libavformat and libavcodec.' + sLineBreak + 96 | 'The output format is guessed according to the file extension.', 97 | [ExtractFileName(ParamStr(0))])); 98 | Exit; 99 | end; 100 | 101 | if not FindCmdLineSwitch('i', in_filename, True) then 102 | exit; 103 | 104 | if not FindCmdLineSwitch('o', out_filename, True) then 105 | exit; 106 | 107 | av_register_all(); 108 | av_log_set_level(AV_LOG_DEBUG); 109 | 110 | ret := avformat_open_input(ifmt_ctx, PAnsiChar(ansistring(in_filename)), nil, nil); 111 | if ret < 0 then 112 | begin 113 | Writeln(ErrOutput, Format('Could not open input file ''%s''', [in_filename])); 114 | goto _end; 115 | end; 116 | 117 | ret := avformat_find_stream_info(ifmt_ctx, nil); 118 | if ret < 0 then 119 | begin 120 | Writeln(ErrOutput, 'Failed to retrieve input stream information'); 121 | goto _end; 122 | end; 123 | 124 | av_dump_format(ifmt_ctx, 0, PAnsiChar(ansistring(in_filename)), 0); 125 | 126 | avformat_alloc_output_context2(ofmt_ctx, nil, nil, PAnsiChar(ansistring(out_filename))); 127 | if not Assigned(ofmt_ctx) then 128 | begin 129 | Writeln(ErrOutput, 'Could not create output context'); 130 | ret := AVERROR_UNKNOWN; 131 | goto _end; 132 | end; 133 | 134 | ofmt := ofmt_ctx.oformat; 135 | 136 | for i := 0 to ifmt_ctx.nb_streams - 1 do 137 | begin 138 | in_stream := PPtrIdx(ifmt_ctx.streams, i); 139 | out_stream := avformat_new_stream(ofmt_ctx, in_stream.codec.codec); 140 | if not Assigned(out_stream) then 141 | begin 142 | Writeln(ErrOutput, 'Failed allocating output stream'); 143 | ret := AVERROR_UNKNOWN; 144 | goto _end; 145 | end; 146 | 147 | ret := avcodec_copy_context(out_stream.codec, in_stream.codec); 148 | if ret < 0 then 149 | begin 150 | Writeln(ErrOutput, 'Failed to copy context from input to output stream codec context'); 151 | goto _end; 152 | end; 153 | out_stream.codec.codec_tag := 0; 154 | if (ofmt_ctx.oformat.flags and AVFMT_GLOBALHEADER) <> 0 then 155 | out_stream.codec.flags := out_stream.codec.flags or AV_CODEC_FLAG_GLOBAL_HEADER; 156 | end; 157 | av_dump_format(ofmt_ctx, 0, PAnsiChar(ansistring(out_filename)), 1); 158 | 159 | if (ofmt.flags and AVFMT_NOFILE) = 0 then 160 | begin 161 | ret := avio_open(ofmt_ctx.pb, PAnsiChar(ansistring(out_filename)), AVIO_FLAG_WRITE); 162 | if ret < 0 then 163 | begin 164 | Writeln(ErrOutput, Format('Could not open output file ''%s''', [out_filename])); 165 | goto _end; 166 | end; 167 | end; 168 | 169 | ret := avformat_write_header(ofmt_ctx, nil); 170 | if ret < 0 then 171 | begin 172 | Writeln(ErrOutput, 'Error occurred when opening output file'); 173 | goto _end; 174 | end; 175 | 176 | while True do 177 | begin 178 | ret := av_read_frame(ifmt_ctx, @pkt); 179 | if ret < 0 then 180 | Break; 181 | 182 | in_stream := PPtrIdx(ifmt_ctx.streams, pkt.stream_index); 183 | out_stream := PPtrIdx(ofmt_ctx.streams, pkt.stream_index); 184 | 185 | log_packet(ifmt_ctx, @pkt, 'in'); 186 | 187 | (* copy packet *) 188 | pkt.pts := av_rescale_q_rnd(pkt.pts, in_stream.time_base, out_stream.time_base, integer(AV_ROUND_NEAR_INF) or integer(AV_ROUND_PASS_MINMAX)); 189 | pkt.dts := av_rescale_q_rnd(pkt.dts, in_stream.time_base, out_stream.time_base, integer(AV_ROUND_NEAR_INF) or integer(AV_ROUND_PASS_MINMAX)); 190 | pkt.duration := av_rescale_q(pkt.duration, in_stream.time_base, out_stream.time_base); 191 | pkt.pos := -1; 192 | log_packet(ofmt_ctx, @pkt, 'out'); 193 | 194 | ret := av_interleaved_write_frame(ofmt_ctx, @pkt); 195 | if ret < 0 then 196 | begin 197 | Writeln(ErrOutput, 'Error muxing packet'); 198 | Break; 199 | end; 200 | av_free_packet(@pkt); 201 | end; 202 | 203 | av_write_trailer(ofmt_ctx); 204 | 205 | _end: 206 | 207 | avformat_close_input(ifmt_ctx); 208 | 209 | (* close output *) 210 | if Assigned(ofmt_ctx) and ((ofmt.flags and AVFMT_NOFILE) = 0) then 211 | avio_closep(@ofmt_ctx.pb); 212 | avformat_free_context(ofmt_ctx); 213 | 214 | if (ret < 0) and (ret <> AVERROR_EOF) then 215 | begin 216 | Writeln(ErrOutput, Format('Error occurred: %s', [av_err2str(ret)])); 217 | Exit; 218 | end; 219 | 220 | readln; 221 | except 222 | on E: Exception do 223 | Writeln(E.ClassName, ': ', E.Message); 224 | end; 225 | end. 226 | -------------------------------------------------------------------------------- /Examples/ffmpeg-examples/+version/Project1.dpr: -------------------------------------------------------------------------------- 1 | program Project1; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | avutil in '../../../Include/libavutil/avutil.pas', 10 | avcodec in '../../../Include/libavcodec/avcodec.pas', 11 | avformat in '../../../Include/libavformat/avformat.pas', 12 | avfilter in '../../../Include/libavfilter/avfilter.pas', 13 | swresample in '../../../Include/libswresample/swresample.pas', 14 | postprocess in '../../../Include/libpostproc/postprocess.pas', 15 | avdevice in '../../../Include/libavdevice/avdevice.pas', 16 | swscale in '../../../Include/libswscale/swscale.pas'; 17 | 18 | 19 | 20 | var 21 | VERSION , 22 | MAJOR, MINOR , MICRO: longint; 23 | begin 24 | try 25 | 26 | av_register_all(); 27 | 28 | 29 | if System.SysUtils.FileExists(format('%s.dll', [LIB_AVFORMAT])) then 30 | begin 31 | writeln(''); 32 | writeln(format('Configuration: %s', [string(avformat_configuration)])); 33 | writeln(''); 34 | writeln(format('License: %s', [string(avformat_license)])); 35 | 36 | VERSION:=avformat_version(); 37 | MAJOR:= VERSION shr 16; 38 | MINOR:= VERSION shr 8 and $ff; 39 | MICRO:= VERSION and $ff; 40 | writeln(format('LIB_AVFORMAT %s.dll %s', [LIB_AVFORMAT, AV_VERSION(MAJOR, MINOR, MICRO)])); 41 | end; 42 | if System.SysUtils.FileExists(format('%s.dll', [LIB_AVUTIL])) then 43 | begin 44 | VERSION:=avutil_version(); 45 | MAJOR:= VERSION shr 16; 46 | MINOR:= VERSION shr 8 and $ff; 47 | MICRO:= VERSION and $ff; 48 | writeln(format('LIB_AVUTIL: %s.dll %s', [LIB_AVUTIL, AV_VERSION(MAJOR, MINOR, MICRO)])); 49 | end; 50 | if System.SysUtils.FileExists(format('%s.dll', [LIB_POSTPROC])) then 51 | begin 52 | VERSION:=postproc_version(); 53 | MAJOR:= VERSION shr 16; 54 | MINOR:= VERSION shr 8 and $ff; 55 | MICRO:= VERSION and $ff; 56 | writeln(format('LIB_POSTPROC: %s.dll %s', [LIB_POSTPROC, AV_VERSION(MAJOR, MINOR, MICRO)])); 57 | end; 58 | if System.SysUtils.FileExists(format('%s.dll', [LIB_AVCODEC])) then 59 | begin 60 | VERSION:=avcodec_version(); 61 | MAJOR:= VERSION shr 16; 62 | MINOR:= VERSION shr 8 and $ff; 63 | MICRO:= VERSION and $ff; 64 | writeln(format('LIB_AVCODEC: %s.dll %s', [LIB_AVCODEC, AV_VERSION(MAJOR, MINOR, MICRO)])); 65 | end; 66 | if System.SysUtils.FileExists(format('%s.dll', [LIB_AVFILTER])) then 67 | begin 68 | VERSION:=avfilter_version(); 69 | MAJOR:= VERSION shr 16; 70 | MINOR:= VERSION shr 8 and $ff; 71 | MICRO:= VERSION and $ff; 72 | writeln(format('LIB_AVFILTER: %s.dll %s', [LIB_AVFILTER, AV_VERSION(MAJOR, MINOR, MICRO)])); 73 | end; 74 | if System.SysUtils.FileExists(format('%s.dll', [LIB_AVDEVICE])) then 75 | begin 76 | VERSION:=avdevice_version(); 77 | MAJOR:= VERSION shr 16; 78 | MINOR:= VERSION shr 8 and $ff; 79 | MICRO:= VERSION and $ff; 80 | writeln(format('LIB_AVDEVICE: %s.dll %s', [LIB_AVDEVICE, AV_VERSION(MAJOR, MINOR, MICRO)])); 81 | end; 82 | if System.SysUtils.FileExists(format('%s.dll', [LIB_SWSCALE])) then 83 | begin 84 | VERSION:=swscale_version(); 85 | MAJOR:= VERSION shr 16; 86 | MINOR:= VERSION shr 8 and $ff; 87 | MICRO:= VERSION and $ff; 88 | writeln(format('LIB_SWSCALE: %s.dll %s', [LIB_SWSCALE, AV_VERSION(MAJOR, MINOR, MICRO)])); 89 | end; 90 | if System.SysUtils.FileExists(format('%s.dll', [LIB_SWRESAMPLE])) then 91 | begin 92 | VERSION:=swresample_version(); 93 | MAJOR:= VERSION shr 16; 94 | MINOR:= VERSION shr 8 and $ff; 95 | MICRO:= VERSION and $ff; 96 | writeln(format('LIB_SWRESAMPLE: %s.dll %s', [LIB_SWRESAMPLE, AV_VERSION(MAJOR, MINOR, MICRO)])); 97 | end; 98 | 99 | readln; 100 | 101 | except 102 | on E: Exception do 103 | Writeln(E.ClassName, ': ', E.Message); 104 | end; 105 | end. 106 | -------------------------------------------------------------------------------- /Examples/ffmpeg-examples/+version/Project1.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/ffmpeg-examples/+version/Project1.res -------------------------------------------------------------------------------- /Examples/ffmpeg-tutorial/tutorial01.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | tutorial01.c 3 | 4 | This tutorial was written by Stephen Dranger (dranger@gmail.com). 5 | 6 | Conversion to Delphi by Oleksandr Nazaruk (mail@freehand.com.ua) 7 | Tested on Windows 8.1 64bit rus, compiled with Delphi XE5 8 | 9 | A small sample program that shows how to use libavformat and libavcodec to 10 | read video from a file. 11 | 12 | Run using 13 | 14 | tutorial01 myvideofile.mpg 15 | 16 | to write the first five frames from "myvideofile.mpg" to disk in BMP 17 | format. 18 | *) 19 | 20 | program tutorial01; 21 | 22 | {$APPTYPE CONSOLE} 23 | 24 | {$R *.res} 25 | 26 | uses 27 | System.SysUtils, 28 | System.Classes, 29 | Winapi.Windows, 30 | VCL.Graphics, 31 | System.Math, 32 | SDL2 in '../../../../svn/uses/trunk/Pascal-SDL-2-Headers-master/SDL2.pas', 33 | avutil in '../../Include/libavutil/avutil.pas', 34 | avcodec in '../../Include/libavcodec/avcodec.pas', 35 | avformat in '../../Include/libavformat/avformat.pas', 36 | swresample in '../../Include/libswresample/swresample.pas', 37 | postprocess in '../../Include/libpostproc/postprocess.pas', 38 | avdevice in '../../Include/libavdevice/avdevice.pas', 39 | swscale in '../../Include/libswscale/swscale.pas'; 40 | 41 | procedure SaveFrame(pFrameRGB: PAVFrame; width: integer; height: integer; iFrame: integer); 42 | var 43 | bmp: TBitmap; 44 | i: integer; 45 | begin 46 | bmp := TBitmap.Create; 47 | try 48 | bmp.PixelFormat := pf32bit; 49 | bmp.Width := width; 50 | bmp.Height := height; 51 | 52 | for i := 0 to bmp.Height - 1 do 53 | CopyMemory ( bmp.ScanLine[i], pointer(integer(pFrameRGB.data[0]) + bmp.Width * 4 * i), bmp.Width * 4); 54 | 55 | bmp.SaveToFile(format('frame_%d.bmp', [iFrame])); 56 | finally 57 | bmp.free; 58 | end; 59 | end; 60 | 61 | var 62 | i, videoStream : integer; 63 | src_filename : ansistring; 64 | pFormatCtx : PAVFormatContext = nil; 65 | pCodecCtx : PAVCodecContext = nil; 66 | pCodec : PAVCodec = nil; 67 | optionsDict : PAVDictionary = nil; 68 | pFrame : PAVFrame = nil; 69 | pFrameRGB : PAVFrame = nil; 70 | packet : TAVPacket; 71 | frameFinished : integer; 72 | numBytes : integer; 73 | buffer : PByte = nil; 74 | sws_ctx : PSwsContext = nil; 75 | 76 | begin 77 | try 78 | if (ParamCount < 1) then 79 | begin 80 | writeln('Please provide a movie file'); 81 | exit; 82 | end; 83 | 84 | src_filename:=(AnsiString(ParamStr(1))); 85 | 86 | // Register all formats and codecs 87 | av_register_all(); 88 | 89 | // Open video file 90 | if (avformat_open_input(pFormatCtx, PAnsiChar(src_filename), nil, nil)<>0) then 91 | begin 92 | writeln(format('Could not open source file %s', [src_filename])); 93 | exit; 94 | end; 95 | 96 | // Retrieve stream information 97 | if avformat_find_stream_info(pFormatCtx , nil) < 0 then 98 | begin 99 | writeln(format('Could not find stream information', [])); 100 | exit; 101 | end; 102 | 103 | // Dump information about file onto standard error 104 | av_dump_format(pFormatCtx, 0, PAnsiChar(src_filename), 0); 105 | 106 | // Find the first video stream 107 | videoStream:=-1; 108 | for i:=0 to pFormatCtx.nb_streams-1 do 109 | begin 110 | if pFormatCtx.streams^.codec.codec_type = AVMEDIA_TYPE_VIDEO then 111 | begin 112 | videoStream := i; 113 | // Get a pointer to the codec context for the video stream 114 | pCodecCtx:=pFormatCtx.streams^.codec; 115 | break; 116 | end; 117 | inc(pFormatCtx.streams); 118 | end; 119 | 120 | if videoStream=-1 then 121 | begin 122 | writeln('Didn''t find a video stream'); 123 | exit; 124 | end; 125 | 126 | // Find the decoder for the video stream 127 | pCodec:=avcodec_find_decoder(pCodecCtx.codec_id); 128 | if not assigned(pCodec) then 129 | begin 130 | writeln('Unsupported codec!'); 131 | exit; 132 | end; 133 | 134 | // Open codec 135 | if avcodec_open2(pCodecCtx, pCodec, @optionsDict)<0 then 136 | begin 137 | writeln('Could not open codec'); 138 | exit; 139 | end; 140 | 141 | // Allocate video frame 142 | pFrame:=avcodec_alloc_frame; 143 | 144 | // Allocate an AVFrame structure 145 | pFrameRGB:=avcodec_alloc_frame(); 146 | if not assigned(pFrameRGB) then 147 | begin 148 | writeln('Could not allocate AVFrame structure'); 149 | exit; 150 | end; 151 | 152 | // Determine required buffer size and allocate buffer 153 | numBytes:=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx.width, pCodecCtx.height); 154 | buffer:=av_malloc(numBytes*sizeof(cardinal)); 155 | 156 | sws_ctx := 157 | sws_getContext 158 | ( 159 | pCodecCtx.width, 160 | pCodecCtx.height, 161 | pCodecCtx.pix_fmt, 162 | pCodecCtx.width, 163 | pCodecCtx.height, 164 | PIX_FMT_RGB32, 165 | SWS_BILINEAR, 166 | nil, 167 | nil, 168 | nil 169 | ); 170 | 171 | // Assign appropriate parts of buffer to image planes in pFrameRGB 172 | // Note that pFrameRGB is an AVFrame, but AVFrame is a superset 173 | // of AVPicture 174 | avpicture_fill(PAVPicture(pFrameRGB), buffer, PIX_FMT_RGB32, pCodecCtx.width, pCodecCtx.height); 175 | 176 | // Read frames and save first five frames to disk 177 | i:=0; 178 | while(av_read_frame(pFormatCtx, @packet)>=0) do 179 | begin 180 | // Is this a packet from the video stream? 181 | if(packet.stream_index=videoStream) then 182 | begin 183 | // Decode video frame 184 | avcodec_decode_video2(pCodecCtx, pFrame, frameFinished, @packet); 185 | 186 | // Did we get a video frame? 187 | if frameFinished>0 then 188 | begin 189 | // Convert the image from its native format to RGB 190 | sws_scale 191 | ( 192 | sws_ctx, 193 | @pFrame.data, 194 | @pFrame.linesize, 195 | 0, 196 | pCodecCtx.height, 197 | @pFrameRGB.data, 198 | @pFrameRGB.linesize 199 | ); 200 | 201 | // Save the frame to disk 202 | inc(i); 203 | if(i<=5) then 204 | begin 205 | SaveFrame(pFrameRGB, pCodecCtx.width, pCodecCtx.height, i); 206 | end; 207 | end; 208 | // Free the packet that was allocated by av_read_frame 209 | av_free_packet(@packet); 210 | end; 211 | end; 212 | 213 | // Free the RGB image 214 | av_free(buffer); 215 | av_free(pFrameRGB); 216 | 217 | // Free the YUV frame 218 | av_free(pFrame); 219 | 220 | // Close the codec 221 | avcodec_close(pCodecCtx); 222 | 223 | // Close the video file 224 | avformat_close_input(pFormatCtx); 225 | 226 | except 227 | on E: Exception do 228 | Writeln(E.ClassName, ': ', E.Message); 229 | end; 230 | end. 231 | 232 | 233 | 234 | 235 | -------------------------------------------------------------------------------- /Examples/ffmpeg-tutorial/tutorial01.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/ffmpeg-tutorial/tutorial01.res -------------------------------------------------------------------------------- /Examples/ffmpeg-tutorial/tutorial02.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | tutorial02.c 3 | A pedagogical video player that will stream through every video frame as fast as it can. 4 | 5 | This tutorial was written by Stephen Dranger (dranger@gmail.com). 6 | 7 | Code based on FFplay, Copyright (c) 2003 Fabrice Bellard, 8 | and a tutorial by Martin Bohme (boehme@inb.uni-luebeckREMOVETHIS.de) 9 | 10 | Conversion to Delphi by Oleksandr Nazaruk (mail@freehand.com.ua) 11 | Tested on Windows 8.1 64bit rus, compiled with Delphi XE5 12 | 13 | Run using 14 | 15 | tutorial02 myvideofile.mpg 16 | 17 | to play the video stream on your screen. 18 | *) 19 | 20 | program tutorial02; 21 | 22 | {$APPTYPE CONSOLE} 23 | 24 | {$R *.res} 25 | 26 | uses 27 | System.SysUtils, 28 | System.Classes, 29 | System.Math, 30 | SDL2 in '../../../../svn/uses/trunk/Pascal-SDL-2-Headers-master/SDL2.pas', 31 | avutil in '../../Include/libavutil/avutil.pas', 32 | avcodec in '../../Include/libavcodec/avcodec.pas', 33 | avformat in '../../Include/libavformat/avformat.pas', 34 | swresample in '../../Include/libswresample/swresample.pas', 35 | postprocess in '../../Include/libpostproc/postprocess.pas', 36 | avdevice in '../../Include/libavdevice/avdevice.pas', 37 | swscale in '../../Include/libswscale/swscale.pas'; 38 | 39 | 40 | var 41 | i, videoStream : integer; 42 | src_filename : ansistring; 43 | pFormatCtx : PAVFormatContext = nil; 44 | pCodecCtx : PAVCodecContext = nil; 45 | pCodec : PAVCodec = nil; 46 | optionsDict : PAVDictionary = nil; 47 | pFrame : PAVFrame = nil; 48 | pFrameYUV420P : PAVFrame = nil; 49 | packet : TAVPacket; 50 | frameFinished : integer; 51 | sws_ctx : PSwsContext = nil; 52 | numBytes : integer; 53 | buffer : PByte; 54 | screen : PSDL_Window = nil; 55 | texture : PSDL_texture = nil; 56 | render : PSDL_renderer = nil; 57 | event : TSDL_Event; 58 | pict : TAVPicture; 59 | 60 | begin 61 | try 62 | if (ParamCount < 1) then 63 | begin 64 | writeln('Please provide a movie file'); 65 | exit; 66 | end; 67 | 68 | src_filename:=(AnsiString(ParamStr(1))); 69 | 70 | if SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO or SDL_INIT_TIMER)<0 then 71 | begin 72 | writeln(format('Could not initialize SDL - %s', [SDL_GetError()])); 73 | exit; 74 | end; 75 | 76 | // Register all formats and codecs 77 | av_register_all(); 78 | 79 | // Open video file 80 | if (avformat_open_input(pFormatCtx, PAnsiChar(src_filename), nil, nil)<>0) then 81 | begin 82 | writeln(format('Could not open source file %s', [src_filename])); 83 | exit; 84 | end; 85 | 86 | // Retrieve stream information 87 | if avformat_find_stream_info(pFormatCtx , nil) < 0 then 88 | begin 89 | writeln(format('Could not find stream information', [])); 90 | exit; 91 | end; 92 | 93 | // Dump information about file onto standard error 94 | av_dump_format(pFormatCtx, 0, PAnsiChar(src_filename), 0); 95 | 96 | // Find the first video stream 97 | videoStream:=-1; 98 | for i:=0 to pFormatCtx.nb_streams-1 do 99 | begin 100 | if pFormatCtx.streams^.codec.codec_type = AVMEDIA_TYPE_VIDEO then 101 | begin 102 | videoStream := i; 103 | // Get a pointer to the codec context for the video stream 104 | pCodecCtx:=pFormatCtx.streams^.codec; 105 | break; 106 | end; 107 | inc(pFormatCtx.streams); 108 | end; 109 | 110 | if videoStream=-1 then 111 | begin 112 | writeln('Didn''t find a video stream'); 113 | exit; 114 | end; 115 | 116 | // Find the decoder for the video stream 117 | pCodec:=avcodec_find_decoder(pCodecCtx.codec_id); 118 | if not assigned(pCodec) then 119 | begin 120 | writeln('Unsupported codec!'); 121 | exit; 122 | end; 123 | 124 | // Open codec 125 | if avcodec_open2(pCodecCtx, pCodec, @optionsDict)<0 then 126 | begin 127 | writeln('Could not open codec'); 128 | exit; 129 | end; 130 | 131 | // Allocate video frame 132 | pFrame:=avcodec_alloc_frame; 133 | 134 | 135 | // Allocate an AVFrame structure 136 | pFrameYUV420P:=avcodec_alloc_frame(); 137 | if not assigned(pFrameYUV420P) then 138 | begin 139 | writeln('Could not Allocate AVFrame structure'); 140 | exit; 141 | end; 142 | 143 | // Determine required buffer size and allocate buffer 144 | numBytes:=avpicture_get_size(pCodecCtx.pix_fmt, pCodecCtx.width, pCodecCtx.height); 145 | buffer:=av_malloc(numBytes*sizeof(cardinal)); 146 | 147 | sws_ctx := 148 | sws_getContext 149 | ( 150 | pCodecCtx.width, 151 | pCodecCtx.height, 152 | pCodecCtx.pix_fmt, 153 | pCodecCtx.width, 154 | pCodecCtx.height, 155 | PIX_FMT_YUV420P, 156 | SWS_BILINEAR, 157 | nil, 158 | nil, 159 | nil 160 | ); 161 | 162 | // Assign appropriate parts of buffer to image planes in pFrameYUV420P 163 | // Note that pFrameRGB is an AVFrame, but AVFrame is a superset 164 | // of AVPicture 165 | avpicture_fill(PAVPicture(pFrameYUV420P), buffer, PIX_FMT_YUV420P, pCodecCtx.width, pCodecCtx.height); 166 | 167 | 168 | 169 | // Make a screen to put our video 170 | screen:=SDL_CreateWindow('Tutorial_02', SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, pCodecCtx.width, pCodecCtx.height, SDL_WINDOW_SHOWN ); 171 | if not assigned(screen) then 172 | begin 173 | writeln('SDL: could CreateWindow'); 174 | exit; 175 | end; 176 | 177 | render := SDL_CreateRenderer(screen, -1, 0); 178 | 179 | // Allocate a place to put our YUV image on that screen 180 | texture:=SDL_CreateTexture(render, SDL_PIXELFORMAT_YV12, sint32(SDL_TEXTUREACCESS_STREAMING), pCodecCtx.width, pCodecCtx.height); 181 | 182 | 183 | // Read frames and save first five frames to disk 184 | i:=0; 185 | while(av_read_frame(pFormatCtx, @packet)>=0) do 186 | begin 187 | // Is this a packet from the video stream? 188 | if(packet.stream_index=videoStream) then 189 | begin 190 | // Decode video frame 191 | avcodec_decode_video2(pCodecCtx, pFrame, frameFinished, @packet); 192 | 193 | // Did we get a video frame? 194 | if frameFinished>0 then 195 | begin 196 | 197 | pict.data[0] := pFrameYUV420P.data[0]; 198 | pict.data[1] := pFrameYUV420P.data[2]; 199 | pict.data[2] := pFrameYUV420P.data[1]; 200 | 201 | pict.linesize[0] := pFrameYUV420P.linesize[0]; 202 | pict.linesize[1] := pFrameYUV420P.linesize[2]; 203 | pict.linesize[2] := pFrameYUV420P.linesize[1]; 204 | 205 | 206 | // Convert the image into YUV format that SDL uses 207 | sws_scale 208 | ( 209 | sws_ctx, 210 | @pFrame.data, 211 | @pFrame.linesize, 212 | 0, 213 | pCodecCtx.height, 214 | @pict.data, 215 | @pict.linesize 216 | ); 217 | 218 | 219 | SDL_UpdateTexture(texture, nil, buffer, pCodecCtx.width); 220 | SDL_RenderClear(Render); 221 | SDL_RenderCopy(Render, texture, nil, nil); 222 | SDL_RenderPresent(Render); 223 | end; 224 | end; 225 | // Free the packet that was allocated by av_read_frame 226 | av_free_packet(@packet); 227 | 228 | SDL_PollEvent(@event); 229 | case event.type_ of 230 | SDL_QUITEV: 231 | begin 232 | SDL_Quit(); 233 | exit; 234 | end; 235 | end; 236 | end; 237 | 238 | // Free the pFrameYUV420P image 239 | av_free(buffer); 240 | av_free(pFrameYUV420P); 241 | 242 | // Free the YUV frame 243 | av_free(pFrame); 244 | 245 | // Close the codec 246 | avcodec_close(pCodecCtx); 247 | 248 | if assigned(texture) then 249 | begin 250 | SDL_DestroyRenderer(texture); 251 | texture := nil; 252 | end; 253 | 254 | if assigned(Render) then 255 | begin 256 | SDL_DestroyRenderer(Render); 257 | Render := nil; 258 | end; 259 | 260 | if assigned(screen) then 261 | begin 262 | SDL_DestroyWindow(screen); 263 | screen := nil; 264 | end; 265 | 266 | // Close the video file 267 | avformat_close_input(pFormatCtx); 268 | 269 | except 270 | on E: Exception do 271 | Writeln(E.ClassName, ': ', E.Message); 272 | end; 273 | end. 274 | 275 | 276 | 277 | 278 | -------------------------------------------------------------------------------- /Examples/ffmpeg-tutorial/tutorial02.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/ffmpeg-tutorial/tutorial02.res -------------------------------------------------------------------------------- /Examples/ffmpeg-tutorial/tutorial03.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/ffmpeg-tutorial/tutorial03.res -------------------------------------------------------------------------------- /Examples/ffmpeg-tutorial/tutorial04.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/ffmpeg-tutorial/tutorial04.res -------------------------------------------------------------------------------- /Examples/ffmpeg-tutorial/tutorial05.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/ffmpeg-tutorial/tutorial05.res -------------------------------------------------------------------------------- /Examples/ffmpeg-tutorial/tutorial06.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/ffmpeg-tutorial/tutorial06.res -------------------------------------------------------------------------------- /Examples/ffmpeg-tutorial/tutorial07.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/ffmpeg-delphi/08b120c2cca112447721f30de89c11c77541a9d7/Examples/ffmpeg-tutorial/tutorial07.res -------------------------------------------------------------------------------- /Include/libavcodec/version.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * 3 | * This file is part of FFmpeg. 4 | * 5 | * FFmpeg is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * FFmpeg is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with FFmpeg; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | *) 19 | 20 | {$IFNDEF AVCODEC_VERSION_H} 21 | {$define AVCODEC_VERSION_H} 22 | 23 | const 24 | 25 | LIB_AVCODEC = 'avcodec-56'; 26 | LIBAVCODEC_VERSION_MAJOR = 56; 27 | LIBAVCODEC_VERSION_MINOR = 60; 28 | LIBAVCODEC_VERSION_MICRO = 100; 29 | 30 | //LIBAVCODEC_VERSION = AV_VERSION(LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO); 31 | LIBAVCODEC_VERSION_INT =((LIBAVCODEC_VERSION_MAJOR shl 16) or (LIBAVCODEC_VERSION_MINOR shl 8) or LIBAVCODEC_VERSION_MICRO); 32 | LIBAVCODEC_BUILD = LIBAVCODEC_VERSION_INT; 33 | 34 | LIBAVCODEC_IDENT = 'Lavc'; 35 | 36 | (** 37 | * FF_API_* defines may be placed below to indicate public API that will be 38 | * dropped at a future version bump. The defines themselves are not part of 39 | * the public API and may change, break or disappear at any time. 40 | * 41 | * @note, when bumping the major version it is recommended to manually 42 | * disable each FF_API_* in its own commit instead of disabling them all 43 | * at once through the bump. This improves the git bisect-ability of the change. 44 | *) 45 | 46 | {$ifndef FF_API_VIMA_DECODER} 47 | FF_API_VIMA_DECODER = (LIBAVCODEC_VERSION_MAJOR < 57); 48 | {$endif} 49 | 50 | {$ifndef FF_API_REQUEST_CHANNELS} 51 | FF_API_REQUEST_CHANNELS = (LIBAVCODEC_VERSION_MAJOR < 57); 52 | {$endif} 53 | 54 | {$ifndef FF_API_OLD_DECODE_AUDIO} 55 | FF_API_OLD_DECODE_AUDIO = (LIBAVCODEC_VERSION_MAJOR < 57); 56 | {$endif} 57 | 58 | {$ifndef FF_API_OLD_ENCODE_AUDIO} 59 | FF_API_OLD_ENCODE_AUDIO = (LIBAVCODEC_VERSION_MAJOR < 57); 60 | {$endif} 61 | 62 | {$ifndef FF_API_OLD_ENCODE_VIDEO} 63 | FF_API_OLD_ENCODE_VIDEO = (LIBAVCODEC_VERSION_MAJOR < 57); 64 | {$endif} 65 | 66 | {$ifndef FF_API_CODEC_ID} 67 | FF_API_CODEC_ID = (LIBAVCODEC_VERSION_MAJOR < 57); 68 | {$endif} 69 | 70 | {$ifndef FF_API_AUDIO_CONVERT} 71 | FF_API_AUDIO_CONVERT = (LIBAVCODEC_VERSION_MAJOR < 57); 72 | {$endif} 73 | 74 | {$ifndef FF_API_AVCODEC_RESAMPLE} 75 | FF_API_AVCODEC_RESAMPLE = FF_API_AUDIO_CONVERT; 76 | {$endif} 77 | 78 | {$ifndef FF_API_DEINTERLACE} 79 | FF_API_DEINTERLACE = (LIBAVCODEC_VERSION_MAJOR < 57); 80 | {$endif} 81 | 82 | {$ifndef FF_API_DESTRUCT_PACKET} 83 | FF_API_DESTRUCT_PACKET = (LIBAVCODEC_VERSION_MAJOR < 57); 84 | {$endif} 85 | 86 | {$ifndef FF_API_GET_BUFFER} 87 | FF_API_GET_BUFFER = (LIBAVCODEC_VERSION_MAJOR < 57); 88 | {$endif} 89 | 90 | {$ifndef FF_API_MISSING_SAMPLE} 91 | FF_API_MISSING_SAMPLE = (LIBAVCODEC_VERSION_MAJOR < 57); 92 | {$endif} 93 | {$ifndef FF_API_LOWRES} 94 | FF_API_LOWRES = (LIBAVCODEC_VERSION_MAJOR < 57); 95 | {$endif} 96 | 97 | {$ifndef FF_API_CAP_VDPAU} 98 | FF_API_CAP_VDPAU = (LIBAVCODEC_VERSION_MAJOR < 57); 99 | {$endif} 100 | 101 | {$ifndef FF_API_BUFS_VDPAU} 102 | FF_API_BUFS_VDPAU = (LIBAVCODEC_VERSION_MAJOR < 57); 103 | {$endif} 104 | 105 | {$ifndef FF_API_VOXWARE} 106 | FF_API_VOXWARE = (LIBAVCODEC_VERSION_MAJOR < 57); 107 | {$endif} 108 | 109 | {$ifndef FF_API_SET_DIMENSIONS} 110 | FF_API_SET_DIMENSIONS = (LIBAVCODEC_VERSION_MAJOR < 57); 111 | {$endif} 112 | 113 | {$ifndef FF_API_DEBUG_MV} 114 | FF_API_DEBUG_MV = (LIBAVCODEC_VERSION_MAJOR < 57); 115 | {$endif} 116 | 117 | {$ifndef FF_API_AC_VLC} 118 | FF_API_AC_VLC = (LIBAVCODEC_VERSION_MAJOR < 57); 119 | {$endif} 120 | 121 | {$ifndef FF_API_OLD_MSMPEG4} 122 | FF_API_OLD_MSMPEG4 = (LIBAVCODEC_VERSION_MAJOR < 57); 123 | {$endif} 124 | 125 | {$ifndef FF_API_ASPECT_EXTENDED} 126 | FF_API_ASPECT_EXTENDED = (LIBAVCODEC_VERSION_MAJOR < 57); 127 | {$endif} 128 | 129 | {$ifndef FF_API_THREAD_OPAQUE} 130 | FF_API_THREAD_OPAQUE = (LIBAVCODEC_VERSION_MAJOR < 57); 131 | {$endif} 132 | 133 | {$ifndef FF_API_CODEC_PKT} 134 | FF_API_CODEC_PKT = (LIBAVCODEC_VERSION_MAJOR < 57); 135 | {$endif} 136 | 137 | {$ifndef FF_API_ARCH_ALPHA} 138 | FF_API_ARCH_ALPHA = (LIBAVCODEC_VERSION_MAJOR < 57); 139 | {$endif} 140 | 141 | {$ifndef FF_API_XVMC} 142 | FF_API_XVMC = (LIBAVCODEC_VERSION_MAJOR < 57); 143 | {$endif} 144 | 145 | {$ifndef FF_API_ERROR_RATE} 146 | FF_API_ERROR_RATE = (LIBAVCODEC_VERSION_MAJOR < 57); 147 | {$endif} 148 | 149 | {$ifndef FF_API_QSCALE_TYPE} 150 | FF_API_QSCALE_TYPE = (LIBAVCODEC_VERSION_MAJOR < 57); 151 | {$endif} 152 | 153 | {$ifndef FF_API_MB_TYPE} 154 | FF_API_MB_TYPE = (LIBAVCODEC_VERSION_MAJOR < 57); 155 | {$endif} 156 | 157 | {$ifndef FF_API_MAX_BFRAMES} 158 | FF_API_MAX_BFRAMES = (LIBAVCODEC_VERSION_MAJOR < 57); 159 | {$endif} 160 | 161 | {$ifndef FF_API_NEG_LINESIZES} 162 | FF_API_NEG_LINESIZES = (LIBAVCODEC_VERSION_MAJOR < 57); 163 | {$endif} 164 | 165 | {$ifndef FF_API_EMU_EDGE} 166 | FF_API_EMU_EDGE = (LIBAVCODEC_VERSION_MAJOR < 57); 167 | {$endif} 168 | 169 | {$ifndef FF_API_ARCH_SH4} 170 | FF_API_ARCH_SH4 = (LIBAVCODEC_VERSION_MAJOR < 57); 171 | {$endif} 172 | 173 | {$ifndef FF_API_ARCH_SPARC} 174 | FF_API_ARCH_SPARC = (LIBAVCODEC_VERSION_MAJOR < 57); 175 | {$endif} 176 | 177 | {$ifndef FF_API_UNUSED_MEMBERS} 178 | FF_API_UNUSED_MEMBERS = (LIBAVCODEC_VERSION_MAJOR < 57); 179 | {$endif} 180 | 181 | {$ifndef FF_API_IDCT_XVIDMMX} 182 | FF_API_IDCT_XVIDMMX = (LIBAVCODEC_VERSION_MAJOR < 57); 183 | {$endif} 184 | 185 | {$ifndef FF_API_INPUT_PRESERVED} 186 | FF_API_INPUT_PRESERVED = (LIBAVCODEC_VERSION_MAJOR < 57); 187 | {$endif} 188 | 189 | {$ifndef FF_API_NORMALIZE_AQP} 190 | FF_API_NORMALIZE_AQP = (LIBAVCODEC_VERSION_MAJOR < 57); 191 | {$endif} 192 | 193 | {$ifndef FF_API_GMC} 194 | FF_API_GMC = (LIBAVCODEC_VERSION_MAJOR < 57); 195 | {$endif} 196 | 197 | {$ifndef FF_API_MV0} 198 | FF_API_MV0 = (LIBAVCODEC_VERSION_MAJOR < 57); 199 | {$endif} 200 | 201 | {$ifndef FF_API_CODEC_NAME} 202 | FF_API_CODEC_NAME = (LIBAVCODEC_VERSION_MAJOR < 57); 203 | {$endif} 204 | 205 | {$ifndef FF_API_AFD} 206 | FF_API_AFD = (LIBAVCODEC_VERSION_MAJOR < 57); 207 | {$endif} 208 | 209 | {$IFNDEF FF_API_VISMV} 210 | (* XXX: don't forget to drop the -vismv documentation *) 211 | FF_API_VISMV = (LIBAVCODEC_VERSION_MAJOR < 57); 212 | {$ENDIF} 213 | {$IFNDEF FF_API_DV_FRAME_PROFILE} 214 | FF_API_DV_FRAME_PROFILE = (LIBAVCODEC_VERSION_MAJOR < 57); 215 | {$ENDIF} 216 | {$IFNDEF FF_API_AUDIOENC_DELAY} 217 | FF_API_AUDIOENC_DELAY = (LIBAVCODEC_VERSION_MAJOR < 58); 218 | {$ENDIF} 219 | {$IFNDEF FF_API_VAAPI_CONTEXT} 220 | FF_API_VAAPI_CONTEXT = (LIBAVCODEC_VERSION_MAJOR < 58); 221 | {$ENDIF} 222 | {$IFNDEF FF_API_AVCTX_TIMEBASE} 223 | FF_API_AVCTX_TIMEBASE = (LIBAVCODEC_VERSION_MAJOR < 59); 224 | {$ENDIF} 225 | {$IFNDEF FF_API_MPV_OPT} 226 | FF_API_MPV_OPT = (LIBAVCODEC_VERSION_MAJOR < 59); 227 | {$ENDIF} 228 | {$IFNDEF FF_API_STREAM_CODEC_TAG} 229 | FF_API_STREAM_CODEC_TAG = (LIBAVCODEC_VERSION_MAJOR < 59); 230 | {$ENDIF} 231 | {$IFNDEF FF_API_QUANT_BIAS} 232 | FF_API_QUANT_BIAS = (LIBAVCODEC_VERSION_MAJOR < 59); 233 | {$ENDIF} 234 | {$IFNDEF FF_API_RC_STRATEGY} 235 | FF_API_RC_STRATEGY = (LIBAVCODEC_VERSION_MAJOR < 59); 236 | {$ENDIF} 237 | {$IFNDEF FF_API_CODED_FRAME} 238 | FF_API_CODED_FRAME = (LIBAVCODEC_VERSION_MAJOR < 59); 239 | {$ENDIF} 240 | {$IFNDEF FF_API_MOTION_EST} 241 | FF_API_MOTION_EST = (LIBAVCODEC_VERSION_MAJOR < 59); 242 | {$ENDIF} 243 | {$IFNDEF FF_API_WITHOUT_PREFIX} 244 | FF_API_WITHOUT_PREFIX = (LIBAVCODEC_VERSION_MAJOR < 59); 245 | {$ENDIF} 246 | 247 | 248 | {$ENDIF} (* AVCODEC_VERSION_H *) 249 | -------------------------------------------------------------------------------- /Include/libavdevice/version.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | {$ifndef AVDEVICE_VERSION_H} 20 | {$define AVDEVICE_VERSION_H} 21 | 22 | const 23 | 24 | LIB_AVDEVICE = 'avdevice-56'; 25 | LIBAVDEVICE_VERSION_MAJOR = 56; 26 | LIBAVDEVICE_VERSION_MINOR = 4; 27 | LIBAVDEVICE_VERSION_MICRO = 100; 28 | //LIBAVDEVICE_VERSION = AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO); 29 | LIBAVDEVICE_VERSION_INT = ((LIBAVDEVICE_VERSION_MAJOR shl 16) or (LIBAVDEVICE_VERSION_MINOR shl 8) or LIBAVDEVICE_VERSION_MICRO); 30 | LIBAVDEVICE_BUILD = LIBAVDEVICE_VERSION_INT; 31 | LIBAVDEVICE_IDENT = 'Lavd'; 32 | 33 | (** 34 | * FF_API_* defines may be placed below to indicate public API that will be 35 | * dropped at a future version bump. The defines themselves are not part of 36 | * the public API and may change, break or disappear at any time. 37 | *) 38 | 39 | {$endif} (* AVDEVICE_VERSION_H *) 40 | 41 | 42 | -------------------------------------------------------------------------------- /Include/libavfilter/asrc_abuffer.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | {$ifndef AVFILTER_ASRC_ABUFFER_H} 20 | {$define AVFILTER_ASRC_ABUFFER_H} 21 | 22 | 23 | (** 24 | * @file 25 | * memory buffer source for audio 26 | * 27 | * @deprecated use buffersrc.h instead. 28 | *) 29 | 30 | (** 31 | * Queue an audio buffer to the audio buffer source. 32 | * 33 | * @param abuffersrc audio source buffer context 34 | * @param data pointers to the samples planes 35 | * @param linesize linesizes of each audio buffer plane 36 | * @param nb_samples number of samples per channel 37 | * @param sample_fmt sample format of the audio data 38 | * @param ch_layout channel layout of the audio data 39 | * @param planar flag to indicate if audio data is planar or packed 40 | * @param pts presentation timestamp of the audio buffer 41 | * @param flags unused 42 | * 43 | * @deprecated use av_buffersrc_add_ref() instead. 44 | *) 45 | function av_asrc_buffer_add_samples(abuffersrc: PAVFilterContext; 46 | data: P8PByteArray; linesize : T8IntegerArray; 47 | nb_samples: integer; sample_rate: integer; 48 | sample_fmt: integer; ch_layout: int64; planar: integer; 49 | pts : int64; flags: integer = 0): integer; deprecated 'use av_buffersrc_add_ref() instead'; 50 | cdecl; external LIB_AVFILTER; 51 | 52 | (** 53 | * Queue an audio buffer to the audio buffer source. 54 | * 55 | * This is similar to av_asrc_buffer_add_samples(), but the samples 56 | * are stored in a buffer with known size. 57 | * 58 | * @param abuffersrc audio source buffer context 59 | * @param buf pointer to the samples data, packed is assumed 60 | * @param size the size in bytes of the buffer, it must contain an 61 | * integer number of samples 62 | * @param sample_fmt sample format of the audio data 63 | * @param ch_layout channel layout of the audio data 64 | * @param pts presentation timestamp of the audio buffer 65 | * @param flags unused 66 | * 67 | * @deprecated use av_buffersrc_add_ref() instead. 68 | *) 69 | function av_asrc_buffer_add_buffer(abuffersrc: PAVFilterContext; 70 | buf: PByte; buf_size: integer; 71 | sample_rate: integer; 72 | sample_fmt: integer; ch_layout: int64; planar: integer; 73 | pts : int64; flags: integer = 0): integer; deprecated 'use av_buffersrc_add_ref() instead' 74 | cdecl; external LIB_AVFILTER; 75 | 76 | (** 77 | * Queue an audio buffer to the audio buffer source. 78 | * 79 | * @param abuffersrc audio source buffer context 80 | * @param samplesref buffer ref to queue 81 | * @param flags unused 82 | * 83 | * @deprecated use av_buffersrc_add_ref() instead. 84 | *) 85 | function av_asrc_buffer_add_audio_buffer_ref(abuffersrc: PAVFilterContext; 86 | samplesref: PAVFilterBufferRef; 87 | flags: integer = 0): integer; deprecated 'use av_buffersrc_add_ref() instead'; 88 | cdecl; external LIB_AVFILTER; 89 | 90 | {$endif} (* AVFILTER_ASRC_ABUFFER_H *) 91 | -------------------------------------------------------------------------------- /Include/libavfilter/avcodec_filter.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | {$ifndef AVFILTER_AVCODEC_H} 20 | {$define AVFILTER_AVCODEC_H} 21 | 22 | (** 23 | * @file 24 | * libavcodec/libavfilter gluing utilities 25 | * 26 | * This should be included in an application ONLY if the installed 27 | * libavfilter has been compiled with libavcodec support, otherwise 28 | * symbols defined below will not be available. 29 | *) 30 | 31 | 32 | 33 | {$IF FF_API_AVFILTERBUFFER} 34 | (** 35 | * Create and return a picref reference from the data and properties 36 | * contained in frame. 37 | * 38 | * @param perms permissions to assign to the new buffer reference 39 | * @deprecated avfilter APIs work natively with AVFrame instead. 40 | *) 41 | function avfilter_get_video_buffer_ref_from_frame(const frame: PAVFrame; perms: integer): PAVFilterBufferRef; deprecated 'avfilter APIs work natively with AVFrame instead'; 42 | cdecl; external LIB_AVFILTER; 43 | 44 | 45 | (** 46 | * Create and return a picref reference from the data and properties 47 | * contained in frame. 48 | * 49 | * @param perms permissions to assign to the new buffer reference 50 | * @deprecated avfilter APIs work natively with AVFrame instead. 51 | *) 52 | function avfilter_get_audio_buffer_ref_from_frame(const frame: PAVFrame; 53 | perms: integer): PAVFilterBufferRef; deprecated 'avfilter APIs work natively with AVFrame instead'; 54 | cdecl; external LIB_AVFILTER; 55 | 56 | (** 57 | * Create and return a buffer reference from the data and properties 58 | * contained in frame. 59 | * 60 | * @param perms permissions to assign to the new buffer reference 61 | * @deprecated avfilter APIs work natively with AVFrame instead. 62 | *) 63 | function avfilter_get_buffer_ref_from_frame(type_ : TAVMediaType; 64 | const frame: PAVFrame; 65 | perms: integer): PAVFilterBufferRef; deprecated 'avfilter APIs work natively with AVFrame instead'; 66 | cdecl; external LIB_AVFILTER; 67 | {$ENDIF} 68 | 69 | {$endif} (* AVFILTER_AVCODEC_H *) 70 | -------------------------------------------------------------------------------- /Include/libavfilter/buffersink.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | {$ifndef AVFILTER_BUFFERSINK_H} 20 | {$define AVFILTER_BUFFERSINK_H} 21 | 22 | (** 23 | * @file 24 | * @ingroup lavfi_buffersink 25 | * memory buffer sink API for audio and video 26 | *) 27 | 28 | 29 | (** 30 | * @defgroup lavfi_buffersink Buffer sink API 31 | * @ingroup lavfi 32 | * @{ 33 | *) 34 | 35 | {$IF FF_API_AVFILTERBUFFER} 36 | (** 37 | * Get an audio/video buffer data from buffer_sink and put it in bufref. 38 | * 39 | * This function works with both audio and video buffer sinks. 40 | * 41 | * @param buffer_sink pointer to a buffersink or abuffersink context 42 | * @param flags a combination of AV_BUFFERSINK_FLAG_* flags 43 | * @return >= 0 in case of success, a negative AVERROR code in case of 44 | * failure 45 | *) 46 | function av_buffersink_get_buffer_ref(buffer_sink: PAVFilterContext; 47 | var bufref: PAVFilterBufferRef; flags: integer): integer; deprecated ''; 48 | cdecl; external LIB_AVFILTER; 49 | 50 | (** 51 | * Get the number of immediately available frames. 52 | *) 53 | function av_buffersink_poll_frame(ctx: PAVFilterContext): integer; deprecated ''; 54 | cdecl; external LIB_AVFILTER; 55 | 56 | (** 57 | * Get a buffer with filtered data from sink and put it in buf. 58 | * 59 | * @param ctx pointer to a context of a buffersink or abuffersink AVFilter. 60 | * @param buf pointer to the buffer will be written here if buf is non-NULL. buf 61 | * must be freed by the caller using avfilter_unref_buffer(). 62 | * Buf may also be NULL to query whether a buffer is ready to be 63 | * output. 64 | * 65 | * @return >= 0 in case of success, a negative AVERROR code in case of 66 | * failure. 67 | *) 68 | function av_buffersink_read(ctx: PAVFilterContext; var buf: PAVFilterBufferRef): integer; deprecated ''; 69 | cdecl; external LIB_AVFILTER; 70 | 71 | (** 72 | * Same as av_buffersink_read, but with the ability to specify the number of 73 | * samples read. This function is less efficient than av_buffersink_read(), 74 | * because it copies the data around. 75 | * 76 | * @param ctx pointer to a context of the abuffersink AVFilter. 77 | * @param buf pointer to the buffer will be written here if buf is non-NULL. buf 78 | * must be freed by the caller using avfilter_unref_buffer(). buf 79 | * will contain exactly nb_samples audio samples, except at the end 80 | * of stream, when it can contain less than nb_samples. 81 | * Buf may also be NULL to query whether a buffer is ready to be 82 | * output. 83 | * 84 | * @warning do not mix this function with av_buffersink_read(). Use only one or 85 | * the other with a single sink, not both. 86 | *) 87 | function av_buffersink_read_samples(ctx: PAVFilterContext; var buf: PAVFilterBufferRef; 88 | nb_samples: integer): integer; deprecated ''; 89 | cdecl; external LIB_AVFILTER; 90 | {$ENDIF} 91 | 92 | (** 93 | * Get a frame with filtered data from sink and put it in frame. 94 | * 95 | * @param ctx pointer to a buffersink or abuffersink filter context. 96 | * @param frame pointer to an allocated frame that will be filled with data. 97 | * The data must be freed using av_frame_unref() / av_frame_free() 98 | * @param flags a combination of AV_BUFFERSINK_FLAG_* flags 99 | * 100 | * @return >= 0 in for success, a negative AVERROR code for failure. 101 | *) 102 | function av_buffersink_get_frame_flags(ctx: PAVFilterContext; frame: PAVFrame; flags: integer): integer; 103 | cdecl; external LIB_AVFILTER; 104 | 105 | const 106 | (** 107 | * Tell av_buffersink_get_buffer_ref() to read video/samples buffer 108 | * reference, but not remove it from the buffer. This is useful if you 109 | * need only to read a video/samples buffer, without to fetch it. 110 | *) 111 | AV_BUFFERSINK_FLAG_PEEK = 1; 112 | 113 | (** 114 | * Tell av_buffersink_get_buffer_ref() not to request a frame from its input. 115 | * If a frame is already buffered, it is read (and removed from the buffer), 116 | * but if no frame is present, return AVERROR(EAGAIN). 117 | *) 118 | AV_BUFFERSINK_FLAG_NO_REQUEST = 2; 119 | 120 | (** 121 | * Struct to use for initializing a buffersink context. 122 | *) 123 | type 124 | PAVBufferSinkParams = ^TAVBufferSinkParams; 125 | TAVBufferSinkParams = record 126 | pixel_fmts : PAVPixelFormat; ///< list of allowed pixel formats, terminated by AV_PIX_FMT_NONE 127 | end; 128 | 129 | (** 130 | * Create an AVBufferSinkParams structure. 131 | * 132 | * Must be freed with av_free(). 133 | *) 134 | function av_buffersink_params_alloc(): PAVBufferSinkParams; 135 | cdecl; external LIB_AVFILTER; 136 | 137 | (** 138 | * Struct to use for initializing an abuffersink context. 139 | *) 140 | type 141 | PAVABufferSinkParams = ^TAVABufferSinkParams; 142 | TAVABufferSinkParams = record 143 | sample_fmts : PAVSampleFormat; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE 144 | channel_layouts : PInt64; ///< list of allowed channel layouts, terminated by -1 145 | channel_counts : PInteger; ///< list of allowed channel counts, terminated by -1 146 | all_channel_counts : integer; ///< if not 0, accept any channel count or layout 147 | sample_rates : PInteger; ///< list of allowed sample rates, terminated by -1 148 | end; 149 | 150 | (** 151 | * Create an AVABufferSinkParams structure. 152 | * 153 | * Must be freed with av_free(). 154 | *) 155 | function av_abuffersink_params_alloc(): PAVABufferSinkParams; 156 | cdecl; external LIB_AVFILTER; 157 | 158 | (** 159 | * Set the frame size for an audio buffer sink. 160 | * 161 | * All calls to av_buffersink_get_buffer_ref will return a buffer with 162 | * exactly the specified number of samples, or AVERROR(EAGAIN) if there is 163 | * not enough. The last buffer at EOF will be padded with 0. 164 | *) 165 | procedure av_buffersink_set_frame_size(ctx: PAVFilterContext; frame_size: cardinal); 166 | cdecl; external LIB_AVFILTER; 167 | 168 | (** 169 | * Get the frame rate of the input. 170 | *) 171 | function av_buffersink_get_frame_rate(ctx: PAVFilterContext): TAVRational; 172 | cdecl; external LIB_AVFILTER; 173 | 174 | (** 175 | * Get a frame with filtered data from sink and put it in frame. 176 | * 177 | * @param ctx pointer to a context of a buffersink or abuffersink AVFilter. 178 | * @param frame pointer to an allocated frame that will be filled with data. 179 | * The data must be freed using av_frame_unref() / av_frame_free() 180 | * 181 | * @return 182 | * - >= 0 if a frame was successfully returned. 183 | * - AVERROR(EAGAIN) if no frames are available at this point; more 184 | * input frames must be added to the filtergraph to get more output. 185 | * - AVERROR_EOF if there will be no more output frames on this sink. 186 | * - A different negative AVERROR code in other failure cases. 187 | *) 188 | function av_buffersink_get_frame(ctx: PAVFilterContext; frame: PAVFrame): integer; 189 | cdecl; external LIB_AVFILTER; (* verified: mail@freehand.com.ua, 2014-09-15: + *) 190 | 191 | (** 192 | * Same as av_buffersink_get_frame(), but with the ability to specify the number 193 | * of samples read. This function is less efficient than 194 | * av_buffersink_get_frame(), because it copies the data around. 195 | * 196 | * @param ctx pointer to a context of the abuffersink AVFilter. 197 | * @param frame pointer to an allocated frame that will be filled with data. 198 | * The data must be freed using av_frame_unref() / av_frame_free() 199 | * frame will contain exactly nb_samples audio samples, except at 200 | * the end of stream, when it can contain less than nb_samples. 201 | * 202 | * @return The return codes have the same meaning as for 203 | * av_buffersink_get_samples(). 204 | * 205 | * @warning do not mix this function with av_buffersink_get_frame(). Use only one or 206 | * the other with a single sink, not both. 207 | *) 208 | function av_buffersink_get_samples(ctx: PAVFilterContext; frame:PAVFrame; nb_samples: integer): integer; 209 | cdecl; external LIB_AVFILTER; 210 | 211 | (** 212 | * @} 213 | *) 214 | 215 | {$endif} (* AVFILTER_BUFFERSINK_H *) 216 | -------------------------------------------------------------------------------- /Include/libavfilter/buffersrc.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * 3 | * This file is part of FFmpeg. 4 | * 5 | * FFmpeg is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * FFmpeg is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with FFmpeg; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | *) 19 | 20 | {$ifndef AVFILTER_BUFFERSRC_H} 21 | {$define AVFILTER_BUFFERSRC_H} 22 | 23 | (** 24 | * @file 25 | * @ingroup lavfi_buffersrc 26 | * Memory buffer source API. 27 | *) 28 | 29 | 30 | (** 31 | * @defgroup lavfi_buffersrc Buffer source API 32 | * @ingroup lavfi 33 | * @{ 34 | *) 35 | 36 | type 37 | TAV_BUFFERSRC_FLAG = ( 38 | 39 | (** 40 | * Do not check for format changes. 41 | *) 42 | AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT = 1, 43 | 44 | {$IF FF_API_AVFILTERBUFFER} 45 | (** 46 | * Ignored 47 | *) 48 | AV_BUFFERSRC_FLAG_NO_COPY = 2, 49 | {$ENDIF} 50 | 51 | (** 52 | * Immediately push the frame to the output. 53 | *) 54 | AV_BUFFERSRC_FLAG_PUSH = 4, 55 | 56 | (** 57 | * Keep a reference to the frame. 58 | * If the frame if reference-counted, create a new reference; otherwise 59 | * copy the frame data. 60 | *) 61 | AV_BUFFERSRC_FLAG_KEEP_REF = 8 62 | 63 | ); 64 | 65 | {$IF FF_API_AVFILTERBUFFER} 66 | (** 67 | * Add buffer data in picref to buffer_src. 68 | * 69 | * @param buffer_src pointer to a buffer source context 70 | * @param picref a buffer reference, or NULL to mark EOF 71 | * @param flags a combination of AV_BUFFERSRC_FLAG_* 72 | * @return >= 0 in case of success, a negative AVERROR code 73 | * in case of failure 74 | *) 75 | function av_buffersrc_add_ref(buffer_src: PAVFilterContext; 76 | picref: PAVFilterBufferRef; flags: integer): integer; 77 | cdecl; external LIB_AVFILTER; deprecated; 78 | {$ENDIF} 79 | 80 | (** 81 | * Get the number of failed requests. 82 | * 83 | * A failed request is when the request_frame method is called while no 84 | * frame is present in the buffer. 85 | * The number is reset when a frame is added. 86 | *) 87 | function av_buffersrc_get_nb_failed_requests(buffer_src: PAVFilterContext): cardinal; 88 | cdecl; external LIB_AVFILTER; 89 | 90 | {$IF FF_API_AVFILTERBUFFER} 91 | (** 92 | * Add a buffer to a filtergraph. 93 | * 94 | * @param ctx an instance of the buffersrc filter 95 | * @param buf buffer containing frame data to be passed down the filtergraph. 96 | * This function will take ownership of buf, the user must not free it. 97 | * A NULL buf signals EOF -- i.e. no more frames will be sent to this filter. 98 | * 99 | * @deprecated use av_buffersrc_write_frame() or av_buffersrc_add_frame() 100 | *) 101 | function av_buffersrc_buffer(ctx: PAVFilterContext; buf: PAVFilterBufferRef): integer; deprecated 'use av_buffersrc_write_frame() or av_buffersrc_add_frame()'; 102 | cdecl; external LIB_AVFILTER; 103 | {$ENDIF} 104 | 105 | (** 106 | * Add a frame to the buffer source. 107 | * 108 | * @param ctx an instance of the buffersrc filter 109 | * @param frame frame to be added. If the frame is reference counted, this 110 | * function will make a new reference to it. Otherwise the frame data will be 111 | * copied. 112 | * 113 | * @return 0 on success, a negative AVERROR on error 114 | * 115 | * This function is equivalent to av_buffersrc_add_frame_flags() with the 116 | * AV_BUFFERSRC_FLAG_KEEP_REF flag. 117 | *) 118 | function av_buffersrc_write_frame(ctx: PAVFilterContext; const frame: PAVFrame): integer; 119 | cdecl; external LIB_AVFILTER; 120 | 121 | (** 122 | * Add a frame to the buffer source. 123 | * 124 | * @param ctx an instance of the buffersrc filter 125 | * @param frame frame to be added. If the frame is reference counted, this 126 | * function will take ownership of the reference(s) and reset the frame. 127 | * Otherwise the frame data will be copied. If this function returns an error, 128 | * the input frame is not touched. 129 | * 130 | * @return 0 on success, a negative AVERROR on error. 131 | * 132 | * @note the difference between this function and av_buffersrc_write_frame() is 133 | * that av_buffersrc_write_frame() creates a new reference to the input frame, 134 | * while this function takes ownership of the reference passed to it. 135 | * 136 | * This function is equivalent to av_buffersrc_add_frame_flags() without the 137 | * AV_BUFFERSRC_FLAG_KEEP_REF flag. 138 | *) 139 | function av_buffersrc_add_frame(ctx: PAVFilterContext; frame: PAVFrame): integer; 140 | cdecl; external LIB_AVFILTER; 141 | 142 | (** 143 | * Add a frame to the buffer source. 144 | * 145 | * By default, if the frame is reference-counted, this function will take 146 | * ownership of the reference(s) and reset the frame. This can be controlled 147 | * using the flags. 148 | * 149 | * If this function returns an error, the input frame is not touched. 150 | * 151 | * @param buffer_src pointer to a buffer source context 152 | * @param frame a frame, or NULL to mark EOF 153 | * @param flags a combination of AV_BUFFERSRC_FLAG_* 154 | * @return >= 0 in case of success, a negative AVERROR code 155 | * in case of failure 156 | *) 157 | function av_buffersrc_add_frame_flags(buffer_src: PAVFilterContext; 158 | frame: PAVFrame; flags: integer): integer; 159 | cdecl; external LIB_AVFILTER; (* verified: mail@freehand.com.ua, 2014-09-15: + *) 160 | 161 | (** 162 | * @} 163 | *) 164 | 165 | {$endif} (* AVFILTER_BUFFERSRC_H *) 166 | -------------------------------------------------------------------------------- /Include/libavfilter/version.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *) 20 | 21 | {$ifndef AVFILTER_VERSION_H} 22 | {$define AVFILTER_VERSION_H} 23 | 24 | (** 25 | * @file 26 | * @ingroup lavfi 27 | * Libavfilter version macros 28 | *) 29 | 30 | const 31 | 32 | LIB_AVFILTER = 'avfilter-5'; 33 | LIBAVFILTER_VERSION_MAJOR = 5; 34 | LLIBAVFILTER_VERSION_MINOR = 40; 35 | LIBAVFILTER_VERSION_MICRO = 101; 36 | //LIBAVFILTER_VERSION = AV_VERSION(LIBAVFILTER_VERSION_MAJOR, LLIBAVFILTER_VERSION_MINOR, LIBAVFILTER_VERSION_MICRO); 37 | LIBAVFILTER_VERSION_INT = ((LIBAVFILTER_VERSION_MAJOR shl 16) or (LLIBAVFILTER_VERSION_MINOR shl 8) or LIBAVFILTER_VERSION_MICRO); 38 | LIBAVFILTER_BUILD = LIBAVFILTER_VERSION_INT; 39 | LIBAVFILTER_IDENT = 'Lavfi'; 40 | 41 | (** 42 | * FF_API_* defines may be placed below to indicate public API that will be 43 | * dropped at a future version bump. The defines themselves are not part of 44 | * the public API and may change, break or disappear at any time. 45 | *) 46 | 47 | {$ifndef FF_API_AVFILTERPAD_PUBLIC} 48 | FF_API_AVFILTERPAD_PUBLIC = (LIBAVFILTER_VERSION_MAJOR < 6); 49 | {$endif} 50 | {$ifndef FF_API_FOO_COUNT} 51 | FF_API_FOO_COUNT = (LIBAVFILTER_VERSION_MAJOR < 6); 52 | {$endif} 53 | {$ifndef FF_API_AVFILTERBUFFER} 54 | FF_API_AVFILTERBUFFER = (LIBAVFILTER_VERSION_MAJOR < 6); 55 | {$endif} 56 | {$ifndef FF_API_OLD_FILTER_OPTS} 57 | FF_API_OLD_FILTER_OPTS = (LIBAVFILTER_VERSION_MAJOR < 6); 58 | {$endif} 59 | {$ifndef FF_API_OLD_FILTER_OPTS_ERROR} 60 | FF_API_OLD_FILTER_OPTS_ERROR = (LIBAVFILTER_VERSION_MAJOR < 7); 61 | {$endif} 62 | {$ifndef FF_API_AVFILTER_OPEN} 63 | FF_API_AVFILTER_OPEN = (LIBAVFILTER_VERSION_MAJOR < 6); 64 | {$endif} 65 | {$ifndef FF_API_AVFILTER_INIT_FILTER} 66 | FF_API_AVFILTER_INIT_FILTER = (LIBAVFILTER_VERSION_MAJOR < 6); 67 | {$endif} 68 | {$ifndef FF_API_OLD_FILTER_REGISTER} 69 | FF_API_OLD_FILTER_REGISTER = (LIBAVFILTER_VERSION_MAJOR < 6); 70 | {$endif} 71 | {$ifndef FF_API_OLD_GRAPH_PARSE} 72 | FF_API_OLD_GRAPH_PARSE = (LIBAVFILTER_VERSION_MAJOR < 5); 73 | {$endif} 74 | {$ifndef FF_API_NOCONST_GET_NAME} 75 | FF_API_NOCONST_GET_NAME = (LIBAVFILTER_VERSION_MAJOR < 6); 76 | {$endif} 77 | 78 | 79 | {$endif} (* AVFILTER_VERSION_H *) 80 | 81 | 82 | -------------------------------------------------------------------------------- /Include/libavformat/version.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *) 20 | 21 | {$ifndef AVFORMAT_VERSION_H} 22 | {$define AVFORMAT_VERSION_H} 23 | 24 | const 25 | 26 | LIB_AVFORMAT = 'avformat-56'; 27 | LIBAVFORMAT_VERSION_MAJOR = 56; 28 | LIBAVFORMAT_VERSION_MINOR = 40; 29 | LIBAVFORMAT_VERSION_MICRO = 101; 30 | //LIBAVFORMAT_VERSION = AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO); 31 | LIBAVFORMAT_VERSION_INT = ((LIBAVFORMAT_VERSION_MAJOR shl 16) or (LIBAVFORMAT_VERSION_MINOR shl 8) or LIBAVFORMAT_VERSION_MICRO); 32 | LIBAVFORMAT_BUILD = LIBAVFORMAT_VERSION_INT; 33 | LIBAVFORMAT_IDENT = 'Lavf'; 34 | 35 | (** 36 | * FF_API_* defines may be placed below to indicate public API that will be 37 | * dropped at a future version bump. The defines themselves are not part of 38 | * the public API and may change, break or disappear at any time. 39 | * 40 | * @note, when bumping the major version it is recommended to manually 41 | * disable each FF_API_* in its own commit instead of disabling them all 42 | * at once through the bump. This improves the git bisect-ability of the change. 43 | * 44 | *) 45 | {$ifndef FF_API_LAVF_BITEXACT} 46 | FF_API_LAVF_BITEXACT = (LIBAVFORMAT_VERSION_MAJOR < 57); 47 | {$endif} 48 | {$ifndef FF_API_LAVF_FRAC} 49 | FF_API_LAVF_FRAC = (LIBAVFORMAT_VERSION_MAJOR < 57); 50 | {$endif} 51 | {$ifndef FF_API_LAVF_CODEC_TB} 52 | FF_API_LAVF_CODEC_TB = (LIBAVFORMAT_VERSION_MAJOR < 57); 53 | {$endif} 54 | {$ifndef FF_API_URL_FEOF} 55 | FF_API_URL_FEOF = (LIBAVFORMAT_VERSION_MAJOR < 57); 56 | {$endif} 57 | {$ifndef FF_API_PROBESIZE_32} 58 | FF_API_PROBESIZE_32 = (LIBAVFORMAT_VERSION_MAJOR < 57); 59 | {$endif} 60 | {$ifndef FF_API_R_FRAME_RATE} 61 | FF_API_R_FRAME_RATE = 1; 62 | {$endif} 63 | 64 | {$endif} (* AVFORMAT_VERSION_H *) 65 | 66 | 67 | -------------------------------------------------------------------------------- /Include/libavresample/version.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | {$ifndef AVRESAMPLE_VERSION_H} 20 | {$define AVRESAMPLE_VERSION_H} 21 | 22 | (** 23 | * @file 24 | * @ingroup lavr 25 | * Libavresample version macros. 26 | *) 27 | 28 | const 29 | LIB_AVRESAMPLE = 'avresample-2'; 30 | LIBAVRESAMPLE_VERSION_MAJOR = 2; 31 | LIBAVRESAMPLE_VERSION_MINOR = 1; 32 | LIBAVRESAMPLE_VERSION_MICRO = 0; 33 | //LIBAVRESAMPLE_VERSION = AV_VERSION(LIBAVRESAMPLE_VERSION_MAJOR, LIBAVRESAMPLE_VERSION_MINOR, LIBAVRESAMPLE_VERSION_MICRO); 34 | LIBAVRESAMPLE_VERSION_INT = ((LIBSWRESAMPLE_VERSION_MAJOR shl 16) or (LIBSWRESAMPLE_VERSION_MINOR shl 8) or LIBSWRESAMPLE_VERSION_MICRO); 35 | LIBAVRESAMPLE_BUILD = LIBSWRESAMPLE_VERSION_INT; 36 | 37 | LIBAVRESAMPLE_IDENT = 'Lavr'; 38 | 39 | (** 40 | * FF_API_* defines may be placed below to indicate public API that will be 41 | * dropped at a future version bump. The defines themselves are not part of 42 | * the public API and may change, break or disappear at any time. 43 | *) 44 | 45 | {$IFNDEF FF_API_RESAMPLE_CLOSE_OPEN} 46 | FF_API_RESAMPLE_CLOSE_OPEN = (LIBAVRESAMPLE_VERSION_MAJOR < 3); 47 | {$ENDIF} 48 | 49 | {$endif} (* AVRESAMPLE_VERSION_H *) 50 | -------------------------------------------------------------------------------- /Include/libavutil/channel_layout.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2006 Michael Niedermayer 3 | * Copyright (c) 2008 Peter Ross 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | *) 21 | 22 | {$ifndef AVUTIL_CHANNEL_LAYOUT_H} 23 | {$define AVUTIL_CHANNEL_LAYOUT_H} 24 | 25 | (** 26 | * @file 27 | * audio channel layout utility functions 28 | *) 29 | 30 | (** 31 | * @addtogroup lavu_audio 32 | * @{ 33 | *) 34 | 35 | (** 36 | * @defgroup channel_masks Audio channel masks 37 | * 38 | * A channel layout is a 64-bits integer with a bit set for every channel. 39 | * The number of bits set must be equal to the number of channels. 40 | * The value 0 means that the channel layout is not known. 41 | * @note this data structure is not powerful enough to handle channels 42 | * combinations that have the same channel multiple times, such as 43 | * dual-mono. 44 | * 45 | * @{ 46 | *) 47 | const 48 | AV_CH_FRONT_LEFT = $00000001; 49 | AV_CH_FRONT_RIGHT = $00000002; 50 | AV_CH_FRONT_CENTER = $00000004; 51 | AV_CH_LOW_FREQUENCY = $00000008; 52 | AV_CH_BACK_LEFT = $00000010; 53 | AV_CH_BACK_RIGHT = $00000020; 54 | AV_CH_FRONT_LEFT_OF_CENTER = $00000040; 55 | AV_CH_FRONT_RIGHT_OF_CENTER = $00000080; 56 | AV_CH_BACK_CENTER = $00000100; 57 | AV_CH_SIDE_LEFT = $00000200; 58 | AV_CH_SIDE_RIGHT = $00000400; 59 | AV_CH_TOP_CENTER = $00000800; 60 | AV_CH_TOP_FRONT_LEFT = $00001000; 61 | AV_CH_TOP_FRONT_CENTER = $00002000; 62 | AV_CH_TOP_FRONT_RIGHT = $00004000; 63 | AV_CH_TOP_BACK_LEFT = $00008000; 64 | AV_CH_TOP_BACK_CENTER = $00010000; 65 | AV_CH_TOP_BACK_RIGHT = $00020000; 66 | AV_CH_STEREO_LEFT = $20000000; ///< Stereo downmix. 67 | AV_CH_STEREO_RIGHT = $40000000; ///< See AV_CH_STEREO_LEFT. 68 | AV_CH_WIDE_LEFT = $0000000080000000; 69 | AV_CH_WIDE_RIGHT = $0000000100000000; 70 | AV_CH_SURROUND_DIRECT_LEFT = $0000000200000000; 71 | AV_CH_SURROUND_DIRECT_RIGHT = $0000000400000000; 72 | AV_CH_LOW_FREQUENCY_2 = $0000000800000000; 73 | 74 | (** Channel mask value used for AVCodecContext.request_channel_layout 75 | to indicate that the user requests the channel order of the decoder output 76 | to be the native codec channel order. *) 77 | AV_CH_LAYOUT_NATIVE = $8000000000000000; 78 | 79 | (** 80 | * @} 81 | * @defgroup channel_mask_c Audio channel layouts 82 | * @{ 83 | *) 84 | AV_CH_LAYOUT_MONO = (AV_CH_FRONT_CENTER); 85 | AV_CH_LAYOUT_STEREO = (AV_CH_FRONT_LEFT or AV_CH_FRONT_RIGHT); 86 | AV_CH_LAYOUT_2POINT1 = (AV_CH_LAYOUT_STEREO or AV_CH_LOW_FREQUENCY); 87 | AV_CH_LAYOUT_2_1 = (AV_CH_LAYOUT_STEREO or AV_CH_BACK_CENTER); 88 | AV_CH_LAYOUT_SURROUND = (AV_CH_LAYOUT_STEREO or AV_CH_FRONT_CENTER); 89 | AV_CH_LAYOUT_3POINT1 = (AV_CH_LAYOUT_SURROUND or AV_CH_LOW_FREQUENCY); 90 | AV_CH_LAYOUT_4POINT0 = (AV_CH_LAYOUT_SURROUND or AV_CH_BACK_CENTER); 91 | AV_CH_LAYOUT_4POINT1 = (AV_CH_LAYOUT_4POINT0 or AV_CH_LOW_FREQUENCY); 92 | AV_CH_LAYOUT_2_2 = (AV_CH_LAYOUT_STEREO or AV_CH_SIDE_LEFT or AV_CH_SIDE_RIGHT); 93 | AV_CH_LAYOUT_QUAD = (AV_CH_LAYOUT_STEREO or AV_CH_BACK_LEFT or AV_CH_BACK_RIGHT); 94 | AV_CH_LAYOUT_5POINT0 = (AV_CH_LAYOUT_SURROUND or AV_CH_SIDE_LEFT or AV_CH_SIDE_RIGHT); 95 | AV_CH_LAYOUT_5POINT1 = (AV_CH_LAYOUT_5POINT0 or AV_CH_LOW_FREQUENCY); 96 | AV_CH_LAYOUT_5POINT0_BACK = (AV_CH_LAYOUT_SURROUND or AV_CH_BACK_LEFT or AV_CH_BACK_RIGHT); 97 | AV_CH_LAYOUT_5POINT1_BACK = (AV_CH_LAYOUT_5POINT0_BACK or AV_CH_LOW_FREQUENCY); 98 | AV_CH_LAYOUT_6POINT0 = (AV_CH_LAYOUT_5POINT0 or AV_CH_BACK_CENTER); 99 | AV_CH_LAYOUT_6POINT0_FRONT = (AV_CH_LAYOUT_2_2 or AV_CH_FRONT_LEFT_OF_CENTER or AV_CH_FRONT_RIGHT_OF_CENTER); 100 | AV_CH_LAYOUT_HEXAGONAL = (AV_CH_LAYOUT_5POINT0_BACK or AV_CH_BACK_CENTER); 101 | AV_CH_LAYOUT_6POINT1 = (AV_CH_LAYOUT_5POINT1 or AV_CH_BACK_CENTER); 102 | AV_CH_LAYOUT_6POINT1_BACK = (AV_CH_LAYOUT_5POINT1_BACK or AV_CH_BACK_CENTER); 103 | AV_CH_LAYOUT_6POINT1_FRONT = (AV_CH_LAYOUT_6POINT0_FRONT or AV_CH_LOW_FREQUENCY); 104 | AV_CH_LAYOUT_7POINT0 = (AV_CH_LAYOUT_5POINT0 or AV_CH_BACK_LEFT or AV_CH_BACK_RIGHT); 105 | AV_CH_LAYOUT_7POINT0_FRONT = (AV_CH_LAYOUT_5POINT0 or AV_CH_FRONT_LEFT_OF_CENTER or AV_CH_FRONT_RIGHT_OF_CENTER); 106 | AV_CH_LAYOUT_7POINT1 = (AV_CH_LAYOUT_5POINT1 or AV_CH_BACK_LEFT or AV_CH_BACK_RIGHT); 107 | AV_CH_LAYOUT_7POINT1_WIDE = (AV_CH_LAYOUT_5POINT1 or AV_CH_FRONT_LEFT_OF_CENTER or AV_CH_FRONT_RIGHT_OF_CENTER); 108 | AV_CH_LAYOUT_7POINT1_WIDE_BACK = (AV_CH_LAYOUT_5POINT1_BACK or AV_CH_FRONT_LEFT_OF_CENTER or AV_CH_FRONT_RIGHT_OF_CENTER); 109 | AV_CH_LAYOUT_OCTAGONAL = (AV_CH_LAYOUT_5POINT0 or AV_CH_BACK_LEFT or AV_CH_BACK_CENTER or AV_CH_BACK_RIGHT); 110 | AV_CH_LAYOUT_HEXADECAGONAL = (AV_CH_LAYOUT_OCTAGONAL or AV_CH_WIDE_LEFT or AV_CH_WIDE_RIGHT or AV_CH_TOP_BACK_LEFT or AV_CH_TOP_BACK_RIGHT or AV_CH_TOP_BACK_CENTER or AV_CH_TOP_FRONT_CENTER or AV_CH_TOP_FRONT_LEFT or AV_CH_TOP_FRONT_RIGHT); 111 | AV_CH_LAYOUT_STEREO_DOWNMIX = (AV_CH_STEREO_LEFT or AV_CH_STEREO_RIGHT); 112 | 113 | type 114 | TAVMatrixEncoding = ( 115 | AV_MATRIX_ENCODING_NONE, 116 | AV_MATRIX_ENCODING_DOLBY, 117 | AV_MATRIX_ENCODING_DPLII, 118 | AV_MATRIX_ENCODING_DPLIIX, 119 | AV_MATRIX_ENCODING_DPLIIZ, 120 | AV_MATRIX_ENCODING_DOLBYEX, 121 | AV_MATRIX_ENCODING_DOLBYHEADPHONE, 122 | AV_MATRIX_ENCODING_NB 123 | ); 124 | 125 | (** 126 | * Return a channel layout id that matches name, or 0 if no match is found. 127 | * 128 | * name can be one or several of the following notations, 129 | * separated by '+' or '|': 130 | * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, 131 | * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); 132 | * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, 133 | * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); 134 | * - a number of channels, in decimal, optionally followed by 'c', yielding 135 | * the default channel layout for that number of channels (@see 136 | * av_get_default_channel_layout); 137 | * - a channel layout mask, in hexadecimal starting with "0x" (see the 138 | * AV_CH_* macros). 139 | * 140 | * @warning Starting from the next major bump the trailing character 141 | * 'c' to specify a number of channels will be required, while a 142 | * channel layout mask could also be specified as a decimal number 143 | * (if and only if not followed by "c"). 144 | * 145 | * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7" 146 | *) 147 | function av_get_channel_layout(name: PAnsiChar): int64; 148 | cdecl; external LIB_AVUTIL; 149 | 150 | (** 151 | * Return a description of a channel layout. 152 | * If nb_channels is <= 0, it is guessed from the channel_layout. 153 | * 154 | * @param buf put here the string containing the channel layout 155 | * @param buf_size size in bytes of the buffer 156 | *) 157 | procedure av_get_channel_layout_string(buf: PAnsiChar; buf_size: integer; nb_channels: integer; channel_layout: int64); 158 | cdecl; external LIB_AVUTIL; 159 | 160 | 161 | type 162 | PAVBPrint = ^TAVBPrint; 163 | TAVBPrint = record 164 | end; 165 | 166 | (** 167 | * Append a description of a channel layout to a bprint buffer. 168 | *) 169 | procedure av_bprint_channel_layout(bp: PAVBPrint; nb_channels: integer; channel_layout: int64); 170 | cdecl; external LIB_AVUTIL; 171 | 172 | (** 173 | * Return the number of channels in the channel layout. 174 | *) 175 | function av_get_channel_layout_nb_channels(channel_layout: int64): integer; 176 | cdecl; external LIB_AVUTIL; 177 | 178 | (** 179 | * Return default channel layout for a given number of channels. 180 | *) 181 | function av_get_default_channel_layout(nb_channels: integer): int64; 182 | cdecl; external LIB_AVUTIL; (* verified: mail@freehand.com.ua, 2014-09-01 + *) 183 | 184 | (** 185 | * Get the index of a channel in channel_layout. 186 | * 187 | * @param channel a channel layout describing exactly one channel which must be 188 | * present in channel_layout. 189 | * 190 | * @return index of channel in channel_layout on success, a negative AVERROR 191 | * on error. 192 | *) 193 | function av_get_channel_layout_channel_index(channel_layout: int64; 194 | channel: int64): integer; 195 | cdecl; external LIB_AVUTIL; 196 | 197 | (** 198 | * Get the channel with the given index in channel_layout. 199 | *) 200 | function av_channel_layout_extract_channel(channel_layout: int64; index: integer): int64; 201 | cdecl; external LIB_AVUTIL; 202 | 203 | (** 204 | * Get the name of a given channel. 205 | * 206 | * @return channel name on success, NULL on error. 207 | *) 208 | function av_get_channel_name(channel: int64): PAnsiChar; 209 | cdecl; external LIB_AVUTIL; 210 | 211 | (** 212 | * Get the description of a given channel. 213 | * 214 | * @param channel a channel layout with a single channel 215 | * @return channel description on success, NULL on error 216 | *) 217 | function av_get_channel_description(channel: int64): PAnsiChar; 218 | cdecl; external LIB_AVUTIL; 219 | 220 | (** 221 | * Get the value and name of a standard channel layout. 222 | * 223 | * @param[in] index index in an internal list, starting at 0 224 | * @param[out] layout channel layout mask 225 | * @param[out] name name of the layout 226 | * @return 0 if the layout exists, 227 | * <0 if index is beyond the limits 228 | *) 229 | function av_get_standard_channel_layout(index: cardinal; var layout: int64; 230 | var name: PAnsiChar): integer; 231 | cdecl; external LIB_AVUTIL; 232 | 233 | (** 234 | * @} 235 | * @} 236 | *) 237 | 238 | {$endif} (* AVUTIL_CHANNEL_LAYOUT_H *) 239 | -------------------------------------------------------------------------------- /Include/libavutil/common.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *) 20 | 21 | (** 22 | * @file 23 | * common internal and external API header 24 | *) 25 | 26 | 27 | function MKTAG(a, b, c, d: AnsiChar): integer; inline; 28 | 29 | function MKBETAG(a, b, c, d: AnsiChar): integer; inline; 30 | 31 | function FFMIN(a,b : integer): integer; inline; 32 | 33 | -------------------------------------------------------------------------------- /Include/libavutil/cpu.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2000, 2001, 2002 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *) 20 | 21 | {$ifndef AVUTIL_CPU_H} 22 | {$define AVUTIL_CPU_H} 23 | 24 | const 25 | 26 | AV_CPU_FLAG_FORCE = $80000000; (* force usage of selected flags (OR) *) 27 | 28 | (* lower 16 bits - CPU features *) 29 | AV_CPU_FLAG_MMX = $0001; ///< standard MMX 30 | AV_CPU_FLAG_MMXEXT = $0002; ///< SSE integer functions or AMD MMX ext 31 | AV_CPU_FLAG_MMX2 = $0002; ///< SSE integer functions or AMD MMX ext 32 | AV_CPU_FLAG_3DNOW = $0004; ///< AMD 3DNOW 33 | AV_CPU_FLAG_SSE = $0008; ///< SSE functions 34 | AV_CPU_FLAG_SSE2 = $0010; ///< PIV SSE2 functions 35 | AV_CPU_FLAG_SSE2SLOW = $40000000; ///< SSE2 supported, but usually not faster 36 | ///< than regular MMX/SSE (e.g. Core1) 37 | AV_CPU_FLAG_3DNOWEXT = $0020; ///< AMD 3DNowExt 38 | AV_CPU_FLAG_SSE3 = $0040; ///< Prescott SSE3 functions 39 | AV_CPU_FLAG_SSE3SLOW = $20000000; ///< SSE3 supported, but usually not faster 40 | ///< than regular MMX/SSE (e.g. Core1) 41 | AV_CPU_FLAG_SSSE3 = $0080; ///< Conroe SSSE3 functions 42 | AV_CPU_FLAG_ATOM = $10000000; ///< Atom processor, some SSSE3 instructions are slower 43 | AV_CPU_FLAG_SSE4 = $0100; ///< Penryn SSE4.1 functions 44 | AV_CPU_FLAG_SSE42 = $0200; ///< Nehalem SSE4.2 functions 45 | AV_CPU_FLAG_AVX = $4000; ///< AVX functions: requires OS support even if YMM registers aren't used 46 | AV_CPU_FLAG_AVXSLOW = $8000000; ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) 47 | AV_CPU_FLAG_XOP = $0400; ///< Bulldozer XOP functions 48 | AV_CPU_FLAG_FMA4 = $0800; ///< Bulldozer FMA4 functions 49 | 50 | AV_CPU_FLAG_CMOV = $1001000; ///< supports cmov instruction 51 | 52 | AV_CPU_FLAG_AVX2 = $8000; ///< AVX2 functions: requires OS support even if YMM registers aren't used 53 | AV_CPU_FLAG_FMA3 = $10000; ///< Haswell FMA3 functions 54 | AV_CPU_FLAG_BMI1 = $20000; ///< Bit Manipulation Instruction Set 1 55 | AV_CPU_FLAG_BMI2 = $40000; ///< Bit Manipulation Instruction Set 2 56 | 57 | 58 | AV_CPU_FLAG_ALTIVEC = $0001; ///< standard 59 | AV_CPU_FLAG_VSX = $0002; ///< ISA 2.06 60 | AV_CPU_FLAG_POWER8 = $0004; ///< ISA 2.07 61 | 62 | AV_CPU_FLAG_ARMV5TE = (1 Shl 0); 63 | AV_CPU_FLAG_ARMV6 = (1 Shl 1); 64 | AV_CPU_FLAG_ARMV6T2 = (1 Shl 2); 65 | AV_CPU_FLAG_VFP = (1 Shl 3); 66 | AV_CPU_FLAG_VFPV3 = (1 Shl 4); 67 | AV_CPU_FLAG_NEON = (1 Shl 5); 68 | AV_CPU_FLAG_ARMV8 = (1 Shl 6); 69 | AV_CPU_FLAG_SETEND = (1 shl 16); 70 | 71 | 72 | (** 73 | * Return the flags which specify extensions supported by the CPU. 74 | * The returned value is affected by av_force_cpu_flags() if that was used 75 | * before. So av_get_cpu_flags() can easily be used in a application to 76 | * detect the enabled cpu flags. 77 | *) 78 | function av_get_cpu_flags(): integer; 79 | cdecl; external LIB_AVUTIL;(* verified: mail@freehand.com.ua, 2014-08-29: + *) 80 | 81 | (** 82 | * Disables cpu detection and forces the specified flags. 83 | * -1 is a special case that disables forcing of specific flags. 84 | *) 85 | procedure av_force_cpu_flags(flags: integer); 86 | cdecl; external LIB_AVUTIL; 87 | 88 | (** 89 | * Set a mask on flags returned by av_get_cpu_flags(). 90 | * This function is mainly useful for testing. 91 | * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible 92 | * 93 | * @warning this function is not thread safe. 94 | *) 95 | procedure av_set_cpu_flags_mask(mask: integer); 96 | cdecl; external LIB_AVUTIL; deprecated; 97 | 98 | (** 99 | * Parse CPU flags from a string. 100 | * 101 | * The returned flags contain the specified flags as well as related unspecified flags. 102 | * 103 | * This function exists only for compatibility with libav. 104 | * Please use av_parse_cpu_caps() when possible. 105 | * @return a combination of AV_CPU_* flags, negative on error. 106 | *) 107 | function av_parse_cpu_flags(s: PAnsiChar): integer; 108 | cdecl; external LIB_AVUTIL; deprecated; 109 | 110 | (** 111 | * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. 112 | * 113 | * @return negative on error. 114 | *) 115 | function av_parse_cpu_caps(flags: PCardinal; s: PAnsiChar): integer; 116 | cdecl; external LIB_AVUTIL; 117 | 118 | (** 119 | * @return the number of logical CPU cores present. 120 | *) 121 | function av_cpu_count(): integer; 122 | cdecl; external LIB_AVUTIL; 123 | 124 | {$endif} (* AVUTIL_CPU_H *) 125 | -------------------------------------------------------------------------------- /Include/libavutil/crc.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *) 20 | 21 | {$ifndef AVUTIL_CRC_H} 22 | {$define AVUTIL_CRC_H} 23 | 24 | (** 25 | * @defgroup lavu_crc32 CRC32 26 | * @ingroup lavu_crypto 27 | * @{ 28 | *) 29 | 30 | type 31 | 32 | TAVCRC = cardinal; 33 | PAVCRC = ^TAVCRC; 34 | 35 | TAVCRCId = (AV_CRC_8_ATM, 36 | AV_CRC_16_ANSI, 37 | AV_CRC_16_CCITT, 38 | AV_CRC_32_IEEE, 39 | AV_CRC_32_IEEE_LE, (*< reversed bitorder version of AV_CRC_32_IEEE *) 40 | AV_CRC_16_ANSI_LE, (*< reversed bitorder version of AV_CRC_16_ANSI *) 41 | AV_CRC_24_IEEE = 12, 42 | AV_CRC_MAX (*< Not part of public API! Do not use outside libavutil. *) 43 | ); 44 | 45 | 46 | (** 47 | * Initialize a CRC table. 48 | * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 49 | * @param le If 1, the lowest bit represents the coefficient for the highest 50 | * exponent of the corresponding polynomial (both for poly and 51 | * actual CRC). 52 | * If 0, you must swap the CRC parameter and the result of av_crc 53 | * if you need the standard representation (can be simplified in 54 | * most cases to e.g. bswap16): 55 | * av_bswap32(crc << (32-bits)) 56 | * @param bits number of bits for the CRC 57 | * @param poly generator polynomial without the x**bits coefficient, in the 58 | * representation as specified by le 59 | * @param ctx_size size of ctx in bytes 60 | * @return <0 on failure 61 | *) 62 | function av_crc_init(ctx: PAVCRC; le: integer; bits: integer; poly: longword; ctx_size: integer): integer; 63 | cdecl; external LIB_AVUTIL; 64 | 65 | (** 66 | * Get an initialized standard CRC table. 67 | * @param crc_id ID of a standard CRC 68 | * @return a pointer to the CRC table or NULL on failure 69 | *) 70 | function av_crc_get_table(crc_id: TAVCRCId): PAVCRC; 71 | cdecl; external LIB_AVUTIL; 72 | 73 | 74 | (** 75 | * Calculate the CRC of a block. 76 | * @param crc CRC of previous blocks if any or initial value for CRC 77 | * @return CRC updated with the data from the given block 78 | * 79 | * @see av_crc_init() "le" parameter 80 | *) 81 | function av_crc(const ctx: PAVCRC; start_crc: longword; const buffer: PByte; length: cardinal): longword; 82 | cdecl; external LIB_AVUTIL; 83 | 84 | {$endif} (* AVUTIL_CRC_H *) 85 | -------------------------------------------------------------------------------- /Include/libavutil/dict.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * 3 | * This file is part of FFmpeg. 4 | * 5 | * FFmpeg is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * FFmpeg is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with FFmpeg; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | *) 19 | 20 | (** 21 | * @file 22 | * Public dictionary API. 23 | * @deprecated 24 | * AVDictionary is provided for compatibility with libav. It is both in 25 | * implementation as well as API inefficient. It does not scale and is 26 | * extremely slow with large dictionaries. 27 | * It is recommended that new code uses our tree container from tree.c/h 28 | * where applicable, which uses AVL trees to achieve O(log n) performance. 29 | *) 30 | 31 | 32 | {$ifndef AVUTIL_DICT_H} 33 | {$define AVUTIL_DICT_H} 34 | 35 | (** 36 | * @addtogroup lavu_dict AVDictionary 37 | * @ingroup lavu_data 38 | * 39 | * @brief Simple key:value store 40 | * 41 | * @{ 42 | * Dictionaries are used for storing key:value pairs. To create 43 | * an AVDictionary, simply pass an address of a NULL pointer to 44 | * av_dict_set(). NULL can be used as an empty dictionary wherever 45 | * a pointer to an AVDictionary is required. 46 | * Use av_dict_get() to retrieve an entry or iterate over all 47 | * entries and finally av_dict_free() to free the dictionary 48 | * and all its contents. 49 | * 50 | @code 51 | AVDictionary *d = NULL; // "create" an empty dictionary 52 | AVDictionaryEntry *t = NULL; 53 | 54 | av_dict_set(&d, "foo", "bar", 0); // add an entry 55 | 56 | char *k = av_strdup("key"); // if your strings are already allocated, 57 | char *v = av_strdup("value"); // you can avoid copying them like this 58 | av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); 59 | 60 | while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { 61 | <....> // iterate over all entries in d 62 | } 63 | av_dict_free(&d); 64 | @endcode 65 | * 66 | *) 67 | 68 | const 69 | AV_DICT_MATCH_CASE = 1; 70 | AV_DICT_IGNORE_SUFFIX = 2; 71 | AV_DICT_DONT_STRDUP_KEY = 4; (**< Take ownership of a key that's been 72 | allocated with av_malloc() and children. *) 73 | AV_DICT_DONT_STRDUP_VAL = 8; (**< Take ownership of a value that's been 74 | allocated with av_malloc() and chilren. *) 75 | AV_DICT_DONT_OVERWRITE = 16; (**< Don't overwrite existing entries. *) 76 | AV_DICT_APPEND = 32; (**< If the entry already exists, append to it. Note that no 77 | delimiter is added, the strings are simply concatenated. *) 78 | 79 | type 80 | PAVDictionaryEntry = ^TAVDictionaryEntry; 81 | TAVDictionaryEntry = record 82 | key: PAnsiChar; 83 | value: PAnsiChar; 84 | end; 85 | 86 | PPAVDictionary = ^PAVDictionary; 87 | PAVDictionary = ^TAVDictionary; 88 | TAVDictionary = record 89 | count: integer; 90 | elems: PAVDictionaryEntry; 91 | end; 92 | 93 | (** 94 | * Get a dictionary entry with matching key. 95 | * 96 | * The returned entry key or value must not be changed, or it will 97 | * cause undefined behavior. 98 | * 99 | * To iterate through all the dictionary entries, you can set the matching key 100 | * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag. 101 | * 102 | * @param prev Set to the previous matching element to find the next. 103 | * If set to NULL the first matching element is returned. 104 | * @param key matching key 105 | * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved 106 | * @return found entry or NULL in case no matching entry was found in the dictionary 107 | *) 108 | function av_dict_get(m: PAVDictionary; key: PAnsiChar; prev: PAVDictionaryEntry; flags: integer): PAVDictionaryEntry; 109 | cdecl; external LIB_AVUTIL; 110 | 111 | (** 112 | * Get number of entries in dictionary. 113 | * 114 | * @param m dictionary 115 | * @return number of entries in dictionary 116 | *) 117 | function av_dict_count(m: PAVDictionary): integer; 118 | cdecl; external LIB_AVUTIL; 119 | 120 | (** 121 | * Set the given entry in *pm, overwriting an existing entry. 122 | * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, 123 | * these arguments will be freed on error. 124 | * 125 | * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL 126 | * a dictionary struct is allocated and put in *pm. 127 | * @param key entry key to add to *pm (will be av_strduped depending on flags) 128 | * @param value entry value to add to *pm (will be av_strduped depending on flags). 129 | * Passing a NULL value will cause an existing entry to be deleted. 130 | * @return >= 0 on success otherwise an error code <0 131 | *) 132 | function av_dict_set(var pm: PAVDictionary; key: PAnsiChar; value: PAnsiChar; flags: integer): integer; 133 | cdecl; external LIB_AVUTIL; (* verified: mail@freehand.com.ua, 2014-09-05: + *) 134 | 135 | (** 136 | * Convenience wrapper for av_dict_set that converts the value to a string 137 | * and stores it. 138 | * 139 | * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. 140 | *) 141 | function av_dict_set_int(var pm: PAVDictionary; key: PAnsiChar; value: int64; flags: integer): integer; 142 | cdecl; external LIB_AVUTIL; 143 | 144 | (** 145 | * Parse the key/value pairs list and add the parsed entries to a dictionary. 146 | * 147 | * In case of failure, all the successfully set entries are stored in 148 | * *pm. You may need to manually free the created dictionary. 149 | * 150 | * @param key_val_sep a 0-terminated list of characters used to separate 151 | * key from value 152 | * @param pairs_sep a 0-terminated list of characters used to separate 153 | * two pairs from each other 154 | * @param flags flags to use when adding to dictionary. 155 | * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL 156 | * are ignored since the key/value tokens will always 157 | * be duplicated. 158 | * @return 0 on success, negative AVERROR code on failure 159 | *) 160 | function av_dict_parse_string(var pm: PAVDictionary; str: PAnsiChar; 161 | key_val_sep: PAnsiChar; pairs_sep: PAnsiChar; 162 | flags: integer): integer; 163 | cdecl; external LIB_AVUTIL; 164 | 165 | (** 166 | * Copy entries from one AVDictionary struct into another. 167 | * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, 168 | * this function will allocate a struct for you and put it in *dst 169 | * @param src pointer to source AVDictionary struct 170 | * @param flags flags to use when setting entries in *dst 171 | * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag 172 | *) 173 | procedure av_dict_copy(dst: PPAVDictionary; src: PAVDictionary; flags: integer); 174 | cdecl; external LIB_AVUTIL; (* verified: mail@freehand.com.ua, 2014-09-05: + *) 175 | 176 | (** 177 | * Free all the memory allocated for an AVDictionary struct 178 | * and all keys and values. 179 | *) 180 | procedure av_dict_free(var m: PAVDictionary); 181 | cdecl; external LIB_AVUTIL; 182 | 183 | (* 184 | * Get dictionary entries as a string. 185 | * 186 | * Create a string containing dictionary's entries. 187 | * Such string may be passed back to av_dict_parse_string(). 188 | * @note String is escaped with backslashes ('\'). 189 | * 190 | * @param[in] m dictionary 191 | * @param[out] buffer Pointer to buffer that will be allocated with string containg entries. 192 | * Buffer must be freed by the caller when is no longer needed. 193 | * @param[in] key_val_sep character used to separate key from value 194 | * @param[in] pairs_sep character used to separate two pairs from each other 195 | * @return >= 0 on success, negative on error 196 | * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. 197 | *) 198 | function av_dict_get_string(m: PAVDictionary; var buffer: PAnsiChar; 199 | const key_val_sep: AnsiChar; const pairs_sep: AnsiChar): integer; 200 | cdecl; external LIB_AVUTIL; 201 | 202 | {$endif} (* AVUTIL_DICT_H *) 203 | -------------------------------------------------------------------------------- /Include/libavutil/error.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * This is a part of the Pascal port of ffmpeg. 19 | * - Changes and updates by the UltraStar Deluxe Team 20 | * 21 | * Conversion of libavutil/error.h 22 | * avutil version 52.38.100 23 | * 24 | *) 25 | 26 | (** 27 | * @file 28 | * error code definitions 29 | *) 30 | 31 | (** 32 | * @addtogroup lavu_error 33 | * 34 | * @ 35 | *) 36 | 37 | {* error handling *} 38 | 39 | const 40 | ENOENT = 2; 41 | EIO = 5; 42 | ENOMEM = 12; 43 | EINVAL = 22; 44 | EPIPE = 32; // just an assumption. needs to be checked. 45 | EDOM = 33; 46 | {$IFDEF MSWINDOWS} 47 | // Note: we assume that ffmpeg was compiled with MinGW. 48 | // This must be changed if DLLs were compiled with cygwin. 49 | ENOSYS = 40; // MSVC/MINGW: 40, CYGWIN: 88, LINUX/FPC: 38 50 | EILSEQ = 42; // MSVC/MINGW: 42, CYGWIN: 138, LINUX/FPC: 84 51 | {$ENDIF} 52 | 53 | (** 54 | * We need the sign of the error, because some platforms have 55 | * E* and errno already negated. The previous version failed 56 | * with Delphi, because it needed EINVAL defined. 57 | * Warning: This code is platform dependent and assumes constants 58 | * to be 32 bit. 59 | * This version does the following steps: 60 | * 1) shr 30: shifts the sign bit to bit position 2 61 | * 2) and $00000002: sets all other bits to zero 62 | * positive EINVAL gives 0, negative gives 2 63 | * 3) - 1: positive EINVAL gives -1, negative 1 64 | *) 65 | const 66 | AVERROR_SIGN = (EINVAL shr 30) and $00000002 - 1; 67 | 68 | (* 69 | #if EDOM > 0 70 | #define AVERROR(e) (-(e)) {**< Returns a negative error code from a POSIX error code, to return from library functions. *} 71 | #define AVUNERROR(e) (-(e)) {**< Returns a POSIX error code from a library function error return value. *} 72 | #else 73 | {* Some platforms have E* and errno already negated. *} 74 | #define AVERROR(e) (e) 75 | #define AVUNERROR(e) (e) 76 | #endif 77 | *) 78 | 79 | function AVERROR(err: integer): integer; // Note: see avutil.pas 80 | function AVUNERROR(err: integer): integer; // Note: see avutil.pas 81 | 82 | function FFERRTAG(a, b, c, d: AnsiChar): integer; inline; // Note: see avutil.pas 83 | 84 | 85 | const 86 | 87 | AVERROR_BSF_NOT_FOUND = -(ord($F8) or (ord('B') shl 8) or (ord('S') shl 16) or (ord('F') shl 24)); ///< Bitstream filter not found 88 | AVERROR_BUG = -(ord('B') or (ord('U') shl 8) or (ord('G') shl 16) or (ord('!') shl 24)); ///< Internal bug, also see AVERROR_BUG2 89 | AVERROR_BUFFER_TOO_SMALL = -(ord('B') or (ord('U') shl 8) or (ord('F') shl 16) or (ord('S') shl 24)); ///< Buffer too small 90 | AVERROR_DECODER_NOT_FOUND = -(ord($F8) or (ord('D') shl 8) or (ord('E') shl 16) or (ord('C') shl 24)); ///< Decoder not found 91 | AVERROR_DEMUXER_NOT_FOUND = -(ord($F8) or (ord('D') shl 8) or (ord('E') shl 16) or (ord('M') shl 24)); ///< Demuxer not found 92 | AVERROR_ENCODER_NOT_FOUND = -(ord($F8) or (ord('E') shl 8) or (ord('N') shl 16) or (ord('C') shl 24)); ///< Encoder not found 93 | AVERROR_EOF = -(ord('E') or (ord('O') shl 8) or (ord('F') shl 16) or (ord(' ') shl 24)); ///< End of file 94 | AVERROR_EXIT = -(ord('E') or (ord('X') shl 8) or (ord('I') shl 16) or (ord('T') shl 24)); ///< Immediate exit was requested; the called function should not be restarted 95 | AVERROR_EXTERNAL = -(ord('E') or (ord('X') shl 8) or (ord('T') shl 16) or (ord(' ') shl 24)); ///< Generic error in an external library 96 | AVERROR_FILTER_NOT_FOUND = -(ord($F8) or (ord('F') shl 8) or (ord('I') shl 16) or (ord('L') shl 24)); ///< Filter not found 97 | AVERROR_INVALIDDATA = -(ord('I') or (ord('N') shl 8) or (ord('D') shl 16) or (ord('A') shl 24)); ///< Invalid data found when processing input 98 | AVERROR_MUXER_NOT_FOUND = -(ord($F8) or (ord('M') shl 8) or (ord('U') shl 16) or (ord('X') shl 24)); ///< Muxer not found 99 | AVERROR_OPTION_NOT_FOUND = -(ord($F8) or (ord('O') shl 8) or (ord('P') shl 16) or (ord('T') shl 24)); ///< Option not found 100 | AVERROR_PATCHWELCOME = -(ord('P') or (ord('A') shl 8) or (ord('W') shl 16) or (ord('E') shl 24)); ///< Not yet implemented in FFmpeg, patches welcome 101 | AVERROR_PROTOCOL_NOT_FOUND = -(ord($F8) or (ord('P') shl 8) or (ord('R') shl 16) or (ord('O') shl 24)); ///< Protocol not found 102 | AVERROR_STREAM_NOT_FOUND = -(ord($F8) or (ord('S') shl 8) or (ord('T') shl 16) or (ord('R') shl 24)); ///< Stream not found 103 | 104 | (** 105 | * This is semantically identical to AVERROR_BUG 106 | * it has been introduced in Libav after our AVERROR_BUG and with a modified value. 107 | *) 108 | AVERROR_BUG2 = -(ord('B') or (ord('U') shl 8) or (ord('G') shl 16) or (ord(' ') shl 24)); 109 | AVERROR_UNKNOWN = -(ord('U') or (ord('N') shl 8) or (ord('K') shl 16) or (ord('N') shl 24)); ///< Unknown error, typically from an external library 110 | AVERROR_EXPERIMENTAL = -($2bb2afa8); ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. 111 | AVERROR_INPUT_CHANGED = (-$636e6701); ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED) 112 | AVERROR_OUTPUT_CHANGED = (-$636e6702); ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED) 113 | (* HTTP & RTSP errors *) 114 | AVERROR_HTTP_BAD_REQUEST = -(ord($F8) or (ord('4') shl 8) or (ord('0') shl 16) or (ord('0') shl 24)); //FFERRTAG(0xF8,'4','0','0') 115 | AVERROR_HTTP_UNAUTHORIZED = -(ord($F8) or (ord('4') shl 8) or (ord('0') shl 16) or (ord('1') shl 24)); //FFERRTAG(0xF8,'4','0','1') 116 | AVERROR_HTTP_FORBIDDEN = -(ord($F8) or (ord('4') shl 8) or (ord('0') shl 16) or (ord('3') shl 24)); //FFERRTAG(0xF8,'4','0','3') 117 | AVERROR_HTTP_NOT_FOUND = -(ord($F8) or (ord('4') shl 8) or (ord('0') shl 16) or (ord('4') shl 24)); //FFERRTAG(0xF8,'4','0','4') 118 | AVERROR_HTTP_OTHER_4XX = -(ord($F8) or (ord('4') shl 8) or (ord('X') shl 16) or (ord('X') shl 24)); //FFERRTAG(0xF8,'4','X','X') 119 | AVERROR_HTTP_SERVER_ERROR = -(ord($F8) or (ord('5') shl 8) or (ord('X') shl 16) or (ord('X') shl 24)); //FFERRTAG(0xF8,'5','X','X') 120 | 121 | AV_ERROR_MAX_STRING_SIZE = 64; 122 | 123 | 124 | (* 125 | * Put a description of the AVERROR code errnum in errbuf. 126 | * In case of failure the global variable errno is set to indicate the 127 | * error. Even in case of failure av_strerror() will print a generic 128 | * error message indicating the errnum provided to errbuf. 129 | * 130 | * @param errnum error code to describe 131 | * @param errbuf buffer to which description is written 132 | * @param errbuf_size the size in bytes of errbuf 133 | * @return 0 on success, a negative value if a description for errnum 134 | * cannot be found 135 | *) 136 | function av_strerror(errnum: integer; errbuf: PAnsiChar; errbuf_size: cardinal): integer; 137 | cdecl; external LIB_AVUTIL; 138 | 139 | (** 140 | * Fill the provided buffer with a string containing an error string 141 | * corresponding to the AVERROR code errnum. 142 | * 143 | * @param errbuf a buffer 144 | * @param errbuf_size size in bytes of errbuf 145 | * @param errnum error code to describe 146 | * @return the buffer in input, filled with the error description 147 | * @see av_strerror() 148 | *) 149 | function av_make_error_string(errbuf: PAnsiChar; errbuf_size: cardinal; errnum: integer): PAnsiChar; inline; // Note: see avutil.pas 150 | 151 | 152 | (** 153 | * Convenience macro, the return value should be used only directly in 154 | * function arguments but never stand-alone. 155 | *) 156 | function av_err2str(errnum: integer): PAnsiChar; inline; // Note: see avutil.pas 157 | 158 | 159 | (** 160 | * @} 161 | *) 162 | -------------------------------------------------------------------------------- /Include/libavutil/fifo.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | (** 20 | * @file 21 | * a very simple circular buffer FIFO implementation 22 | *) 23 | 24 | {$ifndef AVUTIL_FIFO_H} 25 | {$define AVUTIL_FIFO_H} 26 | 27 | type 28 | PPAVFifoBuffer = ^PAVFifoBuffer; 29 | PAVFifoBuffer = ^TAVFifoBuffer; 30 | TAVFifoBuffer = record 31 | buffer : PByte; 32 | rptr, wptr, end_ : PByte; 33 | rndx, wndx : longword; 34 | end; 35 | 36 | //callbacks used in the functions av_fifo_generic_read and av_fifo_generic_write 37 | TFifo_read_func = function(ptr1: Pointer; ptr2: Pointer; int: integer): Pointer; 38 | TFifo_write_func = function(ptr1: Pointer; ptr2: Pointer; int: integer): integer; 39 | TFifo_generic_peek_func = procedure(ptr1: Pointer; ptr2: Pointer; int : integer); 40 | 41 | (** 42 | * Initialize an AVFifoBuffer. 43 | * @param size of FIFO 44 | * @return AVFifoBuffer or NULL in case of memory allocation failure 45 | *) 46 | function av_fifo_alloc(size: cardinal): PAVFifoBuffer; 47 | cdecl; external LIB_AVUTIL; 48 | 49 | (** 50 | * Initialize an AVFifoBuffer. 51 | * @param nmemb number of elements 52 | * @param size size of the single element 53 | * @return AVFifoBuffer or NULL in case of memory allocation failure 54 | *) 55 | function av_fifo_alloc_array(nmemb: cardinal; size: cardinal): PAVFifoBuffer; 56 | cdecl; external LIB_AVUTIL; 57 | 58 | (** 59 | * Free an AVFifoBuffer. 60 | * @param *f AVFifoBuffer to free 61 | *) 62 | procedure av_fifo_free(f: PAVFifoBuffer); 63 | cdecl; external LIB_AVUTIL; 64 | 65 | (** 66 | * Free an AVFifoBuffer and reset pointer to NULL. 67 | * @param f AVFifoBuffer to free 68 | *) 69 | procedure av_fifo_freep(f: PPAVFifoBuffer); 70 | cdecl; external LIB_AVUTIL; 71 | 72 | (** 73 | * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. 74 | * @param *f AVFifoBuffer to reset 75 | *) 76 | procedure av_fifo_reset(f: PAVFifoBuffer); 77 | cdecl; external LIB_AVUTIL; 78 | 79 | (** 80 | * Return the amount of data in bytes in the AVFifoBuffer, that is the 81 | * amount of data you can read from it. 82 | * @param *f AVFifoBuffer to read from 83 | * @return size 84 | *) 85 | function av_fifo_size(f: PAVFifoBuffer): integer; 86 | cdecl; external LIB_AVUTIL; 87 | 88 | (** 89 | * Return the amount of space in bytes in the AVFifoBuffer, that is the 90 | * amount of data you can write into it. 91 | * @param *f AVFifoBuffer to write into 92 | * @return size 93 | *) 94 | function av_fifo_space(f: PAVFifoBuffer): integer; 95 | cdecl; external LIB_AVUTIL; 96 | 97 | (** 98 | * Feed data from an AVFifoBuffer to a user-supplied callback. 99 | * Similar as av_fifo_gereric_read but without discarding data. 100 | * @param f AVFifoBuffer to read from 101 | * @param buf_size number of bytes to read 102 | * @param func generic read function 103 | * @param dest data destination 104 | *) 105 | 106 | function av_fifo_generic_peek(f: PAVFifoBuffer; dest: Pointer; buf_size: integer; func : TFifo_generic_peek_func): integer; 107 | cdecl; external LIB_AVUTIL; 108 | 109 | (** 110 | * Feed data from an AVFifoBuffer to a user-supplied callback. 111 | * @param *f AVFifoBuffer to read from 112 | * @param buf_size number of bytes to read 113 | * @param *func generic read function 114 | * @param *dest data destination 115 | *) 116 | //void (*func)(void*, void*, int 117 | function av_fifo_generic_read(f: PAVFifoBuffer; dest: Pointer; buf_size: integer; func: TFifo_read_func): integer; 118 | cdecl; external LIB_AVUTIL; 119 | 120 | (** 121 | * Feed data from a user-supplied callback to an AVFifoBuffer. 122 | * @param *f AVFifoBuffer to write to 123 | * @param *src data source; non-const since it may be used as a 124 | * modifiable context by the function defined in func 125 | * @param size number of bytes to write 126 | * @param *func generic write function; the first parameter is src, 127 | * the second is dest_buf, the third is dest_buf_size. 128 | * func must return the number of bytes written to dest_buf, or <= 0 to 129 | * indicate no more data available to write. 130 | * If func is NULL, src is interpreted as a simple byte array for source data. 131 | * @return the number of bytes written to the FIFO 132 | *) 133 | //int (*func)(void*, void*, int) 134 | function av_fifo_generic_write(f: PAVFifoBuffer; src: Pointer; size: integer; func: TFifo_write_func): integer; 135 | cdecl; external LIB_AVUTIL; 136 | 137 | 138 | (** 139 | * Resize an AVFifoBuffer. 140 | * @param *f AVFifoBuffer to resize 141 | * @param size new AVFifoBuffer size in bytes 142 | * @return <0 for failure, >=0 otherwise 143 | *) 144 | function av_fifo_realloc2(f: PAVFifoBuffer; size: cardinal): integer; 145 | cdecl; external LIB_AVUTIL; 146 | 147 | (** 148 | * Enlarge an AVFifoBuffer. 149 | * In case of reallocation failure, the old FIFO is kept unchanged. 150 | * The new fifo size may be larger than the requested size. 151 | * 152 | * @param f AVFifoBuffer to resize 153 | * @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size() 154 | * @return <0 for failure, >=0 otherwise 155 | *) 156 | function av_fifo_grow(f : PAVFifoBuffer; additional_space : cardinal): integer; 157 | cdecl; external LIB_AVUTIL; 158 | 159 | (** 160 | * Read and discard the specified amount of data from an AVFifoBuffer. 161 | * @param *f AVFifoBuffer to read from 162 | * @param size amount of data to read in bytes 163 | *) 164 | procedure av_fifo_drain(f: PAVFifoBuffer; size: cint); 165 | cdecl; external LIB_AVUTIL; 166 | 167 | 168 | 169 | {$endif} (* AVUTIL_FIFO_H *) 170 | 171 | -------------------------------------------------------------------------------- /Include/libavutil/file.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | {$ifndef AVUTIL_FILE_H} 20 | {$define AVUTIL_FILE_H} 21 | 22 | (** 23 | * @file 24 | * Misc file utilities. 25 | *) 26 | 27 | (** 28 | * Read the file with name filename, and put its content in a newly 29 | * allocated buffer or map it with mmap() when available. 30 | * In case of success set *bufptr to the read or mmapped buffer, and 31 | * *size to the size in bytes of the buffer in *bufptr. 32 | * The returned buffer must be released with av_file_unmap(). 33 | * 34 | * @param log_offset loglevel offset used for logging 35 | * @param log_ctx context used for logging 36 | * @return a non negative number in case of success, a negative value 37 | * corresponding to an AVERROR error code in case of failure 38 | *) 39 | function av_file_map(const filename: PAnsiChar; var bufptr: PByte; var size: integer; 40 | log_offset: integer; log_ctx: Pointer): integer; 41 | cdecl; external LIB_AVUTIL; 42 | 43 | (** 44 | * Unmap or free the buffer bufptr created by av_file_map(). 45 | * 46 | * @param size size in bytes of bufptr, must be the same as returned 47 | * by av_file_map() 48 | *) 49 | procedure av_file_unmap(bufptr: PByte; size: integer); 50 | cdecl; external LIB_AVUTIL; 51 | 52 | (** 53 | * Wrapper to work around the lack of mkstemp() on mingw. 54 | * Also, tries to create file in /tmp first, if possible. 55 | * *prefix can be a character constant; *filename will be allocated internally. 56 | * @return file descriptor of opened file (or negative value corresponding to an 57 | * AVERROR code on error) 58 | * and opened file name in **filename. 59 | * @note On very old libcs it is necessary to set a secure umask before 60 | * calling this, av_tempfile() can't call umask itself as it is used in 61 | * libraries and could interfere with the calling application. 62 | *) 63 | function av_tempfile(prefix : PAnsiChar; var filename: PAnsiChar; log_offset : integer; log_ctx: Pointer): integer 64 | cdecl; external LIB_AVUTIL; 65 | 66 | {$endif} (* AVUTIL_FILE_H *) 67 | -------------------------------------------------------------------------------- /Include/libavutil/imgutils.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | 20 | {$ifndef AVUTIL_IMGUTILS_H} 21 | {$define AVUTIL_IMGUTILS_H} 22 | 23 | 24 | 25 | (** 26 | * @file 27 | * misc image utilities 28 | * 29 | * @addtogroup lavu_picture 30 | * @{ 31 | *) 32 | 33 | {$INCLUDE pixdesc.pas} 34 | 35 | 36 | (** 37 | * Compute the max pixel step for each plane of an image with a 38 | * format described by pixdesc. 39 | * 40 | * The pixel step is the distance in bytes between the first byte of 41 | * the group of bytes which describe a pixel component and the first 42 | * byte of the successive group in the same plane for the same 43 | * component. 44 | * 45 | * @param max_pixsteps an array which is filled with the max pixel step 46 | * for each plane. Since a plane may contain different pixel 47 | * components, the computed max_pixsteps[plane] is relative to the 48 | * component in the plane with the max pixel step. 49 | * @param max_pixstep_comps an array which is filled with the component 50 | * for each plane which has the max pixel step. May be NULL. 51 | *) 52 | 53 | 54 | Procedure av_image_fill_max_pixsteps(max_pixsteps: TArray4Integer; max_pixstep_comps: TArray4Integer; 55 | const pixdesc: PAVPixFmtDescriptor); 56 | cdecl; external LIB_AVUTIL; 57 | 58 | (** 59 | * Compute the size of an image line with format pix_fmt and width 60 | * width for the plane plane. 61 | * 62 | * @return the computed size in bytes 63 | *) 64 | Function av_image_get_linesize(pix_fmt: TAVPixelFormat; width, plane : integer) : integer; 65 | cdecl; external LIB_AVUTIL; 66 | (** 67 | * Fill plane linesizes for an image with pixel format pix_fmt and 68 | * width width. 69 | * 70 | * @param linesizes array to be filled with the linesize for each plane 71 | * @return >= 0 in case of success, a negative error code otherwise 72 | *) 73 | Function av_image_fill_linesizes(linesizes: TArray4Integer; pix_fmt: TAVPixelFormat; width : integer): integer; 74 | cdecl; external LIB_AVUTIL; 75 | (** 76 | * Fill plane data pointers for an image with pixel format pix_fmt and 77 | * height height. 78 | * 79 | * @param data pointers array to be filled with the pointer for each image plane 80 | * @param ptr the pointer to a buffer which will contain the image 81 | * @param linesizes the array containing the linesize for each 82 | * plane, should be filled by av_image_fill_linesizes() 83 | * @return the size in bytes required for the image buffer, a negative 84 | * error code in case of failure 85 | *) 86 | Function av_image_fill_pointers(data: PArray4PByte; pix_fmt: TAVPixelFormat; height: integer; 87 | ptr : PByte; const linesizes: TArray4Integer): integer; 88 | cdecl; external LIB_AVUTIL; 89 | (** 90 | * Allocate an image with size w and h and pixel format pix_fmt, and 91 | * fill pointers and linesizes accordingly. 92 | * The allocated image buffer has to be freed by using 93 | * av_freep(&pointers[0]). 94 | * 95 | * @param align the value to use for buffer size alignment 96 | * @return the size in bytes required for the image buffer, a negative 97 | * error code in case of failure 98 | *) 99 | Function av_image_alloc(pointers: PArray4PByte; linesizes: PInteger {TArray4Integer}; 100 | w, h : integer; pix_fmt : TAVPixelFormat; align : integer): integer; 101 | cdecl; external LIB_AVUTIL; 102 | (** 103 | * Copy image plane from src to dst. 104 | * That is, copy "height" number of lines of "bytewidth" bytes each. 105 | * The first byte of each successive line is separated by *_linesize 106 | * bytes. 107 | * 108 | * bytewidth must be contained by both absolute values of dst_linesize 109 | * and src_linesize, otherwise the function behavior is undefined. 110 | * 111 | * @param dst_linesize linesize for the image plane in dst 112 | * @param src_linesize linesize for the image plane in src 113 | *) 114 | Procedure av_image_copy_plane(var dst: PByte; dst_linesize : integer; 115 | const src : PByte; const src_linesize : integer; 116 | bytewidth: integer; height: integer); 117 | cdecl; external LIB_AVUTIL; 118 | (** 119 | * Copy image in src_data to dst_data. 120 | * 121 | * @param dst_linesizes linesizes for the image in dst_data 122 | * @param src_linesizes linesizes for the image in src_data 123 | *) 124 | Procedure av_image_copy(dst_data: PArray4PByte; dst_linesizes: PInteger; 125 | const src_data: PArray4PByte; src_linesizes: PInteger; 126 | pix_fmt: TAVPixelFormat; width, height : integer); 127 | cdecl; external LIB_AVUTIL; 128 | 129 | 130 | (** 131 | * Setup the data pointers and linesizes based on the specified image 132 | * parameters and the provided array. 133 | * 134 | * The fields of the given image are filled in by using the src 135 | * address which points to the image data buffer. Depending on the 136 | * specified pixel format, one or multiple image data pointers and 137 | * line sizes will be set. If a planar format is specified, several 138 | * pointers will be set pointing to the different picture planes and 139 | * the line sizes of the different planes will be stored in the 140 | * lines_sizes array. Call with src == NULL to get the required 141 | * size for the src buffer. 142 | * 143 | * To allocate the buffer and fill in the dst_data and dst_linesize in 144 | * one call, use av_image_alloc(). 145 | * 146 | * @param dst_data data pointers to be filled in 147 | * @param dst_linesizes linesizes for the image in dst_data to be filled in 148 | * @param src buffer which will contain or contains the actual image data, can be NULL 149 | * @param pix_fmt the pixel format of the image 150 | * @param width the width of the image in pixels 151 | * @param height the height of the image in pixels 152 | * @param align the value used in src for linesize alignment 153 | * @return the size in bytes required for src, a negative error code 154 | * in case of failure 155 | *) 156 | function av_image_fill_arrays(var dst_data : PArray4PByte; dst_linesize : TArray4Integer; 157 | const src: PByte; 158 | pix_fmt : TAVPixelFormat; width : integer; height : integer; align : integer): integer; 159 | cdecl; external LIB_AVUTIL; 160 | 161 | (** 162 | * Return the size in bytes of the amount of data required to store an 163 | * image with the given parameters. 164 | * 165 | * @param[in] align the assumed linesize alignment 166 | *) 167 | function av_image_get_buffer_size(pix_fmt : TAVPixelFormat; width : integer; height : integer; align : integer): integer; 168 | cdecl; external LIB_AVUTIL; 169 | 170 | (** 171 | * Copy image data from an image into a buffer. 172 | * 173 | * av_image_get_buffer_size() can be used to compute the required size 174 | * for the buffer to fill. 175 | * 176 | * @param dst a buffer into which picture data will be copied 177 | * @param dst_size the size in bytes of dst 178 | * @param src_data pointers containing the source image data 179 | * @param src_linesizes linesizes for the image in src_data 180 | * @param pix_fmt the pixel format of the source image 181 | * @param width the width of the source image in pixels 182 | * @param height the height of the source image in pixels 183 | * @param align the assumed linesize alignment for dst 184 | * @return the number of bytes written to dst, or a negative value 185 | * (error code) on error 186 | *) 187 | function av_image_copy_to_buffer(var dst : PByte; dst_size : integer; 188 | const src_data : PArray4PByte; const src_linesize : TArray4Integer; 189 | pix_fmt : TAVPixelFormat; width : integer; height : integer; align : integer): integer; 190 | cdecl; external LIB_AVUTIL; 191 | 192 | (** 193 | * Check if the given dimension of an image is valid, meaning that all 194 | * bytes of the image can be addressed with a signed int. 195 | * 196 | * @param w the width of the picture 197 | * @param h the height of the picture 198 | * @param log_offset the offset to sum to the log level for logging with log_ctx 199 | * @param log_ctx the parent logging context, it may be NULL 200 | * @return >= 0 if valid, a negative error code otherwise 201 | *) 202 | Function av_image_check_size(w : cardinal; h: cardinal; log_offset : integer; log_ctx : Pointer): integer; 203 | cdecl; external LIB_AVUTIL; 204 | 205 | (** 206 | * Check if the given sample aspect ratio of an image is valid. 207 | * 208 | * It is considered invalid if the denominator is 0 or if applying the ratio 209 | * to the image size would make the smaller dimension less than 1. If the 210 | * sar numerator is 0, it is considered unknown and will return as valid. 211 | * 212 | * @param w width of the image 213 | * @param h height of the image 214 | * @param sar sample aspect ratio of the image 215 | * @return 0 if valid, a negative AVERROR code otherwise 216 | *) 217 | function av_image_check_sar(w : cardinal; h : cardinal; sar : TAVRational): integer; 218 | cdecl; external LIB_AVUTIL; 219 | 220 | (** 221 | * @} 222 | *) 223 | 224 | 225 | {$EndIf} (* AVUTIL_IMGUTILS_H *) 226 | 227 | 228 | 229 | 230 | -------------------------------------------------------------------------------- /Include/libavutil/mathematics.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * copyright (c) 2005-2012 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *) 20 | 21 | {$ifndef AVUTIL_MATHEMATICS_H} 22 | {$define AVUTIL_MATHEMATICS_H} 23 | 24 | const 25 | {$IFNDEF M_E} 26 | M_E = 2.7182818284590452354; (* e *) 27 | {$ENDIF} 28 | {$IFNDEF M_LN2} 29 | M_LN2 = 0.69314718055994530942; (* log_e 2 *) 30 | {$ENDIF} 31 | {$IFNDEF M_LN10} 32 | M_LN10 = 2.30258509299404568402; (* log_e 10 *) 33 | {$ENDIF} 34 | {$IFNDEF M_LOG2_10} 35 | M_LOG2_10 = 3.32192809488736234787; (* log_2 10 *) 36 | {$ENDIF} 37 | {$IFNDEF M_PHI} 38 | M_PHI = 1.61803398874989484820; (* phi / golden ratio *) 39 | {$ENDIF} 40 | {$IFNDEF M_PI} 41 | M_PI = 3.14159265358979323846; (* pi *) 42 | {$ENDIF} 43 | {$IFNDEF M_PI_2} 44 | M_PI_2 = 1.57079632679489661923; (* pi/2 *) 45 | {$ENDIF} 46 | {$IFNDEF M_SQRT1_2} 47 | M_SQRT1_2 = 0.70710678118654752440; (* 1/sqrt(2) *) 48 | {$ENDIF} 49 | {$IFNDEF M_SQRT2} 50 | M_SQRT2 = 1.41421356237309504880; (* sqrt(2) *) 51 | {$ENDIF} 52 | {$IFNDEF NAN} 53 | NAN = $7fc00000; 54 | {$ENDIF} 55 | {$IFNDEF INFINITY} 56 | INFINITY = $7f800000; 57 | {$ENDIF} 58 | 59 | 60 | (** 61 | * @addtogroup lavu_math 62 | * @ 63 | *) 64 | 65 | type 66 | TAVRounding = ( 67 | AV_ROUND_ZERO = 0, ///< Round toward zero. 68 | AV_ROUND_INF = 1, ///< Round away from zero. 69 | AV_ROUND_DOWN = 2, ///< Round toward -infinity. 70 | AV_ROUND_UP = 3, ///< Round toward +infinity. 71 | AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. 72 | AV_ROUND_PASS_MINMAX = 8192 ///< Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE 73 | ); 74 | 75 | (** 76 | * Return the greatest common divisor of a and b. 77 | * If both a or b are 0 or either or both are <0 then behavior is 78 | * undefined. 79 | *) 80 | function av_gcd(a: int64; b: int64): int64; 81 | cdecl; external LIB_AVUTIL; 82 | 83 | (** 84 | * Rescale a 64-bit integer with rounding to nearest. 85 | * A simple a*b/c isn't possible as it can overflow. 86 | *) 87 | function av_rescale (a, b, c: int64): int64; 88 | cdecl; external LIB_AVUTIL; (* verified: mail@freehand.com.ua, 2014-09-05: + *) 89 | 90 | (** 91 | * Rescale a 64-bit integer with specified rounding. 92 | * A simple a*b/c isn't possible as it can overflow. 93 | * 94 | * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is 95 | * INT64_MIN or INT64_MAX then a is passed through unchanged. 96 | *) 97 | function av_rescale_rnd (a, b, c: int64; enum: TAVRounding): int64; 98 | cdecl; external LIB_AVUTIL; 99 | 100 | (** 101 | * Rescale a 64-bit integer by 2 rational numbers. 102 | *) 103 | function av_rescale_q (a: int64; bq, cq: TAVRational): int64; 104 | cdecl; external LIB_AVUTIL; 105 | 106 | (** 107 | * Rescale a 64-bit integer by 2 rational numbers with specified rounding. 108 | * 109 | * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is 110 | * INT64_MIN or INT64_MAX then a is passed through unchanged. 111 | *) 112 | function av_rescale_q_rnd(a: int64; bq, cq: TAVRational; 113 | enum: integer): int64; (* verified: mail@freehand.com.ua, 2014-08-29: + *) 114 | cdecl; external LIB_AVUTIL; 115 | 116 | (** 117 | * Compare 2 timestamps each in its own timebases. 118 | * The result of the function is undefined if one of the timestamps 119 | * is outside the int64_t range when represented in the others timebase. 120 | * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position 121 | *) 122 | function av_compare_ts(ts_a: int64; tb_a: TAVRational; ts_b: int64; tb_b: TAVRational): integer; 123 | cdecl; external LIB_AVUTIL; 124 | 125 | (** 126 | * Compare 2 integers modulo mod. 127 | * That is we compare integers a and b for which only the least 128 | * significant log2(mod) bits are known. 129 | * 130 | * @param mod must be a power of 2 131 | * @return a negative value if a is smaller than b 132 | * a positiv value if a is greater than b 133 | * 0 if a equals b 134 | *) 135 | function av_compare_mod(a: int64; b: int64; modVar: int64): int64; 136 | cdecl; external LIB_AVUTIL; 137 | 138 | (** 139 | * Rescale a timestamp while preserving known durations. 140 | * 141 | * @param in_ts Input timestamp 142 | * @param in_tb Input timesbase 143 | * @param fs_tb Duration and *last timebase 144 | * @param duration duration till the next call 145 | * @param out_tb Output timesbase 146 | *) 147 | function av_rescale_delta(in_tb: TAVRational; in_ts: int64; fs_tb: TAVRational; duration: integer; last: PInt64; out_tb: TAVRational): int64; 148 | cdecl; external LIB_AVUTIL; 149 | 150 | (** 151 | * Add a value to a timestamp. 152 | * 153 | * This function guarantees that when the same value is repeatly added that 154 | * no accumulation of rounding errors occurs. 155 | * 156 | * @param ts Input timestamp 157 | * @param ts_tb Input timestamp timebase 158 | * @param inc value to add to ts 159 | * @param inc_tb inc timebase 160 | *) 161 | function av_add_stable(in_tb: TAVRational; ts: int64; inc_tb: TAVRational; inc: int64): int64; 162 | cdecl; external LIB_AVUTIL; 163 | 164 | {$endif} (* AVUTIL_MATHEMATICS_H *) 165 | -------------------------------------------------------------------------------- /Include/libavutil/parseutils.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | {$ifndef AVUTIL_PARSEUTILS_H} 20 | {$define AVUTIL_PARSEUTILS_H} 21 | 22 | (** 23 | * @file 24 | * misc parsing utilities 25 | *) 26 | 27 | (** 28 | * Parse str and store the parsed ratio in q. 29 | * 30 | * Note that a ratio with infinite (1/0) or negative value is 31 | * considered valid, so you should check on the returned value if you 32 | * want to exclude those values. 33 | * 34 | * The undefined value can be expressed using the "0:0" string. 35 | * 36 | * @param[in,out] q pointer to the AVRational which will contain the ratio 37 | * @param[in] str the string to parse: it has to be a string in the format 38 | * num:den, a float number or an expression 39 | * @param[in] max the maximum allowed numerator and denominator 40 | * @param[in] log_offset log level offset which is applied to the log 41 | * level of log_ctx 42 | * @param[in] log_ctx parent logging context 43 | * @return >= 0 on success, a negative error code otherwise 44 | *) 45 | function av_parse_ratio(q: PAVRational; const str: PAnsiChar; max: integer; 46 | log_offset: integer; log_ctx: pointer): integer; 47 | cdecl; external LIB_AVUTIL; 48 | 49 | //#define av_parse_ratio_quiet(rate, str, max) \ 50 | // av_parse_ratio(rate, str, max, AV_LOG_MAX_OFFSET, NULL) 51 | 52 | (** 53 | * Parse str and put in width_ptr and height_ptr the detected values. 54 | * 55 | * @param[in,out] width_ptr pointer to the variable which will contain the detected 56 | * width value 57 | * @param[in,out] height_ptr pointer to the variable which will contain the detected 58 | * height value 59 | * @param[in] str the string to parse: it has to be a string in the format 60 | * width x height or a valid video size abbreviation. 61 | * @return >= 0 on success, a negative error code otherwise 62 | *) 63 | function av_parse_video_size(width_ptr: PInteger; height_ptr: PInteger; const str: PAnsiChar): integer; 64 | cdecl; external LIB_AVUTIL; 65 | 66 | (** 67 | * Parse str and store the detected values in *rate. 68 | * 69 | * @param[in,out] rate pointer to the AVRational which will contain the detected 70 | * frame rate 71 | * @param[in] str the string to parse: it has to be a string in the format 72 | * rate_num / rate_den, a float number or a valid video rate abbreviation 73 | * @return >= 0 on success, a negative error code otherwise 74 | *) 75 | function av_parse_video_rate(rate: PAVRational; const str: PAnsiChar): integer; 76 | cdecl; external LIB_AVUTIL; 77 | 78 | (** 79 | * Put the RGBA values that correspond to color_string in rgba_color. 80 | * 81 | * @param color_string a string specifying a color. It can be the name of 82 | * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, 83 | * possibly followed by "@" and a string representing the alpha 84 | * component. 85 | * The alpha component may be a string composed by "0x" followed by an 86 | * hexadecimal number or a decimal number between 0.0 and 1.0, which 87 | * represents the opacity value (0x00/0.0 means completely transparent, 88 | * 0xff/1.0 completely opaque). 89 | * If the alpha component is not specified then 0xff is assumed. 90 | * The string "random" will result in a random color. 91 | * @param slen length of the initial part of color_string containing the 92 | * color. It can be set to -1 if color_string is a null terminated string 93 | * containing nothing else than the color. 94 | * @return >= 0 in case of success, a negative value in case of 95 | * failure (for example if color_string cannot be parsed). 96 | *) 97 | function av_parse_color(rgba_color: array of Byte; color_string: PAnsiChar; slen: integer; 98 | log_ctx: Pointer): integer; 99 | cdecl; external LIB_AVUTIL; 100 | 101 | (** 102 | * Get the name of a color from the internal table of hard-coded named 103 | * colors. 104 | * 105 | * This function is meant to enumerate the color names recognized by 106 | * av_parse_color(). 107 | * 108 | * @param color_idx index of the requested color, starting from 0 109 | * @param rgbp if not NULL, will point to a 3-elements array with the color value in RGB 110 | * @return the color name string or NULL if color_idx is not in the array 111 | *) 112 | function av_get_known_color_name(color_idx: integer; const rgb: array of Byte): PAnsiChar; 113 | cdecl; external LIB_AVUTIL; 114 | 115 | (** 116 | * Parse timestr and return in *time a corresponding number of 117 | * microseconds. 118 | * 119 | * @param timeval puts here the number of microseconds corresponding 120 | * to the string in timestr. If the string represents a duration, it 121 | * is the number of microseconds contained in the time interval. If 122 | * the string is a date, is the number of microseconds since 1st of 123 | * January, 1970 up to the time of the parsed date. If timestr cannot 124 | * be successfully parsed, set *time to INT64_MIN. 125 | 126 | * @param timestr a string representing a date or a duration. 127 | * - If a date the syntax is: 128 | * @code 129 | * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH:MM:SS[.m...]]]}|{HHMMSS[.m...]]]}}[Z] 130 | * now 131 | * @endcode 132 | * If the value is "now" it takes the current time. 133 | * Time is local time unless Z is appended, in which case it is 134 | * interpreted as UTC. 135 | * If the year-month-day part is not specified it takes the current 136 | * year-month-day. 137 | * - If a duration the syntax is: 138 | * @code 139 | * [-][HH:]MM:SS[.m...] 140 | * [-]S+[.m...] 141 | * @endcode 142 | * @param duration flag which tells how to interpret timestr, if not 143 | * zero timestr is interpreted as a duration, otherwise as a date 144 | * @return >= 0 in case of success, a negative value corresponding to an 145 | * AVERROR code otherwise 146 | *) 147 | function av_parse_time(var timeval: Int64; const timestr: PAnsiChar; duration: integer): integer; 148 | cdecl; external LIB_AVUTIL; 149 | 150 | (** 151 | * Attempt to find a specific tag in a URL. 152 | * 153 | * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. 154 | * Return 1 if found. 155 | *) 156 | function av_find_info_tag(arg: PAnsiChar; arg_size: integer; const tag1: PAnsiChar; const info: PAnsiChar): integer; 157 | cdecl; external LIB_AVUTIL; 158 | 159 | (** 160 | * Simplified version of strptime 161 | * 162 | * Parse the input string p according to the format string fmt and 163 | * store its results in the structure dt. 164 | * This implementation supports only a subset of the formats supported 165 | * by the standard strptime(). 166 | * 167 | * The supported input field descriptors are listed below. 168 | * - %H: the hour as a decimal number, using a 24-hour clock, in the 169 | * range '00' through '23' 170 | * - %J: hours as a decimal number, in the range '0' through INT_MAX 171 | * - %M: the minute as a decimal number, using a 24-hour clock, in the 172 | * range '00' through '59' 173 | * - %S: the second as a decimal number, using a 24-hour clock, in the 174 | * range '00' through '59' 175 | * - %Y: the year as a decimal number, using the Gregorian calendar 176 | * - %m: the month as a decimal number, in the range '1' through '12' 177 | * - %d: the day of the month as a decimal number, in the range '1' 178 | * through '31' 179 | * - %T: alias for '%H:%M:%S' 180 | * - %%: a literal '%' 181 | * 182 | * @return a pointer to the first character not processed in this function 183 | * call. In case the input string contains more characters than 184 | * required by the format string the return value points right after 185 | * the last consumed input character. In case the whole input string 186 | * is consumed the return value points to the null byte at the end of 187 | * the string. On failure NULL is returned. 188 | *) 189 | function av_small_strptime(const p: PAnsiChar; const fmt: PAnsiChar; dt: Ptm): PAnsiChar; 190 | cdecl; external LIB_AVUTIL; 191 | 192 | (** 193 | * Convert the decomposed UTC time in tm to a time_t value. 194 | *) 195 | function av_timegm(tm : PTm): integer; 196 | cdecl; external LIB_AVUTIL; 197 | 198 | {$endif} (* AVUTIL_PARSEUTILS_H *) 199 | 200 | -------------------------------------------------------------------------------- /Include/libavutil/rational.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * rational numbers 3 | * Copyright (c) 2003 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | *) 21 | 22 | (** 23 | * @file 24 | * rational numbers 25 | * @author Michael Niedermayer 26 | *) 27 | 28 | {$ifndef AVUTIL_RATIONAL_H} 29 | {$define AVUTIL_RATIONAL_H} 30 | 31 | type 32 | (** 33 | * rational number numerator/denominator 34 | *) 35 | PAVRational = ^TAVRational; 36 | TAVRational = record 37 | num: integer; ///< numerator 38 | den: integer; ///< denominator 39 | end; (* size: x64:8, x86:8; verified: mail@freehand.com.ua; 2014-08-26: + *) 40 | 41 | (** 42 | * Create a rational. 43 | * Useful for compilers that do not support compound literals. 44 | * @note The return value is not reduced. 45 | *) 46 | function av_make_q(num: integer; den: integer): TAVRational; inline; 47 | 48 | (** 49 | * Compare two rationals. 50 | * @param a first rational 51 | * @param b second rational 52 | * @return 0 if a==b, 1 if a>b, -1 if a 3 | * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | *) 21 | 22 | (** 23 | * @file 24 | * Timecode helpers header 25 | *) 26 | 27 | {$ifndef AVUTIL_TIMECODE_H} 28 | {$define AVUTIL_TIMECODE_H} 29 | 30 | 31 | Const 32 | AV_TIMECODE_STR_SIZE = 16; 33 | 34 | Type 35 | AVTimecodeFlag =( 36 | AV_TIMECODE_FLAG_DROPFRAME = 1 Shl 0, ///< timecode is drop frame 37 | AV_TIMECODE_FLAG_24HOURSMAX = 1 Shl 1, ///< timecode wraps after 24 hours 38 | AV_TIMECODE_FLAG_ALLOWNEGATIVE = 1 Shl 2 ///< negative time values are allowed 39 | ); 40 | 41 | Type 42 | PAVTimecode = ^TAVTimecode; 43 | TAVTimecode = record 44 | start : integer; ///< timecode frame start (first base frame number) 45 | flags : cardinal; ///< flags such as drop frame, +24 hours support, ... 46 | rate : TAVRational; ///< frame rate in rational form 47 | fps : cardinal; ///< frame per second; must be consistent with the rate field 48 | end; (* verified: mail@freehand.com.ua; 2014-09-01: + *) 49 | 50 | (** 51 | * Adjust frame number for NTSC drop frame time code. 52 | * 53 | * @param framenum frame number to adjust 54 | * @param fps frame per second, 30 or 60 55 | * @return adjusted frame number 56 | * @warning adjustment is only valid in NTSC 29.97 and 59.94 57 | *) 58 | Function av_timecode_adjust_ntsc_framenum2(framenum, fps : integer) : integer; 59 | cdecl; external LIB_AVUTIL; 60 | (** 61 | * Convert frame number to SMPTE 12M binary representation. 62 | * 63 | * @param tc timecode data correctly initialized 64 | * @param framenum frame number 65 | * @return the SMPTE binary representation 66 | * 67 | * @note Frame number adjustment is automatically done in case of drop timecode, 68 | * you do NOT have to call av_timecode_adjust_ntsc_framenum2(). 69 | * @note The frame number is relative to tc->start. 70 | * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity 71 | * correction (PC) bits are set to zero. 72 | *) 73 | Function av_timecode_get_smpte_from_framenum(const tc : PAVTimecode; framenum : integer): cardinal; 74 | cdecl; external LIB_AVUTIL; 75 | (** 76 | * Load timecode string in buf. 77 | * 78 | * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long 79 | * @param tc timecode data correctly initialized 80 | * @param framenum frame number 81 | * @return the buf parameter 82 | * 83 | * @note Timecode representation can be a negative timecode and have more than 84 | * 24 hours, but will only be honored if the flags are correctly set. 85 | * @note The frame number is relative to tc->start. 86 | *) 87 | Function av_timecode_make_string(tc: PAVTimecode; buf : PAnsiChar; framenum: integer): PAnsiChar; 88 | cdecl; external LIB_AVUTIL; (* verified: mail@freehand.com.ua; 2014-09-09: + *) 89 | (** 90 | * Get the timecode string from the SMPTE timecode format. 91 | * 92 | * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long 93 | * @param tcsmpte the 32-bit SMPTE timecode 94 | * @param prevent_df prevent the use of a drop flag when it is known the DF bit 95 | * is arbitrary 96 | * @return the buf parameter 97 | *) 98 | Function av_timecode_make_smpte_tc_string(buf: PAnsiChar; tcsmpte: cardinal; prevent_df: integer): PAnsiChar; 99 | cdecl; external LIB_AVUTIL; 100 | (** 101 | * Get the timecode string from the 25-bit timecode format (MPEG GOP format). 102 | * 103 | * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long 104 | * @param tc25bit the 25-bits timecode 105 | * @return the buf parameter 106 | *) 107 | Function av_timecode_make_mpeg_tc_string(buf: PAnsiChar; tc25bit: cardinal): PAnsiChar; 108 | cdecl; external LIB_AVUTIL; 109 | (** 110 | * Init a timecode struct with the passed parameters. 111 | * 112 | * @param log_ctx a pointer to an arbitrary struct of which the first field 113 | * is a pointer to an AVClass struct (used for av_log) 114 | * @param tc pointer to an allocated AVTimecode 115 | * @param rate frame rate in rational form 116 | * @param flags miscellaneous flags such as drop frame, +24 hours, ... 117 | * (see AVTimecodeFlag) 118 | * @param frame_start the first frame number 119 | * @return 0 on success, AVERROR otherwise 120 | *) 121 | Function av_timecode_init(tc: PAVTimecode; rate: TAVRational; flags : integer; frame_start: integer; log_ctx : Pointer): integer; 122 | cdecl; external LIB_AVUTIL; (* verified: mail@freehand.com.ua; 2014-09-01: + *) 123 | (** 124 | * Parse timecode representation (hh:mm:ss[:;.]ff). 125 | * 126 | * @param log_ctx a pointer to an arbitrary struct of which the first field is a 127 | * pointer to an AVClass struct (used for av_log). 128 | * @param tc pointer to an allocated AVTimecode 129 | * @param rate frame rate in rational form 130 | * @param str timecode string which will determine the frame start 131 | * @return 0 on success, AVERROR otherwise 132 | *) 133 | Function av_timecode_init_from_string(tc: PAVTimecode; rate: TAVRational; str: PAnsiChar; log_ctx: Pointer): integer; 134 | cdecl; external LIB_AVUTIL; 135 | (** 136 | * Check if the timecode feature is available for the given frame rate 137 | * 138 | * @return 0 if supported, <0 otherwise 139 | *) 140 | Function av_timecode_check_frame_rate(rate: TAVRational): integer; 141 | cdecl; external LIB_AVUTIL; (* verified: mail@freehand.com.ua; 2014-09-09: + *) 142 | 143 | {$endif} (* AVUTIL_TIMECODE_H *) 144 | -------------------------------------------------------------------------------- /Include/libavutil/timestamp.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | (** 20 | * @file 21 | * timestamp utils, mostly useful for debugging/logging purposes 22 | *) 23 | 24 | {$ifndef AVUTIL_TIMESTAMP_H} 25 | {$define AVUTIL_TIMESTAMP_H} 26 | 27 | const 28 | AV_TS_MAX_STRING_SIZE = 32; 29 | 30 | 31 | (** 32 | * Fill the provided buffer with a string containing a timestamp 33 | * representation. 34 | * 35 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 36 | * @param ts the timestamp to represent 37 | * @return the buffer in input 38 | *) 39 | Function av_ts_make_string(buf : PAnsiChar; ts: int64): PAnsiChar; // Note: see in avutil.pas 40 | 41 | {** 42 | * Convenience macro, the return value should be used only directly in 43 | * function arguments but never stand-alone. 44 | *} 45 | Function av_ts2str(ts: int64): PAnsiChar; // Note: see in avutil.pas 46 | 47 | (** 48 | * Fill the provided buffer with a string containing a timestamp time 49 | * representation. 50 | * 51 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 52 | * @param ts the timestamp to represent 53 | * @param tb the timebase of the timestamp 54 | * @return the buffer in input 55 | *) 56 | Function av_ts_make_time_string(buf : PAnsiChar; ts : int64; tb: PAVRational): PAnsiChar; // Note: see in avutil.pas 57 | 58 | (** 59 | * Convenience macro, the return value should be used only directly in 60 | * function arguments but never stand-alone. 61 | *) 62 | 63 | Function av_ts2timestr(ts: int64; tb: PAVRational): PAnsiChar; // Note: see in avutil.pas 64 | 65 | {$endif} (* AVUTIL_TIMESTAMP_H *) 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Include/libavutil/version.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * copyright (c) 2003 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *) 20 | 21 | {$ifndef AVUTIL_VERSION_H} 22 | {$define AVUTIL_VERSION_H} 23 | 24 | (** 25 | * @addtogroup version_utils 26 | * 27 | * Useful to check and match library version in order to maintain 28 | * backward compatibility. 29 | * 30 | * @{ 31 | *) 32 | 33 | function AV_VERSION_INT(a, b, c: integer): integer; // Note: see in avutil.pas 34 | 35 | function AV_VERSION_DOT(a, b, c: integer): PAnsiChar; // Note: see in avutil.pas 36 | 37 | function AV_VERSION(a, b, c: integer): PAnsiChar; // Note: see in avutil.pas 38 | 39 | 40 | (** 41 | * @ 42 | *) 43 | 44 | (** 45 | * @file 46 | * @ingroup lavu 47 | * Libavutil version macros 48 | *) 49 | 50 | (** 51 | * @defgroup lavu_ver Version and Build diagnostics 52 | * 53 | * Macros and function useful to check at compiletime and at runtime 54 | * which version of libavutil is in use. 55 | * 56 | * @ 57 | *) 58 | 59 | const 60 | 61 | LIB_AVUTIL = 'avutil-54'; 62 | LIBAVUTIL_VERSION_MAJOR = 54; 63 | LIBAVUTIL_VERSION_MINOR = 31; 64 | LIBAVUTIL_VERSION_MICRO = 100; 65 | //LIBAVUTIL_VERSION = AV_VERSION(LIBAVUTIL_VERSION_MAJOR, LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO); 66 | LIBAVUTIL_VERSION_INT = ((LIBAVUTIL_VERSION_MAJOR shl 16) or (LIBAVUTIL_VERSION_MINOR shl 8) or LIBAVUTIL_VERSION_MICRO); 67 | LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; 68 | LIBAVUTIL_IDENT = 'Lavu'; 69 | 70 | (** 71 | * @} 72 | * 73 | * @defgroup depr_guards Deprecation guards 74 | * FF_API_* defines may be placed below to indicate public API that will be 75 | * dropped at a future version bump. The defines themselves are not part of 76 | * the public API and may change, break or disappear at any time. 77 | * 78 | * @note, when bumping the major version it is recommended to manually 79 | * disable each FF_API_* in its own commit instead of disabling them all 80 | * at once through the bump. This improves the git bisect-ability of the change. 81 | * 82 | * @{ 83 | *) 84 | 85 | {$IFNDEF FF_API_OLD_AVOPTIONS} 86 | FF_API_OLD_AVOPTIONS = (LIBAVUTIL_VERSION_MAJOR < 55); 87 | {$ENDIF} 88 | {$IFNDEF FF_API_PIX_FMT} 89 | FF_API_PIX_FMT = (LIBAVUTIL_VERSION_MAJOR < 55); 90 | {$ENDIF} 91 | {$IFNDEF FF_API_CONTEXT_SIZE} 92 | FF_API_CONTEXT_SIZE = (LIBAVUTIL_VERSION_MAJOR < 55); 93 | {$ENDIF} 94 | {$IFNDEF FF_API_PIX_FMT_DESC} 95 | FF_API_PIX_FMT_DESC = (LIBAVUTIL_VERSION_MAJOR < 55); 96 | {$ENDIF} 97 | {$IFNDEF FF_API_AV_REVERSE} 98 | FF_API_AV_REVERSE = (LIBAVUTIL_VERSION_MAJOR < 55); 99 | {$ENDIF} 100 | {$IFNDEF FF_API_AUDIOCONVERT} 101 | FF_API_AUDIOCONVERT = (LIBAVUTIL_VERSION_MAJOR < 55); 102 | {$ENDIF} 103 | {$IFNDEF FF_API_CPU_FLAG_MMX2} 104 | FF_API_CPU_FLAG_MMX2 = (LIBAVUTIL_VERSION_MAJOR < 55); 105 | {$ENDIF} 106 | {$IFNDEF FF_API_LLS_PRIVATE} 107 | FF_API_LLS_PRIVATE = (LIBAVUTIL_VERSION_MAJOR < 55); 108 | {$ENDIF} 109 | {$IFNDEF FF_API_AVFRAME_LAVC} 110 | FF_API_AVFRAME_LAVC = (LIBAVUTIL_VERSION_MAJOR < 55); 111 | {$ENDIF} 112 | {$IFNDEF FF_API_VDPAU} 113 | FF_API_VDPAU = (LIBAVUTIL_VERSION_MAJOR < 55); 114 | {$ENDIF} 115 | {$IFNDEF FF_API_GET_CHANNEL_LAYOUT_COMPAT} 116 | FF_API_GET_CHANNEL_LAYOUT_COMPAT = (LIBAVUTIL_VERSION_MAJOR < 55); 117 | {$ENDIF} 118 | {$IFNDEF FF_API_XVMC} 119 | FF_API_XVMC = (LIBAVUTIL_VERSION_MAJOR < 55); 120 | {$ENDIF} 121 | {$IFNDEF FF_API_OPT_TYPE_METADATA} 122 | FF_API_OPT_TYPE_METADATA = (LIBAVUTIL_VERSION_MAJOR < 55); 123 | {$ENDIF} 124 | 125 | {$IFNDEF FF_API_DLOG} 126 | FF_API_DLOG = (LIBAVUTIL_VERSION_MAJOR < 55); 127 | {$ENDIF} 128 | {$IFNDEF FF_API_HMAC} 129 | FF_API_HMAC = (LIBAVUTIL_VERSION_MAJOR < 55); 130 | {$ENDIF} 131 | {$IFNDEF FF_API_VAAPI} 132 | FF_API_VAAPI = (LIBAVUTIL_VERSION_MAJOR < 56); 133 | {$ENDIF} 134 | 135 | {$IFNDEF FF_CONST_AVUTIL55} 136 | {$IF LIBAVUTIL_VERSION_MAJOR >= 55} 137 | {$DEFINE FF_CONST_AVUTIL55} 138 | {$ELSE} 139 | {$DEFINE FF_CONST_AVUTIL55} 140 | {$ENDIF} 141 | {$ENDIF} 142 | 143 | 144 | 145 | (** 146 | * @ 147 | *) 148 | 149 | {$ENDIF} (* AVUTIL_VERSION_H *) 150 | 151 | -------------------------------------------------------------------------------- /Include/libpostproc/postprocess.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at) 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | *) 21 | 22 | (** 23 | * Conversion to Pascal Copyright 2014 (c) Oleksandr Nazaruk 24 | * 25 | *) 26 | 27 | 28 | unit postprocess; 29 | 30 | 31 | {$MINENUMSIZE 4} 32 | 33 | {$IFDEF DARWIN} 34 | {$linklib postprocess} 35 | {$ENDIF} 36 | 37 | interface 38 | 39 | 40 | uses 41 | avutil; 42 | 43 | {$INCLUDE version.pas} 44 | 45 | 46 | (** 47 | * Return the LIBPOSTPROC_VERSION_INT constant. 48 | *) 49 | function postproc_version(): cardinal; 50 | cdecl; external LIB_POSTPROC; 51 | 52 | (** 53 | * Return the libpostproc build-time configuration. 54 | *) 55 | function postproc_configuration(): PAnsiChar; 56 | cdecl; external LIB_POSTPROC; 57 | 58 | 59 | (** 60 | * Return the libpostproc license. 61 | *) 62 | function postproc_license(): PAnsiChar; 63 | cdecl; external LIB_POSTPROC; 64 | 65 | 66 | type 67 | {$IF FF_API_QP_TYPE} 68 | QP_STORE_T = shortint; //deprecated 69 | PQP_STORE_T = ^QP_STORE_T; //deprecated 70 | {$ENDIF} 71 | TByteQuadArray = array[0..3] of byte; 72 | PByteQuadArray = ^TByteQuadArray; 73 | TIntegerQuadArray = array[0..3] of integer; 74 | 75 | 76 | const 77 | PP_QUALITY_MAX = 6 ; 78 | 79 | type 80 | pp_context = pointer; 81 | pp_mode = pointer; 82 | 83 | {$IF LIBPOSTPROC_VERSION_INT < (52 shl 16)} 84 | pp_context_t = record 85 | {internal structure} 86 | end; 87 | pp_context = ^pp_context_t; 88 | pp_mode_t = record 89 | {internal structure} 90 | end; 91 | pp_mode = ^pp_mode_t; 92 | pp_help: PAnsiChar; 93 | {$ELSE} 94 | pp_help = array of AnsiChar; 95 | {$ENDIF} 96 | 97 | procedure pp_postprocess(src: PByteQuadArray; const srcStride: TIntegerQuadArray; 98 | dst: PByteQuadArray; const dstStride: TIntegerQuadArray; 99 | horizontalSize: integer; verticalSize: integer; 100 | QP_store: PShortint; QP_stride: integer; 101 | mode: pp_mode; Context: pp_context; pict_type: integer); 102 | cdecl; external LIB_POSTPROC; 103 | 104 | 105 | (** 106 | * Return a pp_mode or NULL if an error occurred. 107 | * 108 | * @param name the string after "-pp" on the command line 109 | * @param quality a number from 0 to PP_QUALITY_MAX 110 | *) 111 | function pp_get_mode_by_name_and_quality(name: PAnsiChar; quality: integer): pp_mode; 112 | cdecl; external LIB_POSTPROC; 113 | 114 | procedure pp_free_mode(mode: pp_mode); 115 | cdecl; external LIB_POSTPROC; 116 | 117 | function pp_get_context(width: integer; height: integer; flags: integer): pp_context; 118 | cdecl; external LIB_POSTPROC; 119 | 120 | procedure pp_free_context(Context: pp_context); 121 | cdecl; external LIB_POSTPROC; 122 | 123 | const 124 | PP_CPU_CAPS_MMX = $80000000; 125 | PP_CPU_CAPS_MMX2 = $20000000; 126 | PP_CPU_CAPS_3DNOW = $40000000; 127 | PP_CPU_CAPS_ALTIVEC = $10000000; 128 | PP_CPU_CAPS_AUTO = $00080000; 129 | 130 | PP_FORMAT = $00000008; 131 | PP_FORMAT_420 = ($00000011 or PP_FORMAT); 132 | PP_FORMAT_422 = ($00000001 or PP_FORMAT); 133 | PP_FORMAT_411 = ($00000002 or PP_FORMAT); 134 | PP_FORMAT_444 = ($00000000 or PP_FORMAT); 135 | PP_FORMAT_440 = ($00000010 or PP_FORMAT); 136 | 137 | PP_PICT_TYPE_QP2 = $00000010; ///< MPEG2 style QScale 138 | 139 | 140 | 141 | 142 | implementation 143 | 144 | end. 145 | 146 | -------------------------------------------------------------------------------- /Include/libpostproc/version.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *) 20 | 21 | {$ifndef POSTPROC_POSTPROCESS_VERSION_H} 22 | {$define POSTPROC_POSTPROCESS_VERSION_H} 23 | 24 | const 25 | LIB_POSTPROC = 'postproc-53'; 26 | LIBPOSTPROC_VERSION_MAJOR = 53; 27 | LIBPOSTPROC_VERSION_MINOR = 3; 28 | LIBPOSTPROC_VERSION_MICRO = 100; 29 | //LIBPOSTPROC_VERSION = AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, LIBPOSTPROC_VERSION_MINOR, LIBPOSTPROC_VERSION_MICRO); 30 | LIBPOSTPROC_VERSION_INT = ((LIBPOSTPROC_VERSION_MAJOR shl 16) or (LIBPOSTPROC_VERSION_MINOR shl 8) or LIBPOSTPROC_VERSION_MICRO); 31 | LIBPOSTPROC_BUILD = LIBPOSTPROC_VERSION_INT; 32 | 33 | LIBPOSTPROC_IDENT = 'postproc'; 34 | 35 | {$ifndef FF_API_QP_TYPE} 36 | FF_API_QP_TYPE = LIBPOSTPROC_VERSION_MAJOR < 55; 37 | {$endif} 38 | 39 | {$endif} (* POSTPROC_POSTPROCESS_VERSION_H *) 40 | 41 | -------------------------------------------------------------------------------- /Include/libswresample/audioconvert.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * audio conversion 3 | * Copyright (c) 2006 Michael Niedermayer 4 | * Copyright (c) 2008 Peter Ross 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | *) 22 | 23 | 24 | {$ifndef SWR_AUDIOCONVERT_H} 25 | {$define SWR_AUDIOCONVERT_H} 26 | 27 | (** 28 | * @file 29 | * Audio format conversion routines 30 | *) 31 | 32 | 33 | type 34 | TConv_func_type = procedure(po: PByte; pi: PByte; is_ : integer; os: integer; end_ : PByte) of object; 35 | TSimd_func_type = procedure(var dst: PByte; src: PByte; len: integer) of object; 36 | 37 | 38 | PAudioConvert = ^TAudioConvert; 39 | TAudioConvert = record 40 | channels : integer; 41 | in_simd_align_mask : integer; 42 | out_simd_align_mask : integer; 43 | conv_f : TConv_func_type; 44 | simd_f : TSimd_func_type; 45 | ch_map : PInteger; 46 | silence: array[0..7] of PByte; ///< silence input sample 47 | end; 48 | 49 | 50 | (** 51 | * Create an audio sample format converter context 52 | * @param out_fmt Output sample format 53 | * @param in_fmt Input sample format 54 | * @param channels Number of channels 55 | * @param flags See AV_CPU_FLAG_xx 56 | * @param ch_map list of the channels id to pick from the source stream, NULL 57 | * if all channels must be selected 58 | * @return NULL on error 59 | *) 60 | function swri_audio_convert_alloc(out_fmt: TAVSampleFormat; 61 | in_fmt : TAVSampleFormat; 62 | channels: integer; var ch_map : integer; 63 | flags: integer): PAudioConvert; 64 | cdecl; external LIB_SWRESAMPLE; 65 | 66 | (** 67 | * Free audio sample format converter context. 68 | * and set the pointer to NULL 69 | *) 70 | procedure swri_audio_convert_free(var ctx : PAudioConvert); 71 | cdecl; external LIB_SWRESAMPLE; 72 | 73 | (** 74 | * Convert between audio sample formats 75 | * @param[in] out array of output buffers for each channel. set to NULL to ignore processing of the given channel. 76 | * @param[in] in array of input buffers for each channel 77 | * @param len length of audio frame size (measured in samples) 78 | *) 79 | function swri_audio_convert(ctx : PAudioConvert; out_ : PAudioData; in_ : PAudioData; len: integer): integer; 80 | cdecl; external LIB_SWRESAMPLE; 81 | 82 | {$endif} (* AUDIOCONVERT_H *) 83 | -------------------------------------------------------------------------------- /Include/libswresample/resample.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * audio resampling 3 | * Copyright (c) 2004-2012 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | *) 21 | 22 | {$ifndef SWRESAMPLE_RESAMPLE_H} 23 | {$define SWRESAMPLE_RESAMPLE_H} 24 | 25 | 26 | type 27 | PResampleContext = ^TResampleContext; 28 | TResampleContext = record 29 | av_class : PAVClass; 30 | filter_bank : pByte; 31 | filter_length : integer; 32 | filter_alloc : integer; 33 | ideal_dst_incr : integer; 34 | dst_incr : integer; 35 | dst_incr_div : integer; 36 | dst_incr_mod : integer; 37 | index : integer; 38 | frac : integer; 39 | src_incr : integer; 40 | compensation_distance : integer; 41 | phase_shift : integer; 42 | phase_mask : integer; 43 | linear : integer; 44 | filter_type : TSwrFilterType; 45 | kaiser_beta : integer; 46 | factor : double; 47 | format : TAVSampleFormat; 48 | felem_size : integer; 49 | filter_shift : integer; 50 | dsp : record 51 | resample_one : procedure(dst: Pointer; src : Pointer; n : integer; index : int64; incr : int64); cdecl; 52 | resample : function(c : PResampleContext; dst: Pointer; src: Pointer; n: integer; update_ctx: integer): integer; cdecl; 53 | end; 54 | end; 55 | 56 | 57 | procedure swri_resample_dsp_init(c : PResampleContext); 58 | cdecl; external LIB_SWRESAMPLE; 59 | 60 | procedure swri_resample_dsp_x86_init(c : PResampleContext); 61 | cdecl; external LIB_SWRESAMPLE; 62 | 63 | {$endif} (* SWRESAMPLE_RESAMPLE_H *) 64 | -------------------------------------------------------------------------------- /Include/libswresample/version.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * Version macros. 3 | * 4 | * This file is part of libswresample 5 | * 6 | * libswresample is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * libswresample is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with libswresample; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *) 20 | {$ifndef SWR_VERSION_H} 21 | {$define SWR_VERSION_H} 22 | 23 | const 24 | 25 | LIB_SWRESAMPLE = 'swresample-1'; 26 | LIBSWRESAMPLE_VERSION_MAJOR = 1; 27 | LIBSWRESAMPLE_VERSION_MINOR = 1; 28 | LIBSWRESAMPLE_VERSION_MICRO = 101; 29 | //LIBSWRESAMPLE_VERSION = AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, LIBSWRESAMPLE_VERSION_MINOR, LIBSWRESAMPLE_VERSION_MICRO); 30 | LIBSWRESAMPLE_VERSION_INT = ((LIBSWRESAMPLE_VERSION_MAJOR shl 16) or (LIBSWRESAMPLE_VERSION_MINOR shl 8) or LIBSWRESAMPLE_VERSION_MICRO); 31 | LIBSWRESAMPLE_BUILD = LIBSWRESAMPLE_VERSION_INT; 32 | 33 | LIBSWRESAMPLE_IDENT = 'SwR'; 34 | 35 | {$endif} (* SWR_VERSION_H *) 36 | -------------------------------------------------------------------------------- /Include/libswscale/version.pas: -------------------------------------------------------------------------------- 1 | (* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | *) 18 | 19 | {$ifndef SWSCALE_VERSION_H} 20 | {$define SWSCALE_VERSION_H} 21 | 22 | const 23 | 24 | LIB_SWSCALE = 'swscale-3'; 25 | LIBSWSCALE_VERSION_MAJOR = 3; 26 | LIBSWSCALE_VERSION_MINOR = 1; 27 | LIBSWSCALE_VERSION_MICRO = 101; 28 | //LIBSWSCALE_VERSION = AV_VERSION(LIBSWSCALE_VERSION_MAJOR, LIBSWSCALE_VERSION_MINOR, LIBSWSCALE_VERSION_MICRO); 29 | LIBSWSCALE_VERSION_INT = ((LIBSWSCALE_VERSION_MAJOR shl 16) or (LIBSWSCALE_VERSION_MINOR shl 8) or LIBSWSCALE_VERSION_MICRO); 30 | LIBSWSCALE_BUILD = LIBSWSCALE_VERSION_INT; 31 | LIBSWSCALE_IDENT = 'SwS'; 32 | 33 | (** 34 | * FF_API_* defines may be placed below to indicate public API that will be 35 | * dropped at a future version bump. The defines themselves are not part of 36 | * the public API and may change, break or disappear at any time. 37 | *) 38 | 39 | {$ifndef FF_API_SWS_CPU_CAPS} 40 | FF_API_SWS_CPU_CAPS = LIBSWSCALE_VERSION_MAJOR < 4; 41 | {$endif} 42 | {$ifndef FF_API_ARCH_BFIN} 43 | FF_API_ARCH_BFIN = LIBSWSCALE_VERSION_MAJOR < 4; 44 | {$endif} 45 | 46 | {$endif} (* SWSCALE_VERSION_H *) 47 | 48 | 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ffmpeg-delphi 2 | 3 | FFMpeg Header For Delphi 4 | * FFmpeg Lib Version - 2.8.6
5 | * Development environment - Delphi XE10
6 | 7 | Ported by: 8 | ``` 9 | Oleksandr Nazaruk (email: mail@freehand.com.ua) 10 | ``` --------------------------------------------------------------------------------