summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi/gstvaapiwindow_drm.c
blob: fdbdd2d8c8691f7416202d722caa275352b071c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
 *  gstvaapiwindow_drm.c - VA/DRM window abstraction
 *
 *  Copyright (C) 2012-2013 Intel Corporation
 *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2.1
 *  of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free
 *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301 USA
 */

/**
 * SECTION:gstvaapiwindow_drm
 * @short_description: VA/DRM dummy window abstraction
 */

#include "sysdeps.h"
#include "gstvaapiwindow_drm.h"
#include "gstvaapiwindow_priv.h"
#include "gstvaapidisplay_drm_priv.h"

#define DEBUG 1
#include "gstvaapidebug.h"

typedef struct _GstVaapiWindowDRMClass GstVaapiWindowDRMClass;

/**
 * GstVaapiWindowDRM:
 *
 * A dummy DRM window abstraction.
 */
struct _GstVaapiWindowDRM
{
  /*< private > */
  GstVaapiWindow parent_instance;
};

/**
 * GstVaapiWindowDRMClass:
 *
 * A dummy DRM window abstraction class.
 */
struct _GstVaapiWindowDRMClass
{
  /*< private > */
  GstVaapiWindowClass parent_instance;
};

static gboolean
gst_vaapi_window_drm_show (GstVaapiWindow * window)
{
  return TRUE;
}

static gboolean
gst_vaapi_window_drm_hide (GstVaapiWindow * window)
{
  return TRUE;
}

static gboolean
gst_vaapi_window_drm_create (GstVaapiWindow * window,
    guint * width, guint * height)
{
  return TRUE;
}

static gboolean
gst_vaapi_window_drm_resize (GstVaapiWindow * window, guint width, guint height)
{
  return TRUE;
}

static gboolean
gst_vaapi_window_drm_render (GstVaapiWindow * window,
    GstVaapiSurface * surface,
    const GstVaapiRectangle * src_rect,
    const GstVaapiRectangle * dst_rect, guint flags)
{
  return TRUE;
}

void
gst_vaapi_window_drm_class_init (GstVaapiWindowDRMClass * klass)
{
  GstVaapiWindowClass *const window_class = GST_VAAPI_WINDOW_CLASS (klass);

  window_class->create = gst_vaapi_window_drm_create;
  window_class->show = gst_vaapi_window_drm_show;
  window_class->hide = gst_vaapi_window_drm_hide;
  window_class->resize = gst_vaapi_window_drm_resize;
  window_class->render = gst_vaapi_window_drm_render;
}

static void
gst_vaapi_window_drm_finalize (GstVaapiWindowDRM * window)
{
}

GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiWindowDRM,
    gst_vaapi_window_drm, gst_vaapi_window_drm_class_init (&g_class));

/**
 * gst_vaapi_window_drm_new:
 * @display: a #GstVaapiDisplay
 * @width: the requested window width, in pixels (unused)
 * @height: the requested windo height, in pixels (unused)
 *
 * Creates a dummy window. The window will be attached to the @display.
 * All rendering functions will return success since VA/DRM is a
 * renderless API.
 *
 * Note: this dummy window object is only necessary to fulfill cases
 * where the client application wants to automatically determine the
 * best display to use for the current system. As such, it provides
 * utility functions with the same API (function arguments) to help
 * implement uniform function tables.
 *
 * Return value: the newly allocated #GstVaapiWindow object
 */
GstVaapiWindow *
gst_vaapi_window_drm_new (GstVaapiDisplay * display, guint width, guint height)
{
  GST_DEBUG ("new window, size %ux%u", width, height);

  g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_DRM (display), NULL);

  return
      gst_vaapi_window_new_internal (GST_VAAPI_WINDOW_CLASS
      (gst_vaapi_window_drm_class ()), display, GST_VAAPI_ID_INVALID, width,
      height);
}