Skip to content

Commit

Permalink
getting 2D Video working through VHX
Browse files Browse the repository at this point in the history
  • Loading branch information
obviousjim committed May 22, 2015
1 parent dbbc3d9 commit c2fc643
Show file tree
Hide file tree
Showing 15 changed files with 3,329 additions and 1,073 deletions.
2 changes: 1 addition & 1 deletion CLOUDS/CLOUDS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8433,8 +8433,8 @@
E7D8228118BEBD6E00C1EB93 /* SecondaryDisplay */,
E7D8228B18BEBD6E00C1EB93 /* Sound */,
E7D8229E18BEBD6E00C1EB93 /* StoryEngine */,
E7D822B718BEBD6E00C1EB93 /* VisualSystems */,
E7D8251018BEBD6F00C1EB93 /* VisualSystemsLibrary */,
E7D822B718BEBD6E00C1EB93 /* VisualSystems */,
E7D8251B18BEBD7000C1EB93 /* VisualSystemsPrivate */,
);
path = src;
Expand Down
40 changes: 40 additions & 0 deletions CloudsLibrary/src/CloudsGlobal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,46 @@ string GetCloudsMediaPath(){

}

void TrimVHXId(string& str){
ofStringReplace(str, "VO-", "");
ofStringReplace(str, ".mov", "");
ofStringReplace(str, ".mp3", "");
ofStringReplace(str, ".mp4", "");
ofStringReplace(str, "%2B", "");
ofStringReplace(str, "%3C", "");
ofStringReplace(str, "%3F", "");
ofStringReplace(str, " ", "");
ofStringReplace(str, "-", "");
ofStringReplace(str, "_", "");
ofStringReplace(str, "+", "");
ofStringReplace(str, ",", "");
ofStringReplace(str, "?", "");
ofStringReplace(str, "'", "");
ofStringReplace(str, "\"", "");
}

//--------------------------------------------------------------------
void ParseVHXIds(const string& path, map<string, string>& idMap){
ofBuffer buffer = ofBufferFromFile(path);

while(!buffer.isLastLine()){

string line = buffer.getNextLine();
if(line == ""){
continue;
}

vector<string> split = ofSplitString(line,",", true,true);
string idstring = split[0];
split.erase(split.begin());

string key = ofJoinString(split, "");
TrimVHXId(key);

idMap[key] = idstring;
}
}


//--------------------------------------------------------------------
string GetCloudsVisualSystemDataPath(string systemName, bool ignoredFolder){
Expand Down
12 changes: 8 additions & 4 deletions CloudsLibrary/src/CloudsGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ static ofColor CloudsColorTabFillActive = ofColor::fromHex(0x034C89, 255 *
static ofColor CloudsColorTabFillSelectd = ofColor::fromHex(0x034C89, 255 * .7);
static ofColor CloudsColorTabStrokeSelectd = ofColor::fromHex(0xFFFFFF, 255 * .7);


enum CloudsVisualLevel { FAST, PRETTY };
//--------------------------------------------------------------------
//string GetEnvVar( string key );
enum CloudsVisualLevel { FAST, PRETTY };

//--------------------------------------------------------------------
string GetCloudsDataPath(bool ignored = false);
//--------------------------------------------------------------------
Expand All @@ -44,9 +43,14 @@ void SetLanguage(string language);
string relinkFilePath(string filePath);
//--------------------------------------------------------------------
CloudsVisualLevel getVisualLevel();

//--------------------------------------------------------------------
bool CheckForUpdates();
//--------------------------------------------------------------------
string FindCloudsThumbDrive();
//--------------------------------------------------------------------
void ParseVHXIds(const string& path, map<string, string>& idMap);
//--------------------------------------------------------------------
void TrimVHXId(string& str);

//--------------------------------------
static inline std::string &ltrim(std::string &s) {
Expand Down
5 changes: 4 additions & 1 deletion CloudsLibrary/src/Core/CloudsPlaybackController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ void CloudsPlaybackController::threadedFunction(){
sound.setup(storyEngine);
parser.parseSounds(sound.renders);
sound.enterTunnel();


//videos for visual systems
CloudsVisualSystem::mapVHXMediaIds();

if(!isThreadRunning()) return;
introSequence->percentLoaded = 0.6;

Expand Down
68 changes: 26 additions & 42 deletions CloudsLibrary/src/StoryEngine/CloudsFCPParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void CloudsFCPParser::parseVOClips(){

#ifdef VHX_MEDIA
map<string, string> idMap;
parseVHXIds(GetCloudsDataPath() + "vhx/vo.csv", idMap);
ParseVHXIds(GetCloudsDataPath() + "vhx/vo.csv", idMap);
#endif

ofBuffer voiceOverData = ofBufferFromFile(GetCloudsDataPath() + "VO/_voiceover_data.txt");
Expand All @@ -138,7 +138,7 @@ void CloudsFCPParser::parseVOClips(){
//clip->voiceOverAudioPath = GetCloudsDataPath(true) + "VO/" + fileName;
#ifdef VHX_MEDIA
string key = fileName;
trimVHXId(key);
TrimVHXId(key);
if(idMap.find(key) != idMap.end()){
clip->vhxId = idMap[ key ];
clip->hasMediaAsset = true;
Expand Down Expand Up @@ -499,34 +499,34 @@ void CloudsFCPParser::parseTopicAssociations(const string& filename){
}

#ifdef VHX_MEDIA
void CloudsFCPParser::parseVHXIds(const string& path, map<string, string>& idMap){
ofBuffer buffer = ofBufferFromFile(path);

while(!buffer.isLastLine()){

string line = buffer.getNextLine();
if(line == ""){
continue;
}

vector<string> split = ofSplitString(line,",", true,true);
string idstring = split[0];
split.erase(split.begin());

string key = ofJoinString(split, "");
trimVHXId(key);

idMap[key] = idstring;
}
}
//void CloudsFCPParser::parseVHXIds(const string& path, map<string, string>& idMap){
// ofBuffer buffer = ofBufferFromFile(path);
//
// while(!buffer.isLastLine()){
//
// string line = buffer.getNextLine();
// if(line == ""){
// continue;
// }
//
// vector<string> split = ofSplitString(line,",", true,true);
// string idstring = split[0];
// split.erase(split.begin());
//
// string key = ofJoinString(split, "");
// trimVHXId(key);
//
// idMap[key] = idstring;
// }
//}

void CloudsFCPParser::mapVHXMedia(){
map<string, string> idMap;
parseVHXIds(GetCloudsDataPath() + "vhx/media.csv", idMap);
ParseVHXIds(GetCloudsDataPath() + "vhx/media.csv", idMap);

for(int i = 0; i < allClips.size(); i++){
string key = allClips[i]->person + allClips[i]->name;
trimVHXId(key);
TrimVHXId(key);

if(idMap.find(key) != idMap.end()){
allClips[i]->vhxId = idMap[ key ];
Expand All @@ -538,23 +538,7 @@ void CloudsFCPParser::mapVHXMedia(){

}

void CloudsFCPParser::trimVHXId(string& str){
ofStringReplace(str, "VO-", "");
ofStringReplace(str, ".mov", "");
ofStringReplace(str, ".mp3", "");
ofStringReplace(str, ".mp4", "");
ofStringReplace(str, "%2B", "");
ofStringReplace(str, "%3C", "");
ofStringReplace(str, "%3F", "");
ofStringReplace(str, " ", "");
ofStringReplace(str, "-", "");
ofStringReplace(str, "_", "");
ofStringReplace(str, "+", "");
ofStringReplace(str, ",", "");
ofStringReplace(str, "?", "");
ofStringReplace(str, "'", "");
ofStringReplace(str, "\"", "");
}

#endif

void CloudsFCPParser::parseProjectExamples(const string& filename){
Expand Down Expand Up @@ -1973,7 +1957,7 @@ void CloudsFCPParser::parseSounds(map<string, CloudsMedia *>& sounds){

#ifdef VHX_MEDIA
map<string, string> idMap;
parseVHXIds(GetCloudsDataPath() + "vhx/sound.csv", idMap);
ParseVHXIds(GetCloudsDataPath() + "vhx/sound.csv", idMap);

for (map<string, string>::iterator it = idMap.begin(); it != idMap.end(); ++it) {
CloudsMedia *sound = new CloudsMedia();
Expand Down
4 changes: 2 additions & 2 deletions CloudsLibrary/src/StoryEngine/CloudsFCPParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class CloudsFCPParser {
void parseTopicAssociations(const string& filename);

#ifdef VHX_MEDIA
void trimVHXId(string& str);
void parseVHXIds(const string& filename, map<string, string>& idMap);
//void trimVHXId(string& str);
//void parseVHXIds(const string& filename, map<string, string>& idMap);
void mapVHXMedia();
#endif

Expand Down
3 changes: 3 additions & 0 deletions CloudsLibrary/src/StoryEngine/CloudsMedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ void CloudsMedia::vhxRequestComplete(CloudsVHXEventArgs& args){
vhxSourceVideoUrl = args.result;
vhxTimestamp = ofGetElapsedTimeMillis();
ofLogVerbose("CloudsClip::vhxRequestComplete") << "Got source video URL " << vhxSourceVideoUrl;

//pass along
ofNotifyEvent(completeEvent, args, this);
}
else{
ofLogError("CloudsClip::vhxRequestComplete") << "Error returned from vhx request";
Expand Down
3 changes: 2 additions & 1 deletion CloudsLibrary/src/StoryEngine/CloudsMedia.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ class CloudsMedia
CloudsMedia();

bool hasMediaAsset;

string sourceVideoFilePath;

#ifdef VHX_MEDIA
//passes the complete event on
ofEvent<CloudsVHXEventArgs> completeEvent;
void fetchVhxSourceUrl();
void vhxRequestComplete(CloudsVHXEventArgs& args);
CloudsVHXRequest *vhxRequest;
Expand Down
Loading

0 comments on commit c2fc643

Please sign in to comment.