fixup! [M120 Migration][HBBTV] Merge track and subtitle related patches 91/308291/1
authorzhishun.zhou <zhishun.zhou@samsung.com>
Thu, 21 Mar 2024 03:48:44 +0000 (11:48 +0800)
committerzhishun.zhou <zhishun.zhou@samsung.com>
Thu, 21 Mar 2024 03:50:04 +0000 (11:50 +0800)
Add missing files of inband_cue.h, inband_cue.cpp and inband_cue.idl

Change-Id: I0f767db3a50528ca9bff5605d310640fd9ef79b4
Signed-off-by: zhishun.zhou <zhishun.zhou@samsung.com>
third_party/blink/renderer/core/html/track/inband_cue.cpp [new file with mode: 0755]
third_party/blink/renderer/core/html/track/inband_cue.h [new file with mode: 0755]
third_party/blink/renderer/core/html/track/inband_cue.idl [new file with mode: 0755]

diff --git a/third_party/blink/renderer/core/html/track/inband_cue.cpp b/third_party/blink/renderer/core/html/track/inband_cue.cpp
new file mode 100755 (executable)
index 0000000..41073f4
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright 2023 Samsung Electronics Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/blink/renderer/core/html/track/inband_cue.h"
+
+namespace blink {
+
+InbandCue::InbandCue(double start, double end, DOMArrayBuffer* data)
+    : TextTrackCue(start, end), data_(data) {}
+
+InbandCue::~InbandCue() {}
+
+#ifndef NDEBUG
+String InbandCue::ToString() const {
+  return String::Format("%p id=%s interval=%f-->%f cue=%s)", this,
+                        id().utf8().data(), startTime(), endTime(),
+                        data().utf8().data());
+}
+#endif
+
+void InbandCue::setData(DOMArrayBuffer* data) {
+  if (data_ == data)
+    return;
+
+  CueWillChange();
+  data_ = data;
+  CueDidChange();
+}
+void InbandCue::Trace(blink::Visitor* visitor) const {
+  visitor->Trace(data_);
+  TextTrackCue::Trace(visitor);
+}
+
+}  // namespace blink
diff --git a/third_party/blink/renderer/core/html/track/inband_cue.h b/third_party/blink/renderer/core/html/track/inband_cue.h
new file mode 100755 (executable)
index 0000000..c3ca43c
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright 2023 Samsung Electronics Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_TRACK_INBAND_CUE_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_TRACK_INBAND_CUE_H_
+
+#include "third_party/blink/renderer/core/html/track/text_track_cue.h"
+#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h"
+
+namespace blink {
+
+class InbandCue final : public TextTrackCue {
+  DEFINE_WRAPPERTYPEINFO();
+
+ public:
+  InbandCue(double start, double end, DOMArrayBuffer* array_buffer);
+  ~InbandCue() override;
+
+  static InbandCue* Create(double start, double end, const std::string& data) {
+    DOMArrayBuffer* arrayBuffer =
+        DOMArrayBuffer::Create(data.c_str(), data.length());
+    return MakeGarbageCollected<InbandCue>(start, end, arrayBuffer);
+  }
+
+  DOMArrayBuffer* data() const { return data_.Get(); }
+  void setData(DOMArrayBuffer* data);
+
+  void UpdateDisplay(HTMLDivElement& container) override{};
+
+  void UpdatePastAndFutureNodes(double movieTime) override{};
+
+  void RemoveDisplayTree(RemovalNotification) override{};
+
+  ExecutionContext* GetExecutionContext() const override { return nullptr; }
+  void Trace(blink::Visitor*) const override;
+
+  absl::optional<double> GetNextIntraCueTime(double movie_time) const override {
+    return absl::nullopt;
+  };
+
+  void OnEnter(HTMLMediaElement& video) override{};
+  void OnExit(HTMLMediaElement& video) override{};
+
+#ifndef NDEBUG
+  String ToString() const override;
+#endif
+
+ private:
+  Member<DOMArrayBuffer> data_;
+};
+
+}  // namespace blink
+
+#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_TRACK_INBAND_CUE_H_
diff --git a/third_party/blink/renderer/core/html/track/inband_cue.idl b/third_party/blink/renderer/core/html/track/inband_cue.idl
new file mode 100755 (executable)
index 0000000..bef5ebc
--- /dev/null
@@ -0,0 +1,7 @@
+// Copyright 2023 Samsung Electronics Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+[Exposed=Window]
+interface InbandCue : TextTrackCue {
+    attribute ArrayBuffer data;
+};