X-Git-Url: http://cgit.sxemacs.org/?p=harmattan%2Fcameraplus;a=blobdiff_plain;f=lib%2Fqtcamdevice_p.h;h=c8c09fb1348cff72e05c6c3b6b2cc4b0cf69ca28;hp=717057ee02e5fba1fc8a1146b219ec986a4e8b99;hb=f15b7b41a0fd2cade6cd0bb3771c2c0da14db3c8;hpb=20f29f37dccc479dbbf933a5dabf66aedbb4940e diff --git a/lib/qtcamdevice_p.h b/lib/qtcamdevice_p.h index 717057e..c8c09fb 100644 --- a/lib/qtcamdevice_p.h +++ b/lib/qtcamdevice_p.h @@ -3,7 +3,7 @@ /*! * This file is part of CameraPlus. * - * Copyright (C) 2012 Mohammed Sameer + * Copyright (C) 2012-2013 Mohammed Sameer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,13 +29,13 @@ #include "qtcamviewfinder.h" #include "qtcamdevice.h" #include "qtcammode.h" -#include "qtcamanalysisbin.h" class QtCamGStreamerMessageListener; class QtCamMode; class QtCamImageMode; class QtCamVideoMode; class QtCamPropertySetter; +class QtCamAnalysisBin; class QtCamDevicePrivate { public: @@ -43,18 +43,20 @@ public: cameraBin(0), videoSource(0), wrapperVideoSource(0), + sink(0), image(0), video(0), active(0), viewfinder(0), conf(0), error(false), - notifications(0) { + notifications(0), + viewfinderFilters(0) { } GstElement *createAndAddElement(const QString& elementName, const char *prop, const char *name) { - GstElement *elem = gst_element_factory_make(elementName.toAscii(), name); + GstElement *elem = gst_element_factory_make(elementName.toLatin1(), name); if (!elem) { qWarning() << "Failed to create" << elementName; return 0; @@ -100,12 +102,22 @@ public: } } - bool setViewfinderSink() { - GstElement *sink; - g_object_get(cameraBin, "viewfinder-sink", &sink, NULL); + void setDevicePoperty() { + if (videoSource) { + if (conf->deviceScannerType() == SCANNER_TYPE_ENUM) { + int dev = id.toInt(); + g_object_set(videoSource, conf->deviceScannerProperty().toLatin1().constData(), dev, NULL); + } + else { + QString dev = id.toString(); + g_object_set(videoSource, conf->deviceScannerProperty().toLatin1().constData(), + dev.toLatin1().constData(), NULL); + } + } + } + bool setViewfinderSink() { if (sink) { - gst_object_unref(sink); return true; } @@ -158,7 +170,7 @@ public: void setAudioCaptureCaps() { QString captureCaps = conf->audioCaptureCaps(); if (!captureCaps.isEmpty()) { - GstCaps *caps = gst_caps_from_string(captureCaps.toAscii().data()); + GstCaps *caps = gst_caps_from_string(captureCaps.toLatin1().data()); if (caps) { g_object_set(cameraBin, "audio-capture-caps", caps, NULL); gst_caps_unref(caps); @@ -166,17 +178,18 @@ public: } } - void addViewfinderFilters() { - addElements("viewfinder-filter", conf->viewfinderFilters()); - } + bool isReadyForCapture() { + GstElement *src = videoSource; + if (wrapperVideoSource) { + src = wrapperVideoSource; + } - bool isWrapperReady() { - if (!wrapperVideoSource) { + if (!src) { return false; } gboolean ready = FALSE; - g_object_get(wrapperVideoSource, "ready-for-capture", &ready, NULL); + g_object_get(src, "ready-for-capture", &ready, NULL); return ready == TRUE; } @@ -201,36 +214,6 @@ public: Q_ARG(bool, d->q_ptr->isIdle())); } - void addElements(const char *prop, const QStringList& elements) { - QList list; - - if (elements.isEmpty()) { - return; - } - - foreach (const QString& element, elements) { - GstElement *elem = gst_element_factory_make(element.toUtf8().constData(), NULL); - if (!elem) { - qWarning() << "Failed to create element" << element; - } - else { - list << elem; - } - } - - if (list.isEmpty()) { - return; - } - - GstElement *bin = qt_cam_analysis_bin_create(list, prop); - if (!bin) { - qWarning() << "Failed to create bin for" << prop; - return; - } - - g_object_set(cameraBin, prop, bin, NULL); - } - QString name; QVariant id; @@ -239,6 +222,7 @@ public: GstElement *cameraBin; GstElement *videoSource; GstElement *wrapperVideoSource; + GstElement *sink; QtCamImageMode *image; QtCamVideoMode *video; @@ -250,6 +234,7 @@ public: bool error; QtCamNotifications *notifications; QtCamPropertySetter *propertySetter; + QtCamAnalysisBin *viewfinderFilters; }; #endif /* QT_CAM_DEVICE_P_H */