Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmssound.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2013 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #include "mmsmedia/mmssound.h"
00034 
00035 MMS_CREATEERROR(MMSSoundError);
00036 
00037 #ifdef __HAVE_GSTREAMER__
00038 #endif
00039 #ifdef __HAVE_XINE__
00040 /**
00041  * Callback, that will be called if xine sends event messages.
00042  *
00043  * @param   userData    [in/out]    pointer to the MMSSound object
00044  * @param   event       [in]        pointer to event structure
00045  */
00046 static void queue_cb(void *userData, const xine_event_t *event) {
00047 
00048     if(!userData)
00049         return;
00050 
00051     MMSSound *mmssound = (MMSSound*)userData;
00052 
00053     if(event->type == XINE_EVENT_UI_PLAYBACK_FINISHED)
00054         mmssound->onPlaybackFinished.emit();
00055 }
00056 #endif
00057 
00058 /**
00059  * Constructor of MMSSound class.
00060  *
00061  * @param   verbose [in]    if true the xine engine writes debug messages to stdout
00062  *
00063  * @see MMSAV::MMSAV()
00064  * @see MMSAV::initialize()
00065  */
00066 MMSSound::MMSSound(const bool verbose) {
00067     MMSAV::initialize(verbose);
00068 }
00069 
00070 /**
00071  * Destructor of MMSSound class.
00072  */
00073 MMSSound::~MMSSound() {
00074     this->onPlaybackFinished.clear();
00075 }
00076 
00077 #ifdef __HAVE_GSTREAMER__
00078 #endif
00079 #ifdef __HAVE_XINE__
00080 /**
00081  * Calls MMSAV::open() with the queue_cb callback.
00082  */
00083 void MMSSound::xineOpen() {
00084 
00085     MMSAV::xineOpen(queue_cb);
00086 
00087     // ignore video
00088     xine_set_param(this->stream, XINE_PARAM_IGNORE_VIDEO, true);
00089 }
00090 #endif
00091 
00092 /**
00093  * Starts playing.
00094  *
00095  * If the continue flag is set it tries to continue
00096  * at the position where it was stopped before.
00097  *
00098  * @param   mrl     MRL to play
00099  * @param   cont    if true it tries to continue at a position stopped before
00100  */
00101 void MMSSound::startPlaying(string mrl, bool cont) {
00102 /*    if(!this->stream)
00103         this->open();*/
00104 #ifdef __HAVE_XINE__
00105     if(!this->stream) MMSAV::xineOpen(queue_cb, (void*)this);
00106 #endif
00107 
00108     MMSAV::startPlaying(mrl, cont);
00109 }
00110 
00111 /**
00112  * Playback will be switched to fast forward.
00113  *
00114  * There are two different speed settings for fast forward.
00115  * Twice as fast and four times as fast.
00116  */
00117 void MMSSound::ffwd() {
00118     if (this->backend == MMSMEDIA_BE_GST) {
00119 #ifdef __HAVE_GSTREAMER__
00120 #endif
00121     }
00122     else {
00123 #ifdef __HAVE_XINE__
00124         if(this->status != this->STATUS_NONE) {
00125             this->setStatus(this->STATUS_FFWD);
00126             xine_set_param(this->stream, XINE_PARAM_SPEED, XINE_SPEED_FAST_4);
00127         }
00128 #endif
00129     }
00130 }

Generated by doxygen