Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef __GST_MOZ_VIDEO_BUFFER_H__ |
michael@0 | 6 | #define __GST_MOZ_VIDEO_BUFFER_H__ |
michael@0 | 7 | |
michael@0 | 8 | #include <gst/gst.h> |
michael@0 | 9 | #include "GStreamerLoader.h" |
michael@0 | 10 | #include "MediaDecoderReader.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | |
michael@0 | 14 | #define GST_TYPE_MOZ_VIDEO_BUFFER_DATA (gst_moz_video_buffer_data_get_type()) |
michael@0 | 15 | #define GST_IS_MOZ_VIDEO_BUFFER_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MOZ_VIDEO_BUFFER_DATA)) |
michael@0 | 16 | |
michael@0 | 17 | #define GST_TYPE_MOZ_VIDEO_BUFFER (gst_moz_video_buffer_get_type()) |
michael@0 | 18 | #define GST_IS_MOZ_VIDEO_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MOZ_VIDEO_BUFFER)) |
michael@0 | 19 | #define GST_IS_MOZ_VIDEO_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MOZ_VIDEO_BUFFER)) |
michael@0 | 20 | #define GST_MOZ_VIDEO_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MOZ_VIDEO_BUFFER, GstMozVideoBuffer)) |
michael@0 | 21 | |
michael@0 | 22 | typedef struct _GstMozVideoBuffer GstMozVideoBuffer; |
michael@0 | 23 | typedef struct _GstMozVideoBufferClass GstMozVideoBufferClass; |
michael@0 | 24 | |
michael@0 | 25 | class GstMozVideoBufferData; |
michael@0 | 26 | |
michael@0 | 27 | struct _GstMozVideoBuffer { |
michael@0 | 28 | GstBuffer buffer; |
michael@0 | 29 | GstMozVideoBufferData* data; |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | struct _GstMozVideoBufferClass { |
michael@0 | 33 | GstBufferClass buffer_class; |
michael@0 | 34 | }; |
michael@0 | 35 | |
michael@0 | 36 | GType gst_moz_video_buffer_get_type(void); |
michael@0 | 37 | GstMozVideoBuffer* gst_moz_video_buffer_new(void); |
michael@0 | 38 | void gst_moz_video_buffer_set_data(GstMozVideoBuffer* buf, GstMozVideoBufferData* data); |
michael@0 | 39 | GstMozVideoBufferData* gst_moz_video_buffer_get_data(const GstMozVideoBuffer* buf); |
michael@0 | 40 | |
michael@0 | 41 | class GstMozVideoBufferData { |
michael@0 | 42 | public: |
michael@0 | 43 | GstMozVideoBufferData(layers::PlanarYCbCrImage* aImage) : mImage(aImage) {} |
michael@0 | 44 | |
michael@0 | 45 | static void* Copy(void* aData) { |
michael@0 | 46 | return new GstMozVideoBufferData(reinterpret_cast<GstMozVideoBufferData*>(aData)->mImage); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | static void Free(void* aData) { |
michael@0 | 50 | delete reinterpret_cast<GstMozVideoBufferData*>(aData); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | nsRefPtr<layers::PlanarYCbCrImage> mImage; |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | GType gst_moz_video_buffer_data_get_type (void); |
michael@0 | 57 | |
michael@0 | 58 | } // namespace mozilla |
michael@0 | 59 | |
michael@0 | 60 | #endif /* __GST_MOZ_VIDEO_BUFFER_H__ */ |
michael@0 | 61 |