Skip to content

Commit 3ee2010

Browse files
committed
Merge pull request ypresto#13 from ypresto/generify-future
Generify Future type
2 parents 38a9fe5 + 7f03546 commit 3ee2010

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

example/src/main/java/net/ypresto/androidtranscoder/example/TranscoderActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class TranscoderActivity extends Activity {
2828
private static final String TAG = "TranscoderActivity";
2929
private static final int REQUEST_CODE_PICK = 1;
3030
private static final int PROGRESS_BAR_MAX = 1000;
31-
private Future mFuture;
31+
private Future<Void> mFuture;
3232

3333
@Override
3434
protected void onCreate(Bundle savedInstanceState) {

lib/src/main/java/net/ypresto/androidtranscoder/MediaTranscoder.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static MediaTranscoder getInstance() {
7474
* @deprecated Use {@link #transcodeVideo(FileDescriptor, String, MediaFormatStrategy, MediaTranscoder.Listener)} which accepts output video format.
7575
*/
7676
@Deprecated
77-
public Future transcodeVideo(final FileDescriptor inFileDescriptor, final String outPath, final Listener listener) {
77+
public Future<Void> transcodeVideo(final FileDescriptor inFileDescriptor, final String outPath, final Listener listener) {
7878
return transcodeVideo(inFileDescriptor, outPath, new MediaFormatStrategy() {
7979
@Override
8080
public MediaFormat createVideoOutputFormat(MediaFormat inputFormat) {
@@ -98,7 +98,7 @@ public MediaFormat createAudioOutputFormat(MediaFormat inputFormat) {
9898
* @param listener Listener instance for callback.
9999
* @throws IOException if input file could not be read.
100100
*/
101-
public Future transcodeVideo(final String inPath, final String outPath, final MediaFormatStrategy outFormatStrategy, final Listener listener) throws IOException {
101+
public Future<Void> transcodeVideo(final String inPath, final String outPath, final MediaFormatStrategy outFormatStrategy, final Listener listener) throws IOException {
102102
FileInputStream fileInputStream = null;
103103
FileDescriptor inFileDescriptor;
104104
try {
@@ -158,11 +158,11 @@ private void closeStream() {
158158
* @param outFormatStrategy Strategy for output video format.
159159
* @param listener Listener instance for callback.
160160
*/
161-
public Future transcodeVideo(final FileDescriptor inFileDescriptor, final String outPath, final MediaFormatStrategy outFormatStrategy, final Listener listener) {
161+
public Future<Void> transcodeVideo(final FileDescriptor inFileDescriptor, final String outPath, final MediaFormatStrategy outFormatStrategy, final Listener listener) {
162162
Looper looper = Looper.myLooper();
163163
if (looper == null) looper = Looper.getMainLooper();
164164
final Handler handler = new Handler(looper);
165-
final AtomicReference<Future> futureReference = new AtomicReference<>();
165+
final AtomicReference<Future<Void>> futureReference = new AtomicReference<>();
166166
final Future<Void> createdFuture = mExecutor.submit(new Callable<Void>() {
167167
@Override
168168
public Void call() throws Exception {
@@ -201,7 +201,7 @@ public void run() {
201201
if (exception == null) {
202202
listener.onTranscodeCompleted();
203203
} else {
204-
Future future = futureReference.get();
204+
Future<Void> future = futureReference.get();
205205
if (future != null && future.isCancelled()) {
206206
listener.onTranscodeCanceled();
207207
} else {

0 commit comments

Comments
 (0)