Skip to content

Commit

Permalink
Добавление обновлённой версии
Browse files Browse the repository at this point in the history
Версия основанная на внешнем таймере или внешний отсчёт времени.
  • Loading branch information
konvikkor committed Dec 4, 2018
1 parent 41c2d6c commit 4963156
Show file tree
Hide file tree
Showing 7 changed files with 1,493 additions and 0 deletions.
15 changes: 15 additions & 0 deletions TestVideo.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
program TestVideo;

uses
Vcl.Forms,
uTestMain in 'uTestMain.pas' {Form1},
uVideoMain in 'uVideoMain.pas';

{$R *.res}

begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
503 changes: 503 additions & 0 deletions TestVideo.dproj

Large diffs are not rendered by default.

Binary file added TestVideo.res
Binary file not shown.
50 changes: 50 additions & 0 deletions TestVideo.skincfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[ExpressSkins]
Default=1
ShowNotifications=1
Enabled=1
dxSkinBlack=0
dxSkinBlue=0
dxSkinBlueprint=0
dxSkinCaramel=0
dxSkinCoffee=0
dxSkinDarkRoom=0
dxSkinDarkSide=0
dxSkinDevExpressDarkStyle=1
dxSkinDevExpressStyle=0
dxSkinFoggy=0
dxSkinGlassOceans=0
dxSkinHighContrast=0
dxSkiniMaginary=0
dxSkinLilian=0
dxSkinLiquidSky=0
dxSkinLondonLiquidSky=0
dxSkinMcSkin=0
dxSkinMetropolis=0
dxSkinMetropolisDark=0
dxSkinMoneyTwins=0
dxSkinOffice2007Black=0
dxSkinOffice2007Blue=0
dxSkinOffice2007Green=0
dxSkinOffice2007Pink=0
dxSkinOffice2007Silver=0
dxSkinOffice2010Black=0
dxSkinOffice2010Blue=0
dxSkinOffice2010Silver=0
dxSkinOffice2013DarkGray=0
dxSkinOffice2013LightGray=0
dxSkinOffice2013White=0
dxSkinPumpkin=0
dxSkinSeven=0
dxSkinSevenClassic=0
dxSkinSharp=0
dxSkinSharpPlus=0
dxSkinSilver=0
dxSkinSpringTime=0
dxSkinStardust=0
dxSkinSummer2008=0
dxSkinTheAsphaltWorld=0
dxSkinsDefaultPainters=0
dxSkinValentine=0
dxSkinVS2010=0
dxSkinWhiteprint=0
dxSkinXmas2008Blue=0
145 changes: 145 additions & 0 deletions uTestMain.dfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 325
ClientWidth = 701
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PopupMenu = PopupMenu1
PixelsPerInch = 96
TextHeight = 13
object PageControl1: TPageControl
Left = 0
Top = 0
Width = 701
Height = 306
ActivePage = TabSheet2
Align = alClient
TabOrder = 0
object TabSheet1: TTabSheet
Caption = 'LOG'
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 0
object Splitter1: TSplitter
Left = 505
Top = 0
Height = 278
Align = alRight
ExplicitLeft = 240
ExplicitTop = 128
ExplicitHeight = 100
end
object Splitter2: TSplitter
Left = 185
Top = 0
Height = 278
ExplicitLeft = 256
ExplicitTop = 112
ExplicitHeight = 100
end
object Memo1: TMemo
Left = 188
Top = 0
Width = 317
Height = 278
Align = alClient
Lines.Strings = (
'Memo1')
ScrollBars = ssVertical
TabOrder = 0
end
object Memo2: TMemo
Left = 508
Top = 0
Width = 185
Height = 278
Align = alRight
Lines.Strings = (
'Memo2')
ScrollBars = ssVertical
TabOrder = 1
end
object Memo3: TMemo
Left = 0
Top = 0
Width = 185
Height = 278
Align = alLeft
Lines.Strings = (
'Memo3')
ScrollBars = ssVertical
TabOrder = 2
end
end
object TabSheet2: TTabSheet
Caption = 'TabSheet2'
ImageIndex = 1
end
end
object StatusBar1: TStatusBar
Left = 0
Top = 306
Width = 701
Height = 19
Panels = <
item
Width = 150
end
item
Width = 150
end
item
Width = 150
end
item
Width = 150
end
item
Width = 50
end>
end
object PopupMenu1: TPopupMenu
Left = 88
Top = 64
object Open1: TMenuItem
Caption = 'Open'
OnClick = Open1Click
end
object N1: TMenuItem
Caption = '-'
end
object DecodePak1: TMenuItem
Caption = 'Decode Pak'
OnClick = DecodePak1Click
end
end
object OpenDialog1: TOpenDialog
Left = 176
Top = 48
end
object Timer1: TTimer
OnTimer = Timer1Timer
Left = 132
Top = 40
end
object TrayIcon1: TTrayIcon
PopupMenu = PopupMenu1
Visible = True
Left = 228
Top = 64
end
object TaskDialog1: TTaskDialog
Buttons = <>
RadioButtons = <>
Left = 252
Top = 152
end
end
134 changes: 134 additions & 0 deletions uTestMain.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
unit uTestMain;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uVideoMain, Vcl.Menus, Vcl.ComCtrls,
Vcl.StdCtrls, Vcl.ExtCtrls, System.DateUtils;

type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
Open1: TMenuItem;
OpenDialog1: TOpenDialog;
N1: TMenuItem;
DecodePak1: TMenuItem;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Memo1: TMemo;
Memo2: TMemo;
Splitter1: TSplitter;
Memo3: TMemo;
Splitter2: TSplitter;
StatusBar1: TStatusBar;
Timer1: TTimer;
TabSheet2: TTabSheet;
TrayIcon1: TTrayIcon;
TaskDialog1: TTaskDialog;
procedure Open1Click(Sender: TObject);
procedure DecodePak1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
var MediaDecoder:TMediaDecoder;
var MediaMainCore:TMediaMainCore;
var MediaVideo:TMediaVideo;
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.DecodePak1Click(Sender: TObject);
var i,j:integer;
begin
if not Assigned(MediaDecoder) then exit;
if not Assigned(MediaMainCore) then exit;
if not Assigned(MediaVideo) then exit;
{i:=1;
try
repeat
Inc(i);
until (not tmp.ReadPaked)OR(i > 10000);
except
end;
Memo2.Clear;
tmp.DecodePakedFromFrame;
Memo2.Lines.BeginUpdate;
for I := 0 to TMP.VideoPacket.Count-1 do begin
Memo2.Lines.Add('AVPacket.Items['+IntToStr(i)+'].stream_index='+IntToStr(TMP.VideoPacket.Items[i].stream_index));
Memo2.Lines.Add('AVPacket.Items['+IntToStr(i)+'].size='+IntToStr(TMP.VideoPacket.Items[i].size));
Memo2.Lines.Add('AVPacket.Items['+IntToStr(i)+'].flags='+IntToStr(TMP.VideoPacket.Items[i].flags));
Memo2.Lines.Add('AVPacket.Items['+IntToStr(i)+'].pts='+IntToStr(TMP.VideoPacket.Items[i].pts));
Memo2.Lines.Add('AVPacket.Items['+IntToStr(i)+'].dts='+IntToStr(TMP.VideoPacket.Items[i].dts));
Memo2.Lines.Add('AVPacket.Items['+IntToStr(i)+'].duration='+IntToStr(TMP.VideoPacket.Items[i].duration));
Memo2.Lines.Add('AVPacket.Items['+IntToStr(i)+'].pos='+IntToStr(TMP.VideoPacket.Items[i].pos));
Memo2.Lines.Add('===========');
end;
Memo2.Lines.EndUpdate;
Memo3.Clear;
Memo3.Lines.BeginUpdate;
for I := 0 to tmp.VideoFrame.Count-1 do begin
for j := 0 to TMP.AVStream.Count-1 do begin
if TMP.AVStream.Items[j].AVStream.index = TMP.CurrentVideoStream then begin
Memo3.Lines.Add('Time: '+floatToStr(//UnixToDateTime(
(
TMP.VideoFrame.Items[i].pts * (
TMP.AVStream.Items[j].AVStream^.time_base.num / TMP.AVStream.Items[j].AVStream^.time_base.den
)
) (* Return Second *)
*1000 (* return Milisecond *)
)//)
);
Break;
end;
end;
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].key_frame='+IntToStr(TMP.VideoFrame.Items[i].key_frame));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].width='+IntToStr(TMP.VideoFrame.Items[i].width));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].height='+IntToStr(TMP.VideoFrame.Items[i].height));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].pts='+IntToStr(TMP.VideoFrame.Items[i].pts));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].pkt_pts='+IntToStr(TMP.VideoFrame.Items[i].pkt_pts));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].pkt_dts='+IntToStr(TMP.VideoFrame.Items[i].pkt_dts));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].pkt_pos='+IntToStr(TMP.VideoFrame.Items[i].pkt_pos));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].pkt_duration='+IntToStr(TMP.VideoFrame.Items[i].pkt_duration));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].coded_picture_number='+IntToStr(TMP.VideoFrame.Items[i].coded_picture_number));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].display_picture_number='+IntToStr(TMP.VideoFrame.Items[i].display_picture_number));
Memo3.Lines.Add('AVFrame.Items['+IntToStr(i)+'].best_effort_timestamp='+IntToStr(TMP.VideoFrame.Items[i].best_effort_timestamp));
Memo3.Lines.Add('===========');
end;
Memo3.Lines.EndUpdate; *}
end;

procedure TForm1.Open1Click(Sender: TObject);
var i:Integer;
begin
if not OpenDialog1.Execute then Exit;
if not Assigned(MediaDecoder) then MediaDecoder:=TMediaDecoder.Create(self);
if not Assigned(MediaMainCore) then begin
MediaMainCore:=TMediaMainCore.Create;
MediaDecoder.MediaCore:=MediaMainCore;
end;
if Assigned(MediaMainCore) then MediaMainCore.CloseFile;
MediaMainCore.OpenFile(OpenDialog1.FileName);
Memo1.Lines.Add(OpenDialog1.FileName);
Memo1.Lines.Add(MediaDecoder.GetStatus);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if not Assigned(MediaDecoder) then exit;
{StatusBar1.Panels[0].Text:='AVStream:'+IntToStr(TMP.AVStream.Count);
StatusBar1.Panels[1].Text:='VPacket:'+IntToStr(TMP.VideoPacket.Count);
StatusBar1.Panels[2].Text:='VFrame:'+IntToStr(TMP.VideoFrame.Count);
StatusBar1.Panels[3].Text:='APacket:'+IntToStr(TMP.AudioPacket.Count);
StatusBar1.Panels[4].Text:='GlobalTime:'+IntToStr(TMP.GetGlobalTime);}
end;

end.
Loading

0 comments on commit 4963156

Please sign in to comment.