Chromium Code Reviews| Index: content/common/gpu/media/vaapi_jpeg_decoder.h |
| diff --git a/content/common/gpu/media/vaapi_jpeg_decoder.h b/content/common/gpu/media/vaapi_jpeg_decoder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..27ec5698abf2cbf1eeed55e94675c8657f067c32 |
| --- /dev/null |
| +++ b/content/common/gpu/media/vaapi_jpeg_decoder.h |
| @@ -0,0 +1,79 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
|
wuchengli
2015/01/12 09:08:52
2015 :)
kcwu
2015/01/16 15:12:55
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +// |
| +// This file contains an implementation of a class that provides JPEG decode |
|
wuchengli
2015/01/12 09:08:52
This should be removed or merged with VaapiJpegDec
kcwu
2015/01/16 15:12:55
Done
This is modified from vaapi_h264_decoder.h ;)
|
| +// support for use with VAAPI hardware video decode acceleration on Intel |
| +// systems. |
| + |
| +#ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_JPEG_DECODER_H_ |
| +#define CONTENT_COMMON_GPU_MEDIA_VAAPI_JPEG_DECODER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/callback_forward.h" |
| +#include "base/memory/linked_ptr.h" |
|
Owen Lin
2015/01/13 06:17:58
not used ?
kcwu
2015/01/16 15:12:55
Done.
|
| +#include "base/memory/ref_counted.h" |
|
Owen Lin
2015/01/13 06:17:58
not used?
kcwu
2015/01/16 15:12:55
Done.
|
| +#include "base/memory/scoped_ptr.h" |
| +#include "content/common/gpu/media/vaapi_wrapper.h" |
| +#include "media/base/limits.h" |
|
wuchengli
2015/01/12 09:08:52
Move to .cc?
kcwu
2015/01/16 15:12:54
Done.
|
| +#include "media/filters/jpeg_parser.h" |
|
wuchengli
2015/01/12 09:08:52
move to .cc? Please check every #include here.
kcwu
2015/01/16 15:12:55
Done.
|
| + |
| +namespace content { |
| + |
| +// TODO(kcwu) comment |
|
wuchengli
2015/01/12 09:08:52
Remove TODO and add the documentation.
kcwu
2015/01/16 15:12:55
Done.
|
| +// An JPEG decoder that utilizes VA-API. Provides features not supported by |
| +// the VA-API userspace library (libva), like stream parsing. |
| +// |
| +// Provides functionality to allow plugging VAAPI HW acceleration into the |
| +// JDA framework. |
| +// |
| +// Clients of this class are expected to pass H264 Annex-B byte stream and |
|
wuchengli
2015/01/12 09:08:52
update the comments
kcwu
2015/01/16 15:12:55
Done.
|
| +// will receive decoded surfaces via client-provided |OutputPicCB|. |
| +// |
| +// This class must be created, called and destroyed on a single thread, and |
| +// does nothing internally on any other thread. |
| +class CONTENT_EXPORT VaapiJpegDecoder { |
| + public: |
| + enum DecodeStatus { |
| + SUCCESS = 0, |
| + PARSE_ERROR, |
| + VAAPI_ERROR, |
|
wuchengli
2015/01/12 09:08:52
Document these errors.
kcwu
2015/01/16 15:12:54
Done.
|
| + }; |
| + |
| + // Callback to report errors for UMA purposes, not used to return errors |
| + // to clients. |
| + typedef base::Callback<void(DecodeStatus error)> ReportErrorToUmaCB; |
|
wuchengli
2015/01/12 09:08:52
Remove all UMA code because this needs the corresp
kcwu
2015/01/16 15:12:55
Done.
|
| + |
| + // |vaapi_wrapper| should be initialized. |
| + // |output_pic_cb| notifies the client a surface is to be displayed. |
|
wuchengli
2015/01/12 09:08:52
remove
kcwu
2015/01/16 15:12:54
Done.
|
| + // |report_error_to_uma_cb| called on errors for UMA purposes, not used |
| + // to report errors to clients. |
| + VaapiJpegDecoder(VaapiWrapper* vaapi_wrapper, |
| + const ReportErrorToUmaCB& report_error_to_uma_cb); |
| + |
| + ~VaapiJpegDecoder(); |
| + |
| + DecodeStatus Decode(const uint8* buffer, |
|
wuchengli
2015/01/12 09:08:52
Add documentation for this and DecodeDone.
kcwu
2015/01/16 15:12:55
Done.
|
| + size_t buffer_size, |
| + gfx::Size* output_size, |
| + VASurfaceID* surface); |
| + |
| + void DecodeDone(); |
| + |
| + private: |
| + // Unused VA surface, ready to be reused. |
| + scoped_refptr<VASurface> available_va_surface_; |
|
Owen Lin
2015/01/13 06:17:58
Not used?
kcwu
2015/01/16 15:12:55
Done.
|
| + |
| + VaapiWrapper* vaapi_wrapper_; |
| + |
| + // Called to report decoding error to UMA, not used to indicate errors |
| + // to clients. |
| + ReportErrorToUmaCB report_error_to_uma_cb_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VaapiJpegDecoder); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_JPEG_DECODER_H_ |