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

Side by Side Diff: chromecast/media/cma/ipc_streamer/encryption_scheme_marshaller.cc

Issue 1786733004: Revert of media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chromecast/media/cma/ipc_streamer/encryption_scheme_marshaller.h"
6
7 #include <stdint.h>
8
9 #include "base/logging.h"
10 #include "chromecast/media/cma/ipc/media_message.h"
11
12 namespace chromecast {
13 namespace media {
14
15 namespace {
16
17 class PatternSpecMarshaller {
18 public:
19 static void Write(const ::media::EncryptionScheme::Pattern& pattern,
20 MediaMessage* msg) {
21 CHECK(msg->WritePod(pattern.encrypt_blocks()));
22 CHECK(msg->WritePod(pattern.skip_blocks()));
23 }
24
25 static ::media::EncryptionScheme::Pattern Read(MediaMessage* msg) {
26 uint32_t encrypt_blocks;
27 uint32_t skip_blocks;
28 CHECK(msg->ReadPod(&encrypt_blocks));
29 CHECK(msg->ReadPod(&skip_blocks));
30 return ::media::EncryptionScheme::Pattern(encrypt_blocks, skip_blocks);
31 }
32 };
33
34 } // namespace
35
36 // static
37 void EncryptionSchemeMarshaller::Write(
38 const ::media::EncryptionScheme& encryption_scheme,
39 MediaMessage* msg) {
40 CHECK(msg->WritePod(encryption_scheme.mode()));
41 PatternSpecMarshaller::Write(encryption_scheme.pattern(), msg);
42 }
43
44 // static
45 ::media::EncryptionScheme EncryptionSchemeMarshaller::Read(MediaMessage* msg) {
46 ::media::EncryptionScheme::CipherMode mode;
47 ::media::EncryptionScheme::Pattern pattern;
48 CHECK(msg->ReadPod(&mode));
49 pattern = PatternSpecMarshaller::Read(msg);
50 return ::media::EncryptionScheme(mode, pattern);
51 }
52
53 } // namespace media
54 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698