Miam-Player  0.8.0
A nice music player
SubImage.h
Go to the documentation of this file.
1 /******************************************************************************
2  QtAV: Multimedia framework based on Qt and LibASS
3  Copyright (C) 2012-2016 Wang Bin <wbsecg1@gmail.com>
4 
5 * This file is part of QtAV (from 2016)
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 #ifndef QTAV_SUBIMAGE_H
22 #define QTAV_SUBIMAGE_H
23 
24 #include <QtAV/QtAV_Global.h>
25 #include <QtCore/QVector>
26 
27 namespace QtAV {
32 struct SubImageSet;
34  SubImage(int x = 0, int y = 0, int w = 0, int h = 0, int stride = 0);
35  bool operator ==(const SubImage& o) const {
36  return x == o.x && y == o.y && w == o.w && h == o.h && stride == o.stride && color == o.color && data == o.data;
37  }
38  int x, y;
39  int w, h;
40  int stride;
41  quint32 color; //ass only
42  QByteArray data; //size = stride*h
43 };
44 
46  enum Format { ASS, RGBA, Unknown };
47  SubImageSet(int width = 0, int height = 0, Format format = Unknown);
48  int width() const {return w;}
49  int height() const {return h;}
50  Format format() const {return fmt;}
51  bool isValid() const {return !images.isEmpty() && w > 0 && h > 0 && fmt != Unknown;}
52  void reset(int width = 0, int height = 0, Format format = Unknown) {
53  fmt = format;
54  w = width;
55  h = height;
56  ++id;
57  images.clear();
58  }
59  bool operator ==(const SubImageSet& other) const {
60  return id == other.id && w == other.w && h == other.h && fmt == other.fmt && images == other.images; //TODO: image data
61  }
62  QVector<SubImage> images;
63 private:
64  Format fmt;
65  int w, h;
66  int id;
67 };
68 } //namespace QtAV
69 #endif //QTAV_SUBIMAGE_H
Format
Definition: SubImage.h:46
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
Definition: SubImage.h:33
bool isValid() const
Definition: SubImage.h:51
int height() const
Definition: SubImage.h:49
QByteArray data
Definition: SubImage.h:42
int x
Definition: SubImage.h:38
int h
Definition: SubImage.h:39
Format format() const
Definition: SubImage.h:50
int width() const
Definition: SubImage.h:48
int w
Definition: SubImage.h:39
bool operator==(const TagButton &t1, const TagButton &t2)
Definition: tagbutton.h:61
quint32 color
Definition: SubImage.h:41
int stride
Definition: SubImage.h:40
int y
Definition: SubImage.h:38
Definition: SubImage.h:45
void reset(int width=0, int height=0, Format format=Unknown)
Definition: SubImage.h:52
AudioOutput ao; ao.setAudioFormat(fmt); ao.open(); while (has_data) { data = read_data(ao->bufferSize...
Definition: AudioDecoder.h:31
QVector< SubImage > images
Definition: SubImage.h:62