Merge branch '2_5_to_2_6_bug_107' 2.6.0
authorghost <andreas.monzner@multimedia-labs.de>
Mon, 2 Nov 2009 15:00:05 +0000 (16:00 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Mon, 2 Nov 2009 15:00:05 +0000 (16:00 +0100)
1  2 
lib/service/servicemp3.cpp

index 7f87ffad734ffd93250a8cf89a9ee25342e25904,af9e1d34a52725b2f270b1b4f170b6cc3285cccb..e1bf23dd8482f83106783cdfa014b83b649d77f4
@@@ -42,7 -42,6 +42,6 @@@ eServiceFactoryMP3::eServiceFactoryMP3(
                extensions.push_back("mp4");
                extensions.push_back("mov");
                extensions.push_back("m4a");
-               extensions.push_back("m2ts");
                sc->addServiceFactory(eServiceFactoryMP3::id, this, extensions);
        }
  
@@@ -194,7 -193,7 +193,7 @@@ eServiceMP3::eServiceMP3(eServiceRefere
        m_seekTimeout = eTimer::create(eApp);
        m_subtitle_sync_timer = eTimer::create(eApp);
        m_stream_tags = 0;
 -      m_currentAudioStream = 0;
 +      m_currentAudioStream = -1;
        m_currentSubtitleStream = 0;
        m_subtitle_widget = 0;
        m_currentTrickRatio = 0;
                eDebug("eServiceMP3::sorry, can't play: missing gst-plugin-appsink");
        else
        {
 -              g_signal_connect (subsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this);
 +              m_subs_to_pull_handler_id = g_signal_connect (subsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this);
                g_object_set (G_OBJECT (m_gst_playbin), "text-sink", subsink, NULL);
        }
  
                m_gst_playbin = 0;
        }
  
 -      gst_element_set_state (m_gst_playbin, GST_STATE_PLAYING);
        setBufferSize(m_buffer_size);
  }
  
  eServiceMP3::~eServiceMP3()
  {
 +      // disconnect subtitle callback
 +      GstElement *sink;
 +      g_object_get (G_OBJECT (m_gst_playbin), "text-sink", &sink, NULL);
 +      if (sink)
 +      {
 +              g_signal_handler_disconnect (sink, m_subs_to_pull_handler_id);
 +              gst_object_unref(sink);
 +      }
 +
        delete m_subtitle_widget;
 +
 +      // disconnect sync handler callback
 +      gst_bus_set_sync_handler(gst_pipeline_get_bus (GST_PIPELINE (m_gst_playbin)), NULL, NULL);
 +
        if (m_state == stRunning)
                stop();
 -      
 +
        if (m_stream_tags)
                gst_tag_list_free(m_stream_tags);
        
        }
  }
  
 -DEFINE_REF(eServiceMP3);      
 +DEFINE_REF(eServiceMP3);
  
  RESULT eServiceMP3::connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection)
  {
  RESULT eServiceMP3::start()
  {
        ASSERT(m_state == stIdle);
 -      
 +
        m_state = stRunning;
        if (m_gst_playbin)
        {
                eDebug("eServiceMP3::starting pipeline");
                gst_element_set_state (m_gst_playbin, GST_STATE_PLAYING);
        }
 +
        m_event(this, evStart);
 +
        return 0;
  }
  
  RESULT eServiceMP3::stop()
  {
        ASSERT(m_state != stIdle);
 +
        if (m_state == stStopped)
                return -1;
 +
        eDebug("eServiceMP3::stop %s", m_ref.path.c_str());
        gst_element_set_state(m_gst_playbin, GST_STATE_NULL);
        m_state = stStopped;
 +
        return 0;
  }
  
@@@ -962,8 -944,6 +961,8 @@@ int eServiceMP3::getNumberOfTracks(
  
  int eServiceMP3::getCurrentTrack()
  {
 +      if (m_currentAudioStream == -1)
 +              g_object_get (G_OBJECT (m_gst_playbin), "current-audio", &m_currentAudioStream, NULL);
        return m_currentAudioStream;
  }