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

Side by Side Diff: media/mojo/common/media_type_converters.cc

Issue 2416183002: media: Use native DemuxerStream enum types in media mojo interfaces (Closed)
Patch Set: comments addressed Created 4 years, 2 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 #include "media/mojo/common/media_type_converters.h" 5 #include "media/mojo/common/media_type_converters.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/numerics/safe_conversions.h" 11 #include "base/numerics/safe_conversions.h"
12 #include "media/base/audio_buffer.h" 12 #include "media/base/audio_buffer.h"
13 #include "media/base/audio_decoder_config.h" 13 #include "media/base/audio_decoder_config.h"
14 #include "media/base/cdm_config.h" 14 #include "media/base/cdm_config.h"
15 #include "media/base/cdm_key_information.h" 15 #include "media/base/cdm_key_information.h"
16 #include "media/base/decoder_buffer.h" 16 #include "media/base/decoder_buffer.h"
17 #include "media/base/decrypt_config.h" 17 #include "media/base/decrypt_config.h"
18 #include "media/base/demuxer_stream.h"
19 #include "media/base/encryption_scheme.h" 18 #include "media/base/encryption_scheme.h"
20 #include "media/base/media_keys.h" 19 #include "media/base/media_keys.h"
21 #include "media/base/subsample_entry.h" 20 #include "media/base/subsample_entry.h"
22 #include "media/base/video_decoder_config.h" 21 #include "media/base/video_decoder_config.h"
23 #include "media/base/video_frame.h" 22 #include "media/base/video_frame.h"
24 #include "media/mojo/common/mojo_shared_buffer_video_frame.h" 23 #include "media/mojo/common/mojo_shared_buffer_video_frame.h"
25 #include "media/mojo/interfaces/demuxer_stream.mojom.h"
26 #include "mojo/public/cpp/system/buffer.h" 24 #include "mojo/public/cpp/system/buffer.h"
27 25
28 namespace mojo { 26 namespace mojo {
29 27
30 #define ASSERT_ENUM_EQ(media_enum, media_prefix, mojo_prefix, value) \ 28 #define ASSERT_ENUM_EQ(media_enum, media_prefix, mojo_prefix, value) \
31 static_assert(media::media_prefix##value == \ 29 static_assert(media::media_prefix##value == \
32 static_cast<media::media_enum>( \ 30 static_cast<media::media_enum>( \
33 media::mojom::media_enum::mojo_prefix##value), \ 31 media::mojom::media_enum::mojo_prefix##value), \
34 "Mismatched enum: " #media_prefix #value " != " #media_enum \ 32 "Mismatched enum: " #media_prefix #value " != " #media_enum \
35 "::" #mojo_prefix #value) 33 "::" #mojo_prefix #value)
36 34
37 #define ASSERT_ENUM_EQ_RAW(media_enum, media_enum_value, mojo_enum_value) \ 35 #define ASSERT_ENUM_EQ_RAW(media_enum, media_enum_value, mojo_enum_value) \
38 static_assert(media::media_enum_value == static_cast<media::media_enum>( \ 36 static_assert(media::media_enum_value == static_cast<media::media_enum>( \
39 media::mojom::mojo_enum_value), \ 37 media::mojom::mojo_enum_value), \
40 "Mismatched enum: " #media_enum_value " != " #mojo_enum_value) 38 "Mismatched enum: " #media_enum_value " != " #mojo_enum_value)
41 39
42 // DemuxerStream Type. Note: Mojo DemuxerStream's don't have the TEXT type.
43 ASSERT_ENUM_EQ_RAW(DemuxerStream::Type,
44 DemuxerStream::UNKNOWN,
45 DemuxerStream::Type::UNKNOWN);
46 ASSERT_ENUM_EQ_RAW(DemuxerStream::Type,
47 DemuxerStream::AUDIO,
48 DemuxerStream::Type::AUDIO);
49 ASSERT_ENUM_EQ_RAW(DemuxerStream::Type,
50 DemuxerStream::VIDEO,
51 DemuxerStream::Type::VIDEO);
52 static_assert(
53 media::DemuxerStream::NUM_TYPES ==
54 static_cast<media::DemuxerStream::Type>(
55 static_cast<int>(media::mojom::DemuxerStream::Type::LAST_TYPE) + 2),
56 "Mismatched enum: media::DemuxerStream::NUM_TYPES != "
57 "media::mojom::DemuxerStream::Type::LAST_TYPE + 2");
58
59 // DemuxerStream Status.
60 ASSERT_ENUM_EQ_RAW(DemuxerStream::Status,
61 DemuxerStream::kOk,
62 DemuxerStream::Status::OK);
63 ASSERT_ENUM_EQ_RAW(DemuxerStream::Status,
64 DemuxerStream::kAborted,
65 DemuxerStream::Status::ABORTED);
66 ASSERT_ENUM_EQ_RAW(DemuxerStream::Status,
67 DemuxerStream::kConfigChanged,
68 DemuxerStream::Status::CONFIG_CHANGED);
69
70 // CipherMode 40 // CipherMode
71 ASSERT_ENUM_EQ_RAW(EncryptionScheme::CipherMode, 41 ASSERT_ENUM_EQ_RAW(EncryptionScheme::CipherMode,
72 EncryptionScheme::CipherMode::CIPHER_MODE_UNENCRYPTED, 42 EncryptionScheme::CipherMode::CIPHER_MODE_UNENCRYPTED,
73 CipherMode::UNENCRYPTED); 43 CipherMode::UNENCRYPTED);
74 ASSERT_ENUM_EQ_RAW(EncryptionScheme::CipherMode, 44 ASSERT_ENUM_EQ_RAW(EncryptionScheme::CipherMode,
75 EncryptionScheme::CipherMode::CIPHER_MODE_AES_CTR, 45 EncryptionScheme::CipherMode::CIPHER_MODE_AES_CTR,
76 CipherMode::AES_CTR); 46 CipherMode::AES_CTR);
77 ASSERT_ENUM_EQ_RAW(EncryptionScheme::CipherMode, 47 ASSERT_ENUM_EQ_RAW(EncryptionScheme::CipherMode,
78 EncryptionScheme::CipherMode::CIPHER_MODE_AES_CBC, 48 EncryptionScheme::CipherMode::CIPHER_MODE_AES_CBC,
79 CipherMode::AES_CBC); 49 CipherMode::AES_CBC);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 input->format, input->coded_size, input->visible_rect, 458 input->format, input->coded_size, input->visible_rect,
489 input->natural_size, std::move(input->frame_data), 459 input->natural_size, std::move(input->frame_data),
490 base::saturated_cast<size_t>(input->frame_data_size), 460 base::saturated_cast<size_t>(input->frame_data_size),
491 base::saturated_cast<size_t>(input->y_offset), 461 base::saturated_cast<size_t>(input->y_offset),
492 base::saturated_cast<size_t>(input->u_offset), 462 base::saturated_cast<size_t>(input->u_offset),
493 base::saturated_cast<size_t>(input->v_offset), input->y_stride, 463 base::saturated_cast<size_t>(input->v_offset), input->y_stride,
494 input->u_stride, input->v_stride, input->timestamp); 464 input->u_stride, input->v_stride, input->timestamp);
495 } 465 }
496 466
497 } // namespace mojo 467 } // namespace mojo
OLDNEW
« no previous file with comments | « media/mojo/clients/mojo_demuxer_stream_impl.cc ('k') | media/mojo/interfaces/demuxer_stream.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698