예제 #1
0
  /** One time setup of the FFmpeg library. */
  public Observable<Void> setupFFmpeg() {
    if (!firstSetup.get()) return Observable.just(null);
    firstSetup.set(false);
    return Observable.create(
        new Observable.OnSubscribe<Void>() {
          @Override
          public void call(final Subscriber<? super Void> subscriber) {
            LoadBinaryResponseHandler responseHandler =
                new LoadBinaryResponseHandler() {
                  @Override
                  public void onFailure() {
                    if (subscriber.isUnsubscribed()) return;
                    subscriber.onError(new IllegalStateException("failed to load FFmpeg binaries"));
                  }

                  @Override
                  public void onSuccess() {
                    if (subscriber.isUnsubscribed()) return;
                    subscriber.onNext(null);
                    subscriber.onCompleted();
                  }
                };

            try {
              fFmpeg.loadBinary(responseHandler);
            } catch (FFmpegNotSupportedException e) {
              subscriber.onError(e);
            }
          }
        });
  }
예제 #2
0
 @Inject
 VideoManager(
     Context context, PhotoManager photoManager, PhotoProcessor photoProcessor, IOUtils ioUtils) {
   this.context = context;
   this.photoManager = photoManager;
   this.photoProcessor = photoProcessor;
   this.ioUtils = ioUtils;
   this.firstSetup =
       Pref.newBooleanPref(
           context, VideoManager.class.getName() + ".FIRST_SETUP", "first_setup", true);
   this.fFmpeg = FFmpeg.getInstance(context);
 }