|
|
@ -28,6 +28,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include "avcodec.h" |
|
|
|
#include "avcodec.h" |
|
|
|
#include "bytestream.h" |
|
|
|
#include "bytestream.h" |
|
|
|
|
|
|
|
#include "vorbis.h" |
|
|
|
|
|
|
|
|
|
|
|
#undef NDEBUG |
|
|
|
#undef NDEBUG |
|
|
|
#include <assert.h> |
|
|
|
#include <assert.h> |
|
|
@ -146,16 +147,14 @@ static int oggvorbis_encode_frame(AVCodecContext *avccontext, |
|
|
|
if(data) { |
|
|
|
if(data) { |
|
|
|
int samples = OGGVORBIS_FRAME_SIZE; |
|
|
|
int samples = OGGVORBIS_FRAME_SIZE; |
|
|
|
float **buffer ; |
|
|
|
float **buffer ; |
|
|
|
|
|
|
|
int c, channels = context->vi.channels; |
|
|
|
|
|
|
|
|
|
|
|
buffer = vorbis_analysis_buffer(&context->vd, samples) ; |
|
|
|
buffer = vorbis_analysis_buffer(&context->vd, samples) ; |
|
|
|
if(context->vi.channels == 1) { |
|
|
|
for (c = 0; c < channels; c++) { |
|
|
|
|
|
|
|
int co = (channels > 8) ? c : |
|
|
|
|
|
|
|
ff_vorbis_encoding_channel_layout_offsets[channels-1][c]; |
|
|
|
for(l = 0 ; l < samples ; l++) |
|
|
|
for(l = 0 ; l < samples ; l++) |
|
|
|
buffer[0][l]=audio[l]/32768.f; |
|
|
|
buffer[c][l]=audio[l*channels+co]/32768.f; |
|
|
|
} else { |
|
|
|
|
|
|
|
for(l = 0 ; l < samples ; l++){ |
|
|
|
|
|
|
|
buffer[0][l]=audio[l*2]/32768.f; |
|
|
|
|
|
|
|
buffer[1][l]=audio[l*2+1]/32768.f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
vorbis_analysis_wrote(&context->vd, samples) ; |
|
|
|
vorbis_analysis_wrote(&context->vd, samples) ; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|