| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2010 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() {
|
|---|
| 92 | if (!clip_name.isEmpty()) return clip_name;
|
|---|
| 93 | else
|
|---|
| 94 | if (!stream_title.isEmpty()) return stream_title;
|
|---|
| 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 |
|
|---|
| 120 | #if GENERIC_CHAPTER_SUPPORT
|
|---|
| 121 | qDebug(" chapters: %d", chapters);
|
|---|
| 122 | #else
|
|---|
| 123 | qDebug(" mkv_chapters: %d", mkv_chapters);
|
|---|
| 124 | #endif
|
|---|
| 125 |
|
|---|
| 126 | qDebug(" Subs:");
|
|---|
| 127 | subs.list();
|
|---|
| 128 |
|
|---|
| 129 | #if PROGRAM_SWITCH
|
|---|
| 130 | qDebug(" Programs:");
|
|---|
| 131 | programs.list();
|
|---|
| 132 | #endif
|
|---|
| 133 | qDebug(" Videos:");
|
|---|
| 134 | videos.list();
|
|---|
| 135 |
|
|---|
| 136 | qDebug(" Audios:");
|
|---|
| 137 | audios.list();
|
|---|
| 138 |
|
|---|
| 139 | qDebug(" Titles:");
|
|---|
| 140 | titles.list();
|
|---|
| 141 |
|
|---|
| 142 | //qDebug(" chapters: %d", chapters);
|
|---|
| 143 | //qDebug(" angles: %d", angles);
|
|---|
| 144 |
|
|---|
| 145 | qDebug(" demuxer: '%s'", demuxer.toUtf8().data() );
|
|---|
| 146 | qDebug(" video_format: '%s'", video_format.toUtf8().data() );
|
|---|
| 147 | qDebug(" audio_format: '%s'", audio_format.toUtf8().data() );
|
|---|
| 148 | qDebug(" video_bitrate: %d", video_bitrate );
|
|---|
| 149 | qDebug(" video_fps: '%s'", video_fps.toUtf8().data() );
|
|---|
| 150 | qDebug(" audio_bitrate: %d", audio_bitrate );
|
|---|
| 151 | qDebug(" audio_rate: %d", audio_rate );
|
|---|
| 152 | qDebug(" audio_nch: %d", audio_nch );
|
|---|
| 153 | qDebug(" video_codec: '%s'", video_codec.toUtf8().data() );
|
|---|
| 154 | qDebug(" audio_codec: '%s'", audio_codec.toUtf8().data() );
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|