Index: media/video/jpeg_decode_accelerator.h |
diff --git a/media/video/jpeg_decode_accelerator.h b/media/video/jpeg_decode_accelerator.h |
index 83c59403134c3b32da3eab711d30415abd70449f..fd7608fc9fbcfe15930adf30055987d54da8ac71 100644 |
--- a/media/video/jpeg_decode_accelerator.h |
+++ b/media/video/jpeg_decode_accelerator.h |
@@ -17,7 +17,7 @@ namespace media { |
// The output color format is I420. The decoder will convert the color format |
// to I420 if the color space or subsampling does not match that and if it is |
// capable of doing so. The client is responsible for allocating buffers and |
-// keeps the ownership of them. All methods must be called on the same thread. |
+// keeps the ownership of them. |
// The intended use case of this interface is decoding MJPEG images coming |
// from camera capture. It can also be used for normal still JPEG image |
// decoding, but normal JPEG images may use more JPEG features that may not be |
@@ -28,6 +28,8 @@ class MEDIA_EXPORT JpegDecodeAccelerator { |
// Enumeration of decode errors generated by NotifyError callback. |
enum Error { |
+ // No error. Decode succeeded. |
+ NO_ERRORS, |
// Invalid argument was passed to an API method, e.g. the output buffer is |
// too small, JPEG width/height are too big for JDA. |
INVALID_ARGUMENT, |
@@ -71,6 +73,12 @@ class MEDIA_EXPORT JpegDecodeAccelerator { |
virtual ~Client() {} |
}; |
+ // Destroys the decoder: all pending inputs are dropped immediately. This |
+ // call may asynchronously free system resources, but its client-visible |
+ // effects are synchronous. After destructor returns, no more callbacks |
+ // will be made on the client. |
+ virtual ~JpegDecodeAccelerator() = 0; |
+ |
// JPEG decoder functions. |
// Initializes the JPEG decoder. Should be called once per decoder |
@@ -78,7 +86,7 @@ class MEDIA_EXPORT JpegDecodeAccelerator { |
// is successful. |
// Parameters: |
// |client| is the Client interface for decode callback. The provided |
- // pointer must be valid until Destroy() is called. |
+ // pointer must be valid until destructor is called. |
virtual bool Initialize(Client* client) = 0; |
// Decodes the given bitstream buffer that contains one JPEG picture. It |
@@ -97,38 +105,11 @@ class MEDIA_EXPORT JpegDecodeAccelerator { |
// Ownership of the |bitstream_buffer| and |video_frame| remains with the |
// client. The client is not allowed to deallocate them before |
// VideoFrameReady or NotifyError() is invoked for given id of |
- // |bitstream_buffer|, or Destroy() returns. |
+ // |bitstream_buffer|, or destructor returns. |
virtual void Decode(const BitstreamBuffer& bitstream_buffer, |
const scoped_refptr<media::VideoFrame>& video_frame) = 0; |
- |
- // Destroys the decoder: all pending inputs are dropped immediately. This |
- // call may asynchronously free system resources, but its client-visible |
- // effects are synchronous. After this method returns, no more callbacks |
- // will be made on the client. Deletes |this| unconditionally, so make sure |
- // to drop all pointers to it! |
- virtual void Destroy() = 0; |
- |
- protected: |
- // Do not delete directly; use Destroy() or own it with a scoped_ptr, which |
- // will Destroy() it properly by default. |
- virtual ~JpegDecodeAccelerator(); |
}; |
} // namespace media |
-namespace base { |
- |
-template <class T> |
-struct DefaultDeleter; |
- |
-// Specialize DefaultDeleter so that scoped_ptr<JpegDecodeAccelerator> always |
-// uses "Destroy()" instead of trying to use the destructor. |
-template <> |
-struct MEDIA_EXPORT DefaultDeleter<media::JpegDecodeAccelerator> { |
- public: |
- void operator()(void* jpeg_decode_accelerator) const; |
-}; |
- |
-} // namespace base |
- |
#endif // MEDIA_VIDEO_JPEG_DECODE_ACCELERATOR_H_ |