Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Unified Diff: webrtc/api/android/java/src/org/webrtc/FileVideoCapturerTimer.java

Issue 2273573003: Support for video file instead of camera and output video out to file (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Improved error handling for video in and video out to file Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/android/java/src/org/webrtc/FileVideoCapturerTimer.java
diff --git a/webrtc/api/android/java/src/org/webrtc/FileVideoCapturerTimer.java b/webrtc/api/android/java/src/org/webrtc/FileVideoCapturerTimer.java
new file mode 100644
index 0000000000000000000000000000000000000000..ed24471cd9cd8f9c14ccf286daa6ca1f0022409b
--- /dev/null
+++ b/webrtc/api/android/java/src/org/webrtc/FileVideoCapturerTimer.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2016 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+package org.webrtc;
+
+import android.content.Context;
+
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import java.io.File;
+import java.io.RandomAccessFile;
+import java.io.IOException;
+import android.os.Handler;
+
+public class FileVideoCapturerTimer implements CameraVideoCapturer {
+ private final static String TAG = "FileVideoCapturerTimer";
+
+ private FileVideoCapturer fileVideoCapturer;
+ private CapturerObserver capturerObserver;
+ private volatile boolean isCapturing = false;
+ private Timer timer = new Timer();
+ private TimerTask tickTask = new TimerTask() {
+ @Override
+ public void run() {
+ fileVideoCapturer.tick(capturerObserver);
+ }
+ };
+
+ public FileVideoCapturerTimer(FileVideoCapturer fileVideoCapturer) {
+ this.fileVideoCapturer = fileVideoCapturer;
+ }
+
+ @Override
+ public void initialize(SurfaceTextureHelper surfaceTextureHelper, Context applicationContext,
+ CapturerObserver capturerObserver) {
+ this.capturerObserver = capturerObserver;
+ }
+
+ @Override
+ public void startCapture(
+ int width, int height, int framerate) {
+ timer.schedule(tickTask, 0, 33);
+ }
+
+ @Override
+ public void stopCapture() throws InterruptedException {
+ timer.cancel();
+ }
+
+ @Override
+ public void onOutputFormatRequest(int width, int height, int framerate) {
+ // Empty on purpose
+ }
+
+ @Override
+ public void changeCaptureFormat(int width, int height, int framerate) {
+ // Empty on purpose
+ }
+
+ @Override
+ public void dispose() {
+ fileVideoCapturer.dispose();
+ }
+
+ @Override
+ public void switchCamera(CameraSwitchHandler switchEventsHandler) {
+ // Empty on purpose
+ }
+
+ @Override
+ public boolean isScreencast() {
+ return false;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698