2
/***************************************************************************
5
begin : Thu Oct 27 2004
6
copyright : (C) 2004 by Dirk Ziegelmeier
8
***************************************************************************/
11
* This library is free software; you can redistribute it and/or
12
* modify it under the terms of the GNU Library General Public
13
* License as published by the Free Software Foundation; either
14
* version 2 of the License, or (at your option) any later version.
16
* This library is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
* Library General Public License for more details.
21
* You should have received a copy of the GNU Library General Public License
22
* along with this library; see the file COPYING.LIB. If not, write to
23
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
24
* Boston, MA 02110-1301, USA.
27
#ifndef __KDETV_V4L2GRABBER_H
28
#define __KDETV_V4L2GRABBER_H
35
#include "kdetvvideo/kdetvimage.h"
39
class KdetvImageFilterContext;
41
class KdetvImageFilter;
42
class KdetvFormatConversionFilter;
44
// History: four fields
45
#define V4L2GRABBER_CONTEXT_HISTORY 4
48
* The field images need to be "faked" from progessive images.
49
* The algorithm is simple, but the last two fields must not be
50
* accessed. Depending on the order, the image with buffer may be
51
* deleted while it's corresponding fake field image is still queued.
53
#define V4L2GRABBER_HISTORY V4L2GRABBER_CONTEXT_HISTORY+2
56
class V4L2Grabber : public QObject, public QThread
59
V4L2Grabber(QObject *owner, V4L2Dev *dev, QVideoStream* vs, KdetvImage::ImageFormat fmt);
60
virtual ~V4L2Grabber();
63
void stop() { _stop = true; }
64
QMutex& mutex() { return _devMutex; }
67
KdetvImage::ImageType _mostRecentField;
69
KdetvImageFilter* _flt;
70
KdetvFormatConversionFilter* _fmtConv;
79
KdetvImage::ImageFormat _fmt;
80
KdetvImagePool* _poolWithBuffer;
81
KdetvImagePool* _poolWithoutBuffer;
82
KdetvImageFilterContext* _ctx;
83
KdetvSharedImage* _images[V4L2GRABBER_HISTORY];
86
class V4L2ErrorEvent : public QEvent
89
V4L2ErrorEvent(const QString& msg)
90
: QEvent(QEvent::User),
103
struct V4L2GrabberLocker
105
V4L2GrabberLocker(V4L2Grabber* g)
115
_g->mutex().unlock();