summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/include/ID3.h
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-01-11 15:35:19 -0800
committerAndreas Huber <andih@google.com>2010-01-12 09:14:15 -0800
commitfc9ba09e3bb368f823d473f5e2bb9aa32dba6289 (patch)
treee7a6e0357e39c58d050b23a94b61f734e5578af7 /media/libstagefright/include/ID3.h
parent58e1f78683d9230932c4d5bee53b79fc685b5995 (diff)
downloadframeworks_av-fc9ba09e3bb368f823d473f5e2bb9aa32dba6289.zip
frameworks_av-fc9ba09e3bb368f823d473f5e2bb9aa32dba6289.tar.gz
frameworks_av-fc9ba09e3bb368f823d473f5e2bb9aa32dba6289.tar.bz2
Squashed commit of the following:
commit f81bb1dac5ef107bb0d7d5d756fb1ffa532ba2cc Author: Andreas Huber <andih@google.com> Date: Mon Jan 11 14:55:56 2010 -0800 Support for duration metadata, midi and ogg-vorbis files (in mediascanner) commit 0b1385a0dc156ce27985a1ff757c4c142fd7ec39 Author: Andreas Huber <andih@google.com> Date: Mon Jan 11 14:20:45 2010 -0800 Refactor meta data logic. Container specific metadata is now also returned by the MediaExtractor. commit f9818dfac39c96e5fefe8c8295e60580692d5990 Author: Andreas Huber <andih@google.com> Date: Fri Jan 8 14:26:09 2010 -0800 A first pass at supporting metadata through ID3 tags. commit 476e9e253633336ab790f943e2d6c0cd8991d76a Author: Andreas Huber <andih@google.com> Date: Thu Jan 7 15:48:44 2010 -0800 Initial checkin of ID3 (V2.2 and V2.3) parser for use in stagefright. related-to-bug: 2295456
Diffstat (limited to 'media/libstagefright/include/ID3.h')
-rw-r--r--media/libstagefright/include/ID3.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/media/libstagefright/include/ID3.h b/media/libstagefright/include/ID3.h
new file mode 100644
index 0000000..79931ac
--- /dev/null
+++ b/media/libstagefright/include/ID3.h
@@ -0,0 +1,87 @@
+/*
+ * 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 ID3_H_
+
+#define ID3_H_
+
+#include <utils/RefBase.h>
+
+namespace android {
+
+struct DataSource;
+struct String8;
+
+struct ID3 {
+ enum Version {
+ ID3_UNKNOWN,
+ ID3_V2_2,
+ ID3_V2_3
+ };
+
+ ID3(const sp<DataSource> &source);
+ ~ID3();
+
+ bool isValid() const;
+
+ Version version() const;
+
+ const void *getAlbumArt(size_t *length, String8 *mime) const;
+
+ struct Iterator {
+ Iterator(const ID3 &parent, const char *id);
+ ~Iterator();
+
+ bool done() const;
+ void getID(String8 *id) const;
+ void getString(String8 *s) const;
+ const uint8_t *getData(size_t *length) const;
+ void next();
+
+ private:
+ const ID3 &mParent;
+ char *mID;
+ size_t mOffset;
+
+ const uint8_t *mFrameData;
+ size_t mFrameSize;
+
+ void findFrame();
+
+ size_t getHeaderLength() const;
+
+ Iterator(const Iterator &);
+ Iterator &operator=(const Iterator &);
+ };
+
+private:
+ bool mIsValid;
+ uint8_t *mData;
+ size_t mSize;
+ size_t mFirstFrameOffset;
+ Version mVersion;
+
+ bool parse(const sp<DataSource> &source);
+ void removeUnsynchronization();
+
+ ID3(const ID3 &);
+ ID3 &operator=(const ID3 &);
+};
+
+} // namespace android
+
+#endif // ID3_H_
+