MPEGPlayer Help!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

MPEGPlayer Help!

radouane el Marjani-2
Hi,

I want play a movie, so that after end this movie, it must close it
self. So I do that:
|movie|
movie_MPEGPlayer playFile:'simul1.mpg'.
movie playStreamWaitTilDone:0 .
movie stopAndClose.

All work fine but after the movie finished to play, his screen stay in
squeak  und don't want to close.
I want that after playing, this screen must closing and nothing is
showed.(no movie screen!).
Have someone an idea. (Try please the code und you will understand what
I mean- I hope- my englisch is :-( )

Thanks.
Radouane

Reply | Threaded
Open this post in threaded view
|

Re: MPEGPlayer Help!

johnmci
Nice to see someone working with this. I'll note from a history  
perspective.

MPEGFIle is the api interface to the LibMPEG3.

MPEGPlayer is a proof of concept interface I wrote to enable the  
playback of sound or audio when I was testing the api.
Originally it used the text to sound playback logic to play sound  
buffers since that was the only existing class that let you
play a ring buffer structure. but I believe John Maloney wrote the  
StreamingMP3Sound class to provide a cleaner interface which then was  
integrated into MPEGPlayer.

Although MPEGPlayer has logic to playback video it's an experimental  
interface and should be
reviewed for performance and delay/sync issues if you want to depend  
on it.

For example privatePlayVideoStream:   has logic to fiddle with sound/
video delay syncing, and then figuring out which frame to render
based on the wall clock.

For video playback people usually use the MPEGMoviePlayerMorphic  
which drives the video display logic via morphic ticking
I believe the logic in it works *perhaps* better.

I'll note that sound playback has never been a problem, even slow  
machines
have sufficient CPU power to ensure the StreamingMP3Sound has  
sufficient buffers of decoded sound for playback.

In Sophie we support a tweak based player we wrote that provides for  
player logic using MPEGFile, or quicktime based player that
use a polling quicktime api, or an interrupt based api via a  
quicktime plugin that signals when a frame has been rended by quicktime.
Of course for sound we just say play and quicktime looks after all  
the nasty details. I'll note in testing I've run say 450KBytes/sec  
of  audio
channels (8) in a Sophie book from the internet without any dropout.

On Mar 8, 2007, at 7:34 AM, radouane el Marjani wrote:

> Hi,
>
> I want play a movie, so that after end this movie, it must close it  
> self. So I do that:
> |movie|
> movie_MPEGPlayer playFile:'simul1.mpg'.
> movie playStreamWaitTilDone:0 .
> movie stopAndClose.
>
> All work fine but after the movie finished to play, his screen stay  
> in squeak  und don't want to close.
> I want that after playing, this screen must closing and nothing is  
> showed.(no movie screen!).
> Have someone an idea. (Try please the code und you will understand  
> what I mean- I hope- my englisch is :-( )
>
> Thanks.
> Radouane
>

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: MPEGPlayer Help!

radouane el marjani
In reply to this post by radouane el Marjani-2
Hi, Thanks you, that you have answered me last time . here I have a neue
question: I use MPEGPlayer for Video playing, Know someone how can I fix
the width and the hight of Video playing Window. There is somthing like
movie extent: 100@100.

|movie|
 movie_MPEGPlayer playFile:'simul1.mpg'.
 movie playStreamWaitTilDone:0 .
 movie stopAndClose.
 Display restore.

Thanks,

Radouane




       

       
               
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

Reply | Threaded
Open this post in threaded view
|

Re: MPEGPlayer Help!

johnmci
I'm not sure how you are creating the form to draw in

Normally the videoReadFrameInto:stream:  considers the video  
dimensions and the form dimensions.
Depending on the values you set you can have the plugin scale the  
video into a form as part of the creation, which
is more efficient than taking a form at the normal video size, and  
scalling it in Morphic at a later point.

I'll note in MPEGPlayer>>checkForm we set the form to the video size.  
The size you choose to use for the form is of course
set by the morphic object that is controlling the display of the form.

I'll note not only can you scale, you can set x/y and bytesPerRow to  
draw into a form that is bigger.  Plus with the
openBuffer:  changes I pushed out Jan 2006 you can read a mpeg stream  
from memory, versus using a file handle.
I believe Plopp uses this to avoid file I/O for small sound files,  
and to run videos directly to the Display in order to avoid extra  
overhead of to a form, then to the Display.
PS yes likely some enterprising person (not me) could alter the  
plugin to draw to a surface. Keeping in mind the nasty VM bug with  
surfaces I pointed out last year.


videoReadFrameInto: aForm stream: aStream
        "Read the next video frame from the given stream into the given 16-  
or 32-bit Form. The movie frame will be scaled to fit the Form if  
necessary."

        | colorModel bytesPerRow |
        ((aForm depth = 16) | (aForm depth = 32)) ifFalse: [self error:  
'must use 16- or 32-bit Form'].
        aForm depth = 16
                ifTrue: [
                        colorModel := self endianness = #big ifTrue: [14] ifFalse: [16].
                        bytesPerRow := 2 * (aForm width roundUpTo: 2)]
                ifFalse: [
                        colorModel := self endianness = #big ifTrue: [13] ifFalse: [1].
                        bytesPerRow := 4 * aForm width].
        ^ self
                videoReadNextFrameInto: aForm bits
                x: 0 y: 0
                width: (self videoFrameWidth: aStream)
                height: (self videoFrameHeight: aStream)
                outWidth: aForm width
                outHeight: aForm height
                colorModel: colorModel
                stream: aStream
                bytesPerRow: bytesPerRow



checkForm: aStream
        | y x |

        self form notNil ifTrue: [^self].
        y := self videoFrameHeight: aStream.
        x := self videoFrameWidth: aStream.
        self form:  (Form extent: x@y depth: 32)


On Mar 11, 2007, at 7:41 PM, radouane el marjani wrote:

> Hi, Thanks you, that you have answered me last time . here I have a  
> neue question: I use MPEGPlayer for Video playing, Know someone how  
> can I fix the width and the hight of Video playing Window. There is  
> somthing like movie extent: 100@100.
>
> |movie|
> movie_MPEGPlayer playFile:'simul1.mpg'.
> movie playStreamWaitTilDone:0 .
> movie stopAndClose.
> Display restore.
>
> Thanks,
>
> Radouane

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===