Miam-Player  0.8.0
A nice music player
PlayerSubtitle.h
Go to the documentation of this file.
1 /******************************************************************************
2  QtAV: Multimedia framework based on Qt and FFmpeg
3  Copyright (C) 2012-2016 Wang Bin <wbsecg1@gmail.com>
4 
5 * This file is part of QtAV (from 2014)
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 ******************************************************************************/
21 
22 #ifndef QTAV_PLAYERSUBTITLE_H
23 #define QTAV_PLAYERSUBTITLE_H
24 
25 #include <QtCore/QObject>
26 #include <QtCore/QVariant>
27 #include <QtCore/QVector>
28 #include <QtAV/QtAV_Global.h>
29 #include <QtAV/Packet.h>
30 
31 namespace QtAV {
32 
33 class AVPlayer;
34 class Subtitle;
40 class Q_AV_PRIVATE_EXPORT PlayerSubtitle : public QObject
41 {
42  Q_OBJECT
43 public:
44  PlayerSubtitle(QObject *parent = 0);
45  void setPlayer(AVPlayer* player);
46  Subtitle* subtitle();
51  void setFile(const QString& file);
52  QString file() const;
57  void setAutoLoad(bool value);
58  bool autoLoad() const;
59 Q_SIGNALS:
60  void autoLoadChanged(bool value);
61  void fileChanged();
62 public Q_SLOTS:
63  void onEnabledChanged(bool value);
64 private Q_SLOTS:
65  void onPlayerSourceChanged();
66  void onPlayerPositionChanged();
67  void onPlayerStart();
68  void tryReload();
69  void tryReloadInternalSub();
70  void updateInternalSubtitleTracks(const QVariantList& tracks);
71  void processInternalSubtitlePacket(int track, const QtAV::Packet& packet);
72  void processInternalSubtitleHeader(const QByteArray &codec, const QByteArray& data); //TODO: remove
73 private:
74  void connectSignals();
75  void disconnectSignals();
76  void tryReload(int flag); //1: internal, 2: external, 3: internal+external
77 private:
78  bool m_auto;
79  bool m_enabled; // TODO: m_enable_external
80  AVPlayer *m_player;
81  Subtitle *m_sub;
82  QString m_file;
83  QVariantList m_tracks;
84  QVector<Packet> m_current_pkt;
85 };
86 
87 }
88 #endif // QTAV_PLAYERSUBTITLE_H
The PlayerSubtitle class Bind Subtitle to AVPlayer.
Definition: PlayerSubtitle.h:40
#define Q_AV_PRIVATE_EXPORT
Definition: QtAV_Global.h:43
Definition: Subtitle.h:50
Definition: Packet.h:33
The AVPlayer class Preload:
Definition: AVPlayer.h:62
AudioOutput ao; ao.setAudioFormat(fmt); ao.open(); while (has_data) { data = read_data(ao->bufferSize...
Definition: AudioDecoder.h:31