[112] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[112] | 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 |
|
---|
[188] | 37 | extra_params.clear();
|
---|
| 38 |
|
---|
[165] | 39 | novideo = false;
|
---|
[112] | 40 |
|
---|
| 41 | video_width=0;
|
---|
[188] | 42 | video_height=0;
|
---|
| 43 | video_aspect= (double) 4/3;
|
---|
[112] | 44 |
|
---|
| 45 | #if PROGRAM_SWITCH
|
---|
| 46 | programs.clear();
|
---|
| 47 | #endif
|
---|
| 48 | videos.clear();
|
---|
| 49 | audios.clear();
|
---|
| 50 | titles.clear();
|
---|
| 51 |
|
---|
| 52 | subs.clear();
|
---|
| 53 |
|
---|
[128] | 54 | chapters.clear();
|
---|
[112] | 55 |
|
---|
[128] | 56 | n_chapters = 0;
|
---|
[112] | 57 |
|
---|
| 58 | initialized=false;
|
---|
| 59 |
|
---|
| 60 | // Clip info;
|
---|
| 61 | clip_name = "";
|
---|
| 62 | clip_artist = "";
|
---|
| 63 | clip_author = "";
|
---|
| 64 | clip_album = "";
|
---|
| 65 | clip_genre = "";
|
---|
| 66 | clip_date = "";
|
---|
| 67 | clip_track = "";
|
---|
| 68 | clip_copyright = "";
|
---|
| 69 | clip_comment = "";
|
---|
| 70 | clip_software = "";
|
---|
| 71 |
|
---|
| 72 | stream_title = "";
|
---|
| 73 | stream_url = "";
|
---|
[188] | 74 | stream_path = "";
|
---|
[112] | 75 |
|
---|
| 76 | // Other data
|
---|
| 77 | demuxer="";
|
---|
| 78 | video_format="";
|
---|
| 79 | audio_format="";
|
---|
| 80 | video_bitrate=0;
|
---|
| 81 | video_fps="";
|
---|
| 82 | audio_bitrate=0;
|
---|
| 83 | audio_rate=0;
|
---|
| 84 | audio_nch=0;
|
---|
| 85 | video_codec="";
|
---|
| 86 | audio_codec="";
|
---|
| 87 | }
|
---|
| 88 |
|
---|
[119] | 89 | QString MediaData::displayName(bool show_tag) {
|
---|
| 90 | if (show_tag) {
|
---|
[176] | 91 | if (!stream_title.isEmpty()) return stream_title;
|
---|
| 92 | else
|
---|
[119] | 93 | if (!clip_name.isEmpty()) return clip_name;
|
---|
| 94 | }
|
---|
[112] | 95 |
|
---|
| 96 | QFileInfo fi(filename);
|
---|
| 97 | if (fi.exists())
|
---|
| 98 | return fi.fileName(); // filename without path
|
---|
| 99 | else
|
---|
| 100 | return filename;
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | void MediaData::list() {
|
---|
| 105 | qDebug("MediaData::list");
|
---|
| 106 |
|
---|
| 107 | qDebug(" filename: '%s'", filename.toUtf8().data());
|
---|
| 108 | qDebug(" duration: %f", duration);
|
---|
| 109 |
|
---|
| 110 | qDebug(" video_width: %d", video_width);
|
---|
| 111 | qDebug(" video_height: %d", video_height);
|
---|
| 112 | qDebug(" video_aspect: %f", video_aspect);
|
---|
| 113 |
|
---|
| 114 | qDebug(" type: %d", type);
|
---|
| 115 | qDebug(" novideo: %d", novideo);
|
---|
| 116 | qDebug(" dvd_id: '%s'", dvd_id.toUtf8().data());
|
---|
| 117 |
|
---|
| 118 | qDebug(" initialized: %d", initialized);
|
---|
| 119 |
|
---|
[128] | 120 | qDebug(" chapters: %d", n_chapters);
|
---|
[112] | 121 |
|
---|
| 122 | qDebug(" Subs:");
|
---|
| 123 | subs.list();
|
---|
| 124 |
|
---|
| 125 | #if PROGRAM_SWITCH
|
---|
| 126 | qDebug(" Programs:");
|
---|
| 127 | programs.list();
|
---|
| 128 | #endif
|
---|
| 129 | qDebug(" Videos:");
|
---|
| 130 | videos.list();
|
---|
| 131 |
|
---|
| 132 | qDebug(" Audios:");
|
---|
| 133 | audios.list();
|
---|
| 134 |
|
---|
| 135 | qDebug(" Titles:");
|
---|
| 136 | titles.list();
|
---|
| 137 |
|
---|
| 138 | //qDebug(" chapters: %d", chapters);
|
---|
| 139 | //qDebug(" angles: %d", angles);
|
---|
| 140 |
|
---|
| 141 | qDebug(" demuxer: '%s'", demuxer.toUtf8().data() );
|
---|
| 142 | qDebug(" video_format: '%s'", video_format.toUtf8().data() );
|
---|
| 143 | qDebug(" audio_format: '%s'", audio_format.toUtf8().data() );
|
---|
| 144 | qDebug(" video_bitrate: %d", video_bitrate );
|
---|
| 145 | qDebug(" video_fps: '%s'", video_fps.toUtf8().data() );
|
---|
| 146 | qDebug(" audio_bitrate: %d", audio_bitrate );
|
---|
| 147 | qDebug(" audio_rate: %d", audio_rate );
|
---|
| 148 | qDebug(" audio_nch: %d", audio_nch );
|
---|
| 149 | qDebug(" video_codec: '%s'", video_codec.toUtf8().data() );
|
---|
| 150 | qDebug(" audio_codec: '%s'", audio_codec.toUtf8().data() );
|
---|
| 151 | }
|
---|
| 152 |
|
---|