summaryrefslogtreecommitdiff
path: root/noncore
authoralwin <alwin>2005-04-12 13:33:37 (UTC)
committer alwin <alwin>2005-04-12 13:33:37 (UTC)
commit6df2eb36803e072ea9db62153b762250742610f0 (patch) (side-by-side diff)
tree5e80ac2c581ffe19478110233dbd93ae1977f99f /noncore
parent81b7ea55be071eab5f8b4afd2c4c291dee365545 (diff)
downloadopie-6df2eb36803e072ea9db62153b762250742610f0.zip
opie-6df2eb36803e072ea9db62153b762250742610f0.tar.gz
opie-6df2eb36803e072ea9db62153b762250742610f0.tar.bz2
some usefull xine-helpers
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp34
-rw-r--r--noncore/multimedia/opieplayer2/lib.h4
2 files changed, 32 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 9f7a9c5..4ae8490 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -285,30 +285,58 @@ int Lib::length() const {
}
/*don't poll too much*/
usleep(100000);
iTestLoop++;
}
while ( iTestLoop < 10 ); /* if after 1s, we still don't have any
valid stream, then return -1 (this value could be used to make the stream
unseekable, but it should never occur!! Mr. Murphy ? :) ) */
return -1;
}
+/* info about current stream */
+QSize Lib::videoSize()const
+{
+ if (!m_initialized||!hasVideo()) return QSize(0,0);
+ int width = xine_get_stream_info(m_stream,XINE_STREAM_INFO_VIDEO_WIDTH);
+ int height = xine_get_stream_info(m_stream,XINE_STREAM_INFO_VIDEO_HEIGHT);
+ return QSize(width,height);
+}
+
+
bool Lib::isSeekable() const {
assert( m_initialized );
return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
}
+bool Lib::hasVideo() const {
+ assert( m_initialized );
+
+ return xine_get_stream_info( m_stream, XINE_STREAM_INFO_HAS_VIDEO);
+}
+
+int Lib::audioBitrate()const
+{
+ if (!m_initialized) return 0;
+ return xine_get_stream_info( m_stream, XINE_STREAM_INFO_AUDIO_BITRATE);
+}
+int Lib::videoBitrate()const
+{
+ if (!m_initialized||!hasVideo()) return 0;
+ return xine_get_stream_info( m_stream, XINE_STREAM_INFO_VIDEO_BITRATE);
+}
+/* end info block */
+
void Lib::seekTo( int time ) {
assert( m_initialized );
odebug << "Seeking to second " << time << oendl;
//Keep it paused if it was in that state
if ( xine_get_param( m_stream, XINE_PARAM_SPEED ) ) {
xine_play( m_stream, 0, time*1000 );
}
else {
xine_play( m_stream, 0, time*1000 );
xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE );
@@ -382,30 +410,24 @@ void Lib::setShowVideo( bool video ) {
assert( m_initialized );
m_video = video;
::null_set_show_video( m_videoOutput, video );
}
bool Lib::isShowingVideo() const {
assert( m_initialized );
return ::null_is_showing_video( m_videoOutput );
}
-bool Lib::hasVideo() const {
- assert( m_initialized );
-
- return xine_get_stream_info( m_stream, 18 );
-}
-
void Lib::showVideoFullScreen( bool fullScreen ) {
assert( m_initialized );
::null_set_fullscreen( m_videoOutput, fullScreen );
}
bool Lib::isVideoFullScreen() const {
assert( m_initialized );
return ::null_is_fullscreen( m_videoOutput );
}
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 2f5bf86..2607193 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -162,24 +162,28 @@ namespace XINE {
* Returns the error code
* XINE_ERROR_NONE 0
* XINE_ERROR_NO_INPUT_PLUGIN 1
* XINE_ERROR_NO_DEMUXER_PLUGIN 2
* XINE_ERROR_DEMUXER_FAILED 3
*/
int error() const;
void ensureInitialized();
void setWidget( XineVideoWidget *widget );
+ QSize videoSize()const;
+ int audioBitrate()const;
+ int videoBitrate()const;
+
signals:
void stopped();
void initialized();
protected:
virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType );
virtual void run();
private: