Lines 40-45
Link Here
|
40 |
#include <libavcodec/avcodec.h> |
40 |
#include <libavcodec/avcodec.h> |
41 |
#include <libavformat/avformat.h> |
41 |
#include <libavformat/avformat.h> |
42 |
#include <libavformat/avio.h> |
42 |
#include <libavformat/avio.h> |
|
|
43 |
#include <libavutil/mathematics.h> |
44 |
#include <libavutil/avstring.h> |
43 |
#include "ffmpeg_compat.h" |
45 |
#include "ffmpeg_compat.h" |
44 |
} |
46 |
} |
45 |
|
47 |
|
Lines 57-66
Link Here
|
57 |
{ |
58 |
{ |
58 |
static const char* formats[] = { NULL, "ac3", "flac", "matroska", "mp2", "mp3", "ogg", "wav" }; |
59 |
static const char* formats[] = { NULL, "ac3", "flac", "matroska", "mp2", "mp3", "ogg", "wav" }; |
59 |
|
60 |
|
60 |
if(avformat_alloc_output_context2(&m_formatCtx, NULL, formats[format], filename.c_str())) |
61 |
m_formatCtx = avformat_alloc_context(); |
61 |
AUD_THROW(AUD_ERROR_FFMPEG, context_error); |
62 |
if (!m_formatCtx) AUD_THROW(AUD_ERROR_FFMPEG, context_error); |
62 |
|
63 |
|
63 |
m_outputFmt = m_formatCtx->oformat; |
64 |
av_strlcpy(m_formatCtx->filename, filename.c_str(), sizeof(m_formatCtx->filename)); |
|
|
65 |
m_outputFmt = m_formatCtx->oformat = av_guess_format(formats[format], filename.c_str(), NULL); |
66 |
if (!m_outputFmt) { |
67 |
avformat_free_context(m_formatCtx); |
68 |
AUD_THROW(AUD_ERROR_FFMPEG, context_error); |
69 |
} |
64 |
|
70 |
|
65 |
switch(codec) |
71 |
switch(codec) |
66 |
{ |
72 |
{ |