From 15a9be95ed35a087df0d22fc0f1f7a9fcad6ea5b Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Thu, 10 May 2012 08:21:01 +0000 Subject: a simple test for TFFmpegDecodeStream.Open in media/UAudioDecoder_FFmpeg.pas git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2878 b956fd51-792f-4845-bead-9b4dfca2ff2c --- test/FFmpeg_Test6.pas | 40 ++++++++++++++++++++++++++++++++++++++++ test/menuswoosh.mp3 | Bin 0 -> 5246 bytes 2 files changed, 40 insertions(+) create mode 100644 test/FFmpeg_Test6.pas create mode 100644 test/menuswoosh.mp3 diff --git a/test/FFmpeg_Test6.pas b/test/FFmpeg_Test6.pas new file mode 100644 index 00000000..88751853 --- /dev/null +++ b/test/FFmpeg_Test6.pas @@ -0,0 +1,40 @@ +Program FFmpeg_Test6; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +(** + * Test of function TFFmpegDecodeStream.Open in media/UAudioDecoder_FFmpeg.pas + * after configure for selecting the installed FFmpeg lib compile with: + * + * fpc -Fi../src -Fu../src/base -Fu../src/lib/FFmpeg-0.... FFmpeg_Test6.pas + *) + +uses + avcodec, + avformat; + +const + Filename: PAnsiChar = 'menuswoosh.mp3'; + +var + fFormatCtx: PAVFormatContext; + TestFrame: TAVPacket; + +begin + av_register_all; + if (av_open_input_file(fFormatCtx, Filename, nil, 0, nil) <> 0) then + writeln('av_open_input_file failed: File not found: ', Filename); + + if (av_read_frame(fFormatCtx, TestFrame) < 0) then + writeln('av_read_frame failed'); + + dump_format(fFormatCtx, 0, argv[1], 0); + + if (fFormatCtx <> nil) then + begin + av_close_input_file(fFormatCtx); + fFormatCtx := nil; + end; +end. diff --git a/test/menuswoosh.mp3 b/test/menuswoosh.mp3 new file mode 100644 index 00000000..1025a86f Binary files /dev/null and b/test/menuswoosh.mp3 differ -- cgit v1.2.3