summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/ad_sample.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs/ad_sample.c')
-rw-r--r--libmpcodecs/ad_sample.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libmpcodecs/ad_sample.c b/libmpcodecs/ad_sample.c
index 848152c68e..5ddf4ef77b 100644
--- a/libmpcodecs/ad_sample.c
+++ b/libmpcodecs/ad_sample.c
@@ -23,18 +23,18 @@ static int preinit(sh_audio_t *sh){
// let's check if the driver is available, return 0 if not.
// (you should do that if you use external lib(s) which is optional)
...
-
+
// there are default values set for buffering, but you can override them:
-
+
// minimum output buffer size (should be the uncompressed max. frame size)
sh->audio_out_minsize=4*2*1024; // in this sample, we assume max 4 channels,
// 2 bytes/sample and 1024 samples/frame
// Default: 8192
-
+
// minimum input buffer size (set only if you need input buffering)
// (should be the max compressed frame size)
sh->audio_in_minsize=2048; // Default: 0 (no input buffer)
-
+
// if you set audio_in_minsize non-zero, the buffer will be allocated
// before the init() call by the core, and you can access it via
// pointer: sh->audio_in_buffer
@@ -43,17 +43,17 @@ static int preinit(sh_audio_t *sh){
// the next few parameters define the audio format (channels, sample type,
// in/out bitrate etc.). it's OK to move these to init() if you can set
// them only after some initialization:
-
+
sh->samplesize=2; // bytes (not bits!) per sample per channel
sh->channels=2; // number of channels
sh->samplerate=44100; // samplerate
sh->sample_format=AF_FORMAT_S16_LE; // sample format, see libao2/afmt.h
-
+
sh->i_bps=64000/8; // input data rate (compressed bytes per second)
// Note: if you have VBR or unknown input rate, set it to some common or
// average value, instead of zero. it's used to predict time delay of
// buffered compressed bytes, so it must be more-or-less real!
-
+
//sh->o_bps=... // output data rate (uncompressed bytes per second)
// Note: you DON'T need to set o_bps in most cases, as it defaults to:
// sh->samplesize*sh->channels*sh->samplerate;
@@ -62,7 +62,7 @@ static int preinit(sh_audio_t *sh){
// set the compressed and uncompressed packet size (used by the demuxer):
sh->ds->ss_mul = 34; // compressed packet size
sh->ds->ss_div = 64; // samples per packet
-
+
return 1; // return values: 1=OK 0=ERROR
}
@@ -71,7 +71,7 @@ static int init(sh_audio_t *sh_audio){
// you can store HANDLE or private struct pointer at sh->context
// you can access WAVEFORMATEX header at sh->wf
-
+
// set sample format/rate parameters if you didn't do it in preinit() yet.
return 1; // return values: 1=OK 0=ERROR
@@ -86,7 +86,7 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m
// audio decoding. the most important thing :)
// parameters you get:
- // buf = pointer to the output buffer, you have to store uncompressed
+ // buf = pointer to the output buffer, you have to store uncompressed
// samples there
// minlen = requested minimum size (in bytes!) of output. it's just a
// _recommendation_, you can decode more or less, it just tell you that
@@ -96,8 +96,8 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m
// buffer, it's the upper-most limit!
// note: maxlen will be always greater or equal to sh->audio_out_minsize
- // now, let's decode...
-
+ // now, let's decode...
+
// you can read the compressed stream using the demux stream functions:
// demux_read_data(sh->ds, buffer, length) - read 'length' bytes to 'buffer'
// ds_get_packet(sh->ds, &buffer) - set ptr buffer to next data packet