Revert "[Media] Adding support for virtual paths"
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 14 Dec 2015 07:18:45 +0000 (16:18 +0900)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 14 Dec 2015 07:18:45 +0000 (16:18 +0900)
This reverts commit 592584b262f24c1a8506d4eedbfc7e3383bc6210.

Change-Id: I4420718dadd1b4e84da1ae104bc5f55b28943adf

sample/plugins/media/media.js
src/media/cordova_media.gyp
src/media/cordova_media_api.js
src/media/cordova_media_extension.cc
src/media/cordova_media_extension.h
src/media/cordova_media_instance.cc [deleted file]
src/media/cordova_media_instance.h [deleted file]

index 28d344c2ad298815bc00732037462a0edda33053..405e2eb3a54c717582dfa2abb56b4b388f6566ea 100644 (file)
@@ -35,7 +35,7 @@ var deviceReady = function () {
       console.log(files[i].fullPath);
       if(!(files[i].name in playfiles) ){
         playfiles[files[i].name] =  files[i];
-        table.row.add([i + '.', 'documents/' + files[i].name]).draw(false);
+        table.row.add([i + '.', '/opt/usr/media/Documents/' + files[i].name]).draw(false);
       }
     }
   });
@@ -200,7 +200,7 @@ function stopRecAudio() {
       console.log(files[i].fullPath);
       if(!(files[i].name in playfiles) ){
         playfiles[files[i].name] =  files[i];
-        table.row.add([i + '.', 'documents' + files[i].name]).draw(false);
+        table.row.add([i + '.', '/opt/usr/media/Documents/' + files[i].name]).draw(false);
       }
     }
   });
index e94b863bd6c14c2912f4df81b79134526ba10ee5..4a43c14e7d38e8cf7461cbb346dc6b24f78c8411 100644 (file)
@@ -10,8 +10,6 @@
         'cordova_media_api.js',
         'cordova_media_extension.cc',
         'cordova_media_extension.h',
-        'cordova_media_instance.h',
-        'cordova_media_instance.cc',
       ],
       'include_dirs': [
         '../',
@@ -19,7 +17,6 @@
       ],
       'variables': {
         'packages': [
-          'storage',
           'webapi-plugins',
         ],
       },
index 4398e60a795ea2a56592360aca2fb95cc502ad86..f9f393192f8d9928219a613b2363fedcf58a7dc5 100755 (executable)
 // TODO: remove when added to public cordova repository -> begin
 var plugin_name = 'cordova-plugin-media.tizen.Media';
 
-var utils_ = xwalk.utils;
-var native_ = new utils_.NativeManager(extension);
-var privilege_ = xwalk.utils.privilege;
-
-function GetRealPath(virtualPath) {
-
-    console.log("JS GetRealPath " + virtualPath);
-    xwalk.utils.checkPrivilegeAccess(privilege_.FILESYSTEM_READ);
-
-    var data = {
-        path : virtualPath
-    };
-
-    var result = native_.callSync('CordovaMediaInstance_GetRealPath', data);
-    var fullResult = native_.getResultObject(result);
-    console.log("Result of call " +  fullResult.path);
-    return fullResult.path;
-}
-
 cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
 
@@ -231,10 +212,9 @@ cordova.define(plugin_name, function(require, exports, module) {
   create: function(successCallback, errorCallback, args) {
     var id = args[0], src = args[1];
 
-    var realPath = GetRealPath(src);
-    console.log('media::create() - id =' + id + ', src =' + realPath);
+    console.log('media::create() - id =' + id + ', src =' + src);
 
-    recorder = new Recorder(realPath);
+    recorder = new Recorder(src);
     audioObjects[id] = new Audio();
     audioObjects[id].isReady = false;
 
@@ -324,8 +304,7 @@ cordova.define(plugin_name, function(require, exports, module) {
   startPlayingAudio: function(successCallback, errorCallback, args) {
     var id = args[0], src = args[1];
 
-    var realPath = GetRealPath(src);
-    console.log('media::startPlayingAudio() - id =' + id + ', src =' + realPath);
+    console.log('media::startPlayingAudio() - id =' + id + ', src =' + src);
 
     audioObjects[id].isReady = true;
 
@@ -335,7 +314,7 @@ cordova.define(plugin_name, function(require, exports, module) {
       //it should be saved and restored.
       var rate = audioObjects[id].playbackRate;
 
-      audioObjects[id].src = realPath;
+      audioObjects[id].src = src;
       audioObjects[id].playbackRate = rate;
       return;
     }
@@ -387,7 +366,7 @@ cordova.define(plugin_name, function(require, exports, module) {
       var id = args[0];
       console.log('media::getCurrentPositionAudio()');
       if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = GetRealPath(args[1]);
+          audioObjects[id].src = args[1];
       }
       successCallback(audioObjects[id].currentTime);
   },
@@ -395,7 +374,7 @@ cordova.define(plugin_name, function(require, exports, module) {
       var id = args[0];
       console.log('media::startRecordingAudio()');
       if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = GetRealPath(args[1]);
+          audioObjects[id].src = args[1];
       }
       recorder.rec();
   },
@@ -403,7 +382,7 @@ cordova.define(plugin_name, function(require, exports, module) {
       var id = args[0];
       console.log('media::stopRecordingAudio()');
       if (audioObjects[id].src === 'undefined') {
-          audioObjects[id].src = GetRealPath(args[1]);
+          audioObjects[id].src = args[1];
       }
       recorder.stop();
   },
index 98462f1e2aa0e2001f0592c4f338e9314e84959c..6565afc016b22707b44d3c6791267bb47ec16060 100755 (executable)
@@ -15,7 +15,6 @@
  */
 
 #include "media/cordova_media_extension.h"
-#include "media/cordova_media_instance.h"
 
 // This will be generated from cordova_media_api.js
 extern const char kSource_cordova_media_api[];
@@ -35,11 +34,6 @@ CordovaMediaExtension::CordovaMediaExtension() {
 
 CordovaMediaExtension::~CordovaMediaExtension() {}
 
-common::Instance* CordovaMediaExtension::CreateInstance() {
-  LoggerD("Entered");
-  return new extension::cordova::media::CordovaMediaInstance();
-}
-
 }  // media
 }  // cordova
 }  // extension
index 95750860ed0d9269eece41224ac8285a498445d6..3db047cef0e44321bcc8db9b1876184621c4eca8 100755 (executable)
@@ -27,10 +27,6 @@ class CordovaMediaExtension : public common::Extension {
  public:
   CordovaMediaExtension();
   virtual ~CordovaMediaExtension();
-
- private:
-  // common::Extension implementation.
-  virtual common::Instance* CreateInstance();
 };
 
 }  //media
diff --git a/src/media/cordova_media_instance.cc b/src/media/cordova_media_instance.cc
deleted file mode 100644 (file)
index 6fe8c71..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#include "media/cordova_media_instance.h"
-#include <common/logger.h>
-
-namespace extension {
-namespace cordova {
-namespace media {
-
-CordovaMediaInstance::CordovaMediaInstance(): fs_provider_(common::FilesystemProviderStorage::Create()) {
-    LoggerD("Entered");
-
-    RegisterSyncHandler("CordovaMediaInstance_GetRealPath",
-        std::bind(&CordovaMediaInstance::GetRealPath, this, std::placeholders::_1, std::placeholders::_2));
-
-}
-
-CordovaMediaInstance::~CordovaMediaInstance() {
-}
-
-void CordovaMediaInstance::GetRealPath(const picojson::value& args, picojson::object& out) {
-  LoggerD("Entered");
-
-  const std::string& path_str =  args.get("path").get<std::string>();
-
-  picojson::value retval = picojson::value(picojson::object());
-  picojson::object& obj = retval.get<picojson::object>();
-
-  LoggerD("Path is %s", path_str.c_str());
-  std::string realPath = fs_provider_.GetRealPath(path_str);
-  obj["path"] = picojson::value(realPath);
-  LoggerD("Real Path is %s", realPath.c_str());
-  ReportSuccess(retval,out);
-}
-
-}
-}
-} /* namespace media */
diff --git a/src/media/cordova_media_instance.h b/src/media/cordova_media_instance.h
deleted file mode 100644 (file)
index ba6e23f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#ifndef MEDIA_CORDOVA_MEDIA_EXTENSION_H_
-#define MEDIA_CORDOVA_MEDIA_EXTENSION_H_
-
-#include <common/extension.h>
-#include <common/picojson.h>
-#include <common/filesystem/filesystem_provider_storage.h>
-
-namespace extension {
-namespace cordova {
-namespace media {
-
-class CordovaMediaInstance : public common::ParsedInstance {
- public:
-  CordovaMediaInstance();
-  virtual ~CordovaMediaInstance();
-
- private:
-  common::FilesystemProviderStorage& fs_provider_;
-  void GetRealPath(const picojson::value& args, picojson::object& out);
-};
-
-}
-}
-} /* namespace media */
-
-#endif // MEDIA_CORDOVA_MEDIA_EXTENSION_H_