Skip to content

Commit

Permalink
use codec_name instead of name for AVDecoder to avoid ambigulty
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed May 16, 2014
1 parent 8995ecc commit f67725a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/AVDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ bool AVDecoder::open()
return false;
}
AVCodec *codec = 0;
if (!d.name.isEmpty()) {
codec = avcodec_find_decoder_by_name(d.name.toUtf8().constData());
if (!d.codec_name.isEmpty()) {
codec = avcodec_find_decoder_by_name(d.codec_name.toUtf8().constData());
} else {
codec = avcodec_find_decoder(d.codec_ctx->codec_id);
}
if (!codec) {
if (d.name.isEmpty()) {
if (d.codec_name.isEmpty()) {
qWarning("No codec could be found with id %d", d.codec_ctx->codec_id);
} else {
qWarning("No codec could be found with name %s", d.name.toUtf8().constData());
qWarning("No codec could be found with name %s", d.codec_name.toUtf8().constData());
}
return false;
}
Expand Down Expand Up @@ -205,14 +205,14 @@ void AVDecoder::setLowResolution(int lowres)

void AVDecoder::setCodecName(const QString &name)
{
d_func().name = name;
d_func().codec_name = name;
}

QString AVDecoder::codecName() const
{
DPTR_D(const AVDecoder);
if (!d.name.isEmpty())
return d.name;
if (!d.codec_name.isEmpty())
return d.codec_name;
if (d.codec_ctx)
return d.codec_ctx->codec->name;
return "";
Expand Down
2 changes: 1 addition & 1 deletion src/QtAV/private/AVDecoder_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Q_AV_EXPORT AVDecoderPrivate : public DPtrPrivate<AVDecoder>
int threads;
bool thread_slice;
int low_resolution;
QString name;
QString codec_name;
QVariantHash options;
AVDictionary *dict;
};
Expand Down

0 comments on commit f67725a

Please sign in to comment.