tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

VideoDecoder.h (1965B)


      1 /*
      2 * Copyright 2013, Mozilla Foundation and contributors
      3 *
      4 * Licensed under the Apache License, Version 2.0 (the "License");
      5 * you may not use this file except in compliance with the License.
      6 * You may obtain a copy of the License at
      7 *
      8 * http://www.apache.org/licenses/LICENSE-2.0
      9 *
     10 * Unless required by applicable law or agreed to in writing, software
     11 * distributed under the License is distributed on an "AS IS" BASIS,
     12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 * See the License for the specific language governing permissions and
     14 * limitations under the License.
     15 */
     16 
     17 #ifndef __VideoDecoder_h__
     18 #define __VideoDecoder_h__
     19 
     20 // This include is required in order for content_decryption_module to work
     21 // on Unix systems.
     22 
     23 #include <atomic>
     24 #include <queue>
     25 #include <thread>
     26 
     27 #include "content_decryption_module.h"
     28 #include "WMFH264Decoder.h"
     29 
     30 class VideoDecoder : public RefCounted {
     31 public:
     32  explicit VideoDecoder(cdm::Host_11* aHost);
     33 
     34  cdm::Status InitDecode(const cdm::VideoDecoderConfig_2& aConfig);
     35 
     36  cdm::Status Decode(const cdm::InputBuffer_2& aEncryptedBuffer,
     37                     cdm::VideoFrame* aVideoFrame);
     38 
     39  void Reset();
     40 
     41  void DecodingComplete();
     42 
     43  bool HasShutdown() { return mHasShutdown; }
     44 
     45 private:
     46  virtual ~VideoDecoder();
     47 
     48  cdm::Status Drain(cdm::VideoFrame* aVideoFrame);
     49 
     50  struct DecodeData {
     51    std::vector<uint8_t> mBuffer;
     52    uint64_t mTimestamp = 0;
     53    CryptoMetaData mCrypto;
     54  };
     55 
     56  cdm::Status OutputFrame(cdm::VideoFrame* aVideoFrame);
     57 
     58  HRESULT SampleToVideoFrame(IMFSample* aSample, int32_t aPictureWidth,
     59                             int32_t aPictureHeight, int32_t aStride,
     60                             int32_t aFrameHeight,
     61                             cdm::VideoFrame* aVideoFrame);
     62 
     63  cdm::Host_11* mHost;
     64  wmf::AutoPtr<wmf::WMFH264Decoder> mDecoder;
     65 
     66  std::queue<wmf::CComPtr<IMFSample>> mOutputQueue;
     67 
     68  bool mHasShutdown;
     69 };
     70 
     71 #endif  // __VideoDecoder_h__