Common interface for muxers (MuxerAVI, MuxerMP4) that combine an already-encoded video track (and optionally an audio track) into a container written to a Print (a local File to record, or e.g. a network Client to publish a live stream to an HTTP/TCP client). Write code against this interface instead of a concrete class if it should work with either container format.
More...
#include <ContainerCommon.h>
Common interface for muxers (MuxerAVI, MuxerMP4) that combine an already-encoded video track (and optionally an audio track) into a container written to a Print (a local File to record, or e.g. a network Client to publish a live stream to an HTTP/TCP client). Write code against this interface instead of a concrete class if it should work with either container format.
write() (VideoOutput) treats each call as one complete, already-encoded frame for both MuxerAVI and MuxerMP4 - callers must hand over the full frame in a single call, not build it up incrementally across several write() calls. flush() is a no-op for both.
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ addAudioFrame()
| virtual size_t addAudioFrame |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
pure virtual |
Writes one complete audio frame/block. Meaning is container- and codec-specific (e.g. one raw AAC frame vs. an arbitrary PCM block); see the concrete class.
Implemented in MuxerAVI, MuxerMP4, and MuxerMPG.
◆ addI420Frame()
| virtual size_t addI420Frame |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
pure virtual |
Writes one planar 4:2:0 YUV (I420/IYUV) frame. Expects exactly width*height*3/2 bytes.
Implemented in MuxerAVI, MuxerMP4, and MuxerMPG.
◆ addJpegFrame()
| virtual size_t addJpegFrame |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
pure virtual |
Writes one complete Motion-JPEG frame (a full, already-encoded JPEG image).
Implemented in MuxerAVI, MuxerMP4, and MuxerMPG.
◆ addRGB565Frame()
| virtual size_t addRGB565Frame |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
pure virtual |
Writes one uncompressed RGB565 (16-bit, 5-6-5) frame. Expects exactly width*height*2 bytes.
Implemented in MuxerAVI, MuxerMP4, and MuxerMPG.
◆ addVideoFrame()
| virtual size_t addVideoFrame |
( |
const uint8_t * |
data, |
|
|
size_t |
len, |
|
|
bool |
isKeyFrame = true |
|
) |
| |
|
pure virtual |
Writes one complete, already-encoded video frame (e.g. one H.264 access unit).
- Parameters
-
| isKeyFrame | hints that the frame is independently decodable (a sync/seek point) - used where the container format can express it (e.g. MP4's 'trun' sample flags); ignored where it can't (AVI). |
Implemented in MuxerAVI, MuxerMP4, and MuxerMPG.
◆ addYUV422Frame()
| virtual size_t addYUV422Frame |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
pure virtual |
Writes one packed 4:2:2 YUV frame (YUY2/YUYV byte order). Expects exactly width*height*2 bytes.
Implemented in MuxerAVI, MuxerMP4, and MuxerMPG.
◆ audioInfo()
◆ begin()
Writes the container header. Call after configuring video (and audio, if any) and before writing any frames.
Implemented in MuxerAVI, MuxerMP4, and MuxerMPG.
◆ end()
◆ flush()
Finalizes the frame most recently written via one or more write() calls - see class comment. Default no-op for implementations that display/decode synchronously in write() instead.
Reimplemented from VideoOutput.
◆ getAudioSamplesPerVideoFrame()
| float getAudioSamplesPerVideoFrame |
( |
| ) |
|
|
inline |
Average number of audio samples per video frame, derived from audioInfo().sample_rate and getVideoInfo().fps - the natural audio chunk size to write once per video frame if you want to keep both tracks advancing at roughly the same pace as you write them (not a hard requirement - see addAudioFrame()/addVideoFrame()). 0 if fps hasn't been set.
◆ getVideoInfo()
◆ mime()
| virtual const char * mime |
( |
| ) |
|
|
pure virtual |
The container's MIME type (e.g. "video/avi", "video/mp4") - useful for e.g. an HTTP Content-Type header when streaming the muxed output to a client.
Implemented in MuxerAVI, MuxerMP4, and MuxerMPG.
◆ operator bool()
| virtual operator bool |
( |
| ) |
|
|
pure virtual |
◆ setAudioInfo()
Adds an (optional) interleaved audio track, including the codec selection (the 'format' field) - which AudioFormat values are actually supported (and what they mean, e.g. default codec if unset) is container-specific; see the concrete class. Call before begin().
Implemented in MuxerAVI, MuxerMP4, and MuxerMPG.
◆ setOutput()
| virtual void setOutput |
( |
Print & |
out | ) |
|
|
pure virtual |
◆ setStreamType()
◆ setVideoInfo()
◆ streamType()
◆ write()
| virtual size_t write |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
pure virtualinherited |
◆ p_print
The documentation for this class was generated from the following file: