| | |
| | | #include "audio.h" |
| | | #include "precomp.h" |
| | | |
| | | |
| | | #if defined(__APPLE__) |
| | | #include <string.h> |
| | | #else |
| | | |
| | | extern "C" { |
| | | #include <libavutil/opt.h> |
| | | #include <libavcodec/avcodec.h> |
| | |
| | | #include <libavutil/samplefmt.h> |
| | | #include <libswresample/swresample.h> |
| | | } |
| | | |
| | | #endif |
| | | |
| | | |
| | | |
| | | using namespace std; |
| | | |
| | |
| | | } |
| | | |
| | | bool Audio::FfmpegLoad(const char *filename, bool copy2char){ |
| | | #if defined(__APPLE__) |
| | | return false; |
| | | #else |
| | | // from file |
| | | AVFormatContext* formatContext = avformat_alloc_context(); |
| | | if (avformat_open_input(&formatContext, filename, NULL, NULL) != 0) { |
| | |
| | | } |
| | | else |
| | | return false; |
| | | |
| | | #endif |
| | | } |
| | | |
| | | bool Audio::FfmpegLoad(const char* buf, int n_file_len){ |
| | | #if defined(__APPLE__) |
| | | return false; |
| | | #else |
| | | // from buf |
| | | char* buf_copy = (char *)malloc(n_file_len); |
| | | memcpy(buf_copy, buf, n_file_len); |
| | |
| | | } |
| | | else |
| | | return false; |
| | | |
| | | #endif |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | }else if(speech_end_i != -1){ // [-1,100] |
| | | if(speech_start == -1 or speech_offline_start == -1){ |
| | | LOG(ERROR) <<"Vad start is null while vad end is available." ; |
| | | exit(-1); |
| | | LOG(ERROR) <<"Vad start is null while vad end is available. Set vad start 0" ; |
| | | speech_start = 0; |
| | | } |
| | | |
| | | int start = speech_start*seg_sample; |
| | |
| | | |
| | | } |
| | | |
| | | } // namespace funasr |
| | | } // namespace funasr |