Shaka Player Embedded
media_encrypted_event.cc
Go to the documentation of this file.
1 // Copyright 2018 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
16 
17 namespace shaka {
18 namespace js {
19 namespace events {
20 
21 DEFINE_STRUCT_SPECIAL_METHODS_MOVE_ONLY(MediaEncryptedEventInit);
22 
24  EventType event_type, eme::MediaKeyInitDataType init_data_type,
25  ByteBuffer init_data)
26  : MediaEncryptedEvent(to_string(event_type), init_data_type,
27  std::move(init_data)) {}
28 
29 // \cond Doxygen_Skip
30 MediaEncryptedEvent::~MediaEncryptedEvent() {}
31 // \endcond Doxygen_Skip
32 
33 
35  Event::Trace(tracer);
36  tracer->Trace(&init_data);
37 }
38 
40  const std::string& event_type, eme::MediaKeyInitDataType init_data_type,
42  : Event(event_type),
43  init_data_type(init_data_type),
44  init_data(std::move(init_data)) {}
45 
47  AddReadOnlyProperty("initDataType", &MediaEncryptedEvent::init_data_type);
48  AddReadOnlyProperty("initData", &MediaEncryptedEvent::init_data);
49 }
50 
51 } // namespace events
52 } // namespace js
53 } // namespace shaka
void Trace(memory::HeapTracer *tracer) const override
Definition: event.cc:37
std::string to_string(VideoReadyState state)
Definition: media_player.cc:32
void Trace(const Traceable *ptr)
Definition: heap_tracer.cc:43
Event(const std::string &type)
Definition: event.cc:28
DEFINE_STRUCT_SPECIAL_METHODS_MOVE_ONLY(MediaEncryptedEventInit)
void Trace(memory::HeapTracer *tracer) const override
MediaEncryptedEvent(EventType event_type, eme::MediaKeyInitDataType init_data_type, ByteBuffer init_data)
const eme::MediaKeyInitDataType init_data_type