Skip to content

Commit 5f679c2

Browse files
committed
Revert "ofVideoPlayer using fs::path (openframeworks#8138)"
This reverts commit 2bd8b45.
1 parent 2bd8b45 commit 5f679c2

16 files changed

+70
-70
lines changed

addons/ofxEmscripten/src/ofxEmscriptenVideoPlayer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ ofxEmscriptenVideoPlayer::~ofxEmscriptenVideoPlayer() {
2828
html5video_player_delete(player_id);
2929
}
3030

31-
bool ofxEmscriptenVideoPlayer::load(const of::filesystem::path & fileName){
32-
std::string name = ofPathToString(fileName);
31+
bool ofxEmscriptenVideoPlayer::load(string name){
3332
if (name.substr(0, 7) == "http://" || name.substr(0, 8) == "https://"){
34-
html5video_player_load_url(player_id, fileName.c_str());
33+
html5video_player_load_url(player_id, name.c_str());
3534
} else{
36-
html5video_player_load(player_id, ofToDataPath(fileName).c_str());
35+
html5video_player_load(player_id, ofToDataPath(name).c_str());
3736
}
3837
return true;
3938
}

addons/ofxEmscripten/src/ofxEmscriptenVideoPlayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ofxEmscriptenVideoPlayer: public ofBaseVideoPlayer {
1616
~ofxEmscriptenVideoPlayer();
1717

1818
//needs implementing
19-
bool load(const of::filesystem::path & fileName);
19+
bool load(const std::string fileName);
2020
void close();
2121
void update();
2222

addons/ofxiOS/src/video/ofxiOSVideoPlayer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ofxiOSVideoPlayer : public ofBaseVideoPlayer {
1515
void enableTextureCache();
1616
void disableTextureCache();
1717

18-
bool load(const of::filesystem::path & fileName);
18+
bool load(std::string name);
1919
void close();
2020
void update();
2121

@@ -62,7 +62,7 @@ class ofxiOSVideoPlayer : public ofBaseVideoPlayer {
6262
void * getAVFoundationVideoPlayer();
6363

6464
[[deprecated("use load()")]]
65-
bool loadMovie(const of::filesystem::path & fileName);
65+
bool loadMovie(std::string name);
6666
[[deprecated("use getPixels()")]]
6767
ofPixels & getPixelsRef();
6868
[[deprecated("use getPixels()")]]

addons/ofxiOS/src/video/ofxiOSVideoPlayer.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
}
4242

4343
//----------------------------------------
44-
bool ofxiOSVideoPlayer::load(const of::filesystem::path & fileName) {
44+
bool ofxiOSVideoPlayer::load(string name) {
4545

4646
if(!videoPlayer) {
4747
videoPlayer = (__bridge_retained void *)[[AVFoundationVideoPlayer alloc] init];
4848
[(__bridge AVFoundationVideoPlayer *)videoPlayer setWillBeUpdatedExternally:YES];
4949
}
5050

51-
NSString * videoPath = [NSString stringWithUTF8String:ofToDataPath(fileName).c_str()];
51+
NSString * videoPath = [NSString stringWithUTF8String:ofToDataPath(name).c_str()];
5252
[(__bridge AVFoundationVideoPlayer*)videoPlayer loadWithPath:videoPath];
5353

5454
bResetPixels = true;
@@ -589,8 +589,8 @@
589589
}
590590

591591
//---------------------------------------- DEPRECATED.
592-
bool ofxiOSVideoPlayer::loadMovie(const of::filesystem::path & fileName) {
593-
return load(fileName);
592+
bool ofxiOSVideoPlayer::loadMovie(string name) {
593+
return load(name);
594594
}
595595

596596
ofPixels & ofxiOSVideoPlayer::getPixelsRef() {

libs/openFrameworks/types/ofBaseTypes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ ofBaseVideoPlayer::~ofBaseVideoPlayer(){
4747

4848
}
4949

50-
void ofBaseVideoPlayer::loadAsync(const of::filesystem::path & fileName){
50+
void ofBaseVideoPlayer::loadAsync(std::string name){
5151
ofLogWarning("ofBaseVideoPlayer") << "loadAsync() not implemented, loading synchronously";
52-
load(fileName);
52+
load(name);
5353
}
5454

5555
//---------------------------------------------------------------------------

libs/openFrameworks/video/ofAVFoundationPlayer.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ class ofAVFoundationPlayer : public ofBaseVideoPlayer {
2727
ofAVFoundationPlayer();
2828
~ofAVFoundationPlayer();
2929

30-
bool load(const of::filesystem::path & fileName) override;
31-
void loadAsync(const of::filesystem::path & fileName) override;
30+
//FIXME: FS
31+
bool load(std::string name);
32+
void loadAsync(std::string name);
3233
void close();
3334
void update();
3435

@@ -87,7 +88,7 @@ class ofAVFoundationPlayer : public ofBaseVideoPlayer {
8788
#endif
8889

8990
[[deprecated("use load()")]]
90-
bool loadMovie(const of::filesystem::path & fileName);
91+
bool loadMovie(std::string name);
9192
[[deprecated("use getPixels()")]]
9293
ofPixels & getPixelsRef();
9394
[[deprecated("use getPixels()")]]
@@ -97,7 +98,7 @@ class ofAVFoundationPlayer : public ofBaseVideoPlayer {
9798

9899
protected:
99100

100-
bool loadPlayer(const of::filesystem::path & fileName, bool bAsync);
101+
bool loadPlayer(std::string name, bool bAsync);
101102
void disposePlayer();
102103
bool isReady() const;
103104

libs/openFrameworks/video/ofAVFoundationPlayer.mm

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,31 @@
5252
}
5353

5454
//--------------------------------------------------------------
55-
void ofAVFoundationPlayer::loadAsync(const of::filesystem::path & fileName){
56-
loadPlayer(fileName, true);
55+
void ofAVFoundationPlayer::loadAsync(std::string name){
56+
loadPlayer(name, true);
5757
}
5858

5959
//--------------------------------------------------------------
60-
bool ofAVFoundationPlayer::load(const of::filesystem::path & fileName) {
61-
return loadPlayer(fileName, false);
60+
bool ofAVFoundationPlayer::load(std::string name) {
61+
return loadPlayer(name, false);
6262
}
6363

6464
//--------------------------------------------------------------
65-
bool ofAVFoundationPlayer::loadPlayer(const of::filesystem::path & fileName, bool bAsync) {
65+
// FIXME: fs::path
66+
bool ofAVFoundationPlayer::loadPlayer(std::string name, bool bAsync) {
6667
if( ofGetUsingArbTex() == false ){
6768
killTextureCache();
6869
bUseTextureCache = false;
6970
}
7071

71-
NSString * videoPath = [NSString stringWithUTF8String:fileName.c_str()];
72-
NSString * videoLocalPath = [NSString stringWithUTF8String:ofToDataPath(fileName).c_str()];
72+
NSString * videoPath = [NSString stringWithUTF8String:name.c_str()];
73+
NSString * videoLocalPath = [NSString stringWithUTF8String:ofToDataPath(name).c_str()];
7374

7475
BOOL bStream = NO;
7576

76-
std::string fileNameStr { ofPathToString(fileName) };
77-
bStream = bStream || (ofIsStringInString(fileNameStr, "http://"));
78-
bStream = bStream || (ofIsStringInString(fileNameStr, "https://"));
79-
bStream = bStream || (ofIsStringInString(fileNameStr, "rtsp://"));
77+
bStream = bStream || (ofIsStringInString(name, "http://"));
78+
bStream = bStream || (ofIsStringInString(name, "https://"));
79+
bStream = bStream || (ofIsStringInString(name, "rtsp://"));
8080

8181
NSURL * url = nil;
8282
if(bStream == YES) {
@@ -762,8 +762,8 @@
762762
#endif
763763

764764
//-------------------------------------------------------------- DEPRECATED.
765-
bool ofAVFoundationPlayer::loadMovie(const of::filesystem::path & fileName) {
766-
return load(fileName);
765+
bool ofAVFoundationPlayer::loadMovie(std::string name) {
766+
return load(name);
767767
}
768768

769769
ofPixels & ofAVFoundationPlayer::getPixelsRef() {

libs/openFrameworks/video/ofDirectShowPlayer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,8 +1146,9 @@ ofDirectShowPlayer & ofDirectShowPlayer::operator=(ofDirectShowPlayer&& other) {
11461146
return *this;
11471147
}
11481148

1149-
bool ofDirectShowPlayer::load(const of::filesystem::path & fileName){
1150-
auto path = ofToDataPath(fileName);
1149+
// FIXME: fs::path
1150+
bool ofDirectShowPlayer::load(std::string stringPath){
1151+
auto path = ofToDataPath(of::filesystem::path(stringPath));
11511152

11521153
close();
11531154
player.reset(new DirectShowVideo());

libs/openFrameworks/video/ofDirectShowPlayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ofDirectShowPlayer : public ofBaseVideoPlayer{
2020
ofDirectShowPlayer(ofDirectShowPlayer &&);
2121
ofDirectShowPlayer & operator=(ofDirectShowPlayer&&);
2222

23-
bool load(const of::filesystem::path & fileName) override;
23+
bool load(std::string path);
2424
void update();
2525

2626
void close();

libs/openFrameworks/video/ofGstVideoPlayer.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,13 @@ bool ofGstVideoPlayer::createPipeline(std::string name){
187187
#endif
188188
}
189189

190-
void ofGstVideoPlayer::loadAsync(const of::filesystem::path & fileName){
190+
void ofGstVideoPlayer::loadAsync(std::string name){
191191
bAsyncLoad = true;
192-
load(fileName);
192+
load(name);
193193
}
194194

195195
// FIXME: fs::path
196-
bool ofGstVideoPlayer::load(const of::filesystem::path & fileName){
197-
std::string name { ofPathToString(fileName) };
196+
bool ofGstVideoPlayer::load(std::string name){
198197
if( name.find( "file://",0 ) != std::string::npos){
199198
bIsStream = bAsyncLoad;
200199
}else if( name.find( "://",0 ) == std::string::npos){
@@ -218,7 +217,7 @@ bool ofGstVideoPlayer::load(const of::filesystem::path & fileName){
218217
internalPixelFormat = OF_PIXELS_NATIVE;
219218
bIsAllocated = false;
220219
videoUtils.reallocateOnNextFrame();
221-
g_object_set(G_OBJECT(videoUtils.getPipeline()), "uri", fileName.c_str(), (void*)NULL);
220+
g_object_set(G_OBJECT(videoUtils.getPipeline()), "uri", name.c_str(), (void*)NULL);
222221
gst_element_set_state (videoUtils.getPipeline(), GST_STATE_PAUSED);
223222
if(!bIsStream){
224223
gst_element_get_state (videoUtils.getPipeline(), NULL, NULL, -1);
@@ -228,7 +227,7 @@ bool ofGstVideoPlayer::load(const of::filesystem::path & fileName){
228227
}
229228
}else{
230229
ofGstUtils::startGstMainLoop();
231-
return createPipeline(fileName) &&
230+
return createPipeline(name) &&
232231
videoUtils.startPipeline() &&
233232
(bIsStream || allocate());
234233
}

0 commit comments

Comments
 (0)