Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TestDShowVideo.cpp
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 
26 /**
27  @file TestDShowVideo.cpp
28  @brief Test Windows DirectShow Video Source
29  @relates VideoSource_DSHOW
30  @ingroup g_tests
31  @author MIP
32 */
33 
34 #include <iostream>
35 #include <vector>
36 #include <Image/Camera.hh>
37 #include <VideoSource/DShowVideo.hh>
38 #include <VideoSource/SampleGrabberCallback.hh>
39 
40 using namespace std;
41 using namespace BIAS;
42 
43 /** @brief Implements a SampleGrabberCallback for testing. */
45 {
46  STDMETHODIMP SampleCB(double SampleTime, IMediaSample *pSample)
47  {
48  cout << "SampleCB called\n";
49  cout << "SampleTime: " << SampleTime << endl;
50  cout << "pointer to sample: " << pSample << endl;
51  cout << endl;
52  return 0;
53  }
54 };
55 
56 int main()
57 {
60 
61  DShowVideo vid(&sgcb);
62  if (!vid.Open("C:/Dokumente und Einstellungen/buildmaster/Desktop/test.avi"))
63  {
64  cout << "Error opening the file!" << endl;
65  return 1;
66  }
67 
68  unsigned int w, h, c;
69  vid.GetImageSize(w, h, c);
70  cout << "width, height, channel count: " << w << ", " << h << ", " << c << endl;
71 
72  for (int i = 0; i < 10; i++)
73  vid.PlaySingleFrame();
74 
75  vid.Close();
76 }
Implements a SampleGrabberCallback for testing.
STDMETHODIMP SampleCB(double SampleTime, IMediaSample *pSample)
Die Klasse ReadAvi ist zentraler Bestandteil der Infrastruktur zum Dekodieren von AVI-Videocontainern...
Definition: DShowVideo.hh:57
sample grabber callback class for grabbing single frames only