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)
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
25 #include "lib/depend-inject.hpp"
26 #include "lib/format-cout.hpp"
27 
28 #include "lib/test/run.hpp"
29 #include "lib/symbol.hpp"
30 
31 #include <string>
32 
33 using lib::DependInject;
34 using lib::Literal;
35 using std::string;
36 
37 
38 namespace vault {
39 namespace test {
40 
41 
42 
43 
44  /****************************************************************************/
48  class MediaAccessMock_test : public Test
49  {
50  typedef MediaAccessFacade MAF;
51 
52  virtual void run(Arg)
53  {
55 
56  queryScenario ("test-1");
57  queryScenario ("test-2");
58  }
59 
60 
64  void queryScenario (string const& filename)
65  {
66  MAF& maf (MAF::instance());
67  MediaDesc& mhandle = maf.queryFile (filename);
68  cout << "accessing \""<<filename<<"\" (dur="<<mhandle.length<<")...\n";
69  for (int i=0; true; ++i)
70  {
71  ChanDesc chan = maf.queryChannel (mhandle, i);
72  if (!chan.handle) break;
73 
74  cout << " Channel-" << i
75  << ": nameID=" << chan.chanID
76  << " codecID=" << chan.codecID
77  << "\n";
78  } }
79 
80 
81  };
82 
83 
84 
86  LAUNCHER (MediaAccessMock_test, "unit integration");
87 
88 
89 
90 }} // 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:40
inline string literal This is a marker type to indicate that
Definition: symbol.hpp:76
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.
Simplistic 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...