summaryrefslogtreecommitdiffstats
path: root/media/base/media_format.cc
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-05 19:57:22 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-05 19:57:22 +0000
commit88185ad05fa219c194418e6e7eb9555fb07c2b67 (patch)
treea9e9464358e5f13066d9d7b71817d2c5d5386e64 /media/base/media_format.cc
parent0701ad5e7a6f5607ae6315f355eac2bdfd4c7080 (diff)
downloadchromium_src-88185ad05fa219c194418e6e7eb9555fb07c2b67.zip
chromium_src-88185ad05fa219c194418e6e7eb9555fb07c2b67.tar.gz
chromium_src-88185ad05fa219c194418e6e7eb9555fb07c2b67.tar.bz2
Add EGLImage as one media type different than regular uncompressed video buffer.
Video renderer could get this info via decoder->media_format(). This is needed in case video renderer is the buffer allocator. Patch by wjia@chromium.org: http://codereview.chromium.org/1725021/show BUG=NONE TEST=compiles Review URL: http://codereview.chromium.org/1952003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46479 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/media_format.cc')
-rw-r--r--media/base/media_format.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/media/base/media_format.cc b/media/base/media_format.cc
index 7c10cc8..fca4f89 100644
--- a/media/base/media_format.cc
+++ b/media/base/media_format.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -44,6 +44,15 @@ const char kUncompressedAudio[] = "audio/x-uncompressed";
// kHeight Integer Display height of the surface
const char kUncompressedVideo[] = "video/x-uncompressed";
+// Represents decoded video data in EGLImage, typically from OpenMAX video
+// decoder.
+// Other information, such as surface format (i.e., YV12), stride and planes are
+// included with the buffer itself and is not part of the MediaFormat.
+// Expected keys:
+// kWidth Integer Display width of the surface
+// kHeight Integer Display height of the surface
+const char kUncompressedVideoEglImage[] = "video/x-uncompressed-eglimage";
+
// Major types of media types begin with the prefix "audio/" or "video/".
const char kMajorTypeVideo[] = "video/";
const char kMajorTypeAudio[] = "audio/";
@@ -80,19 +89,23 @@ void MediaFormat::Clear() {
}
void MediaFormat::SetAsBoolean(const std::string& key, bool in_value) {
+ ReleaseValue(key);
value_map_[key] = Value::CreateBooleanValue(in_value);
}
void MediaFormat::SetAsInteger(const std::string& key, int in_value) {
+ ReleaseValue(key);
value_map_[key] = Value::CreateIntegerValue(in_value);
}
void MediaFormat::SetAsReal(const std::string& key, double in_value) {
+ ReleaseValue(key);
value_map_[key] = Value::CreateRealValue(in_value);
}
void MediaFormat::SetAsString(const std::string& key,
const std::string& in_value) {
+ ReleaseValue(key);
value_map_[key] = Value::CreateStringValue(in_value);
}
@@ -122,4 +135,11 @@ Value* MediaFormat::GetValue(const std::string& key) const {
return (value_iter == value_map_.end()) ? NULL : value_iter->second;
}
+void MediaFormat::ReleaseValue(const std::string& key) {
+ ValueMap::iterator vm = value_map_.find(key);
+ if (vm != value_map_.end()) {
+ delete vm->second;
+ }
+}
+
} // namespace media