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 "GStreamerCommon.h"
31#include "TrackPrivateBaseGStreamer.h"
32#include "VideoTrackPrivate.h"
33
34#include <gst/gst.h>
35#include <wtf/WeakPtr.h>
36
37namespace WebCore {
38class MediaPlayerPrivateGStreamer;
39
40class VideoTrackPrivateGStreamer final : public VideoTrackPrivate, public TrackPrivateBaseGStreamer {
41public:
42 static Ref<VideoTrackPrivateGStreamer> create(WeakPtr<MediaPlayerPrivateGStreamer> player, gint index, GRefPtr<GstPad> pad)
43 {
44 return adoptRef(*new VideoTrackPrivateGStreamer(player, index, pad));
45 }
46#if GST_CHECK_VERSION(1, 10, 0)
47 static Ref<VideoTrackPrivateGStreamer> create(WeakPtr<MediaPlayerPrivateGStreamer> player, gint index, GRefPtr<GstStream> stream)
48 {
49 return adoptRef(*new VideoTrackPrivateGStreamer(player, index, stream));
50 }
51 Kind kind() const final;
52#endif
53
54 void disconnect() override;
55
56 void markAsActive();
57 void setSelected(bool) override;
58 void setActive(bool enabled) override { setSelected(enabled); }
59
60 int trackIndex() const override { return m_index; }
61
62 AtomicString id() const override { return m_id; }
63 AtomicString label() const override { return m_label; }
64 AtomicString language() const override { return m_language; }
65
66private:
67 VideoTrackPrivateGStreamer(WeakPtr<MediaPlayerPrivateGStreamer>, gint index, GRefPtr<GstPad>);
68#if GST_CHECK_VERSION(1, 10, 0)
69 VideoTrackPrivateGStreamer(WeakPtr<MediaPlayerPrivateGStreamer>, gint index, GRefPtr<GstStream>);
70#endif
71 AtomicString m_id;
72 WeakPtr<MediaPlayerPrivateGStreamer> m_player;
73};
74
75} // namespace WebCore
76
77#endif // ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)
78