2016-12-31 19 views
0

IMFByteStreamビデオをネットワーク経由で配信するカスタムを実装していますが、CreateObjectFromByteStreamが返されているため、そのオブジェクトをソースリゾルバに渡してメディアソースを作成できないという問題があります。エラー:ソースリーダーとカスタムのシーク不可能なバイトストリーム

0xc00d36ee : The provided bytestream was expected to be seekable and it is not.

もちろん、私のカスタムバイトストリームはネットワーク経由でのシークが不可能なのでシークできません。だから問題は、シーク不可能なバイトストリームを使ってメディアソースを作成する方法です。私の最終的な目的は、IMFSourceReaderオブジェクトを作成することです。ソースコンテンツのタイプはASFです。

+0

シーク不可能なストリームのメディアソースが必要です。いくつかの情報源はシークが必要であり、シークが利用可能になることを確かめるためにキャップをチェックするのは全体的なポイントです。 –

+0

宛先メディアソースのコンテンツタイプがASFです。シーク可能なバイトストリームを必要としないASFメディアソースを作成することは可能ですか? – pawel

+0

私はすべてのシークが "前方"であると仮定しているので、ストリームのための簡単なシークを実装することが可能です(不要なデータを読み込むだけです)。 –

答えて

0

あなたの失敗は、おそらくから来ている:あなたはメディアソースpropertiesを試みるかもしれないが、それはより多くのバイトストリームがシーク可能である必須要件のように見える

During the creation of the media source, the source resolver creates a byte stream for the file from which the media source reads the ASF content. In order for the time conversions to be successful, the byte stream associated with the ASF file must have seeking capabilities; otherwise, the application gets the MF_E_BYTESTREAM_NOT_SEEKABLE error from the Begin... call.

。あなたがこれをうまく動作させるためにできることは、実際にはまだ利用可能ではない位置からの読み取りがあると、実際にシーク可能とマークして待機を実装することです。

+0

しかし、シーク可能なバイトストリームの位置はどこにでも設定できます。だから私は受け取ったすべてのデータをバッファしなければならないだろう。それは不可能です。 – pawel

+1

シーク能力要件は、通常、理由によるものです。有限のバイトストリームを想定しているソースで作業しています。可能な範囲でシークアビリティを模倣するようにコードを適合させるか、(バイトストリームではなく)スキームハンドラとフル機能のネットワークソースに切り替える必要があります。バイトストリームがプログレッシブダウンロードスタイルのデータを運ぶ場合、シークは小さなシステム(フォーマット、メタデータ)の範囲内でしかなく、ペイロードのシーケンシャルリードが続く可能性があります。 –

1

私は2つのIMFByteStreamインターフェイスを実装しています.1つはMediaByteStreamと呼ばれ、非ストレージメモリストリーミングに使用され、もう1つはStoreByteStreamと呼ばれ、インメモリストレージに使用されます。

IMFByteStream実装にコードを配置すると、シーク可能なエラーがなくなり、ストリーム配信機能に影響しません。

 /// <summary> 
     /// Retrieves the characteristics of the byte stream. 
     /// </summary> 
     /// <param name="pdwCapabilities">Receives a bitwise OR of zero or more flags. The following flags are defined. [out]</param> 
     /// <returns>The result of the operation.</returns> 
     HRESULT MediaByteStream::GetCapabilities(
      DWORD *pdwCapabilities) 
     { 
      HRESULT hr = S_OK; 

      // Stream can read, can write, can seek. 
      *pdwCapabilities = MFBYTESTREAM_IS_READABLE | MFBYTESTREAM_IS_WRITABLE | MFBYTESTREAM_IS_SEEKABLE; 

      // Return the result. 
      return hr; 
     } 

あなたはIMFByteStreamインターフェイスのSeekメソッドを実装したいことができるかどうかが、あなたの場合(ネットワーク・ストリーミング)で、あなただけの追求の位置を返すことができます。

 /// <summary> 
     /// Moves the current position in the stream by a specified offset. 
     /// </summary> 
     /// <param name="SeekOrigin">Specifies the origin of the seek as a member of the MFBYTESTREAM_SEEK_ORIGIN enumeration. The offset is calculated relative to this position. [in]</param> 
     /// <param name="qwSeekOffset">Specifies the new position, as a byte offset from the seek origin. [in]</param> 
     /// <param name="dwSeekFlags">Specifies zero or more flags. The following flags are defined. [in]</param> 
     /// <param name="pqwCurrentPosition">Receives the new position after the seek. [out]</param> 
     /// <returns>The result of the operation.</returns> 
     HRESULT MediaByteStream::Seek(
      MFBYTESTREAM_SEEK_ORIGIN SeekOrigin, 
      LONGLONG     qwSeekOffset, 
      DWORD     dwSeekFlags, 
      QWORD     *pqwCurrentPosition) 
     { 
      HRESULT hr = S_OK; 
      _seekRequest = true; 

      // Select the seek origin. 
      switch (SeekOrigin) 
      { 
      case MFBYTESTREAM_SEEK_ORIGIN::msoCurrent: 
       // If the buffer is less or same. 
       if ((qwSeekOffset + _position) < size) 
        _position += qwSeekOffset; 
       else 
        _position = size; 

       break; 

      case MFBYTESTREAM_SEEK_ORIGIN::msoBegin: 
      default: 
       // If the buffer is less or same. 
       if (qwSeekOffset < size) 
        _position = qwSeekOffset; 
       else 
        _position = size; 

       break; 
      } 

      // Get the current position in the stream. 
      *pqwCurrentPosition = _position; 

      // Return the result. 
      return hr; 
     } 
関連する問題