arduino-audio-tools
Loading...
Searching...
No Matches
Modules | Namespaces | Classes | Enumerations | Functions

Video playback. More...

Modules

 H264
 H.264 encoding/decoding using https://github.com/pschatzmann/TinyH264.
 
 H264ESP32P4
 H.264 hardware encoding on ESP32-P4 using https://github.com/pschatzmann/codec-h264-ESP32P4 (esp_h264's dedicated, register/DMA-driven H.264 hardware encoder block). ESP32-P4 only - H264ConfigP4.h in that library fails the build on any other target.
 
 H264ESP32S3
 H.264 encoding/decoding on ESP32-S3 using https://github.com/pschatzmann/ESP32S3-h264 (esp_h264, hardware-assisted where available). ESP32-S3 only - H264Config.h in that library fails the build on any other target.
 
 MJPEG
 Motion-JPEG decoding using https://github.com/pschatzmann/TinyJPEG.
 
 MPG
 MPEG-1 part 2 (video) encoding/decoding using https://github.com/pschatzmann/TinyMPG.
 

Namespaces

namespace  audio_tools::quickstart_detail
 SFINAE helper for FileSeekableSource's auto-quickStart: calls writer.quickStart() if that method exists, no-op otherwise - most WriterT types (e.g. an AVI/WAV decoder) don't have one.
 

Classes

class  CameraFrameSource
 VideoFrameSource that pulls frames from the ESP32 camera (esp_camera.h, the Arduino-ESP32 "esp32-camera" component) - nextFrame() returns esp_camera_fb_get()'s buffer, releasing the previous frame (esp_camera_fb_return()) first; as with any VideoFrameSource, the returned pointer is only valid until the next nextFrame() call. More...
 
class  CameraFrameSourceOpenCV
 VideoFrameSource that pulls frames from an OpenCV cv::VideoCapture (e.g. a USB/CSI webcam via V4L2 on Linux/Raspberry Pi, or any other OpenCV-supported backend) - the desktop/Linux counterpart to CameraFrameSource, which targets the ESP32 esp_camera.h driver instead. More...
 
class  ChunkedSampleTableStore< T, ChunkSize >
 RAM-backed like RamSampleTableStore, but grows by allocating additional fixed-size chunks instead of reallocating and copying one single growing array. More...
 
class  Demuxer
 Common interface for demuxers (DemuxerAVI, DemuxerMP4) that split a container's video and (optional) audio tracks apart. Write code against this interface instead of a concrete class if it should work with either container format. More...
 
class  DemuxerAVI
 AVI Container Decoder which can be fed with small chunks of data. The minimum length must be bigger then the header size! The file structure is documented at https://learn.microsoft.com/en-us/windows/win32/directshow/avi-riff-file-reference. More...
 
class  DemuxerMP4
 DemuxerMP4 extracts both the audio and (H.264) video track from a general, interleaved MP4/ISO-BMFF stream - unlike M4AAudioDemuxer/ M4AAudioFileDemuxer, which only handle a single (audio) track. More...
 
class  DemuxerMPG
 MPEG-1 System (Program) Stream Demuxer, as defined by ISO/IEC 11172-1: splits the pack_header/system_header/PES_packet framing apart and forwards the raw MPEG-1 video (ISO/IEC 11172-2) and MPEG-1 audio (ISO/IEC 11172-3, Layer I/II/III) elementary streams to setOutputVideo()/ setOutputAudio(). Both elementary streams are self-delimiting (the video ES has its own picture_start_code sequence, the audio ES its own frame sync word) so, like DemuxerAVI/DemuxerMP4, no separate decoding is done here - point the outputs at whatever decoder understands the codec (e.g. an MPEG1 video decoder, or an EncodedAudioStream wrapping an MP3/MP2 AudioDecoder). More...
 
class  FileSeekableSource< FileT, WriterT >
 Adapts a single concrete file/stream (Arduino's File, or anything else exposing position(), seek(size_t) and a readBytes(size_t) overload) to SeekableSource, and also drives feeding that same file's bytes into a DemuxerMP4 (or any other AudioWriter with a setSeekSource(SeekableSource&) method) via copy() - replacing the separate CodecCopy/StreamCopy a sketch would otherwise need, and letting this class use just one File for everything instead of requiring two independent handles (one for sequential forward reads, one for the out-of-band seeks SourceSeekSampleTableStore performs). More...
 
class  FileSpoolStorage< FileT >
 Adapts any concrete file/stream type to SpoolStorage - same role as FileSeekableSource, just adding write(). This is the one place the concrete file type appears for spool-backed storage. More...
 
class  MultiVideoDecoder
 Manages multiple VideoDecoders with automatic format detection - the video-side counterpart of MultiDecoder (AudioCodecs/MultiDecoder.h). No decoders are registered by default and this header has no codec- library dependency of its own - register whatever your content needs via addDecoder(), or use MultiVideoDecoderFull (MultiVideoDecoderFull.h) for one pre-registered with every video codec this library ships a portable (no hardware-specific backend) software decoder for (H264/MJPEG/MPEG-1). More...
 
class  MultiVideoDecoderFull
 MultiVideoDecoder pre-registered with every video codec this library ships a portable (no hardware-specific backend) software decoder for: MJPEGDecoder (Motion-JPEG, TinyJPEG, CodecJPEG.h), MPGDecoder (MPEG-1, TinyMPG, CodecMPG.h), H264Decoder (H.264 Annex-B, TinyH264, CodecH264.h) - drop it into a demuxer's setOutputVideo() the same way any single decoder would go, and it self-selects the right one from the bitstream's own framing instead of the caller having to know the codec up front. Use the plain MultiVideoDecoder (MultiVideoDecoder.h) instead if you don't want all three codec libraries pulled in unconditionally - register only what your content actually needs via its own addDecoder(). More...
 
class  MultiVideoDemuxer
 Manages multiple Demuxers with automatic container-format detection - the container-side counterpart of MultiVideoDecoder (Video/MultiVideoDecoder.h), which does the same job one layer down for the video elementary stream's own codec. No demuxers are registered by default and this header has no container-parser dependency of its own (it only needs the Demuxer interface, ContainerCommon.h) - register whichever concrete demuxers (DemuxerAVI/DemuxerMP4/DemuxerMPG) your content actually needs via addDemuxer(). More...
 
class  MultiVideoDemuxerFull
 MultiVideoDemuxer pre-registered with every container format this library ships a demuxer for: DemuxerAVI (RIFF/AVI, AudioCodecs/ContainerAVI.h), DemuxerMP4 (ISO base media/MP4, AudioCodecs/ContainerMP4.h), DemuxerMPG (MPEG Program Stream, AudioCodecs/ContainerMPG.h) - drop it in wherever a plain Demuxer& is expected (VideoPlayer in fact uses one internally as its own built-in demuxer) and it self-selects the right one from the stream's own container signature instead of the caller having to know the file format up front. Use the plain MultiVideoDemuxer (MultiVideoDemuxer.h) instead if you don't want all three container parsers pulled in unconditionally - register only what your content actually needs via its own addDemuxer(). More...
 
class  Muxer
 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...
 
class  MuxerAVI
 Configuration for the (single) video track written by MuxerAVI. More...
 
class  MuxerMP4
 Video track configuration for MuxerMP4 - update before calling begin(). More...
 
class  MuxerMPG
 MPEG-1 System (Program) Stream Encoder, as defined by ISO/IEC 11172-1: muxes an already-encoded MPEG-1 video elementary stream (ISO/IEC 11172-2) and an optional MPEG-1 audio elementary stream (ISO/IEC 11172-3, Layer I/II/III) into pack_header/system_header/PES_packet framing written to a Print (a local File to record, or e.g. a network Client to publish a live stream). More...
 
struct  MuxerVideoConfig
 Shared video track configuration for muxers (MuxerAVI, MuxerMP4) - call before begin(). More...
 
class  MuxerVideoSink
 Print sink that writes each frame it receives to a Muxer's video track via addVideoFrame(), determining a real isKeyFrame value instead of relying on that method's isKeyFrame=true default - via isH264KeyFrame() (Video.h) when the Muxer's video track is VideoFormat::H264, otherwise always true (correct for e.g. MJPEG, where every frame is independently decodable). More...
 
class  OutputFPSMeter
 Wraps a VideoOutput (typically a codec decoder, e.g. H264Decoder/ MJPEGDecoder/MPGDecoder or a MultiVideoDecoder) and measures how long decoding+outputting each frame actually takes - forwards every write()/ flush()/setSkipRender()/isKeyFrame() call unmodified to the wrapped target, but times write()+flush() together and classifies the result I- vs P-frame via the target's own isKeyFrame(), the same way PacedVideoOutput classifies frames for its own frameCountI()/ frameCountP() stats. More...
 
class  OutputOpenCV
 Display a video frame with OpenCV, to be used on the desktop - VideoFormat::MJPEG (the default) expects one complete, already-encoded JPEG image assembled across write() calls and closed off by flush(), as produced by e.g. DemuxerAVI. Any other setVideoFormat() value (e.g. RGB565, the common raw picture format decoders like H264Decoder produce) expects one complete, already-decoded picture per write() call instead - setSize() must be called too in that case, since unlike JPEG a raw picture doesn't carry its own dimensions. More...
 
class  OutputTFT_eSPI
 Bridges VideoDecoder's write() calls to the TFT - VideoDecoder always hands over one complete frame per write() call (see its class comment), so this can push the whole frame in one go. Usually the data is in RGB565 format, but other formats are supported as well. More...
 
class  OutputTinyGPU
 Bridges VideoDecoder's write() calls to a TinyGPU DisplayDriver (e.g. ILI9341Driver, or any board wrapped in an LCDBoard - see the LCDBoard constructor) - VideoDecoder always hands over one complete frame per write() call (see its class comment), so this can push the whole frame in one go. Usually the data is in RGB565 format, but other formats are supported as well. More...
 
class  PacedVideoOutput
 Buffers a small, configurable amount of video (see setQueueBytes()) and renders it frame by frame from a dedicated background task, timed against an audio clock - so a demuxer's own dispatch loop never blocks on video pacing. Wrap the real VideoOutput (e.g. H264Decoder) in this and pass it to setOutputVideo() instead of the decoder itself. More...
 
class  RamSampleTableStore< T >
 Keeps every entry in RAM (a plain Vector<T>) - the simplest and fastest option, but scales with the track's total sample/chunk count (e.g. ~4.5MB total for a 102-minute movie's stsz+stco tables). Default if no other SampleTableStore is configured. More...
 
class  SampleTableStore< T >
 Sequential-access storage for one MP4 sample table (e.g. stsz sample sizes, stco chunk offsets, or the raw stsc/stts RLE entries). Every real access pattern in DemuxerMP4 is append-only while parsing 'moov', then forward-cursor reads while consuming 'mdat' - this interface intentionally only supports that (no random-access mutation, no delete), which is what keeps all three implementations below simple and correct. More...
 
class  SeekableSource
 Minimal seek+read interface a SourceSeekSampleTableStore needs from "the original MP4 source" - kept deliberately tiny (no write, no generic Stream surface) and non-templated, so classes that only need to hold/pass a source around (like DemuxerMP4 itself) don't have to become templates just to support this one storage strategy. More...
 
class  SourceSeekSampleTableStore< T >
 Discards every value right after appending it, keeping only the file offset of the first entry - get() seeks back into the original MP4 source and re-reads the entry directly (entries are fixed-size and contiguous on disk, so entry N sits at start_offset + N*sizeof(T)), trading RAM for repeated small seeks. More...
 
class  SpoolFileSampleTableStore< T >
 Writes every entry to a caller-provided scratch file as it's appended, instead of keeping it in RAM - get() seeks that file and reads the entry back. Unlike SourceSeekSampleTableStore this needs no knowledge of (or seekability in) the original MP4 source - it works even when that source is a live, non-seekable stream, since it's writing its own local, sequential copy as data streams past. The tradeoff is disk I/O (both a write during parsing and a seek+read during playback) instead of a pure RAM cost. More...
 
class  SpoolStorage
 Minimal seek+read+write interface a SpoolFileSampleTableStore needs from its scratch file - SeekableSource plus write(), kept non-templated for the same reason as SeekableSource (see its comment): so DemuxerMP4/SpoolStorageFactory don't need to become templates just to hold/pass one of these around. More...
 
class  SpoolStorageFactory
 Factory DemuxerMP4 calls once per table, per track, to obtain a SpoolStorage for spool-backed sample table storage - needed (rather than a single shared file/setter, the way setSeekSource() works) because up to two tracks (video + audio) times four tables means up to eight distinct spool regions are needed, and DemuxerMP4 doesn't know how many tracks a file has, or which kind each one is, until it's actually parsing 'moov' - implement this to open/return whatever files or regions your storage scheme uses (e.g. one file per call, named by trackKind+tableKind). More...
 
class  VideoDecoder
 Common interface for video decoders (e.g. H264Decoder, H264DecoderESP32S3 - CodecH264.h/CodecH264ESP32S3.h) - standardizes lifecycle (begin()/end()), the Print target decoded pictures are written to, and the pixel format they're written in (setVideoFormat()), on top of VideoOutput's write()/flush() (the encoded-bitstream input side, inherited unchanged). Concrete decoders may still expose their own additional config knobs beyond this shared surface. More...
 
class  VideoEncoder
 Common interface for video encoders (e.g. H264Encoder, H264EncoderESP32S3 - CodecH264.h/CodecH264ESP32S3.h; H264EncoderESP32P4. More...
 
class  VideoFrameMeter
 Transparent write() wrapper that measures throughput/turnaround while forwarding every call unchanged to the target given in the constructor - drop it into a pipeline slot (e.g. h264Decoder.setOutput( meter) instead of h264Decoder.setOutput(tftOutput), with meter wrapping tftOutput) to find out how that one stage is actually performing, without instrumenting the stage itself. More...
 
class  VideoFrameSource
 Pull-based provider of one already-encoded video/image frame at a time - e.g. wraps a camera capture + H264Encoder/MJPEG capture pipeline. Used by VideoMuxerWithTasks's video task, which calls nextFrame() once per iteration, at the rate given by videoInfo().fps. Implementations should produce/capture the frame here directly (not defer it): a slow nextFrame() only delays whatever is pulling from it. More...
 
struct  VideoInfo
 Basic video information (width/height/codec/frame size), analogous to AudioInfo - common to both DemuxerAVI and DemuxerMP4, accessible via their getVideoInfo() getter. More...
 
class  VideoInfoSource
 Provider of VideoInfo (width/height/fps/format) for whoever needs to size buffers/panel setup against it - e.g. a Demuxer (already parsed from the container's own metadata) handed to VideoOutput:: setVideoInfoSource(). More...
 
class  VideoMuxer
 Feeds a Muxer (MuxerAVI, MuxerMP4, ...) from a single copy() call. More...
 
class  VideoMuxerWithTasks
 Feeds a Muxer (MuxerAVI, MuxerMP4, ...) from two background Tasks instead of a single loop()/copy() call - one per track, each write wrapped in a LockGuard over a shared mutex (real by default; override via setMutex()), since a Muxer is not safe to call from two threads concurrently. More...
 
class  VideoOutput
 Abstract class for video playback. This class is used to assemble a complete video frame in memory. A video frame is written via one or more write() calls, then finalized with flush() - implementations use flush() to know a frame is complete (there is no separate frame-size hint, unlike a length-prefixed chunk format). More...
 
class  VideoPlayer
 High-level video playback pipeline and controller - the video counterpart of AudioPlayer (CoreAudio/AudioPlayer.h). Wraps a container Demuxer, a VideoDecoder driven through a PacedVideoOutput, and optionally an audio decode chain synced against it, behind one object driven by a single copy() call per loop() iteration. More...
 
class  VideoPlayerFull
 VideoPlayer subclass pre-registered with every video/audio codec this library ships a portable decoder for - H264/MJPEG/MPEG-1 video, MP3/AAC/MP2 audio - so it's the "just point it at a file, any common codec just works" player. Use instead of the base VideoPlayer unless you want to keep these dependencies out of your build (the base class's own multi-decoders start out completely empty, requiring an explicit addVideoDecoder()/addAudioDecoder() call per codec). More...
 

Enumerations

enum class  AudioFormat : uint16_t {
  UNKNOWN = 0x0000 , PCM = 0x0001 , ADPCM = 0x0002 , IEEE_FLOAT = 0x0003 ,
  ALAW = 0x0006 , MULAW = 0x0007 , OKI_ADPCM = 0x0010 , DVI_ADPCM = 0x0011 ,
  IMA_ADPCM = DVI_ADPCM , MEDIASPACE_ADPCM = 0x0012 , SIERRA_ADPCM = 0x0013 , G723_ADPCM = 0x0014 ,
  DIALOGIC_OKI_ADPCM = 0x0017 , MEDIAVISION_ADPCM = 0x0018 , YAMAHA_ADPCM = 0x0020 , ANTEX_ADPCME = 0x0033 ,
  DIGIADPCM = 0x0036 , NMS_VBXADPCM = 0x0038 , CS_IMAADPCM = 0x0039 , ROCKWELL_ADPCM = 0x003B ,
  G721_ADPCM = 0x0040 , G726_ADPCM = 0x0064 , G722_ADPCM = 0x0065 , INFOCOM_ITS_G721_ADPCM = 0x008B ,
  AC3 = 0x0092 , ZYXEL_ADPCM = 0x0097 , RHETOREX_ADPCM = 0x0100 , SANYO_LD_ADPCM = 0x0125 ,
  G726ADPCM = 0x0140 , UNISYS_NAP_ADPCM = 0x0170 , MP3 = 0x0055 , ALAC = 0x6C61 ,
  AAC = 0xA106
}
 Audio format codes used by Microsoft e.g. in avi or wav files. More...
 
enum class  SampleTableKind { SampleSizes , ChunkOffsets , Stsc , Stts }
 Identifies which of a track's four sample tables a SpoolStorageFactory is being asked to provide storage for. More...
 
enum  StreamContentType { Audio , Video }
 Which track write() feeds, for muxers (MuxerAVI, MuxerMP4) that double as a plain, generic Print-like sink for both tracks - see setStreamType()/streamType() on those classes. More...
 
enum class  TrackKind { Unknown , Audio , Video }
 Video vs. audio track classification - lives here (rather than nested inside DemuxerMP4::Track, where it conceptually belongs) purely so SpoolStorageFactory can reference it: this header is included before DemuxerMP4/Track are defined, so a nested type wouldn't be visible yet. DemuxerMP4::Track::kind uses this same type. More...
 
enum class  VideoFormat {
  H264 , MJPEG , MPEG4 , RAW ,
  YUV422 , RGB565 , RGB666 , RGB888 ,
  I420 , MPEG1 , UNKNOWN
}
 Video codec/pixel-format identifier, shared by two unrelated uses: the (single) video stream of a container (DemuxerAVI/MuxerAVI and DemuxerMP4 - much like AudioFormat is shared across the audio demuxers, despite its WAV-flavored name), and the decoded-picture pixel format VideoDecoder::setVideoFormat() selects. H264 is the primary target for muxing; the others are AVI-specific conveniences or decoder-only. More...
 

Functions

AudioFormat fromMime (const char *mime)
 Best-effort inverse of toMime(): maps a mime type (e.g. an AudioEncoder's mime()) back to the AudioFormat wav code it came from - AudioFormat::UNKNOWN if mime is null or doesn't match any of toMime()'s mappings (most codecs - Opus, FLAC, GSM, ... - have no wav code at all, so this can never be exhaustive; "audio/wav" itself maps back to PCM specifically, even though toMime() also uses it for every ADPCM variant, since PCM is the common case).
 
bool isH264KeyFrame (const uint8_t *data, size_t len)
 True if the given Annex-B H.264 access unit contains an IDR slice NAL unit (nal_unit_type 5) - the reliable way to tell a real keyframe/sync-sample apart from a P-frame, since nothing in the byte layout itself says so without inspecting NAL headers. Used e.g. to determine Muxer::addVideoFrame()'s isKeyFrame argument for an already-encoded VideoFormat::H264 frame.
 
bool isMpeg1KeyFrame (const uint8_t *data, size_t len)
 True if the given MPEG-1/2 video access unit's picture header declares picture_coding_type == 1 (I-picture) - the MPEG equivalent of isH264KeyFrame(). Layout (ISO/IEC 11172-2): a 00 00 01 00 picture_start_code is immediately followed by temporal_reference (10 bits) then picture_coding_type (3 bits), so the type field always falls in bits 5-3 of the byte right after the 2-byte temporal_reference span (i.e. 6 bytes into the access unit, counting the start code).
 
bool isWavFormat (AudioFormat format)
 True if the wav code is handled via the WAV decoder (i.e. toMime() maps it to "audio/wav": PCM and all ADPCM variants).
 
const char * toMime (AudioFormat format)
 Provides the mime type for a AudioFormat wav code, or nullptr if not known/mapped.
 
size_t videoFrameSizeBytes (VideoFormat format, uint16_t width, uint16_t height)
 Fixed per-frame size (bytes) for a raw/uncompressed VideoFormat at the given resolution - 0 for compressed formats (H264/MJPEG/MPEG4) or VideoFormat::UNKNOWN, since their frame size varies per frame.
 

Detailed Description

Video playback.

Enumeration Type Documentation

◆ AudioFormat

enum class AudioFormat : uint16_t
strong

Audio format codes used by Microsoft e.g. in avi or wav files.

Enumerator
UNKNOWN 
PCM 
ADPCM 
IEEE_FLOAT 
ALAW 
MULAW 
OKI_ADPCM 
DVI_ADPCM 
IMA_ADPCM 
MEDIASPACE_ADPCM 
SIERRA_ADPCM 
G723_ADPCM 
DIALOGIC_OKI_ADPCM 
MEDIAVISION_ADPCM 
YAMAHA_ADPCM 
ANTEX_ADPCME 
DIGIADPCM 
NMS_VBXADPCM 
CS_IMAADPCM 
ROCKWELL_ADPCM 
G721_ADPCM 
G726_ADPCM 
G722_ADPCM 
INFOCOM_ITS_G721_ADPCM 
AC3 
ZYXEL_ADPCM 
RHETOREX_ADPCM 
SANYO_LD_ADPCM 
G726ADPCM 
UNISYS_NAP_ADPCM 
MP3 
ALAC 
AAC 

◆ SampleTableKind

enum class SampleTableKind
strong

Identifies which of a track's four sample tables a SpoolStorageFactory is being asked to provide storage for.

Enumerator
SampleSizes 
ChunkOffsets 
Stsc 
Stts 

◆ StreamContentType

Which track write() feeds, for muxers (MuxerAVI, MuxerMP4) that double as a plain, generic Print-like sink for both tracks - see setStreamType()/streamType() on those classes.

Enumerator
Audio 
Video 

◆ TrackKind

enum class TrackKind
strong

Video vs. audio track classification - lives here (rather than nested inside DemuxerMP4::Track, where it conceptually belongs) purely so SpoolStorageFactory can reference it: this header is included before DemuxerMP4/Track are defined, so a nested type wouldn't be visible yet. DemuxerMP4::Track::kind uses this same type.

Enumerator
Unknown 
Audio 
Video 

◆ VideoFormat

enum class VideoFormat
strong

Video codec/pixel-format identifier, shared by two unrelated uses: the (single) video stream of a container (DemuxerAVI/MuxerAVI and DemuxerMP4 - much like AudioFormat is shared across the audio demuxers, despite its WAV-flavored name), and the decoded-picture pixel format VideoDecoder::setVideoFormat() selects. H264 is the primary target for muxing; the others are AVI-specific conveniences or decoder-only.

  • H264/MPEG4: compressed, variable frame size -> use addVideoFrame()
  • MJPEG: one complete JPEG image per frame -> use addJpegFrame()
  • RAW: uncompressed 24-bit BGR -> use addVideoFrame()
  • YUV422: packed 4:2:2 (YUY2/YUYV), 16 bit/pixel -> use addYUV422Frame()
  • RGB565: uncompressed 16-bit RGB (5-6-5) -> use addRGB565Frame()
  • RGB666: uncompressed 18-bit RGB, 3 bytes/pixel (each byte's 6 significant bits left-justified) - decoder pixel output only, no dedicated Muxer addXxxFrame()
  • RGB888: uncompressed 24-bit RGB, 3 bytes/pixel, full precision - decoder pixel output only, no dedicated Muxer addXxxFrame()
  • I420: planar 4:2:0 YUV (aka IYUV/YUV420), 12 bit/pixel -> use addI420Frame()
  • MPEG1: ISO/IEC 11172-2 compressed video, variable frame size -> use addVideoFrame() (ContainerMPG's MuxerMPG/DemuxerMPG)
  • UNKNOWN: decoder only - the codec did not match any of the above
Enumerator
H264 
MJPEG 
MPEG4 
RAW 
YUV422 
RGB565 
RGB666 
RGB888 
I420 
MPEG1 
UNKNOWN 

Function Documentation

◆ fromMime()

AudioFormat fromMime ( const char *  mime)
inline

Best-effort inverse of toMime(): maps a mime type (e.g. an AudioEncoder's mime()) back to the AudioFormat wav code it came from - AudioFormat::UNKNOWN if mime is null or doesn't match any of toMime()'s mappings (most codecs - Opus, FLAC, GSM, ... - have no wav code at all, so this can never be exhaustive; "audio/wav" itself maps back to PCM specifically, even though toMime() also uses it for every ADPCM variant, since PCM is the common case).

◆ isH264KeyFrame()

bool isH264KeyFrame ( const uint8_t *  data,
size_t  len 
)
inline

True if the given Annex-B H.264 access unit contains an IDR slice NAL unit (nal_unit_type 5) - the reliable way to tell a real keyframe/sync-sample apart from a P-frame, since nothing in the byte layout itself says so without inspecting NAL headers. Used e.g. to determine Muxer::addVideoFrame()'s isKeyFrame argument for an already-encoded VideoFormat::H264 frame.

◆ isMpeg1KeyFrame()

bool isMpeg1KeyFrame ( const uint8_t *  data,
size_t  len 
)
inline

True if the given MPEG-1/2 video access unit's picture header declares picture_coding_type == 1 (I-picture) - the MPEG equivalent of isH264KeyFrame(). Layout (ISO/IEC 11172-2): a 00 00 01 00 picture_start_code is immediately followed by temporal_reference (10 bits) then picture_coding_type (3 bits), so the type field always falls in bits 5-3 of the byte right after the 2-byte temporal_reference span (i.e. 6 bytes into the access unit, counting the start code).

◆ isWavFormat()

bool isWavFormat ( AudioFormat  format)
inline

True if the wav code is handled via the WAV decoder (i.e. toMime() maps it to "audio/wav": PCM and all ADPCM variants).

◆ toMime()

const char * toMime ( AudioFormat  format)
inline

Provides the mime type for a AudioFormat wav code, or nullptr if not known/mapped.

◆ videoFrameSizeBytes()

size_t videoFrameSizeBytes ( VideoFormat  format,
uint16_t  width,
uint16_t  height 
)
inline

Fixed per-frame size (bytes) for a raw/uncompressed VideoFormat at the given resolution - 0 for compressed formats (H264/MJPEG/MPEG4) or VideoFormat::UNKNOWN, since their frame size varies per frame.