On Thu, 16 Dec 2010 10:13:53 pm ext [email protected] wrote:
> I have a problem for which I cannot find a solution. I’m using QCamera class 
> (Qt Mobility 1.1) and I need to get access to the video frames(e.g. 
> QVideoFrame) provided by the camera in N900. I need to do some image 
> processing 
> to the frames before they are shown in for example QVideoWidget. How can I do 
> that?
> 
> I have tried the method illustrated in 
> http://developer.qt.nokia.com/forums/viewthread/370
> with no luck.
> If i don’t define “camera->setViewfinder(viewfinder);”, all I get 
> is some Gstreamer Camerabin “internal data flow error” after a while.

Camera pipeline on N900 doesn't use the colorspace transformation element 
due to (already fixed) gstreamer bug, so you have to accept the native 
QVideoFrame::Format_UYVY
frames format. I attached a simple video surface which works with QCamera on 
N900.

You can use the code from qgraphicsvideoitem_maemo5.cpp for fast UYVY->RGB16 
transformation.

> 
> I have 
> also considered subclassing QVideoWidget and reimplementing paintEvent, but 
> don’
> t see how can I actually get access to the frames before they are drawn to 
> the 
> widget.

QVideoWidget uses XVideo based overlay for fast video rendering.

> 
> I do not want to process snapshot images that are already saved in 
> file.
> 
> Is the any good solutions/examples how to solve this problem?
> 
> Thank 
> you.
> _______________________________________________
> Qt-mobility-feedback mailing list
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt-mobility-feedback
> 

Regards
  Dmytro.
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at [email protected].
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <qabstractvideosurface.h>

#ifndef QVIDEOITEMSURFACE_MAEMO5_H
#define QVIDEOITEMSURFACE_MAEMO5_H

QT_BEGIN_NAMESPACE

class QVideoItemSurface : public QAbstractVideoSurface
{
    Q_OBJECT
public:
    QVideoItemSurface()
        :QAbstractVideoSurface()
    {
    }

    virtual ~QVideoItemSurface()
    {
    }


    QList<QVideoFrame::PixelFormat> supportedPixelFormats(
            QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const
    {
        if (handleType == QAbstractVideoBuffer::NoHandle)
            return QList<QVideoFrame::PixelFormat>()
                    << QVideoFrame::Format_UYVY
                    << QVideoFrame::Format_RGB565
                    << QVideoFrame::Format_RGB32
                    << QVideoFrame::Format_ARGB32_Premultiplied;
        else
            return QList<QVideoFrame::PixelFormat>();
    }

    bool present(const QVideoFrame &frame)
    {
        m_lastFrame = frame;
        emit frameChanged();
        return true;
    }

    void stop()
    {
        m_lastFrame = QVideoFrame();
        QAbstractVideoSurface::stop();
    }

    QVideoFrame videoFrame() const
    {
        return m_lastFrame;
    }

Q_SIGNALS:
    void frameChanged();

private:
    QVideoFrame m_lastFrame;
};

QT_END_NAMESPACE

#endif
_______________________________________________
Qt-mobility-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-mobility-feedback

Reply via email to