• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) <2005> Julien Moutte <julien@moutte.net>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __GST_XV_IMAGE_SINK_H__
21 #define __GST_XV_IMAGE_SINK_H__
22 
23 #include <gst/video/gstvideosink.h>
24 
25 /* Helper functions */
26 #include <gst/video/video.h>
27 
28 G_BEGIN_DECLS
29 #define GST_TYPE_XV_IMAGE_SINK \
30   (gst_xv_image_sink_get_type())
31 #define GST_XV_IMAGE_SINK(obj) \
32   (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_XV_IMAGE_SINK, GstXvImageSink))
33 #define GST_XV_IMAGE_SINK_CLASS(klass) \
34   (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_XV_IMAGE_SINK, GstXvImageSinkClass))
35 #define GST_IS_XV_IMAGE_SINK(obj) \
36   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XV_IMAGE_SINK))
37 #define GST_IS_XV_IMAGE_SINK_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XV_IMAGE_SINK))
39 
40 typedef struct _GstXvImageSink GstXvImageSink;
41 typedef struct _GstXvImageSinkClass GstXvImageSinkClass;
42 
43 #include "xvimageallocator.h"
44 #include "xvimagepool.h"
45 #include "xvcontext.h"
46 
47 /**
48  * GstXvImageSink:
49  * @display_name: the name of the Display we want to render to
50  * @xvcontext: our instance's #GstXvContext
51  * @xwindow: the #GstXWindow we are rendering to
52  * @cur_image: a reference to the last #GstXvImage that was put to @xwindow. It
53  * is used when Expose events are received to redraw the latest video frame
54  * @event_thread: a thread listening for events on @xwindow and handling them
55  * @running: used to inform @event_thread if it should run/shutdown
56  * @fps_n: the framerate fraction numerator
57  * @fps_d: the framerate fraction denominator
58  * @x_lock: used to protect X calls as we are not using the XLib in threaded
59  * mode
60  * @flow_lock: used to protect data flow routines from external calls such as
61  * events from @event_thread or methods from the #GstVideoOverlay interface
62  * @par: used to override calculated pixel aspect ratio from @xvcontext
63  * @pool_lock: used to protect the buffer pool
64  * @image_pool: a list of #GstXvImageBuffer that could be reused at next buffer
65  * allocation call
66  * @synchronous: used to store if XSynchronous should be used or not (for
67  * debugging purpose only)
68  * @keep_aspect: used to remember if reverse negotiation scaling should respect
69  * aspect ratio
70  * @handle_events: used to know if we should handle select XEvents or not
71  * @brightness: used to store the user settings for color balance brightness
72  * @contrast: used to store the user settings for color balance contrast
73  * @hue: used to store the user settings for color balance hue
74  * @saturation: used to store the user settings for color balance saturation
75  * @cb_changed: used to store if the color balance settings where changed
76  * @video_width: the width of incoming video frames in pixels
77  * @video_height: the height of incoming video frames in pixels
78  *
79  * The #GstXvImageSink data structure.
80  */
81 struct _GstXvImageSink
82 {
83   /* Our element stuff */
84   GstVideoSink videosink;
85 
86   GstXvContextConfig config;
87   GstXvContext *context;
88   GstXvImageAllocator *allocator;
89   GstXWindow *xwindow;
90   GstBuffer *cur_image;
91 
92   GThread *event_thread;
93   gboolean running;
94 
95   GstVideoInfo info;
96 
97   /* Framerate numerator and denominator */
98   gint fps_n;
99   gint fps_d;
100 
101   GMutex flow_lock;
102 
103   /* object-set pixel aspect ratio */
104   GValue *par;
105 
106   /* the buffer pool */
107   GstBufferPool *pool;
108 
109   gboolean synchronous;
110   gboolean double_buffer;
111   gboolean keep_aspect;
112   gboolean redraw_border;
113   gboolean handle_events;
114   gboolean handle_expose;
115 
116   /* size of incoming video, used as the size for XvImage */
117   guint video_width, video_height;
118 
119   gboolean draw_borders;
120 
121   /* stream metadata */
122   gchar *media_title;
123 
124   /* saved render rectangle until we have a window */
125   gboolean pending_render_rect;
126   GstVideoRectangle render_rect;
127 };
128 
129 struct _GstXvImageSinkClass
130 {
131   GstVideoSinkClass parent_class;
132 };
133 
134 GType gst_xv_image_sink_get_type (void);
135 GST_ELEMENT_REGISTER_DECLARE (xvimagesink);
136 
137 G_END_DECLS
138 #endif /* __GST_XV_IMAGE_SINK_H__ */
139