Debian Codegraph @

src/byzanzencoderbyzanz.c

raw symbols SCIP
1 /* desktop session recorder
2 * Copyright (C) 2009 Benjamin Otte <[email protected]>
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 3 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, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21
22 #include "byzanzencoderbyzanz.h"
23
24 #include <string.h>
25 #include <glib/gi18n.h>
26
27 #include "byzanzserialize.h"
28
29 G_DEFINE_TYPE (ByzanzEncoderByzanz, byzanz_encoder_byzanz, BYZANZ_TYPE_ENCODER)
30
31 static gboolean
32 byzanz_encoder_byzanz_setup (ByzanzEncoder * encoder,
33 GOutputStream * stream,
34 guint width,
35 guint height,
36 GCancellable * cancellable,
37 GError ** error)
38 {
39 return byzanz_serialize_header (stream, width, height, cancellable, error);
40 }
41
42 static gboolean
43 byzanz_encoder_byzanz_process (ByzanzEncoder * encoder,
44 GOutputStream * stream,
45 guint64 msecs,
46 cairo_surface_t * surface,
47 const cairo_region_t * region,
48 GCancellable * cancellable,
49 GError ** error)
50 {
51 return byzanz_serialize (stream, msecs, surface, region, cancellable, error);
52 }
53
54 static gboolean
55 byzanz_encoder_byzanz_close (ByzanzEncoder * encoder,
56 GOutputStream * stream,
57 guint64 msecs,
58 GCancellable * cancellable,
59 GError ** error)
60 {
61 return byzanz_serialize (stream, msecs, NULL, NULL, cancellable, error);
62 }
63
64 static void
65 byzanz_encoder_byzanz_class_init (ByzanzEncoderByzanzClass *klass)
66 {
67 ByzanzEncoderClass *encoder_class = BYZANZ_ENCODER_CLASS (klass);
68
69 /* We don't use the run vfunc and just g_output_stream_slice() here,
70 * because this way we get data verification.
71 */
72 encoder_class->setup = byzanz_encoder_byzanz_setup;
73 encoder_class->process = byzanz_encoder_byzanz_process;
74 encoder_class->close = byzanz_encoder_byzanz_close;
75
76 encoder_class->filter = gtk_file_filter_new ();
77 g_object_ref_sink (encoder_class->filter);
78 gtk_file_filter_set_name (encoder_class->filter, _("Byzanz debug files"));
79 gtk_file_filter_add_mime_type (encoder_class->filter, "application/x-byzanz");
80 gtk_file_filter_add_pattern (encoder_class->filter, "*.byzanz");
81 }
82
83 static void
84 byzanz_encoder_byzanz_init (ByzanzEncoderByzanz *encoder_byzanz)
85 {
86 }
87