summaryrefslogtreecommitdiffstats
path: root/apps/codecs/Tremor/vorbisfile.c
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2005-07-24 15:32:28 +0000
committerMagnus Holmgren <magnushol@gmail.com>2005-07-24 15:32:28 +0000
commit4a53787992b396d28c001f7567bc91644fae861c (patch)
tree0ab4fee5b878e957fa781d6581efbe6f103c0fd2 /apps/codecs/Tremor/vorbisfile.c
parent6bd8e5db08e42130d1a72377b3c0cec0b8d57a69 (diff)
downloadrockbox-4a53787992b396d28c001f7567bc91644fae861c.tar.gz
rockbox-4a53787992b396d28c001f7567bc91644fae861c.zip
ReplayGain support for Ogg Vorbis files (also called VorbisGain) added.
Note that there is a small delay from leaving a setting until the change can be heard (due to audio data buffering). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7234 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/Tremor/vorbisfile.c')
-rw-r--r--apps/codecs/Tremor/vorbisfile.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/apps/codecs/Tremor/vorbisfile.c b/apps/codecs/Tremor/vorbisfile.c
index f6a208d1c7..0d8c04ab91 100644
--- a/apps/codecs/Tremor/vorbisfile.c
+++ b/apps/codecs/Tremor/vorbisfile.c
@@ -1604,3 +1604,47 @@ long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
return(samples);
}
}
+
+/* input values: pcm_channels) a float vector per channel of output
+ length) the sample length being read by the app
+
+ return values: <0) error/hole in data (OV_HOLE), partial open (OV_EINVAL)
+ 0) EOF
+ n) number of samples of PCM actually returned. The
+ below works on a packet-by-packet basis, so the
+ return length is not related to the 'length' passed
+ in, just guaranteed to fit.
+
+ *section) set to the logical bitstream number */
+
+long ov_read_fixed(OggVorbis_File *vf,ogg_int32_t ***pcm_channels,int length,
+ int *bitstream){
+ if(vf->ready_state<OPENED)return(OV_EINVAL);
+
+#if CONFIG_CPU == MCF5249
+ mcf5249_init_mac();
+#endif
+
+ while(1){
+ if(vf->ready_state==INITSET){
+ ogg_int32_t **pcm;
+ long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
+ if(samples){
+ if(pcm_channels)*pcm_channels=pcm;
+ if(samples>length)samples=length;
+ vorbis_synthesis_read(&vf->vd,samples);
+ vf->pcm_offset+=samples;
+ if(bitstream)*bitstream=vf->current_link;
+ return samples;
+
+ }
+ }
+
+ /* suck in another packet */
+ {
+ int ret=_fetch_and_process_packet(vf,1,1);
+ if(ret==OV_EOF)return(0);
+ if(ret<=0)return(ret);
+ }
+ }
+}