Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-03

Play video from memory

20 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

aradeonas

Hi,

Any one know a library or way to buffer video file into memory and then pass it to player?
Any simple player do the job but it should support a way to open file from memory.

Regards,
Ara

http://www.fastmail.com - IMAP accessible web-mail

Reply by email

aradeonas
to Leonardo M. Ramé

Thank you Leonardo,

I saw it before but it doesn't seem there is a way to pass memory to it or I couldn't find out how.
Do you know?

Regards,
Ara

Leonardo M. Ram? wrote 21 lines
It looks like MPlayer can do this: http://www.mplayerhq.hu/DOCS/HTML/en/streaming.html El 04/03/15 a las 13:29, aradeonas escibi?: > Hi, > > Any one know a library or way to buffer video file into memory and then > pass it to player? > Any simple player do the job but it should support a way to open file > from memory. > > Regards, > Ara > -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
http://www.fastmail.com - Choose from over 50 domains or use your own

Reply by email

Leonardo M. Ramé
to aradeonas

Yes, you can!.

1) Load your Video to a TStream (TMemoryStream for example).
2) Use TProcess to execute "mplayer -", the "-" is the parameter.
3) Send your stream to the standard input of the process.

El 05/03/15 a las 16:45, aradeonas escibi?:

Show quoted text 30 lines
Thank you Leonardo, I saw it before but it doesn't seem there is a way to pass memory to it or I couldn't find out how. Do you know? Regards, Ara On Thu, Mar 5, 2015, at 11:40 AM, Leonardo M. Ram? wrote: > It looks like MPlayer can do this: > http://www.mplayerhq.hu/DOCS/HTML/en/streaming.html > > El 04/03/15 a las 13:29, aradeonas escibi?: >> Hi, >> >> Any one know a library or way to buffer video file into memory and then >> pass it to player? >> Any simple player do the job but it should support a way to open file >> from memory. >> >> Regards, >> Ara >> > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Philippe Lévi
to Leonardo M. Ramé

and you know how to tell MPLAYER to show the video in a specific window? (using WINDOWS, and glutCreateWindow).

thanks
Philippe

________________________________________
De: "Leonardo M. Ram?"
Enviado: quinta-feira, 5 de mar?o de 2015 17:44
Para:
Assunto: Re: [Lazarus] Play video from memory

Yes, you can!.

1) Load your Video to a TStream (TMemoryStream for example).
2) Use TProcess to execute "mplayer -", the "-" is the parameter.
3) Send your stream to the standard input of the process.

El 05/03/15 a las 16:45, aradeonas escibi?:

Show quoted text 30 lines
Thank you Leonardo, I saw it before but it doesn't seem there is a way to pass memory to it or I couldn't find out how. Do you know? Regards, Ara On Thu, Mar 5, 2015, at 11:40 AM, Leonardo M. Ram? wrote: > It looks like MPlayer can do this: > http://www.mplayerhq.hu/DOCS/HTML/en/streaming.html > > El 04/03/15 a las 13:29, aradeonas escibi?: >> Hi, >> >> Any one know a library or way to buffer video file into memory and then >> pass it to player? >> Any simple player do the job but it should support a way to open file >> from memory. >> >> Regards, >> Ara >> > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Leonardo M. Ramé
to Philippe Lévi

To embed mplayer into a window you must know its ID. Window IDs have a relation with the WindowHandle, but that value must be somehow "translated" to be understood by X11 (or Windows). I don't know how to translate it :(.

For example, If I use Format('%x', [Self.WindowHandle]) I get the Hex value BB5380, then, using the wininfo tool I can get the ID. Just run xwininfo and click on the window you want to embed mplayer into.

In my example I got:

xwininfo: Window id: 0x2800048 "BB5380"

Absolute upper-left X: 662
Absolute upper-left Y: 270
Relative upper-left X: 1
Relative upper-left Y: 24
Width: 320
Height: 240
Depth: 24
Visual: 0x20
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x22 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +662+270 -1744+270 -1744-258 +662-258 -geometry 320x240+661+246

As you can see, the first line displays the same Hex number I get from Lazarus, and 0x2800048, this is the value mplayer expects.

So, to embed a movie into a window, when you know the window Id, you just launch mplayer using this options:

mplayer -wid 0x2800048 /home/leonardo/Im?genes/Fotos/2009/11/21/mvi_0260.avi

Please, if any you know how to translate BB5380 to 0x2800048 I'll be glad to learn.

El 05/03/15 a las 18:51, Philippe L?vi escibi?:

Show quoted text 60 lines
and you know how to tell MPLAYER to show the video in a specific window? (using WINDOWS, and glutCreateWindow). thanks Philippe ________________________________________ De: "Leonardo M. Ram?" Enviado: quinta-feira, 5 de mar?o de 2015 17:44 Para: Assunto: Re: [Lazarus] Play video from memory Yes, you can!. 1) Load your Video to a TStream (TMemoryStream for example). 2) Use TProcess to execute "mplayer -", the "-" is the parameter. 3) Send your stream to the standard input of the process. El 05/03/15 a las 16:45, aradeonas escibi?: > Thank you Leonardo, > > I saw it before but it doesn't seem there is a way to pass memory to it > or I couldn't find out how. > Do you know? > > Regards, > Ara > > On Thu, Mar 5, 2015, at 11:40 AM, Leonardo M. Ram? wrote: >> It looks like MPlayer can do this: >> http://www.mplayerhq.hu/DOCS/HTML/en/streaming.html >> >> El 04/03/15 a las 13:29, aradeonas escibi?: >>> Hi, >>> >>> Any one know a library or way to buffer video file into memory and then >>> pass it to player? >>> Any simple player do the job but it should support a way to open file >>> from memory. >>> >>> Regards, >>> Ara >>> >> -- >> _______________________________________________ >> Lazarus mailing list >> >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

aradeonas
to Leonardo M. Ramé

Leonardo,

Im not familiar with Mplayer but take a look at here: http://wiki.freepascal.org/TMPlayerControl And in MPlayerCtrl unit line 665 it just pass handle.

Do you have opinion about how to pass memory stream?

Regards, Ara

Leonardo M. Ram? wrote 93 lines
To embed mplayer into a window you must know its ID. Window IDs have a relation with the WindowHandle, but that value must be somehow "translated" to be understood by X11 (or Windows). I don't know how to translate it :(. For example, If I use Format('%x', [Self.WindowHandle]) I get the Hex value BB5380, then, using the wininfo tool I can get the ID. Just run xwininfo and click on the window you want to embed mplayer into. In my example I got: xwininfo: Window id: 0x2800048 "BB5380" Absolute upper-left X: 662 Absolute upper-left Y: 270 Relative upper-left X: 1 Relative upper-left Y: 24 Width: 320 Height: 240 Depth: 24 Visual: 0x20 Visual Class: TrueColor Border width: 0 Class: InputOutput Colormap: 0x22 (installed) Bit Gravity State: NorthWestGravity Window Gravity State: NorthWestGravity Backing Store State: NotUseful Save Under State: no Map State: IsViewable Override Redirect State: no Corners: +662+270 -1744+270 -1744-258 +662-258 -geometry 320x240+661+246 As you can see, the first line displays the same Hex number I get from Lazarus, and 0x2800048, this is the value mplayer expects. So, to embed a movie into a window, when you know the window Id, you just launch mplayer using this options: mplayer -wid 0x2800048 /home/leonardo/Im?genes/Fotos/2009/11/21/mvi_0260.avi Please, if any you know how to translate BB5380 to 0x2800048 I'll be glad to learn. El 05/03/15 a las 18:51, Philippe L?vi escibi?: > and you know how to tell MPLAYER to show the video in a specific > window? (using WINDOWS, and glutCreateWindow). > > thanks Philippe > > ________________________________________ > De: "Leonardo M. Ram?" Enviado: quinta-feira, 5 > de mar?o de 2015 17:44 Para: > Assunto: Re: [Lazarus] Play video from memory > > Yes, you can!. > > 1) Load your Video to a TStream (TMemoryStream for example). > 2) Use TProcess to execute "mplayer -", the "-" is the parameter. > 3) Send your stream to the standard input of the process. > > > El 05/03/15 a las 16:45, aradeonas escibi?: >> Thank you Leonardo, >> >> I saw it before but it doesn't seem there is a way to pass memory >> to it or I couldn't find out how. Do you know? >> >> Regards, Ara >> >> On Thu, Mar 5, 2015, at 11:40 AM, Leonardo M. Ram? wrote: >>> It looks like MPlayer can do this: >>> http://www.mplayerhq.hu/DOCS/HTML/en/streaming.html >>> >>> El 04/03/15 a las 13:29, aradeonas escibi?: >>>> Hi, >>>> >>>> Any one know a library or way to buffer video file into memory >>>> and then pass it to player? Any simple player do the job but it >>>> should support a way to open file from memory. >>>> >>>> Regards, Ara >>>> >>> -- >>> _______________________________________________ >>> Lazarus mailing list >>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > -- > _______________________________________________ > Lazarus mailing list > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > -- > _______________________________________________ > Lazarus mailing list > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
http://www.fastmail.com - Email service worth paying for. Try it for free -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150306/9fa358cd/attachment.html>

Reply by email

Philippe Lévi
to aradeonas

xwininfo ... linux ! ...

I need a solution for windows ...

I tried

whndl := WindowFromDC(wglGetCurrentDC())

but MPLAYER does not seem to like it, either in decimal format or hex format ...

and I do not know how to check if I get the resquested value ... the handle of the window launched by glutCreateWindow ...

________________________________
De: aradeonas
Enviado: sexta-feira, 6 de mar?o de 2015 12:58
Para:
Assunto: Re: [Lazarus] Play video from memory

Leonardo,

Im not familiar with Mplayer but take a look at here: http://wiki.freepascal.org/TMPlayerControl
And in MPlayerCtrl unit line 665 it just pass handle.

Do you have opinion about how to pass memory stream?

Regards,
Ara

Leonardo M. Ram? wrote 114 lines
To embed mplayer into a window you must know its ID. Window IDs have a relation with the WindowHandle, but that value must be somehow "translated" to be understood by X11 (or Windows). I don't know how to translate it :(. For example, If I use Format('%x', [Self.WindowHandle]) I get the Hex value BB5380, then, using the wininfo tool I can get the ID. Just run xwininfo and click on the window you want to embed mplayer into. In my example I got: xwininfo: Window id: 0x2800048 "BB5380" Absolute upper-left X: 662 Absolute upper-left Y: 270 Relative upper-left X: 1 Relative upper-left Y: 24 Width: 320 Height: 240 Depth: 24 Visual: 0x20 Visual Class: TrueColor Border width: 0 Class: InputOutput Colormap: 0x22 (installed) Bit Gravity State: NorthWestGravity Window Gravity State: NorthWestGravity Backing Store State: NotUseful Save Under State: no Map State: IsViewable Override Redirect State: no Corners: +662+270 -1744+270 -1744-258 +662-258 -geometry 320x240+661+246 As you can see, the first line displays the same Hex number I get from Lazarus, and 0x2800048, this is the value mplayer expects. So, to embed a movie into a window, when you know the window Id, you just launch mplayer using this options: mplayer -wid 0x2800048 /home/leonardo/Im?genes/Fotos/2009/11/21/mvi_0260.avi Please, if any you know how to translate BB5380 to 0x2800048 I'll be glad to learn. El 05/03/15 a las 18:51, Philippe L?vi escibi?: > and you know how to tell MPLAYER to show the video in a specific window? (using WINDOWS, and glutCreateWindow). > > thanks > Philippe > > ________________________________________ > De: "Leonardo M. Ram?" > Enviado: quinta-feira, 5 de mar?o de 2015 17:44 > Para: > Assunto: Re: [Lazarus] Play video from memory > > Yes, you can!. > > 1) Load your Video to a TStream (TMemoryStream for example). > 2) Use TProcess to execute "mplayer -", the "-" is the parameter. > 3) Send your stream to the standard input of the process. > > > El 05/03/15 a las 16:45, aradeonas escibi?: >> Thank you Leonardo, >> >> I saw it before but it doesn't seem there is a way to pass memory to it >> or I couldn't find out how. >> Do you know? >> >> Regards, >> Ara >> >> On Thu, Mar 5, 2015, at 11:40 AM, Leonardo M. Ram? wrote: >>> It looks like MPlayer can do this: >>> http://www.mplayerhq.hu/DOCS/HTML/en/streaming.html >>> >>> El 04/03/15 a las 13:29, aradeonas escibi?: >>>> Hi, >>>> >>>> Any one know a library or way to buffer video file into memory and then >>>> pass it to player? >>>> Any simple player do the job but it should support a way to open file >>>> from memory. >>>> >>>> Regards, >>>> Ara >>>> >>> -- >>> _______________________________________________ >>> Lazarus mailing list >>> >>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
http://www.fastmail.com - Email service worth paying for. Try it for free -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150306/e2fc6d19/attachment-0001.html>

Reply by email

aradeonas
to Philippe Lévi

Anyway if anyone know a way or library please tell me.

Ara

Philippe L?vi wrote
xwininfo ... linux ! ...
I need a solution for windows ...
I tried
whndl := WindowFromDC(wglGetCurrentDC())

but MPLAYER does not seem to like it, either in decimal format or hex format ...

and I do not know how to check if I get the resquested value ... the handle of the window launched by glutCreateWindow ...
Show quoted text 113 lines
*De:* aradeonas *Enviado:* sexta-feira, 6 de mar?o de 2015 12:58 *Para:* *Assunto:* Re: [Lazarus] Play video from memory Leonardo, Im not familiar with Mplayer but take a look at here: http://wiki.freepascal.org/TMPlayerControl And in MPlayerCtrl unit line 665 it just pass handle. Do you have opinion about how to pass memory stream? Regards, Ara On Fri, Mar 6, 2015, at 07:41 AM, Leonardo M. Ram? wrote: > To embed mplayer into a window you must know its ID. Window IDs have > a relation with the WindowHandle, but that value must be somehow > "translated" to be understood by X11 (or Windows). I don't know how > to translate it :(. > > For example, If I use Format('%x', [Self.WindowHandle]) I get the > Hex value BB5380, then, using the wininfo tool I can get the ID. > Just run xwininfo and click on the window you want to embed > mplayer into. > > In my example I got: > > xwininfo: Window id: 0x2800048 "BB5380" > > Absolute upper-left X: 662 Absolute upper-left Y: 270 Relative > upper-left X: 1 Relative upper-left Y: 24 Width: 320 Height: 240 > Depth: 24 Visual: 0x20 Visual Class: TrueColor Border width: 0 > Class: InputOutput Colormap: 0x22 (installed) Bit Gravity State: > NorthWestGravity Window Gravity State: NorthWestGravity Backing > Store State: NotUseful Save Under State: no Map State: IsViewable > Override Redirect State: no Corners: +662+270 -1744+270 -1744-258 > +662-258 -geometry 320x240+661+246 > > As you can see, the first line displays the same Hex number I get > from Lazarus, and 0x2800048, this is the value mplayer expects. > > So, to embed a movie into a window, when you know the window Id, you > just launch mplayer using this options: > > mplayer -wid 0x2800048 > /home/leonardo/Im?genes/Fotos/2009/11/21/mvi_0260.avi > > Please, if any you know how to translate BB5380 to 0x2800048 I'll be > glad to learn. > > El 05/03/15 a las 18:51, Philippe L?vi escibi?: > > and you know how to tell MPLAYER to show the video in a specific > > window? (using WINDOWS, and glutCreateWindow). > > > > thanks Philippe > > > > ________________________________________ > > De: "Leonardo M. Ram?" Enviado: quinta-feira, > > 5 de mar?o de 2015 17:44 Para: > > Assunto: Re: [Lazarus] Play > > video from memory > > > > Yes, you can!. > > > > 1) Load your Video to a TStream (TMemoryStream for example). > > 2) Use TProcess to execute "mplayer -", the "-" is the parameter. > > 3) Send your stream to the standard input of the process. > > > > > > El 05/03/15 a las 16:45, aradeonas escibi?: > >> Thank you Leonardo, > >> > >> I saw it before but it doesn't seem there is a way to pass memory > >> to it or I couldn't find out how. Do you know? > >> > >> Regards, Ara > >> > >> On Thu, Mar 5, 2015, at 11:40 AM, Leonardo M. Ram? wrote: > >>> It looks like MPlayer can do this: > >>> http://www.mplayerhq.hu/DOCS/HTML/en/streaming.html > >>> > >>> El 04/03/15 a las 13:29, aradeonas escibi?: > >>>> Hi, > >>>> > >>>> Any one know a library or way to buffer video file into memory > >>>> and then pass it to player? Any simple player do the job but it > >>>> should support a way to open file from memory. > >>>> > >>>> Regards, Ara > >>>> > >>> -- > >>> _______________________________________________ > >>> Lazarus mailing list > >>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > > > -- > > _______________________________________________ > > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > > > -- > > _______________________________________________ > > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > > -- > _______________________________________________ > Lazarus mailing list > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --

http://www.fastmail.com - Email service worth paying for. Try it for free

-- _________________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
http://www.fastmail.com - Send your email first class -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150306/207d2dcf/attachment.html>

Reply by email

aradeonas
to silvioprog

Dear Silvio I checked them before and I couldn't find out way for opening from memory.

Ara

silvioprog wrote 17 lines
On Fri, Mar 6, 2015 at 2:02 PM, aradeonas wrote: > __ > Anyway if anyone know a way or library please tell me. > > Ara You can get some video libraries here: http://wiki.freepascal.org/Video_Playback_Libraries -- Silvio Cl?cio My public projects - github.com/silvioprog -- _________________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
http://www.fastmail.com - Or how I learned to stop worrying and love email again -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150306/5af5b161/attachment-0001.html>

Reply by email

ListMember
to aradeonas
aradeonas wrote
Dear Silvio I checked them before and I couldn't find out way for opening from memory.

Seeing that there isn't an option to feed a memorystream to a video player, it seems your best option to do that using a RAMDisk. You could use mapped file streams for speed too.

BTW, I am aware that this is not much different from buffering the videostream to physical disk, but at least you get to have a greater speed plus, of course, there will be no traces of the video file once you reboot.

or you could take a look at, if you haven't already, to BoxedApp:

http://boxedapp.com/encrypted_video_streaming.html

HTH,

Reply by email

aradeonas
to ListMember

Thank you HTH,

I already look at that but my project is a free project and I cant buy this and I think there a way to open video from memory but its hard to find!

Ara

ListMember wrote 24 lines
On 2015-03-06 19:32, aradeonas wrote: > Dear Silvio I checked them before and I couldn't find out way for > opening from memory. Seeing that there isn't an option to feed a memorystream to a video player, it seems your best option to do that using a RAMDisk. You could use mapped file streams for speed too. BTW, I am aware that this is not much different from buffering the videostream to physical disk, but at least you get to have a greater speed plus, of course, there will be no traces of the video file once you reboot. or you could take a look at, if you haven't already, to BoxedApp: http://boxedapp.com/encrypted_video_streaming.html HTH, -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
http://www.fastmail.com - Same, same, but different...

Reply by email

silvioprog
to aradeonas: Dear Silvio I checked them before and I couldn't find out way for opening from memory. Ara
aradeonas wrote 5 lines
Dear Silvio I checked them before and I couldn't find out way for opening from memory. Ara

FFVCL (from the link that I sent in previous message) offer support to video stream (FPC/Dephi):

http://www.delphiffmpeg.com/downloads/

Silvio Cl?cio My public projects - github.com/silvioprog -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150308/d8dc1164/attachment.html>

Reply by email

aradeonas
to silvioprog

Thank you Silvio,

I spoke with author and he its not have this ability but maybe its a misundesrtanding. I will check this library today.

Regards, Ara

silvioprog wrote 19 lines
On Fri, Mar 6, 2015 at 2:32 PM, aradeonas wrote: > __ > Dear Silvio I checked them before and I couldn't find out way for > opening from memory. > > Ara FFVCL (from the link that I sent in previous message) offer support to video stream (FPC/Dephi): http://www.delphiffmpeg.com/downloads/ -- Silvio Cl?cio My public projects - github.com/silvioprog -- _________________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
http://www.fastmail.com - A fast, anti-spam email service. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150309/468ad5fa/attachment.html>

Reply by email

aradeonas
to aradeonas

Hi. Silvio you are right,That is a miss understanding. Here another test with DelphiFFmpeg,I don't have full version and I can test it with Delphi. I made a test that play video from memory but there is a delay between changing files,Can any one test this demo and help me with this? My goal is buffer second one before first one and after first one finished play second almost imminently. I also attached Delphi project.

Show quoted text 120 lines
unit Unit2; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, FFBaseComponent, MemoryProtocol, Vcl.FFPlay, Vcl.StdCtrls, Vcl.MemoryAccess; type TForm2 = class(TForm) FFPlayer: TFFPlayer; Panel1: TPanel; Button1: TButton; MAA: TMemoryAccessAdapter; ListBox1: TListBox; Timer1: TTimer; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); procedure MAAClose(Sender: TObject); function MAAOpen(Sender: TObject; AURLContext: Pointer; const APrivateData: string; AFlags: Integer): Boolean; function MAARead(Sender: TObject; var Buffer; Count: Integer): Integer; function MAASeek(Sender: TObject; const Offset: Int64; Origin: TSeekOrigin): Int64; function MAAWrite(Sender: TObject; const Buffer; Count: Integer): Integer; procedure FFPlayerState(Sender: TObject; APlayState: TPlayState); procedure Timer1Timer(Sender: TObject); private { Private declarations } public FStream: TStream; LFileName: string; ci: Integer; changing: Boolean; l1,l2:Integer; n1,n2:Integer; nn:Boolean; procedure AddMsgLog(AMsg: string); procedure PlayNext(ADelta: Integer = 1); procedure TryPlay(AIsDiskFile: Boolean); end; var Form2: TForm2; implementation {$R *.dfm} procedure TForm2.AddMsgLog(AMsg: string); begin ListBox1.Items.Add(AMsg); ListBox1.TopIndex := ListBox1.Items.Count - 1; end; procedure TForm2.Button1Click(Sender: TObject); begin FFPlayer.TryOpen(Format('memory:%d', [Integer(MAA.Stream)]), Panel1.Handle, False); end; procedure TForm2.FFPlayerState(Sender: TObject; APlayState: TPlayState); const CPlayState: array [TPlayState] of string = ('Play', 'Pause', 'Resume', 'Step', 'Stop', 'End'); begin // OnState event handler // show state AddMsgLog(CPlayState[APlayState]); case APlayState of psPlay: begin l2:=GetTickCount; AddMsgLog('---Play time: ' + inttostr(l2 - l1)); end; psStop: begin n2:=GetTickCount; AddMsgLog('---Stop time: ' + inttostr(n2 - n1)); end; psEnd: begin l1:=GetTickCount; n1:=GetTickCount; FFPlayer.Pause; if ci < 2 then if not changing then PlayNext; // FFPlayer.Seek(0, [sfBackward]); // LFileName := 'C:\ffmpeg\bin\tmp\OUTPUT1.mp4'; // FFPlayer.TryOpen(Format('memory:%d', [Integer(MAA.Stream)]), Panel1.Handle, False); // FFPlayer.Resume; end; end; end; procedure TForm2.FormCreate(Sender: TObject); begin ci := 0; changing := False; FFPlayer.SetLicenseKey('FSXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX'); FStream := nil; if not FFPlayer.AVLibLoaded then begin if not FFPlayer.LoadAVLib(ExtractFilePath(Application.ExeName) + 'LibAV') then begin ShowMessage('h'); end; register_memory_protocol; end; end; procedure TForm2.MAAClose(Sender: TObject); begin if FStream nil then FreeAndNil(FStream); end; function TForm2.MAAOpen(Sender: TObject; AURLContext: Pointer; const APrivateData: string; AFlags: Integer): Boolean; function GetFileSize(const FileName: String): Int64; var SearchRec: TSearchRec; begin if FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec) = 0 then Result := SearchRec.Size else Result := -1; end; var LFileSize: Int64; t1, t2: Integer; begin t1 := GetTickCount; Result := False; if FStream nil then FreeAndNil(FStream); LFileName := 'C:\ffmpeg\bin\tmp\OUTPUT' + inttostr(ci) + '.mp4'; LFileSize := GetFileSize(LFileName); if LFileSize <= 0 then AddMsgLog('file error') else if LFileSize < 1024 * 1024 * 10 then begin // less than 10 MB, use TMemoryStream FStream := TMemoryStream.Create; (FStream as TMemoryStream).LoadFromFile(LFileName); end else // for large file, use TFileStream FStream := TFileStream.Create(LFileName, fmOpenRead); Result := FStream nil; t2 := GetTickCount; AddMsgLog('Open time: ' + inttostr(t2 - t1)); end; function TForm2.MAARead(Sender: TObject; var Buffer; Count: Integer): Integer; var t1, t2: Integer; begin t1 := GetTickCount; if not Assigned(FStream) then begin Result := -1; Exit; end; Result := FStream.Read(Buffer, Count); AddMsgLog(Format('MAA read from input stream %d -> %d', [Count, Result])); t2 := GetTickCount; AddMsgLog('Reed time: ' + inttostr(t2 - t1)); end; function TForm2.MAASeek(Sender: TObject; const Offset: Int64; Origin: TSeekOrigin): Int64; var t1, t2: Integer; begin t1 := GetTickCount; if not Assigned(FStream) then begin Result := -1; Exit; end; Result := FStream.Seek(Offset, Origin); AddMsgLog(Format('MAA seek input stream [whence: %d] %d -> %d', [Ord(Origin), Offset, Result])); t2 := GetTickCount; AddMsgLog('Seek time: ' + inttostr(t2 - t1)); end; function TForm2.MAAWrite(Sender: TObject; const Buffer; Count: Integer): Integer; begin Result := -1; end; procedure TForm2.PlayNext(ADelta: Integer); begin changing := True; Timer1.Interval := 1; AddMsgLog('Run timer'); Timer1.Enabled := True; end; procedure TForm2.Timer1Timer(Sender: TObject); begin Timer1.Enabled := False; AddMsgLog('Play next'); TryPlay(True); end; procedure TForm2.TryPlay(AIsDiskFile: Boolean); begin ci := ci + 1; FFPlayer.TryOpen(Format('memory:%d', [Integer(MAA.Stream)]), Panel1.Handle, False); changing := False; end; end.

Regards, Ara

http://www.fastmail.com - Does exactly what it says on the tin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150314/947c1046/attachment.html>

Reply by email

aradeonas
to aradeonas

Thank you all,

Now with help of author of FFVCL I can do what I want.

That is great library with a great support.After testing many libraries I think its best choice for any one wants expert and easy to use tools in video field (also audio and .. but I didn't work with them).

Regards,

Ara

http://www.fastmail.com - Faster than the air-speed velocity of an unladen european swallow -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150317/3c8eaedd/attachment.html>

Reply by email

vfclists .
to aradeonas
aradeonas wrote 12 lines
Thank you all, Now with help of author of FFVCL I can do what I want. That is great library with a great support.After testing many libraries I think its best choice for any one wants expert and easy to use tools in video field (also audio and .. but I didn't work with them). Regards, Ara

Consider uploading it to some place where we can all learn from it, something like a
Frank Church

=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150317/13cb59fe/attachment.html>

Reply by email

aradeonas
to vfclists .

Hi,

You need to take a look at MemoryPlayer demo of FFVCL,There is not? much I done and demo is documented fairly,my version is just simpler but if you wants any help tell me although Im newbie in this subject ;)

http://www.delphiffmpeg.com/

Regards,

Ara

http://www.fastmail.com - Access your email from home and the web -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150317/08d46234/attachment-0001.html>

Reply by email