1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2011 Ricardo Villalba <rvm@escomposlinux.org>
|
---|
3 |
|
---|
4 | This program is free software; you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU General Public License as published by
|
---|
6 | the Free Software Foundation; either version 2 of the License, or
|
---|
7 | (at your option) any later version.
|
---|
8 |
|
---|
9 | This program is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this program; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include "mediadata.h"
|
---|
20 | #include <QFileInfo>
|
---|
21 | #include <cmath>
|
---|
22 |
|
---|
23 |
|
---|
24 | MediaData::MediaData() {
|
---|
25 | reset();
|
---|
26 | }
|
---|
27 |
|
---|
28 | MediaData::~MediaData() {
|
---|
29 | }
|
---|
30 |
|
---|
31 | void MediaData::reset() {
|
---|
32 | filename="";
|
---|
33 | dvd_id="";
|
---|
34 | type = TYPE_UNKNOWN;
|
---|
35 | duration=0;
|
---|
36 |
|
---|
37 | novideo = FALSE;
|
---|
38 |
|
---|
39 | video_width=0;
|
---|
40 | video_height=0;
|
---|
41 | video_aspect= (double) 4/3;
|
---|
42 |
|
---|
43 | #if PROGRAM_SWITCH
|
---|
44 | programs.clear();
|
---|
45 | #endif
|
---|
46 | videos.clear();
|
---|
47 | audios.clear();
|
---|
48 | titles.clear();
|
---|
49 |
|
---|
50 | subs.clear();
|
---|
51 |
|
---|
52 | #if GENERIC_CHAPTER_SUPPORT
|
---|
53 | chapters = 0;
|
---|
54 | #else
|
---|
55 | //chapters=0;
|
---|
56 | //angles=0;
|
---|
57 |
|
---|
58 | mkv_chapters=0;
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | initialized=false;
|
---|
62 |
|
---|
63 | // Clip info;
|
---|
64 | clip_name = "";
|
---|
65 | clip_artist = "";
|
---|
66 | clip_author = "";
|
---|
67 | clip_album = "";
|
---|
68 | clip_genre = "";
|
---|
69 | clip_date = "";
|
---|
70 | clip_track = "";
|
---|
71 | clip_copyright = "";
|
---|
72 | clip_comment = "";
|
---|
73 | clip_software = "";
|
---|
74 |
|
---|
75 | stream_title = "";
|
---|
76 | stream_url = "";
|
---|
77 |
|
---|
78 | // Other data
|
---|
79 | demuxer="";
|
---|
80 | video_format="";
|
---|
81 | audio_format="";
|
---|
82 | video_bitrate=0;
|
---|
83 | video_fps="";
|
---|
84 | audio_bitrate=0;
|
---|
85 | audio_rate=0;
|
---|
86 | audio_nch=0;
|
---|
87 | video_codec="";
|
---|
88 | audio_codec="";
|
---|
89 | }
|
---|
90 |
|
---|
91 | QString MediaData::displayName(bool show_tag) {
|
---|
92 | if (show_tag) {
|
---|
93 | if (!clip_name.isEmpty()) return clip_name;
|
---|
94 | else
|
---|
95 | if (!stream_title.isEmpty()) return stream_title;
|
---|
96 | }
|
---|
97 |
|
---|
98 | QFileInfo fi(filename);
|
---|
99 | if (fi.exists())
|
---|
100 | return fi.fileName(); // filename without path
|
---|
101 | else
|
---|
102 | return filename;
|
---|
103 | }
|
---|
104 |
|
---|
105 |
|
---|
106 | void MediaData::list() {
|
---|
107 | qDebug("MediaData::list");
|
---|
108 |
|
---|
109 | qDebug(" filename: '%s'", filename.toUtf8().data());
|
---|
110 | qDebug(" duration: %f", duration);
|
---|
111 |
|
---|
112 | qDebug(" video_width: %d", video_width);
|
---|
113 | qDebug(" video_height: %d", video_height);
|
---|
114 | qDebug(" video_aspect: %f", video_aspect);
|
---|
115 |
|
---|
116 | qDebug(" type: %d", type);
|
---|
117 | qDebug(" novideo: %d", novideo);
|
---|
118 | qDebug(" dvd_id: '%s'", dvd_id.toUtf8().data());
|
---|
119 |
|
---|
120 | qDebug(" initialized: %d", initialized);
|
---|
121 |
|
---|
122 | #if GENERIC_CHAPTER_SUPPORT
|
---|
123 | qDebug(" chapters: %d", chapters);
|
---|
124 | #else
|
---|
125 | qDebug(" mkv_chapters: %d", mkv_chapters);
|
---|
126 | #endif
|
---|
127 |
|
---|
128 | qDebug(" Subs:");
|
---|
129 | subs.list();
|
---|
130 |
|
---|
131 | #if PROGRAM_SWITCH
|
---|
132 | qDebug(" Programs:");
|
---|
133 | programs.list();
|
---|
134 | #endif
|
---|
135 | qDebug(" Videos:");
|
---|
136 | videos.list();
|
---|
137 |
|
---|
138 | qDebug(" Audios:");
|
---|
139 | audios.list();
|
---|
140 |
|
---|
141 | qDebug(" Titles:");
|
---|
142 | titles.list();
|
---|
143 |
|
---|
144 | //qDebug(" chapters: %d", chapters);
|
---|
145 | //qDebug(" angles: %d", angles);
|
---|
146 |
|
---|
147 | qDebug(" demuxer: '%s'", demuxer.toUtf8().data() );
|
---|
148 | qDebug(" video_format: '%s'", video_format.toUtf8().data() );
|
---|
149 | qDebug(" audio_format: '%s'", audio_format.toUtf8().data() );
|
---|
150 | qDebug(" video_bitrate: %d", video_bitrate );
|
---|
151 | qDebug(" video_fps: '%s'", video_fps.toUtf8().data() );
|
---|
152 | qDebug(" audio_bitrate: %d", audio_bitrate );
|
---|
153 | qDebug(" audio_rate: %d", audio_rate );
|
---|
154 | qDebug(" audio_nch: %d", audio_nch );
|
---|
155 | qDebug(" video_codec: '%s'", video_codec.toUtf8().data() );
|
---|
156 | qDebug(" audio_codec: '%s'", audio_codec.toUtf8().data() );
|
---|
157 | }
|
---|
158 |
|
---|