head 1.3; access; symbols pkgsrc-2014Q3:1.2.0.4 pkgsrc-2014Q3-base:1.2 pkgsrc-2014Q2:1.2.0.2 pkgsrc-2014Q2-base:1.2 pkgsrc-2014Q1:1.1.0.2 pkgsrc-2014Q1-base:1.1; locks; strict; comment @// @; 1.3 date 2014.11.02.05.40.31; author ryoon; state dead; branches; next 1.2; commitid NE5EWeAimDmUuzWx; 1.2 date 2014.06.22.08.54.39; author ryoon; state Exp; branches; next 1.1; commitid PZNghMi9oWIHQuFx; 1.1 date 2014.03.30.04.13.17; author ryoon; state Exp; branches; next ; commitid tLBJBro5DZzzZFux; desc @@ 1.3 log @Update to 2.30 * Update enigmail to 1.7.2 Changelog: * SeaMonkey specific changes are not available. * Use xul engine from Firefox 33. @ text @$NetBSD: patch-mozilla_content_media_gstreamer_GStreamerReader-0.10.cpp,v 1.2 2014/06/22 08:54:39 ryoon Exp $ --- mozilla/content/media/gstreamer/GStreamerReader-0.10.cpp.orig 2014-06-21 11:28:32.000000000 +0000 +++ mozilla/content/media/gstreamer/GStreamerReader-0.10.cpp @@@@ -0,0 +1,200 @@@@ +#include "nsError.h" +#include "MediaDecoderStateMachine.h" +#include "AbstractMediaDecoder.h" +#include "MediaResource.h" +#include "GStreamerReader.h" +#include "GStreamerMozVideoBuffer.h" +#include "GStreamerFormatHelper.h" +#include "VideoUtils.h" +#include "mozilla/dom/TimeRanges.h" +#include "mozilla/Preferences.h" + +using namespace mozilla; +using mozilla::layers::PlanarYCbCrImage; +using mozilla::layers::ImageContainer; + +GstFlowReturn GStreamerReader::AllocateVideoBufferCb(GstPad* aPad, + guint64 aOffset, + guint aSize, + GstCaps* aCaps, + GstBuffer** aBuf) +{ + GStreamerReader* reader = reinterpret_cast(gst_pad_get_element_private(aPad)); + return reader->AllocateVideoBuffer(aPad, aOffset, aSize, aCaps, aBuf); +} + +GstFlowReturn GStreamerReader::AllocateVideoBuffer(GstPad* aPad, + guint64 aOffset, + guint aSize, + GstCaps* aCaps, + GstBuffer** aBuf) +{ + nsRefPtr image; + return AllocateVideoBufferFull(aPad, aOffset, aSize, aCaps, aBuf, image); +} + +GstFlowReturn GStreamerReader::AllocateVideoBufferFull(GstPad* aPad, + guint64 aOffset, + guint aSize, + GstCaps* aCaps, + GstBuffer** aBuf, + nsRefPtr& aImage) +{ + /* allocate an image using the container */ + ImageContainer* container = mDecoder->GetImageContainer(); + if (container == nullptr) { + return GST_FLOW_ERROR; + } + PlanarYCbCrImage* img = reinterpret_cast(container->CreateImage(ImageFormat::PLANAR_YCBCR).get()); + nsRefPtr image = dont_AddRef(img); + + /* prepare a GstBuffer pointing to the underlying PlanarYCbCrImage buffer */ + GstBuffer* buf = GST_BUFFER(gst_moz_video_buffer_new()); + GST_BUFFER_SIZE(buf) = aSize; + /* allocate the actual YUV buffer */ + GST_BUFFER_DATA(buf) = image->AllocateAndGetNewBuffer(aSize); + + aImage = image; + + /* create a GstMozVideoBufferData to hold the image */ + GstMozVideoBufferData* bufferdata = new GstMozVideoBufferData(image); + + /* Attach bufferdata to our GstMozVideoBuffer, it will take care to free it */ + gst_moz_video_buffer_set_data(GST_MOZ_VIDEO_BUFFER(buf), bufferdata); + + *aBuf = buf; + return GST_FLOW_OK; +} + +gboolean GStreamerReader::EventProbe(GstPad* aPad, GstEvent* aEvent) +{ + GstElement* parent = GST_ELEMENT(gst_pad_get_parent(aPad)); + switch(GST_EVENT_TYPE(aEvent)) { + case GST_EVENT_NEWSEGMENT: + { + gboolean update; + gdouble rate; + GstFormat format; + gint64 start, stop, position; + GstSegment* segment; + + /* Store the segments so we can convert timestamps to stream time, which + * is what the upper layers sync on. + */ + ReentrantMonitorAutoEnter mon(mGstThreadsMonitor); + gst_event_parse_new_segment(aEvent, &update, &rate, &format, + &start, &stop, &position); + if (parent == GST_ELEMENT(mVideoAppSink)) + segment = &mVideoSegment; + else + segment = &mAudioSegment; + gst_segment_set_newsegment(segment, update, rate, format, + start, stop, position); + break; + } + case GST_EVENT_FLUSH_STOP: + /* Reset on seeks */ + ResetDecode(); + break; + default: + break; + } + gst_object_unref(parent); + + return TRUE; +} + +gboolean GStreamerReader::EventProbeCb(GstPad* aPad, + GstEvent* aEvent, + gpointer aUserData) +{ + GStreamerReader* reader = reinterpret_cast(aUserData); + return reader->EventProbe(aPad, aEvent); +} + +nsRefPtr GStreamerReader::GetImageFromBuffer(GstBuffer* aBuffer) +{ + if (!GST_IS_MOZ_VIDEO_BUFFER (aBuffer)) + return nullptr; + + nsRefPtr image; + GstMozVideoBufferData* bufferdata = reinterpret_cast(gst_moz_video_buffer_get_data(GST_MOZ_VIDEO_BUFFER(aBuffer))); + image = bufferdata->mImage; + + PlanarYCbCrImage::Data data; + data.mPicX = data.mPicY = 0; + data.mPicSize = gfx::IntSize(mPicture.width, mPicture.height); + data.mStereoMode = StereoMode::MONO; + + data.mYChannel = GST_BUFFER_DATA(aBuffer); + data.mYStride = gst_video_format_get_row_stride(mFormat, 0, mPicture.width); + data.mYSize = gfx::IntSize(data.mYStride, + gst_video_format_get_component_height(mFormat, 0, mPicture.height)); + data.mYSkip = 0; + data.mCbCrStride = gst_video_format_get_row_stride(mFormat, 1, mPicture.width); + data.mCbCrSize = gfx::IntSize(data.mCbCrStride, + gst_video_format_get_component_height(mFormat, 1, mPicture.height)); + data.mCbChannel = data.mYChannel + gst_video_format_get_component_offset(mFormat, 1, + mPicture.width, mPicture.height); + data.mCrChannel = data.mYChannel + gst_video_format_get_component_offset(mFormat, 2, + mPicture.width, mPicture.height); + data.mCbSkip = 0; + data.mCrSkip = 0; + + image->SetDataNoCopy(data); + + return image; +} + +void GStreamerReader::CopyIntoImageBuffer(GstBuffer* aBuffer, + GstBuffer** aOutBuffer, + nsRefPtr &aImage) +{ + AllocateVideoBufferFull(nullptr, GST_BUFFER_OFFSET(aBuffer), + GST_BUFFER_SIZE(aBuffer), nullptr, aOutBuffer, aImage); + + gst_buffer_copy_metadata(*aOutBuffer, aBuffer, (GstBufferCopyFlags)GST_BUFFER_COPY_ALL); + memcpy(GST_BUFFER_DATA(*aOutBuffer), GST_BUFFER_DATA(aBuffer), GST_BUFFER_SIZE(*aOutBuffer)); + + aImage = GetImageFromBuffer(*aOutBuffer); +} + +GstCaps* GStreamerReader::BuildAudioSinkCaps() +{ + GstCaps* caps; +#ifdef IS_LITTLE_ENDIAN + int endianness = 1234; +#else + int endianness = 4321; +#endif + gint width; +#ifdef MOZ_SAMPLE_TYPE_FLOAT32 + caps = gst_caps_from_string("audio/x-raw-float, channels={1,2}"); + width = 32; +#else /* !MOZ_SAMPLE_TYPE_FLOAT32 */ + caps = gst_caps_from_string("audio/x-raw-int, channels={1,2}"); + width = 16; +#endif + gst_caps_set_simple(caps, + "width", G_TYPE_INT, width, + "endianness", G_TYPE_INT, endianness, + NULL); + + return caps; +} + +void GStreamerReader::InstallPadCallbacks() +{ + GstPad* sinkpad = gst_element_get_static_pad(GST_ELEMENT(mVideoAppSink), "sink"); + gst_pad_add_event_probe(sinkpad, + G_CALLBACK(&GStreamerReader::EventProbeCb), this); + + gst_pad_set_bufferalloc_function(sinkpad, GStreamerReader::AllocateVideoBufferCb); + gst_pad_set_element_private(sinkpad, this); + gst_object_unref(sinkpad); + + sinkpad = gst_element_get_static_pad(GST_ELEMENT(mAudioAppSink), "sink"); + gst_pad_add_event_probe(sinkpad, + G_CALLBACK(&GStreamerReader::EventProbeCb), this); + gst_object_unref(sinkpad); +} @ 1.2 log @Update to 2.26.1 Changelog: SeaMonkey-specific changes The delimiter for forwarded messages can now be configured. An option to not strip signatures on reply has been added to prevent top signatures from deleting the body. Add to Searchbar (search-engine autodiscovery) was implemented. The location bar tooltip now shows the complete current URL in case it is displayed only partially. See the changes page for a more complete overview. Mozilla platform changes The Gamepad API has been finalized and enabled (learn more). navigator.plugins is no longer enumerable, for user privacy. ECMAScript Internationalization API has been enabled. 'box-sizing' (dropping the -moz- prefix) has been implemented. SharedWorker is now enabled by default. CSS3 variables have been implemented. Console object is now available in Web Workers. Promises have been enabled by default. has been implemented and enabled. has been implemented and enabled. Fixed several stability issues. Fixed in SeaMonkey 2.26.1 MFSA 2014-54 Buffer overflow in Gamepad API MFSA 2014-53 Buffer overflow in Web Audio Speex resampler MFSA 2014-52 Use-after-free with SMIL Animation Controller MFSA 2014-51 Use-after-free in Event Listener Manager MFSA 2014-49 Use-after-free and out of bounds issues found using Address Sanitizer MFSA 2014-48 Miscellaneous memory safety hazards (rv:30.0 / rv:24.6) Fixed in SeaMonkey 2.26 MFSA 2014-47 Debugger can bypass XrayWrappers with JavaScript MFSA 2014-46 Use-after-free in nsHostResolve MFSA 2014-45 Incorrect IDNA domain name matching for wildcard certificates MFSA 2014-44 Use-after-free in imgLoader while resizing images MFSA 2014-43 Cross-site scripting (XSS) using history navigations MFSA 2014-42 Privilege escalation through Web Notification API MFSA 2014-41 Out-of-bounds write in Cairo MFSA 2014-39 Use-after-free in the Text Track Manager for HTML video MFSA 2014-38 Buffer overflow when using non-XBL object as XBL MFSA 2014-37 Out of bounds read while decoding JPG images MFSA 2014-36 Web Audio memory corruption issues MFSA 2014-34 Miscellaneous memory safety hazards (rv:29.0 / rv:24.5) @ text @d1 1 a1 1 $NetBSD: patch-mozilla_content_media_gstreamer_GStreamerReader-0.10.cpp,v 1.1 2014/03/30 04:13:17 ryoon Exp $ @ 1.1 log @Update to 2.25 * Change enigmail build mechanism Changelog: 2.25: SeaMonkey-specific changes Newsgroup names can now be entered using autocompletion. See the changes page for a more complete overview. Mozilla platform changes The Gamepad API has been finalized and enabled (learn more). VP9 video decoding has been implemented. Support for Opus in WebM was added. Volume control for HTML5 audio/video has been added. Mac OS X Notification Center support has been added for web notifications. Support for spdy/2 has been removed. Support for multi-line flexbox in layout has been added. Support for the MathML 2.0 mathvariant attribute has been added. Background thread hang reporting has been added. has been implemented and enabled. Fixed several stability issues. Fixed in SeaMonkey 2.25 MFSA 2014-32 Out-of-bounds write through TypedArrayObject after neutering MFSA 2014-31 Out-of-bounds read/write through neutering ArrayBuffer objects MFSA 2014-30 Use-after-free in TypeObject MFSA 2014-29 Privilege escalation using WebIDL-implemented APIs MFSA 2014-28 SVG filters information disclosure through feDisplacementMap MFSA 2014-27 Memory corruption in Cairo during PDF font rendering MFSA 2014-26 Information disclosure through polygon rendering in MathML MFSA 2014-23 Content Security Policy for data: documents not preserved by session restore MFSA 2014-22 WebGL content injection from one domain to rendering in another MFSA 2014-20 onbeforeunload and Javascript navigation DOS MFSA 2014-19 Spoofing attack on WebRTC permission prompt MFSA 2014-18 crypto.generateCRMFRequest does not validate type of key MFSA 2014-17 Out of bounds read during WAV file decoding MFSA 2014-16 Files extracted during updates are not always read only MFSA 2014-15 Miscellaneous memory safety hazards (rv:28.0 / rv:24.4) 2.24: SeaMonkey-specific changes The DoNotTrack and Prompt on Sanitize preferences are now kept in sync. A pref (mailnews.p7m_external) has been added to allow users to choose an alternate application/pkcs7-mime handling. Support for Atom Threading Extensions (RFC 4685) has been added. Migrating profiles from Thunderbird supports the new signons file format now (support for the old format has been dropped). Autocomplete drop-downs (e.g. used on the Location Bar and Open Location dialog) now show favicons for their entries. The account name is now displayed in the status bar for all messages when checking mail. IMAP alert messages now show the server of the corresponding mail account. Newsgroup names are now searched for all search strings combined (AND-search) on the subscribe dialog. See the changes page for a more complete overview. Mozilla platform changes Removed support for importing logins from the legacy signons.txt format, including the Base64 conversion (bug 717490). Enabled support for TLS 1.2 (RFC 5246) by default (bug 861266). Added support for the SPDY 3.1 protocol. Added ability to reset style sheets using all:unset. Added support for scrolled fieldsets (overflow property support, bug 261037). Implemented allow-popups directive for iframe sandbox, enabling increased security (bug 766282). Unprefixed CSS cursor keywords -moz-grab and -moz-grabbing (bug 880672). Added support for ES6 generators in SpiderMonkey (blog post). Implemented support for mathematical function Math.hypot() in ES6 (bug 896264). Added dashed line support on Canvas (bug 768067). Fixed Azure/Skia content rendering on Linux (bug 740200). Fixed several stability issues. Fixed in SeaMonkey 2.24 MFSA 2014-13 Inconsistent JavaScript handling of access to Window objects MFSA 2014-12 NSS ticket handling issues MFSA 2014-11 Crash when using web workers with asm.js MFSA 2014-09 Cross-origin information leak through web workers MFSA 2014-08 Use-after-free with imgRequestProxy and image proccessing MFSA 2014-07 XSLT stylesheets treated as styles in Content Security Policy MFSA 2014-05 Information disclosure with *FromPoint on iframes MFSA 2014-04 Incorrect use of discarded images by RasterImage MFSA 2014-03 UI selection timeout missing on download prompts MFSA 2014-02 Clone protected content with XBL scopes MFSA 2014-01 Miscellaneous memory safety hazards (rv:27.0 / rv:24.3) @ text @d1 1 a1 1 $NetBSD$ d3 1 a3 1 --- mozilla/content/media/gstreamer/GStreamerReader-0.10.cpp.orig 2014-03-29 04:22:17.000000000 +0000 d5 1 a5 1 @@@@ -0,0 +1,203 @@@@ d50 2 a51 4 + if (!container) { + // We don't have an ImageContainer. We probably belong to an