Skip to content
Permalink
Browse files
2011-02-21 Philippe Normand <pnormand@igalia.com>
        Reviewed by Martin Robinson.

        [GStreamer] GRefPtr support for GstElement
        https://bugs.webkit.org/show_bug.cgi?id=54870

        * CMakeListsEfl.txt:
        * GNUmakefile.am:
        * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: Added.
        (WTF::GstElement):
        * platform/graphics/gstreamer/GRefPtrGStreamer.h: Added.
        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
        (webKitWebSrcQuery):

Canonical link: https://commits.webkit.org/69466@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
philn committed Feb 24, 2011
1 parent 7b2582a commit 4306e9dd3edbeafe5851a51c351ef15a1e33ca71
Showing 6 changed files with 103 additions and 6 deletions.
@@ -173,6 +173,7 @@ IF (ENABLE_VIDEO)
)
LIST(APPEND WebCore_SOURCES
platform/graphics/gstreamer/GOwnPtrGStreamer.cpp
platform/graphics/gstreamer/GRefPtrGStreamer.cpp
platform/graphics/gstreamer/GStreamerGWorld.cpp
platform/graphics/gstreamer/ImageGStreamerCairo.cpp
platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -1,3 +1,18 @@
2011-02-21 Philippe Normand <pnormand@igalia.com>

Reviewed by Martin Robinson.

[GStreamer] GRefPtr support for GstElement
https://bugs.webkit.org/show_bug.cgi?id=54870

* CMakeListsEfl.txt:
* GNUmakefile.am:
* platform/graphics/gstreamer/GRefPtrGStreamer.cpp: Added.
(WTF::GstElement):
* platform/graphics/gstreamer/GRefPtrGStreamer.h: Added.
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcQuery):

2011-02-24 Emil A Eklund <eae@chromium.org>

Reviewed by Eric Seidel.
@@ -3707,6 +3707,8 @@ webcoregtk_sources += \
Source/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp \
Source/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.cpp \
Source/WebCore/platform/graphics/gstreamer/GOwnPtrGStreamer.h \
Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp \
Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h \
Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp \
Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h \
Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp \
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2011 Igalia S.L
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/


#include "config.h"
#include "GRefPtrGStreamer.h"

#if USE(GSTREAMER)
#include <gst/gstelement.h>

namespace WTF {

template <> GstElement* refGPtr<GstElement>(GstElement* ptr)
{
if (ptr)
gst_object_ref(ptr);
return ptr;
}

template <> void derefGPtr<GstElement>(GstElement* ptr)
{
if (ptr)
gst_object_unref(ptr);
}

}
#endif // USE(GSTREAMER)
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2011 Igalia S.L
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

#ifndef GRefPtrGStreamer_h
#define GRefPtrGStreamer_h
#if USE(GSTREAMER)

#include "GRefPtr.h"

typedef struct _GstElement GstElement;

namespace WTF {

template<> GstElement* refGPtr<GstElement>(GstElement* ptr);
template<> void derefGPtr<GstElement>(GstElement* ptr);

}

#endif // USE(GSTREAMER)
#endif
@@ -23,6 +23,7 @@
#include "Document.h"
#include "GOwnPtr.h"
#include "GRefPtr.h"
#include "GRefPtrGStreamer.h"
#include "NetworkingContext.h"
#include "Noncopyable.h"
#include "NotImplemented.h"
@@ -500,7 +501,8 @@ static GstStateChangeReturn webKitWebSrcChangeState(GstElement* element, GstStat

static gboolean webKitWebSrcQuery(GstPad* pad, GstQuery* query)
{
WebKitWebSrc* src = WEBKIT_WEB_SRC(gst_pad_get_parent(pad));
GRefPtr<GstElement> src = adoptGRef(gst_pad_get_parent_element(pad));
WebKitWebSrc* webkitSrc = WEBKIT_WEB_SRC(src.get());
gboolean result = FALSE;

switch (GST_QUERY_TYPE(query)) {
@@ -510,16 +512,16 @@ static gboolean webKitWebSrcQuery(GstPad* pad, GstQuery* query)

gst_query_parse_duration(query, &format, NULL);

GST_DEBUG_OBJECT(src, "duration query in format %s", gst_format_get_name(format));
if ((format == GST_FORMAT_BYTES) && (src->priv->size > 0)) {
gst_query_set_duration(query, format, src->priv->size);
GST_DEBUG_OBJECT(webkitSrc, "duration query in format %s", gst_format_get_name(format));
if ((format == GST_FORMAT_BYTES) && (webkitSrc->priv->size > 0)) {
gst_query_set_duration(query, format, webkitSrc->priv->size);
result = TRUE;
}
break;
}
case GST_QUERY_URI:
{
gst_query_set_uri(query, src->priv->uri);
gst_query_set_uri(query, webkitSrc->priv->uri);
result = TRUE;
break;
}
@@ -530,7 +532,6 @@ static gboolean webKitWebSrcQuery(GstPad* pad, GstQuery* query)
if (!result)
result = gst_pad_query_default(pad, query);

gst_object_unref(src);
return result;
}

0 comments on commit 4306e9d

Please sign in to comment.