"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/AV/Output/AudioEncoder.cpp" between
ssr-0.3.10.tar.gz and ssr-0.3.11.tar.gz

About: SimpleScreenRecorder is a screen (video-audio) recorder for Linux.

AudioEncoder.cpp  (ssr-0.3.10):AudioEncoder.cpp  (ssr-0.3.11)
skipping to change at line 61 skipping to change at line 61
StartThread(); StartThread();
} }
AudioEncoder::~AudioEncoder() { AudioEncoder::~AudioEncoder() {
StopThread(); StopThread();
} }
unsigned int AudioEncoder::GetFrameSize() { unsigned int AudioEncoder::GetFrameSize() {
#if SSR_USE_AVCODEC_ENCODE_AUDIO2 #if SSR_USE_AVCODEC_ENCODE_AUDIO2
return (GetCodecContext()->codec->capabilities & CODEC_CAP_VARIABLE_FRAME _SIZE)? DEFAULT_FRAME_SAMPLES : GetCodecContext()->frame_size; return (GetCodecContext()->codec->capabilities & AV_CODEC_CAP_VARIABLE_FR AME_SIZE)? DEFAULT_FRAME_SAMPLES : GetCodecContext()->frame_size;
#else #else
return (GetCodecContext()->frame_size <= 1)? DEFAULT_FRAME_SAMPLES : GetC odecContext()->frame_size; return (GetCodecContext()->frame_size <= 1)? DEFAULT_FRAME_SAMPLES : GetC odecContext()->frame_size;
#endif #endif
} }
AVSampleFormat AudioEncoder::GetSampleFormat() { AVSampleFormat AudioEncoder::GetSampleFormat() {
return GetCodecContext()->sample_fmt; return GetCodecContext()->sample_fmt;
} }
unsigned int AudioEncoder::GetChannels() { unsigned int AudioEncoder::GetChannels() {
skipping to change at line 110 skipping to change at line 110
Logger::LogError("[AudioEncoder::PrepareStream] " + Logger::tr("E rror: Channel count is zero.")); Logger::LogError("[AudioEncoder::PrepareStream] " + Logger::tr("E rror: Channel count is zero."));
throw LibavException(); throw LibavException();
} }
if(sample_rate == 0) { if(sample_rate == 0) {
Logger::LogError("[AudioEncoder::PrepareStream] " + Logger::tr("E rror: Sample rate is zero.")); Logger::LogError("[AudioEncoder::PrepareStream] " + Logger::tr("E rror: Sample rate is zero."));
throw LibavException(); throw LibavException();
} }
codec_context->bit_rate = bit_rate; codec_context->bit_rate = bit_rate;
codec_context->channels = channels; codec_context->channels = channels;
codec_context->channel_layout = (channels == 1)? AV_CH_LAYOUT_MONO : AV_C H_LAYOUT_STEREO;
codec_context->sample_rate = sample_rate; codec_context->sample_rate = sample_rate;
codec_context->time_base.num = 1; codec_context->time_base.num = 1;
codec_context->time_base.den = sample_rate; codec_context->time_base.den = sample_rate;
#if SSR_USE_AVSTREAM_TIME_BASE #if SSR_USE_AVSTREAM_TIME_BASE
stream->time_base = codec_context->time_base; stream->time_base = codec_context->time_base;
#endif #endif
codec_context->thread_count = 1; codec_context->thread_count = 1;
// parse options // parse options
QString sample_format_name; QString sample_format_name;
for(unsigned int i = 0; i < codec_options.size(); ++i) { for(unsigned int i = 0; i < codec_options.size(); ++i) {
const QString &key = codec_options[i].first, &value = codec_optio ns[i].second; const QString &key = codec_options[i].first, &value = codec_optio ns[i].second;
if(key == "threads") { if(key == "threads") {
codec_context->thread_count = ParseCodecOptionInt(key, va lue, 1, 100); codec_context->thread_count = ParseCodecOptionInt(key, va lue, 1, 100);
} else if(key == "qscale") { } else if(key == "qscale") {
codec_context->flags |= CODEC_FLAG_QSCALE; codec_context->flags |= AV_CODEC_FLAG_QSCALE;
codec_context->global_quality = lrint(ParseCodecOptionDou ble(key, value, -1.0e6, 1.0e6, FF_QP2LAMBDA)); codec_context->global_quality = lrint(ParseCodecOptionDou ble(key, value, -1.0e6, 1.0e6, FF_QP2LAMBDA));
} else if(key == "sampleformat") { } else if(key == "sampleformat") {
sample_format_name = value; sample_format_name = value;
} else { } else {
av_dict_set(options, key.toUtf8().constData(), value.toUt f8().constData(), 0); av_dict_set(options, key.toUtf8().constData(), value.toUt f8().constData(), 0);
} }
} }
// choose the sample format // choose the sample format
codec_context->sample_fmt = AV_SAMPLE_FMT_NONE; codec_context->sample_fmt = AV_SAMPLE_FMT_NONE;
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)