Skip to content

Commit

Permalink
Initialise ffmpeg libavformat in spdif muxer constructor.
Browse files Browse the repository at this point in the history
SPDIFEncoder requires libavformat to be properly initialised, so do so in the constructor.
  • Loading branch information
jyavenard committed Dec 23, 2010
1 parent 7295e55 commit fc5f185
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mythtv/libs/libmyth/spdifencoder.cpp
@@ -1,5 +1,7 @@
#include "config.h"

#include "mythcorecontext.h"

#include "compat.h"
#include "spdifencoder.h"
#include "mythverbose.h"
Expand All @@ -22,7 +24,7 @@ SPDIFEncoder::SPDIFEncoder(QString muxer, AVCodecContext *ctx)
QByteArray dev_ba = muxer.toAscii();
AVOutputFormat *fmt;

if (!(av_guess_format && avformat_alloc_context &&
if (!(av_register_all && av_guess_format && avformat_alloc_context &&
av_new_stream && av_write_header && av_write_frame &&
av_write_trailer && av_set_parameters))
{
Expand All @@ -42,6 +44,10 @@ SPDIFEncoder::SPDIFEncoder(QString muxer, AVCodecContext *ctx)
return;
}

avcodeclock->lock();
av_register_all();
avcodeclock->unlock();

fmt = av_guess_format(dev_ba.constData(), NULL, NULL);
if (!fmt)
{
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmyth/spdifencoder.h
Expand Up @@ -11,6 +11,7 @@ extern "C" {
#include "libavcodec/audioconvert.h"
}

#pragma weak av_register_all
#pragma weak av_guess_format
#pragma weak avformat_alloc_context
#pragma weak av_new_stream
Expand Down

0 comments on commit fc5f185

Please sign in to comment.