summaryrefslogtreecommitdiffstats
path: root/camera/DecoderFactory.cpp
diff options
context:
space:
mode:
authorDaniel Levin <dendy@ti.com>2012-11-27 21:34:12 +0200
committerDaniel Levin <dendy@ti.com>2012-12-04 15:38:30 +0200
commitcf614ea4fd9ebc303d6314016d7e226fa7cd1966 (patch)
tree7f09a3067b666a09dd8faadcac8d33b89166e219 /camera/DecoderFactory.cpp
parent92c40268fb2cdf196b7bd97fa5e569d8267a9ac7 (diff)
parent005d358cbcf413658d3e5204b699d9bf7367c256 (diff)
downloadhardware_ti_omap4-cf614ea4fd9ebc303d6314016d7e226fa7cd1966.zip
hardware_ti_omap4-cf614ea4fd9ebc303d6314016d7e226fa7cd1966.tar.gz
hardware_ti_omap4-cf614ea4fd9ebc303d6314016d7e226fa7cd1966.tar.bz2
Merge branch 'd-jb-mr0-release-camera' into p-jb-mr1-release
Conflicts: camera/OMXCameraAdapter/OMXCameraAdapter.cpp test/CameraHal/camera_test_bufferqueue.h test/CameraHal/camera_test_surfacetexture.cpp Change-Id: I1f13c6a5b6369e943773d04a650406a79eb95750 Signed-off-by: Daniel Levin <dendy@ti.com>
Diffstat (limited to 'camera/DecoderFactory.cpp')
-rw-r--r--camera/DecoderFactory.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/camera/DecoderFactory.cpp b/camera/DecoderFactory.cpp
new file mode 100644
index 0000000..846fda4
--- /dev/null
+++ b/camera/DecoderFactory.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) Texas Instruments - http://www.ti.com/
+ *
+ * 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.
+ */
+
+#include "FrameDecoder.h"
+#include "SwFrameDecoder.h"
+#include "OmxFrameDecoder.h"
+#include "CameraHal.h"
+#include "DecoderFactory.h"
+
+namespace Ti {
+namespace Camera {
+
+
+FrameDecoder* DecoderFactory::createDecoderByType(DecoderType type, bool forceSwDecoder) {
+ FrameDecoder* decoder = NULL;
+ switch (type) {
+ case DecoderType_MJPEG: {
+
+ if (!forceSwDecoder) {
+ decoder = new OmxFrameDecoder(DecoderType_MJPEG);
+ CAMHAL_LOGD("Using HW Decoder for MJPEG");
+ } else {
+ decoder = new SwFrameDecoder();
+ CAMHAL_LOGD("Using SW Decoder for MJPEG");
+ }
+
+ //TODO add logic that handle verification is HW Decoder is available ?
+ // And if no - create SW decoder.
+ break;
+ }
+ case DecoderType_H264: {
+ decoder = new OmxFrameDecoder(DecoderType_H264);
+ CAMHAL_LOGD("Using HW Decoder for H264");
+ break;
+ }
+ default: {
+ CAMHAL_LOGE("Unrecognized decoder type %d", type);
+ }
+ }
+
+ return decoder;
+}
+
+} // namespace Camera
+} // namespace Ti
+