libstagefright: Add support to seek to zero
- Add CAN_SEEK_TO_ZERO flag in MediaExtractor to allow
seek to zero, when previous button is pressed, for clip
that can't be seeked.
Change-Id: Ic2761cc5bac2403ee1339da77ad02fde942a3437
diff --git a/include/media/stagefright/MediaExtractor.h b/include/media/stagefright/MediaExtractor.h
index 3076a96..ec3de50 100644
--- a/include/media/stagefright/MediaExtractor.h
+++ b/include/media/stagefright/MediaExtractor.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 The Android Open Source Project
+ * Copyright (c) 2012, The Linux Foundation. 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.
@@ -49,6 +50,7 @@
CAN_SEEK_FORWARD = 2, // the "seek 10secs forward button"
CAN_PAUSE = 4,
CAN_SEEK = 8, // the "seek bar"
+ CAN_SEEK_TO_ZERO = 16, // the "previous button"
};
// If subclasses do _not_ override this, the default is
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 52bd896..582d9b5 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 The Android Open Source Project
+ * Copyright (c) 2012, The Linux Foundation. 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.
@@ -1398,7 +1399,8 @@
status_t AwesomePlayer::seekTo(int64_t timeUs) {
ATRACE_CALL();
- if (mExtractorFlags & MediaExtractor::CAN_SEEK) {
+ if (((timeUs == 0) && (mExtractorFlags & MediaExtractor::CAN_SEEK_TO_ZERO)) ||
+ (mExtractorFlags & MediaExtractor::CAN_SEEK)) {
Mutex::Autolock autoLock(mLock);
return seekTo_l(timeUs);
}