Changeset 109005 in webkit
- Timestamp:
- Feb 27, 2012 10:04:18 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r109003 r109005 1 2012-02-27 Philippe Normand <pnormand@igalia.com> 2 3 [GStreamer] 0.11 support in MediaPlayerPrivateGStreamer 4 https://bugs.webkit.org/show_bug.cgi?id=77089 5 6 Reviewed by Martin Robinson. 7 8 Basic port to GStreamer 0.11 APIs. This patch excludes the video 9 painting changes and the GStreamerGWorld changes which are handled 10 in two other patches (bugs 77087 and 77088). 11 12 * GNUmakefile.list.am: Add GStreamerVersioning files to the build. 13 * Source/WebCore/PlatformEfl.cmake: Ditto. 14 * Source/WebCore/Target.pri: Ditto. 15 * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: 16 (WTF::GstElement): 17 (WTF::GstPad): 18 (WTF::GstPadTemplate): 19 (WTF::GstTask): 20 * platform/graphics/gstreamer/GStreamerVersioning.cpp: Added. 21 (webkit_gst_object_ref_sink): 22 (webkit_gst_element_get_pad_caps): 23 * platform/graphics/gstreamer/GStreamerVersioning.h: Added. 24 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: 25 (WebCore::MediaPlayerPrivateGStreamer::isAvailable): 26 (WebCore::MediaPlayerPrivateGStreamer::duration): 27 (WebCore::MediaPlayerPrivateGStreamer::naturalSize): 28 1 29 2012-02-27 Philip Rogers <pdr@google.com> 2 30 -
trunk/Source/WebCore/GNUmakefile.list.am
r108985 r109005 4531 4531 Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp \ 4532 4532 Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h \ 4533 Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp \ 4534 Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h \ 4533 4535 Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp \ 4534 4536 Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h \ -
trunk/Source/WebCore/PlatformEfl.cmake
r108558 r109005 189 189 platform/graphics/gstreamer/GRefPtrGStreamer.cpp 190 190 platform/graphics/gstreamer/GStreamerGWorld.cpp 191 platform/graphics/gstreamer/GStreamerVersioning.cpp 191 192 platform/graphics/gstreamer/ImageGStreamerCairo.cpp 192 193 platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp -
trunk/Source/WebCore/Target.pri
r108982 r109005 3232 3232 platform/graphics/gstreamer/GRefPtrGStreamer.h \ 3233 3233 platform/graphics/gstreamer/GStreamerGWorld.h \ 3234 platform/graphics/gstreamer/GStreamerVersioning.h \ 3234 3235 platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h \ 3235 3236 platform/graphics/gstreamer/VideoSinkGStreamer.h \ … … 3241 3242 platform/graphics/gstreamer/GRefPtrGStreamer.cpp \ 3242 3243 platform/graphics/gstreamer/GStreamerGWorld.cpp \ 3244 platform/graphics/gstreamer/GStreamerVersioning.cpp \ 3243 3245 platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp \ 3244 3246 platform/graphics/gstreamer/VideoSinkGStreamer.cpp \ -
trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
r102791 r109005 20 20 #include "config.h" 21 21 #include "GRefPtrGStreamer.h" 22 #include "GStreamerVersioning.h" 22 23 23 24 #if USE(GSTREAMER) … … 34 35 template <> GstElement* refGPtr<GstElement>(GstElement* ptr) 35 36 { 36 if (ptr) { 37 gst_object_ref(GST_OBJECT(ptr)); 38 gst_object_sink(GST_OBJECT(ptr)); 39 } 37 if (ptr) 38 webkitGstObjectRefSink(GST_OBJECT(ptr)); 40 39 41 40 return ptr; … … 56 55 template <> GstPad* refGPtr<GstPad>(GstPad* ptr) 57 56 { 58 if (ptr) { 59 gst_object_ref(GST_OBJECT(ptr)); 60 gst_object_sink(GST_OBJECT(ptr)); 61 } 57 if (ptr) 58 webkitGstObjectRefSink(GST_OBJECT(ptr)); 59 62 60 return ptr; 63 61 } … … 77 75 template <> GstPadTemplate* refGPtr<GstPadTemplate>(GstPadTemplate* ptr) 78 76 { 79 if (ptr) { 80 gst_object_ref(GST_OBJECT(ptr)); 81 gst_object_sink(GST_OBJECT(ptr)); 82 } 77 if (ptr) 78 webkitGstObjectRefSink(GST_OBJECT(ptr)); 79 83 80 return ptr; 84 81 } … … 112 109 template <> GstTask* refGPtr<GstTask>(GstTask* ptr) 113 110 { 114 if (ptr) { 115 gst_object_ref(GST_OBJECT(ptr)); 116 gst_object_sink(GST_OBJECT(ptr)); 117 } 111 if (ptr) 112 webkitGstObjectRefSink(GST_OBJECT(ptr)); 118 113 119 114 return ptr; -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
r108524 r109005 33 33 #include "GRefPtrGStreamer.h" 34 34 #include "GStreamerGWorld.h" 35 #include "GStreamerVersioning.h" 35 36 #include "GraphicsContext.h" 36 37 #include "GraphicsTypes.h" … … 47 48 #include <GOwnPtr.h> 48 49 #include <gst/gst.h> 49 #include <gst/interfaces/streamvolume.h>50 50 #include <gst/video/video.h> 51 51 #include <limits> 52 52 #include <math.h> 53 53 #include <wtf/text/CString.h> 54 55 #ifdef GST_API_VERSION_1 56 #include <gst/audio/streamvolume.h> 57 #else 58 #include <gst/interfaces/streamvolume.h> 59 #endif 54 60 55 61 // GstPlayFlags flags from playbin2. It is the policy of GStreamer to … … 68 74 } GstPlayFlags; 69 75 76 #ifdef GST_API_VERSION_1 77 static const char* gPlaybinName = "playbin"; 78 #else 79 static const char* gPlaybinName = "playbin2"; 80 #endif 81 70 82 using namespace std; 71 83 … … 187 199 return false; 188 200 189 GstElementFactory* factory = gst_element_factory_find( "playbin2");201 GstElementFactory* factory = gst_element_factory_find(gPlaybinName); 190 202 if (factory) { 191 203 gst_object_unref(GST_OBJECT(factory)); … … 401 413 gint64 timeLength = 0; 402 414 403 if (!gst_element_query_duration(m_playBin, &timeFormat, &timeLength) || timeFormat != GST_FORMAT_TIME || static_cast<guint64>(timeLength) == GST_CLOCK_TIME_NONE) { 415 #ifdef GST_API_VERSION_1 416 bool failure = !gst_element_query_duration(m_playBin, timeFormat, &timeLength) || static_cast<guint64>(timeLength) == GST_CLOCK_TIME_NONE; 417 #else 418 bool failure = !gst_element_query_duration(m_playBin, &timeFormat, &timeLength) || timeFormat != GST_FORMAT_TIME || static_cast<guint64>(timeLength) == GST_CLOCK_TIME_NONE; 419 #endif 420 if (failure) { 404 421 LOG_VERBOSE(Media, "Time duration query failed."); 405 422 return numeric_limits<float>::infinity(); … … 490 507 return IntSize(); 491 508 492 G RefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(m_webkitVideoSink, "sink"));493 if (! pad)509 GstCaps* caps = webkitGstElementGetPadCaps(m_webkitVideoSink, "sink"); 510 if (!caps) 494 511 return IntSize(); 495 512 496 guint64 width = 0, height = 0;497 GstCaps* caps = GST_PAD_CAPS(pad.get());498 513 int pixelAspectRatioNumerator, pixelAspectRatioDenominator; 499 514 int displayWidth, displayHeight, displayAspectRatioGCD; … … 507 522 // Get the video PAR and original size, if this fails the 508 523 // video-sink has likely not yet negotiated its caps. 524 #ifdef GST_API_VERSION_1 525 GstVideoInfo info; 526 if (!gst_video_info_from_caps(&info, caps)) 527 return IntSize(); 528 529 originalWidth = GST_VIDEO_INFO_WIDTH(&info); 530 originalHeight = GST_VIDEO_INFO_HEIGHT(&info); 531 pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info); 532 pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info); 533 #else 534 // Get the video PAR and original size. 509 535 if (!GST_IS_CAPS(caps) || !gst_caps_is_fixed(caps) 510 536 || !gst_video_format_parse_caps(caps, 0, &originalWidth, &originalHeight) … … 512 538 &pixelAspectRatioDenominator)) 513 539 return IntSize(); 540 #endif 514 541 515 542 LOG_VERBOSE(Media, "Original video size: %dx%d", originalWidth, originalHeight); … … 526 553 527 554 // Apply DAR to original video size. This is the same behavior as in xvimagesink's setcaps function. 555 guint64 width = 0, height = 0; 528 556 if (!(originalHeight % displayHeight)) { 529 557 LOG_VERBOSE(Media, "Keeping video original height"); … … 930 958 GstFormat fmt = GST_FORMAT_BYTES; 931 959 gint64 length = 0; 960 #ifdef GST_API_VERSION_1 961 if (gst_element_query_duration(m_source, fmt, &length)) { 962 #else 932 963 if (gst_element_query_duration(m_source, &fmt, &length)) { 964 #endif 933 965 LOG_VERBOSE(Media, "totalBytes %" G_GINT64_FORMAT, length); 934 966 return static_cast<unsigned>(length); … … 940 972 bool done = false; 941 973 while (!done) { 974 #ifdef GST_API_VERSION_1 975 GValue item = {0, }; 976 switch (gst_iterator_next(iter, &item)) { 977 case GST_ITERATOR_OK: { 978 GstPad* pad = static_cast<GstPad*>(g_value_get_object(&item)); 979 gint64 padLength = 0; 980 if (gst_pad_query_duration(pad, fmt, &padLength) && padLength > length) 981 length = padLength; 982 break; 983 } 984 #else 942 985 gpointer data; 943 986 … … 946 989 GRefPtr<GstPad> pad = adoptGRef(GST_PAD_CAST(data)); 947 990 gint64 padLength = 0; 948 if (gst_pad_query_duration(pad.get(), &fmt, &padLength) 949 && padLength > length) 991 if (gst_pad_query_duration(pad.get(), &fmt, &padLength) && padLength > length) 950 992 length = padLength; 951 993 break; 952 994 } 995 #endif 953 996 case GST_ITERATOR_RESYNC: 954 997 gst_iterator_resync(iter); … … 960 1003 break; 961 1004 } 962 } 1005 1006 #ifdef GST_API_VERSION_1 1007 g_value_unset(&item); 1008 #endif 1009 } 1010 963 1011 gst_iterator_free(iter); 964 1012 … … 1672 1720 { 1673 1721 ASSERT(!m_playBin); 1674 m_playBin = gst_element_factory_make( "playbin2", "play");1722 m_playBin = gst_element_factory_make(gPlaybinName, "play"); 1675 1723 1676 1724 m_gstGWorld = GStreamerGWorld::createGWorld(m_playBin); … … 1693 1741 g_signal_connect(m_webkitVideoSink, "repaint-requested", G_CALLBACK(mediaPlayerPrivateRepaintCallback), this); 1694 1742 1743 1744 #ifndef GST_API_VERSION_1 1695 1745 m_videoSinkBin = gst_bin_new("sink"); 1746 1696 1747 GstElement* videoTee = gst_element_factory_make("tee", "videoTee"); 1697 1748 GstElement* queue = gst_element_factory_make("queue", 0); … … 1711 1762 GRefPtr<GstPad> sinkPad = adoptGRef(gst_element_get_static_pad(queue, "sink")); 1712 1763 gst_pad_link(srcPad.get(), sinkPad.get()); 1764 #endif 1713 1765 1714 1766 GstElement* actualVideoSink = 0; … … 1729 1781 if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_fpsSink), "video-sink")) { 1730 1782 g_object_set(m_fpsSink, "video-sink", m_webkitVideoSink, NULL); 1783 #ifndef GST_API_VERSION_1 1731 1784 gst_bin_add(GST_BIN(m_videoSinkBin), m_fpsSink); 1785 #endif 1732 1786 actualVideoSink = m_fpsSink; 1733 1787 } else … … 1738 1792 1739 1793 if (!m_fpsSink) { 1794 #ifndef GST_API_VERSION_1 1740 1795 gst_bin_add(GST_BIN(m_videoSinkBin), m_webkitVideoSink); 1796 #endif 1741 1797 actualVideoSink = m_webkitVideoSink; 1742 1798 } … … 1744 1800 ASSERT(actualVideoSink); 1745 1801 1802 #ifndef GST_API_VERSION_1 1746 1803 // Faster elements linking. 1747 1804 gst_element_link_pads_full(queue, "src", actualVideoSink, "sink", GST_PAD_LINK_CHECK_NOTHING); … … 1753 1810 // Set the bin as video sink of playbin. 1754 1811 g_object_set(m_playBin, "video-sink", m_videoSinkBin, NULL); 1755 1756 pad = adoptGRef(gst_element_get_static_pad(m_webkitVideoSink, "sink")); 1757 if (pad) 1758 g_signal_connect(pad.get(), "notify::caps", G_CALLBACK(mediaPlayerPrivateVideoSinkCapsChangedCallback), this); 1812 #else 1813 g_object_set(m_playBin, "video-sink", actualVideoSink, NULL); 1814 #endif 1815 1816 GRefPtr<GstPad> videoSinkPad = adoptGRef(gst_element_get_static_pad(m_webkitVideoSink, "sink")); 1817 if (videoSinkPad) 1818 g_signal_connect(videoSinkPad.get(), "notify::caps", G_CALLBACK(mediaPlayerPrivateVideoSinkCapsChangedCallback), this); 1759 1819 1760 1820 }
Note: See TracChangeset
for help on using the changeset viewer.