Changeset 49019 in webkit
- Timestamp:
- Oct 2, 2009 4:14:58 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49018 r49019 5 5 Stale database version persists through browser refresh (changeVersion doesn't work) 6 6 https://bugs.webkit.org/show_bug.cgi?id=27836 7 8 Scale the cairo surface of the video sink depending on the 9 pixel-aspect-ratio of the video buffer to paint. Also 10 destruct/re-create the surface when setSize() is called with a new 11 size. 12 13 * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: 14 (WebCore::MediaPlayerPrivate::naturalSize): 15 (WebCore::MediaPlayerPrivate::setSize): 16 (WebCore::MediaPlayerPrivate::paint): 17 * platform/graphics/gtk/VideoSinkGStreamer.cpp: 18 (webkit_video_sink_idle_func): 19 20 2009-10-02 Philippe Normand <pnormand@igalia.com> 21 22 Reviewed by Gustavo Noronha. 23 24 [GTK] missing support for anamorphic PAR video size 25 https://bugs.webkit.org/show_bug.cgi?id=29717 7 26 8 27 Tests: storage/change-version-handle-reuse.html -
trunk/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
r48980 r49019 335 335 return IntSize(); 336 336 337 int x = 0, y = 0; 337 // TODO: handle possible clean aperture data. See 338 // https://bugzilla.gnome.org/show_bug.cgi?id=596571 339 // TODO: handle possible transformation matrix. See 340 // https://bugzilla.gnome.org/show_bug.cgi?id=596326 341 int width = 0, height = 0; 338 342 if (GstPad* pad = gst_element_get_static_pad(m_videoSink, "sink")) { 339 gst_video_get_size(GST_PAD(pad), &x, &y); 343 gst_video_get_size(GST_PAD(pad), &width, &height); 344 GstCaps* caps = GST_PAD_CAPS(pad); 345 gfloat pixelAspectRatio; 346 gint pixelAspectRatioNumerator, pixelAspectRatioDenominator; 347 348 if (!gst_video_parse_caps_pixel_aspect_ratio(caps, &pixelAspectRatioNumerator, 349 &pixelAspectRatioDenominator)) 350 pixelAspectRatioNumerator = pixelAspectRatioDenominator = 1; 351 352 pixelAspectRatio = (gfloat) pixelAspectRatioNumerator / (gfloat) pixelAspectRatioDenominator; 353 width *= pixelAspectRatio; 354 height /= pixelAspectRatio; 340 355 gst_object_unref(GST_OBJECT(pad)); 341 356 } 342 357 343 return IntSize( x, y);358 return IntSize(width, height); 344 359 } 345 360 … … 625 640 void MediaPlayerPrivate::setSize(const IntSize& size) 626 641 { 642 // Destroy and re-create the cairo surface only if the size 643 // changed. 644 if (size != m_size) { 645 if (m_surface) 646 cairo_surface_destroy(m_surface); 647 m_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, size.width(), 648 size.height()); 649 g_object_set(m_videoSink, "surface", m_surface, 0); 650 } 651 627 652 m_size = size; 653 628 654 } 629 655 … … 646 672 return; 647 673 648 //TODO: m_size vs rect?649 674 cairo_t* cr = context->platformContext(); 650 675 651 676 cairo_save(cr); 652 677 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); 678 679 // paint the rectangle on the context and draw the surface inside. 653 680 cairo_translate(cr, rect.x(), rect.y()); 654 681 cairo_rectangle(cr, 0, 0, rect.width(), rect.height()); -
trunk/WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp
r48979 r49019 112 112 WebKitVideoSinkPrivate* priv = sink->priv; 113 113 GstBuffer* buffer; 114 GstCaps* caps; 115 GstVideoFormat* format; 116 gint par_n, par_d; 117 gfloat par; 118 gint bwidth, bheight; 119 114 120 if (!priv->async_queue) 115 121 return FALSE; … … 119 125 return FALSE; 120 126 121 cairo_surface_t* src = cairo_image_surface_create_for_data(GST_BUFFER_DATA(buffer), CAIRO_FORMAT_RGB24, priv->width, priv->height, (4 * priv->width + 3) & ~3); 127 caps = GST_BUFFER_CAPS(buffer); 128 if (!gst_video_format_parse_caps(caps, format, &bwidth, &bheight)) { 129 GST_ERROR_OBJECT(sink, "Unknown video format in buffer caps '%s'", 130 gst_caps_to_string(caps)); 131 return FALSE; 132 } 133 134 if (!gst_video_parse_caps_pixel_aspect_ratio(caps, &par_n, &par_d)) 135 par_n = par_d = 1; 136 137 par = (gfloat) par_n / (gfloat) par_d; 138 139 // TODO: consider priv->rgb_ordering? 140 cairo_surface_t* src = cairo_image_surface_create_for_data(GST_BUFFER_DATA(buffer), 141 CAIRO_FORMAT_RGB24, 142 bwidth, bheight, 143 4 * bwidth); 122 144 123 145 // TODO: We copy the data twice right now. This could be easily improved. 124 146 cairo_t* cr = cairo_create(priv->surface); 147 cairo_scale(cr, par, 1.0 / par); 125 148 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); 126 149 cairo_set_source_surface(cr, src, 0, 0);
Note: See TracChangeset
for help on using the changeset viewer.