TMediaInfoT¶
primo::avblocks::modern::TMediaInfoT
-
template<typename CharT = char>
class TMediaInfoT¶ Fluent wrapper for
primo::avblocks::MediaInfo, which analyzes a file or a stream and reports its type and properties.Configure the input socket (see
file()andinputs()), callopen(), then read the detected streams fromoutputs()and the metadata from the sockets. In push mode, feed data withpush()untilisReady().auto info = TMediaInfo().file("in.mp4").open(); int32_t pins = info.outputs(0).pins().count();
- Template Parameters:
CharT –
charfor UTF-8std::stringpaths,wchar_tforstd::wstringpaths. Use the aliasesTMediaInfoandTMediaInfoW. Owns the raw object through aprimo::ref. Not copyable, movable.
Unnamed Group
-
TMediaInfoT(TMediaInfoT&&) = default¶
-
TMediaInfoT &operator=(TMediaInfoT&&) = default¶
Move construction/assignment transfers ownership of the underlying object. The moved-from object no longer wraps anything.
Unnamed Group
-
inline TMediaInfoT &&file(const string_type &path) &&¶
-
inline TMediaInfoT &file(const string_type &path) &¶
Sets the file of the first input socket, so a probe can be written as
TMediaInfo().file(“in.mp4”).open().- Parameters:
path – File name.
- Returns:
This object, for chaining. On a temporary the rvalue overload returns the object by rvalue reference, so the chain can be returned or moved.
Unnamed Group
-
inline TMediaInfoT &open() &¶
-
inline TMediaInfoT &&open() &&¶
Analyzes the input.
If it succeeds, the detected streams and metadata can be read from the object. On a temporary,
autoinfo=TMediaInfo().file(f).open(); moves the opened object intoinfo.- Throws:
TAVBlocksException – if the input cannot be analyzed.
- Returns:
This object, for chaining.
Public Types
-
using string_type = typename string_traits<CharT>::string_type¶
The string type for paths:
std::stringforchar,std::wstringforwchar_t.
Public Functions
-
inline TMediaInfoT()¶
Creates a media info object with one default input socket.
-
TMediaInfoT(const TMediaInfoT&) = delete¶
-
TMediaInfoT &operator=(const TMediaInfoT&) = delete¶
-
inline bool isReady()¶
Returns
truewhen stream info and metadata have been fully parsed in push mode.
-
inline bool push(int32_t inputIndex, TMediaSample &sample)¶
Pushes a chunk of input data for the socket at
inputIndex.Returns
trueon success.
-
inline bool pushEos(int32_t inputIndex)¶
Signals end-of-stream on the input socket at
inputIndex.Equivalent to pushing a null (empty) sample.
-
inline TErrorInfo error() const¶
Returns the error information for the last operation.
-
inline TMediaSocketList inputs() const¶
Returns a non-owning view of the input socket list.
-
inline TMediaSocketT<CharT> inputs(int32_t index) const¶
Returns the input socket at
index, wrapping the existing (non-owned) pointer.
-
inline TMediaSocketList outputs() const¶
Returns a non-owning view of the output socket list.
-
inline TMediaSocketT<CharT> outputs(int32_t index) const¶
Returns the output socket at
index, wrapping the existing (non-owned) pointer.