| 1 | /* |
| 2 | * Copyright (C) 2013 Cable Television Laboratories, Inc. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY |
| 15 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 | * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 18 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #pragma once |
| 27 | |
| 28 | #if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK) |
| 29 | |
| 30 | #include "InbandTextTrackPrivate.h" |
| 31 | |
| 32 | namespace WebCore { |
| 33 | |
| 34 | class InbandMetadataTextTrackPrivateGStreamer : public InbandTextTrackPrivate { |
| 35 | public: |
| 36 | static Ref<InbandMetadataTextTrackPrivateGStreamer> create(Kind kind, CueFormat cueFormat, const AtomicString& id = emptyAtom()) |
| 37 | { |
| 38 | return adoptRef(*new InbandMetadataTextTrackPrivateGStreamer(kind, cueFormat, id)); |
| 39 | } |
| 40 | |
| 41 | ~InbandMetadataTextTrackPrivateGStreamer() = default; |
| 42 | |
| 43 | Kind kind() const override { return m_kind; } |
| 44 | AtomicString id() const override { return m_id; } |
| 45 | AtomicString inBandMetadataTrackDispatchType() const override { return m_inBandMetadataTrackDispatchType; } |
| 46 | void setInBandMetadataTrackDispatchType(const AtomicString& value) { m_inBandMetadataTrackDispatchType = value; } |
| 47 | |
| 48 | void addDataCue(const MediaTime& start, const MediaTime& end, const void* data, unsigned length) |
| 49 | { |
| 50 | ASSERT(cueFormat() == Data); |
| 51 | client()->addDataCue(start, end, data, length); |
| 52 | } |
| 53 | |
| 54 | void addGenericCue(GenericCueData& data) |
| 55 | { |
| 56 | ASSERT(cueFormat() == Generic); |
| 57 | client()->addGenericCue(data); |
| 58 | } |
| 59 | |
| 60 | private: |
| 61 | InbandMetadataTextTrackPrivateGStreamer(Kind kind, CueFormat cueFormat, const AtomicString& id) |
| 62 | : InbandTextTrackPrivate(cueFormat) |
| 63 | , m_kind(kind) |
| 64 | , m_id(id) |
| 65 | { |
| 66 | |
| 67 | } |
| 68 | |
| 69 | Kind m_kind; |
| 70 | AtomicString m_id; |
| 71 | AtomicString m_inBandMetadataTrackDispatchType; |
| 72 | }; |
| 73 | |
| 74 | } // namespace WebCore |
| 75 | |
| 76 | #endif // ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK) |
| 77 | |