|
arduino-audio-tools
|
Media Source Interface - Contract for Media Data Providers. More...
#include <IMediaSource.h>
Public Member Functions | |
| virtual RTSPFormat & | getFormat ()=0 |
| Get the media format configuration. | |
| virtual int | packetSize () |
| Size of the next queued, ready-to-send fragment, for sources that provide already RTP-payload-ready, self-delimited fragments (e.g. RFC 2435 JPEG) instead of a continuous byte stream. For these sources, readBytes() must always be called with exactly packetSize() as maxBytes, so each call retrieves exactly one complete fragment instead of the transport having to guess where one RTP payload ends and the next begins. | |
| virtual int | readBytes (void *dest, int maxSamples)=0 |
| Read media data into provided buffer. | |
| virtual void | start () |
| Initialize media source for streaming. | |
| virtual void | stop () |
| Cleanup media source after streaming. | |
Media Source Interface - Contract for Media Data Providers.
|
pure virtual |
Get the media format configuration.
Returns the RTSPFormat object that describes the media data characteristics including sample rate, bit depth, number of channels, and RTP packaging parameters. If no format has been explicitly set, creates a default 16-bit PCM format at 16kHz mono.
Implemented in H264RtpEncoder, JPEGRtpEncoder, RTSPMediaCallbackSource, and RTSPMediaSource.
|
inlinevirtual |
Size of the next queued, ready-to-send fragment, for sources that provide already RTP-payload-ready, self-delimited fragments (e.g. RFC 2435 JPEG) instead of a continuous byte stream. For these sources, readBytes() must always be called with exactly packetSize() as maxBytes, so each call retrieves exactly one complete fragment instead of the transport having to guess where one RTP payload ends and the next begins.
Call it once before each readBytes() to size that call, and again right after to tell whether the fragment just read was the last one currently available - a 0 result means the caller should set the RTP marker bit on the fragment it just sent (and may advance the timestamp for the next frame).
Reimplemented in H264RtpEncoder, JPEGRtpEncoder, and RTSPMediaCallbackSource.
|
pure virtual |
Read media data into provided buffer.
This is the core method that provides media data to the streaming system. Implementation should fill the destination buffer with media samples in the format specified by getFormat(). The method should be non-blocking and return available data immediately.
| dest | Pointer to buffer where media data should be written |
| maxBytes | Maximum number of bytes that can be written to dest buffer |
Implemented in RTSPMediaSource, H264RtpEncoder, JPEGRtpEncoder, and RTSPMediaCallbackSource.
|
inlinevirtual |
Initialize media source for streaming.
Called when streaming is about to begin. Implementations should use this to initialize hardware, allocate buffers, start media capture, or perform any other setup required for media data generation.
Reimplemented in H264RtpEncoder, JPEGRtpEncoder, RTSPMediaCallbackSource, and RTSPMediaSource.
|
inlinevirtual |
Cleanup media source after streaming.
Called when streaming has ended. Implementations should use this to release hardware resources, deallocate buffers, stop media capture, or perform cleanup operations.
Reimplemented in H264RtpEncoder, JPEGRtpEncoder, RTSPMediaCallbackSource, and RTSPMediaSource.