| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ | 5 #ifndef MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ |
| 6 #define MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ | 6 #define MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| 11 | 11 |
| 12 namespace media { | 12 namespace media { |
| 13 | 13 |
| 14 class Buffer; | 14 class Buffer; |
| 15 | 15 |
| 16 enum VideoCodec { | 16 enum VideoCodec { |
| 17 kCodecH264, | 17 kCodecH264, |
| 18 kCodecVC1, | 18 kCodecVC1, |
| 19 kCodecMPEG2, | 19 kCodecMPEG2, |
| 20 kCodecMPEG4, | 20 kCodecMPEG4, |
| 21 kCodecTheora, | 21 kCodecTheora, |
| 22 kCodecVP8, | 22 kCodecVP8, |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 static const uint32 kProfileDoNotCare = static_cast<uint32>(-1); | 25 static const uint32 kProfileDoNotCare = static_cast<uint32>(-1); |
| 26 static const uint32 kLevelDoNotCare = static_cast<uint32>(-1); | 26 static const uint32 kLevelDoNotCare = static_cast<uint32>(-1); |
| 27 | 27 |
| 28 struct VideoCodecConfig { | 28 struct VideoCodecConfig { |
| 29 VideoCodecConfig() : codec_(kCodecH264), | 29 VideoCodecConfig() : codec(kCodecH264), |
| 30 profile_(kProfileDoNotCare), | 30 profile(kProfileDoNotCare), |
| 31 level_(kLevelDoNotCare), | 31 level(kLevelDoNotCare), |
| 32 width_(0), | 32 width(0), |
| 33 height_(0), | 33 height(0), |
| 34 opaque_context_(NULL) {} | 34 opaque_context(NULL) {} |
| 35 | 35 |
| 36 VideoCodec codec_; | 36 VideoCodec codec; |
| 37 | 37 |
| 38 // TODO(jiesun): video profile and level are specific to individual codec. | 38 // TODO(jiesun): video profile and level are specific to individual codec. |
| 39 // Define enum to. | 39 // Define enum to. |
| 40 uint32 profile_; | 40 uint32 profile; |
| 41 uint32 level_; | 41 uint32 level; |
| 42 | 42 |
| 43 // Container's concept of width and height of this video. | 43 // Container's concept of width and height of this video. |
| 44 int32 width_; | 44 int32 width; |
| 45 int32 height_; // TODO(jiesun): Do we allow height to be negative to | 45 int32 height; // TODO(jiesun): Do we allow height to be negative to |
| 46 // indicate output is upside-down? | 46 // indicate output is upside-down? |
| 47 | 47 |
| 48 // FFMPEG's will use this to pass AVStream. Otherwise, we should remove this. | 48 // FFMPEG's will use this to pass AVStream. Otherwise, we should remove this. |
| 49 void* opaque_context_; | 49 void* opaque_context; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 struct VideoStreamInfo { | 52 struct VideoStreamInfo { |
| 53 VideoFrame::Format surface_format_; | 53 VideoFrame::Format surface_format; |
| 54 VideoFrame::SurfaceType surface_type_; | 54 VideoFrame::SurfaceType surface_type; |
| 55 uint32 surface_width_; // Can be different with container's value. | 55 |
| 56 uint32 surface_height_; // Can be different with container's value. | 56 // Can be different with container's value. |
| 57 uint32 surface_width; |
| 58 |
| 59 // Can be different with container's value. |
| 60 uint32 surface_height; |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 struct VideoCodecInfo { | 63 struct VideoCodecInfo { |
| 60 // Other parameter is only meaningful when this is true. | 64 // Other parameter is only meaningful when this is true. |
| 61 bool success_; | 65 bool success; |
| 62 | 66 |
| 63 // Whether decoder provides output buffer pool. | 67 // Whether decoder provides output buffer pool. |
| 64 bool provides_buffers_; | 68 bool provides_buffers; |
| 65 | 69 |
| 66 // Initial Stream Info. Only part of them could be valid. | 70 // Initial Stream Info. Only part of them could be valid. |
| 67 // If they are not valid, Engine should update with OnFormatChange. | 71 // If they are not valid, Engine should update with OnFormatChange. |
| 68 VideoStreamInfo stream_info_; | 72 VideoStreamInfo stream_info; |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 class VideoDecodeEngine { | 75 class VideoDecodeEngine { |
| 72 public: | 76 public: |
| 73 struct EventHandler { | 77 struct EventHandler { |
| 74 public: | 78 public: |
| 75 virtual ~EventHandler() {} | 79 virtual ~EventHandler() {} |
| 76 virtual void OnInitializeComplete(const VideoCodecInfo& info) = 0; | 80 virtual void OnInitializeComplete(const VideoCodecInfo& info) = 0; |
| 77 virtual void OnUninitializeComplete() = 0; | 81 virtual void OnUninitializeComplete() = 0; |
| 78 virtual void OnFlushComplete() = 0; | 82 virtual void OnFlushComplete() = 0; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // is called by the user to return the video frame object. | 156 // is called by the user to return the video frame object. |
| 153 // | 157 // |
| 154 // In response to this method call, ConsumeVideoFrame() is called with a | 158 // In response to this method call, ConsumeVideoFrame() is called with a |
| 155 // video frame object containing decoded video content. | 159 // video frame object containing decoded video content. |
| 156 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame) = 0; | 160 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame) = 0; |
| 157 }; | 161 }; |
| 158 | 162 |
| 159 } // namespace media | 163 } // namespace media |
| 160 | 164 |
| 161 #endif // MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ | 165 #endif // MEDIA_VIDEO_VIDEO_DECODE_ENGINE_H_ |
| OLD | NEW |