Ocean
Loading...
Searching...
No Matches
DSLibrary.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_MEDIA_DS_LIBRARY_H
9#define META_OCEAN_MEDIA_DS_LIBRARY_H
10
12
13#include "ocean/media/Library.h"
14#include "ocean/media/Manager.h"
15
16namespace Ocean
17{
18
19namespace Media
20{
21
22namespace DirectShow
23{
24
25/**
26 * This class implements the DirectShow library.
27 * @ingroup mediads
28 */
29class OCEAN_MEDIA_DS_EXPORT DSLibrary : public Library
30{
31 friend class Media::Manager;
32 friend class DSAudio;
33 friend class DSMovie;
34
35 public:
36
37 /**
38 * Creates a new medium by a given url.
39 * @see Library::newMedium().
40 */
41 MediumRef newMedium(const std::string& url, bool useExclusive = false) override;
42
43 /**
44 * Creates a new medium by a given url and an expected type.
45 * @see Library::newMedium().
46 */
47 MediumRef newMedium(const std::string& url, const Medium::Type type, bool useExclusive = false) override;
48
49 /**
50 * Creates a new recorder specified by the recorder type.
51 * @see Library::newRecorder().
52 */
54
55 /**
56 * Returns a list of selectable mediums.
57 * @see Library::selectableMedia().
58 */
59 Definitions selectableMedia() const override;
60
61 /**
62 * Returns a list of specific selectable mediums.
63 * @see Library::selectableMedia().
64 */
65 Definitions selectableMedia(const Medium::Type type) const override;
66
67 /**
68 * Returns the supported medium types.
69 * @see Library::supportedTypes().
70 */
71 Medium::Type supportedTypes() const override;
72
73 /**
74 * Registers this library at the global media manager.
75 * With each register call, the reference counter for a specific library will be incremented.
76 * Each call to registerLibrary() needs to be balanced with a corresponding call of unregisterLibrary() before shutting down.
77 * @return True, if the library has not been registered before
78 * @see Manager, unregisterLibrary()
79 */
80 static bool registerLibrary();
81
82 /**
83 * Unregisters this library at the global media manager.
84 * With each unregister call, the reference counter for a specific library will be decremented and removed from the system if the counter reaches zero.
85 * Each call to registerLibrary() needs to be balanced with a corresponding call of unregisterLibrary() before shutting down.
86 * @return True, if the library was actually removed from the system (as the reference counter reached zero); False, if the library is still used by someone else
87 * @see registerLibrary().
88 */
89 static bool unregisterLibrary();
90
91 protected:
92
93 /**
94 * Creates a new DSLibrary object.
95 */
97
98 /**
99 * Creates a new DSLibrary object.
100 */
101 ~DSLibrary() override;
102
103 /**
104 * Creates this library and returns it an object reference.
105 * @return The new library object
106 */
108
109 /**
110 * Creates a new audio medium.
111 * @param url Url of the audio medium to create
112 * @param useExclusive Determines whether the caller would like to use this medium exclusively
113 * @return Reference of the new medium
114 */
115 static MediumRef newAudio(const std::string& url, bool useExclusive);
116
117 /**
118 * Creates a new live video medium.
119 * @param url Url of the video medium to create
120 * @param useExclusive Determines whether the caller would like to use this medium exclusively
121 * @return Reference of the new medium
122 */
123 static MediumRef newLiveVideo(const std::string& url, bool useExclusive);
124
125 /**
126 * Creates a new movie medium.
127 * @param url Url of the movie medium to create
128 * @param useExclusive Determines whether the caller would like to use this medium exclusively
129 * @return Reference of the new medium
130 */
131 static MediumRef newMovie(const std::string& url, bool useExclusive);
132
133 private:
134
135 /// True, if the COM library has to be released when this library is released.
136 bool libraryReleaseCOM_ = false;
137};
138
139}
140
141}
142
143}
144
145#endif // META_OCEAN_MEDIA_DS_LIBRARY_H
This class implements a DirectShow audio object.
Definition DSAudio.h:34
This class implements the DirectShow library.
Definition DSLibrary.h:30
MediumRef newMedium(const std::string &url, const Medium::Type type, bool useExclusive=false) override
Creates a new medium by a given url and an expected type.
Definitions selectableMedia() const override
Returns a list of selectable mediums.
static bool unregisterLibrary()
Unregisters this library at the global media manager.
static MediumRef newAudio(const std::string &url, bool useExclusive)
Creates a new audio medium.
Definitions selectableMedia(const Medium::Type type) const override
Returns a list of specific selectable mediums.
MediumRef newMedium(const std::string &url, bool useExclusive=false) override
Creates a new medium by a given url.
static MediumRef newMovie(const std::string &url, bool useExclusive)
Creates a new movie medium.
Medium::Type supportedTypes() const override
Returns the supported medium types.
static MediumRef newLiveVideo(const std::string &url, bool useExclusive)
Creates a new live video medium.
static LibraryRef create()
Creates this library and returns it an object reference.
DSLibrary()
Creates a new DSLibrary object.
~DSLibrary() override
Creates a new DSLibrary object.
RecorderRef newRecorder(const Recorder::Type type) override
Creates a new recorder specified by the recorder type.
static bool registerLibrary()
Registers this library at the global media manager.
This class implements a DirectShow movie object.
Definition DSMovie.h:36
This class is the base class for all media libraries.
Definition media/Library.h:42
std::vector< Definition > Definitions
Definition of a vector holding medium definition objects.
Definition media/Library.h:111
This class is the manager for all media objects.
Definition media/Manager.h:34
Type
Definition of different medium types.
Definition Medium.h:57
Type
Definition of different recorder types.
Definition Recorder.h:46
The namespace covering the entire Ocean framework.
Definition Accessor.h:15