Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BASE_VIDEO_DECODER_CONFIG_H_ | 5 #ifndef MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| 6 #define MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 6 #define MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "libavutil/pixfmt.h" | |
|
scherkus (not reviewing)
2011/09/28 17:32:17
in order to prevent FFmpeg types leaking into the
shadi1
2011/09/29 18:31:03
Done.
| |
| 10 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 11 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 12 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
| 13 | 14 |
| 14 namespace media { | 15 namespace media { |
| 15 | 16 |
| 16 enum VideoCodec { | 17 enum VideoCodec { |
| 17 kUnknownVideoCodec, | 18 kUnknownVideoCodec, |
| 18 kCodecH264, | 19 kCodecH264, |
| 19 kCodecVC1, | 20 kCodecVC1, |
| 20 kCodecMPEG2, | 21 kCodecMPEG2, |
| 21 kCodecMPEG4, | 22 kCodecMPEG4, |
| 22 kCodecTheora, | 23 kCodecTheora, |
| 23 kCodecVP8, | 24 kCodecVP8, |
| 24 | 25 |
| 25 // DO NOT ADD RANDOM VIDEO CODECS! | 26 // DO NOT ADD RANDOM VIDEO CODECS! |
| 26 // | 27 // |
| 27 // The only acceptable time to add a new codec is if there is production code | 28 // The only acceptable time to add a new codec is if there is production code |
| 28 // that uses said codec in the same CL. | 29 // that uses said codec in the same CL. |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 class MEDIA_EXPORT VideoDecoderConfig { | 32 class MEDIA_EXPORT VideoDecoderConfig { |
| 32 public: | 33 public: |
| 33 VideoDecoderConfig(VideoCodec codec, const gfx::Size& coded_size, | 34 VideoDecoderConfig(VideoCodec codec, |
| 35 PixelFormat pix_fmt, | |
| 36 const gfx::Size& coded_size, | |
| 34 const gfx::Rect& visible_rect, | 37 const gfx::Rect& visible_rect, |
| 35 const gfx::Size& natural_size, | 38 const gfx::Size& natural_size, |
| 36 int frame_rate_numerator, int frame_rate_denominator, | 39 int frame_rate_numerator, int frame_rate_denominator, |
| 37 const uint8* extra_data, size_t extra_data_size); | 40 const uint8* extra_data, size_t extra_data_size); |
| 38 ~VideoDecoderConfig(); | 41 ~VideoDecoderConfig(); |
| 39 | 42 |
| 40 VideoCodec codec() const; | 43 VideoCodec codec() const; |
| 44 PixelFormat pix_fmt() const; | |
| 41 gfx::Size coded_size() const; | 45 gfx::Size coded_size() const; |
| 42 gfx::Rect visible_rect() const; | 46 gfx::Rect visible_rect() const; |
| 43 gfx::Size natural_size() const; | 47 gfx::Size natural_size() const; |
| 44 int frame_rate_numerator() const; | 48 int frame_rate_numerator() const; |
| 45 int frame_rate_denominator() const; | 49 int frame_rate_denominator() const; |
| 46 uint8* extra_data() const; | 50 uint8* extra_data() const; |
| 47 size_t extra_data_size() const; | 51 size_t extra_data_size() const; |
| 48 | 52 |
| 49 private: | 53 private: |
| 50 VideoCodec codec_; | 54 VideoCodec codec_; |
| 51 | 55 |
| 56 // Pixel format, used to determine U & V buffer sizes. | |
| 57 PixelFormat pix_fmt_; | |
| 58 | |
| 52 // Width and height of video frame immediately post-decode. Not all pixels | 59 // Width and height of video frame immediately post-decode. Not all pixels |
| 53 // in this region are valid. | 60 // in this region are valid. |
| 54 gfx::Size coded_size_; | 61 gfx::Size coded_size_; |
| 55 | 62 |
| 56 // Region of |coded_size_| that is visible. | 63 // Region of |coded_size_| that is visible. |
| 57 gfx::Rect visible_rect_; | 64 gfx::Rect visible_rect_; |
| 58 | 65 |
| 59 // Natural width and height of the video, i.e. the visible dimensions | 66 // Natural width and height of the video, i.e. the visible dimensions |
| 60 // after aspect ratio is applied. | 67 // after aspect ratio is applied. |
| 61 gfx::Size natural_size_; | 68 gfx::Size natural_size_; |
| 62 | 69 |
| 63 // Frame rate in seconds expressed as a fraction. | 70 // Frame rate in seconds expressed as a fraction. |
| 64 // TODO(scherkus): fairly certain decoders don't require frame rates. | 71 // TODO(scherkus): fairly certain decoders don't require frame rates. |
| 65 int frame_rate_numerator_; | 72 int frame_rate_numerator_; |
| 66 int frame_rate_denominator_; | 73 int frame_rate_denominator_; |
| 67 | 74 |
| 68 // Optional byte data required to initialize video decoders. | 75 // Optional byte data required to initialize video decoders. |
| 69 scoped_array<uint8> extra_data_; | 76 scoped_array<uint8> extra_data_; |
| 70 size_t extra_data_size_; | 77 size_t extra_data_size_; |
| 71 | 78 |
| 72 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoDecoderConfig); | 79 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoDecoderConfig); |
| 73 }; | 80 }; |
| 74 | 81 |
| 75 } // namespace media | 82 } // namespace media |
| 76 | 83 |
| 77 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 84 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| OLD | NEW |