Hi folks
What is the best way to implement a video player in Dolphin? I currently using ImagePresenter for it. a series of bitmap is put into the ImagePresenter as its model. There is a need to call ... ImagePresenter>>model: aBimap ... at least 5 times per a second to make it a video player. The problem is that imagePresenter(StaticBitmap) blinks too loud in repeated model: calls. Example: i := ImagePresenter show. b1 := Bitmap fromFile: '.....'. b2 := Bitmap fromFile: '......'. [[i model: b1. i model: b2]repeat] forkBack. As you can see from the above example, whitened image is shown most of the time and b1 b2 very brief. Hwa Jong Oh |
Hwa Jong,
> What is the best way to implement a video player in Dolphin? > > I currently using ImagePresenter for it. a series of bitmap is put > into the ImagePresenter as its model. > > There is a need to call ... > > ImagePresenter>>model: aBimap > > ... at least 5 times per a second to make it a video player. There are a couple of levels of overhead that will cause you problems. First, Windows itself is not the fastest video handling system; it was designed for cooperative multitasking and device independence, which is hard to do at all let alone to do it fast. In response, Microsoft created (and in at least some places bought) DirectX and friends to provide a lower-level interface to hardware with better performance as a result. Even with very fast screen updates, you'll likely run into limits on how quickly you can update the screen. I'm no expert on the subject, but, my understanding is that video playback gets a boost from identifying regions that have changed significantly and updating only those areas of the image. Finally, I doubt that Smalltalk is going to be quick enough to do all of the low-level work. With that said, Dolphin should be able to host a video playback view as an ActiveX control. Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by Howard Oh
Long time ago there was a thread on the old newsgroup
(news.newcastle.ca/Dolphin.smalltalk) with an example package from Andy. Subject: Bitmap animation Date: Wed, 18 Feb 1998 16:02:43 +0100 I have never tried the example but ask me if you want it, I think I have it in my archive. Have a nice day Alain Fischer "Hwa Jong Oh" <[hidden email]> a écrit dans le message news: 90hj3u$17im6$[hidden email]... > Hi folks > > What is the best way to implement a video player in Dolphin? > > I currently using ImagePresenter for it. a series of bitmap is put > into the ImagePresenter as its model. > > There is a need to call ... > > ImagePresenter>>model: aBimap > > ... at least 5 times per a second to make it a video player. > > The problem is that imagePresenter(StaticBitmap) blinks too loud in > model: calls. > > Example: > i := ImagePresenter show. > b1 := Bitmap fromFile: '.....'. > b2 := Bitmap fromFile: '......'. > [[i model: b1. i model: b2]repeat] forkBack. > > As you can see from the above example, whitened image is shown most of the > time and b1 b2 very brief. > > Hwa Jong Oh > > |
Alain,
There was? I'm very interested to see it. Could you look it for me in the archive? I have a deadline of 3 more hours. Please post them quick if you can. Best Regards Hwa Jong Oh Alain Fischer <[hidden email]>ÀÌ(°¡) ¾Æ·¡ ¸Þ½ÃÁö¸¦ news:[hidden email]¿¡ °Ô½ÃÇÏ¿´½À´Ï´Ù. > Long time ago there was a thread on the old newsgroup > (news.newcastle.ca/Dolphin.smalltalk) with an example > package from Andy. > > Subject: Bitmap animation > Date: Wed, 18 Feb 1998 16:02:43 +0100 > > I have never tried the example but ask me if you want it, > I think I have it in my archive. > > Have a nice day > Alain Fischer > > > > "Hwa Jong Oh" <[hidden email]> a ?rit dans le message news: > 90hj3u$17im6$[hidden email]... > > Hi folks > > > > What is the best way to implement a video player in Dolphin? > > > > I currently using ImagePresenter for it. a series of bitmap is put > > into the ImagePresenter as its model. > > > > There is a need to call ... > > > > ImagePresenter>>model: aBimap > > > > ... at least 5 times per a second to make it a video player. > > > > The problem is that imagePresenter(StaticBitmap) blinks too loud in > repeated > > model: calls. > > > > Example: > > i := ImagePresenter show. > > b1 := Bitmap fromFile: '.....'. > > b2 := Bitmap fromFile: '......'. > > [[i model: b1. i model: b2]repeat] forkBack. > > > > As you can see from the above example, whitened image is shown most of > > time and b1 b2 very brief. > > > > Hwa Jong Oh > > > > > > |
Have fun with this ...
Alain Fischer "Hwa Jong Oh" <[hidden email]> a écrit dans le message news: 90joaq$18v5v$[hidden email]... > Alain, > > There was? I'm very interested to see it. > Could you look it for me in the archive? > I have a deadline of 3 more hours. Please post them quick > if you can. > > Best Regards > Hwa Jong Oh > > Alain Fischer <[hidden email]>ÀÌ(°¡) ¾Æ·¡ ¸Þ½ÃÁö¸¦ > news:[hidden email]¿¡ °Ô½ÃÇÏ¿´½À´Ï´Ù. > > Long time ago there was a thread on the old newsgroup > > (news.newcastle.ca/Dolphin.smalltalk) with an example > > package from Andy. > > > > Subject: Bitmap animation > > Date: Wed, 18 Feb 1998 16:02:43 +0100 > > > > I have never tried the example but ask me if you want it, > > I think I have it in my archive. > > > > Have a nice day > > Alain Fischer > > > > > > > > "Hwa Jong Oh" <[hidden email]> a ?rit dans le message news: > > 90hj3u$17im6$[hidden email]... > > > Hi folks > > > > > > What is the best way to implement a video player in Dolphin? > > > > > > I currently using ImagePresenter for it. a series of bitmap is put > > > into the ImagePresenter as its model. > > > > > > There is a need to call ... > > > > > > ImagePresenter>>model: aBimap > > > > > > ... at least 5 times per a second to make it a video player. > > > > > > The problem is that imagePresenter(StaticBitmap) blinks too loud in > > repeated > > > model: calls. > > > > > > Example: > > > i := ImagePresenter show. > > > b1 := Bitmap fromFile: '.....'. > > > b2 := Bitmap fromFile: '......'. > > > [[i model: b1. i model: b2]repeat] forkBack. > > > > > > As you can see from the above example, whitened image is shown most of > the > > > time and b1 b2 very brief. > > > > > > Hwa Jong Oh > > > > > > > > > > > > begin 666 BitmapAnimationShell.cls M(D9I;&5D(&]U="!F<F]M($1O;'!H:6X@4VUA;&QT86QK+SDX(')E;&5A<V4@ M,2XP(B$-"@T*4VAE;&Q6:65W('-U8F-L87-S.B C0FET;6%P06YI;6%T:6]N M4VAE;&P-"@EI;G-T86YC959A<FEA8FQE3F%M97,Z("=F;W)E0FET<R!B86-K M0FET<R!R861I86YS(&%N:6UA=&EO;E!R;V-E<W,G#0H)8VQA<W-687)I86)L M94YA;65S.B G)PT*"7!O;VQ$:6-T:6]N87)I97,Z("<G(0T*#0I":71M87!! M;FEM871I;VY3:&5L;"!C;&%S<R!I;G-T86YC959A<FEA8FQE3F%M97,Z("<G M(0T*#0I":71M87!!;FEM871I;VY3:&5L;"!C;VUM96YT.B G)R$-"@T*(4)I M=&UA<$%N:6UA=&EO;E-H96QL(&-A=&5G;W)I97-&;W)#;&%S<R%.;R!C871E M9V]R>2$@(0T*#0HA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M(&9R964-"@DA#0H-"F]N4F5S:7IE9#H@85-I>F5%=F5N= T*"2)4:&4@<F5C M96EV97(@:&%S(&)E96X@<F5S:7IE9#L@<V5T('5P(&$@8F%C:V=R;W5N9"!B M:71M87 @;V8@=&AE(&%P<')O<')I871E('-I>F4B#0H-"@ES=7!E<B!O;E)E M<VEZ960Z(&%3:7IE179E;G0N#0H)8F%C:T)I=',@.CT@0FET;6%P(&-O;7!A M=&EB;&4Z('-E;&8@8V%N=F%S('=I9'1H.B!A4VEZ945V96YT('=I9'1H(&AE M:6=H=#H@85-I>F5%=F5N="!H96EG:'0N#0H)9F]R94)I=',@.CT@0FET;6%P M(&-O;7!A=&EB;&4Z('-E;&8@8V%N=F%S('=I9'1H.B!A4VEZ945V96YT('=I M9'1H(&AE:6=H=#H@85-I>F5%=F5N="!H96EG:'0N#0H-"@EA;FEM871I;VY0 M<F]C97-S(&ES3FEL(&EF5')U93H@6PT*"0EA;FEM871I;VY0<F]C97-S(#H] M(%M;<V5L9B!C;VUP;W-E4V-E;F4N(%!R;V-E<W-O<B!S;&5E<#H@,3 P72!R M97!E870@72!F;W)K070Z(%!R;V-E<W-O<B!U<V5R0F%C:V=R;W5N9%!R:6]R M:71Y(%TN(2 A#0H-"B%":71M87!!;FEM871I;VY3:&5L;"!C871E9V]R:65S M1F]R.B C8V]M<&]S94)A8VLZ(6]P97)A=&EO;G,A("$-"B%":71M87!!;FEM M871I;VY3:&5L;"!C871E9V]R:65S1F]R.B C8V]M<&]S95-C96YE(6]P97)A M=&EO;G,A("$-"B%":71M87!!;FEM871I;VY3:&5L;"!C871E9V]R:65S1F]R M.B C97)A<V5"86-K.B%O<&5R871I;VYS(2 A#0HA0FET;6%P06YI;6%T:6]N M4VAE;&P@8V%T96=O<FEE<T9O<CH@(V9L:7 A;W!E<F%T:6]N<R$@(0T*(4)I M=&UA<$%N:6UA=&EO;E-H96QL(&-A=&5G;W)I97-&;W(Z("-I;FET:6%L:7IE M(6YO(&-A=&5G;W)Y(2 A#0HA0FET;6%P06YI;6%T:6]N4VAE;&P@8V%T96=O M<FEE<T9O<CH@(V]N1&5S=')O>65D(65V96YT(&AA;F1L:6YG(2 A#0HA0FET M;6%P06YI;6%T:6]N4VAE;&P@8V%T96=O<FEE<T9O<CH@(V]N4&%I;G1297%U M:7)E9#HA979E;G0@:&%N9&QI;F<A("$-"B%":71M87!!;FEM871I;VY3:&5L M;"!C871E9V]R:65S1F]R.B C;VY297-I>F5D.B%E=F5N="!H86YD;&EN9R$@ %(0T*#0H` ` end |
In reply to this post by Alain Fischer-3
Alain Fischer,
Filed Out Class 'BitmapAnimationShell' attached at your mail, had some problems some are serious some are minor. I have fixed some features and wants to post it here. Problems found in the original version was: [1] BitmapAnimationShell is a subclass of a ShellView. Therefore, Its name is quite confusing. So I renamed it "BitmapAnimationShellView" [2] #onResized: method is not included is the pure image since 3.05. BitmapAnimationShell is triggered by #onResized. BitmapAnimationShell won't be started. So I added #wmResize:lParam:wParam: to the class to get it triggered. [3] "animationProcess terminate" message will make error if there hasn't been any process triggered. So I fixed like this; (animationProcess isKindOf: Process) ifTrue: [ animationProcess terminate ]. [4] Canvas>>font: method is very dangers if called many times rapidly. BitmapAnimationShell is the case. Canvas>>font: will consume font resource each time called. Font of the canvas must be stored before the Canvas>>font: action, and it must be return after the action. #composeBack: ... oldFont := aCanvas font. aCanvas font: (Font name: 'Times New Roman' pointSize: 24); text: 'Hello world' at: pos rounded. aCanvas font: oldFont Have a good one Hwa Jong Oh ==============<BEGIN:BitmapAnimationShellView.cls>============== "Filed out from Dolphin Smalltalk 99 release 3.0"! ShellView subclass: #BitmapAnimationShellView instanceVariableNames: 'foreBits backBits radians animationProcess' classVariableNames: '' poolDictionaries: ''! BitmapAnimationShellView class instanceVariableNames: ''! BitmapAnimationShellView comment: ''! BitmapAnimationShellView guid: (GUID fromString: '{D7CA0A20-CBD2-11D4-A7B9-0050DAC5AC82}')! !BitmapAnimationShellView categoriesForClass!No category! ! !BitmapAnimationShellView methodsFor! composeBack: aCanvas "Compose the scene into the background canvas, aCanvas. This is the method responsible for rendering the scene. Here we just move some text about" | origin pos radius oldFont| origin := self clientRectangle center. radians := radians + (Float pi*2 /360). radius := 100. pos := ((radians sin) @ (radians cos))*radius+origin. oldFont := aCanvas font. aCanvas font: (Font name: 'Times New Roman' pointSize: 24); text: 'Hello world' at: pos rounded. aCanvas font: oldFont! composeScene "Compose the scene. We explicitly free the canvas rather than allowing garbage collection to do this since this method is liable to be called very frequently. This will avoid temporarily accumulating large amounts of garbage " | canvas | canvas := backBits canvas. self eraseBack: canvas. self composeBack: canvas. canvas free. self flip.! eraseBack: aCanvas "Erase the background bits in aCanvas to white." aCanvas fillRectangle: self clientRectangle brush: Brush white.! flip "Flips background and foreground bitmaps and cause the new foreground to be painted" | temp canvas | temp := foreBits. foreBits := backBits. backBits := temp. canvas := self canvas. foreBits drawOn: canvas. canvas free ! initialize "Private - Initialize the receiver" super initialize. radians := 0! model: aBitmap "ºñÆ®¸ÊÀ» backBits¿¡ ÀúÀå(º¹»ç)ÇÏ°í flip½ÃŲ´Ù" super model: aBitmap! onDestroyed "Terminate the animation process" (animationProcess isKindOf: Process) ifTrue: [ animationProcess terminate ]. super onDestroyed. ! onPaintRequired: aPaintEvent "Paint the background bitmap" | canvas | foreBits isNil ifFalse: [canvas := aPaintEvent canvas. foreBits drawOn: canvas. canvas free] ! onResized: aSizeEvent "The receiver has been resized; set up a background bitmap of the appropriate size" "super onResized: aSizeEvent." backBits := Bitmap compatible: self canvas width: aSizeEvent width height: aSizeEvent height. foreBits := Bitmap compatible: self canvas width: aSizeEvent width height: aSizeEvent height. animationProcess isNil ifTrue: [ animationProcess := [[self composeScene. Processor sleep: 100] repeat ] forkAt: Processor userBackgroundPriority ].! wmSize: message wParam: wParam lParam: lParam "Private - Default handler for a WM_SIZE (window resized) message." super wmSize: message wParam: wParam lParam: lParam. self onResized: (SizeEvent message: message handle: handle wParam: wParam lParam: lParam)! ! !BitmapAnimationShellView categoriesFor: #composeBack:!operations!public! ! !BitmapAnimationShellView categoriesFor: #composeScene!operations!public! ! !BitmapAnimationShellView categoriesFor: #eraseBack:!operations!public! ! !BitmapAnimationShellView categoriesFor: #flip!operations!public! ! !BitmapAnimationShellView categoriesFor: #initialize!*-unclassified!public! ! !BitmapAnimationShellView categoriesFor: #model:!*-unclassified!public! ! !BitmapAnimationShellView categoriesFor: #onDestroyed!event handling!public! ! !BitmapAnimationShellView categoriesFor: #onPaintRequired:!event handling!public! ! !BitmapAnimationShellView categoriesFor: #onResized:!event handling!public! ! !BitmapAnimationShellView categoriesFor: #wmSize:wParam:lParam:!event handling!event handling-win32!private! ! ==============<END:BitmapAnimationShellView.cls>================ |
In reply to this post by Howard Oh
Hwa Jong Oh
You wrote in message news:90hj3u$17im6$[hidden email]... > > What is the best way to implement a video player in Dolphin? >... The "best" way in D4 (or at least the one which makes best use of existing code, rather than reinventing it) would be to use an Active-X control, e.g. the Windows Media Player, or the Microsoft Multimedia control. The latter is, I think, just an OCX wrapper around the Windows MCI control, intended so that it can be accessed from VB, and a ControlView subclass could be added to D3 which interfaces to it (the MCI control) directly; search for MCIWnd on MSDN. Regards Blair |
Free forum by Nabble | Edit this page |