summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2009-05-06 14:38:00 +0100
committerBastien Nocera <hadess@hadess.net>2009-05-06 14:38:00 +0100
commitf9f0074d165dbec419028faca3047deb77ce5973 (patch)
tree6650230bec0647bc4c248b41f8718f0faad5457a
parentb82bc22eb92f4eee7967b810c16eeadd05487fb7 (diff)
downloadtotem-f9f0074d165dbec419028faca3047deb77ce5973.tar.gz
7 years later, remove xine-lib backend.
2009-05-06 Bastien Nocera <hadess@hadess.net> * COPYING: * README: * configure.in: * data/icons/scalable/totem.svg: * data/totem-video-thumbnailer.1: * data/totem-video-thumbnailer.pod: * data/totem.1: * src/backend/Makefile.am: * src/backend/bacon-video-widget-common.c: * src/backend/bacon-video-widget-common.h: * src/backend/bacon-video-widget-gst-0.10.c (bvw_error_msg), (bacon_video_widget_init), (bacon_video_widget_finalize), (bacon_video_widget_open), (bacon_video_widget_play), (bacon_video_widget_can_direct_seek), (bacon_video_widget_seek_time), (bacon_video_widget_close), (bacon_video_widget_pause), (get_visualization_size), (bacon_video_widget_is_seekable): * src/backend/bacon-video-widget-xine.c: * src/backend/bacon-video-widget.h: * src/backend/video-utils.c: * src/backend/video-utils.h: * totem.doap: 7 years later, remove xine-lib backend. Bye bye
-rw-r--r--COPYING3
-rw-r--r--ChangeLog27
-rw-r--r--README5
-rw-r--r--configure.in238
-rw-r--r--data/icons/scalable/totem.svg1
-rw-r--r--data/totem-video-thumbnailer.110
-rw-r--r--data/totem-video-thumbnailer.pod2
-rw-r--r--data/totem.17
-rw-r--r--po/ChangeLog6
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/backend/Makefile.am12
-rw-r--r--src/backend/bacon-video-widget-common.c72
-rw-r--r--src/backend/bacon-video-widget-common.h50
-rw-r--r--src/backend/bacon-video-widget-gst-0.10.c117
-rw-r--r--src/backend/bacon-video-widget-xine.c4350
-rw-r--r--src/backend/bacon-video-widget.h1
-rw-r--r--src/backend/video-utils.c107
-rw-r--r--src/backend/video-utils.h5
-rw-r--r--totem.doap2
19 files changed, 203 insertions, 4813 deletions
diff --git a/COPYING b/COPYING
index 8a428dbeb..3f38fa617 100644
--- a/COPYING
+++ b/COPYING
@@ -350,8 +350,5 @@ extend this exception to your version of the code, but you are not obligated
to do so. If you do not wish to do so, delete this exception statement from
your version.
-Note that the src/backend/bacon-video-widget-xine.c file does not require such
-an exception as it does not link to GStreamer plugins.
-
Note that the src/totem-subtitle-encoding.c file was relicensed to LGPL
(see http://bugzilla.gnome.org/show_bug.cgi?id=515809).
diff --git a/ChangeLog b/ChangeLog
index 1144a2b9e..f87f708a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2009-05-06 Bastien Nocera <hadess@hadess.net>
+
+ * COPYING:
+ * README:
+ * configure.in:
+ * data/icons/scalable/totem.svg:
+ * data/totem-video-thumbnailer.1:
+ * data/totem-video-thumbnailer.pod:
+ * data/totem.1:
+ * src/backend/Makefile.am:
+ * src/backend/bacon-video-widget-common.c:
+ * src/backend/bacon-video-widget-common.h:
+ * src/backend/bacon-video-widget-gst-0.10.c (bvw_error_msg),
+ (bacon_video_widget_init), (bacon_video_widget_finalize),
+ (bacon_video_widget_open), (bacon_video_widget_play),
+ (bacon_video_widget_can_direct_seek),
+ (bacon_video_widget_seek_time), (bacon_video_widget_close),
+ (bacon_video_widget_pause), (get_visualization_size),
+ (bacon_video_widget_is_seekable):
+ * src/backend/bacon-video-widget-xine.c:
+ * src/backend/bacon-video-widget.h:
+ * src/backend/video-utils.c:
+ * src/backend/video-utils.h:
+ * totem.doap:
+ 7 years later, remove xine-lib backend.
+ Bye bye
+
2009-05-01 Bastien Nocera <hadess@hadess.net>
* browser-plugin/totemPlugin.cpp:
diff --git a/README b/README
index 0e7f74002..ec817fcf1 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@
_|_ __|_ _ ._ _
|_(_)|_(/_| | |
-Totem is movie player for the GNOME desktop based on xine or GStreamer.
+Totem is movie player for the GNOME desktop based on GStreamer.
It features a playlist, a full-screen mode, seek and volume controls,
as well as complete keyboard navigation.
@@ -17,9 +17,6 @@ See NEWS file
Dependencies
============
-xine-lib 1.1.7 or newer:
- http://xinehq.de
-or
GStreamer 0.10.6, and gstreamer-plugins-base 0.10.7
http://gstreamer.freedesktop.org
diff --git a/configure.in b/configure.in
index baa7276a5..9d83ee98d 100644
--- a/configure.in
+++ b/configure.in
@@ -53,148 +53,103 @@ allowed_plugins="thumbnail screensaver ontop galago gromit lirc media-player-key
PLUGINDIR='${libdir}/totem/plugins'
AC_SUBST(PLUGINDIR)
-dnl xine or gst ?
-
dnl the two versions here implicate the gstreamer core and gst-plugins
dnl release versions.
-XINE_REQS=1.1.7
GST_MAJORMINOR=0.10
GST_REQS=0.10.22
GSTPLUG_REQS=0.10.22.1
-AC_ARG_ENABLE(xine,
- AC_HELP_STRING([--enable-xine], [use xine instead of GStreamer for the backend]),
- [case "${enableval}" in
- yes) ENABLE_XINE=yes ;;
- no) ENABLE_XINE=no ;;
- *) AC_MSG_ERROR([
- ***** Bad value ${enableval} for --enable-xine
- ***** Please use one of the following:
- ***** --enable-xine=yes
- ***** --enable-xine=no
- ]) ;;
- esac],
- [ENABLE_XINE=auto]) dnl Default value
-
HAVE_GSTREAMER=no
-if test x$ENABLE_XINE = xno || test x$ENABLE_XINE = xauto; then
- dnl Check for the required GStreamer versions for missing plugins
- dnl installation, unless this has been disabled.
- AC_MSG_CHECKING([whether to enable easy codec installation support])
- AC_ARG_ENABLE([easy-codec-installation],
- [
- AS_HELP_STRING([--enable-easy-codec-installation],
- [Whether to enable easy codec installation support for GStreamer]
- )
- ], [
- case "${enableval}" in
- yes) enable_easy_codec_installation=yes ;;
- no) enable_easy_codec_installation=no ;;
- *) enable_easy_codec_installation=auto ;;
- esac
- ], [
- dnl default value
- enable_easy_codec_installation=auto
- ]
- )
- AC_MSG_RESULT([$enable_easy_codec_installation])
-
- if test "x$enable_easy_codec_installation" != "xno"; then
- PKG_CHECK_MODULES(MISSING_PLUGINS, gstreamer-plugins-base-0.10,
- [
- MISSING_PLUGINS_LIBS="$MISSING_PLUGINS_LIBS -lgstpbutils-0.10"
- AC_DEFINE([ENABLE_MISSING_PLUGIN_INSTALLATION], 1,
- [Whether we can and want to do installation of missing plugins])
- ])
- fi
-
- MM="gstreamer-0.10 >= $GST_REQS gstreamer-base-0.10 >= $GST_REQS gstreamer-plugins-base-0.10 >= $GSTPLUG_REQS gstreamer-tag-0.10 >= $GSTPLUG_REQS gconf-2.0"
- PKG_CHECK_MODULES(GST, $MM,
- HAVE_GSTREAMER=yes, HAVE_GSTREAMER=no)
- GST_LIBS="$GST_LIBS -lgstbase-$GST_MAJORMINOR -lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR -lgstpbutils-$GST_MAJORMINOR -lgsttag-$GST_MAJORMINOR"
- AC_SUBST(GST_LIBS)
- EXTRA_BACKEND_LIBS="-lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR -lgstpbutils-$GST_MAJORMINOR"
-
- AC_MSG_CHECKING(for backend libraries)
- dnl Give error and exit if we don't have gstreamer
- if test "x$HAVE_GSTREAMER" = "xno"; then
- AC_MSG_ERROR(you need the GStreamer or the xine-lib development packages installed)
- fi
- AC_MSG_RESULT(GStreamer-$GST_MAJORMINOR)
- dnl Check for required plugins
- gst010_toolsdir=`$PKG_CONFIG --variable=toolsdir gstreamer-0.10`
- gst010_inspect="$gst010_toolsdir/gst-inspect-0.10"
+dnl Check for the required GStreamer versions for missing plugins
+dnl installation, unless this has been disabled.
+AC_MSG_CHECKING([whether to enable easy codec installation support])
+AC_ARG_ENABLE([easy-codec-installation],
+ [
+ AS_HELP_STRING([--enable-easy-codec-installation],
+ [Whether to enable easy codec installation support for GStreamer]
+ )
+ ], [
+ case "${enableval}" in
+ yes) enable_easy_codec_installation=yes ;;
+ no) enable_easy_codec_installation=no ;;
+ *) enable_easy_codec_installation=auto ;;
+ esac
+ ], [
+ dnl default value
+ enable_easy_codec_installation=auto
+ ]
+)
+AC_MSG_RESULT([$enable_easy_codec_installation])
+
+if test "x$enable_easy_codec_installation" != "xno"; then
+ PKG_CHECK_MODULES(MISSING_PLUGINS, gstreamer-plugins-base-0.10,
+ [
+ MISSING_PLUGINS_LIBS="$MISSING_PLUGINS_LIBS -lgstpbutils-0.10"
+ AC_DEFINE([ENABLE_MISSING_PLUGIN_INSTALLATION], 1,
+ [Whether we can and want to do installation of missing plugins])
+ ])
+fi
+
+MM="gstreamer-0.10 >= $GST_REQS gstreamer-base-0.10 >= $GST_REQS gstreamer-plugins-base-0.10 >= $GSTPLUG_REQS gstreamer-tag-0.10 >= $GSTPLUG_REQS gconf-2.0"
+PKG_CHECK_MODULES(GST, $MM,
+ HAVE_GSTREAMER=yes, HAVE_GSTREAMER=no)
+GST_LIBS="$GST_LIBS -lgstbase-$GST_MAJORMINOR -lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR -lgstpbutils-$GST_MAJORMINOR -lgsttag-$GST_MAJORMINOR"
+AC_SUBST(GST_LIBS)
+EXTRA_BACKEND_LIBS="-lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR -lgstpbutils-$GST_MAJORMINOR"
+
+AC_MSG_CHECKING(for backend libraries)
+dnl Give error and exit if we don't have gstreamer
+if test "x$HAVE_GSTREAMER" = "xno"; then
+ AC_MSG_ERROR(you need the GStreamer development packages installed)
+fi
+AC_MSG_RESULT(GStreamer-$GST_MAJORMINOR)
+
+dnl Check for required plugins
+gst010_toolsdir=`$PKG_CONFIG --variable=toolsdir gstreamer-0.10`
+gst010_inspect="$gst010_toolsdir/gst-inspect-0.10"
+
+dnl Give error and exit if we don't have the gst_inspect tool
+AC_MSG_CHECKING([GStreamer 0.10 inspection tool])
+if test -r "$gst010_inspect"; then
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([
+ Cannot find required GStreamer-0.10 tool 'gst-inspect-0.10'.
+ It should be part of gstreamer-0_10-utils. Please install it.
+ ])
+fi
- dnl Give error and exit if we don't have the gst_inspect tool
- AC_MSG_CHECKING([GStreamer 0.10 inspection tool])
- if test -r "$gst010_inspect"; then
+dnl Check for elements from gst-plugins-base
+for base_element in playbin2 ffmpegcolorspace videoscale
+do
+ AC_MSG_CHECKING([GStreamer 0.10 $base_element plugin])
+ if $gst010_inspect $base_element >/dev/null 2>/dev/null; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([
- Cannot find required GStreamer-0.10 tool 'gst-inspect-0.10'.
- It should be part of gstreamer-0_10-utils. Please install it.
+ Cannot find required GStreamer-0.10 plugin '$base_element'.
+ It should be part of gst-plugins-base. Please install it.
])
fi
+done
- dnl Check for elements from gst-plugins-base
- for base_element in playbin2 ffmpegcolorspace videoscale
- do
- AC_MSG_CHECKING([GStreamer 0.10 $base_element plugin])
- if $gst010_inspect $base_element >/dev/null 2>/dev/null; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([
- Cannot find required GStreamer-0.10 plugin '$base_element'.
- It should be part of gst-plugins-base. Please install it.
- ])
- fi
- done
-
- dnl Check for elements from gst-plugins-good
- for good_element in gconfaudiosink gconfvideosink goom
- do
- AC_MSG_CHECKING([GStreamer 0.10 $good_element plugin])
- if $gst010_inspect $good_element >/dev/null 2>/dev/null; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([
- Cannot find required GStreamer-0.10 plugin '$good_element'.
- It should be part of gst-plugins-good. Please install it.
- ])
- fi
- done
-fi
-
-if test x$ENABLE_XINE = xno && test x$HAVE_GSTREAMER = xno; then
- AC_MSG_CHECKING(for backend libraries)
- AC_MSG_RESULT([none])
- AC_MSG_ERROR(you need the GStreamer or the xine-lib development packages installed)
-fi
-
-if test x$HAVE_GSTREAMER = xno; then
- MM="libxine >= $XINE_REQS gconf-2.0"
- PKG_CHECK_MODULES(XINE, $MM, HAVE_XINE=yes,
- [
- AC_MSG_RESULT(no)
- HAVE_XINE=no
+dnl Check for elements from gst-plugins-good
+for good_element in gconfaudiosink gconfvideosink goom
+do
+ AC_MSG_CHECKING([GStreamer 0.10 $good_element plugin])
+ if $gst010_inspect $good_element >/dev/null 2>/dev/null; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([
+ Cannot find required GStreamer-0.10 plugin '$good_element'.
+ It should be part of gst-plugins-good. Please install it.
])
- AC_MSG_CHECKING(for backend libraries)
- if test x$HAVE_XINE = xyes; then
- AC_MSG_RESULT([xine-lib])
- else
- AC_MSG_WARN([No xine-lib found])
fi
-fi
-
-if test "$HAVE_GSTREAMER" = "yes"; then
- AC_DEFINE([HAVE_GSTREAMER],[1],[Define if using gst backend])
-fi
-
-AM_CONDITIONAL(TOTEM_GST, test "x$HAVE_GSTREAMER" = "xyes")
+done
AC_MSG_CHECKING([Whether not to check for iso-codes])
AC_ARG_ENABLE([iso-codes],
@@ -614,19 +569,16 @@ for plugin in ${used_plugins}; do
add_plugin="0"
fi
- dnl We need the souphttpsrc element for the YouTube plugin, if we're using GStreamer.
- dnl The xine backend is fine for YouTube videos.
- if test "$HAVE_GSTREAMER" = "yes"; then
- AC_MSG_CHECKING([GStreamer 0.10 souphttpsrc plugin])
- if $gst010_inspect souphttpsrc >/dev/null 2>/dev/null; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([
- Cannot find required GStreamer-0.10 plugin 'souphttpsrc'.
- It should be part of gst-plugins-good. Please install it.
- ])
- fi
+ dnl We need the souphttpsrc element for the YouTube plugin
+ AC_MSG_CHECKING([GStreamer 0.10 souphttpsrc plugin])
+ if $gst010_inspect souphttpsrc >/dev/null 2>/dev/null; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([
+ Cannot find required GStreamer-0.10 plugin 'souphttpsrc'.
+ It should be part of gst-plugins-good. Please install it.
+ ])
fi
;;
esac
@@ -922,15 +874,11 @@ docs/reference/version.xml
])
AC_MSG_NOTICE([Totem was configured with the following options:])
-if test x$HAVE_GSTREAMER = xno ; then
- AC_MSG_NOTICE([** Using the xine backend])
+AC_MSG_NOTICE([** Using the GStreamer-$GST_MAJORMINOR backend])
+if test "x$MISSING_PLUGINS_LIBS" != "x"; then
+ AC_MSG_NOTICE([** Easy codec installation support enabled])
else
- AC_MSG_NOTICE([** Using the GStreamer-$GST_MAJORMINOR backend])
- if test "x$MISSING_PLUGINS_LIBS" != "x"; then
- AC_MSG_NOTICE([** Easy codec installation support enabled])
- else
- AC_MSG_NOTICE([ Easy codec installation support disabled])
- fi
+ AC_MSG_NOTICE([ Easy codec installation support disabled])
fi
if test x$enable_python = xyes ; then
AC_MSG_NOTICE([** Python binding support enabled])
diff --git a/data/icons/scalable/totem.svg b/data/icons/scalable/totem.svg
index 5867a32c6..e0383d616 100644
--- a/data/icons/scalable/totem.svg
+++ b/data/icons/scalable/totem.svg
@@ -620,7 +620,6 @@
<rdf:Bag>
<rdf:li>totem</rdf:li>
<rdf:li>gstreamer</rdf:li>
- <rdf:li>xine</rdf:li>
<rdf:li>player</rdf:li>
<rdf:li>mplayer</rdf:li>
<rdf:li>video</rdf:li>
diff --git a/data/totem-video-thumbnailer.1 b/data/totem-video-thumbnailer.1
index 1c6e67093..fde4a35d8 100644
--- a/data/totem-video-thumbnailer.1
+++ b/data/totem-video-thumbnailer.1
@@ -38,8 +38,8 @@
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
-. ds C` ""
-. ds C' ""
+. ds C`
+. ds C'
'br\}
.el\{\
. ds -- \|\(em\|
@@ -131,8 +131,8 @@
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
-.IX Title "TOTEM-VIDEO-THUMBNAILER 1"
-.TH TOTEM-VIDEO-THUMBNAILER 1 "2009-04-21" "GNOME" ""
+.IX Title "totem-video-thumbnailer 1"
+.TH totem-video-thumbnailer 1 "2009-05-06" "GNOME" ""
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -157,7 +157,7 @@ The input filename. This can be in any format that \fBtotem\fR can play.
The output filename, output in \s-1PNG\s0 format.
.IP "\fBbackend options\fR" 8
.IX Item "backend options"
-Options to be passed to the backend (i.e. \fBxine\fR or \fBgstreamer\fR).
+Options to be passed to the backend (i.e. \fBgstreamer\fR).
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-j\fR \fB\-\-jpeg\fR" 8
diff --git a/data/totem-video-thumbnailer.pod b/data/totem-video-thumbnailer.pod
index cf85b3dec..0cd861038 100644
--- a/data/totem-video-thumbnailer.pod
+++ b/data/totem-video-thumbnailer.pod
@@ -26,7 +26,7 @@ The output filename, output in PNG format.
=item B<backend options>
-Options to be passed to the backend (i.e. B<xine> or B<gstreamer>).
+Options to be passed to the backend (i.e. B<gstreamer>).
=back
diff --git a/data/totem.1 b/data/totem.1
index 5cbb32e57..6c24fbafd 100644
--- a/data/totem.1
+++ b/data/totem.1
@@ -15,7 +15,7 @@
.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
.TH totem 1 "2008\-08\-25" "GNOME"
.SH NAME
-Totem \- GNOME desktop movie player based on GStreamer or xine
+Totem \- GNOME desktop movie player based on GStreamer
.SH SYNOPSIS
.B totem
.RI [ option... ] " " [ filenames | URI ]
@@ -23,9 +23,7 @@ Totem \- GNOME desktop movie player based on GStreamer or xine
.B Totem
is a movie player for the GNOME desktop. Through use of the
.B GStreamer
-or
-.B xine
-backends many popular file and streaming formats are supported including:
+backend many popular file and streaming formats are supported including:
MPEG audio and video (MP3/MPV), Ogg, AVI, ASF, MOV, WMV,
QuickTime, and more. Playing of DVD and VCD media is
also possible.
@@ -223,7 +221,6 @@ The latest version of Totem may be downloaded from
.UE
.SH SEE ALSO
.BR "totem-video-thumbnailer" (1),
-.BR xine (1)
.P
The online documentation available through the program's
.I Help
diff --git a/po/ChangeLog b/po/ChangeLog
index 366369d82..460773e58 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -1,3 +1,9 @@
+2009-05-06 Bastien Nocera <hadess@hadess.net>
+
+ reviewed by: <delete if not using a buddy>
+
+ * POTFILES.in:
+
2009-04-29 Takeshi AIHANA <takeshi.aihana@gmail.com>
* ja.po: Fixed b.g.o #580634.
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ae6af5a08..f3a579a96 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -34,7 +34,6 @@ src/totem-time-label.c
src/totem-uri.c
src/totem.c
src/backend/bacon-video-widget-gst-0.10.c
-src/backend/bacon-video-widget-xine.c
src/backend/video-utils.c
src/plugins/totem-plugin-manager.c
src/plugins/totem-plugins-engine.c
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index 6d1d099fd..cd2056ba9 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -1,6 +1,6 @@
noinst_PROGRAMS = bvw-test
-lib_LTLIBRARIES = libbaconvideowidget.la
+noinst_LTLIBRARIES = libbaconvideowidget.la
bvw_test_SOURCES = bvw-test.c
@@ -32,22 +32,14 @@ baconvideowidget-marshal.c: baconvideowidget-marshal.h
libbaconvideowidget_la_SOURCES = \
$(BVWMARSHALFILES) \
bacon-video-widget.h \
- bacon-video-widget-common.h bacon-video-widget-common.c \
bacon-resize.h bacon-resize.c \
video-utils.c video-utils.h \
- debug.h
-
-if TOTEM_GST
-libbaconvideowidget_la_SOURCES += \
bacon-video-widget-gst-0.10.c \
bacon-video-widget-gst-missing-plugins.c \
bacon-video-widget-gst-missing-plugins.h \
gstscreenshot.c \
gstscreenshot.h
-else
-libbaconvideowidget_la_SOURCES += \
- bacon-video-widget-xine.c
-endif
+ debug.h
libbaconvideowidget_la_CPPFLAGS = \
-D_REENTRANT \
diff --git a/src/backend/bacon-video-widget-common.c b/src/backend/bacon-video-widget-common.c
deleted file mode 100644
index 6780018c3..000000000
--- a/src/backend/bacon-video-widget-common.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2006 Bastien Nocera <hadess@hadess.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The Totem project hereby grant permission for non-gpl compatible GStreamer
- * plugins to be used and distributed together with GStreamer and Totem. This
- * permission are above and beyond the permissions granted by the GPL license
- * Totem is covered by.
- *
- * Monday 7th February 2005: Christian Schaller: Add exception clause.
- * See license_change file for details.
- *
- */
-
-#include <config.h>
-
-#include "bacon-video-widget-common.h"
-
-static struct {
- int height;
- int fps;
-} const vis_qualities[] = {
- { 240, 15 }, /* VISUAL_SMALL */
- { 320, 25 }, /* VISUAL_NORMAL */
- { 480, 25 }, /* VISUAL_LARGE */
- { 600, 30 } /* VISUAL_EXTRA_LARGE */
-};
-
-gboolean
-bacon_video_widget_common_can_direct_seek (BaconVideoWidgetCommon *com)
-{
- g_return_val_if_fail (com != NULL, FALSE);
-
- if (com->mrl == NULL)
- return FALSE;
-
- /* (instant seeking only make sense with video,
- * hence no cdda:// here) */
- if (g_str_has_prefix (com->mrl, "file://") ||
- g_str_has_prefix (com->mrl, "dvd:/") ||
- g_str_has_prefix (com->mrl, "vcd:/"))
- return TRUE;
-
- return FALSE;
-}
-
-gboolean
-bacon_video_widget_common_get_vis_quality (BvwVisualsQuality q,
- int *height, int *fps)
-{
- g_return_val_if_fail (height != NULL, FALSE);
- g_return_val_if_fail (fps != NULL, FALSE);
- g_return_val_if_fail (q < G_N_ELEMENTS (vis_qualities), FALSE);
-
- *height = vis_qualities[q].height;
- *fps = vis_qualities[q].fps;
- return TRUE;
-}
-
diff --git a/src/backend/bacon-video-widget-common.h b/src/backend/bacon-video-widget-common.h
deleted file mode 100644
index a695b5741..000000000
--- a/src/backend/bacon-video-widget-common.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2006 Bastien Nocera <hadess@hadess.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The Totem project hereby grant permission for non-gpl compatible GStreamer
- * plugins to be used and distributed together with GStreamer and Totem. This
- * permission are above and beyond the permissions granted by the GPL license
- * Totem is covered by.
- *
- * Monday 7th February 2005: Christian Schaller: Add exception clause.
- * See license_change file for details.
- *
- */
-
-#ifndef HAVE_BACON_VIDEO_WIDGET_COMMON_H
-#define HAVE_BACON_VIDEO_WIDGET_COMMON_H
-
-#include "bacon-video-widget.h"
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-#define SMALL_STREAM_WIDTH 200
-#define SMALL_STREAM_HEIGHT 120
-
-struct BaconVideoWidgetCommon {
- char *mrl;
-};
-
-gboolean bacon_video_widget_common_can_direct_seek (BaconVideoWidgetCommon *com);
-gboolean bacon_video_widget_common_get_vis_quality (BvwVisualsQuality q,
- int *height,
- int *fps);
-
-G_END_DECLS
-
-#endif /* HAVE_BACON_VIDEO_WIDGET_COMMON_H */
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 6b26fa289..b82450a1b 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -35,7 +35,7 @@
* @stability: Unstable
* @include: bacon-video-widget.h
*
- * #BaconVideoWidget is a widget to play audio or video streams, with support for visualisations for audio-only streams. It has a GStreamer and xine
+ * #BaconVideoWidget is a widget to play audio or video streams, with support for visualisations for audio-only streams. It has a GStreamer
* backend, and abstracts away the differences to provide a simple interface to the functionality required by Totem. It handles all the low-level
* audio and video work for Totem (or passes the work off to the backend).
**/
@@ -76,7 +76,6 @@
#include <gconf/gconf-client.h>
#include "bacon-video-widget.h"
-#include "bacon-video-widget-common.h"
#include "bacon-video-widget-gst-missing-plugins.h"
#include "baconvideowidget-marshal.h"
#include "video-utils.h"
@@ -85,6 +84,8 @@
#define DEFAULT_HEIGHT 420
#define DEFAULT_WIDTH 315
+#define SMALL_STREAM_WIDTH 200
+#define SMALL_STREAM_HEIGHT 120
#define is_error(e, d, c) \
(e->domain == GST_##d##_ERROR && \
@@ -140,7 +141,8 @@ typedef enum {
struct BaconVideoWidgetPrivate
{
- BvwAspectRatio ratio_type;
+ char *mrl;
+ BvwAspectRatio ratio_type;
GstElement *play;
GstXOverlay *xoverlay; /* protect with lock */
@@ -345,7 +347,7 @@ bvw_error_msg (BaconVideoWidget * bvw, GstMessage * msg)
GST_ERROR ("code = %d", err->code);
GST_ERROR ("debug = %s", GST_STR_NULL (dbg));
GST_ERROR ("source = %" GST_PTR_FORMAT, msg->src);
- GST_ERROR ("uri = %s", GST_STR_NULL (bvw->com->mrl));
+ GST_ERROR ("uri = %s", GST_STR_NULL (bvw->priv->mrl));
g_message ("Error: %s\n%s\n", GST_STR_NULL (err->message),
GST_STR_NULL (dbg));
@@ -1195,8 +1197,7 @@ bacon_video_widget_init (BaconVideoWidget * bvw)
GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
bvw->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (bvw, BACON_TYPE_VIDEO_WIDGET, BaconVideoWidgetPrivate);
- bvw->com = g_new0 (BaconVideoWidgetCommon, 1);
-
+
priv->update_id = 0;
priv->tagcache = NULL;
priv->audiotags = NULL;
@@ -2001,8 +2002,8 @@ bacon_video_widget_finalize (GObject * object)
g_free (bvw->priv->media_device);
bvw->priv->media_device = NULL;
- g_free (bvw->com->mrl);
- bvw->com->mrl = NULL;
+ g_free (bvw->priv->mrl);
+ bvw->priv->mrl = NULL;
g_free (bvw->priv->vis_element_name);
bvw->priv->vis_element_name = NULL;
@@ -2051,8 +2052,6 @@ bacon_video_widget_finalize (GObject * object)
g_mutex_free (bvw->priv->lock);
- g_free (bvw->com);
-
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -2138,10 +2137,7 @@ bacon_video_widget_get_property (GObject * object, guint property_id,
* @bvw: a #BaconVideoWidget
*
* Returns the name string for @bvw. For the GStreamer backend, it is the output
- * of gst_version_string(). For the xine backend, it is a string of the
- * form <literal>xine-lib version <replaceable>%s</replaceable></literal>, where
- * <replaceable>%s</replaceable> is the version number from xine_get_version_string().
- *
+ * of gst_version_string(). *
* Return value: the backend's name; free with g_free()
**/
char *
@@ -2919,7 +2915,7 @@ bacon_video_widget_open (BaconVideoWidget * bvw,
g_return_val_if_fail (bvw->priv->play != NULL, FALSE);
/* So we aren't closed yet... */
- if (bvw->com->mrl) {
+ if (bvw->priv->mrl) {
bacon_video_widget_close (bvw);
}
@@ -2932,32 +2928,32 @@ bacon_video_widget_open (BaconVideoWidget * bvw,
/* Only use the URI when FUSE isn't available for a file */
path = g_file_get_path (file);
if (path) {
- bvw->com->mrl = g_filename_to_uri (path, NULL, NULL);
+ bvw->priv->mrl = g_filename_to_uri (path, NULL, NULL);
g_free (path);
} else {
- bvw->com->mrl = g_strdup (mrl);
+ bvw->priv->mrl = g_strdup (mrl);
}
g_object_unref (file);
if (g_str_has_prefix (mrl, "icy:") != FALSE) {
/* Handle "icy://" URLs from QuickTime */
- g_free (bvw->com->mrl);
- bvw->com->mrl = g_strdup_printf ("http:%s", mrl + 4);
+ g_free (bvw->priv->mrl);
+ bvw->priv->mrl = g_strdup_printf ("http:%s", mrl + 4);
} else if (g_str_has_prefix (mrl, "icyx:") != FALSE) {
/* Handle "icyx://" URLs from Orban/Coding Technologies AAC/aacPlus Player */
- g_free (bvw->com->mrl);
- bvw->com->mrl = g_strdup_printf ("http:%s", mrl + 5);
+ g_free (bvw->priv->mrl);
+ bvw->priv->mrl = g_strdup_printf ("http:%s", mrl + 5);
} else if (g_str_has_prefix (mrl, "dvd:///")) {
/* this allows to play backups of dvds */
- g_free (bvw->com->mrl);
- bvw->com->mrl = g_strdup ("dvd://");
+ g_free (bvw->priv->mrl);
+ bvw->priv->mrl = g_strdup ("dvd://");
g_free (bvw->priv->media_device);
bvw->priv->media_device = g_strdup (mrl + strlen ("dvd://"));
} else if (g_str_has_prefix (mrl, "vcd:///")) {
/* this allows to play backups of vcds */
- g_free (bvw->com->mrl);
- bvw->com->mrl = g_strdup ("vcd://");
+ g_free (bvw->priv->mrl);
+ bvw->priv->mrl = g_strdup ("vcd://");
g_free (bvw->priv->media_device);
bvw->priv->media_device = g_strdup (mrl + strlen ("vcd://"));
}
@@ -2982,11 +2978,11 @@ bacon_video_widget_open (BaconVideoWidget * bvw,
setup_vis (bvw);
}
- if (g_strrstr (bvw->com->mrl, "#subtitle:")) {
+ if (g_strrstr (bvw->priv->mrl, "#subtitle:")) {
gchar **uris;
gchar *subtitle_uri;
- uris = g_strsplit (bvw->com->mrl, "#subtitle:", 2);
+ uris = g_strsplit (bvw->priv->mrl, "#subtitle:", 2);
/* Try to fix subtitle uri if needed */
if (uris[1][0] == '/') {
subtitle_uri = g_strdup_printf ("file://%s", uris[1]);
@@ -3005,12 +3001,12 @@ bacon_video_widget_open (BaconVideoWidget * bvw,
g_free (cur_dir);
}
}
- g_object_set (bvw->priv->play, "uri", bvw->com->mrl,
+ g_object_set (bvw->priv->play, "uri", bvw->priv->mrl,
"suburi", subtitle_uri, NULL);
g_free (subtitle_uri);
g_strfreev (uris);
} else {
- g_object_set (bvw->priv->play, "uri", bvw->com->mrl,
+ g_object_set (bvw->priv->play, "uri", bvw->priv->mrl,
"suburi", subtitle_uri, NULL);
}
@@ -3055,8 +3051,8 @@ bacon_video_widget_open (BaconVideoWidget * bvw,
} else {
bvw->priv->ignore_messages_mask |= GST_MESSAGE_ERROR;
bvw_stop_play_pipeline (bvw);
- g_free (bvw->com->mrl);
- bvw->com->mrl = NULL;
+ g_free (bvw->priv->mrl);
+ bvw->priv->mrl = NULL;
}
}
@@ -3085,9 +3081,6 @@ bacon_video_widget_open (BaconVideoWidget * bvw,
* Errors from the GStreamer backend will be returned asynchronously via the
* #BaconVideoWidget::error signal, even if this function returns %TRUE.
*
- * The xine backend will synchronously return a #BvwError in @error if it
- * encounters a problem.
- *
* Return value: %TRUE on success, %FALSE otherwise
**/
gboolean
@@ -3098,7 +3091,7 @@ bacon_video_widget_play (BaconVideoWidget * bvw, GError ** error)
g_return_val_if_fail (bvw != NULL, FALSE);
g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (bvw->priv->play), FALSE);
- g_return_val_if_fail (bvw->com->mrl != NULL, FALSE);
+ g_return_val_if_fail (bvw->priv->mrl != NULL, FALSE);
bvw->priv->target_state = GST_STATE_PLAYING;
@@ -3139,7 +3132,17 @@ bacon_video_widget_can_direct_seek (BaconVideoWidget *bvw)
g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (bvw->priv->play), FALSE);
- return bacon_video_widget_common_can_direct_seek (bvw->com);
+ if (bvw->priv->mrl == NULL)
+ return FALSE;
+
+ /* (instant seeking only make sense with video,
+ * hence no cdda:// here) */
+ if (g_str_has_prefix (bvw->priv->mrl, "file://") ||
+ g_str_has_prefix (bvw->priv->mrl, "dvd:/") ||
+ g_str_has_prefix (bvw->priv->mrl, "vcd:/"))
+ return TRUE;
+
+ return FALSE;
}
/**
@@ -3163,8 +3166,8 @@ bacon_video_widget_seek_time (BaconVideoWidget *bvw, gint64 time, GError **error
if (time > bvw->priv->stream_length
&& bvw->priv->stream_length > 0
- && !g_str_has_prefix (bvw->com->mrl, "dvd:")
- && !g_str_has_prefix (bvw->com->mrl, "vcd:")) {
+ && !g_str_has_prefix (bvw->priv->mrl, "dvd:")
+ && !g_str_has_prefix (bvw->priv->mrl, "vcd:")) {
if (bvw->priv->eos_id == 0)
bvw->priv->eos_id = g_idle_add (bvw_signal_eos_delayed, bvw);
return TRUE;
@@ -3280,8 +3283,8 @@ bacon_video_widget_close (BaconVideoWidget * bvw)
GST_LOG ("Closing");
bvw_stop_play_pipeline (bvw);
- g_free (bvw->com->mrl);
- bvw->com->mrl = NULL;
+ g_free (bvw->priv->mrl);
+ bvw->priv->mrl = NULL;
bvw->priv->is_live = FALSE;
bvw->priv->window_resized = FALSE;
@@ -3519,7 +3522,7 @@ bacon_video_widget_pause (BaconVideoWidget * bvw)
g_return_if_fail (bvw != NULL);
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
g_return_if_fail (GST_IS_ELEMENT (bvw->priv->play));
- g_return_if_fail (bvw->com->mrl != NULL);
+ g_return_if_fail (bvw->priv->mrl != NULL);
if (bvw->priv->is_live != FALSE) {
GST_LOG ("Stopping because we have a live stream");
@@ -3730,6 +3733,16 @@ bacon_video_widget_get_show_cursor (BaconVideoWidget * bvw)
return bvw->priv->cursor_shown;
}
+static struct {
+ int height;
+ int fps;
+} const vis_qualities[] = {
+ { 240, 15 }, /* VISUAL_SMALL */
+ { 320, 25 }, /* VISUAL_NORMAL */
+ { 480, 25 }, /* VISUAL_LARGE */
+ { 600, 30 } /* VISUAL_EXTRA_LARGE */
+};
+
static void
get_visualization_size (BaconVideoWidget *bvw,
int *w, int *h, gint *fps_n, gint *fps_d)
@@ -3737,11 +3750,15 @@ get_visualization_size (BaconVideoWidget *bvw,
GdkScreen *screen;
int new_fps_n;
+ g_return_if_fail (h != NULL);
+ g_return_if_fail (fps_n != NULL);
+ g_return_if_fail (bvw->priv->visq < G_N_ELEMENTS (vis_qualities));
+
if (!bvw->priv->video_window)
return;
- if (bacon_video_widget_common_get_vis_quality (bvw->priv->visq, h, &new_fps_n) == FALSE)
- return;
+ *h = vis_qualities[bvw->priv->visq].height;
+ new_fps_n = vis_qualities[bvw->priv->visq].fps;
screen = gtk_widget_get_screen (GTK_WIDGET (bvw));
*w = *h * gdk_screen_get_width (screen) / gdk_screen_get_height (screen);
@@ -4472,7 +4489,7 @@ bacon_video_widget_is_seekable (BaconVideoWidget * bvw)
g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (bvw->priv->play), FALSE);
- if (bvw->com->mrl == NULL)
+ if (bvw->priv->mrl == NULL)
return FALSE;
old_seekable = bvw->priv->seekable;
@@ -4654,14 +4671,11 @@ bacon_video_widget_get_dvb_mrls (const char *device)
* Totem (and hence #BaconVideoWidget).
*
* A %BVW_ERROR_NO_PLUGIN_FOR_FILE error will be returned if the required GStreamer elements do
- * not exist for the given @type (for the GStreamer backend), or if the media type is
- * unsupported by xine (for the xine backend).
- *
+ * not exist for the given @type (for the GStreamer backend). *
* If @device does not exist, a %BVW_ERROR_INVALID_DEVICE error will be returned.
*
* If @type is %MEDIA_TYPE_DVB and the DVB channels file (as given by
- * bacon_video_widget_get_channels_file() for the GStreamer backend, and in the user's
- * <filename class="directory">.xine</filename> directory for the xine backend)
+ * bacon_video_widget_get_channels_file() for the GStreamer backend)
* does not exist, a %BVW_ERROR_FILE_NOT_FOUND error will be returned.
*
* Return value: a %NULL-terminated array of MRLs, or %NULL; free with g_strfreev()
@@ -5522,9 +5536,8 @@ bacon_video_widget_get_option_group (void)
* @argc: pointer to application's argc
* @argv: pointer to application's argv
*
- * Initialises #BaconVideoWidget's backend (either GStreamer or xine). If this fails
- * for the GStreamer backend, your application will be terminated. This is a no-op
- * for the xine backend.
+ * Initialises #BaconVideoWidget's GStreamer backend. If this fails
+ * for the GStreamer backend, your application will be terminated.
*
* Applications must call either this or bacon_video_widget_get_option_group() exactly
* once; but not both.
diff --git a/src/backend/bacon-video-widget-xine.c b/src/backend/bacon-video-widget-xine.c
deleted file mode 100644
index c4f77d293..000000000
--- a/src/backend/bacon-video-widget-xine.c
+++ /dev/null
@@ -1,4350 +0,0 @@
-/*
- * Copyright (C) 2001-2005 the xine project
- * Heavily modified by Bastien Nocera <hadess@hadess.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * $Id$
- *
- * the xine engine in a widget - implementation
- */
-
-#include <config.h>
-
-/* system */
-#include <math.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sched.h>
-#include <pthread.h>
-/* X11 */
-#include <X11/X.h>
-#include <X11/Xlib.h>
-/* gtk+/gnome */
-#include <gio/gio.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
-#include <glib/gi18n.h>
-/* xine */
-#define XINE_ENABLE_EXPERIMENTAL_FEATURES
-#include <xine.h>
-
-#include "debug.h"
-#include "bacon-video-widget.h"
-#include "bacon-video-widget-common.h"
-#include "baconvideowidget-marshal.h"
-#include "video-utils.h"
-#include "bacon-resize.h"
-
-#define DEFAULT_HEIGHT 180
-#define DEFAULT_WIDTH 240
-/* This is built into a path with g_get_user_config_dir(), so the full
- * path is something like ~/.config/totem/xine_config */
-#define CONFIG_FILE "totem"G_DIR_SEPARATOR_S"xine_config"
-
-/* Signals */
-enum {
- ERROR,
- EOS,
- REDIRECT,
- TITLE_CHANGE,
- CHANNELS_CHANGE,
- SIGNAL_TICK,
- GOT_METADATA,
- BUFFERING,
- LAST_SIGNAL
-};
-
-/* Enum for none-signal stuff that needs to go through the AsyncQueue */
-enum {
- RATIO_ASYNC,
- REDIRECT_ASYNC,
- TITLE_CHANGE_ASYNC,
- EOS_ASYNC,
- CHANNELS_CHANGE_ASYNC,
- BUFFERING_ASYNC,
- MESSAGE_ASYNC,
- ERROR_ASYNC
-};
-
-typedef struct {
- int signal;
- char *msg;
- int num;
- gboolean fatal;
-} signal_data;
-
-enum {
- SEEKING_BY_INVALID,
- SEEKING_BY_TIME,
- SEEKING_BY_FRACTION
-};
-
-/* Arguments */
-enum {
- PROP_0,
- PROP_LOGO_MODE,
- PROP_SPEED,
- PROP_POSITION,
- PROP_CURRENT_TIME,
- PROP_STREAM_LENGTH,
- PROP_PLAYING,
- PROP_SEEKABLE,
- PROP_SHOW_CURSOR,
- PROP_SHOW_VISUALS,
- PROP_VOLUME
-};
-
-static int video_props[4] = {
- XINE_PARAM_VO_BRIGHTNESS,
- XINE_PARAM_VO_CONTRAST,
- XINE_PARAM_VO_SATURATION,
- XINE_PARAM_VO_HUE
-};
-
-static char *video_props_str[4] = {
- GCONF_PREFIX"/brightness",
- GCONF_PREFIX"/contrast",
- GCONF_PREFIX"/saturation",
- GCONF_PREFIX"/hue"
-};
-
-enum {
- BVW_XINE_PLAY,
- BVW_XINE_PAUSE
-};
-
-struct BaconVideoWidgetPrivate {
- /* Xine stuff */
- xine_t *xine;
- xine_stream_t *stream;
- xine_video_port_t *vo_driver;
- xine_audio_port_t *ao_driver;
- xine_event_queue_t *ev_queue;
- double display_ratio;
-
- /* Configuration */
- GConfClient *gc;
- BvwUseType type;
-
- /* X stuff */
- Display *display;
- int screen;
- GdkCursor *cursor;
-
- /* Opening thread for fd://0 */
- pthread_t open_thread;
- pthread_mutex_t queued_actions_mutex;
- GList *queued_actions;
-
- /* Visual effects */
- char *vis_name;
- xine_post_t *vis;
- GList *visuals;
- char *queued_vis;
- BvwVisualsQuality quality;
-
- /* Seeking stuff */
- int seeking;
- double seek_dest;
- gint64 seek_dest_time;
-
- /* Logo */
- GdkPixbuf *logo_pixbuf;
- /* Logo, save frame_output_cb members */
- int dest_x, dest_y, dest_width, dest_height, win_x, win_y;
- double dest_pixel_aspect;
-
- /* Other stuff */
- int xpos, ypos;
- guint tick_id;
- double volume;
- BvwAudioOutType audio_out_type;
- gint64 stream_length;
- double zoom;
-
- GAsyncQueue *queue;
- int video_width, video_height;
- int init_width, init_height;
-
- /* fullscreen stuff */
- int screenid;
-
- /* Bacon resize */
- BaconResize *bacon_resize;
-
- guint ao_driver_none : 1;
- guint show_vfx : 1;
- guint using_vfx : 1;
- guint logo_mode : 1;
- guint can_dvd : 1;
- guint can_vcd : 1;
- guint can_dvb : 1;
- guint auto_resize : 1;
- guint is_live : 1;
- guint got_redirect : 1;
- guint has_subtitle : 1;
- /* Whether the last button event was consumed internally */
- guint bevent_consumed : 1;
- guint fullscreen_mode : 1;
- guint cursor_shown : 1;
- /* Whether the window has already been resized for this media */
- guint window_resized : 1;
-};
-
-static const char *mms_bandwidth_strs[] = {
- "14.4 Kbps (Modem)",
- "19.2 Kbps (Modem)",
- "28.8 Kbps (Modem)",
- "33.6 Kbps (Modem)",
- "34.4 Kbps (Modem)",
- "57.6 Kbps (Modem)",
- "115.2 Kbps (ISDN)",
- "262.2 Kbps (Cable/DSL)",
- "393.2 Kbps (Cable/DSL)",
- "524.3 Kbps (Cable/DSL)",
- "1.5 Mbps (T1)",
- "10.5 Mbps (LAN)",
- NULL
-};
-
-static const char *audio_out_types_strs[] = {
- "Mono 1.0",
- "Stereo 2.0",
- "Headphones 2.0",
- "Stereo 2.1",
- "Surround 3.0",
- "Surround 4.0",
- "Surround 4.1",
- "Surround 5.0",
- "Surround 5.1",
- "Surround 6.0",
- "Surround 6.1",
- "Surround 7.1",
- "Pass Through",
- NULL
-};
-
-static const char *demux_strategies_str[] = {
- "default",
- "reverse",
- "content",
- "extension",
- NULL
-};
-
-static void bacon_video_widget_class_init (BaconVideoWidgetClass *klass);
-static void bacon_video_widget_init (BaconVideoWidget *bvw);
-
-static void setup_config (BaconVideoWidget *bvw);
-
-static void bacon_video_widget_set_property (GObject *object,
- guint property_id, const GValue *value, GParamSpec *pspec);
-static void bacon_video_widget_get_property (GObject *object,
- guint property_id, GValue *value, GParamSpec *pspec);
-
-static void bacon_video_widget_realize (GtkWidget *widget);
-static void bacon_video_widget_unrealize (GtkWidget *widget);
-static void bacon_video_widget_finalize (GObject *object);
-
-static gboolean bacon_video_widget_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gboolean bacon_video_widget_motion_notify (GtkWidget *widget,
- GdkEventMotion *event);
-static gboolean bacon_video_widget_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static void bacon_video_widget_show (GtkWidget *widget);
-static void bacon_video_widget_hide (GtkWidget *widget);
-
-static void bacon_video_widget_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void bacon_video_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static xine_video_port_t * load_video_out_driver (BaconVideoWidget *bvw,
- BvwUseType type);
-static xine_audio_port_t * load_audio_out_driver (BaconVideoWidget *bvw,
- gboolean null_out, GError **error);
-static gboolean bacon_video_widget_tick_send (BaconVideoWidget *bvw);
-static void bacon_video_widget_reconfigure_tick (BaconVideoWidget *bvw, gboolean enable);
-static void bacon_video_widget_set_visuals_quality_size (BaconVideoWidget *bvw,
- int h, int w, int fps);
-
-static GObjectClass *parent_class = NULL;
-
-static void xine_event (void *user_data, const xine_event_t *event);
-static gboolean bacon_video_widget_idle_signal (BaconVideoWidget *bvw);
-static void show_vfx_update (BaconVideoWidget *bvw, gboolean show_visuals);
-
-static int bvw_table_signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE(BaconVideoWidget, bacon_video_widget, GTK_TYPE_EVENT_BOX)
-
-static void
-bacon_video_widget_class_init (BaconVideoWidgetClass *klass)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GObjectClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- /* GtkWidget */
- widget_class->realize = bacon_video_widget_realize;
- widget_class->unrealize = bacon_video_widget_unrealize;
- widget_class->size_request = bacon_video_widget_size_request;
- widget_class->size_allocate = bacon_video_widget_size_allocate;
- widget_class->expose_event = bacon_video_widget_expose;
- widget_class->motion_notify_event = bacon_video_widget_motion_notify;
- widget_class->button_press_event = bacon_video_widget_button_press;
- widget_class->show = bacon_video_widget_show;
- widget_class->hide = bacon_video_widget_hide;
-
- /* GObject */
- object_class->set_property = bacon_video_widget_set_property;
- object_class->get_property = bacon_video_widget_get_property;
- object_class->finalize = bacon_video_widget_finalize;
-
- /* Properties */
- g_object_class_install_property (object_class, PROP_LOGO_MODE,
- g_param_spec_boolean ("logo_mode", NULL, NULL,
- FALSE, G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_POSITION,
- g_param_spec_double ("position", NULL, NULL,
- 0, 1.0, 0, G_PARAM_READABLE));
- g_object_class_install_property (object_class, PROP_STREAM_LENGTH,
- g_param_spec_int64 ("stream_length", NULL, NULL,
- 0, G_MAXINT64, 0, G_PARAM_READABLE));
- g_object_class_install_property (object_class, PROP_PLAYING,
- g_param_spec_boolean ("playing", NULL, NULL,
- FALSE, G_PARAM_READABLE));
- g_object_class_install_property (object_class, PROP_SEEKABLE,
- g_param_spec_boolean ("seekable", NULL, NULL,
- FALSE, G_PARAM_READABLE));
- g_object_class_install_property (object_class, PROP_VOLUME,
- g_param_spec_double ("volume", NULL, NULL,
- 0.0, 1.0, 0.0,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_SHOW_CURSOR,
- g_param_spec_boolean ("show-cursor", NULL, NULL,
- FALSE, G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_SHOW_VISUALS,
- g_param_spec_boolean ("show-visuals", NULL, NULL,
- FALSE, G_PARAM_WRITABLE));
-
- /* Signals */
- bvw_table_signals[ERROR] =
- g_signal_new ("error",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (BaconVideoWidgetClass, error),
- NULL, NULL,
- baconvideowidget_marshal_VOID__STRING_BOOLEAN_BOOLEAN,
- G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN);
-
- bvw_table_signals[EOS] =
- g_signal_new ("eos",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (BaconVideoWidgetClass, eos),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
- bvw_table_signals[REDIRECT] =
- g_signal_new ("got-redirect",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (BaconVideoWidgetClass, got_redirect),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- bvw_table_signals[GOT_METADATA] =
- g_signal_new ("got-metadata",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (BaconVideoWidgetClass, got_metadata),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
- bvw_table_signals[TITLE_CHANGE] =
- g_signal_new ("title-change",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (BaconVideoWidgetClass, title_change),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- bvw_table_signals[CHANNELS_CHANGE] =
- g_signal_new ("channels-change",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (BaconVideoWidgetClass, channels_change),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- bvw_table_signals[SIGNAL_TICK] =
- g_signal_new ("tick",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (BaconVideoWidgetClass, tick),
- NULL, NULL,
- baconvideowidget_marshal_VOID__INT64_INT64_DOUBLE_BOOLEAN,
- G_TYPE_NONE, 4, G_TYPE_INT64, G_TYPE_INT64,
- G_TYPE_DOUBLE, G_TYPE_BOOLEAN);
-
- bvw_table_signals[BUFFERING] =
- g_signal_new ("buffering",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (BaconVideoWidgetClass, buffering),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-}
-
-static void
-bacon_video_widget_init (BaconVideoWidget *bvw)
-{
- const char *const *autoplug_list;
- int i = 0;
-
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
-
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (bvw), GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
-
- bvw->com = g_new0 (BaconVideoWidgetCommon, 1);
- bvw->priv = g_new0 (BaconVideoWidgetPrivate, 1);
- bvw->priv->xine = xine_new ();
- bvw->priv->cursor_shown = TRUE;
- bvw->priv->volume = 0.0;
-
- bvw->priv->init_width = 0;
- bvw->priv->init_height = 0;
-
- bvw->priv->queue = g_async_queue_new ();
-
- /* init configuration */
- bvw->priv->gc = gconf_client_get_default ();
- setup_config (bvw);
-
- xine_init (bvw->priv->xine);
-
- /* Can we play DVDs and VCDs ? */
- autoplug_list = xine_get_autoplay_input_plugin_ids (bvw->priv->xine);
- while (autoplug_list && autoplug_list[i])
- {
- if (g_ascii_strcasecmp (autoplug_list[i], "VCD") == 0) {
- bvw->priv->can_vcd = TRUE;
- } else if (g_ascii_strcasecmp (autoplug_list[i], "DVD") == 0) {
- bvw->priv->can_dvd = TRUE;
- } else if (g_ascii_strcasecmp (autoplug_list[i], "DVB") == 0) {
- bvw->priv->can_dvb = TRUE;
- }
- i++;
- }
-}
-
-static void
-bacon_video_widget_finalize (GObject *object)
-{
- BaconVideoWidget *bvw = (BaconVideoWidget *) object;
-
- if (&bvw->priv->queued_actions_mutex != NULL)
- pthread_mutex_destroy (&bvw->priv->queued_actions_mutex);
-
- if (bvw->priv->gc)
- g_object_unref (G_OBJECT (bvw->priv->gc));
-
- if (bvw->priv->xine != NULL) {
- xine_plugins_garbage_collector (bvw->priv->xine);
- xine_exit (bvw->priv->xine);
- bvw->priv->xine = NULL;
- }
- if (bvw->priv->cursor != NULL) {
- gdk_cursor_unref (bvw->priv->cursor);
- bvw->priv->cursor = NULL;
- }
- if (bvw->priv->logo_pixbuf != NULL) {
- g_object_unref (bvw->priv->logo_pixbuf);
- bvw->priv->logo_pixbuf = NULL;
- }
- g_free (bvw->priv->vis_name);
- g_object_unref (G_OBJECT (bvw->priv->gc));
-
- g_list_foreach (bvw->priv->visuals, (GFunc) g_free, NULL);
- g_list_free (bvw->priv->visuals);
-
- g_idle_remove_by_data (bvw);
- g_async_queue_unref (bvw->priv->queue);
- G_OBJECT_CLASS (parent_class)->finalize (object);
-
- g_free (bvw->priv);
- g_free (bvw->com);
-}
-
-static gboolean
-bacon_video_widget_draw_logo (BaconVideoWidget *bvw)
-{
- gboolean draw_logo, has_video;
-
- /* draw the logo in logo mode */
- if (bvw->priv->logo_mode != FALSE)
- return TRUE;
-
- /* We're probably shutting down when this happens */
- if (bvw->priv->stream == NULL)
- return TRUE;
-
- /* if there's only audio and no visualisation, draw the logo as well */
- has_video = xine_get_stream_info(bvw->priv->stream,
- XINE_STREAM_INFO_HAS_VIDEO);
- draw_logo = !has_video && !bvw->priv->using_vfx;
-
- return draw_logo;
-}
-
-static void
-dest_size_cb (void *data,
- int video_width, int video_height,
- double video_pixel_aspect,
- int *dest_width, int *dest_height,
- double *dest_pixel_aspect)
-{
- BaconVideoWidget *bvw = (BaconVideoWidget *)data;
-
- /* correct size with video_pixel_aspect */
- if (video_pixel_aspect >= bvw->priv->display_ratio)
- video_width = video_width * video_pixel_aspect
- / bvw->priv->display_ratio + .5;
- else
- video_height = video_height * bvw->priv->display_ratio
- / video_pixel_aspect + .5;
-
- *dest_width = GTK_WIDGET(bvw)->allocation.width;
- *dest_height = GTK_WIDGET(bvw)->allocation.height;
- *dest_pixel_aspect = bvw->priv->display_ratio;
-}
-
-static void
-frame_output_cb (void *bvw_gen,
- int video_width, int video_height,
- double video_pixel_aspect,
- int *dest_x, int *dest_y,
- int *dest_width, int *dest_height,
- double *dest_pixel_aspect,
- int *win_x, int *win_y)
-{
- BaconVideoWidget *bvw = (BaconVideoWidget *) bvw_gen;
-
- if (bvw == NULL || bvw->priv == NULL)
- return;
-
- if (bacon_video_widget_draw_logo (bvw) != FALSE) {
- /* display the video outside the window,
- * otherwise xine-lib will show stuff on top
- * of our logo */
- *dest_x = - bvw->priv->dest_width;
- *dest_y = - bvw->priv->dest_height;
- *dest_width = bvw->priv->dest_width;
- *dest_height = bvw->priv->dest_height;
- *win_x = bvw->priv->win_x;
- *win_y = bvw->priv->win_y;
- *dest_pixel_aspect = bvw->priv->dest_pixel_aspect;
- return;
- }
-
- /* correct size with video_pixel_aspect */
- if (video_pixel_aspect >= bvw->priv->display_ratio)
- {
- video_width = video_width * video_pixel_aspect
- / bvw->priv->display_ratio + .5;
- } else {
- video_height = video_height * bvw->priv->display_ratio
- / video_pixel_aspect + .5;
- }
-
- *dest_x = 0;
- *dest_y = 0;
- *win_x = bvw->priv->xpos;
- *win_y = bvw->priv->ypos;
-
- *dest_width = GTK_WIDGET(bvw)->allocation.width;
- *dest_height = GTK_WIDGET(bvw)->allocation.height;
-
- /* Size changed */
- if (bvw->priv->video_width != video_width
- || bvw->priv->video_height != video_height)
- {
- bvw->priv->video_width = video_width;
- bvw->priv->video_height = video_height;
-
- if (bvw->priv->auto_resize != FALSE
- && bvw->priv->logo_mode == FALSE
- && bvw->priv->fullscreen_mode == FALSE
- && bvw->priv->window_resized == FALSE)
- {
- signal_data *data;
-
- bvw->priv->window_resized = TRUE;
-
- data = g_new0 (signal_data, 1);
- data->signal = RATIO_ASYNC;
- g_async_queue_push (bvw->priv->queue, data);
- g_idle_add ((GSourceFunc)
- bacon_video_widget_idle_signal, bvw);
- }
- }
-
- *dest_pixel_aspect = bvw->priv->display_ratio;
-
- /* Save them */
- bvw->priv->dest_x = *dest_x;
- bvw->priv->dest_y = *dest_y;
- bvw->priv->dest_width = *dest_width;
- bvw->priv->dest_height = *dest_height;
- bvw->priv->win_x = *win_x;
- bvw->priv->win_y = *win_y;
- bvw->priv->dest_pixel_aspect = *dest_pixel_aspect;
-}
-
-static xine_video_port_t *
-load_video_out_driver (BaconVideoWidget *bvw, BvwUseType type)
-{
- double res_h, res_v;
- x11_visual_t vis;
- const char *video_driver_id;
- xine_video_port_t *vo_driver;
- static char *drivers[] = { "xv", "xshm" };
- guint i;
-
- if (type == BVW_USE_TYPE_METADATA) {
- return xine_open_video_driver (bvw->priv->xine,
- "none", XINE_VISUAL_TYPE_NONE, NULL);
- } else if (type == BVW_USE_TYPE_CAPTURE) {
- return xine_new_framegrab_video_port (bvw->priv->xine);
- }
-
- vis.display = bvw->priv->display;
- vis.screen = bvw->priv->screen;
- vis.d = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET(bvw)));
- res_h = (DisplayWidth (bvw->priv->display, bvw->priv->screen) * 1000 /
- DisplayWidthMM (bvw->priv->display,
- bvw->priv->screen));
- res_v = (DisplayHeight (bvw->priv->display, bvw->priv->screen) * 1000 /
- DisplayHeightMM (bvw->priv->display,
- bvw->priv->screen));
-
- /* FIXME this should be fixed with proper multi-head handling in
- * the xine-lib backend */
- if (res_h == 0 || res_v == 0)
- bvw->priv->display_ratio = 1.0;
- else
- bvw->priv->display_ratio = res_v / res_h;
-
- if (fabs (bvw->priv->display_ratio - 1.0) < 0.01) {
- bvw->priv->display_ratio = 1.0;
- }
-
- vis.dest_size_cb = dest_size_cb;
- vis.frame_output_cb = frame_output_cb;
- vis.user_data = bvw;
-
- /* Try to init video with stored information */
- video_driver_id = xine_config_register_string (bvw->priv->xine,
- "video.driver", "auto", "video driver to use",
- NULL, 10, NULL, NULL);
-
- /* Don't try to load anything but the xshm plugin if we're not
- * on a local display */
- if (totem_display_is_local () == FALSE ||
- (bvw->priv->init_width < SMALL_STREAM_WIDTH
- && bvw->priv->init_width > 0
- && bvw->priv->init_height < SMALL_STREAM_HEIGHT
- && bvw->priv->init_height > 0))
- {
- return xine_open_video_driver (bvw->priv->xine, "xshm",
- XINE_VISUAL_TYPE_X11, (void *) &vis);
- }
-
- if (strcmp (video_driver_id, "auto") != 0)
- {
- vo_driver = xine_open_video_driver (bvw->priv->xine,
- video_driver_id,
- XINE_VISUAL_TYPE_X11,
- (void *) &vis);
- if (vo_driver)
- return vo_driver;
- }
-
- /* The types are hardcoded for now */
- for (i = 0; i < G_N_ELEMENTS (drivers); i++) {
- vo_driver = xine_open_video_driver (bvw->priv->xine,
- drivers[i], XINE_VISUAL_TYPE_X11,
- (void *) &vis);
- if (vo_driver)
- break;
- }
-
- return vo_driver;
-}
-
-static xine_audio_port_t *
-load_audio_out_driver (BaconVideoWidget *bvw, gboolean null_out,
- GError **error)
-{
- xine_audio_port_t *ao_driver;
- const char *audio_driver_id;
-
- if (null_out != FALSE) {
- ao_driver = xine_open_audio_driver (bvw->priv->xine,
- "none", NULL);
- if (ao_driver != NULL) {
- bvw->priv->ao_driver_none = TRUE;
- }
- return ao_driver;
- }
-
- audio_driver_id = xine_config_register_string (bvw->priv->xine,
- "audio.driver", "auto", "audio driver to use",
- NULL, 10, NULL, NULL);
-
- /* No configuration, fallback to auto */
- if (audio_driver_id == NULL || strcmp (audio_driver_id, "") == 0)
- audio_driver_id = g_strdup ("auto");
-
- /* We know how to handle null driver */
- if (strcmp (audio_driver_id, "null") == 0)
- return NULL;
-
- /* auto probe */
- if (strcmp (audio_driver_id, "auto") == 0)
- ao_driver = xine_open_audio_driver (bvw->priv->xine,
- NULL, NULL);
- else
- ao_driver = xine_open_audio_driver (bvw->priv->xine,
- audio_driver_id, NULL);
-
- /* if it failed without autoprobe, probe */
- if (ao_driver == NULL && strcmp (audio_driver_id, "auto") != 0)
- ao_driver = xine_open_audio_driver (bvw->priv->xine,
- NULL, NULL);
-
- if (ao_driver == NULL && strcmp (audio_driver_id, "auto") != 0)
- {
- g_set_error (error, BVW_ERROR, BVW_ERROR_AUDIO_PLUGIN,
- _("Couldn't load the '%s' audio driver\n"
- "Check that the device is not busy."),
- audio_driver_id ? audio_driver_id : "auto" );
- return NULL;
- }
-
- return ao_driver;
-}
-
-static void
-bvw_config_helper_string (xine_t *xine, const char *id, const char *val,
- xine_cfg_entry_t *entry)
-{
- memset (entry, 0, sizeof (entry));
-
- if (!xine_config_lookup_entry (xine, id, entry))
- {
- xine_config_register_string (xine, id, val, "", NULL, 10,
- NULL, NULL);
- xine_config_lookup_entry (xine, id, entry);
- }
-}
-
-static void
-bvw_config_helper_num (xine_t *xine, const char *id, int val,
- xine_cfg_entry_t *entry)
-{
- memset (entry, 0, sizeof (entry));
-
- if (!xine_config_lookup_entry (xine, id, entry))
- {
- xine_config_register_num (xine, id, val, 0, NULL, 10,
- NULL, NULL);
- xine_config_lookup_entry (xine, id, entry);
- }
-}
-
-static void
-setup_config (BaconVideoWidget *bvw)
-{
- char *path;
- xine_cfg_entry_t entry;
-
- path = g_build_path (G_DIR_SEPARATOR_S,
- g_get_user_config_dir (), CONFIG_FILE, NULL);
- xine_config_load (bvw->priv->xine, path);
- g_free (path);
-
- /* default demux strategy */
- xine_config_register_enum (bvw->priv->xine,
- "engine.demux.strategy",
- 0,
- (char **) demux_strategies_str,
- "media format detection strategy",
- NULL, 10, NULL, NULL);
-
- xine_config_lookup_entry (bvw->priv->xine,
- "engine.demux.strategy", &entry);
- entry.num_value = 0;
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- if (bvw->priv->gc == NULL)
- return;
-
- /* Disable the mixer polling for ALSA */
- bvw_config_helper_num (bvw->priv->xine,
- "audio.alsa_hw_mixer", 1, &entry);
- entry.num_value = 0;
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- /* Don't save the last viewed channel for DVB */
- bvw_config_helper_num (bvw->priv->xine,
- "media.dvb.remember_channel", 1, &entry);
- entry.num_value = 0;
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- if (bvw->priv->gc == NULL) {
- g_warning ("GConf not available, broken installation?");
- return;
- }
-
- /* Debug configuration */
- if (gconf_client_get_bool (bvw->priv->gc,
- GCONF_PREFIX"/debug", NULL) == FALSE)
- {
- xine_engine_set_param (bvw->priv->xine,
- XINE_ENGINE_PARAM_VERBOSITY,
- XINE_VERBOSITY_NONE);
- } else {
- xine_engine_set_param (bvw->priv->xine,
- XINE_ENGINE_PARAM_VERBOSITY,
- 0xff);
- }
-
- /* Proxy configuration */
- if (gconf_client_get_bool (bvw->priv->gc, "/system/http_proxy/use_http_proxy", NULL) == FALSE)
- {
- bvw_config_helper_string (bvw->priv->xine,
- "media.network.http_proxy_host", "", &entry);
- entry.str_value = "";
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- return;
- }
-
- bvw_config_helper_string (bvw->priv->xine,
- "media.network.http_proxy_host", "", &entry);
- entry.str_value = gconf_client_get_string (bvw->priv->gc,
- "/system/http_proxy/host", NULL);
- xine_config_update_entry (bvw->priv->xine, &entry);
- g_free (entry.str_value);
-
- bvw_config_helper_num (bvw->priv->xine,
- "media.network.http_proxy_port", 8080, &entry);
- entry.num_value = gconf_client_get_int (bvw->priv->gc,
- "/system/http_proxy/port", NULL);
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- if (gconf_client_get_bool (bvw->priv->gc, "/system/http_proxy/use_authentication", NULL) == FALSE)
- {
- bvw_config_helper_string (bvw->priv->xine,
- "media.network.http_proxy_user", g_get_user_name(),
- &entry);
- entry.str_value = "";
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- bvw_config_helper_string (bvw->priv->xine,
- "media.network.http_proxy_password", "",
- &entry);
- entry.str_value = "";
- xine_config_update_entry (bvw->priv->xine, &entry);
- } else {
- bvw_config_helper_string (bvw->priv->xine,
- "media.network.http_proxy_user", g_get_user_name(),
- &entry);
- entry.str_value = gconf_client_get_string (bvw->priv->gc,
- "/system/http_proxy/authentication_user",
- NULL);
- xine_config_update_entry (bvw->priv->xine, &entry);
- g_free (entry.str_value);
-
- bvw_config_helper_string (bvw->priv->xine,
- "media.network.http_proxy_password", "",
- &entry);
- entry.str_value = gconf_client_get_string (bvw->priv->gc,
- "/system/http_proxy/authentication_password",
- NULL);
- xine_config_update_entry (bvw->priv->xine, &entry);
- g_free (entry.str_value);
- }
-}
-
-static void
-setup_config_stream (BaconVideoWidget *bvw)
-{
- GConfValue *confvalue;
- int value, i, tmp;
-
- if (bvw->priv->gc == NULL)
- return;
-
- /* Setup brightness and contrast */
- if (bvw->priv->vo_driver == NULL)
- return;
-
- for (i = 0; i < 4; i++)
- {
- confvalue = gconf_client_get_without_default (bvw->priv->gc,
- video_props_str[i], NULL);
-
- if (confvalue != NULL)
- {
- value = gconf_value_get_int (confvalue);
- gconf_value_free (confvalue);
- } else {
- value = 65535 / 2;
- }
-
- tmp = xine_get_param (bvw->priv->stream, video_props[i]);
- if (value != tmp)
- {
- xine_set_param (bvw->priv->stream,
- video_props[i], value);
- }
- }
-}
-
-static gboolean
-video_window_translate_point (BaconVideoWidget *bvw, int gui_x, int gui_y,
- int *video_x, int *video_y)
-{
- int res;
- x11_rectangle_t rect;
-
- rect.x = gui_x;
- rect.y = gui_y;
- rect.w = 0;
- rect.h = 0;
-
- res = xine_port_send_gui_data (bvw->priv->vo_driver,
- XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO, (void*)&rect);
-
- if (res != -1)
- {
- /* the driver implements gui->video coordinate space
- * translation so we use it */
- *video_x = rect.x;
- *video_y = rect.y;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/* Changes the way xine skips while playing a DVD,
- * 1 == CHAPTER
- * 2 == TITLE
- */
-static void
-dvd_skip_behaviour (BaconVideoWidget *bvw, int behaviour)
-{
- if (behaviour < 1 || behaviour > 2)
- return;
-
- xine_config_register_num (bvw->priv->xine,
- "media.dvd.skip_behaviour",
- behaviour,
- "DVD Skip behaviour",
- NULL,
- 10,
- NULL, NULL);
-
- return;
-}
-
-void
-bacon_video_widget_dvd_event (BaconVideoWidget *bvw, BvwDVDEvent type)
-{
- xine_event_t event;
-
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- switch (type)
- {
- case BVW_DVD_ROOT_MENU:
- event.type = XINE_EVENT_INPUT_MENU1;
- break;
- case BVW_DVD_TITLE_MENU:
- event.type = XINE_EVENT_INPUT_MENU2;
- break;
- case BVW_DVD_SUBPICTURE_MENU:
- event.type = XINE_EVENT_INPUT_MENU4;
- break;
- case BVW_DVD_AUDIO_MENU:
- event.type = XINE_EVENT_INPUT_MENU5;
- break;
- case BVW_DVD_ANGLE_MENU:
- event.type = XINE_EVENT_INPUT_MENU6;
- break;
- case BVW_DVD_CHAPTER_MENU:
- event.type = XINE_EVENT_INPUT_MENU7;
- break;
- case BVW_DVD_NEXT_CHAPTER:
- dvd_skip_behaviour (bvw, 1);
- event.type = XINE_EVENT_INPUT_NEXT;
- break;
- case BVW_DVD_PREV_CHAPTER:
- dvd_skip_behaviour (bvw, 1);
- event.type = XINE_EVENT_INPUT_PREVIOUS;
- break;
- case BVW_DVD_NEXT_TITLE:
- dvd_skip_behaviour (bvw, 2);
- event.type = XINE_EVENT_INPUT_NEXT;
- break;
- case BVW_DVD_PREV_TITLE:
- dvd_skip_behaviour (bvw, 2);
- event.type = XINE_EVENT_INPUT_PREVIOUS;
- break;
- case BVW_DVD_NEXT_ANGLE:
- event.type = XINE_EVENT_INPUT_ANGLE_NEXT;
- break;
- case BVW_DVD_PREV_ANGLE:
- event.type = XINE_EVENT_INPUT_ANGLE_PREVIOUS;
- break;
- case BVW_DVD_ROOT_MENU_UP:
- event.type = XINE_EVENT_INPUT_UP;
- break;
- case BVW_DVD_ROOT_MENU_DOWN:
- event.type = XINE_EVENT_INPUT_DOWN;
- break;
- case BVW_DVD_ROOT_MENU_LEFT:
- event.type = XINE_EVENT_INPUT_LEFT;
- break;
- case BVW_DVD_ROOT_MENU_RIGHT:
- event.type = XINE_EVENT_INPUT_RIGHT;
- break;
- case BVW_DVD_ROOT_MENU_SELECT:
- event.type = XINE_EVENT_INPUT_SELECT;
- break;
- default:
- return;
- }
-
- event.stream = bvw->priv->stream;
- event.data = NULL;
- event.data_length = 0;
-
- xine_event_send (bvw->priv->stream,
- (xine_event_t *) (&event));
-}
-
-static gboolean
-generate_mouse_event (BaconVideoWidget *bvw, GdkEvent *event,
- gboolean is_motion)
-{
- GdkEventMotion *mevent = (GdkEventMotion *) event;
- GdkEventButton *bevent = (GdkEventButton *) event;
- int x, y;
- gboolean retval;
-
- /* Don't even try to generate an event if we're dying */
- if (bvw->priv->stream == NULL)
- return FALSE;
-
- if (is_motion == FALSE && bevent->button != 1)
- return FALSE;
-
- if (is_motion != FALSE)
- retval = video_window_translate_point (bvw,
- mevent->x, mevent->y, &x, &y);
- else
- retval = video_window_translate_point (bvw,
- bevent->x, bevent->y, &x, &y);
-
- if (retval != FALSE)
- {
- xine_event_t event;
- xine_input_data_t input;
-
- if (is_motion != FALSE)
- {
- event.type = XINE_EVENT_INPUT_MOUSE_MOVE;
- input.button = 0; /* Just motion. */
- } else {
- event.type = XINE_EVENT_INPUT_MOUSE_BUTTON;
- input.button = 1;
- }
-
- input.x = x;
- input.y = y;
- event.stream = bvw->priv->stream;
- event.data = &input;
- event.data_length = sizeof(input);
-
- xine_event_send (bvw->priv->stream,
- (xine_event_t *) (&event));
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-configure_cb (GtkWidget *widget, GdkEventConfigure *event,
- BaconVideoWidget *bvw)
-{
- bvw->priv->xpos = event->x + GTK_WIDGET (bvw)->allocation.x;
- bvw->priv->ypos = event->y + GTK_WIDGET (bvw)->allocation.y;
-
- return FALSE;
-}
-
-static void
-size_changed_cb (GdkScreen *screen, BaconVideoWidget *bvw)
-{
- double res_h, res_v, vis_width;
- int vis_height, fps;
-
- res_h = gdk_screen_get_width (screen) * 1000 /
- gdk_screen_get_width_mm (screen);
- res_v = gdk_screen_get_height (screen) * 1000 /
- gdk_screen_get_height_mm (screen);
-
- if (bacon_video_widget_common_get_vis_quality (bvw->priv->quality, &vis_height, &fps) == FALSE)
- return;
-
- vis_width = vis_height * gdk_screen_get_width (screen) /
- gdk_screen_get_height (screen);
-
- bvw->priv->display_ratio = res_v / res_h;
-
- if (fabs (bvw->priv->display_ratio - 1.0) < 0.01) {
- bvw->priv->display_ratio = 1.0;
- }
-
- bacon_video_widget_set_visuals_quality_size (bvw,
- vis_width, vis_height, fps);
-}
-
-static void
-bacon_video_widget_realize (GtkWidget *widget)
-{
- GdkColor black;
- BaconVideoWidget *bvw;
- GdkWindow *window;
- GdkEventMask event_mask;
-
- bvw = BACON_VIDEO_WIDGET (widget);
- if (bvw->priv->type != BVW_USE_TYPE_VIDEO)
- {
- g_warning ("Use type isn't video but we realized the widget");
- return;
- }
-
-
- event_mask = gtk_widget_get_events (widget)
- | GDK_POINTER_MOTION_MASK
- | GDK_KEY_PRESS_MASK;
- gtk_widget_set_events (widget, event_mask);
-
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
-
- /* Flush, so that the window is really shown */
- gdk_flush ();
-
- window = gtk_widget_get_window (widget);
-
- gdk_color_parse ("Black", &black);
- gdk_colormap_alloc_color (gtk_widget_get_colormap (widget),
- &black, TRUE, TRUE);
- gdk_window_set_background (window, &black);
- gtk_widget_set_style
- (widget,
- gtk_style_attach (gtk_widget_get_style (widget), window));
-
- /* track configure events of toplevel window */
- g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)),
- "configure-event",
- G_CALLBACK (configure_cb), bvw);
-
- /* get screen size changes */
- g_signal_connect (G_OBJECT (gtk_widget_get_screen (widget)),
- "size-changed", G_CALLBACK (size_changed_cb), bvw);
-
- /* Now onto the video out driver */
- bvw->priv->display = XOpenDisplay (gdk_display_get_name
- (gdk_display_get_default ()));
- bvw->priv->screen = DefaultScreen (bvw->priv->display);
-
- bvw->priv->vo_driver = load_video_out_driver (bvw, bvw->priv->type);
-
- if (bvw->priv->vo_driver == NULL)
- {
- signal_data *sigdata;
-
- bvw->priv->vo_driver = load_video_out_driver
- (bvw, BVW_USE_TYPE_METADATA);
-
- /* We need to use an async signal, otherwise we try to
- * unrealize the widget before it's finished realizing */
- sigdata = g_new0 (signal_data, 1);
- sigdata->signal = ERROR_ASYNC;
- sigdata->msg = _("No video output is available. Make sure that the program is correctly installed.");
- sigdata->fatal = TRUE;
- g_async_queue_push (bvw->priv->queue, sigdata);
- g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
- }
-
- bvw->priv->ao_driver = load_audio_out_driver (bvw, FALSE, NULL);
-
- if (bvw->priv->ao_driver != NULL
- && bvw->priv->ao_driver_none == FALSE)
- {
- BvwAudioOutType type;
-
- if (bvw->priv->vis_name == NULL)
- bvw->priv->vis_name = g_strdup ("goom");
- type = bacon_video_widget_get_audio_out_type (bvw);
- bacon_video_widget_set_audio_out_type (bvw, type);
- } else {
- g_free (bvw->priv->vis_name);
- bvw->priv->vis_name = NULL;
- }
-
- bvw->priv->bacon_resize = bacon_resize_new (widget);
- bvw->priv->stream = xine_stream_new (bvw->priv->xine,
- bvw->priv->ao_driver, bvw->priv->vo_driver);
- setup_config_stream (bvw);
- bvw->priv->ev_queue = xine_event_new_queue (bvw->priv->stream);
-
- /* Set the zoom that might have been recorded */
- if (bvw->priv->zoom != 0.0)
- bacon_video_widget_set_zoom (bvw, bvw->priv->zoom);
-
- /* Setup xine events */
- xine_event_create_listener_thread (bvw->priv->ev_queue,
- xine_event, (void *) bvw);
-
- return;
-}
-
-static gboolean
-bacon_video_widget_idle_signal (BaconVideoWidget *bvw)
-{
- int queue_length;
- signal_data *data;
-
- data = g_async_queue_try_pop (bvw->priv->queue);
- if (data == NULL)
- return FALSE;
-
- TE ();
-
- switch (data->signal)
- {
- case RATIO_ASYNC:
- bacon_video_widget_set_scale_ratio (bvw, 1);
- break;
- case REDIRECT_ASYNC:
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[REDIRECT],
- 0, data->msg);
- break;
- case TITLE_CHANGE_ASYNC:
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[TITLE_CHANGE],
- 0, data->msg);
- break;
- case EOS_ASYNC:
- bacon_video_widget_reconfigure_tick (bvw, FALSE);
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[EOS], 0, NULL);
- g_object_notify (G_OBJECT (bvw), "seekable");
- break;
- case CHANNELS_CHANGE_ASYNC:
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[CHANNELS_CHANGE], 0, NULL);
- g_object_notify (G_OBJECT (bvw), "seekable");
- break;
- case BUFFERING_ASYNC:
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[BUFFERING],
- 0, data->num);
- break;
- case MESSAGE_ASYNC:
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[ERROR],
- 0, data->msg, TRUE, FALSE);
- break;
- case ERROR_ASYNC:
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[ERROR], 0,
- data->msg, TRUE, data->fatal);
- break;
- default:
- g_assert_not_reached ();
- }
-
- TL ();
-
- g_free (data->msg);
- g_free (data);
- queue_length = g_async_queue_length (bvw->priv->queue);
-
- return (queue_length > 0);
-}
-
-static void
-xine_event_message (BaconVideoWidget *bvw, xine_ui_message_data_t *data)
-{
- char *message;
- int num;
- signal_data *sigdata;
- const char *params;
-
- message = NULL;
-
- switch (data->type)
- {
- case XINE_MSG_NO_ERROR:
- return;
- case XINE_MSG_GENERAL_WARNING:
- g_message ("general warning: %s", data->messages);
- if (data->messages != NULL && strcmp (data->messages, "DVB Signal Lost. Please check connections.") == 0) {
- num = BVW_ERROR_INVALID_DEVICE;
- message = g_strdup (_("The TV adapter could not tune into the channel. Please check your hardware setup and channel configuration."));
- }
- break;
- case XINE_MSG_UNKNOWN_HOST:
- num = BVW_ERROR_UNKNOWN_HOST;
- message = g_strdup (_("The server you are trying to connect to is not known."));
- break;
- case XINE_MSG_UNKNOWN_DEVICE:
- num = BVW_ERROR_INVALID_DEVICE;
- message = g_strdup_printf (_("The device name you specified (%s) seems to be invalid."), (char *) data + data->parameters);
- break;
- case XINE_MSG_NETWORK_UNREACHABLE:
- num = BVW_ERROR_NETWORK_UNREACHABLE;
- message = g_strdup_printf (_("The server you are trying to connect to (%s) is unreachable."), (char *) data + data->parameters);
- break;
- case XINE_MSG_CONNECTION_REFUSED:
- num = BVW_ERROR_CONNECTION_REFUSED;
- message = g_strdup (_("The connection to this server was refused."));
- break;
- case XINE_MSG_FILE_NOT_FOUND:
- num = BVW_ERROR_FILE_NOT_FOUND;
- message = g_strdup (_("The specified movie could not be found."));
- break;
- case XINE_MSG_READ_ERROR:
- if (g_str_has_prefix (bvw->com->mrl, "dvd:") != FALSE)
- {
- num = BVW_ERROR_DVD_ENCRYPTED;
- message = g_strdup (_("The source seems encrypted and can't be read. Are you trying to play an encrypted DVD without libdvdcss?"));
- } else {
- num = BVW_ERROR_READ_ERROR;
- message = g_strdup (_("The movie could not be read."));
- }
- break;
- case XINE_MSG_LIBRARY_LOAD_ERROR:
- params = (char *) data + data->parameters;
- /* Only if the file could really not be loaded */
- num = BVW_ERROR_PLUGIN_LOAD;
- message = g_strdup_printf (_("A problem occurred while loading a library or a decoder (%s)."), params);
- break;
- case XINE_MSG_ENCRYPTED_SOURCE:
- if (g_str_has_prefix (bvw->com->mrl, "dvd:") != FALSE)
- {
- num = BVW_ERROR_DVD_ENCRYPTED;
- message = g_strdup (_("The source seems encrypted and can't be read. Are you trying to play an encrypted DVD without libdvdcss?"));
- } else {
- num = BVW_ERROR_FILE_ENCRYPTED;
- message = g_strdup (_("This file is encrypted and cannot be played back."));
- }
- break;
- case XINE_MSG_SECURITY:
- num = BVW_ERROR_GENERIC;
- message = g_strdup (_("For security reasons, this movie can not be played back."));
- break;
- case XINE_MSG_AUDIO_OUT_UNAVAILABLE:
- xine_stop (bvw->priv->stream);
- num = BVW_ERROR_AUDIO_BUSY;
- message = g_strdup (_("The audio device is busy. Is another application using it?"));
- break;
-#ifdef XINE_MSG_AUTHENTICATION_NEEDED /* xine-lib 1.2 */
- case XINE_MSG_AUTHENTICATION_NEEDED:
- num = BVW_ERROR_FILE_PERMISSION;
- if (g_str_has_prefix (bvw->com->mrl, "file:") != FALSE)
- message = g_strdup (_("Authentication is required to access this file."));
- else
- message = g_strdup (_("Authentication is required to access this file or stream."));
- break;
-#endif /* XINE_MSG_AUTHENTICATION_NEEDED */
- case XINE_MSG_PERMISSION_ERROR:
- num = BVW_ERROR_FILE_PERMISSION;
- if (g_str_has_prefix (bvw->com->mrl, "file:") != FALSE)
- message = g_strdup (_("You are not allowed to open this file."));
- else
- message = g_strdup (_("The server refused access to this file or stream."));
- break;
- case XINE_MSG_FILE_EMPTY:
- num = BVW_ERROR_EMPTY_FILE;
- message = g_strdup (_("The file you tried to play is an empty file."));
- break;
- default:
- D("xine_event_message: unhandled error\ntype: %d", data->type);
- return;
- }
-
- sigdata = g_new0 (signal_data, 1);
- sigdata->signal = ERROR_ASYNC;
- sigdata->msg = message;
- sigdata->num = num;
- g_async_queue_push (bvw->priv->queue, sigdata);
- g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
-}
-
-static void
-xine_event (void *user_data, const xine_event_t *event)
-{
- BaconVideoWidget *bvw = (BaconVideoWidget *) user_data;
- xine_ui_data_t *ui_data;
- xine_progress_data_t *prg;
- xine_mrl_reference_data_t *ref;
- xine_spu_button_t *spubtn;
- signal_data *data;
-
- switch (event->type)
- {
- case XINE_EVENT_SPU_BUTTON:
- spubtn = (xine_spu_button_t *) event->data;
- if (spubtn->direction)
- {
- if (bvw->priv->cursor == NULL) {
- bvw->priv->cursor = gdk_cursor_new (GDK_HAND2);
- }
- } else {
- if (bvw->priv->cursor != NULL) {
- gdk_cursor_unref (bvw->priv->cursor);
- bvw->priv->cursor = NULL;
- }
- }
- gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(bvw)),
- bvw->priv->cursor);
- break;
- case XINE_EVENT_UI_PLAYBACK_FINISHED:
- if (bvw->priv->got_redirect != FALSE)
- break;
-
- data = g_new0 (signal_data, 1);
- data->signal = EOS_ASYNC;
- g_async_queue_push (bvw->priv->queue, data);
- g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
- break;
- case XINE_EVENT_UI_CHANNELS_CHANGED:
- data = g_new0 (signal_data, 1);
- data->signal = CHANNELS_CHANGE_ASYNC;
- g_async_queue_push (bvw->priv->queue, data);
- g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
- break;
- case XINE_EVENT_UI_SET_TITLE:
- ui_data = event->data;
- data = NULL;
-
- if (g_utf8_validate (ui_data->str, -1, NULL) == FALSE) {
- char *utf8;
-
- g_warning ("Metadata for updated title not in UTF-8 for mrl '%s'", bvw->com->mrl);
- utf8 = g_locale_to_utf8 (ui_data->str, -1, NULL, NULL, NULL);
- if (utf8 != NULL) {
- data = g_new0 (signal_data, 1);
- data->msg = utf8;
- }
- } else {
- data = g_new0 (signal_data, 1);
- data->msg = g_strdup (ui_data->str);
- }
-
- if (data != NULL) {
- data->signal = TITLE_CHANGE_ASYNC;
- g_async_queue_push (bvw->priv->queue, data);
- g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
- }
- break;
- case XINE_EVENT_PROGRESS:
- prg = event->data;
-
- data = g_new0 (signal_data, 1);
- data->signal = BUFFERING_ASYNC;
- if (prg->percent < 0)
- data->num = 0;
- else if (prg->percent > 100)
- data->num = 100;
- else
- data->num = prg->percent;
- g_async_queue_push (bvw->priv->queue, data);
- g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
- break;
- case XINE_EVENT_MRL_REFERENCE:
- ref = event->data;
- data = g_new0 (signal_data, 1);
- data->signal = REDIRECT_ASYNC;
- data->msg = g_strdup (ref->mrl);
- g_async_queue_push (bvw->priv->queue, data);
- g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
- bvw->priv->got_redirect = TRUE;
- break;
- case XINE_EVENT_UI_MESSAGE:
- xine_event_message (bvw, (xine_ui_message_data_t *)event->data);
- break;
- case XINE_EVENT_DROPPED_FRAMES:
- break;
- case XINE_EVENT_AUDIO_LEVEL:
- /* Unhandled, we use the software mixer, not the hardware one */
- break;
- }
-}
-
-static int
-bacon_video_widget_sort_queue (gconstpointer a, gconstpointer b, gpointer data)
-{
- signal_data *one, *two;
-
- one = (signal_data *) a;
- two = (signal_data *) b;
-
- if (one->signal == two->signal)
- return 0;
- if (one->signal == ERROR_ASYNC || one->signal == MESSAGE_ASYNC)
- return -1;
- return 1;
-}
-
-static void
-xine_try_error (BaconVideoWidget *bvw, gboolean probe_error, GError **error)
-{
- signal_data *data, *save_data;
- int err;
-
- save_data = NULL;
-
- sched_yield ();
-
- /* Sort the queue with the errors first */
- g_async_queue_sort (bvw->priv->queue, bacon_video_widget_sort_queue, NULL);
-
- /* Steal messages from the async queue, if there's an error,
- * to use as the error message rather than the crappy errors from
- * xine_open() */
- while ((data = g_async_queue_try_pop (bvw->priv->queue)) != NULL) {
- if (data->signal == ERROR_ASYNC || data->signal == MESSAGE_ASYNC) {
- if (save_data != NULL) {
- g_free (save_data->msg);
- g_free (save_data);
- }
- save_data = data;
- } else {
- g_async_queue_push (bvw->priv->queue, data);
- break;
- }
- }
-
- if (save_data != NULL) {
- g_set_error_literal (error, BVW_ERROR, save_data->num,
- save_data->msg);
- g_free (save_data->msg);
- g_free (save_data);
-
- return;
- }
-
- if (probe_error != FALSE)
- return;
-
- err = xine_get_error (bvw->priv->stream);
- if (err == XINE_ERROR_NONE)
- return;
-
- switch (err)
- {
- case XINE_ERROR_NO_INPUT_PLUGIN:
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_NO_PLUGIN_FOR_FILE,
- _("There is no input plugin to handle the location of this movie"));
- break;
- case XINE_ERROR_NO_DEMUX_PLUGIN:
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_NO_PLUGIN_FOR_FILE,
- _("There is no plugin to handle this movie."));
- break;
- case XINE_ERROR_DEMUX_FAILED:
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_BROKEN_FILE,
- _("This movie is broken and can not be played further."));
- break;
- case XINE_ERROR_MALFORMED_MRL:
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_INVALID_LOCATION,
- _("This location is not a valid one."));
- break;
- case XINE_ERROR_INPUT_FAILED:
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_FILE_GENERIC,
- _("This movie could not be opened."));
- break;
- default:
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_GENERIC,
- _("Generic Error."));
- break;
- }
-}
-
-static void
-xine_error (BaconVideoWidget *bvw, GError **error)
-{
- xine_try_error (bvw, FALSE, error);
-}
-
-static void
-bacon_video_widget_unrealize (GtkWidget *widget)
-{
- BaconVideoWidget *bvw;
- char *configfile;
- int speed;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (widget));
-
- bvw = BACON_VIDEO_WIDGET (widget);
-
- if (bvw->priv->tick_id > 0)
- g_source_remove (bvw->priv->tick_id);
-
- speed = xine_get_param (bvw->priv->stream, XINE_PARAM_SPEED);
- if (speed != XINE_SPEED_PAUSE)
- show_vfx_update (bvw, FALSE);
-
- /* stop the playback */
- xine_stop (bvw->priv->stream);
- xine_close (bvw->priv->stream);
-
- /* Save the current volume */
- if (bacon_video_widget_can_set_volume (bvw) != FALSE)
- {
- int vol;
-
- vol = (bvw->priv->volume * 100.0 + 0.5);
- gconf_client_set_int (bvw->priv->gc, GCONF_PREFIX"/volume",
- CLAMP (vol, 0, 100), NULL);
- }
-
- xine_port_send_gui_data (bvw->priv->vo_driver,
- XINE_GUI_SEND_WILL_DESTROY_DRAWABLE,
- (void*) gtk_widget_get_window (widget));
-
- g_object_unref (bvw->priv->bacon_resize);
-
- /* Hide all windows */
- if (GTK_WIDGET_MAPPED (widget))
- gtk_widget_unmap (widget);
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- /* Get rid of the rest of the stream */
- xine_dispose (bvw->priv->stream);
- xine_event_dispose_queue (bvw->priv->ev_queue);
- bvw->priv->stream = NULL;
-
- /* save config */
- configfile = g_build_path (G_DIR_SEPARATOR_S,
- g_get_user_config_dir (), CONFIG_FILE, NULL);
- xine_config_save (bvw->priv->xine, configfile);
- g_free (configfile);
-
- if (bvw->priv->vis != NULL)
- xine_post_dispose (bvw->priv->xine, bvw->priv->vis);
-
- /* Kill the drivers */
- if (bvw->priv->vo_driver != NULL)
- xine_close_video_driver (bvw->priv->xine,
- bvw->priv->vo_driver);
- if (bvw->priv->ao_driver != NULL)
- xine_close_audio_driver (bvw->priv->xine,
- bvw->priv->ao_driver);
-
- /* stop event thread */
- xine_plugins_garbage_collector (bvw->priv->xine);
- xine_exit (bvw->priv->xine);
- bvw->priv->xine = NULL;
-
- /* This destroys widget->window and unsets the realized flag */
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (*GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-GOptionGroup *
-bacon_video_widget_get_option_group (void)
-{
- return g_option_group_new ("xine", "Show xine-lib Options",
- "xine-lib Options", NULL, NULL);
-}
-
-void
-bacon_video_widget_init_backend (int *argc, char ***argv)
-{
- /* no-op */
-}
-
-GQuark
-bacon_video_widget_error_quark (void)
-{
- static GQuark q = 0;
- if (q == 0)
- q = g_quark_from_static_string ("bvw-error-quark");
- return q;
-}
-
-GtkWidget *
-bacon_video_widget_new (int width, int height,
- BvwUseType type, GError **error)
-{
- BaconVideoWidget *bvw;
- xine_cfg_entry_t entry;
-
- bvw = BACON_VIDEO_WIDGET (g_object_new
- (bacon_video_widget_get_type (), NULL));
-
- bvw->priv->init_width = width;
- bvw->priv->init_height = height;
- bvw->priv->type = type;
- bvw->priv->audio_out_type = -1;
-
- if (type == BVW_USE_TYPE_AUDIO || type == BVW_USE_TYPE_VIDEO)
- pthread_mutex_init (&bvw->priv->queued_actions_mutex, NULL);
-
- /* Don't load anything yet if we're looking for proper video
- * output */
- if (type == BVW_USE_TYPE_VIDEO)
- {
- bvw_config_helper_num (bvw->priv->xine, "engine.buffers.video_num_buffers",
- 500, &entry);
- entry.num_value = 500;
- xine_config_update_entry (bvw->priv->xine, &entry);
- return GTK_WIDGET (bvw);
- }
-
- /* load the output drivers */
- if (type == BVW_USE_TYPE_AUDIO)
- {
- BvwAudioOutType type;
-
- bvw->priv->ao_driver = load_audio_out_driver (bvw,
- FALSE, error);
- if (error != NULL && *error != NULL)
- return NULL;
- type = bacon_video_widget_get_audio_out_type (bvw);
- bacon_video_widget_set_audio_out_type (bvw, type);
- } else if (type == BVW_USE_TYPE_METADATA) {
- bvw->priv->ao_driver = load_audio_out_driver (bvw,
- TRUE, error);
- }
-
- /* We need to wait for the widget to realise if we want to
- * load a video output with screen output, and capture is the
- * only one actually needing a video output */
- if (type == BVW_USE_TYPE_CAPTURE || type == BVW_USE_TYPE_METADATA) {
- bvw->priv->vo_driver = load_video_out_driver (bvw, type);
- }
-
- /* Be extra careful about exiting out nicely when a video output
- * isn't available */
- if (type == BVW_USE_TYPE_CAPTURE && bvw->priv->vo_driver == NULL)
- {
- /* Close the xine stuff */
- if (bvw->priv->ao_driver != NULL) {
- xine_close_audio_driver (bvw->priv->xine,
- bvw->priv->ao_driver);
- }
- xine_exit (bvw->priv->xine);
- bvw->priv->xine = NULL;
-
- /* get rid of all our crappety crap */
- if (bvw->priv->tick_id > 0)
- g_source_remove (bvw->priv->tick_id);
- g_idle_remove_by_data (bvw);
- g_async_queue_unref (bvw->priv->queue);
- g_free (bvw->priv->vis_name);
- g_object_unref (G_OBJECT (bvw->priv->gc));
- g_free (bvw->priv);
- g_free (bvw);
-
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_VIDEO_PLUGIN,
- _("No video output is available. Make sure that the program is correctly installed."));
- return NULL;
- }
-
- bvw_config_helper_num (bvw->priv->xine, "engine.buffers.video_num_buffers",
- 5, &entry);
- entry.num_value = 5;
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- bvw->priv->stream = xine_stream_new (bvw->priv->xine,
- bvw->priv->ao_driver, bvw->priv->vo_driver);
- setup_config_stream (bvw);
- bvw->priv->ev_queue = xine_event_new_queue (bvw->priv->stream);
- xine_event_create_listener_thread (bvw->priv->ev_queue,
- xine_event, (void *) bvw);
-
- return GTK_WIDGET (bvw);
-}
-
-static gboolean
-bacon_video_widget_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- BaconVideoWidget *bvw = (BaconVideoWidget *) widget;
-
- if (bacon_video_widget_draw_logo (bvw) == FALSE) {
- XExposeEvent *expose;
-
- if (event->count != 0)
- return TRUE;
-
- expose = g_new0 (XExposeEvent, 1);
- expose->count = event->count;
-
- xine_port_send_gui_data (bvw->priv->vo_driver,
- XINE_GUI_SEND_EXPOSE_EVENT, expose);
-
- g_free (expose);
- } else {
- int s_width, s_height, w_width, w_height;
- GdkPixbuf *logo = NULL;
- gfloat ratio;
- GdkRegion *region;
- GdkRectangle rect;
- GdkWindow *window;
-
- rect.x = rect.y = 0;
- rect.width = widget->allocation.width;
- rect.height = widget->allocation.height;
- region = gdk_region_rectangle (&rect);
-
- window = gtk_widget_get_window (widget);
-
- gdk_window_begin_paint_region (window, region);
- gdk_region_destroy (region);
-
- gdk_window_clear_area (window,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- if (bvw->priv->logo_pixbuf == NULL) {
- gdk_window_end_paint (window);
- return FALSE;
- }
-
- s_width = gdk_pixbuf_get_width (bvw->priv->logo_pixbuf);
- s_height = gdk_pixbuf_get_height (bvw->priv->logo_pixbuf);
- w_width = widget->allocation.width;
- w_height = widget->allocation.height;
-
- if ((gfloat) w_width / s_width > (gfloat) w_height / s_height) {
- ratio = (gfloat) w_height / s_height;
- } else {
- ratio = (gfloat) w_width / s_width;
- }
-
- s_width *= ratio;
- s_height *= ratio;
-
- if (s_width <= 1 || s_height <= 1) {
- gdk_window_end_paint (window);
- return FALSE;
- }
-
- logo = gdk_pixbuf_scale_simple (bvw->priv->logo_pixbuf,
- s_width, s_height, GDK_INTERP_BILINEAR);
-
- gdk_draw_pixbuf (window,
- gtk_widget_get_style (widget)->fg_gc[0], logo,
- 0, 0,
- (w_width - s_width) / 2,
- (w_height - s_height) / 2,
- s_width, s_height, GDK_RGB_DITHER_NONE, 0, 0);
-
- gdk_window_end_paint (window);
- g_object_unref (logo);
- }
-
- return TRUE;
-}
-
-static gboolean
-bacon_video_widget_motion_notify (GtkWidget *widget, GdkEventMotion *event)
-{
- BaconVideoWidget *bvw = (BaconVideoWidget *) widget;
-
- generate_mouse_event (bvw, (GdkEvent *)event, TRUE);
-
- if (GTK_WIDGET_CLASS (parent_class)->motion_notify_event != NULL)
- (* GTK_WIDGET_CLASS (parent_class)->motion_notify_event) (widget, event);
-
- return FALSE;
-}
-
-static gboolean
-bacon_video_widget_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- BaconVideoWidget *bvw = (BaconVideoWidget *) widget;
-
- /* Don't propagate double-click events if we just had a button
- * event consumed internally */
- if (event->type == GDK_2BUTTON_PRESS && bvw->priv->bevent_consumed != FALSE) {
- bvw->priv->bevent_consumed = FALSE;
- return TRUE;
- }
-
- /* If the event was consumed, mark it as such */
- if (generate_mouse_event (bvw, (GdkEvent *)event, FALSE) != FALSE && bvw->priv->cursor != NULL) {
- bvw->priv->bevent_consumed = TRUE;
- return FALSE;
- }
-
- if (GTK_WIDGET_CLASS (parent_class)->button_press_event != NULL)
- (* GTK_WIDGET_CLASS (parent_class)->button_press_event) (widget, event);
-
- return FALSE;
-}
-
-static void
-bacon_video_widget_show (GtkWidget *widget)
-{
- GdkWindow *window;
-
- window = gtk_widget_get_window (widget);
- if (window != NULL)
- gdk_window_show (window);
-
- if (GTK_WIDGET_CLASS (parent_class)->show != NULL)
- (* GTK_WIDGET_CLASS (parent_class)->show) (widget);
-}
-
-static void
-bacon_video_widget_hide (GtkWidget *widget)
-{
- GdkWindow *window;
-
- window = gtk_widget_get_window (widget);
- if (window != NULL)
- gdk_window_hide (window);
-
- if (GTK_WIDGET_CLASS (parent_class)->hide != NULL)
- (* GTK_WIDGET_CLASS (parent_class)->hide) (widget);
-}
-
-static void
-bacon_video_widget_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- g_return_if_fail(widget != NULL);
- g_return_if_fail(BACON_IS_VIDEO_WIDGET(widget));
-
- requisition->width = 240;
- requisition->height = 180;
-}
-
-static void
-bacon_video_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- BaconVideoWidget *bvw;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (widget));
-
- bvw = BACON_VIDEO_WIDGET (widget);
-
- widget->allocation = *allocation;
- bvw->priv->xpos = allocation->x;
- bvw->priv->ypos = allocation->y;
-
- if ( (bvw->priv->init_width == 0) && (bvw->priv->init_height == 0) ) {
- /* First allocation, saving values */
- bvw->priv->init_width = allocation->width;
- bvw->priv->init_height = allocation->height;
- }
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (gtk_widget_get_window (widget),
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
- }
-}
-
-static void
-bacon_video_widget_reconfigure_tick (BaconVideoWidget *bvw, gboolean enable)
-{
- if (bvw->priv->tick_id != 0 && enable != FALSE)
- return;
- if (bvw->priv->tick_id == 0 && enable == FALSE)
- return;
-
- if (enable == FALSE) {
- g_source_remove (bvw->priv->tick_id);
- bvw->priv->tick_id = 0;
- } else {
- bvw->priv->tick_id = g_timeout_add (140,
- (GSourceFunc) bacon_video_widget_tick_send,
- bvw);
- }
- bacon_video_widget_tick_send (bvw);
-}
-
-static gboolean
-bacon_video_widget_tick_send (BaconVideoWidget *bvw)
-{
- int current_time, stream_length, current_position;
- double current_position_f;
- gboolean ret = TRUE, seekable;
-
- g_return_val_if_fail (bvw->priv->stream != NULL, FALSE);
- g_return_val_if_fail (bvw->priv->logo_mode == FALSE, FALSE);
-
- if (bvw->com->mrl == NULL)
- {
- current_time = 0;
- stream_length = 0;
- current_position = 0;
- } else {
- ret = xine_get_pos_length (bvw->priv->stream,
- &current_position,
- &current_time,
- &stream_length);
- }
-
- if (ret == FALSE)
- return TRUE;
-
- if (bvw->priv->seeking == SEEKING_BY_FRACTION)
- {
- current_position_f = bvw->priv->seek_dest;
- current_time = bvw->priv->seek_dest * stream_length;
- } else if (bvw->priv->seeking == SEEKING_BY_TIME) {
- current_time = bvw->priv->seek_dest_time;
- if (stream_length == 0)
- stream_length = current_time;
- current_position_f = (double) current_time / stream_length;
- } else {
- /* xine-lib doesn't update current_position if the stream
- * isn't seekable */
- if ((current_position == 0 || current_position == 65535) && current_time > 0) {
- if (stream_length == 0)
- stream_length = current_time;
- current_position_f = (double) current_time / stream_length;
- } else {
- current_position_f = ((double) current_position) / 65535;
- }
- }
-
- bvw->priv->is_live = (stream_length == 0);
-
- if (stream_length != 0 && bvw->com->mrl != NULL) {
- seekable = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_SEEKABLE);
- if (stream_length != bvw->priv->stream_length)
- g_object_notify (G_OBJECT (bvw), "seekable");
- } else {
- seekable = FALSE;
- }
-
- bvw->priv->stream_length = stream_length;
-
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[SIGNAL_TICK], 0,
- (gint64) (current_time),
- (gint64) (stream_length),
- current_position_f,
- seekable);
-
- return TRUE;
-}
-
-static void
-show_vfx_update (BaconVideoWidget *bvw, gboolean show_visuals)
-{
- xine_post_out_t *audio_source;
- gboolean has_video, enable;
-
- if (bvw->priv->vis_name == NULL)
- return;
-
- has_video = xine_get_stream_info(bvw->priv->stream,
- XINE_STREAM_INFO_HAS_VIDEO);
- enable = FALSE;
-
- /* Already has video, and we were showing visual effects */
- if (has_video != FALSE && show_visuals != FALSE
- && bvw->priv->using_vfx != FALSE) {
- enable = FALSE;
- GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
- /* Doesn't have video, should show visual effects, and wasn't doing
- * so before */
- } else if (has_video == FALSE && show_visuals != FALSE
- && bvw->priv->using_vfx == FALSE) {
- if (bvw->priv->vis == NULL) {
- bvw->priv->vis = xine_post_init (bvw->priv->xine,
- bvw->priv->vis_name, 0,
- &bvw->priv->ao_driver,
- &bvw->priv->vo_driver);
- }
- if (bvw->priv->vis == NULL && strcmp (bvw->priv->vis_name, "goom") != 0) {
- bvw->priv->vis = xine_post_init (bvw->priv->xine,
- "goom", 0,
- &bvw->priv->ao_driver,
- &bvw->priv->vo_driver);
- }
- if (bvw->priv->vis != NULL) {
- enable = TRUE;
- GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
- }
- /* Doesn't have video, but visual effects are disabled */
- } else if (has_video == FALSE && show_visuals == FALSE) {
- enable = FALSE;
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
- /* No changes, but has video */
- } else if (has_video != FALSE) {
- GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
- return;
- /* No changes but doesn't have video */
- } else {
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
- return;
- }
-
- if (enable == FALSE) {
- audio_source = xine_get_audio_source (bvw->priv->stream);
- if (xine_post_wire_audio_port (audio_source,
- bvw->priv->ao_driver)) {
- bvw->priv->using_vfx = FALSE;
-
- /* Queue a redraw of the widget */
- gtk_widget_queue_draw (GTK_WIDGET (bvw));
- }
- if (bvw->priv->vis != NULL) {
- xine_post_dispose (bvw->priv->xine,
- bvw->priv->vis);
- bvw->priv->vis = NULL;
- }
- } else {
- audio_source = xine_get_audio_source (bvw->priv->stream);
- if (xine_post_wire_audio_port (audio_source,
- bvw->priv->vis->audio_input[0])) {
- bvw->priv->using_vfx = TRUE;
-
- /* Queue a redraw of the widget */
- gtk_widget_queue_draw (GTK_WIDGET (bvw));
- }
- }
-}
-
-static char *
-get_fourcc_string (uint32_t f)
-{
- char fcc[5];
-
- memset(&fcc, 0, sizeof(fcc));
-
- /* Should we take care about endianess ? */
- fcc[0] = f | 0xFFFFFF00;
- fcc[1] = f>>8 | 0xFFFFFF00;
- fcc[2] = f>>16 | 0xFFFFFF00;
- fcc[3] = f>>24 | 0xFFFFFF00;
- fcc[4] = 0;
-
- if(f <= 0xFFFF)
- sprintf(fcc, "0x%x", f);
-
- if((fcc[0] == 'm') && (fcc[1] == 's'))
- {
- if((fcc[2] = 0x0) && (fcc[3] == 0x55))
- *(uint32_t *) fcc = 0x33706d2e; /* Force to '.mp3' */
- }
-
- return g_strdup (fcc);
-}
-
-static char *
-bacon_video_widget_get_nice_codec_name (BaconVideoWidget *bvw,
- gboolean is_audio)
-{
- char *name;
- int codec, fcc;
-
- if (is_audio == FALSE) {
- codec = XINE_META_INFO_VIDEOCODEC;
- fcc = XINE_STREAM_INFO_VIDEO_FOURCC;
- } else {
- codec = XINE_META_INFO_AUDIOCODEC;
- fcc = XINE_STREAM_INFO_AUDIO_FOURCC;
- }
-
- name = g_strdup (xine_get_meta_info (bvw->priv->stream, codec));
-
- if (name == NULL || name[0] == '\0')
- {
- guint32 fourcc;
-
- g_free (name);
- fourcc = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_VIDEO_FOURCC);
- name = get_fourcc_string (fourcc);
- }
-
- return name;
-}
-
-char *
-bacon_video_widget_get_backend_name (BaconVideoWidget *bvw)
-{
- return g_strdup_printf ("xine-lib version %s",
- xine_get_version_string ());
-}
-
-static char *
-bacon_video_widget_get_subtitled (const char *mrl, const char *subtitle_uri)
-{
- GFile *file;
- char *local_path, *local_uri, *retval;
-
- file = g_file_new_for_uri (subtitle_uri);
- local_path = g_file_get_path (file);
- g_object_unref (file);
-
- if (local_path == NULL)
- return NULL;
-
- local_uri = g_filename_to_uri (local_path, NULL, NULL);
- g_free (local_path);
- if (local_uri == NULL)
- return NULL;
-
- retval = g_strdup_printf ("%s#subtitle:%s", mrl, local_uri + strlen ("file://"));
- g_free (local_uri);
-
- return retval;
-}
-
-static void
-bacon_video_widget_open_async_error (BaconVideoWidget *bvw, GError *error)
-{
- signal_data *sigdata;
-
- sigdata = g_new0 (signal_data, 1);
- sigdata->signal = ERROR_ASYNC;
- sigdata->msg = g_strdup (error->message);
- sigdata->fatal = FALSE;
- g_async_queue_push (bvw->priv->queue, sigdata);
- g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
-}
-
-static gpointer
-bacon_video_widget_open_thread (gpointer data)
-{
- BaconVideoWidget *bvw = (BaconVideoWidget *) data;
- GError *error = NULL;
- int err;
-
- pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
- err = xine_open (bvw->priv->stream, bvw->com->mrl);
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL);
- if (err == 0) {
- xine_error (bvw, &error);
- bacon_video_widget_close (bvw);
- bacon_video_widget_open_async_error (bvw, error);
- g_error_free (error);
- } else {
- xine_try_error (bvw, TRUE, &error);
- if (error != NULL) {
- bacon_video_widget_close (bvw);
- bacon_video_widget_open_async_error (bvw, error);
- g_error_free (error);
- } else {
- GList *l;
-
- /* A few known commands before we crack on */
- xine_plugins_garbage_collector (bvw->priv->xine);
- show_vfx_update (bvw, bvw->priv->show_vfx);
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[GOT_METADATA], 0, NULL);
- g_object_notify (G_OBJECT (bvw), "seekable");
- bacon_video_widget_tick_send (bvw);
-
- pthread_mutex_lock (&bvw->priv->queued_actions_mutex);
-
- /* This is so that we don't deadlock when calling the
- * real play() */
- bvw->priv->open_thread = 0;
-
- for (l = bvw->priv->queued_actions; l != NULL; l = l->next) {
- int action;
-
- action = GPOINTER_TO_INT (l->data);
- switch (action) {
- case BVW_XINE_PLAY:
- bacon_video_widget_play (bvw, &error);
- if (error != NULL) {
- bacon_video_widget_close (bvw);
- bacon_video_widget_open_async_error (bvw, error);
- g_error_free (error);
- }
- break;
- case BVW_XINE_PAUSE:
- bacon_video_widget_pause (bvw);
- break;
- default:
- g_assert_not_reached ();
- }
- }
-
- g_list_free (bvw->priv->queued_actions);
- bvw->priv->queued_actions = NULL;
- pthread_mutex_unlock (&bvw->priv->queued_actions_mutex);
- }
- }
-
- bvw->priv->open_thread = 0;
- return NULL;
-}
-
-static gboolean
-bacon_video_widget_open_async (BaconVideoWidget *bvw, const char *mrl,
- GError **error)
-{
- if (pthread_create (&bvw->priv->open_thread, NULL, bacon_video_widget_open_thread, bvw) != 0) {
- g_assert_not_reached ();
- return FALSE;
- }
-
- /* Make it so that the thread we just started is executed straight away,
- * otherwise other events can occur before we start the open */
- sched_yield ();
-
- return TRUE;
-}
-
-gboolean
-bacon_video_widget_open (BaconVideoWidget *bvw, const char *mrl,
- const char *subtitle_uri, GError **error)
-{
- int err;
-
- g_return_val_if_fail (mrl != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
- g_return_val_if_fail (bvw->com->mrl == NULL, FALSE);
-
- bvw->priv->got_redirect = FALSE;
-
- /* Hack to get VCD playback from .cue files */
- if (g_str_has_prefix (mrl, "vcd:/") != FALSE
- && g_str_has_suffix (mrl, ".cue") != FALSE) {
- bvw->com->mrl = g_strdup_printf ("%s@", mrl);
- } else if (g_str_has_prefix (mrl, "icy:") != FALSE) {
- /* Handle "icy://" URLs from QuickTime */
- bvw->com->mrl = g_strdup_printf ("http:%s", mrl + 4);
- } else if (g_str_has_prefix (mrl, "icyx:") != FALSE) {
- /* Handle "icyx://" URLs from Orban/Coding Technologies AAC/aacPlus Player */
- bvw->com->mrl = g_strdup_printf ("http:%s", mrl + 5);
- } else {
- GFile *file;
- char *path;
-
- file = g_file_new_for_commandline_arg (mrl);
- path = g_file_get_path (file);
- if (path != NULL) {
- bvw->com->mrl = g_filename_to_uri (path, NULL, NULL);
- g_free (path);
- } else {
- bvw->com->mrl = g_strdup (mrl);
- }
- g_object_unref (file);
- }
-
- if (g_str_has_prefix (mrl, "fd://") != FALSE) {
- if (subtitle_uri != NULL)
- g_warning ("%s passed along with a subtitle URI", mrl);
- return bacon_video_widget_open_async (bvw, mrl, error);
- }
-
- if (subtitle_uri != NULL) {
- char *subtitled;
- subtitled = bacon_video_widget_get_subtitled (mrl, subtitle_uri);
- if (subtitled != NULL) {
- err = xine_open (bvw->priv->stream, subtitled);
- bvw->priv->has_subtitle = TRUE;
- g_free (subtitled);
- } else {
- err = xine_open (bvw->priv->stream, bvw->com->mrl);
- }
- } else {
- err = xine_open (bvw->priv->stream, bvw->com->mrl);
- }
-
- xine_plugins_garbage_collector (bvw->priv->xine);
-
- if (err == 0) {
- bacon_video_widget_close (bvw);
- if (error == NULL || *error == NULL)
- xine_error (bvw, error);
- return FALSE;
- } else {
- if (error == NULL || *error == NULL)
- xine_try_error (bvw, TRUE, error);
- if (error != NULL && *error != NULL) {
- bacon_video_widget_close (bvw);
- return FALSE;
- }
- }
-
- if ((xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_HAS_VIDEO) &&
- xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_VIDEO_HANDLED) == FALSE)
- || (xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_HAS_VIDEO) == FALSE
- && xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_AUDIO_HANDLED) == FALSE))
- {
- char *name;
- gboolean is_audio;
-
- is_audio = (xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_HAS_VIDEO) == FALSE);
-
- name = bacon_video_widget_get_nice_codec_name (bvw, is_audio);
-
- bacon_video_widget_close (bvw);
-
- if (is_audio == FALSE) {
- g_set_error (error, BVW_ERROR,
- BVW_ERROR_CODEC_NOT_HANDLED,
- _("Video codec '%s' is not handled. You might need to install additional plugins to be able to play some types of movies"), name);
- } else {
- g_set_error (error, BVW_ERROR,
- BVW_ERROR_CODEC_NOT_HANDLED,
- _("Audio codec '%s' is not handled. You might need to install additional plugins to be able to play some types of movies"), name);
- }
-
- g_free (name);
-
- return FALSE;
- }
-
- if (xine_get_stream_info (bvw->priv->stream, XINE_STREAM_INFO_HAS_VIDEO) == FALSE
- && bvw->priv->type != BVW_USE_TYPE_METADATA
- && bvw->priv->ao_driver == NULL) {
- bacon_video_widget_close (bvw);
-
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_AUDIO_ONLY,
- _("This is an audio-only file and there is no audio output available."));
-
- return FALSE;
- }
-
- show_vfx_update (bvw, bvw->priv->show_vfx);
-
- /* Update metadata in the UI */
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[GOT_METADATA], 0, NULL);
- g_object_notify (G_OBJECT (bvw), "seekable");
- bacon_video_widget_tick_send (bvw);
-
- return TRUE;
-}
-
-gboolean
-bacon_video_widget_play (BaconVideoWidget *bvw, GError **gerror)
-{
- int error;
-
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- error = 1;
-
- if (bvw->priv->open_thread != 0) {
- pthread_mutex_lock (&bvw->priv->queued_actions_mutex);
- bvw->priv->queued_actions = g_list_append (bvw->priv->queued_actions,
- GINT_TO_POINTER (BVW_XINE_PLAY));
- pthread_mutex_unlock (&bvw->priv->queued_actions_mutex);
- return TRUE;
- }
-
- if (bvw->priv->seeking == SEEKING_BY_FRACTION) {
- if (bvw->priv->stream_length != 0) {
- error = xine_play (bvw->priv->stream,
- 0, bvw->priv->seek_dest * bvw->priv->stream_length);
- } else {
- error = xine_play (bvw->priv->stream,
- bvw->priv->seek_dest * 65535, 0);
- }
- bvw->priv->seeking = SEEKING_BY_INVALID;
- } else if (bvw->priv->seeking == SEEKING_BY_TIME) {
- error = xine_play (bvw->priv->stream, 0,
- bvw->priv->seek_dest_time);
- bvw->priv->seeking = SEEKING_BY_INVALID;
- } else {
- int speed, status;
-
- speed = xine_get_param (bvw->priv->stream, XINE_PARAM_SPEED);
- status = xine_get_status (bvw->priv->stream);
- if (speed != XINE_SPEED_NORMAL && status == XINE_STATUS_PLAY)
- {
- xine_set_param (bvw->priv->stream,
- XINE_PARAM_SPEED, XINE_SPEED_NORMAL);
- } else {
- error = xine_play (bvw->priv->stream, 0, 0);
- }
-
- bvw->priv->seeking = SEEKING_BY_INVALID;
- }
-
- if (error == 0) {
- xine_error (bvw, gerror);
- return FALSE;
- }
-
- if (bvw->priv->queued_vis != NULL) {
- bacon_video_widget_set_visuals (bvw, bvw->priv->queued_vis);
- g_free (bvw->priv->queued_vis);
- bvw->priv->queued_vis = NULL;
- }
-
- /* Workaround for xine-lib: don't try to use a
- * non-existent audio channel */
- {
- int cur, num;
-
- cur = xine_get_param(bvw->priv->stream,
- XINE_PARAM_AUDIO_CHANNEL_LOGICAL);
- num = xine_get_stream_info(bvw->priv->stream,
- XINE_STREAM_INFO_AUDIO_CHANNELS);
- if (cur > num)
- xine_set_param(bvw->priv->stream,
- XINE_PARAM_AUDIO_CHANNEL_LOGICAL, -1);
- }
-
- bacon_video_widget_reconfigure_tick (bvw, TRUE);
- g_object_notify (G_OBJECT (bvw), "seekable");
-
- return TRUE;
-}
-
-gboolean
-bacon_video_widget_can_direct_seek (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
-
- return bacon_video_widget_common_can_direct_seek (bvw->com);
-}
-
-gboolean bacon_video_widget_seek (BaconVideoWidget *bvw,
- double position,
- GError **gerror)
-{
- int error, speed;
-
- g_return_val_if_fail (bvw != NULL, -1);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), -1);
- g_return_val_if_fail (bvw->priv->xine != NULL, -1);
-
- speed = xine_get_param (bvw->priv->stream, XINE_PARAM_SPEED);
- if (speed == XINE_SPEED_PAUSE)
- {
- bvw->priv->seeking = SEEKING_BY_FRACTION;
- bvw->priv->seek_dest = position;
- bacon_video_widget_tick_send (bvw);
- return TRUE;
- }
-
- if (bvw->priv->stream_length != 0) {
- error = xine_play (bvw->priv->stream, 0,
- position * bvw->priv->stream_length);
- } else {
- error = xine_play (bvw->priv->stream, position * 65535, 0);
- }
-
- if (error == 0)
- {
- xine_error (bvw, gerror);
- return FALSE;
- }
-
- bacon_video_widget_reconfigure_tick (bvw, TRUE);
-
- return TRUE;
-}
-
-gboolean bacon_video_widget_seek_time (BaconVideoWidget *bvw, gint64 time,
- GError **error)
-{
- int error_num, speed, status;
- gint64 length;
-
- g_return_val_if_fail (bvw != NULL, -1);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), -1);
- g_return_val_if_fail (bvw->priv->xine != NULL, -1);
-
- length = bacon_video_widget_get_stream_length (bvw);
-
- speed = xine_get_param (bvw->priv->stream, XINE_PARAM_SPEED);
- status = xine_get_status (bvw->priv->stream);
- if (speed == XINE_SPEED_PAUSE || status == XINE_STATUS_STOP)
- {
- bvw->priv->seeking = SEEKING_BY_TIME;
- bvw->priv->seek_dest_time = CLAMP (time, 0, length);
- bacon_video_widget_tick_send (bvw);
- return TRUE;
- }
-
- if (time > length && g_str_has_prefix (bvw->com->mrl, "dvd:") == FALSE && g_str_has_prefix (bvw->com->mrl, "vcd:") == FALSE) {
- signal_data *data;
-
- data = g_new0 (signal_data, 1);
- data->signal = EOS_ASYNC;
- g_async_queue_push (bvw->priv->queue, data);
- g_idle_add ((GSourceFunc) bacon_video_widget_idle_signal, bvw);
- return TRUE;
- }
-
- error_num = xine_play (bvw->priv->stream, 0, CLAMP (time, 0, length));
-
- if (error_num == 0)
- {
- xine_error (bvw, error);
- return FALSE;
- }
-
- bacon_video_widget_reconfigure_tick (bvw, TRUE);
-
- return TRUE;
-}
-
-void
-bacon_video_widget_stop (BaconVideoWidget *bvw)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- pthread_mutex_lock (&bvw->priv->queued_actions_mutex);
- g_list_free (bvw->priv->queued_actions);
- bvw->priv->queued_actions = NULL;
- pthread_mutex_unlock (&bvw->priv->queued_actions_mutex);
-
- xine_stop (bvw->priv->stream);
- bacon_video_widget_reconfigure_tick (bvw, FALSE);
- g_object_notify (G_OBJECT (bvw), "seekable");
-}
-
-void
-bacon_video_widget_close (BaconVideoWidget *bvw)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- if (bvw->priv->open_thread != 0
- && pthread_self () != bvw->priv->open_thread) {
- /* Nicely wait for the timeout */
- pthread_cancel (bvw->priv->open_thread);
- pthread_join (bvw->priv->open_thread, NULL);
- bvw->priv->open_thread = 0;
- }
-
- bacon_video_widget_stop (bvw);
- xine_close (bvw->priv->stream);
- bvw->priv->has_subtitle = FALSE;
- bvw->priv->is_live = FALSE;
- g_free (bvw->com->mrl);
- bvw->com->mrl = NULL;
- bvw->priv->stream_length = 0;
- bvw->priv->window_resized = FALSE;
-
- g_object_notify (G_OBJECT (bvw), "seekable");
- bacon_video_widget_reconfigure_tick (bvw, FALSE);
-
- if (bvw->priv->logo_mode == FALSE)
- g_signal_emit (G_OBJECT (bvw),
- bvw_table_signals[CHANNELS_CHANGE], 0, NULL);
-}
-
-/* Properties */
-static void
-bacon_video_widget_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- BaconVideoWidget *bvw;
-
- bvw = BACON_VIDEO_WIDGET (object);
-
- switch (property_id)
- {
- case PROP_LOGO_MODE:
- bacon_video_widget_set_logo_mode (bvw,
- g_value_get_boolean (value));
- break;
- case PROP_SHOW_CURSOR:
- bacon_video_widget_set_show_cursor (bvw,
- g_value_get_boolean (value));
- break;
- case PROP_SHOW_VISUALS:
- bacon_video_widget_set_show_visuals (bvw,
- g_value_get_boolean (value));
- break;
- case PROP_VOLUME:
- bacon_video_widget_set_volume (bvw, g_value_get_double (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-bacon_video_widget_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- BaconVideoWidget *bvw;
-
- bvw = BACON_VIDEO_WIDGET (object);
-
- switch (property_id)
- {
- case PROP_LOGO_MODE:
- g_value_set_boolean (value,
- bacon_video_widget_get_logo_mode (bvw));
- break;
- case PROP_POSITION:
- g_value_set_double (value, bacon_video_widget_get_position (bvw));
- break;
- case PROP_STREAM_LENGTH:
- g_value_set_int64 (value,
- bacon_video_widget_get_stream_length (bvw));
- break;
- case PROP_PLAYING:
- g_value_set_boolean (value,
- bacon_video_widget_is_playing (bvw));
- break;
- case PROP_SEEKABLE:
- g_value_set_boolean (value,
- bacon_video_widget_is_seekable (bvw));
- break;
- case PROP_SHOW_CURSOR:
- g_value_set_boolean (value,
- bacon_video_widget_get_show_cursor (bvw));
- break;
- case PROP_VOLUME:
- g_value_set_double (value, bvw->priv->volume);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-void
-bacon_video_widget_set_logo_mode (BaconVideoWidget *bvw, gboolean logo_mode)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- if (logo_mode != bvw->priv->logo_mode) {
- bvw->priv->logo_mode = logo_mode;
-
- /* Queue a redraw of the widget */
- gtk_widget_queue_draw (GTK_WIDGET (bvw));
-
- if (logo_mode == FALSE)
- GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
- else
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
-
- /* And set a decent size for the video output */
- if (logo_mode != FALSE && bvw->priv->logo_pixbuf != NULL) {
- bvw->priv->video_width = gdk_pixbuf_get_width (bvw->priv->logo_pixbuf);
- bvw->priv->video_height = gdk_pixbuf_get_height (bvw->priv->logo_pixbuf);
- } else if (logo_mode != FALSE) {
- bvw->priv->video_width = DEFAULT_WIDTH;
- bvw->priv->video_height = DEFAULT_HEIGHT;
- }
- }
- g_object_notify (G_OBJECT (bvw), "logo_mode");
-}
-
-void
-bacon_video_widget_set_logo (BaconVideoWidget *bvw, char *filename)
-{
- GError *err = NULL;
-
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET(bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
- g_return_if_fail (filename != NULL);
-
- if (bvw->priv->logo_pixbuf != NULL)
- g_object_unref (bvw->priv->logo_pixbuf);
-
- bvw->priv->logo_pixbuf = gdk_pixbuf_new_from_file (filename, &err);
- if (err) {
- g_warning ("Couldn't open logo image: %s",
- err->message ? err->message : "No reason");
- g_error_free (err);
- }
-}
-
-void
-bacon_video_widget_set_logo_pixbuf (BaconVideoWidget *bvw, GdkPixbuf *logo)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET(bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
- g_return_if_fail (logo != NULL);
-
- if (bvw->priv->logo_pixbuf != NULL)
- g_object_unref (bvw->priv->logo_pixbuf);
-
- g_object_ref (logo);
- bvw->priv->logo_pixbuf = logo;
-}
-
-gboolean
-bacon_video_widget_get_logo_mode (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- return bvw->priv->logo_mode;
-}
-
-void
-bacon_video_widget_pause (BaconVideoWidget *bvw)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- if (bvw->priv->open_thread != 0) {
- pthread_mutex_lock (&bvw->priv->queued_actions_mutex);
- bvw->priv->queued_actions = g_list_append (bvw->priv->queued_actions,
- GINT_TO_POINTER (BVW_XINE_PAUSE));
- pthread_mutex_unlock (&bvw->priv->queued_actions_mutex);
- return;
- }
-
- xine_set_param (bvw->priv->stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE);
-
- if (bvw->priv->is_live != FALSE)
- xine_stop (bvw->priv->stream);
-
- /* Close the audio device when on pause */
- xine_set_param (bvw->priv->stream,
- XINE_PARAM_AUDIO_CLOSE_DEVICE, 1);
-
- bacon_video_widget_reconfigure_tick (bvw, FALSE);
-}
-
-double
-bacon_video_widget_get_position (BaconVideoWidget *bvw)
-{
- int pos_stream = 0, i = 0;
- int pos_time, length_time;
- gboolean ret;
-
- g_return_val_if_fail (bvw != NULL, 0);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 0);
- g_return_val_if_fail (bvw->priv->xine != NULL, 0);
-
- if (bvw->com->mrl == NULL)
- return 0;
-
- if (bacon_video_widget_is_playing (bvw) == FALSE)
- return 0;
-
- ret = xine_get_pos_length (bvw->priv->stream, &pos_stream,
- &pos_time, &length_time);
-
- while (ret == FALSE && i < 10)
- {
- usleep (100000);
- ret = xine_get_pos_length (bvw->priv->stream, &pos_stream,
- &pos_time, &length_time);
- i++;
- }
-
- if (bvw->priv->seeking == SEEKING_BY_FRACTION) {
- return bvw->priv->seek_dest;
- } else if (bvw->priv->seeking == SEEKING_BY_TIME) {
- return (double) bvw->priv->seek_dest_time / bvw->priv->stream_length;
- }
-
- if (ret == FALSE)
- return -1;
-
- return (double) pos_stream / 65535;
-}
-
-gboolean
-bacon_video_widget_can_set_volume (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- if (bvw->priv->ao_driver == NULL || bvw->priv->ao_driver_none != FALSE)
- return FALSE;
-
- if (bvw->priv->audio_out_type == BVW_AUDIO_SOUND_AC3PASSTHRU)
- return FALSE;
-
- if (xine_get_param (bvw->priv->stream,
- XINE_PARAM_AUDIO_CHANNEL_LOGICAL) == -2)
- return FALSE;
-
- return TRUE;
-}
-
-void
-bacon_video_widget_set_volume (BaconVideoWidget *bvw, double volume)
-{
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- if (bacon_video_widget_can_set_volume (bvw) != FALSE)
- {
- bvw->priv->volume = volume;
-
- volume = volume * 100 + 0.5;
- volume = CLAMP (volume, 0, 100);
- xine_set_param (bvw->priv->stream,
- XINE_PARAM_AUDIO_AMP_LEVEL, volume);
- g_object_notify (G_OBJECT (bvw), "volume");
- }
-}
-
-double
-bacon_video_widget_get_volume (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 0.0);
- g_return_val_if_fail (bvw->priv->xine != NULL, 0.0);
-
- if (bacon_video_widget_can_set_volume (bvw) == FALSE)
- return 0.0;
-
- return bvw->priv->volume;
-}
-
-void
-bacon_video_widget_set_fullscreen (BaconVideoWidget *bvw, gboolean fullscreen)
-{
- gboolean have_xvidmode;
-
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
-
- g_object_get (G_OBJECT (bvw->priv->bacon_resize),
- "have-xvidmode", &have_xvidmode,
- NULL);
-
- if (have_xvidmode == FALSE)
- return;
-
- bvw->priv->fullscreen_mode = fullscreen;
-
- if (fullscreen == FALSE)
- {
- bacon_resize_restore (bvw->priv->bacon_resize);
- /* Turn fullscreen on when we have xvidmode */
- } else if (have_xvidmode != FALSE) {
- bacon_resize_resize (bvw->priv->bacon_resize);
- }
-}
-
-void
-bacon_video_widget_set_show_cursor (BaconVideoWidget *bvw,
- gboolean show_cursor)
-{
- GdkWindow *window;
-
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
-
- window = gtk_widget_get_window (GTK_WIDGET (bvw));
- if (show_cursor == FALSE)
- {
- totem_gdk_window_set_invisible_cursor (window);
- } else {
- gdk_window_set_cursor (window, bvw->priv->cursor);
- }
-
- bvw->priv->cursor_shown = show_cursor;
-}
-
-gboolean
-bacon_video_widget_get_show_cursor (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- return bvw->priv->cursor_shown;
-}
-
-void
-bacon_video_widget_set_connection_speed (BaconVideoWidget *bvw, int speed)
-{
- xine_cfg_entry_t entry;
-
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
- g_return_if_fail (speed >= 0);
- /* -1 for the NULL, -1 for the indexing from 0 */
- g_return_if_fail (speed <= (int) (G_N_ELEMENTS (mms_bandwidth_strs) - 2));
-
- xine_config_register_enum (bvw->priv->xine,
- "media.network.bandwidth",
- 6,
- (char **) mms_bandwidth_strs,
- "Network bandwidth",
- NULL, 11, NULL, NULL);
-
- xine_config_lookup_entry (bvw->priv->xine,
- "media.network.bandwidth", &entry);
- entry.num_value = speed;
- xine_config_update_entry (bvw->priv->xine, &entry);
-}
-
-int
-bacon_video_widget_get_connection_speed (BaconVideoWidget *bvw)
-{
- xine_cfg_entry_t entry;
-
- g_return_val_if_fail (bvw != NULL, 0);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 0);
- g_return_val_if_fail (bvw->priv->xine != NULL, 0);
-
- xine_config_register_enum (bvw->priv->xine,
- "media.network.bandwidth",
- 6,
- (char **) mms_bandwidth_strs,
- "Network bandwidth",
- NULL, 11, NULL, NULL);
-
- xine_config_lookup_entry (bvw->priv->xine,
- "media.network.bandwidth", &entry);
-
- return entry.num_value;
-}
-
-gboolean
-bacon_video_widget_can_deinterlace (BaconVideoWidget *bvw)
-{
- return TRUE;
-}
-
-void
-bacon_video_widget_set_deinterlacing (BaconVideoWidget *bvw,
- gboolean deinterlace)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- xine_set_param (bvw->priv->stream, XINE_PARAM_VO_DEINTERLACE,
- deinterlace);
-}
-
-gboolean
-bacon_video_widget_get_deinterlacing (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, 0);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 0);
- g_return_val_if_fail (bvw->priv->xine != NULL, 0);
-
- return xine_get_param (bvw->priv->stream, XINE_PARAM_VO_DEINTERLACE);
-}
-
-void
-bacon_video_widget_set_show_visuals (BaconVideoWidget *bvw,
- gboolean show_visuals)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- bvw->priv->show_vfx = show_visuals;
- show_vfx_update (bvw, show_visuals);
-}
-
-GList *
-bacon_video_widget_get_visuals_list (BaconVideoWidget *bvw)
-{
- const char * const* plugins;
- int i;
-
- g_return_val_if_fail (bvw != NULL, NULL);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), NULL);
- g_return_val_if_fail (bvw->priv->xine != NULL, NULL);
-
- if (bvw->priv->visuals != NULL)
- return bvw->priv->visuals;
-
- plugins = xine_list_post_plugins_typed (bvw->priv->xine,
- XINE_POST_TYPE_AUDIO_VISUALIZATION);
-
- for (i = 0; plugins[i] != NULL; i++)
- {
- bvw->priv->visuals = g_list_prepend
- (bvw->priv->visuals, g_strdup (plugins[i]));
- }
-
- bvw->priv->visuals = g_list_reverse (bvw->priv->visuals);
-
- return bvw->priv->visuals;
-}
-
-gboolean
-bacon_video_widget_set_visuals (BaconVideoWidget *bvw, const char *name)
-{
- int speed;
-
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- if (bvw->priv->type != BVW_USE_TYPE_VIDEO)
- return FALSE;
-
- if (GTK_WIDGET_REALIZED (bvw) == FALSE)
- {
- g_free (bvw->priv->vis_name);
- bvw->priv->vis_name = g_strdup (name);
- return FALSE;
- }
-
- speed = xine_get_param (bvw->priv->stream, XINE_PARAM_SPEED);
- if (speed == XINE_SPEED_PAUSE && bvw->priv->using_vfx != FALSE)
- {
- g_free (bvw->priv->queued_vis);
- if (strcmp (name, bvw->priv->vis_name) == 0)
- {
- bvw->priv->queued_vis = NULL;
- } else {
- bvw->priv->queued_vis = g_strdup (name);
- }
- return FALSE;
- }
-
- if (bvw->priv->using_vfx != FALSE) {
- show_vfx_update (bvw, FALSE);
- g_free (bvw->priv->vis_name);
- bvw->priv->vis_name = g_strdup (name);
- show_vfx_update (bvw, TRUE);
- } else {
- g_free (bvw->priv->vis_name);
- bvw->priv->vis_name = g_strdup (name);
- show_vfx_update (bvw, FALSE);
- }
-
- return FALSE;
-}
-
-static void
-bacon_video_widget_set_visuals_quality_size (BaconVideoWidget *bvw,
- int w, int h, int fps)
-{
- xine_cfg_entry_t entry;
-
- bvw_config_helper_num (bvw->priv->xine, "effects.goom.fps", fps, &entry);
- entry.num_value = fps;
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- bvw_config_helper_num (bvw->priv->xine, "effects.goom.width", w, &entry);
- entry.num_value = w;
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- bvw_config_helper_num (bvw->priv->xine, "effects.goom.height", h, &entry);
- entry.num_value = h;
- xine_config_update_entry (bvw->priv->xine, &entry);
-}
-
-void
-bacon_video_widget_set_visuals_quality (BaconVideoWidget *bvw,
- BvwVisualsQuality quality)
-{
- GdkScreen *screen;
- int fps, h, w;
-
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- if (bacon_video_widget_common_get_vis_quality (quality, &h, &fps) == FALSE)
- return;
-
- screen = gtk_widget_get_screen (GTK_WIDGET (bvw));
- w = h * gdk_screen_get_width (screen) / gdk_screen_get_height (screen);
- bacon_video_widget_set_visuals_quality_size (bvw, w, h, fps);
-
- bvw->priv->quality = quality;
-}
-
-gboolean
-bacon_video_widget_get_auto_resize (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- return bvw->priv->auto_resize;
-}
-
-void
-bacon_video_widget_set_auto_resize (BaconVideoWidget *bvw,
- gboolean auto_resize)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- bvw->priv->auto_resize = auto_resize;
-}
-
-gint64
-bacon_video_widget_get_current_time (BaconVideoWidget *bvw)
-{
- int pos_time = 0, i = 0;
- int pos_stream, length_time;
- int status;
- gboolean ret;
-
- g_return_val_if_fail (bvw != NULL, 0);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 0);
- g_return_val_if_fail (bvw->priv->xine != NULL, 0);
-
- status = xine_get_status (bvw->priv->stream);
- if (status != XINE_STATUS_STOP && status != XINE_STATUS_PLAY)
- return 0;
-
- ret = xine_get_pos_length (bvw->priv->stream, &pos_stream,
- &pos_time, &length_time);
-
- while (ret == FALSE && i < 10)
- {
- usleep (100000);
- ret = xine_get_pos_length (bvw->priv->stream, &pos_stream,
- &pos_time, &length_time);
- i++;
- }
-
- if (bvw->priv->seeking == SEEKING_BY_FRACTION)
- {
- return bvw->priv->seek_dest * length_time;
- } else if (bvw->priv->seeking == SEEKING_BY_TIME) {
- return bvw->priv->seek_dest_time;
- }
-
- if (ret == FALSE)
- return -1;
-
- return pos_time;
-}
-
-gint64
-bacon_video_widget_get_stream_length (BaconVideoWidget *bvw)
-{
- int length_time = 0;
- int pos_stream, pos_time;
-
- g_return_val_if_fail (bvw != NULL, 0);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 0);
- g_return_val_if_fail (bvw->priv->xine != NULL, 0);
-
- if (bvw->com->mrl == NULL)
- return 0;
-
- if (xine_get_pos_length (bvw->priv->stream, &pos_stream,
- &pos_time, &length_time) == FALSE) {
- return (gint64) bvw->priv->stream_length;
- }
-
- if (length_time != bvw->priv->stream_length)
- bvw->priv->stream_length = length_time;
-
- return length_time;
-}
-
-gboolean
-bacon_video_widget_is_playing (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- if (bvw->priv->stream == NULL)
- return FALSE;
-
- return (xine_get_status (bvw->priv->stream) == XINE_STATUS_PLAY && xine_get_param (bvw->priv->stream, XINE_PARAM_SPEED) != XINE_SPEED_PAUSE);
-}
-
-gboolean
-bacon_video_widget_is_seekable (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- if (bvw->com->mrl == NULL)
- return FALSE;
-
- if (bacon_video_widget_get_stream_length (bvw) == 0)
- return FALSE;
-
- return xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_SEEKABLE);
-}
-
-static char **
-bacon_video_widget_strdupnv (const char **mrls, guint num_mrls)
-{
- guint i;
- char **retval;
-
- retval = g_new (gchar*, num_mrls + 1);
- for (i = 0; i < num_mrls; i++)
- retval[i] = g_strdup (mrls[i]);
- retval[num_mrls] = NULL;
-
- return retval;
-}
-
-char **
-bacon_video_widget_get_mrls (BaconVideoWidget *bvw,
- TotemDiscMediaType type,
- const char *device,
- GError **error)
-{
- const char *plugin_id, *entry_name;
- int num_mrls;
- char **mrls;
-
- g_return_val_if_fail (bvw != NULL, NULL);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), NULL);
- g_return_val_if_fail (bvw->priv->xine != NULL, NULL);
- g_return_val_if_fail (device != NULL, NULL);
-
- switch (type) {
- case MEDIA_TYPE_DVD:
- if (bvw->priv->can_dvd == FALSE) {
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_NO_PLUGIN_FOR_FILE,
- "XXX Do not use XXX");
- return NULL;
- }
- plugin_id = "DVD";
- entry_name = "media.dvd.device";
- break;
- case MEDIA_TYPE_VCD:
- if (bvw->priv->can_vcd == FALSE) {
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_NO_PLUGIN_FOR_FILE,
- "XXX Do not use XXX");
- return NULL;
- }
- plugin_id = "VCD";
- entry_name = "media.vcd.device";
- break;
- case MEDIA_TYPE_DVB:
- if (bvw->priv->can_dvb == FALSE) {
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_NO_PLUGIN_FOR_FILE,
- "XXX Do not use XXX");
- return NULL;
- } else {
- char *path;
-
- path = g_strdup_printf ("/dev/dvb/adapter%s/frontend0", device);
- if (g_file_test (path, G_FILE_TEST_EXISTS) == FALSE) {
- g_free (path);
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_INVALID_DEVICE,
- "XXX Do not use XXX");
- return NULL;
- }
- g_free (path);
-
- path = g_build_filename (g_get_home_dir (),
- ".xine",
- "channels.conf",
- NULL);
- if (g_file_test (path, G_FILE_TEST_IS_REGULAR) == FALSE) {
- g_free (path);
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_FILE_NOT_FOUND,
- "XXX Do not use XXX");
- return NULL;
- }
- g_free (path);
- }
- plugin_id = "DVB";
- entry_name = "media.dvb.adapter";
- break;
- case MEDIA_TYPE_CDDA:
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_INVALID_LOCATION,
- "XXX Do not use XXX");
- return NULL;
- default:
- g_assert_not_reached ();
- }
-
- if (type != MEDIA_TYPE_DVB) {
- xine_cfg_entry_t entry;
- bvw_config_helper_string (bvw->priv->xine,
- entry_name,
- device, &entry);
- entry.str_value = (char *) device;
- xine_config_update_entry (bvw->priv->xine, &entry);
- } else {
- xine_cfg_entry_t entry;
- bvw_config_helper_string (bvw->priv->xine,
- entry_name,
- 0, &entry);
- entry.num_value = atoi (device);
- xine_config_update_entry (bvw->priv->xine, &entry);
- }
-
- mrls = xine_get_autoplay_mrls (bvw->priv->xine, plugin_id, &num_mrls);
- if (mrls == NULL)
- return NULL;
-
- /* Add the device to the MRL for DVD,
- * VCD already does that for us */
- if (type == MEDIA_TYPE_DVD) {
- if (strcmp (mrls[0], "dvd:/") == 0) {
- char *uris[] = { NULL, NULL };
- uris[0] = g_strdup_printf ("dvd://%s", device);
- mrls = g_strdupv (uris);
- return mrls;
- }
- } else if (type == MEDIA_TYPE_DVB) {
- /* No channels.conf, and we couldn't find it */
- if (g_str_has_prefix (mrls[0], "Sorry, No valid channels.conf found") != FALSE) {
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_FILE_NOT_FOUND,
- "XXX Do not use XXX");
- return NULL;
- } else if (g_str_has_prefix (mrls[0], "Sorry, No DVB input device found.") != FALSE) {
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_DEVICE_BUSY,
- "XXX Do not use XXX");
- return NULL;
- }
- }
-
- return bacon_video_widget_strdupnv ((const char **) mrls, num_mrls);
-}
-
-void
-bacon_video_widget_set_subtitle_font (BaconVideoWidget *bvw, const char *font)
-{
- xine_cfg_entry_t entry;
- int fontsize, size_index;
- PangoFontDescription *desc;
-#if 0
- const char *font_family;
-#endif
- desc = pango_font_description_from_string (font);
- fontsize = pango_font_description_get_size (desc) / PANGO_SCALE;
-
- if (fontsize <= 18) {
- size_index = 0;
- } else if (fontsize <= 22) {
- size_index = 1;
- } else if (fontsize <= 28) {
- size_index = 2;
- } else if (fontsize <= 40) {
- size_index = 3;
- } else if (fontsize <= 56) {
- size_index = 4;
- } else {
- size_index = 5;
- }
-
- bvw_config_helper_num (bvw->priv->xine, "subtitles.separate.subtitle_size", size_index, &entry);
- entry.num_value = size_index;
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- //FIXME disabled, because Freetype isn't default in xine-lib yet
-#if 0
- font_family = pango_font_description_get_family (desc);
- if (font_family == NULL)
- font_family = "Sans";
-
- bvw_config_helper_string (bvw->priv->xine,
- "subtitles.separate.font", font_family, &entry);
- entry.str_value = (char *) font_family;
- xine_config_update_entry (bvw->priv->xine, &entry);
-#endif
- pango_font_description_free (desc);
-}
-
-void
-bacon_video_widget_set_subtitle_encoding (BaconVideoWidget *bvw, const char *encoding)
-{
- xine_cfg_entry_t entry;
- char *lower;
-
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
- g_return_if_fail (encoding != NULL);
-
- lower = g_ascii_strdown (encoding, -1);
-
- bvw_config_helper_string (bvw->priv->xine,
- "subtitles.separate.src_encoding", lower, &entry);
- entry.str_value = (char *) lower;
- xine_config_update_entry (bvw->priv->xine, &entry);
- g_free (lower);
-}
-
-void
-bacon_video_widget_set_aspect_ratio (BaconVideoWidget *bvw,
- BvwAspectRatio ratio)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- xine_set_param (bvw->priv->stream, XINE_PARAM_VO_ASPECT_RATIO, ratio);
-}
-
-BvwAspectRatio
-bacon_video_widget_get_aspect_ratio (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, 0);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 0);
- g_return_val_if_fail (bvw->priv->xine != NULL, 0);
-
- return xine_get_param (bvw->priv->stream, XINE_PARAM_VO_ASPECT_RATIO);
-}
-
-void
-bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw, gfloat ratio)
-{
- GtkWidget *toplevel, *widget;
- int new_w, new_h, win_w, win_h;
- GdkWindow *window;
-
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
- g_return_if_fail (ratio >= 0);
-
- if (bvw->priv->fullscreen_mode != FALSE
- || bvw->priv->logo_mode != FALSE)
- return;
-
- widget = GTK_WIDGET (bvw);
- window = gtk_widget_get_window (widget);
-
- /* Try best fit for the screen */
- if (ratio == 0)
- {
- if (totem_ratio_fits_screen (window, bvw->priv->video_width, bvw->priv->video_height, 2) != FALSE) {
- ratio = 2;
- } else if (totem_ratio_fits_screen (window, bvw->priv->video_width, bvw->priv->video_height, 1) != FALSE) {
- ratio = 1;
- } else if (totem_ratio_fits_screen (window, bvw->priv->video_width, bvw->priv->video_height, 0.5) != FALSE) {
- ratio = 0.5;
- } else {
- return;
- }
- } else {
- /* don't scale to something bigger than the screen, and leave
- * us some room */
- if (totem_ratio_fits_screen (window, bvw->priv->video_width, bvw->priv->video_height, ratio) == FALSE)
- return;
- }
-
- toplevel = gtk_widget_get_toplevel (widget);
- window = gtk_widget_get_window (toplevel);
-
- /* Get the size of the toplevel window */
- gdk_drawable_get_size (GDK_DRAWABLE (window),
- &win_w, &win_h);
-
- /* Calculate the new size of the window, depending on the size of the
- * video widget, and the new size of the video */
- new_w = win_w - widget->allocation.width +
- bvw->priv->video_width * ratio;
- new_h = win_h - widget->allocation.height +
- bvw->priv->video_height * ratio;
-
- if (new_w == win_w && new_h == win_h)
- return;
-
- /* Change the minimum size of the widget
- * but only if we're getting a smaller window */
- if (new_w < widget->allocation.width
- || new_h < widget->allocation.height)
- {
- gtk_widget_set_size_request (widget,
- bvw->priv->video_width * ratio,
- bvw->priv->video_height * ratio);
- }
-
- gtk_window_resize (GTK_WINDOW (toplevel), 1, 1);
- totem_widget_set_preferred_size (toplevel, new_w, new_h);
-}
-
-void
-bacon_video_widget_set_zoom (BaconVideoWidget *bvw, double zoom)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
- g_return_if_fail (zoom >= 0.0 && zoom <= 4.0);
-
- if (bvw->priv->stream == NULL) {
- /* No stream yet, remember the zoom level */
- bvw->priv->zoom = zoom;
- return;
- }
-
- xine_set_param (bvw->priv->stream,
- XINE_PARAM_VO_ZOOM_X, (int) (zoom * 100));
- xine_set_param (bvw->priv->stream,
- XINE_PARAM_VO_ZOOM_Y, (int) (zoom * 100));
-}
-
-double
-bacon_video_widget_get_zoom (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, 1.0);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 1.0);
- g_return_val_if_fail (bvw->priv->xine != NULL, 1.0);
-
- if (bvw->priv->stream == NULL)
- return 1.0;
-
- return (double) xine_get_param (bvw->priv->stream, XINE_PARAM_VO_ZOOM_X) / 100.0;
-}
-
-int
-bacon_video_widget_get_video_property (BaconVideoWidget *bvw,
- BvwVideoProperty type)
-{
- g_return_val_if_fail (bvw != NULL, 65535 / 2);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 65535 / 2);
- g_return_val_if_fail (bvw->priv->xine != NULL, 65535 / 2);
-
- return xine_get_param (bvw->priv->stream, video_props[type]);
-}
-
-void
-bacon_video_widget_set_video_property (BaconVideoWidget *bvw,
- BvwVideoProperty type, int value)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
-
- if ( !(value <= 65535 && value >= 0) )
- return;
-
- xine_set_param (bvw->priv->stream, video_props[type], value);
- gconf_client_set_int (bvw->priv->gc, video_props_str[type], value, NULL);
-}
-
-BvwAudioOutType
-bacon_video_widget_get_audio_out_type (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (bvw != NULL, BVW_AUDIO_SOUND_STEREO);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw),
- BVW_AUDIO_SOUND_STEREO);
- g_return_val_if_fail (bvw->priv->xine != NULL, BVW_AUDIO_SOUND_STEREO);
-
- return gconf_client_get_int (bvw->priv->gc,
- GCONF_PREFIX"/audio_output_type", NULL);
-}
-
-gboolean
-bacon_video_widget_set_audio_out_type (BaconVideoWidget *bvw,
- BvwAudioOutType type)
-{
- xine_cfg_entry_t entry;
- int value;
-
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- if (type == bvw->priv->audio_out_type)
- return FALSE;
- bvw->priv->audio_out_type = type;
-
- xine_config_register_enum (bvw->priv->xine,
- "audio.output.speaker_arrangement",
- 1,
- (char **) audio_out_types_strs,
- "Speaker arrangement",
- NULL, 0, NULL, NULL);
-
- gconf_client_set_int (bvw->priv->gc,
- GCONF_PREFIX"/audio_output_type",
- type, NULL);
-
- switch (type) {
- case BVW_AUDIO_SOUND_STEREO:
- value = 1;
- break;
- case BVW_AUDIO_SOUND_4CHANNEL:
- value = 5;
- break;
- case BVW_AUDIO_SOUND_41CHANNEL:
- value = 6;
- break;
- case BVW_AUDIO_SOUND_5CHANNEL:
- value = 7;
- break;
- case BVW_AUDIO_SOUND_51CHANNEL:
- value = 8;
- break;
- case BVW_AUDIO_SOUND_AC3PASSTHRU:
- value = 12;
- break;
- default:
- value = 1;
- g_warning ("Unsupported audio type %d selected", type);
- }
-
- xine_config_lookup_entry (bvw->priv->xine,
- "audio.output.speaker_arrangement", &entry);
- entry.num_value = value;
- xine_config_update_entry (bvw->priv->xine, &entry);
-
- return FALSE;
-}
-
-static void
-bacon_video_widget_get_metadata_string (BaconVideoWidget *bvw, BvwMetadataType type,
- GValue *value)
-{
- const char *string = NULL;
-
- g_value_init (value, G_TYPE_STRING);
-
- if (bvw->priv->stream == NULL)
- {
- g_value_set_string (value, string);
- return;
- }
-
- switch (type)
- {
- case BVW_INFO_TITLE:
- string = xine_get_meta_info (bvw->priv->stream,
- XINE_META_INFO_TITLE);
- break;
- case BVW_INFO_ARTIST:
- string = xine_get_meta_info (bvw->priv->stream,
- XINE_META_INFO_ARTIST);
- break;
- case BVW_INFO_ALBUM:
- string = xine_get_meta_info (bvw->priv->stream,
- XINE_META_INFO_ALBUM);
- break;
- case BVW_INFO_YEAR:
- string = xine_get_meta_info (bvw->priv->stream,
- XINE_META_INFO_YEAR);
- break;
- case BVW_INFO_COMMENT:
- string = xine_get_meta_info (bvw->priv->stream,
- XINE_META_INFO_COMMENT);
- break;
- case BVW_INFO_VIDEO_CODEC:
- string = xine_get_meta_info (bvw->priv->stream,
- XINE_META_INFO_VIDEOCODEC);
- break;
- case BVW_INFO_AUDIO_CODEC:
- string = xine_get_meta_info (bvw->priv->stream,
- XINE_META_INFO_AUDIOCODEC);
- break;
- case BVW_INFO_AUDIO_CHANNELS:
- {
- //FIXME xine-lib sucks at this, it gives the
- //mode of the output, not the one of the file
-#if 0
- int mode;
-
- mode = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_AUDIO_MODE);
- switch (mode)
-#endif
- }
- break;
- default:
- g_assert_not_reached ();
- }
-
- if (string != NULL && string[0] == '\0')
- string = NULL;
-
- /* Remove line feeds */
- if (string != NULL && strstr (string, "\n") != NULL)
- g_strdelimit (string, "\n", " ");
-
- if (string != NULL)
- {
- if (g_utf8_validate (string, -1, NULL) == FALSE)
- {
- char *utf8;
-
- g_warning ("Metadata for index %d not in UTF-8 for mrl '%s'", type, bvw->com->mrl);
- utf8 = g_locale_to_utf8 (string, -1, NULL, NULL, NULL);
- g_value_set_string (value, utf8);
- g_free (utf8);
- return;
- }
- }
-
- g_value_set_string (value, string);
-
- return;
-}
-
-static void
-bacon_video_widget_get_metadata_int (BaconVideoWidget *bvw,
- BvwMetadataType type, GValue *value)
-{
- int integer = 0;
-
- g_value_init (value, G_TYPE_INT);
-
- if (bvw->priv->stream == NULL)
- {
- g_value_set_int (value, 0);
- return;
- }
-
- switch (type)
- {
- case BVW_INFO_DURATION:
- integer = bacon_video_widget_get_stream_length (bvw) / 1000;
- break;
- case BVW_INFO_DIMENSION_X:
- integer = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_VIDEO_WIDTH);
- break;
- case BVW_INFO_DIMENSION_Y:
- integer = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_VIDEO_HEIGHT);
- break;
- case BVW_INFO_FPS:
- if (xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_FRAME_DURATION) != 0)
- {
- integer = 90000 / xine_get_stream_info
- (bvw->priv->stream,
- XINE_STREAM_INFO_FRAME_DURATION);
- } else {
- integer = 0;
- }
- break;
- case BVW_INFO_AUDIO_BITRATE:
- integer = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_AUDIO_BITRATE) / 1000;
- break;
- case BVW_INFO_VIDEO_BITRATE:
- integer = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_VIDEO_BITRATE) / 1000;
- break;
- case BVW_INFO_TRACK_NUMBER:
- {
- const char *string;
- string = xine_get_meta_info (bvw->priv->stream,
- XINE_META_INFO_TRACK_NUMBER);
- if (string == NULL)
- return;
-
- integer = (int) g_ascii_strtod (string, NULL);
- }
- break;
- case BVW_INFO_AUDIO_SAMPLE_RATE:
- integer = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_AUDIO_SAMPLERATE);
- break;
- default:
- g_assert_not_reached ();
- }
-
- g_value_set_int (value, integer);
-
- return;
-}
-
-static void
-bacon_video_widget_get_metadata_bool (BaconVideoWidget *bvw,
- BvwMetadataType type, GValue *value)
-{
- gboolean boolean = FALSE;
-
- g_value_init (value, G_TYPE_BOOLEAN);
-
- if (bvw->priv->stream == NULL)
- {
- g_value_set_boolean (value, FALSE);
- return;
- }
-
- switch (type)
- {
- case BVW_INFO_HAS_VIDEO:
- if (bvw->priv->logo_mode == FALSE)
- boolean = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_HAS_VIDEO);
- break;
- case BVW_INFO_HAS_AUDIO:
- if (bvw->priv->logo_mode == FALSE)
- boolean = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_HAS_AUDIO);
- break;
- default:
- g_assert_not_reached ();
- }
-
- g_value_set_boolean (value, boolean);
-
- return;
-}
-
-void
-bacon_video_widget_get_metadata (BaconVideoWidget *bvw,
- BvwMetadataType type, GValue *value)
-{
- g_return_if_fail (bvw != NULL);
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->xine != NULL);
- g_return_if_fail (value != NULL);
-
- switch (type)
- {
- case BVW_INFO_TITLE:
- case BVW_INFO_ARTIST:
- case BVW_INFO_ALBUM:
- case BVW_INFO_YEAR:
- case BVW_INFO_COMMENT:
- case BVW_INFO_VIDEO_CODEC:
- case BVW_INFO_AUDIO_CODEC:
- case BVW_INFO_AUDIO_CHANNELS:
- bacon_video_widget_get_metadata_string (bvw, type, value);
- break;
- case BVW_INFO_DURATION:
- case BVW_INFO_DIMENSION_X:
- case BVW_INFO_DIMENSION_Y:
- case BVW_INFO_FPS:
- case BVW_INFO_AUDIO_BITRATE:
- case BVW_INFO_VIDEO_BITRATE:
- case BVW_INFO_TRACK_NUMBER:
- case BVW_INFO_AUDIO_SAMPLE_RATE:
- bacon_video_widget_get_metadata_int (bvw, type, value);
- break;
- case BVW_INFO_HAS_VIDEO:
- case BVW_INFO_HAS_AUDIO:
- bacon_video_widget_get_metadata_bool (bvw, type, value);
- break;
- case BVW_INFO_COVER:
- g_value_init (value, G_TYPE_OBJECT);
- break;
- default:
- g_assert_not_reached ();
- }
-
- return;
-}
-
-GList
-*bacon_video_widget_get_languages (BaconVideoWidget *bvw)
-{
- GList *list = NULL;
- int i, num_channels;
- char lang[XINE_LANG_MAX];
-
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), NULL);
- g_return_val_if_fail (bvw->priv->stream != NULL, NULL);
-
- if (bvw->com->mrl == NULL)
- return NULL;
-
- num_channels = xine_get_stream_info
- (bvw->priv->stream, XINE_STREAM_INFO_MAX_AUDIO_CHANNEL);
-
- if (num_channels < 2)
- return NULL;
-
- for(i = 0; i < num_channels; i++)
- {
- memset (&lang, 0, sizeof (lang));
-
- if (xine_get_audio_lang(bvw->priv->stream, i, lang) == 1)
- {
- char *nospace = lang;
-
- while (g_ascii_isspace (*nospace) != FALSE)
- nospace++;
-
- list = g_list_prepend (list,
- (gpointer) g_strdup (nospace));
- } else {
- /* An unnamed language, for example 'Language 2' */
- list = g_list_prepend (list,
- (gpointer) g_strdup_printf
- (_("Language %d"), i + 1));
- }
- }
-
- return g_list_reverse (list);
-}
-
-int
-bacon_video_widget_get_language (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), -1);
- g_return_val_if_fail (bvw->priv->stream != NULL, -1);
-
- return xine_get_param (bvw->priv->stream,
- XINE_PARAM_AUDIO_CHANNEL_LOGICAL);
-}
-
-void
-bacon_video_widget_set_language (BaconVideoWidget *bvw, int language)
-{
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->stream != NULL);
-
- xine_set_param (bvw->priv->stream,
- XINE_PARAM_AUDIO_CHANNEL_LOGICAL, language);
-}
-
-GList
-*bacon_video_widget_get_subtitles (BaconVideoWidget *bvw)
-{
- GList *list = NULL;
- int i, num_channels;
- char lang[XINE_LANG_MAX];
-
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), NULL);
- g_return_val_if_fail (bvw->priv->stream != NULL, NULL);
-
- if (bvw->com->mrl == NULL)
- return NULL;
-
- num_channels = xine_get_stream_info
- (bvw->priv->stream, XINE_STREAM_INFO_MAX_SPU_CHANNEL);
-
- if (num_channels < 1) {
- if (bvw->priv->has_subtitle != FALSE) {
- return g_list_prepend (list,
- (gpointer) g_strdup_printf
- (_("Language %d"), 0));
- }
- return NULL;
- }
-
- for(i = 0; i < num_channels; i++)
- {
- memset (&lang, 0, sizeof (lang));
-
- if (xine_get_spu_lang (bvw->priv->stream, i, lang) == 1)
- {
- char *nospace = lang;
-
- while (g_ascii_isspace (*nospace) != FALSE)
- nospace++;
-
- list = g_list_prepend (list,
- (gpointer) g_strdup (nospace));
- } else {
- /* An unnamed language, for example 'Language 2' */
- list = g_list_prepend (list,
- (gpointer) g_strdup_printf
- (_("Language %d"), i + 1));
- }
- }
-
- return g_list_reverse (list);
-}
-
-int
-bacon_video_widget_get_subtitle (BaconVideoWidget *bvw)
-{
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), -2);
- g_return_val_if_fail (bvw->priv->stream != NULL, -2);
-
- return xine_get_param (bvw->priv->stream, XINE_PARAM_SPU_CHANNEL);
-}
-
-void
-bacon_video_widget_set_subtitle (BaconVideoWidget *bvw, int subtitle)
-{
- g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
- g_return_if_fail (bvw->priv->stream != NULL);
-
- xine_set_param (bvw->priv->stream, XINE_PARAM_SPU_CHANNEL, subtitle);
-}
-
-gboolean
-bacon_video_widget_has_next_track (BaconVideoWidget *bvw)
-{
- int num, current;
-
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), TRUE);
- g_return_val_if_fail (bvw->priv->stream != NULL, TRUE);
-
- if (g_str_has_prefix (bvw->com->mrl, "dvd:") == FALSE
- || bvw->com->mrl == NULL)
- return TRUE;
-
- /* Check whether there's additional chapters first */
- num = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_DVD_CHAPTER_COUNT);
- if (num == 0)
- return FALSE;
-
- current = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_DVD_CHAPTER_NUMBER);
- if (current < num)
- return TRUE;
-
- /* And now with titles */
- num = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_DVD_TITLE_COUNT);
- current = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_DVD_TITLE_NUMBER);
-
- return (current < num);
-}
-
-gboolean
-bacon_video_widget_has_previous_track (BaconVideoWidget *bvw)
-{
- int current;
-
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), TRUE);
- g_return_val_if_fail (bvw->priv->stream != NULL, TRUE);
-
- if (g_str_has_prefix (bvw->com->mrl, "dvd:") == FALSE
- || bvw->com->mrl == NULL)
- return TRUE;
-
- current = xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_DVD_CHAPTER_NUMBER);
-
- /* We can't go back across titles */
-
- return (current > 1);
-}
-
-gboolean
-bacon_video_widget_can_get_frames (BaconVideoWidget *bvw, GError **error)
-{
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- if (xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_HAS_VIDEO) == FALSE
- && bvw->priv->using_vfx == FALSE)
- {
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_CANNOT_CAPTURE,
- _("No video to capture."));
- return FALSE;
- }
-
- if (xine_get_stream_info (bvw->priv->stream,
- XINE_STREAM_INFO_VIDEO_HANDLED) == FALSE)
- {
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_CANNOT_CAPTURE,
- _("Video codec is not handled."));
- return FALSE;
- }
-
- if (bvw->priv->type == BVW_USE_TYPE_CAPTURE)
- return TRUE;
-
- if (xine_get_status (bvw->priv->stream) != XINE_STATUS_PLAY
- && bvw->priv->logo_mode == FALSE)
- {
- g_set_error_literal (error, BVW_ERROR, BVW_ERROR_CANNOT_CAPTURE,
- _("Movie is not playing."));
- return FALSE;
- }
-
- return TRUE;
-}
-
-GdkPixbuf *
-bacon_video_widget_get_current_frame (BaconVideoWidget *bvw)
-{
- GdkPixbuf *pixbuf = NULL;
- uint8_t *yuv, *y, *u, *v, *rgb;
- int width, height, ratio, format, image_ratio, desired_ratio;
- xine_video_frame_t *frame = NULL;
-
- g_return_val_if_fail (bvw != NULL, NULL);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), NULL);
- g_return_val_if_fail (bvw->priv->xine != NULL, NULL);
-
- if (bvw->priv->type != BVW_USE_TYPE_CAPTURE) {
-
- if (xine_get_current_frame (bvw->priv->stream, &width, &height,
- &ratio, &format, NULL) == 0) {
- return NULL;
- }
-
- if (width == 0 || height == 0)
- return NULL;
-
- yuv = g_malloc ((width + 8) * (height + 1) * 2);
- if (yuv == NULL)
- return NULL;
-
- if (xine_get_current_frame (bvw->priv->stream, &width, &height,
- &ratio, &format, yuv) == 0) {
- g_free (yuv);
- return NULL;
- }
- } else {
- frame = g_new0 (xine_video_frame_t, 1);
- if (xine_get_next_video_frame (bvw->priv->vo_driver, frame) != 1) {
- g_free (frame);
- return NULL;
- }
- format = frame->colorspace;
- width = frame->width;
- height = frame->height;
- yuv = frame->data;
- ratio = frame->aspect_ratio;
- }
-
- /* Convert to yv12 */
- switch (format) {
- case XINE_IMGFMT_YUY2:
- {
- uint8_t *yuy2 = yuv;
-
- yuv = g_malloc (width * height * 2);
- y = yuv;
- u = yuv + width * height;
- v = yuv + width * height * 5 / 4;
-
- yuy2toyv12 (y, u, v, yuy2, width, height);
-
- g_free (yuy2);
- }
- break;
- case XINE_IMGFMT_YV12:
- y = yuv;
- /* XXX Work-around xine-lib bug, u and v channels are swapped
- * when using xine_get_current_frame */
- if (bvw->priv->type != BVW_USE_TYPE_CAPTURE) {
- u = yuv + width * height;
- v = yuv + width * height * 5 / 4;
- } else {
- v = yuv + width * height;
- u = yuv + width * height * 5 / 4;
- }
- break;
- default:
- g_warning ("Format '%.4s' unsupported", (char *) &format);
- g_free (yuv);
- return NULL;
- }
-
- image_ratio = (double) width / (double) height * 10000.0;
-
- switch (ratio) {
- case XINE_VO_ASPECT_SQUARE:
- case XINE_VO_ASPECT_DONT_TOUCH:
- desired_ratio = image_ratio;
- break;
- case XINE_VO_ASPECT_4_3:
- desired_ratio = 10000.0 * 4 / 3;
- break;
- case XINE_VO_ASPECT_ANAMORPHIC:
- desired_ratio = 10000.0 * 16 / 9;
- break;
- case XINE_VO_ASPECT_DVB:
- desired_ratio = 10000.0 * 2.11;
- break;
- default:
- desired_ratio = 0.0;
- }
-
- /* Convert to rgb */
- rgb = yv12torgb (y, u, v, width, height);
-
- pixbuf = gdk_pixbuf_new_from_data (rgb,
- GDK_COLORSPACE_RGB, FALSE,
- 8, width, height, 3 * width,
- (GdkPixbufDestroyNotify) g_free, NULL);
-
- if (frame != NULL) {
- xine_free_video_frame (bvw->priv->vo_driver, frame);
- g_free (frame);
- }
-
- if (desired_ratio != 0)
- {
- GdkPixbuf *tmp;
-
- ratio = (double) desired_ratio / (double) image_ratio * 10000.0;
-
- if (ratio > 10000.0)
- tmp = gdk_pixbuf_scale_simple (pixbuf,
- (int) (width * ratio / 10000), height,
- GDK_INTERP_BILINEAR);
- else
- tmp = gdk_pixbuf_scale_simple (pixbuf,
- width, (int) (height * ratio / 10000),
- GDK_INTERP_BILINEAR);
-
- g_object_unref (pixbuf);
-
- return tmp;
- }
-
- return pixbuf;
-}
diff --git a/src/backend/bacon-video-widget.h b/src/backend/bacon-video-widget.h
index b11de921c..f876ed0c0 100644
--- a/src/backend/bacon-video-widget.h
+++ b/src/backend/bacon-video-widget.h
@@ -52,7 +52,6 @@ typedef struct BaconVideoWidgetCommon BaconVideoWidgetCommon;
typedef struct {
/*< private >*/
GtkEventBox parent;
- BaconVideoWidgetCommon *com;
BaconVideoWidgetPrivate *priv;
} BaconVideoWidget;
diff --git a/src/backend/video-utils.c b/src/backend/video-utils.c
index 4efb70cda..1a3783c6f 100644
--- a/src/backend/video-utils.c
+++ b/src/backend/video-utils.c
@@ -12,113 +12,6 @@
#include <string.h>
#include <stdio.h>
-/* Code taken from:
- * transcode Copyright (C) Thomas Oestreich - June 2001
- * enix enix.berlios.de
- */
-
-void yuy2toyv12 (guint8 *y, guint8 *u, guint8 *v, guint8 *input,
- int width, int height) {
- int i, j, w2;
-
- w2 = width / 2;
-
- for (i = 0; i < height; i += 2) {
- for (j = 0; j < w2; j++) {
- /* packed YUV 422 is: Y[i] U[i] Y[i+1] V[i] */
- *(y++) = *(input++);
- *(u++) = *(input++);
- *(y++) = *(input++);
- *(v++) = *(input++);
- }
-
- /* down sampling */
- for (j = 0; j < w2; j++) {
- /* skip every second line for U and V */
- *(y++) = *(input++);
- input++;
- *(y++) = *(input++);
- input++;
- }
- }
-}
-
-#define clip_8_bit(val) \
-{ \
- if (val < 0) \
- val = 0; \
- else \
- if (val > 255) val = 255; \
-}
-
-guint8 * yv12torgb (guint8 *src_y, guint8 *src_u, guint8 *src_v,
- int width, int height) {
- int i, j;
-
- int y, u, v;
- int r, g, b;
-
- int sub_i_uv;
- int sub_j_uv;
-
- int uv_width, uv_height;
-
- guchar *rgb;
-
- uv_width = width / 2;
- uv_height = height / 2;
-
- rgb = (guchar *) malloc (width * height * 3);
- if (!rgb)
- return NULL;
-
- for (i = 0; i < height; ++i) {
- /* calculate u & v rows */
- sub_i_uv = ((i * uv_height) / height);
-
- for (j = 0; j < width; ++j) {
- /* calculate u & v columns */
- sub_j_uv = ((j * uv_width) / width);
-
- /***************************************************
- * Colour conversion from
- * http://www.inforamp.net/~poynton/notes/colour_and_gamma/ColorFAQ.html#RTFToC30
- *
- * Thanks to Billy Biggs <vektor@dumbterm.net>
- * for the pointer and the following conversion.
- *
- * R' = [ 1.1644 0 1.5960 ] ([ Y' ] [ 16 ])
- * G' = [ 1.1644 -0.3918 -0.8130 ] * ([ Cb ] - [ 128 ])
- * B' = [ 1.1644 2.0172 0 ] ([ Cr ] [ 128 ])
- *
- * Where in xine the above values are represented as
- * Y' == image->y
- * Cb == image->u
- * Cr == image->v
- *
- ***************************************************/
-
- y = src_y[(i * width) + j] - 16;
- u = src_u[(sub_i_uv * uv_width) + sub_j_uv] - 128;
- v = src_v[(sub_i_uv * uv_width) + sub_j_uv] - 128;
-
- r = (1.1644 * y) + (1.5960 * v);
- g = (1.1644 * y) - (0.3918 * u) - (0.8130 * v);
- b = (1.1644 * y) + (2.0172 * u);
-
- clip_8_bit (r);
- clip_8_bit (g);
- clip_8_bit (b);
-
- rgb[(i * width + j) * 3 + 0] = r;
- rgb[(i * width + j) * 3 + 1] = g;
- rgb[(i * width + j) * 3 + 2] = b;
- }
- }
-
- return rgb;
-}
-
void
totem_gdk_window_set_invisible_cursor (GdkWindow *window)
{
diff --git a/src/backend/video-utils.h b/src/backend/video-utils.h
index ae1a6d935..68cd4021a 100644
--- a/src/backend/video-utils.h
+++ b/src/backend/video-utils.h
@@ -7,11 +7,6 @@
void totem_gdk_window_set_invisible_cursor (GdkWindow *window);
void totem_gdk_window_set_waiting_cursor (GdkWindow *window);
-void yuy2toyv12 (guint8 *y, guint8 *u, guint8 *v, guint8 *input,
- int width, int height);
-guint8 *yv12torgb (guint8 *src_y, guint8 *src_u, guint8 *src_v,
- int width, int height);
-
gboolean totem_display_is_local (void);
char *totem_time_to_string (gint64 msecs);
diff --git a/totem.doap b/totem.doap
index de1671b7c..8c7d1dae8 100644
--- a/totem.doap
+++ b/totem.doap
@@ -4,7 +4,7 @@
xmlns:gnome="http://api.gnome.org/doap-extensions#"
xmlns="http://usefulinc.com/ns/doap#">
<name xml:lang="en">totem</name>
- <shortdesc xml:lang="en">Movie player for the GNOME desktop based on xine or GStreamer</shortdesc>
+ <shortdesc xml:lang="en">Movie player for the GNOME desktop based on GStreamer</shortdesc>
<homepage rdf:resource="http://projects.gnome.org/totem/" />
<category rdf:resource="http://api.gnome.org/doap-extensions#desktop" />
<maintainer>