#include "gstvacaps.h"
#include "gstvadisplay_priv.h"
#include "gstvavideoformat.h"
+#include "vasurfaceimage.h"
struct _GstVaFilter
{
_fill_va_sample (GstVaFilter * self, GstVaSample * sample,
GstPadDirection direction)
{
- GstVideoCropMeta *crop;
+ GstVideoCropMeta *crop = NULL;
- sample->surface = gst_va_buffer_get_surface (sample->buffer);
+ if (sample->buffer)
+ sample->surface = gst_va_buffer_get_surface (sample->buffer);
if (sample->surface == VA_INVALID_ID)
return FALSE;
+ /* @FIXME: in gallium vaQuerySurfaceStatus only seems to work with
+ * encoder's surfaces */
+ if (!GST_VA_DISPLAY_IS_IMPLEMENTATION (self->display, MESA_GALLIUM)) {
+ if (!va_check_surface (self->display, sample->surface))
+ return FALSE;
+ }
+
/* XXX: cropping occurs only in input frames */
if (direction == GST_PAD_SRC) {
GST_OBJECT_LOCK (self);
}
/* if buffer has crop meta, its real size is in video meta */
- crop = gst_buffer_get_video_crop_meta (sample->buffer);
+ if (sample->buffer)
+ crop = gst_buffer_get_video_crop_meta (sample->buffer);
GST_OBJECT_LOCK (self);
if (crop && self->crop_enabled) {
gboolean ret = FALSE;
g_return_val_if_fail (GST_IS_VA_FILTER (self), FALSE);
- g_return_val_if_fail (src && GST_IS_BUFFER (src->buffer), FALSE);
- g_return_val_if_fail (dst && GST_IS_BUFFER (dst->buffer), FALSE);
+ g_return_val_if_fail (src, FALSE);
+ g_return_val_if_fail (dst, FALSE);
if (!gst_va_filter_is_open (self))
return FALSE;
#include "vasurfaceimage.h"
#include "gstvavideoformat.h"
+#include <va/va.h>
gboolean
va_destroy_surfaces (GstVaDisplay * display, VASurfaceID * surfaces,
return ret;
}
+
+gboolean
+va_check_surface (GstVaDisplay * display, VASurfaceID surface)
+{
+ VADisplay dpy = gst_va_display_get_va_dpy (display);
+ VAStatus status;
+ VASurfaceStatus state;
+
+ gst_va_display_lock (display);
+ status = vaQuerySurfaceStatus (dpy, surface, &state);
+ gst_va_display_unlock (display);
+
+ if (status != VA_STATUS_SUCCESS)
+ GST_ERROR ("vaQuerySurfaceStatus: %s", vaErrorStr (status));
+
+ GST_LOG ("surface %#x status %d", surface, state);
+
+ return (status == VA_STATUS_SUCCESS);
+}