Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: content/common/gpu/media/vt_video_decode_accelerator.h

Issue 374153003: Use PPS/SPS NALUs to initialize a VTDecompressionSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <stdint.h> 8 #include "base/basictypes.h"
9
10 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
13 #include "base/message_loop/message_loop_proxy.h" 12 #include "content/common/gpu/media/vt.h"
13 #include "media/filters/h264_parser.h"
14 #include "media/video/video_decode_accelerator.h" 14 #include "media/video/video_decode_accelerator.h"
15 #include "ui/gl/gl_context_cgl.h" 15 #include "ui/gl/gl_context_cgl.h"
16 16
17 namespace base {
18 class SingleThreadTaskRunner;
19 } // namespace base
20
17 namespace content { 21 namespace content {
18 22
19 // (Stub of a) VideoToolbox.framework implementation of the 23 // (Stub of a) VideoToolbox.framework implementation of the
20 // VideoDecodeAccelerator interface for Mac OS X. 24 // VideoDecodeAccelerator interface for Mac OS X.
21 class VTVideoDecodeAccelerator 25 class VTVideoDecodeAccelerator
22 : public media::VideoDecodeAccelerator, 26 : public media::VideoDecodeAccelerator,
23 public base::NonThreadSafe { 27 public base::NonThreadSafe {
24 public: 28 public:
25 explicit VTVideoDecodeAccelerator(CGLContextObj cgl_context); 29 explicit VTVideoDecodeAccelerator(CGLContextObj cgl_context);
26 virtual ~VTVideoDecodeAccelerator(); 30 virtual ~VTVideoDecodeAccelerator();
27 31
28 // VideoDecodeAccelerator implementation. 32 // VideoDecodeAccelerator implementation.
29 virtual bool Initialize( 33 virtual bool Initialize(
30 media::VideoCodecProfile profile, 34 media::VideoCodecProfile profile,
31 Client* client) OVERRIDE; 35 Client* client) OVERRIDE;
32 virtual void Decode(const media::BitstreamBuffer& bitstream) OVERRIDE; 36 virtual void Decode(const media::BitstreamBuffer& bitstream) OVERRIDE;
33 virtual void AssignPictureBuffers( 37 virtual void AssignPictureBuffers(
34 const std::vector<media::PictureBuffer>& pictures) OVERRIDE; 38 const std::vector<media::PictureBuffer>& pictures) OVERRIDE;
35 virtual void ReusePictureBuffer(int32_t picture_id) OVERRIDE; 39 virtual void ReusePictureBuffer(int32_t picture_id) OVERRIDE;
36 virtual void Flush() OVERRIDE; 40 virtual void Flush() OVERRIDE;
37 virtual void Reset() OVERRIDE; 41 virtual void Reset() OVERRIDE;
38 virtual void Destroy() OVERRIDE; 42 virtual void Destroy() OVERRIDE;
39 virtual bool CanDecodeOnIOThread() OVERRIDE; 43 virtual bool CanDecodeOnIOThread() OVERRIDE;
40 44
45 // Called by VideoToolbox when a frame is decoded.
46 void Output(
47 int32_t bitstream_id,
48 OSStatus status,
49 VTDecodeInfoFlags info_flags,
50 CVImageBufferRef image_buffer);
51
41 private: 52 private:
42 scoped_refptr<base::MessageLoopProxy> loop_proxy_; 53 // Configure a VideoToolbox decompression session from parameter set NALUs.
54 void ConfigureDecoder(
55 const std::vector<const uint8_t*>& nalu_data_ptrs,
56 const std::vector<size_t>& nalu_data_sizes);
57
58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
43 CGLContextObj cgl_context_; 59 CGLContextObj cgl_context_;
44 media::VideoDecodeAccelerator::Client* client_; 60 media::VideoDecodeAccelerator::Client* client_;
61 media::H264Parser parser_;
62
63 // Decoder configuration.
64 VTDecompressionOutputCallbackRecord callback_;
65 CMFormatDescriptionRef format_;
66 VTDecompressionSessionRef session_;
67 int32_t coded_width_;
68 int32_t coded_height_;
45 69
46 // Member variables should appear before the WeakPtrFactory, to ensure 70 // Member variables should appear before the WeakPtrFactory, to ensure
47 // that any WeakPtrs to Controller are invalidated before its members 71 // that any WeakPtrs to Controller are invalidated before its members
48 // variable's destructors are executed, rendering them invalid. 72 // variable's destructors are executed, rendering them invalid.
49 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; 73 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_factory_;
50 74
51 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); 75 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator);
52 }; 76 };
53 77
54 } // namespace content 78 } // namespace content
55 79
56 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ 80 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698