Lumiera  0.pre.03
»edit your freedom«
media-access-mock-test.cpp
Go to the documentation of this file.
1 /*
2  MediaAccessMock(Test) - checking our Test Mock replacing the MediaAccessFacade
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
34 #include "lib/depend-inject.hpp"
35 #include "lib/format-cout.hpp"
36 
37 #include "lib/test/run.hpp"
38 #include "lib/symbol.hpp"
39 
40 #include <string>
41 
42 using lib::DependInject;
43 using lib::Literal;
44 using std::string;
45 
46 
47 namespace vault {
48 namespace test {
49 
50 
51 
52 
53  /****************************************************************************/
57  class MediaAccessMock_test : public Test
58  {
59  typedef MediaAccessFacade MAF;
60 
61  virtual void run(Arg)
62  {
64 
65  queryScenario ("test-1");
66  queryScenario ("test-2");
67  }
68 
69 
73  void queryScenario (string const& filename)
74  {
75  MAF& maf (MAF::instance());
76  MediaDesc& mhandle = maf.queryFile (filename);
77  cout << "accessing \""<<filename<<"\" (dur="<<mhandle.length<<")...\n";
78  for (int i=0; true; ++i)
79  {
80  ChanDesc chan = maf.queryChannel (mhandle, i);
81  if (!chan.handle) break;
82 
83  cout << " Channel-" << i
84  << ": nameID=" << chan.chanID
85  << " codecID=" << chan.codecID
86  << "\n";
87  } }
88 
89 
90  };
91 
92 
93 
95  LAUNCHER (MediaAccessMock_test, "unit integration");
96 
97 
98 
99 }} // namespace vault::test
virtual MediaDesc & queryFile(string const &name) const
request for testing the denoted files accessibility
MediaAccessFacade::ChanHandle handle
opaque handle, which will be used later to open this channel and retrieve some frames from it ...
Automatically use custom string conversion in C++ stream output.
virtual ChanDesc queryChannel(MediaDesc &, uint chanNo) const
request for information about the n-th channel of the file referred by FileHandle.
Definition: run.hpp:49
inline string literal This is a marker type to indicate that
Definition: symbol.hpp:85
Per type specific configuration of instances created as service dependencies.
Descriptor holding the global information record required for further handling this kind of media wit...
Mock implementation of the MediaAccessFacade.
Unit test helper to access an emulated media file.
Duration length
effectively usable duration.
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Interface to the vault layer: provides functions for querying (opening) a media file, detecting the channels or streams found within this file etc.
void queryScenario(string const &filename)
perform the test: query for an (alleged) file and retrieve the mock answer.
Marker types to indicate a literal string and a Symbol.
Simple test class runner.
const char * codecID
identifier characterising the access method (or codec) needed to get at the media data...
static lib::Depend< MediaAccessFacade > instance
storage for the SingletonFactory (actually a lumiera::test::MockInjector)
Vault-Layer implementation namespace root.
Description of one channel found in a media file; result of querying the channel. ...
Abstraction interface to query for a media file.
const char * chanID
identifier which can be used to create a name for the media asset corresponding to this channel...