From c1cb78d574c0429aa5e3ff3a2b3886e4bc153212 Mon Sep 17 00:00:00 2001 From: bbergeron Date: Wed, 3 Apr 2024 17:32:01 -0400 Subject: Reset Git repo and use a pseudonym to sign commits I used to sign my commits with my real name and my personal email address, which I wanted scrubbed off the "B." pseudosphere. Re-creating a new git repository was safer than simpler than re-writing the history (although the latter could've also worked but, oh well). --- audio/muxer.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 audio/muxer.h (limited to 'audio/muxer.h') diff --git a/audio/muxer.h b/audio/muxer.h new file mode 100644 index 0000000..b671484 --- /dev/null +++ b/audio/muxer.h @@ -0,0 +1,54 @@ +#ifndef AUDIO_MUXER_H_ +#define AUDIO_MUXER_H_ + +#include +#include + +/** + * An AudioMuxer is responsible for attaching and managing an audio stream to an + * FFMPEG AVFormatContext instance. Ultimately, AudioMuxer allows users to pass + * amorphous FFMPEG audio packets to an AvFormatContext without worrying about + * encoding or sample count, and to enable silent streaming. + */ +typedef struct AudioMuxer AudioMuxer; + +struct AudioMuxerOpt { + int sample_rate; + enum AVSampleFormat sample_format; + enum AVCodecID codec_id; + AVChannelLayout ch_layout; + AVDictionary **opts_muxer; + AVDictionary **opts_encoder; +}; + +#define AUDIO_MUXER_OPT_DEFAULTS\ + .sample_rate = 44100,\ + .sample_format = 0,\ + .codec_id = 0,\ + .ch_layout = 0,\ + .opts_muxer = NULL,\ + .opts_encoder = NULL + +/** + * Initialize **pmuxer using the parameters passed by *opts and attach an audio + * stream to *avctx. This function mearly configures the output front of the + * remuxer (i.e. a stream, an encoder, and part of a resmapler), and a second + * call to audiomuxer_conf must be dispatched before sending in packets. Return + * 0 on success, or a negative AVERROR on failure. + */ +int audiomuxer_init(AudioMuxer **pmuxer, AVFormatContext *avctx, const struct AudioMuxerOpt *opts); + +/** + * Configure *muxer to process input from a given *input stream. Internally, + * this function allocate a decoder and configure the remuxer's resampler to + * suite *input's codec and sample rate. Return 0 on success, or a negative + * AVERROR on failure. + */ +int audiomuxer_conf(AudioMuxer *muxer, const AVStream *input); + +int audiomuxer_send_packet (AudioMuxer *muxer, const AVPacket *pkt_in); +int audiomuxer_send_silence (AudioMuxer *muxer, unsigned int microsec); +uint64_t audiomuxer_get_runtime (const AudioMuxer *muxer); +void audiomuxer_free (AudioMuxer *muxer); + +#endif // AUDIO_MUXER_H_ -- cgit v1.2.3