[squeak-dev] Quicktime

John M McIntosh johnmci at smalltalkconsulting.com
Thu Aug 26 03:52:45 UTC 2010


If someone wants to drag that Sophie source code into the squeak or Pharo mainstream I'll help from the side lines.  we did re-write the code *MANY* times so it's I think fairly easy to port. 

The concept is there is an abstraction that plays audio & video,  which concrete  classes are used is dependent on the media & what's on the platform, so when a URI is supplied,
I note everything in Sophie referring to a media object was a URI (memory pointer, file pointer, internet pointer), then it's passed to either quicktime which likes many flavours of URI or 
resolved to a file path for URI friendly codecs. 

Some of this was tied to tweak, but the concept was a heartbeat timer either polled every N seconds and then invalidate the form area, which later caused tweak to redraw the form, or tied to 
the quicktime plugin which had the responsibility to fire a semaphore when a movie frame changed so that  we didn't have to run a polling cycle. 

Some people might be offended by having to use quicktime, but we realized at the time that quicktime actually *is* everywhere because people for some reason install iTunes on all their computers
so they can listen to music or watch video....  As for the linux folks (*cough*) well there are frameworks that pretend to offer up the quicktime api, so just compile those up as a solution or provide some api to some other codec solution.

So take a look at the class hierarchy at SophieMovie 


So some porting thoughts 
resource is of course the sophie resource that wraps the media object, it contains meta-data. 
So for example
bounds
	self resource ifNil:[^self rectangle].
	^(self naturalRectangle scaleBy: (self resource applyTransformationsAgainst: 1 at 1)) rounded

The applyTransformationsAgainst:   runs a sequence of steps to turn the 1 at 1 into a float between 0-1 that is applied against the natural scale of a movie. 
This allowed the Sophie book creator to manipulate the size & orientation of the media resource as a set of steps. 
No doubt you can just return the size of the movie to simplify things where it's used to set the rectangle size for the frame via openMovieFromURI:

openMovieFromURI: foo
	self setupOffscreen.
	self rectangle: self bounds.
	self time:0.  "This should likely go into a separate API, but it is needed to ensure clips start at the proper time 0, not the natural media's time 0"



On 2010-08-25, at 7:27 PM, Chris Cunnington wrote:

> I found the Sophie dev image ( http://dev.opensophie.org/HomePage ) and the gang's all there: MPEG; Ogg; Vorbis; Quicktime; etc. 
> 
> Sophie is built on a Squeak3.8.2a image and it has functionality that people want to have in 4.1. I can watch three versions of Macbeth in Sophie. I want to do that in 4.1. I imagine the Documentation team would like that too. They could have links in the HelpSystem open movies from all over the Internet and have them play in the image. 
> 
> The files are available at http://source.opensophie.org/Sophie/. This file looks promising: Sophie-Quicktime-JMM.28.mcz. When I drag it onto the World I get an error that I think is telling me I need FFI installed. 
> 
> John, on a scale of 1 to 10 how hard would it be for people not you to play around with your code and install a video player in 4.1?
> 
> Chris 
> 
> 
> 

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




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100825/88c38da9/attachment.htm


More information about the Squeak-dev mailing list