MPEGPlayer Help!

John M McIntosh johnmci at smalltalkconsulting.com
Mon Mar 12 03:56:58 UTC 2007


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 at 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 at 100.
>
> |movie|
> movie_MPEGPlayer playFile:'simul1.mpg'.
> movie playStreamWaitTilDone:0 .
> movie stopAndClose.
> Display restore.
>
> Thanks,
>
> Radouane

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===





More information about the Squeak-dev mailing list