summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rotord/libavaudioloader.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/rotord/libavaudioloader.cpp b/rotord/libavaudioloader.cpp
index a894727..a634740 100644
--- a/rotord/libavaudioloader.cpp
+++ b/rotord/libavaudioloader.cpp
@@ -164,7 +164,7 @@ uint16_t* libav::Audioloader::get_samples(int num){ //presumes 16bpc here
sample_end=sample_start;
while (sample_end<num) {
- frame=get_frame();
+ frame=get_frame();
if (frame) {
channels=av_frame_get_channels(frame); //will always reach here 1st
if (((sample_end+std::max(num,frame->nb_samples))*channels)>buffer.size()){
@@ -176,8 +176,25 @@ uint16_t* libav::Audioloader::get_samples(int num){ //presumes 16bpc here
}
for (int i=0;i<frame->nb_samples;i++) {
for (int j=0;j<channels;j++) {
- buffer[((sample_end+i)*frame->channels)+j]= ((uint16_t*) frame->buf[j]->data)[i];
-
+ //int frame->format
+ //format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames, enum AVSampleFormat for audio)
+ int ff=frame->format;
+ //uint64_t frame->channel_layout
+ //Channel layout of the audio data.
+ uint64_t fcl=frame->channel_layout;
+ //int frame->nb_extended_buf
+ //Number of elements in extended_buf.
+ int fnb=frame->nb_extended_buf;
+ //int frame->decode_error_flags
+ //decode error flags of the frame, set to a combination of FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there were errors during the decoding.
+ int fde=frame->decode_error_flags;
+
+
+ //uint16_t s=((uint16_t*) frame->buf[j]->data)[i];
+ uint16_t s=((uint16_t*) frame->buf[0]->data)[j*channels+i];
+ //which? must be determined by format or layout of the channels
+ //ALSO some kind of HEINOUS memory leak??
+ buffer[((sample_end+i)*frame->channels)+j]=s;
//buffer[(j*frame->channels)+(sample_end+i)]= ((uint16_t*) frame->buf[j]->data)[i]; ??planar?? nope
}
}
@@ -193,7 +210,7 @@ uint16_t* libav::Audioloader::get_samples(int num){ //presumes 16bpc here
}
//std::cerr<<"filling buffer to "<<((sample_end+frame->nb_samples)*frame->channels)<<std::endl;
-
+
//avcodec_free_frame(&frame);
}
if (sample_end>num) {