Browse code

fixes transcoding to vorbis with ffmpeg on big endian machines patch by (Sigbjørn Skjæret {sskjer-1 broadpark no})

Originally committed as revision 3759 to svn://svn.ffmpeg.org/ffmpeg/trunk

Sigbjørn Skjæret authored on 2004/12/19 01:20:42
Showing 1 changed files
... ...
@@ -102,18 +102,18 @@ static int oggvorbis_encode_frame(AVCodecContext *avccontext,
102 102
     OggVorbisContext *context = avccontext->priv_data ;
103 103
     float **buffer ;
104 104
     ogg_packet op ;
105
-    signed char *audio = data ;
105
+    signed short *audio = data ;
106 106
     int l, samples = data ? OGGVORBIS_FRAME_SIZE : 0;
107 107
 
108 108
     buffer = vorbis_analysis_buffer(&context->vd, samples) ;
109 109
 
110 110
     if(context->vi.channels == 1) {
111 111
 	for(l = 0 ; l < samples ; l++)
112
-	    buffer[0][l]=((audio[l*2+1]<<8)|(0x00ff&(int)audio[l*2]))/32768.f;
112
+	    buffer[0][l]=audio[l]/32768.f;
113 113
     } else {
114 114
 	for(l = 0 ; l < samples ; l++){
115
-	    buffer[0][l]=((audio[l*4+1]<<8)|(0x00ff&(int)audio[l*4]))/32768.f;
116
-	    buffer[1][l]=((audio[l*4+3]<<8)|(0x00ff&(int)audio[l*4+2]))/32768.f;
115
+	    buffer[0][l]=audio[l*2]/32768.f;
116
+	    buffer[1][l]=audio[l*2+1]/32768.f;
117 117
 	}
118 118
     }
119 119