OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 * | 9 * |
10 */ | 10 */ |
11 | 11 |
12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ | 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ |
13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ | 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ |
14 | 14 |
| 15 #include <memory> |
| 16 |
15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 17 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
16 | 18 |
17 extern "C" { | 19 extern "C" { |
18 #include "third_party/ffmpeg/libavcodec/avcodec.h" | 20 #include "third_party/ffmpeg/libavcodec/avcodec.h" |
19 } // extern "C" | 21 } // extern "C" |
20 | 22 |
21 #include "webrtc/base/scoped_ptr.h" | |
22 #include "webrtc/common_video/include/i420_buffer_pool.h" | 23 #include "webrtc/common_video/include/i420_buffer_pool.h" |
23 | 24 |
24 namespace webrtc { | 25 namespace webrtc { |
25 | 26 |
26 struct AVCodecContextDeleter { | 27 struct AVCodecContextDeleter { |
27 void operator()(AVCodecContext* ptr) const { avcodec_free_context(&ptr); } | 28 void operator()(AVCodecContext* ptr) const { avcodec_free_context(&ptr); } |
28 }; | 29 }; |
29 struct AVFrameDeleter { | 30 struct AVFrameDeleter { |
30 void operator()(AVFrame* ptr) const { av_frame_free(&ptr); } | 31 void operator()(AVFrame* ptr) const { av_frame_free(&ptr); } |
31 }; | 32 }; |
(...skipping 24 matching lines...) Expand all Loading... |
56 // The |VideoFrame| returned by FFmpeg at |Decode| originate from here. Their | 57 // The |VideoFrame| returned by FFmpeg at |Decode| originate from here. Their |
57 // buffers are reference counted and freed by FFmpeg using |AVFreeBuffer2|. | 58 // buffers are reference counted and freed by FFmpeg using |AVFreeBuffer2|. |
58 static int AVGetBuffer2( | 59 static int AVGetBuffer2( |
59 AVCodecContext* context, AVFrame* av_frame, int flags); | 60 AVCodecContext* context, AVFrame* av_frame, int flags); |
60 // Called by FFmpeg when it is done with a video frame, see |AVGetBuffer2|. | 61 // Called by FFmpeg when it is done with a video frame, see |AVGetBuffer2|. |
61 static void AVFreeBuffer2(void* opaque, uint8_t* data); | 62 static void AVFreeBuffer2(void* opaque, uint8_t* data); |
62 | 63 |
63 bool IsInitialized() const; | 64 bool IsInitialized() const; |
64 | 65 |
65 I420BufferPool pool_; | 66 I420BufferPool pool_; |
66 rtc::scoped_ptr<AVCodecContext, AVCodecContextDeleter> av_context_; | 67 std::unique_ptr<AVCodecContext, AVCodecContextDeleter> av_context_; |
67 rtc::scoped_ptr<AVFrame, AVFrameDeleter> av_frame_; | 68 std::unique_ptr<AVFrame, AVFrameDeleter> av_frame_; |
68 | 69 |
69 DecodedImageCallback* decoded_image_callback_; | 70 DecodedImageCallback* decoded_image_callback_; |
70 }; | 71 }; |
71 | 72 |
72 } // namespace webrtc | 73 } // namespace webrtc |
73 | 74 |
74 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ | 75 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ |
OLD | NEW |