• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef __GST_TRANSCODER_H
2 #define __GST_TRANSCODER_H
3 
4 #ifdef HAVE_CONFIG_H
5 #  include "config.h"
6 #endif
7 
8 #include <gst/gst.h>
9 #include <gst/pbutils/pbutils.h>
10 #include <gst/transcoder/transcoder-prelude.h>
11 #include <gst/transcoder/transcoder-enumtypes.h>
12 
13 G_BEGIN_DECLS
14 
15 /*********** Error definitions ************/
16 #define      GST_TRANSCODER_ERROR                         (gst_transcoder_error_quark ())
17 
18 /**
19  * GstTranscoderError:
20  * @GST_TRANSCODER_ERROR_FAILED: generic error.
21  */
22 typedef enum {
23   GST_TRANSCODER_ERROR_FAILED = 0
24 } GstTranscoderError;
25 
26 GST_TRANSCODER_API
27 GQuark        gst_transcoder_error_quark    (void);
28 GST_TRANSCODER_API
29 const gchar * gst_transcoder_error_get_name (GstTranscoderError error);
30 
31 /*********** State definition ************/
32 
33 /**
34  * GstTranscoderState:
35  * @GST_TRANSCODER_STATE_STOPPED: the transcoder is stopped.
36  * @GST_TRANSCODER_STATE_PAUSED: the transcoder is paused.
37  * @GST_TRANSCODER_STATE_PLAYING: the transcoder is currently transcoding a
38  * stream.
39  *
40  * High level representation of the transcoder pipeline state.
41  *
42  * Since: 1.20
43  */
44 typedef enum {
45     GST_TRANSCODER_STATE_STOPPED,
46     GST_TRANSCODER_STATE_PAUSED,
47     GST_TRANSCODER_STATE_PLAYING
48 } GstTranscoderState;
49 
50 GST_TRANSCODER_API
51 const gchar * gst_transcoder_state_get_name                (GstTranscoderState state);
52 
53 /*********** Messages types definitions ************/
54 
55 /**
56  * GstTranscoderMessage:
57  * @GST_TRANSCODER_MESSAGE_POSITION_UPDATED: Sink position changed
58  * @GST_TRANSCODER_MESSAGE_DURATION_CHANGED: Duration of stream changed
59  * @GST_TRANSCODER_MESSAGE_STATE_CHANGED: Pipeline state changed
60  * @GST_TRANSCODER_MESSAGE_DONE: Transcoding is done
61  * @GST_TRANSCODER_MESSAGE_ERROR: Message contains an error
62  * @GST_TRANSCODER_MESSAGE_WARNING: Message contains an error
63  *
64  * Types of messages that will be posted on the transcoder API bus.
65  *
66  * See also #gst_transcoder_get_message_bus()
67  *
68  * Since: 1.20
69  */
70 typedef enum
71 {
72   GST_TRANSCODER_MESSAGE_POSITION_UPDATED,
73   GST_TRANSCODER_MESSAGE_DURATION_CHANGED,
74   GST_TRANSCODER_MESSAGE_STATE_CHANGED,
75   GST_TRANSCODER_MESSAGE_DONE,
76   GST_TRANSCODER_MESSAGE_ERROR,
77   GST_TRANSCODER_MESSAGE_WARNING,
78 } GstTranscoderMessage;
79 
80 GST_TRANSCODER_API
81 gboolean gst_transcoder_is_transcoder_message                 (GstMessage * msg);
82 
83 GST_TRANSCODER_API
84 const gchar * gst_transcoder_message_get_name                  (GstTranscoderMessage message);
85 
86 GST_TRANSCODER_API
87 void           gst_transcoder_message_parse_position           (GstMessage * msg, GstClockTime * position);
88 
89 GST_TRANSCODER_API
90 void           gst_transcoder_message_parse_duration           (GstMessage * msg, GstClockTime * duration);
91 
92 GST_TRANSCODER_API
93 void           gst_transcoder_message_parse_state              (GstMessage * msg, GstTranscoderState * state);
94 
95 GST_TRANSCODER_API
96 void           gst_transcoder_message_parse_error              (GstMessage * msg, GError * error, GstStructure ** details);
97 
98 GST_TRANSCODER_API
99 void           gst_transcoder_message_parse_warning            (GstMessage * msg, GError * error, GstStructure ** details);
100 
101 
102 
103 /*********** GstTranscoder definition  ************/
104 #define GST_TYPE_TRANSCODER (gst_transcoder_get_type ())
105 
106 /**
107  * GstTranscoderClass.parent_class:
108  *
109  * Since: 1.20
110  */
111 GST_TRANSCODER_API
112 G_DECLARE_FINAL_TYPE (GstTranscoder, gst_transcoder, GST, TRANSCODER, GstObject)
113 
114 GST_TRANSCODER_API
115 GstTranscoder * gst_transcoder_new                        (const gchar * source_uri,
116                                                            const gchar * dest_uri,
117                                                            const gchar * encoding_profile);
118 
119 GST_TRANSCODER_API
120 GstTranscoder * gst_transcoder_new_full                   (const gchar * source_uri,
121                                                            const gchar * dest_uri,
122                                                            GstEncodingProfile * profile);
123 
124 GST_TRANSCODER_API
125 gboolean gst_transcoder_run                               (GstTranscoder * self,
126                                                            GError ** error);
127 
128 GST_TRANSCODER_API
129 GstBus * gst_transcoder_get_message_bus                   (GstTranscoder * transcoder);
130 
131 GST_TRANSCODER_API
132 void gst_transcoder_set_cpu_usage                         (GstTranscoder * self,
133                                                            gint cpu_usage);
134 
135 GST_TRANSCODER_API
136 void gst_transcoder_run_async                             (GstTranscoder * self);
137 
138 GST_TRANSCODER_API
139 void gst_transcoder_set_position_update_interval          (GstTranscoder * self,
140                                                            guint interval);
141 
142 GST_TRANSCODER_API
143 gchar * gst_transcoder_get_source_uri                     (GstTranscoder * self);
144 
145 GST_TRANSCODER_API
146 gchar * gst_transcoder_get_dest_uri                       (GstTranscoder * self);
147 
148 GST_TRANSCODER_API
149 guint gst_transcoder_get_position_update_interval         (GstTranscoder * self);
150 
151 GST_TRANSCODER_API
152 GstClockTime gst_transcoder_get_position                  (GstTranscoder * self);
153 
154 GST_TRANSCODER_API
155 GstClockTime gst_transcoder_get_duration                  (GstTranscoder * self);
156 
157 GST_TRANSCODER_API
158 GstElement * gst_transcoder_get_pipeline                  (GstTranscoder * self);
159 
160 GST_TRANSCODER_API
161 gboolean gst_transcoder_get_avoid_reencoding              (GstTranscoder * self);
162 GST_TRANSCODER_API
163 void gst_transcoder_set_avoid_reencoding                  (GstTranscoder * self,
164                                                            gboolean avoid_reencoding);
165 
166 #include "gsttranscoder-signal-adapter.h"
167 
168 GST_TRANSCODER_API
169 GstTranscoderSignalAdapter*
170 gst_transcoder_get_signal_adapter                         (GstTranscoder * self,
171                                                            GMainContext *context);
172 GST_TRANSCODER_API
173 GstTranscoderSignalAdapter*
174 gst_transcoder_get_sync_signal_adapter                    (GstTranscoder * self);
175 
176 G_END_DECLS
177 
178 #endif
179