Skip to content

Commit

Permalink
Merge pull request wang-bin#916 from cculianu/master
Browse files Browse the repository at this point in the history
Added muxer stream_index key to internalAudioTracks, internalVideoTracks, externalAudioTracks in AVPlayer and misc other fixups
  • Loading branch information
wang-bin authored Jul 4, 2017
2 parents 90d5c79 + bfb6a76 commit 3360595
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
1 change: 0 additions & 1 deletion qml/QmlAV/QmlAVPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ class QmlAVPlayer : public QObject, public QQmlParserStatus
int audioTrack() const;
void setAudioTrack(int value);
QVariantList internalAudioTracks() const;
/*!
/*!
* \brief videoTrack
* The video stream number in current media.
Expand Down
2 changes: 2 additions & 0 deletions src/AVPlayerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ QVariantList AVPlayer::Private::getTracksInfo(AVDemuxer *demuxer, AVDemuxer::Str
QVariantMap t;
t[QStringLiteral("id")] = info.size();
t[QStringLiteral("file")] = demuxer->fileName();
t[QStringLiteral("stream_index")] = QVariant(s);

AVStream *stream = demuxer->formatContext()->streams[s];
AVCodecContext *ctx = stream->codec;
if (ctx) {
Expand Down
20 changes: 19 additions & 1 deletion src/QtAV/AVPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,30 @@ class Q_AV_EXPORT AVPlayer : public QObject
/*!
* \brief externalAudioTracks
* A list of QVariantMap. Using QVariantMap and QVariantList is mainly for QML support.
* [ {id: 0, file: abc.dts, language: eng, title: xyz}, ...]
* [ {id: 0, stream_index: 2, file: abc.dts, language: eng, title: xyz}, ...]
* id: used for setAudioStream(id)
* stream_index: the actual muxer stream index -- not used by API to this class but possibly
* useful for interop with external libs that require absolute stream_index
* \sa externalAudioTracksChanged
*/
const QVariantList& externalAudioTracks() const;
/*!
* \brief internalAudioTracks
* A list of QVariantMap. Using QVariantMap and QVariantList is mainly for QML support.
* [ {id: 0, stream_index: 2, file: abc.dts, language: eng, title: xyz}, ...]
* id: used for setAudioStream(id)
* stream_index: the actual muxer stream index -- not used by API to this class but possibly
* useful for interop with external libs that require absolute stream_index
*/
const QVariantList& internalAudioTracks() const;
/*!
* \brief internalVideoTracks
* A list of QVariantMap. Using QVariantMap and QVariantList is mainly for QML support.
* [ {id: 0, stream_index: 2, file: abc.dts, language: eng, title: xyz}, ...]
* id: used for setAudioStream(id)
* stream_index: the actual muxer stream index -- not used by API to this class but possibly
* useful for interop with external libs that require absolute stream_index
*/
const QVariantList& internalVideoTracks() const;
/*!
* \brief setAudioStream
Expand Down
2 changes: 1 addition & 1 deletion src/QtAV/EncodeFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Q_SLOTS:
void frameEncoded(const QtAV::Packet& packet);
void startTimeChanged(qint64 value);
// internal use only
void requestToEncode(const AudioFrame& frame);
void requestToEncode(const QtAV::AudioFrame& frame);
protected Q_SLOTS:
void encode(const QtAV::AudioFrame& frame = AudioFrame());
protected:
Expand Down
10 changes: 9 additions & 1 deletion src/filter/EncodeFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ class AudioEncodeFilterPrivate Q_DECL_FINAL : public AudioFilterPrivate
AudioEncodeFilter::AudioEncodeFilter(QObject *parent)
: AudioFilter(*new AudioEncodeFilterPrivate(), parent)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
connect(this, SIGNAL(requestToEncode(QtAV::AudioFrame)), this, SLOT(encode(QtAV::AudioFrame)));
#else
connect(this, &AudioEncodeFilter::requestToEncode, this, &AudioEncodeFilter::encode);
#endif
connect(this, SIGNAL(finished()), &d_func().enc_thread, SLOT(quit()));
}

Expand Down Expand Up @@ -204,7 +208,11 @@ class VideoEncodeFilterPrivate Q_DECL_FINAL : public VideoFilterPrivate
VideoEncodeFilter::VideoEncodeFilter(QObject *parent)
: VideoFilter(*new VideoEncodeFilterPrivate(), parent)
{
connect(this, SIGNAL(requestToEncode(QtAV::VideoFrame)), this, SLOT(encode(QtAV::VideoFrame)));
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
connect(this, SIGNAL(requestToEncode(QtAV::VideoFrame)), this, SLOT(encode(QtAV::VideoFrame)));
#else
connect(this, &VideoEncodeFilter::requestToEncode, this, &VideoEncodeFilter::encode);
#endif
connect(this, SIGNAL(finished()), &d_func().enc_thread, SLOT(quit()));
}

Expand Down

0 comments on commit 3360595

Please sign in to comment.