all repos — mgba @ eab30ebf0583df2e2fc388e3b03481b3f87bd281

mGBA Game Boy Advance Emulator

Video: Consolidate state initialization
Jeffrey Pfau jeffrey@endrift.com
Tue, 28 Oct 2014 02:53:52 -0700
commit

eab30ebf0583df2e2fc388e3b03481b3f87bd281

parent

c101703b202775d5779e172810be21c10ad6912c

1 files changed, 5 insertions(+), 8 deletions(-)

jump to
M src/platform/ffmpeg/ffmpeg-encoder.csrc/platform/ffmpeg/ffmpeg-encoder.c

@@ -27,9 +27,6 @@ encoder->containerFormat = 0;

FFmpegEncoderSetAudio(encoder, "flac", 0); FFmpegEncoderSetVideo(encoder, "png", 0); FFmpegEncoderSetContainer(encoder, "matroska"); - encoder->currentAudioSample = 0; - encoder->currentAudioFrame = 0; - encoder->currentVideoFrame = 0; encoder->context = 0; }

@@ -165,6 +162,11 @@ if (!acodec || !vcodec || !FFmpegEncoderVerifyContainer(encoder)) {

return false; } + encoder->currentAudioSample = 0; + encoder->currentAudioFrame = 0; + encoder->currentVideoFrame = 0; + encoder->nextAudioPts = 0; + avformat_alloc_output_context2(&encoder->context, 0, 0, outfile); encoder->context->oformat = av_guess_format(encoder->containerFormat, 0, 0);

@@ -254,11 +256,6 @@ sws_freeContext(encoder->scaleContext);

avformat_free_context(encoder->context); encoder->context = 0; - - encoder->currentAudioSample = 0; - encoder->currentAudioFrame = 0; - encoder->nextAudioPts = 0; - encoder->currentVideoFrame = 0; } void _ffmpegPostAudioFrame(struct GBAAVStream* stream, int32_t left, int32_t right) {