Basic Image AlgorithmS Library 2.8.0

TestDShowVideo.cpp

00001 /* 
00002 This file is part of the BIAS library (Basic ImageAlgorithmS).
00003 
00004 Copyright (C) 2003-2009    (see file CONTACT for details)
00005   Multimediale Systeme der Informationsverarbeitung
00006   Institut fuer Informatik
00007   Christian-Albrechts-Universitaet Kiel
00008 
00009 
00010 BIAS is free software; you can redistribute it and/or modify
00011 it under the terms of the GNU Lesser General Public License as published by
00012 the Free Software Foundation; either version 2.1 of the License, or
00013 (at your option) any later version.
00014 
00015 BIAS is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU Lesser General Public License for more details.
00019 
00020 You should have received a copy of the GNU Lesser General Public License
00021 along with BIAS; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 */
00024 
00025 
00026 /**
00027    @file TestDShowVideo.cpp
00028    @brief Test Windows DirectShow Video Source 
00029    @relates VideoSource_DSHOW
00030    @ingroup g_tests
00031    @author MIP
00032 */
00033 
00034 #include <iostream>
00035 #include <vector>
00036 #include <Image/Camera.hh>
00037 #include <VideoSource/DShowVideo.hh>
00038 #include <VideoSource/SampleGrabberCallback.hh>
00039 
00040 using namespace std;
00041 using namespace BIAS;
00042 
00043 /** @brief Implements a SampleGrabberCallback for testing. */
00044 class TestSampleGrabberCallback : public SampleGrabberCallback
00045 {
00046   STDMETHODIMP SampleCB(double SampleTime, IMediaSample *pSample)
00047   {
00048     cout << "SampleCB called\n";
00049     cout << "SampleTime: " << SampleTime << endl;
00050     cout << "pointer to sample: " << pSample << endl;
00051     cout << endl;
00052     return 0;
00053   }
00054 };
00055 
00056 int main()
00057 {
00058   Camera<unsigned char> img;
00059   TestSampleGrabberCallback sgcb;
00060 
00061   DShowVideo vid(&sgcb);
00062   if (!vid.Open("C:/Dokumente und Einstellungen/buildmaster/Desktop/test.avi"))
00063   {
00064     cout << "Error opening the file!" << endl;
00065     return 1;
00066   }
00067 
00068   unsigned int w, h, c;
00069   vid.GetImageSize(w, h, c);
00070   cout << "width, height, channel count: " << w << ", " << h << ", " << c << endl;
00071 
00072   for (int i = 0; i < 10; i++)
00073     vid.PlaySingleFrame();
00074 
00075   vid.Close();
00076 }
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends