Logo Search packages:      
Sourcecode: ultrastar-ng version File versions  Download package

int CAudio::getLength ( void   ) 

This method returns the length of the current track stored in the length varialble. If the length variable hasn't be already computed (for any reason) it is computed again.

Definition at line 131 of file audio.cpp.

Referenced by isPlaying(), and seek().

{
      if( length == LENGTH_ERROR ) {
#ifdef USE_LIBXINE_AUDIO
            int pos_stream;
            int pos_time;
            if( !xine_get_pos_length(stream, &pos_stream, &pos_time, &length) )
                  length = LENGTH_ERROR;
#endif
#ifdef USE_GSTREAMER_AUDIO
            GstFormat fmt = GST_FORMAT_TIME;
            gint64 len;
            if (!gst_element_query_duration (music, &fmt, &len))
                  length = LENGTH_ERROR;
            else
                  length = (int) (len/GST_MSECOND);
#endif
      }

      if( length == LENGTH_ERROR )
            return 0;
      else
            return length;
}


Generated by  Doxygen 1.6.0   Back to index