...
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.arthenica.ffmpegkit.reactnative">
|
||||
</manifest>
|
||||
+1261
File diff suppressed because it is too large
Load Diff
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Taner Sener
|
||||
*
|
||||
* This file is part of FFmpegKit.
|
||||
*
|
||||
* FFmpegKit is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FFmpegKit is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.arthenica.ffmpegkit.reactnative;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class FFmpegKitReactNativePackage implements ReactPackage {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
||||
return Collections.singletonList(new FFmpegKitReactNativeModule(reactContext));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Taner Sener
|
||||
*
|
||||
* This file is part of FFmpegKit.
|
||||
*
|
||||
* FFmpegKit is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FFmpegKit is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.arthenica.ffmpegkit.reactnative;
|
||||
|
||||
import com.arthenica.ffmpegkit.FFmpegKitConfig;
|
||||
import com.arthenica.ffmpegkit.FFmpegSession;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
|
||||
public class FFmpegSessionExecuteTask implements Runnable {
|
||||
private final FFmpegSession ffmpegSession;
|
||||
private final Promise promise;
|
||||
|
||||
public FFmpegSessionExecuteTask(final FFmpegSession ffmpegSession, final Promise promise) {
|
||||
this.ffmpegSession = ffmpegSession;
|
||||
this.promise = promise;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FFmpegKitConfig.ffmpegExecute(ffmpegSession);
|
||||
promise.resolve(null);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Taner Sener
|
||||
*
|
||||
* This file is part of FFmpegKit.
|
||||
*
|
||||
* FFmpegKit is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FFmpegKit is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.arthenica.ffmpegkit.reactnative;
|
||||
|
||||
import com.arthenica.ffmpegkit.FFmpegKitConfig;
|
||||
import com.arthenica.ffmpegkit.FFprobeSession;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
|
||||
public class FFprobeSessionExecuteTask implements Runnable {
|
||||
private final FFprobeSession ffprobeSession;
|
||||
private final Promise promise;
|
||||
|
||||
public FFprobeSessionExecuteTask(final FFprobeSession ffprobeSession, final Promise promise) {
|
||||
this.ffprobeSession = ffprobeSession;
|
||||
this.promise = promise;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FFmpegKitConfig.ffprobeExecute(ffprobeSession);
|
||||
promise.resolve(null);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Taner Sener
|
||||
*
|
||||
* This file is part of FFmpegKit.
|
||||
*
|
||||
* FFmpegKit is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FFmpegKit is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.arthenica.ffmpegkit.reactnative;
|
||||
|
||||
import com.arthenica.ffmpegkit.FFmpegKitConfig;
|
||||
import com.arthenica.ffmpegkit.MediaInformationSession;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
|
||||
public class MediaInformationSessionExecuteTask implements Runnable {
|
||||
private final MediaInformationSession mediaInformationSession;
|
||||
private final int timeout;
|
||||
private final Promise promise;
|
||||
|
||||
public MediaInformationSessionExecuteTask(final MediaInformationSession mediaInformationSession, final int timeout, final Promise promise) {
|
||||
this.mediaInformationSession = mediaInformationSession;
|
||||
this.timeout = timeout;
|
||||
this.promise = promise;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FFmpegKitConfig.getMediaInformationExecute(mediaInformationSession, timeout);
|
||||
promise.resolve(null);
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Taner Sener
|
||||
*
|
||||
* This file is part of FFmpegKit.
|
||||
*
|
||||
* FFmpegKit is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FFmpegKit is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.arthenica.ffmpegkit.reactnative;
|
||||
|
||||
import static com.arthenica.ffmpegkit.reactnative.FFmpegKitReactNativeModule.LIBRARY_NAME;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.facebook.react.bridge.Promise;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class WriteToPipeTask implements Runnable {
|
||||
private final String inputPath;
|
||||
private final String namedPipePath;
|
||||
private final Promise promise;
|
||||
|
||||
public WriteToPipeTask(final String inputPath, final String namedPipePath, final Promise promise) {
|
||||
this.inputPath = inputPath;
|
||||
this.namedPipePath = namedPipePath;
|
||||
this.promise = promise;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int rc;
|
||||
|
||||
try {
|
||||
final String asyncCommand = "cat " + inputPath + " > " + namedPipePath;
|
||||
Log.d(LIBRARY_NAME, String.format("Starting copy %s to pipe %s operation.", inputPath, namedPipePath));
|
||||
|
||||
final long startTime = System.currentTimeMillis();
|
||||
|
||||
final Process process = Runtime.getRuntime().exec(new String[]{"sh", "-c", asyncCommand});
|
||||
rc = process.waitFor();
|
||||
|
||||
final long endTime = System.currentTimeMillis();
|
||||
|
||||
Log.d(LIBRARY_NAME, String.format("Copying %s to pipe %s operation completed with rc %d in %d seconds.", inputPath, namedPipePath, rc, (endTime - startTime) / 1000));
|
||||
|
||||
promise.resolve(rc);
|
||||
|
||||
} catch (final IOException | InterruptedException e) {
|
||||
Log.e(LIBRARY_NAME, String.format("Copy %s to pipe %s failed with error.", inputPath, namedPipePath), e);
|
||||
promise.reject("Copy failed", String.format("Copy %s to pipe %s failed with error.", inputPath, namedPipePath), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user