diff options
| author | xant <[email protected]> | 2010-12-25 02:05:19 (GMT) |
|---|---|---|
| committer | xant <[email protected]> | 2010-12-25 02:05:19 (GMT) |
| commit | d5509c9917e3abbca75d00f7295ff2fa20e93ed4 (patch) | |
| tree | 821a1444a22bf0a13a914ceb4195a63c38ef539d | |
| parent | ac8896e32c88566f602f0a26fcaa8ecd99542cb5 (diff) | |
reviewing javascript base classes after recent changes in the class hierarchy
| -rw-r--r-- | JMX.xcodeproj/project.pbxproj | 18 | ||||
| -rw-r--r-- | core/JMXEntity.mm | 1 | ||||
| -rw-r--r-- | core/JMXScript.mm | 2 | ||||
| -rw-r--r-- | core/JMXThreadedEntity.mm | 1 | ||||
| -rw-r--r-- | entities/JMXAudioCapture.mm | 32 | ||||
| -rw-r--r-- | entities/JMXScriptEntity.mm | 20 | ||||
| -rw-r--r-- | entities/JMXScriptFile.mm | 24 | ||||
| -rw-r--r-- | entities/JMXVideoCapture.mm | 4 | ||||
| -rw-r--r-- | entities/video/JMXQtMovieEntity.mm | 27 | ||||
| -rw-r--r-- | entities/video/JMXQtVideoCaptureEntity.mm | 9 | ||||
| -rw-r--r-- | jmx-icon.icns | bin | 53092 -> 154772 bytes | |||
| -rw-r--r-- | jsapi/AudioCapture.js | 6 | ||||
| -rw-r--r-- | jsapi/AudioFile.js (copied from jsapi/core_doc/MovieFile.js) | 35 | ||||
| -rw-r--r-- | jsapi/AudioOutput.js | 8 | ||||
| -rw-r--r-- | jsapi/JMX.js | 8 | ||||
| -rw-r--r-- | jsapi/MovieFile.js (copied from jsapi/core_doc/MovieFile.js) | 14 | ||||
| -rw-r--r-- | jsapi/VideoCapture.js | 8 | ||||
| -rw-r--r-- | jsapi/VideoFilter.js | 4 | ||||
| -rw-r--r-- | jsapi/core_doc/CoreAudioAudioFile.js (renamed from jsapi/core_doc/AudioFile.js) | 8 | ||||
| -rw-r--r-- | jsapi/core_doc/QtMovieFile.js (renamed from jsapi/core_doc/MovieFile.js) | 8 |
20 files changed, 142 insertions, 95 deletions
diff --git a/JMX.xcodeproj/project.pbxproj b/JMX.xcodeproj/project.pbxproj index c830496..7ea3ba3 100644 --- a/JMX.xcodeproj/project.pbxproj +++ b/JMX.xcodeproj/project.pbxproj @@ -89,6 +89,9 @@ AA5563C412B188EB00C882FF /* CIAlphaFade.m in Sources */ = {isa = PBXBuildFile; fileRef = AA555FC712AEF39600C882FF /* CIAlphaFade.m */; }; AA7F247212907AA500BE432F /* libv8.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AA7F247112907AA500BE432F /* libv8.dylib */; }; AA8CB78E1282BB9900A17115 /* JMXScriptFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = AA8CB78D1282BB9900A17115 /* JMXScriptFile.mm */; }; + AA8F785812C5880100EA8543 /* VideoCapture.js in Deploy JS API */ = {isa = PBXBuildFile; fileRef = AA4B039812C06C3000775B88 /* VideoCapture.js */; }; + AA8F785912C5880100EA8543 /* MovieFile.js in Deploy JS API */ = {isa = PBXBuildFile; fileRef = AA8F770712C5718600EA8543 /* MovieFile.js */; }; + AA8F785A12C5880100EA8543 /* AudioFile.js in Deploy JS API */ = {isa = PBXBuildFile; fileRef = AA8F770812C571A200EA8543 /* AudioFile.js */; }; AACE7D04129315DE00FBDC0D /* JMXScriptEntity.mm in Sources */ = {isa = PBXBuildFile; fileRef = AACE7D03129315DE00FBDC0D /* JMXScriptEntity.mm */; }; AACE7D331293195600FBDC0D /* JMXV8PropertyAccessors.mm in Sources */ = {isa = PBXBuildFile; fileRef = AACE7D321293195600FBDC0D /* JMXV8PropertyAccessors.mm */; }; AAD139BB128EA0DF00ECB03A /* JMXDrawPath.mm in Sources */ = {isa = PBXBuildFile; fileRef = AAD139BA128EA0DF00ECB03A /* JMXDrawPath.mm */; }; @@ -109,6 +112,9 @@ AA4BFED112BE25E900775B88 /* VideoOutput.js in Deploy JS API */, AA4BFF2F12BE2F9500775B88 /* VideoFilter.js in Deploy JS API */, AA4B01F412BEC85F00775B88 /* AudioCapture.js in Deploy JS API */, + AA8F785812C5880100EA8543 /* VideoCapture.js in Deploy JS API */, + AA8F785912C5880100EA8543 /* MovieFile.js in Deploy JS API */, + AA8F785A12C5880100EA8543 /* AudioFile.js in Deploy JS API */, ); name = "Deploy JS API"; runOnlyForDeploymentPostprocessing = 0; @@ -267,14 +273,14 @@ AA4BFDF712BE0CF800775B88 /* Size.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = Size.js; sourceTree = "<group>"; }; AA4BFDF812BE0CF800775B88 /* Point.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = Point.js; sourceTree = "<group>"; }; AA4BFDF912BE0CF800775B88 /* Pin.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = Pin.js; sourceTree = "<group>"; }; - AA4BFDFA12BE0CF800775B88 /* MovieFile.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = MovieFile.js; sourceTree = "<group>"; }; + AA4BFDFA12BE0CF800775B88 /* QtMovieFile.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = QtMovieFile.js; sourceTree = "<group>"; }; AA4BFDFB12BE0CF800775B88 /* Entity.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = Entity.js; sourceTree = "<group>"; }; AA4BFDFC12BE0CF800775B88 /* DrawPath.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = DrawPath.js; sourceTree = "<group>"; }; AA4BFDFD12BE0CF800775B88 /* CoreImageFilter.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = CoreImageFilter.js; sourceTree = "<group>"; }; AA4BFDFE12BE0CF800775B88 /* Color.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = Color.js; sourceTree = "<group>"; }; AA4BFDFF12BE0CF800775B88 /* AudioSpectrum.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AudioSpectrum.js; sourceTree = "<group>"; }; AA4BFE0012BE0CF800775B88 /* CoreAudioOutput.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = CoreAudioOutput.js; sourceTree = "<group>"; }; - AA4BFE0112BE0CF800775B88 /* AudioFile.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AudioFile.js; sourceTree = "<group>"; }; + AA4BFE0112BE0CF800775B88 /* CoreAudioAudioFile.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = CoreAudioAudioFile.js; sourceTree = "<group>"; }; AA4BFE1112BE0D7400775B88 /* AudioOutput.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AudioOutput.js; sourceTree = "<group>"; }; AA4BFE1312BE0E2000775B88 /* JMX.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = JMX.js; sourceTree = "<group>"; }; AA4BFE1512BE135000775B88 /* VideoOutput.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = VideoOutput.js; sourceTree = "<group>"; }; @@ -288,6 +294,8 @@ AA8CB78C1282BB9800A17115 /* JMXScriptFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMXScriptFile.h; sourceTree = "<group>"; }; AA8CB78D1282BB9900A17115 /* JMXScriptFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JMXScriptFile.mm; sourceTree = "<group>"; }; AA8F768C12C40D2700EA8543 /* QtVideoCapture.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = QtVideoCapture.js; sourceTree = "<group>"; }; + AA8F770712C5718600EA8543 /* MovieFile.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = MovieFile.js; sourceTree = "<group>"; }; + AA8F770812C571A200EA8543 /* AudioFile.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AudioFile.js; sourceTree = "<group>"; }; AACE7D02129315DE00FBDC0D /* JMXScriptEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMXScriptEntity.h; sourceTree = "<group>"; }; AACE7D03129315DE00FBDC0D /* JMXScriptEntity.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JMXScriptEntity.mm; sourceTree = "<group>"; }; AACE7D311293195600FBDC0D /* JMXV8PropertyAccessors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMXV8PropertyAccessors.h; sourceTree = "<group>"; }; @@ -531,6 +539,8 @@ AA4BFEFD12BE2B4500775B88 /* VideoFilter.js */, AA4B01F312BEC85500775B88 /* AudioCapture.js */, AA4B039812C06C3000775B88 /* VideoCapture.js */, + AA8F770712C5718600EA8543 /* MovieFile.js */, + AA8F770812C571A200EA8543 /* AudioFile.js */, ); path = jsapi; sourceTree = SOURCE_ROOT; @@ -542,14 +552,14 @@ AA4BFDF712BE0CF800775B88 /* Size.js */, AA4BFDF812BE0CF800775B88 /* Point.js */, AA4BFDF912BE0CF800775B88 /* Pin.js */, - AA4BFDFA12BE0CF800775B88 /* MovieFile.js */, + AA4BFDFA12BE0CF800775B88 /* QtMovieFile.js */, AA4BFDFB12BE0CF800775B88 /* Entity.js */, AA4BFDFC12BE0CF800775B88 /* DrawPath.js */, AA4BFDFD12BE0CF800775B88 /* CoreImageFilter.js */, AA4BFDFE12BE0CF800775B88 /* Color.js */, AA4BFDFF12BE0CF800775B88 /* AudioSpectrum.js */, AA4BFE0012BE0CF800775B88 /* CoreAudioOutput.js */, - AA4BFE0112BE0CF800775B88 /* AudioFile.js */, + AA4BFE0112BE0CF800775B88 /* CoreAudioAudioFile.js */, AA4BFE1912BE13D100775B88 /* OpenGLScreen.js */, AA4B01FA12BECCCA00775B88 /* QtAudioCapture.js */, AA8F768C12C40D2700EA8543 /* QtVideoCapture.js */, diff --git a/core/JMXEntity.mm b/core/JMXEntity.mm index 9e91d88..b1c3b34 100644 --- a/core/JMXEntity.mm +++ b/core/JMXEntity.mm @@ -500,7 +500,6 @@ v8::Persistent<v8::FunctionTemplate>JMXEntityJSClassTemplate() // set instance methods v8::Handle<ObjectTemplate> instanceTemplate = classTemplate->InstanceTemplate(); instanceTemplate->SetInternalFieldCount(1); - // Add accessors for each of the fields of the entity. instanceTemplate->SetAccessor(String::NewSymbol("name"), GetStringProperty, SetStringProperty); instanceTemplate->SetAccessor(String::NewSymbol("description"), GetStringProperty); diff --git a/core/JMXScript.mm b/core/JMXScript.mm index ac20d46..8788bd9 100644 --- a/core/JMXScript.mm +++ b/core/JMXScript.mm @@ -55,7 +55,7 @@ static JMXV8ClassDescriptor mappedClasses[] = { { "JMXVideoMixer", "VideoMixer", JMXVideoMixerJSConstructor }, { "JMXAudioFileEntity", "CoreAudioFile", JMXAudioFileEntityJSConstructor }, { "JMXCoreAudioOutput", "CoreAudioOutput", JMXCoreAudioOutputJSConstructor }, - { "JMXQtAudioCaptureEntity", "QtAudioCapture", JMXCoreAudioOutputJSConstructor }, + { "JMXQtAudioCaptureEntity", "QtAudioCapture", JMXQtAudioCaptureEntityJSConstructor }, { "JMXAudioSpectrumAnalyzer", "AudioSpectrum", JMXAudioSpectrumAnalyzerJSConstructor }, { "JMXDrawEntity", "DrawPath", JMXDrawEntityJSConstructor }, { "JMXPoint", "Point", JMXPointJSConstructor }, diff --git a/core/JMXThreadedEntity.mm b/core/JMXThreadedEntity.mm index 8546bd0..9d3ab33 100644 --- a/core/JMXThreadedEntity.mm +++ b/core/JMXThreadedEntity.mm @@ -407,6 +407,7 @@ static Persistent<FunctionTemplate> classTemplate; v8::Handle<ObjectTemplate> classProto = classTemplate->PrototypeTemplate(); classProto->Set("start", FunctionTemplate::New(Start)); classProto->Set("stop", FunctionTemplate::New(Stop)); + classTemplate->InstanceTemplate()->SetInternalFieldCount(1); classTemplate->InstanceTemplate()->SetAccessor(String::NewSymbol("frequency"), GetNumberProperty, SetNumberProperty); return classTemplate; } diff --git a/entities/JMXAudioCapture.mm b/entities/JMXAudioCapture.mm index 0e12bc8..cad4e4c 100644 --- a/entities/JMXAudioCapture.mm +++ b/entities/JMXAudioCapture.mm @@ -132,9 +132,9 @@ static v8::Handle<Value> DefaultDevice(const Arguments& args) NSString *defaultDevice = [[vc class] defaultDevice]; v8::Handle<String> deviceName = String::New([defaultDevice UTF8String]); [pool release]; - handleScope.Close(deviceName); + return handleScope.Close(deviceName); } - return handleScope.Close(Undefined()); + return v8::Undefined(); } @@ -142,19 +142,20 @@ static v8::Handle<Value> DefaultDevice(const Arguments& args) static v8::Handle<Value>AvailableDevices(const Arguments& args) { HandleScope handleScope; - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + v8::Handle<Object> holder = args.Holder(); + v8::String::Utf8Value value(holder->ObjectProtoToString()); JMXAudioCapture *entity = (JMXAudioCapture *)args.Holder()->GetPointerFromInternalField(0); - NSArray *availableDevices; - if (entity) - availableDevices = [[entity class] availableDevices]; - else - availableDevices = [JMXAudioCapture availableDevices]; // XXX - v8::Handle<Array> list = Array::New([availableDevices count]); - for (int i = 0; i < [availableDevices count]; i++) { - list->Set(i, String::New([[availableDevices objectAtIndex:i] UTF8String])); + if (entity) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSArray *availableDevices = [[entity class] availableDevices]; + v8::Handle<Array> list = Array::New([availableDevices count]); + for (int i = 0; i < [availableDevices count]; i++) { + list->Set(i, String::New([[availableDevices objectAtIndex:i] UTF8String])); + } + [pool drain]; + return handleScope.Close(list); } - [pool drain]; - return handleScope.Close(list); + return v8::Undefined(); } @@ -181,14 +182,15 @@ static v8::Handle<Value> SelectDevice(const Arguments& args) HandleScope handleScope; if (!classTemplate.IsEmpty()) return classTemplate; + NSLog(@"JMXAudioCapture ClassTemplate created"); classTemplate = v8::Persistent<FunctionTemplate>::New(FunctionTemplate::New()); classTemplate->Inherit([super jsClassTemplate]); - classTemplate->SetClassName(String::New("AudioCapture")); + classTemplate->SetClassName(String::New("QtAudioCapture")); classTemplate->InstanceTemplate()->SetInternalFieldCount(1); v8::Handle<ObjectTemplate> classProto = classTemplate->PrototypeTemplate(); classProto->Set("start", FunctionTemplate::New(Start)); classProto->Set("stop", FunctionTemplate::New(Stop)); - classProto->Set("avaliableDevices", FunctionTemplate::New(AvailableDevices)); + classProto->Set("availableDevices", FunctionTemplate::New(AvailableDevices)); classProto->Set("selectDevice", FunctionTemplate::New(SelectDevice)); classProto->Set("defaultDevice", FunctionTemplate::New(DefaultDevice)); diff --git a/entities/JMXScriptEntity.mm b/entities/JMXScriptEntity.mm index 774d859..ff7fea0 100644 --- a/entities/JMXScriptEntity.mm +++ b/entities/JMXScriptEntity.mm @@ -8,7 +8,6 @@ #import "JMXScriptEntity.h" #import "JMXScript.h" -#import "JMXThreadedEntity.h" using namespace v8; @@ -29,33 +28,16 @@ using namespace v8; { self = [super init]; if (self) { - self.frequency = [NSNumber numberWithDouble:1.0]; active = NO; - JMXThreadedEntity *threadedEntity = [JMXThreadedEntity threadedEntity:self]; - if (threadedEntity) - return threadedEntity; } - return nil; + return self; } - (void)dealloc { - [self stop]; [super dealloc]; } -- (void)tick:(uint64_t)timeStamp -{ - if (!self.quit) { - self.quit = YES; // we want to stop the thread as soon as the script exits - if (self.code) - [JMXScript runScript:self.code withEntity:self]; - else - NSLog(@"JMXScriptEntity::tick(): No script to run"); - - } -} - static Persistent<FunctionTemplate> classTemplate; + (v8::Persistent<v8::FunctionTemplate>)jsClassTemplate diff --git a/entities/JMXScriptFile.mm b/entities/JMXScriptFile.mm index 8ddfa0c..f4433a5 100644 --- a/entities/JMXScriptFile.mm +++ b/entities/JMXScriptFile.mm @@ -8,6 +8,7 @@ #import "JMXScriptFile.h" #import "JMXScript.h" +#import "JMXThreadedEntity.h" @implementation JMXScriptFile @@ -24,10 +25,20 @@ if (self) { path = nil; self.name = @"JMXScript"; + self.frequency = [NSNumber numberWithDouble:1.0]; + JMXThreadedEntity *threadedEntity = [JMXThreadedEntity threadedEntity:self]; + if (threadedEntity) + return threadedEntity; } return self; } +- (void)dealloc +{ + [self stop]; + [super dealloc]; +} + - (void)setPath:(NSString *)newPath { if (path) @@ -66,4 +77,17 @@ - (void)runScript { } + +- (void)tick:(uint64_t)timeStamp +{ + if (!self.quit) { + self.quit = YES; // we want to stop the thread as soon as the script exits + if (self.code) + [JMXScript runScript:self.code withEntity:self]; + else + NSLog(@"JMXScriptEntity::tick(): No script to run"); + + } +} + @end diff --git a/entities/JMXVideoCapture.mm b/entities/JMXVideoCapture.mm index 0dee0ed..1e5233d 100644 --- a/entities/JMXVideoCapture.mm +++ b/entities/JMXVideoCapture.mm @@ -66,10 +66,10 @@ static v8::Handle<Value> DefaultDevice(const Arguments& args) static v8::Handle<Value> AvailableDevices(const Arguments& args) { HandleScope handleScope; - JMXVideoCapture *vc = (JMXVideoCapture *)args.Holder()->GetPointerFromInternalField(0); + Class vc = (Class)args.Holder()->GetPointerFromInternalField(1); if (vc) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSArray *availableDevices = [[vc class] availableDevices]; + NSArray *availableDevices = [vc availableDevices]; v8::Handle<Array> list = v8::Array::New([availableDevices count]); for (int i = 0; i < [availableDevices count]; i++) list->Set(Number::New(i), String::New([[availableDevices objectAtIndex:i] UTF8String])); diff --git a/entities/video/JMXQtMovieEntity.mm b/entities/video/JMXQtMovieEntity.mm index 4cd87ea..8ab64d3 100644 --- a/entities/video/JMXQtMovieEntity.mm +++ b/entities/video/JMXQtMovieEntity.mm @@ -337,7 +337,7 @@ using namespace v8; } } -static v8::Handle<Value>open(const Arguments& args) +static v8::Handle<Value>Open(const Arguments& args) { HandleScope handleScope; JMXQtMovieEntity *entity = (JMXQtMovieEntity *)args.Holder()->GetPointerFromInternalField(0); @@ -347,7 +347,7 @@ static v8::Handle<Value>open(const Arguments& args) return v8::Boolean::New(ret); } -static v8::Handle<Value>close(const Arguments& args) +static v8::Handle<Value>Close(const Arguments& args) { HandleScope handleScope; JMXQtMovieEntity *entity = (JMXQtMovieEntity *)args.Holder()->GetPointerFromInternalField(0); @@ -355,15 +355,32 @@ static v8::Handle<Value>close(const Arguments& args) return v8::Undefined(); } +static v8::Handle<Value>SupportedFileTypes(const Arguments& args) +{ + HandleScope handleScope; + Class<JMXFileRead> movieFileClass = (Class)args.Holder()->GetPointerFromInternalField(1); + if (movieFileClass) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSArray *availableDevices = [movieFileClass supportedFileTypes]; + v8::Handle<Array> list = v8::Array::New([availableDevices count]); + for (int i = 0; i < [availableDevices count]; i++) + list->Set(Number::New(i), String::New([[availableDevices objectAtIndex:i] UTF8String])); + [pool release]; + handleScope.Close(list); + } + return handleScope.Close(Undefined()); +} + + (v8::Persistent<v8::FunctionTemplate>)jsClassTemplate { HandleScope handleScope; v8::Persistent<v8::FunctionTemplate> entityTemplate = [super jsClassTemplate]; - entityTemplate->SetClassName(String::New("VideoFile")); + entityTemplate->SetClassName(String::New("QtVideoFile")); entityTemplate->InstanceTemplate()->SetInternalFieldCount(1); v8::Handle<ObjectTemplate> classProto = entityTemplate->PrototypeTemplate(); - classProto->Set("open", FunctionTemplate::New(open)); - classProto->Set("close", FunctionTemplate::New(close)); + classProto->Set("supportedFileTypes", FunctionTemplate::New(SupportedFileTypes)); + classProto->Set("open", FunctionTemplate::New(Open)); + classProto->Set("close", FunctionTemplate::New(Close)); return entityTemplate; } diff --git a/entities/video/JMXQtVideoCaptureEntity.mm b/entities/video/JMXQtVideoCaptureEntity.mm index 2debca0..7a8835b 100644 --- a/entities/video/JMXQtVideoCaptureEntity.mm +++ b/entities/video/JMXQtVideoCaptureEntity.mm @@ -32,8 +32,6 @@ #define JMX_GRABBER_WIDTH_MAX 640 #define JMX_GRABBER_HEIGHT_MAX 480 -/* Coming from Apple sample code */ - /* * QTKit Bridge */ @@ -62,8 +60,8 @@ JMXV8_EXPORT_ENTITY_CLASS(JMXQtVideoCaptureEntity); { self = [super init]; if(self) { - width = 352; - height = 288; + width = 640; + height = 480; session = nil; input = nil; } @@ -77,6 +75,7 @@ JMXV8_EXPORT_ENTITY_CLASS(JMXQtVideoCaptureEntity); [super dealloc]; } +/* Coming from Apple sample code */ - (void)startCapture:(JMXQtVideoCaptureEntity *)controller { NSLog(@"QTCapture opened"); @@ -223,8 +222,6 @@ error: [super dealloc]; } - - - (void)start { [grabber startCapture:self]; diff --git a/jmx-icon.icns b/jmx-icon.icns Binary files differindex 180fd94..85cbb94 100644 --- a/jmx-icon.icns +++ b/jmx-icon.icns diff --git a/jsapi/AudioCapture.js b/jsapi/AudioCapture.js index 2b5436b..263ff2d 100644 --- a/jsapi/AudioCapture.js +++ b/jsapi/AudioCapture.js @@ -63,7 +63,7 @@ function AudioCapture(device, type) AudioCapture.availableDevices = function() { ret = new Array(); - QtKitDevices = QtAudioCapture.availableDevices(); + QtKitDevices = QtAudioCapture().availableDevices(); /* TODO - extra implementations */ ret = ret.concat(QtKitDevices); return ret; @@ -76,6 +76,8 @@ AudioCapture.availableDevices = function() AudioCapture.defaultDevice = function() { ret = new Array(); - return QtAudioCapture.defaultDevice(); + ret.concat(QtAudioCapture().availableDevices()); + // add further backends here + return ret; } diff --git a/jsapi/core_doc/MovieFile.js b/jsapi/AudioFile.js index 5c56f1a..63f48d8 100644 --- a/jsapi/core_doc/MovieFile.js +++ b/jsapi/AudioFile.js @@ -4,12 +4,13 @@ */ /** - * MovieFile + * AudioFile * @constructor - * @base VideoEntity - * @class Wrapper class for JMXQtMovieEntity objects. + * @param {String} path The path of the Audio file. + * @base Entity + * @class Abstract class implementing basic functionalities for entities grabbing video frames from Audio files. * Such objects will extract video frames from supported video file types and will provide images on their 'frame' output pin - * Supported file types can be obtained calling the {@link MovieFile#supportedFileTypes} method + * Supported file types can be obtained calling the {@link AudioFile#supportedFileTypes} method * <h3>InputPins:</h3> * <ul> * <li>path {String}</li> @@ -18,22 +19,31 @@ * </ul> * */ -function MovieFile() +function AudioFile(path, type) { + if (!type) { + // TODO implement type selection + return CoreAudioFile(); + } else { + // TODO + } + + /* Documenation Only */ + this.path = ""; this.repeat = false; this.paused = false; - + /** - * Open movie file at specified path + * Open Audio file at specified path * @param {String} path The path of the video file. */ this.open = function(path) { // ... } - + /** - * Close the current movie file (if any) + * Close the current Audio file (if any) */ this.close = function() { // ... @@ -60,7 +70,10 @@ function MovieFile() /** * Returns a list of supported video file types */ -MovieFile.supportedFileTypes = function() { - // ... +AudioFile.supportedFileTypes = function() { + ret = new Array(); + ret = ret.concat(CoreAudioFile().supporterFileTypes()); + /* TODO - add further file-reader implementations */ + return ret; } diff --git a/jsapi/AudioOutput.js b/jsapi/AudioOutput.js index 3c0cc4f..bbb698e 100644 --- a/jsapi/AudioOutput.js +++ b/jsapi/AudioOutput.js @@ -6,9 +6,10 @@ /** * AudioOutput * @constructor + * @param {String} device The device to open. * @param {String} type The specific implementation type, * pass a null value to use the default - * CoreAudio-based implementation + * CoreAudio-based implementation. * @base Entity * @class Send audio samples to an output device * <h3>InputPins:</h3> @@ -21,10 +22,11 @@ * </ul> * */ -function AudioOutput(type) +function AudioOutput(device, type) { if (!type) - return CoreAudioOutput(device); + // TODO - backend-detection using the provided device + return CoreAudioOutput(device); // revert to default backend else echo("Unsupported device type " + type); }
\ No newline at end of file diff --git a/jsapi/JMX.js b/jsapi/JMX.js index a66d55a..535e557 100644 --- a/jsapi/JMX.js +++ b/jsapi/JMX.js @@ -15,10 +15,8 @@ include("AudioOutput.js"); //echo("Registered class: AudioOutput"); include("AudioCapture.js"); //echo("Registered class: AudioCapture"); +include("VideoCapture.js"); +include("MovieFile.js"); +include("AudioFile.js"); -/* -include("QtMovieFile.js"); -include("QtVideoCapture.js"); -include("CoreAudioFile.js"); -*/ //echo("Done initializing JMX Core API");
\ No newline at end of file diff --git a/jsapi/core_doc/MovieFile.js b/jsapi/MovieFile.js index 5c56f1a..da4e778 100644 --- a/jsapi/core_doc/MovieFile.js +++ b/jsapi/MovieFile.js @@ -6,8 +6,9 @@ /** * MovieFile * @constructor + * @param {String} path The path of the movie file. * @base VideoEntity - * @class Wrapper class for JMXQtMovieEntity objects. + * @class Abstract class implementing basic functionalities for entities grabbing video frames from movie files. * Such objects will extract video frames from supported video file types and will provide images on their 'frame' output pin * Supported file types can be obtained calling the {@link MovieFile#supportedFileTypes} method * <h3>InputPins:</h3> @@ -18,12 +19,12 @@ * </ul> * */ -function MovieFile() +function MovieFile(path, type) { this.path = ""; this.repeat = false; this.paused = false; - + /** * Open movie file at specified path * @param {String} path The path of the video file. @@ -31,7 +32,7 @@ function MovieFile() this.open = function(path) { // ... } - + /** * Close the current movie file (if any) */ @@ -61,6 +62,9 @@ function MovieFile() * Returns a list of supported video file types */ MovieFile.supportedFileTypes = function() { - // ... + ret = new Array(); + ret = ret.concat(QtMovieFile().supporterFileTypes()); + /* TODO - add further file-reader implementations */ + return ret; } diff --git a/jsapi/VideoCapture.js b/jsapi/VideoCapture.js index 39a4fe5..20a72fc 100644 --- a/jsapi/VideoCapture.js +++ b/jsapi/VideoCapture.js @@ -63,9 +63,8 @@ function VideoCapture(device, type) VideoCapture.availableDevices = function() { ret = new Array(); - QtKitDevices = QtVideoCapture.availableDevices(); - /* TODO - extra implementations */ - ret = ret.concat(QtKitDevices); + ret = ret.concat(QtVideoCapture().availableDevices()); + /* TODO - add further backends */ return ret; } @@ -75,7 +74,6 @@ VideoCapture.availableDevices = function() */ VideoCapture.defaultDevice = function() { - ret = new Array(); - return QtVideoCapture.defaultDevice(); + return QtVideoCapture().defaultDevice(); } diff --git a/jsapi/VideoFilter.js b/jsapi/VideoFilter.js index bdf8ea2..b408086 100644 --- a/jsapi/VideoFilter.js +++ b/jsapi/VideoFilter.js @@ -56,10 +56,8 @@ VideoFilter.availableFilters = function() { // list filters from all implemented backends // Core Image ret = new Array(); - ciFilter = new CoreImageFilter(); - coreImageFilters = ciFilter.availableFilters(); /* TODO - extra backends */ - ret = ret.concat(coreImageFilters); + ret = ret.concat(CoreImageFilter().availableFilters()); return ret; } diff --git a/jsapi/core_doc/AudioFile.js b/jsapi/core_doc/CoreAudioAudioFile.js index d9440c0..ded681a 100644 --- a/jsapi/core_doc/AudioFile.js +++ b/jsapi/core_doc/CoreAudioAudioFile.js @@ -4,9 +4,9 @@ */ /** - * AudioFile + * CoreAudioFile * @constructor - * @base Entity + * @base AudioFile * @class Read samples from audio files * Supported file types can be obtained calling the {@link AudioFile#supportedFileTypes} method * <h3>InputPins:</h3> @@ -21,7 +21,7 @@ * </ul> * */ -function AudioFile() +function CoreAudioFile() { this.path = ""; this.repeat = false; @@ -60,7 +60,7 @@ function AudioFile() /** * Returns a list of supported audio file types */ -AudioFile.supportedFileTypes = function() { +CoreAudioFile.supportedFileTypes = function() { // ... } diff --git a/jsapi/core_doc/MovieFile.js b/jsapi/core_doc/QtMovieFile.js index 5c56f1a..aea01be 100644 --- a/jsapi/core_doc/MovieFile.js +++ b/jsapi/core_doc/QtMovieFile.js @@ -4,9 +4,9 @@ */ /** - * MovieFile + * QtMovieFile * @constructor - * @base VideoEntity + * @base MovieFile * @class Wrapper class for JMXQtMovieEntity objects. * Such objects will extract video frames from supported video file types and will provide images on their 'frame' output pin * Supported file types can be obtained calling the {@link MovieFile#supportedFileTypes} method @@ -18,7 +18,7 @@ * </ul> * */ -function MovieFile() +function QtMovieFile() { this.path = ""; this.repeat = false; @@ -60,7 +60,7 @@ function MovieFile() /** * Returns a list of supported video file types */ -MovieFile.supportedFileTypes = function() { +QtMovieFile.supportedFileTypes = function() { // ... } |

