1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
// (C) 2005 Max Howell (max.howell@methylblue.com)
// See COPYING file for licensing information
#include <kurl.h>
#include "../mxcl.library.h"
#include "theStream.h"
#include <xine.h>
#include "xineEngine.h"
namespace Codeine
{
#define e VideoWindow::s_instance
TDEConfig*
TheStream::profile()
{
//TODO a unique id for discs, and then even to also record chapters etc.
// if( url().protocol() == "dvd" )
// return Codeine::config( TQString( "dvd:/" ) + prettyTitle() );
// else
return Codeine::config( url().prettyURL() );
}
const KURL&
TheStream::url()
{ return e->m_url; }
bool
TheStream::canSeek()
//FIXME!
{ return e->m_url.protocol() != "http"; }
bool
TheStream::hasAudio()
{ return xine_get_stream_info( e->m_stream, XINE_STREAM_INFO_HAS_AUDIO ); }
bool
TheStream::hasVideo()
{ return xine_get_stream_info( e->m_stream, XINE_STREAM_INFO_HAS_VIDEO ); }
TQSize
TheStream::defaultVideoSize()
{
return !e->m_stream
? TQSize()
: TQSize(
xine_get_stream_info( e->m_stream, XINE_STREAM_INFO_VIDEO_WIDTH ),
xine_get_stream_info( e->m_stream, XINE_STREAM_INFO_VIDEO_HEIGHT ) );
}
int TheStream::aspectRatio()
{ return xine_get_param( e->m_stream, XINE_PARAM_VO_ASPECT_RATIO ); }
int TheStream::subtitleChannel()
{ return xine_get_param( e->m_stream, XINE_PARAM_SPU_CHANNEL ); }
int TheStream::audioChannel()
{ return xine_get_param( e->m_stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL ); }
TQString
TheStream::prettyTitle()
{
const KURL &url = e->m_url;
const TQString artist = TQString::fromUtf8( xine_get_meta_info( e->m_stream, XINE_META_INFO_ARTIST ) );
const TQString title = TQString::fromUtf8( xine_get_meta_info( e->m_stream, XINE_META_INFO_TITLE ) );
if (hasVideo() && !title.isEmpty())
return title;
else if (!title.isEmpty() && !artist.isEmpty())
return artist + " - " + title;
else if (url.protocol() != "http" && !url.fileName().isEmpty()) {
const TQString n = url.fileName();
return KURL::decode_string( n.left( n.findRev( '.' ) ).replace( '_', ' ' ) ); }
else
return url.prettyURL();
}
static inline TQString
entryHelper( const TQString &plate, const TQString &s1, const TQString &s2 )
{
return s2.isEmpty() ? s2 : plate.arg( s1 ).arg( s2 );
}
static inline TQString
sectionHelper( const TQString §ionTitle, const TQStringList &entries )
{
TQString s;
foreach( entries )
if( !(*it).isEmpty() )
s += *it;
return s.isEmpty() ? s : "<h2>" + sectionTitle + "</h2>" + s;
}
TQString
TheStream::information()
{
#define meta( x ) xine_get_meta_info( e->m_stream, x )
#define info( x, y ) x.arg( xine_get_stream_info( e->m_stream, y ) )
#define simple( x ) TQString::number( xine_get_stream_info( e->m_stream, x ) )
const TQString plate = "<p><b>%1</b>: %2</p>";
TQString s;
s += sectionHelper( i18n("Metadata"),
TQStringList()
<< entryHelper( plate, i18n("Title"), meta( XINE_META_INFO_TITLE ) )
<< entryHelper( plate, i18n("Comment"), meta( XINE_META_INFO_COMMENT ) )
<< entryHelper( plate, i18n("Artist"), meta( XINE_META_INFO_ARTIST ) )
<< entryHelper( plate, i18n("Genre"), meta( XINE_META_INFO_GENRE ) )
<< entryHelper( plate, i18n("Album"), meta( XINE_META_INFO_ALBUM ) )
<< entryHelper( plate, i18n("Year"), meta( XINE_META_INFO_YEAR ) ) );
s += sectionHelper( i18n("Audio Properties"),
TQStringList()
<< entryHelper( plate, i18n("Bitrate"), info( i18n("%1 bps"), XINE_STREAM_INFO_AUDIO_BITRATE ) )
<< entryHelper( plate, i18n("Sample-rate"), info( i18n("%1 Hz"), XINE_STREAM_INFO_AUDIO_SAMPLERATE ) ) );
s += sectionHelper( i18n("Technical Information"),
TQStringList()
<< entryHelper( plate, i18n("Video Codec"), meta( XINE_META_INFO_VIDEOCODEC ) )
<< entryHelper( plate, i18n("Audio Codec"), meta( XINE_META_INFO_AUDIOCODEC ) )
<< entryHelper( plate, i18n("System Layer"), meta( XINE_META_INFO_SYSTEMLAYER ) )
<< entryHelper( plate, i18n("Input Plugin"), meta( XINE_META_INFO_INPUT_PLUGIN ))
<< entryHelper( plate, i18n("CDINDEX_DISCID"), meta( XINE_META_INFO_CDINDEX_DISCID ) ) );
TQStringList texts;
texts << "BITRATE" << "SEEKABLE" << "VIDEO_WIDTH" << "VIDEO_HEIGHT" << "VIDEO_RATIO" << "VIDEO_CHANNELS" << "VIDEO_STREAMS" << "VIDEO_BITRATE" << "VIDEO_FOURCC" << "VIDEO_HANDLED" << "FRAME_DURATION" << "AUDIO_CHANNELS" << "AUDIO_BITS" << "-AUDIO_SAMPLERATE" << "-AUDIO_BITRATE" << "AUDIO_FOURCC" << "AUDIO_HANDLED" << "HAS_CHAPTERS" << "HAS_VIDEO" << "HAS_AUDIO" << "-IGNORE_VIDEO" << "-IGNORE_AUDIO" << "-IGNORE_SPU" << "VIDEO_HAS_STILL" << "MAX_AUDIO_CHANNEL" << "MAX_SPU_CHANNEL" << "AUDIO_MODE" << "SKIPPED_FRAMES" << "DISCARDED_FRAMES";
s += "<h2>Other</h2>";
for( uint x = 0; x <= 28; ++x )
s += entryHelper( plate, texts[x], simple( x ) );
#undef meta
#undef info
#undef simple
return s;
}
#undef e
}
|