OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 * |
| 10 */ |
| 11 |
| 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ |
| 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ |
| 14 |
| 15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
| 16 |
| 17 extern "C" { |
| 18 #include "third_party/ffmpeg/libavcodec/avcodec.h" |
| 19 } // extern "C" |
| 20 |
| 21 #include "webrtc/base/scoped_ptr.h" |
| 22 |
| 23 namespace webrtc { |
| 24 |
| 25 struct AVCodecContextDeleter { |
| 26 void operator()(AVCodecContext* ptr) const { avcodec_free_context(&ptr); } |
| 27 }; |
| 28 struct AVFrameDeleter { |
| 29 void operator()(AVFrame* ptr) const { av_frame_free(&ptr); } |
| 30 }; |
| 31 |
| 32 class H264DecoderImpl : public H264Decoder { |
| 33 public: |
| 34 H264DecoderImpl(); |
| 35 ~H264DecoderImpl() override; |
| 36 |
| 37 // |codec_settings| is ignored except if it's not null then |
| 38 // |codec_settings->codecType| must be kVideoCodecH264. |
| 39 int32_t InitDecode(const VideoCodec* codec_settings, |
| 40 int32_t number_of_cores) override; |
| 41 int32_t Release() override; |
| 42 int32_t Reset() override; |
| 43 |
| 44 int32_t RegisterDecodeCompleteCallback( |
| 45 DecodedImageCallback* callback) override; |
| 46 |
| 47 // |missing_frames|, |fragmentation| and |render_time_ms| are ignored. |
| 48 int32_t Decode(const EncodedImage& input_image, |
| 49 bool /*missing_frames*/, |
| 50 const RTPFragmentationHeader* /*fragmentation*/, |
| 51 const CodecSpecificInfo* codec_specific_info = nullptr, |
| 52 int64_t render_time_ms = -1) override; |
| 53 |
| 54 private: |
| 55 bool IsInitialized() const; |
| 56 |
| 57 rtc::scoped_ptr<AVCodecContext, AVCodecContextDeleter> av_context_; |
| 58 rtc::scoped_ptr<AVFrame, AVFrameDeleter> av_frame_; |
| 59 |
| 60 DecodedImageCallback* decoded_image_callback_; |
| 61 }; |
| 62 |
| 63 } // namespace webrtc |
| 64 |
| 65 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ |
OLD | NEW |