Skip to content

Commit

Permalink
fix build error etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed May 7, 2015
1 parent 030ab12 commit 4b0643f
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/QtAV/AVDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ class Q_AV_EXPORT AVDecoder : public QObject
Q_SIGNALS:
void error(const QtAV::AVError& e); //explictly use QtAV::AVError in connection for Qt4 syntax
void descriptionChanged();
virtual void codecNameChanged();
protected:
AVDecoder(AVDecoderPrivate& d);
DPTR_DECLARE(AVDecoder)
// force a codec. only used by avcodec sw decoders
void setCodecName(const QString& name);
QString codecName() const;
virtual void codecNameChanged() {}
private:
Q_DISABLE_COPY(AVDecoder)
AVDecoder(); // base class, not direct create. only final class has is enough
Expand Down
3 changes: 2 additions & 1 deletion src/QtAV/VideoCapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ class Q_AV_EXPORT VideoCapture : public QObject
void setCaptureDir(const QString& value);
QString captureDir() const;
public Q_SLOTS:
void request();
void capture();
QTAV_DEPRECATED void request();
Q_SIGNALS:
void requested();
/*use it to popup a dialog for selecting dir, name etc. TODO: block avthread if not async*/
Expand Down
1 change: 0 additions & 1 deletion src/QtAV/VideoDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <QtAV/VideoFrame.h>

class QSize;
struct SwsContext;
namespace QtAV {

typedef int VideoDecoderId;
Expand Down
3 changes: 0 additions & 3 deletions src/QtAV/private/AVDecoder_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

#include <QtCore/QByteArray>
#include <QtCore/QHash>
#include <QtCore/QMutex>
#include <QtCore/QThread>
#include "QtAV/private/AVCompat.h"

namespace QtAV {
Expand Down Expand Up @@ -55,7 +53,6 @@ class Q_AV_PRIVATE_EXPORT AVDecoderPrivate : public DPtrPrivate<AVDecoder>
bool available; //TODO: true only when context(and hw ctx) is ready
bool is_open;
int undecoded_size;
QMutex mutex;
QString codec_name;
QVariantHash options;
AVDictionary *dict;
Expand Down
18 changes: 7 additions & 11 deletions src/codec/AVDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ namespace QtAV {
AVDecoder::AVDecoder(AVDecoderPrivate &d)
:DPTR_INIT(&d)
{
class AVInitializer {
public:
AVInitializer() {
qDebug("avcodec_register_all");
avcodec_register_all();
}
};
static AVInitializer sAVInit;
Q_UNUSED(sAVInit);
avcodec_register_all(); // avcodec_find_decoder will always be used
}

AVDecoder::~AVDecoder()
Expand Down Expand Up @@ -165,7 +157,11 @@ AVCodecContext* AVDecoder::codecContext() const

void AVDecoder::setCodecName(const QString &name)
{
d_func().codec_name = name;
DPTR_D(AVDecoder);
if (d.codec_name == name)
return;
d.codec_name = name;
Q_EMIT codecNameChanged();
}

QString AVDecoder::codecName() const
Expand Down Expand Up @@ -224,7 +220,7 @@ void AVDecoder::setOptions(const QVariantHash &dict)
else if (dict.contains(name().toLower()))
opt = dict.value(name().toLower());
else
return;
return; // TODO: set property if no name() key found?
if (opt.type() == QVariant::Hash) {
QVariantHash property_dict(opt.toHash());
if (property_dict.isEmpty())
Expand Down
4 changes: 3 additions & 1 deletion src/codec/audio/AudioDecoderFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ class AudioDecoderFFmpegPrivate : public AudioDecoderPrivate
AudioDecoderFFmpegPrivate()
: AudioDecoderPrivate()
, frame(av_frame_alloc())
{}
{
avcodec_register_all();
}
~AudioDecoderFFmpegPrivate() {
if (frame) {
av_frame_free(&frame);
Expand Down
1 change: 1 addition & 0 deletions src/codec/video/VideoDecoderFFmpegBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class VideoDecoderFFmpegBasePrivate : public VideoDecoderPrivate
: VideoDecoderPrivate()
, frame(0)
{
avcodec_register_all();
frame = av_frame_alloc();
}
virtual ~VideoDecoderFFmpegBasePrivate() {
Expand Down

0 comments on commit 4b0643f

Please sign in to comment.