summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/include
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-05-07 10:35:13 -0700
committerAndreas Huber <andih@google.com>2010-05-07 12:01:45 -0700
commitee7ff20e69498ebd53dd9717a0f984188341a75e (patch)
tree2338621414d60b23ec50dd5f28fc413fb957a59e /media/libstagefright/include
parentf9325834de1ae004212aec2fd03445b4eebfa766 (diff)
downloadframeworks_av-ee7ff20e69498ebd53dd9717a0f984188341a75e.zip
frameworks_av-ee7ff20e69498ebd53dd9717a0f984188341a75e.tar.gz
frameworks_av-ee7ff20e69498ebd53dd9717a0f984188341a75e.tar.bz2
A new OggExtractor/VorbisDecoder combo to support approximate seeking.
Change-Id: Id5d0c1c8b1adc62896bb5ed951f7b5cfda811e95 related-to-bug: 2654400
Diffstat (limited to 'media/libstagefright/include')
-rw-r--r--media/libstagefright/include/OggExtractor.h (renamed from media/libstagefright/include/VorbisExtractor.h)32
-rw-r--r--media/libstagefright/include/VorbisDecoder.h71
2 files changed, 86 insertions, 17 deletions
diff --git a/media/libstagefright/include/VorbisExtractor.h b/media/libstagefright/include/OggExtractor.h
index 2bb7deb..7066669 100644
--- a/media/libstagefright/include/VorbisExtractor.h
+++ b/media/libstagefright/include/OggExtractor.h
@@ -14,23 +14,22 @@
* limitations under the License.
*/
-#ifndef VORBIS_EXTRACTOR_H_
+#ifndef OGG_EXTRACTOR_H_
-#define VORBIS_EXTRACTOR_H_
+#define OGG_EXTRACTOR_H_
#include <media/stagefright/MediaExtractor.h>
-struct OggVorbis_File;
-
namespace android {
class DataSource;
class String8;
-struct VorbisDataSource;
+struct MyVorbisExtractor;
+struct OggSource;
-struct VorbisExtractor : public MediaExtractor {
- VorbisExtractor(const sp<DataSource> &source);
+struct OggExtractor : public MediaExtractor {
+ OggExtractor(const sp<DataSource> &source);
virtual size_t countTracks();
virtual sp<MediaSource> getTrack(size_t index);
@@ -38,25 +37,24 @@ struct VorbisExtractor : public MediaExtractor {
virtual sp<MetaData> getMetaData();
- uint32_t flags() const;
-
protected:
- virtual ~VorbisExtractor();
+ virtual ~OggExtractor();
private:
+ friend struct OggSource;
+
sp<DataSource> mDataSource;
- struct OggVorbis_File *mFile;
- struct VorbisDataSource *mVorbisDataSource;
status_t mInitCheck;
- sp<MetaData> mMeta;
- VorbisExtractor(const VorbisExtractor &);
- VorbisExtractor &operator=(const VorbisExtractor &);
+ MyVorbisExtractor *mImpl;
+
+ OggExtractor(const OggExtractor &);
+ OggExtractor &operator=(const OggExtractor &);
};
-bool SniffVorbis(
+bool SniffOgg(
const sp<DataSource> &source, String8 *mimeType, float *confidence);
} // namespace android
-#endif // VORBIS_EXTRACTOR_H_
+#endif // OGG_EXTRACTOR_H_
diff --git a/media/libstagefright/include/VorbisDecoder.h b/media/libstagefright/include/VorbisDecoder.h
new file mode 100644
index 0000000..e9a488a
--- /dev/null
+++ b/media/libstagefright/include/VorbisDecoder.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VORBIS_DECODER_H_
+
+#define VORBIS_DECODER_H_
+
+#include <media/stagefright/MediaSource.h>
+
+struct vorbis_dsp_state;
+struct vorbis_info;
+
+namespace android {
+
+struct MediaBufferGroup;
+
+struct VorbisDecoder : public MediaSource {
+ VorbisDecoder(const sp<MediaSource> &source);
+
+ virtual status_t start(MetaData *params);
+ virtual status_t stop();
+
+ virtual sp<MetaData> getFormat();
+
+ virtual status_t read(
+ MediaBuffer **buffer, const ReadOptions *options);
+
+protected:
+ virtual ~VorbisDecoder();
+
+private:
+ enum {
+ kMaxNumSamplesPerBuffer = 8192 * 2
+ };
+
+ sp<MediaSource> mSource;
+ bool mStarted;
+
+ MediaBufferGroup *mBufferGroup;
+
+ int32_t mNumChannels;
+ int32_t mSampleRate;
+ int64_t mAnchorTimeUs;
+ int64_t mNumFramesOutput;
+
+ vorbis_dsp_state *mState;
+ vorbis_info *mVi;
+
+ int decodePacket(MediaBuffer *packet, MediaBuffer *out);
+
+ VorbisDecoder(const VorbisDecoder &);
+ VorbisDecoder &operator=(const VorbisDecoder &);
+};
+
+} // namespace android
+
+#endif // VORBIS_DECODER_H_
+