~ubuntu-branches/ubuntu/gutsy/smplayer/gutsy-backports

« back to all changes in this revision

Viewing changes to src/mediadata.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Breuil Cyril
  • Date: 2007-05-06 17:09:35 UTC
  • Revision ID: james.westby@ubuntu.com-20070506170935-d83qqn48tv1muk7j
Tags: upstream-0.4.12
ImportĀ upstreamĀ versionĀ 0.4.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  smplayer, GUI front-end for mplayer.
 
2
    Copyright (C) 2007 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 <qsettings.h>
 
21
#include <qfileinfo.h>
 
22
#include <cmath>
 
23
 
 
24
 
 
25
MediaData::MediaData() {
 
26
        reset();
 
27
}
 
28
 
 
29
MediaData::~MediaData() {
 
30
}
 
31
 
 
32
void MediaData::reset() {
 
33
        filename="";
 
34
        dvd_id="";
 
35
        type = TYPE_UNKNOWN;
 
36
        duration=0;
 
37
 
 
38
        novideo = FALSE;
 
39
 
 
40
        // Some defaults in case file is only audio...
 
41
    /*
 
42
        video_width=200;
 
43
    video_height=150;
 
44
        */
 
45
        video_width=0;
 
46
    video_height=0;
 
47
    video_aspect= (double) 4/3;
 
48
 
 
49
        audios.clear();
 
50
        titles.clear();
 
51
 
 
52
#if SUBTITLES_BY_INDEX
 
53
        subs.clear();
 
54
#else
 
55
        subtitles.clear();
 
56
#endif
 
57
 
 
58
        //chapters=0;
 
59
        //angles=0;
 
60
 
 
61
        mkv_chapters=0;
 
62
 
 
63
        initialized=false;
 
64
 
 
65
        // Clip info;
 
66
        clip_name = "";
 
67
    clip_artist = "";
 
68
    clip_author = "";
 
69
    clip_album = "";
 
70
    clip_genre = "";
 
71
    clip_date = "";
 
72
    clip_track = "";
 
73
    clip_copyright = "";
 
74
    clip_comment = "";
 
75
    clip_software = "";
 
76
 
 
77
        // Other data
 
78
        demuxer="";
 
79
        video_format="";
 
80
        audio_format="";
 
81
        video_bitrate=0;
 
82
        video_fps="";
 
83
        audio_bitrate=0;
 
84
        audio_rate=0;
 
85
        audio_nch=0;
 
86
        video_codec="";
 
87
        audio_codec="";
 
88
}
 
89
 
 
90
QString MediaData::displayName() {
 
91
        QFileInfo fi(filename);
 
92
        if (fi.exists()) 
 
93
                return fi.fileName(); // filename without path
 
94
        else
 
95
                return filename;
 
96
}
 
97
 
 
98
 
 
99
void MediaData::list() {
 
100
        qDebug("MediaData::list");
 
101
 
 
102
        qDebug("  filename: '%s'", filename.utf8().data());
 
103
        qDebug("  duration: %f", duration);
 
104
 
 
105
        qDebug("  video_width: %d", video_width); 
 
106
        qDebug("  video_height: %d", video_height); 
 
107
        qDebug("  video_aspect: %f", video_aspect); 
 
108
 
 
109
        qDebug("  type: %d", type);
 
110
        qDebug("  novideo: %d", novideo);
 
111
        qDebug("  dvd_id: '%s'", dvd_id.utf8().data());
 
112
 
 
113
        qDebug("  initialized: %d", initialized);
 
114
 
 
115
        qDebug("  mkv_chapters: %d", mkv_chapters);
 
116
 
 
117
        qDebug("  Subs:");
 
118
#if SUBTITLES_BY_INDEX
 
119
        subs.list();
 
120
#else
 
121
        subtitles.list();
 
122
#endif
 
123
 
 
124
        qDebug("  Audios:");
 
125
        audios.list();
 
126
 
 
127
        qDebug("  Titles:");
 
128
        titles.list();
 
129
 
 
130
        //qDebug("  chapters: %d", chapters);
 
131
        //qDebug("  angles: %d", angles);
 
132
 
 
133
        qDebug("  demuxer: '%s'", demuxer.utf8().data() );
 
134
        qDebug("  video_format: '%s'", video_format.utf8().data() );
 
135
        qDebug("  audio_format: '%s'", audio_format.utf8().data() );
 
136
        qDebug("  video_bitrate: %d", video_bitrate );
 
137
        qDebug("  video_fps: '%s'", video_fps.utf8().data() );
 
138
        qDebug("  audio_bitrate: %d", audio_bitrate );
 
139
        qDebug("  audio_rate: %d", audio_rate );
 
140
        qDebug("  audio_nch: %d", audio_nch );
 
141
        qDebug("  video_codec: '%s'", video_codec.utf8().data() );
 
142
        qDebug("  audio_codec: '%s'", audio_codec.utf8().data() );
 
143
}
 
144