aboutsummaryrefslogtreecommitdiffstats
path: root/test/FFmpeg_Test6.pas
blob: 88751853e1e70e4d7cb8223ea3dc05c16d76a3da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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.