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#ifndef TrackPrivateBaseGStreamer_h 27#define TrackPrivateBaseGStreamer_h 28 29#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK) 30 31#include "GRefPtrGStreamer.h" 32#include <wtf/ThreadingPrimitives.h> 33#include <wtf/gobject/GMainLoopSource.h> 34#include <wtf/text/WTFString.h> 35 36namespace WebCore { 37 38class TrackPrivateBase; 39 40class TrackPrivateBaseGStreamer { 41public: 42 virtual ~TrackPrivateBaseGStreamer(); 43 44 GstPad* pad() const { return m_pad.get(); } 45 46 virtual void disconnect(); 47 48 virtual void setActive(bool) { } 49 50 void setIndex(int index) { m_index = index; } 51 52 void activeChanged(); 53 void tagsChanged(); 54 55 void notifyTrackOfActiveChanged(); 56 void notifyTrackOfTagsChanged(); 57 58protected: 59 TrackPrivateBaseGStreamer(TrackPrivateBase* owner, gint index, GRefPtr<GstPad>); 60 61 gint m_index; 62 AtomicString m_label; 63 AtomicString m_language; 64 GRefPtr<GstPad> m_pad; 65 66private: 67 bool getLanguageCode(GstTagList* tags, AtomicString& value); 68 69 template<class StringType> 70 bool getTag(GstTagList* tags, const gchar* tagName, StringType& value); 71 72 TrackPrivateBase* m_owner; 73 GMainLoopSource m_activeTimerHandler; 74 GMainLoopSource m_tagTimerHandler; 75 76 Mutex m_tagMutex; 77 GRefPtr<GstTagList> m_tags; 78}; 79 80} // namespace WebCore 81 82#endif // ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK) 83 84#endif // TrackPrivateBaseGStreamer_h 85