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

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

Issue 839523002: V4L2VDA: Generalize EGLImage import and query driver for output formats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 // This file contains an implementation of VideoDecodeAccelerator 5 // This file contains an implementation of VideoDecodeAccelerator
6 // that utilizes hardware video decoders, which expose Video4Linux 2 API 6 // that utilizes hardware video decoders, which expose Video4Linux 2 API
7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). 7 // (http://linuxtv.org/downloads/v4l-dvb-apis/).
8 8
9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_
10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // 268 //
269 // Other utility functions. Called on decoder_thread_, unless 269 // Other utility functions. Called on decoder_thread_, unless
270 // decoder_thread_ is not yet started, in which case the child thread can call 270 // decoder_thread_ is not yet started, in which case the child thread can call
271 // these (e.g. in Initialize() or Destroy()). 271 // these (e.g. in Initialize() or Destroy()).
272 // 272 //
273 273
274 // Create the buffers we need. 274 // Create the buffers we need.
275 bool CreateInputBuffers(); 275 bool CreateInputBuffers();
276 bool CreateOutputBuffers(); 276 bool CreateOutputBuffers();
277 277
278 // Query the hardware for a suitable format that we can use for
279 // importing into EGLImages for output, and set it.
280 bool SetupOutputFormat();
281
278 // 282 //
279 // Methods run on child thread. 283 // Methods run on child thread.
280 // 284 //
281 285
282 // Destroy buffers. 286 // Destroy buffers.
283 void DestroyInputBuffers(); 287 void DestroyInputBuffers();
284 // In contrast to DestroyInputBuffers, which is called only from destructor, 288 // In contrast to DestroyInputBuffers, which is called only from destructor,
285 // we call DestroyOutputBuffers also during playback, on resolution change. 289 // we call DestroyOutputBuffers also during playback, on resolution change.
286 // Even if anything fails along the way, we still want to go on and clean 290 // Even if anything fails along the way, we still want to go on and clean
287 // up as much as possible, so return false if this happens, so that the 291 // up as much as possible, so return false if this happens, so that the
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 bool output_streamon_; 395 bool output_streamon_;
392 // Output buffers enqueued to device. 396 // Output buffers enqueued to device.
393 int output_buffer_queued_count_; 397 int output_buffer_queued_count_;
394 // Output buffers ready to use, as a FIFO since we want oldest-first to hide 398 // Output buffers ready to use, as a FIFO since we want oldest-first to hide
395 // synchronization latency with GL. 399 // synchronization latency with GL.
396 std::queue<int> free_output_buffers_; 400 std::queue<int> free_output_buffers_;
397 // Mapping of int index to output buffer record. 401 // Mapping of int index to output buffer record.
398 std::vector<OutputRecord> output_buffer_map_; 402 std::vector<OutputRecord> output_buffer_map_;
399 // Required size of DPB for decoding. 403 // Required size of DPB for decoding.
400 int output_dpb_size_; 404 int output_dpb_size_;
401 // Stores the number of planes (i.e. separate memory buffers) for output. 405
406 // Number of planes (i.e. separate memory buffers) for output.
402 size_t output_planes_count_; 407 size_t output_planes_count_;
403 408
404 // Pictures that are ready but not sent to PictureReady yet. 409 // Pictures that are ready but not sent to PictureReady yet.
405 std::queue<PictureRecord> pending_picture_ready_; 410 std::queue<PictureRecord> pending_picture_ready_;
406 411
407 // The number of pictures that are sent to PictureReady and will be cleared. 412 // The number of pictures that are sent to PictureReady and will be cleared.
408 int picture_clearing_count_; 413 int picture_clearing_count_;
409 414
410 // Used by the decoder thread to wait for AssignPictureBuffers to arrive 415 // Used by the decoder thread to wait for AssignPictureBuffers to arrive
411 // to avoid races with potential Reset requests. 416 // to avoid races with potential Reset requests.
(...skipping 15 matching lines...) Expand all
427 432
428 // Make our context current before running any EGL entry points. 433 // Make our context current before running any EGL entry points.
429 base::Callback<bool(void)> make_context_current_; 434 base::Callback<bool(void)> make_context_current_;
430 435
431 // EGL state 436 // EGL state
432 EGLDisplay egl_display_; 437 EGLDisplay egl_display_;
433 EGLContext egl_context_; 438 EGLContext egl_context_;
434 439
435 // The codec we'll be decoding for. 440 // The codec we'll be decoding for.
436 media::VideoCodecProfile video_profile_; 441 media::VideoCodecProfile video_profile_;
442 // Chosen output format.
443 uint32_t output_format_fourcc_;
437 444
438 // The WeakPtrFactory for |weak_this_|. 445 // The WeakPtrFactory for |weak_this_|.
439 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; 446 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_;
440 447
441 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); 448 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator);
442 }; 449 };
443 450
444 } // namespace content 451 } // namespace content
445 452
446 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ 453 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « content/common/gpu/media/tegra_v4l2_video_device.cc ('k') | content/common/gpu/media/v4l2_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698