/src/mozilla-central/dom/media/platforms/ffmpeg/FFmpegDataDecoder.h
Line | Count | Source (jump to first uncovered line) |
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 | | |
7 | | #ifndef __FFmpegDataDecoder_h__ |
8 | | #define __FFmpegDataDecoder_h__ |
9 | | |
10 | | #include "PlatformDecoderModule.h" |
11 | | #include "FFmpegLibWrapper.h" |
12 | | #include "mozilla/StaticMutex.h" |
13 | | #include "FFmpegLibs.h" |
14 | | |
15 | | namespace mozilla { |
16 | | |
17 | | template <int V> |
18 | | class FFmpegDataDecoder : public MediaDataDecoder |
19 | | { |
20 | | }; |
21 | | |
22 | | template<> |
23 | | class FFmpegDataDecoder<LIBAV_VER>; |
24 | | DDLoggedTypeNameAndBase(FFmpegDataDecoder<LIBAV_VER>, MediaDataDecoder); |
25 | | |
26 | | template<> |
27 | | class FFmpegDataDecoder<LIBAV_VER> |
28 | | : public MediaDataDecoder |
29 | | , public DecoderDoctorLifeLogger<FFmpegDataDecoder<LIBAV_VER>> |
30 | | { |
31 | | public: |
32 | | FFmpegDataDecoder(FFmpegLibWrapper* aLib, TaskQueue* aTaskQueue, |
33 | | AVCodecID aCodecID); |
34 | | virtual ~FFmpegDataDecoder(); |
35 | | |
36 | | static bool Link(); |
37 | | |
38 | | RefPtr<InitPromise> Init() override = 0; |
39 | | RefPtr<DecodePromise> Decode(MediaRawData* aSample) override; |
40 | | RefPtr<DecodePromise> Drain() override; |
41 | | RefPtr<FlushPromise> Flush() override; |
42 | | RefPtr<ShutdownPromise> Shutdown() override; |
43 | | |
44 | | static AVCodec* FindAVCodec(FFmpegLibWrapper* aLib, AVCodecID aCodec); |
45 | | |
46 | | protected: |
47 | | // Flush and Drain operation, always run |
48 | | virtual RefPtr<FlushPromise> ProcessFlush(); |
49 | | virtual void ProcessShutdown(); |
50 | 0 | virtual void InitCodecContext() { } Unexecuted instantiation: mozilla::FFmpegDataDecoder<46465650>::InitCodecContext() Unexecuted instantiation: mozilla::FFmpegDataDecoder<53>::InitCodecContext() Unexecuted instantiation: mozilla::FFmpegDataDecoder<54>::InitCodecContext() Unexecuted instantiation: mozilla::FFmpegDataDecoder<55>::InitCodecContext() Unexecuted instantiation: mozilla::FFmpegDataDecoder<57>::InitCodecContext() Unexecuted instantiation: mozilla::FFmpegDataDecoder<58>::InitCodecContext() |
51 | | AVFrame* PrepareFrame(); |
52 | | MediaResult InitDecoder(); |
53 | | MediaResult DoDecode(MediaRawData* aSample, |
54 | | bool* aGotFrame, |
55 | | DecodedData& aOutResults); |
56 | | |
57 | | FFmpegLibWrapper* mLib; |
58 | | |
59 | | AVCodecContext* mCodecContext; |
60 | | AVCodecParserContext* mCodecParser; |
61 | | AVFrame* mFrame; |
62 | | RefPtr<MediaByteBuffer> mExtraData; |
63 | | AVCodecID mCodecID; |
64 | | |
65 | | private: |
66 | | RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample); |
67 | | RefPtr<DecodePromise> ProcessDrain(); |
68 | | virtual MediaResult DoDecode(MediaRawData* aSample, |
69 | | uint8_t* aData, |
70 | | int aSize, |
71 | | bool* aGotFrame, |
72 | | MediaDataDecoder::DecodedData& aOutResults) = 0; |
73 | 0 | virtual bool NeedParser() const { return false; } Unexecuted instantiation: mozilla::FFmpegDataDecoder<46465650>::NeedParser() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<53>::NeedParser() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<54>::NeedParser() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<55>::NeedParser() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<57>::NeedParser() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<58>::NeedParser() const |
74 | 0 | virtual int ParserFlags() const { return PARSER_FLAG_COMPLETE_FRAMES; } Unexecuted instantiation: mozilla::FFmpegDataDecoder<46465650>::ParserFlags() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<53>::ParserFlags() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<54>::ParserFlags() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<55>::ParserFlags() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<57>::ParserFlags() const Unexecuted instantiation: mozilla::FFmpegDataDecoder<58>::ParserFlags() const |
75 | | |
76 | | static StaticMutex sMonitor; |
77 | | const RefPtr<TaskQueue> mTaskQueue; |
78 | | MozPromiseHolder<DecodePromise> mPromise; |
79 | | media::TimeUnit mLastInputDts; |
80 | | }; |
81 | | |
82 | | } // namespace mozilla |
83 | | |
84 | | #endif // __FFmpegDataDecoder_h__ |