Miam-Player  0.8.0
A nice music player
Frame.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
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_FRAME_H
23 #define QTAV_FRAME_H
24 
25 #include <QtAV/QtAV_Global.h>
26 #include <QtCore/QVariant>
27 #include <QtCore/QSharedData>
28 
29 // TODO: fromAVFrame() asAVFrame()?
30 namespace QtAV {
31 
32 class FramePrivate;
34 {
35  Q_DECLARE_PRIVATE(Frame)
36 public:
37  Frame(const Frame& other);
38  virtual ~Frame() = 0;
39  Frame& operator =(const Frame &other);
48  int planeCount() const;
55  virtual int channelCount() const;
62  int bytesPerLine(int plane = 0) const;
63  // the whole frame data. may be empty unless clone() or allocate is called
64  QByteArray frameData() const;
65  // deep copy 1 plane data
66  QByteArray data(int plane = 0) const;
67  uchar* bits(int plane = 0);
68  const uchar *bits(int plane = 0) const { return constBits(plane);}
69  const uchar* constBits(int plane = 0) const;
76  // TODO: const?
77  void setBits(uchar *b, int plane = 0);
78  void setBits(const QVector<uchar*>& b);
79  void setBits(quint8 *slice[]);
84  void setBytesPerLine(int lineSize, int plane = 0);
85  void setBytesPerLine(const QVector<int>& lineSize);
86  void setBytesPerLine(int stride[]);
87 
88  QVariantMap availableMetaData() const;
89  QVariant metaData(const QString& key) const;
90  void setMetaData(const QString &key, const QVariant &value);
91  void setTimestamp(qreal ts);
92  qreal timestamp() const;
93  inline void swap(Frame &other) { qSwap(d_ptr, other.d_ptr); }
94 
95 protected:
96  Frame(FramePrivate *d);
97  QExplicitlySharedDataPointer<FramePrivate> d_ptr;
98 };
99 
100 } //namespace QtAV
101 
102 #endif // QTAV_FRAME_H
Definition: Frame.h:33
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
const uchar * bits(int plane=0) const
Definition: Frame.h:68
void swap(Frame &other)
Definition: Frame.h:93
AudioOutput ao; ao.setAudioFormat(fmt); ao.open(); while (has_data) { data = read_data(ao->bufferSize...
Definition: AudioDecoder.h:31
Definition: Frame_p.h:33
unsigned char uchar
Definition: taglib.h:66
QExplicitlySharedDataPointer< FramePrivate > d_ptr
Definition: Frame.h:97