Stop using single-include headers that are only available since GStreamer >= 1.2.
[WebKit-https.git] / Source / WebCore / platform / graphics / gstreamer / ImageGStreamer.h
index 332908d..1ecd334 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Igalia S.L
+ * Copyright (C) 2010, 2011, 2012 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
 #ifndef ImageGStreamer_h
 #define ImageGStreamer_h
 
-#if USE(GSTREAMER)
+#if ENABLE(VIDEO) && USE(GSTREAMER)
 
 #include "BitmapImage.h"
+#include "FloatRect.h"
+#include "GRefPtrGStreamer.h"
+
 #include <gst/gst.h>
-#include <gst/video/video.h>
-#include <wtf/PassRefPtr.h>
+#include <gst/video/video-frame.h>
 
-#if USE(CAIRO)
-#include <cairo.h>
-#endif
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 class IntSize;
 
 class ImageGStreamer : public RefCounted<ImageGStreamer> {
     public:
-        static PassRefPtr<ImageGStreamer> createImage(GstBuffer*);
+        static PassRefPtr<ImageGStreamer> createImage(GstSample* sample)
+        {
+            return adoptRef(new ImageGStreamer(sample));
+        }
         ~ImageGStreamer();
 
         PassRefPtr<BitmapImage> image()
@@ -45,21 +50,23 @@ class ImageGStreamer : public RefCounted<ImageGStreamer> {
             return m_image.get();
         }
 
+        void setCropRect(FloatRect rect) { m_cropRect = rect; }
+        FloatRect rect()
+        {
+            if (!m_cropRect.isEmpty())
+                return FloatRect(m_cropRect);
+            ASSERT(m_image);
+            return FloatRect(0, 0, m_image->size().width(), m_image->size().height());
+        }
+
     private:
+        ImageGStreamer(GstSample*);
         RefPtr<BitmapImage> m_image;
+        FloatRect m_cropRect;
 
 #if USE(CAIRO)
-        ImageGStreamer(GstBuffer*&, IntSize, cairo_format_t&);
-#endif
-
-#if PLATFORM(QT)
-        ImageGStreamer(GstBuffer*&, IntSize, QImage::Format);
-#endif
-
-#if PLATFORM(MAC)
-        ImageGStreamer(GstBuffer*&, IntSize);
+        GstVideoFrame m_videoFrame;
 #endif
-
     };
 }