Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 : #if !defined(TheoraDecoder_h_)
7 : #define TheoraDecoder_h_
8 :
9 : #include "PlatformDecoderModule.h"
10 : #include "ogg/ogg.h"
11 : #include "theora/theoradec.h"
12 : #include <stdint.h>
13 :
14 : namespace mozilla {
15 :
16 : class TheoraDecoder : public MediaDataDecoder
17 : {
18 : public:
19 : explicit TheoraDecoder(const CreateDecoderParams& aParams);
20 :
21 : RefPtr<InitPromise> Init() override;
22 : RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
23 : RefPtr<DecodePromise> Drain() override;
24 : RefPtr<FlushPromise> Flush() override;
25 : RefPtr<ShutdownPromise> Shutdown() override;
26 :
27 : // Return true if mimetype is a Theora codec
28 : static bool IsTheora(const nsACString& aMimeType);
29 :
30 0 : const char* GetDescriptionName() const override
31 : {
32 0 : return "theora video decoder";
33 : }
34 :
35 : private:
36 : ~TheoraDecoder();
37 : nsresult DoDecodeHeader(const unsigned char* aData, size_t aLength);
38 :
39 : RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample);
40 :
41 : RefPtr<layers::KnowsCompositor> mImageAllocator;
42 : RefPtr<layers::ImageContainer> mImageContainer;
43 : RefPtr<TaskQueue> mTaskQueue;
44 :
45 : // Theora header & decoder state
46 : th_info mTheoraInfo;
47 : th_comment mTheoraComment;
48 : th_setup_info *mTheoraSetupInfo;
49 : th_dec_ctx *mTheoraDecoderContext;
50 : int mPacketCount;
51 :
52 : const VideoInfo& mInfo;
53 : };
54 :
55 : } // namespace mozilla
56 :
57 : #endif
|