diff options
| author | Tim Redfern <tim@herge.(none)> | 2013-04-24 18:48:25 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@herge.(none)> | 2013-04-24 18:48:25 +0100 |
| commit | 740768a0d6b13ecc3eb68219f6eee208ab4ecc1d (patch) | |
| tree | ec8265f3f4c248736c083df3347baff0bbe1ed07 | |
| parent | c4edc9359dd6cfb0836d0d370fe008f308bc0156 (diff) | |
tinkering with audio speed
| -rw-r--r-- | rotord/libavaudioloader.cpp | 4 | ||||
| -rw-r--r-- | rotord/libavexporter.h | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/rotord/libavaudioloader.cpp b/rotord/libavaudioloader.cpp index b842a42..b9beabc 100644 --- a/rotord/libavaudioloader.cpp +++ b/rotord/libavaudioloader.cpp @@ -179,9 +179,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; for (int i=0;i<frame->nb_samples;i++) { for (int j=0;j<av_frame_get_channels(frame);j++) { - uint16_t s=((uint16_t*) frame->buf[j]->data)[i]; - //uint16_t s=frame->buf[j]->data[i*2]+((frame->buf[j]->data)[i*2+1]<<8); - buffer[((sample_end+i)*frame->channels)+j]= s; + buffer[((sample_end+i)*frame->channels)+j]= ((uint16_t*) frame->buf[j]->data)[i]; } } sample_end+=frame->nb_samples; diff --git a/rotord/libavexporter.h b/rotord/libavexporter.h index fd2da93..24b656c 100644 --- a/rotord/libavexporter.h +++ b/rotord/libavexporter.h @@ -29,6 +29,11 @@ * @example doc/examples/muxing.c */ + + // + //http://stackoverflow.com/questions/14871916/can-i-concurrently-read-an-earlier-section-of-an-mp4-file-while-streaming-writin + // + #include <stdlib.h> #include <stdio.h> #include <string> @@ -208,12 +213,15 @@ namespace libav { sampleptr=new uint8_t[bufsize]; memset(sampleptr,0,bufsize); } + avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, sampleptr, audio_input_frame_size * av_get_bytes_per_sample(c->sample_fmt) * - c->channels, 1); - + c->channels, 0); //; + //frame->sample_rate=44100; //hard coded input rate- nope, this doesn't help + //frame->format=AV_SAMPLE_FMT_S16P; + //?? why is ffmpeg reporting fltp as the sample format??? doesn't seem to have an effect to change this though ret = avcodec_encode_audio2(c, &pkt, frame, &got_packet); if (!samples) { free(sampleptr); |
