Permalink
Browse files

created blackmagiccontroller, but forgot to pull

  • Loading branch information...
1 parent 3bdca5c commit 45a8a4e765fc385f40592837fd2b9dd799a5d80e @HalfdanJ committed Oct 5, 2012
@@ -25,6 +25,8 @@
DD03973D161C94D500D0D629 /* colorCorrectShader.vert in Resources */ = {isa = PBXBuildFile; fileRef = DD039739161C94A100D0D629 /* colorCorrectShader.vert */; };
DD03973E161C94D700D0D629 /* colorCorrectShader.frag in Resources */ = {isa = PBXBuildFile; fileRef = DD03973B161C94B000D0D629 /* colorCorrectShader.frag */; };
DD03974C161C96EF00D0D629 /* ofxShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD03974A161C96EF00D0D629 /* ofxShader.cpp */; };
+ DD2B4CB0161CE153003FC9EF /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD2B4CAF161CE153003FC9EF /* GLUT.framework */; };
+ DDDCF64A161EB5AC00E8E368 /* BlackMagicController.mm in Sources */ = {isa = PBXBuildFile; fileRef = DDDCF649161EB5AC00E8E368 /* BlackMagicController.mm */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -67,6 +69,9 @@
DD03973B161C94B000D0D629 /* colorCorrectShader.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = colorCorrectShader.frag; sourceTree = "<group>"; };
DD03974A161C96EF00D0D629 /* ofxShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxShader.cpp; sourceTree = "<group>"; };
DD03974B161C96EF00D0D629 /* ofxShader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxShader.h; sourceTree = "<group>"; };
+ DD2B4CAF161CE153003FC9EF /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = ../../../../../System/Library/Frameworks/GLUT.framework; sourceTree = "<group>"; };
+ DDDCF648161EB5AC00E8E368 /* BlackMagicController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlackMagicController.h; sourceTree = "<group>"; };
+ DDDCF649161EB5AC00E8E368 /* BlackMagicController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BlackMagicController.mm; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -77,6 +82,7 @@
845FB20D1520A77400FAB093 /* OpenGL.framework in Frameworks */,
84AFDC0815209A0A00DB5DEF /* Cocoa.framework in Frameworks */,
84A64CB3152492B3004B2050 /* ofxCocoaPlugins.framework in Frameworks */,
+ DD2B4CB0161CE153003FC9EF /* GLUT.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -117,6 +123,7 @@
84AFDC0615209A0A00DB5DEF /* Frameworks */ = {
isa = PBXGroup;
children = (
+ DD2B4CAF161CE153003FC9EF /* GLUT.framework */,
845FB20C1520A77400FAB093 /* OpenGL.framework */,
84AFDC0715209A0A00DB5DEF /* Cocoa.framework */,
84AFDC0915209A0A00DB5DEF /* Other Frameworks */,
@@ -187,6 +194,8 @@
DD039719161C4F9000D0D629 /* include */,
8429C0DA156A7943000ADD56 /* BlackMagic.h */,
8429C0DB156A7943000ADD56 /* BlackMagic.mm */,
+ DDDCF648161EB5AC00E8E368 /* BlackMagicController.h */,
+ DDDCF649161EB5AC00E8E368 /* BlackMagicController.mm */,
DD039735161C591400D0D629 /* DecklinkCallback.h */,
DD039736161C591400D0D629 /* DecklinkCallback.cpp */,
8429C0DC156A7943000ADD56 /* BlackMagic.xib */,
@@ -289,6 +298,7 @@
DD03973A161C94A100D0D629 /* colorCorrectShader.vert in Sources */,
DD03973C161C94B000D0D629 /* colorCorrectShader.frag in Sources */,
DD03974C161C96EF00D0D629 /* ofxShader.cpp in Sources */,
+ DDDCF64A161EB5AC00E8E368 /* BlackMagicController.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1,17 +1,11 @@
#pragma once
#import <ofxCocoaPlugins/Plugin.h>
-#import "DeckLinkAPI.h"
-#import "DecklinkCallback.h"
+#import "BlackMagicController.h"
class DeckLinkController;
@interface BlackMagic : ofPlugin {
- DeckLinkController* deckLinkController;
+ BlackMagicController * blackMagicController;
- std::vector<IDeckLink*> deviceList;
-
-
- IDeckLinkInput * deckLinkInputs[3];
- DecklinkCallback * callbacks[3];
ofImage currentFrames[3];
@@ -1,6 +1,7 @@
#import "BlackMagic.h"
#import <ofxCocoaPlugins/Keystoner.h>
#import "ofxShader.h"
+#import <OpenGL/CGLRenderers.h>
@implementation BlackMagic
@@ -9,101 +10,8 @@ -(void)initPlugin{
[self addPropF:@"whiteFront"];
[self addPropF:@"grovKalibrering"];
- [self initDeckLink];
- NSArray * deviceNames = [self getDeviceNameList];
- for (int deviceIndex = 0; deviceIndex < [deviceNames count]; deviceIndex++)
- {
- // Add this DeckLink device to the device list
- // [deviceListPopup addItemWithTitle:[deviceNames objectAtIndex:deviceIndex]];
- NSLog(@"Device: %@",[deviceNames objectAtIndex:deviceIndex]);
- }
-
-}
-
--(void) initDeckLink {
- IDeckLinkIterator* deckLinkIterator = NULL;
- IDeckLink* deckLink = NULL;
- IDeckLinkDisplayModeIterator* displayModeIterator = NULL;
-
- IDeckLinkDisplayMode* displayMode = NULL;
- bool result = false;
- std::vector<IDeckLinkDisplayMode*> modeList;
-
- callbacks[0] = new DecklinkCallback();
- callbacks[1] = new DecklinkCallback();
- callbacks[2] = new DecklinkCallback();
-
- // Create an iterator
- deckLinkIterator = CreateDeckLinkIteratorInstance();
-
-
- // List all DeckLink devices
- while (deckLinkIterator->Next(&deckLink) == S_OK)
- {
- // Add device to the device list
- deviceList.push_back(deckLink);
-
-
- }
-
- for(int index=0;index<deviceList.size();index++){
- // Get the IDeckLinkInput for the selected device
- if ((deviceList[index]->QueryInterface(IID_IDeckLinkInput, (void**)&deckLinkInputs[index]) != S_OK))
- {
- NSLog(@"This application was unable to obtain IDeckLinkInput for the selected device.");
- }
-
-
-
- //
- // Retrieve and cache mode list
- if (deckLinkInputs[index]->GetDisplayModeIterator(&displayModeIterator) == S_OK)
- {
- CFStringRef modeName;
- int i=0;
-
- while (displayModeIterator->Next(&displayMode) == S_OK){
- modeList.push_back(displayMode);
-
- if (displayMode->GetName(&modeName) == S_OK)
- {
- NSLog(@"Mode: %i %@",i++,(NSString *)modeName);
- }
- }
-
- displayModeIterator->Release();
- }
-
-
-
-
- // Set capture callback
- BMDVideoInputFlags videoInputFlags = bmdVideoInputFlagDefault;
-
- deckLinkInputs[index]->SetCallback(callbacks[index]);
-
- // Set the video input mode
- if (deckLinkInputs[index]->EnableVideoInput(modeList[2]->GetDisplayMode(), bmdFormat8BitYUV, videoInputFlags) != S_OK)
- {
- /* [uiDelegate showErrorMessage:@"This application was unable to select the chosen video mode. Perhaps, the selected device is currently in-use." title:@"Error starting the capture"];
- return false;*/
- NSLog(@"This application was unable to select the chosen video mode. Perhaps, the selected device is currently in-use.");
- }
-
- // Start the capture
- if (deckLinkInputs[index]->StartStreams() != S_OK)
- {
- NSLog(@"This application was unable to start the capture. Perhaps, the selected device is currently in-use.");
- /* [uiDelegate showErrorMessage:@"This application was unable to start the capture. Perhaps, the selected device is currently in-use." title:@"Error starting the capture"];
- return false;*/
- }
-
-
-
- }
-
- result = true;
-
+ blackMagicController = [[BlackMagicController alloc] init];
+ [blackMagicController initDecklink];
}
@@ -113,50 +21,31 @@ -(void) initDeckLink {
-(void)setup{
+/* [[NSBundle mainBundle] pathForResource:@"colorCorrectShader" ofType:@"vert"];
+ ofxShader * shader = new ofxShader();
+ shader->setup("test"); */
}
//
//----------------
//
--(NSArray*)getDeviceNameList{
- NSMutableArray* nameList = [NSMutableArray array];
- int deviceIndex = 0;
-
- while (deviceIndex < deviceList.size())
- {
- CFStringRef cfStrName;
-
- // Get the name of this device
- if (deviceList[deviceIndex]->GetDisplayName(&cfStrName) == S_OK)
- {
- [nameList addObject:(NSString *)cfStrName];
- CFRelease(cfStrName);
- }
- else
- {
- [nameList addObject:@"DeckLink"];
- }
-
- deviceIndex++;
- }
-
- return nameList;
-}
+
-(void)update:(NSDictionary *)drawingInformation{
for(int i=0;i<3;i++){
- if(callbacks[i]->newFrame){
- callbacks[i]->newFrame = false;
- int w = callbacks[i]->w;
- int h = callbacks[i]->h;
+ DecklinkCallback * callback = [blackMagicController callbacks:i];
+ if(callback->newFrame){
+ callback->newFrame = false;
+ int w = callback->w;
+ int h = callback->h;
if(currentFrames[i].width != w){
currentFrames[i].allocate(w, h, OF_IMAGE_COLOR);
}
- unsigned char * bytes = callbacks[i]->bytes;
+ unsigned char * bytes = callback->bytes;
currentFrames[i].setFromPixels(bytes, w, h, OF_IMAGE_COLOR);
}
}
@@ -0,0 +1,27 @@
+//
+// BlackMagicController.h
+// ViljensTriumf
+//
+// Created by Jonas Jongejan on 05/10/12.
+//
+//
+
+#import <Foundation/Foundation.h>
+#import "DeckLinkAPI.h"
+#import "DecklinkCallback.h"
+
+@interface BlackMagicController : NSObject{
+
+// DeckLinkController* deckLinkController;
+ std::vector<IDeckLink*> deviceList;
+
+ IDeckLinkInput * deckLinkInputs[3];
+ DecklinkCallback * callbacks[3];
+
+}
+
+-(void) initDecklink;
+-(DecklinkCallback*)callbacks:(int)num;
+
+
+@end
Oops, something went wrong.

0 comments on commit 45a8a4e

Please sign in to comment.