Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DShowVideo.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 #ifndef __READAVI_HH__
26 #define __READAVI_HH__
27 #include <BIAS_DeclSpec.hh>
28 #include <string>
29 
30 namespace BIAS {
31 /**
32  * \test tested with TestDShowVideo.cpp
33  * \class DShowVideo
34  \brief Die Klasse ReadAvi ist zentraler Bestandteil der Infrastruktur zum
35  Dekodieren von AVI-Videocontainern. Weitere Bestandteile sind:
36  SampleGrabberCallback.
37 
38  ReadAvi baut einen DShow-Graphen auf aus drei Filtern: pSrcFilter_ zum
39  oeffnen und dekodieren des Videos, pSampleGrabber um einzelne Samples
40  abzugreifen und pNullRenderer umd die Vollstaendigkeit des Graphs mit
41  einer Senke zu gewaehrleisten. Die Filter werden ueber ihre jeweiligen
42  In und Out-Pins verbunden. Die Klasse SampleGrabberCallback muss dem
43  Konstruktor von ReadAvi mitgegeben werden. Fuer jedes Frame wird dann
44  von DShow die Methode SampleGrabberCallback::SampleCB(..)
45  aufgerufen. Diese kann dann die Bilddaten herausgeben.
46 
47  Um im Code der Klassen die ReadAvi u.a. benutzen keine #ifdef ...DSHOW...
48  einbauen zu muessen, sollen die Klassen und alle Interfaces _immer_
49  mitkompiliert werden. Falls DShow nicht zur Verfuegung steht, sind die
50  Methoden der Klassen ReadAvi und SampleGrabberCallback eben leer.
51  \author Max Hollmann
52  */
53 
54  class SampleGrabberCallback;
55  class DShowStuff;
56 
57  class BIASVideoSource_EXPORT DShowVideo
58  {
59  public:
61 
62  ~DShowVideo();
63 
64  /// open file, if not possible throw exception
65  bool Open(const std::string &filename);
66 
67  void Close();
68 
69  // to allow SampleGrabberCallback to stop immedeatly after one frame
70  void Pause();
71 
72  void GotoFrame(unsigned long long frameNo);
73 
74  void PlaySingleFrame();
75 
76  void PlayContinously();
77 
79  {return SGCB_;};
80 
81  /** If grabber is in realibale mode and
82  frame grabbing failed for some reason
83  the reader retrys to read the current frame.
84  This mode can slow down frame reading so
85  don't use it for realtime playback. */
86  void EnableReliableFrameRead(const bool enabled)
87  {FastNLazy_ = !enabled;};
88 
89  /** returns the image size contained in the stream, only meaningfull
90  results after call to Open() function */
91  bool GetImageSize(unsigned &width, unsigned &height,
92  unsigned &channel_count);
93 
94  protected:
95 
96  bool Init_();
97  bool IsRunning_;
98  bool IsPaused_;
99 
100  unsigned long long FrameNum_;
102 
103  DShowStuff *DShowStuff_;
105  bool Open_;
107  unsigned Width_, Height_, ChannelCount_;
108  };
109 
110 
111 } // namespace
112 
113 #endif
void EnableReliableFrameRead(const bool enabled)
If grabber is in realibale mode and frame grabbing failed for some reason the reader retrys to read t...
Definition: DShowVideo.hh:86
unsigned long long FrameNum_
Definition: DShowVideo.hh:100
Die Klasse ReadAvi ist zentraler Bestandteil der Infrastruktur zum Dekodieren von AVI-Videocontainern...
Definition: DShowVideo.hh:57
DShowStuff * DShowStuff_
Definition: DShowVideo.hh:103
sample grabber callback class for grabbing single frames only
SampleGrabberCallback * GetSampleGrabberCallback()
Definition: DShowVideo.hh:78
SampleGrabberCallback * SGCB_
Definition: DShowVideo.hh:101