예제 #1
0
        /// <summary>
        /// Positions the stream at the start of the next frame.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="streamContentType"></param>
        /// <returns></returns>
        public void SeekNextFrame(int stream, StreamContentType streamContentType)
        {
            SyncWord syncWord;

            switch (_streamContentType)
            {
            case StreamContentType.DD:
                syncWord = new DDSyncWord();
                break;

            case StreamContentType.DTS14Bit:
                syncWord = new DTS14bitSyncWord();
                break;

            case StreamContentType.DTS:
                syncWord = new DTSSyncWord();
                break;

            case StreamContentType.IEC61937:
                syncWord = new IECSyncWord();
                break;

            default:
                syncWord = null;
                break;
            }

            if (syncWord != null)
            {
                SeekNextFrame(syncWord);
            }
        }
        public static bool Sync(int stream, StreamContentType streamContentType)
        {
            SyncWord syncWord;
              switch (streamContentType)
              {
            case StreamContentType.DD:
              syncWord = new DDSyncWord();
              break;

            case StreamContentType.DTS14Bit:
              syncWord = new DTS14bitSyncWord();
              break;

            case StreamContentType.DTS:
              syncWord = new DTSSyncWord();
              break;

            case StreamContentType.IEC61937:
              syncWord = new IECSyncWord();
              break;

            default:
              syncWord = null;
              break;
              }

              if (syncWord != null)
            return SyncToWord(stream, syncWord);
              else
            return false;
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        private void Initialize()
        {
            _info = Bass.BASS_ChannelGetInfo(_handle);
            Log.Debug("Stream type: {0}", _info.ctype);

            if (_info.ctype != BASSChannelType.BASS_CTYPE_STREAM &&
                _info.ctype != BASSChannelType.BASS_CTYPE_STREAM_MIXER)
            {
                Log.Info("Stream info: {0}", _info.ToString());

                UpdateLocalFields();
                _streamContentType = GetStreamContentType();

                Log.Info("Stream content: {0}", _streamContentType);
            }
        }
        private bool InternalPlay(string filePath, bool isAsync)
        {
            Log.Debug("BASSPlayer.InternalPlay(\"{0}\", {1}) called...", filePath, isAsync);

              _CurrentFilePath = filePath;
              bool result = InitBASS();

              if (result)
              {
            _CurrentFileType = Utils.GetFileType(filePath);
            Log.Info(String.Format("Determined file type: {0}", _CurrentFileType));

            CreateCurrentStream();
            result = (_CurrentStream != 0);
              }

              if (result)
              {
            GetReplayGainData();
              }

              if (result)
              {
            _CurrentContentType = EncodedStreamHelper.GetStreamContentType(_CurrentStream);
            Log.Info(String.Format("Determined stream content type: {0}", _CurrentContentType));

            if (_CurrentFileType.FileMainType == FileMainType.WebStream)
            {
              // Get the Tags and set the Meta Tag SyncProc
              GetStreamTags(_CurrentStream);
              _PrevMetaTag = "";
              GetStreamMetaTags(Bass.BASS_ChannelGetTags(_CurrentStream, BASSTag.BASS_TAG_META));
              Bass.BASS_ChannelSetSync(_CurrentStream, BASSSync.BASS_SYNC_META, 0, _MetaTagSyncProcDelegate, IntPtr.Zero);
            }

            if (_State == PlayState.Playing || _State == PlayState.Paused)
            {
              if (!_PlayingFromBuffer)
              {
            //Normally we won't get here; MP will call Stop()
            FadeOut();
            result = StopSession(false, true);

            if (result)
            {
              _DataStream = _CurrentStream;
              result = StartSession();
            }
              }
              else
              {
            Log.Debug("Queueing stream...");
            _NextDataStream = _CurrentStream;
              }
            }
            else if (_State == PlayState.Stopped)
            {
              _DataStream = _CurrentStream;
              result = StartSession();
            }
              }

              if (WaitCursorRequested != null)
            WaitCursorRequested(this, WaitCursorRequest.Off);

              if (isAsync && !result)
              {
            // If there is a problem with the file, and we're not playing a CD
            // make MP try the next item in the playlist
            // When playing CD, most likely cause is CD has been ejected.
            // In other cases, stop alltogether
            if (_LastError.ErrorCode == ErrorCode.FileError && _CurrentFileType.FileMainType != FileMainType.CDTrack)
            {
              if (Ended != null)
            Ended();
            }
            else
            {
              if (_State != PlayState.Stopped)
              {
            FadeOut();
            StopSession();
              }

              if (Stopped != null)
            Stopped();
            }
              }

              return result;
        }
예제 #5
0
    /// <summary>
    /// Initializes a new instance.
    /// </summary>
    private void Initialize()
    {
      _info = Bass.BASS_ChannelGetInfo(_handle);
      Log.Debug("Stream type: {0}", _info.ctype);

      if (_info.ctype != BASSChannelType.BASS_CTYPE_STREAM &&
          _info.ctype != BASSChannelType.BASS_CTYPE_STREAM_MIXER)
      {
        Log.Info("Stream info: {0}", _info.ToString());

        UpdateLocalFields();
        _streamContentType = GetStreamContentType();

        Log.Info("Stream content: {0}", _streamContentType);
      }
    }
예제 #6
0
    /// <summary>
    /// Positions the stream at the start of the next frame.
    /// </summary>
    /// <param name="stream"></param>
    /// <param name="streamContentType"></param>
    /// <returns></returns>
    public void SeekNextFrame(int stream, StreamContentType streamContentType)
    {
      SyncWord syncWord;
      switch (_streamContentType)
      {
        case StreamContentType.DD:
          syncWord = new DDSyncWord();
          break;

        case StreamContentType.DTS14Bit:
          syncWord = new DTS14bitSyncWord();
          break;

        case StreamContentType.DTS:
          syncWord = new DTSSyncWord();
          break;

        case StreamContentType.IEC61937:
          syncWord = new IECSyncWord();
          break;

        default:
          syncWord = null;
          break;
      }

      if (syncWord != null)
        SeekNextFrame(syncWord);
    }