Merge branch 'master' into 0.11
[platform/upstream/gstreamer.git] / docs / random / porting-to-0.11.txt
1 The 0.11 porting guide
2 ----------------------
3
4 * All deprecated methods were removed. Recompile against 0.10 with
5   DISABLE_DEPRECATED and fix issues before attempting to port to 0.11.
6
7 * GST_BOILERPLATE is gone, use G_DEFINE_TYPE instead.
8
9 * various methods take a gsize instead of a guint when talking about memory
10   sizes.
11
12 * multifdsink, tcpclientsink, tcpclientsrc, tcpserversrc the protocol property
13   is removed, use gdppay and gdpdepay.
14
15 * Presets and plugins moved to $XDG_DATA_HOME/gstreamer-0.11/ root
16   directory. Registry moved to $XDG_CACHE_HOME/gstreamer-0.11/.
17   XDG_CACHE_HOME usually points to $HOME/.cache and XDG_DATA_HOME
18   usually is $HOME/.local/share/.
19
20 * GstObject:
21     GST_OBJECT_DISPOSING flag removed
22     GST_OBJECT_IS_DISPOSING removed
23     GST_OBJECT_FLOATING flag remove, GstObject is now GInitiallyUnowned
24     GST_OBJECT_IS_FLOATING removed, use g_object_is_floating()
25
26     GST_CLASS_GET_LOCK, GST_CLASS_LOCK, GST_CLASS_TRYLOCK, GST_CLASS_UNLOCK,
27     used to be a workaround for thread-unsafe glib < 2.8
28
29     gst_object_ref_sink() has gpointer as result to make it more like the
30     GObject version.
31
32     gst_object_sink() removed, use gst_object_ref_sink() instead.
33
34     gst_class_signal_connect() removed, was only used for XML
35
36     parent-set and parent-unset signals removed. Use notify:parent. Currently
37     still disabled because of deep notify locking issues.
38
39 * GstElement:
40     GstElementDetails is removed and replaced with more generic metadata.
41
42     gst_element_class_set_details_simple() -> gst_element_class_set_metadata()
43     gst_element_class_set_documentation_uri -> gst_element_class_add_metadata
44     gst_element_class_set_icon_name -> gst_element_class_add_metadata
45     also gst_element_class_get_metadata()
46
47     gst_element_factory_get_longname -> gst_element_factory_get_metadata
48     gst_element_factory_get_klass -> gst_element_factory_get_metadata
49     gst_element_factory_get_description -> gst_element_factory_get_metadata
50     gst_element_factory_get_author -> gst_element_factory_get_metadata
51     gst_element_factory_get_documentation_uri -> gst_element_factory_get_metadata
52     gst_element_factory_get_icon_name -> gst_element_factory_get_metadata
53
54     gstelementmetadata.h contains the keys for all standard metadata.
55
56     gst_element_factory_can_{src,sink}_caps() => gst_element_factory_can_{src,sink}_{any,all}_caps()
57
58     Element metadata and pad templates are inherited from parent classes and
59     should be added in class_init instead of base_init.
60
61     gst_element_class_add_pad_template() takes ownership of the template
62
63     Elements that change the duration must post DURATION messages on the
64     bus when the duration changes in PAUSED or PLAYING.
65
66     gst_element_lost_state_full() -> gst_element_lost_state()
67     gst_element_lost_state() -> gst_element_lost_state(, TRUE)
68
69     request_new_pad_full() -> request_new_pad()
70
71 * GstPad:
72     gst_pad_get_caps() does not return writable caps anymore and an explicit
73     gst_caps_make_writable() needs to be performed. This was the functionality
74     of gst_pad_get_caps_reffed(), which is removed now.
75
76     A similar change was done for gst_pad_peer_get_caps() and
77     gst_pad_peer_get_caps_reffed()
78
79     gst_pad_set_bufferalloc_function(), gst_pad_alloc_buffer() and
80     gst_pad_alloc_buffer_and_set_caps() are removed. Use the ALLOCATION query
81     now to obtain a reference to a bufferpool object that can be used to
82     allocate buffers.
83
84     removed sched_private, it should not be used, use g_object_set_qdata() or
85     use element_private.
86
87     Removed GST_PAD_CAPS() use gst_pad_get_current_caps() to get a handle to the
88     currently configured caps.
89
90     GstPadGetCapsFunction, gst_pad_get_caps(), gst_pad_peer_get_caps(),
91     gst_pad_proxy_getcaps() now takes a GstCaps* parameter to inform
92     the other side about the possible caps and preferences.
93
94     gst_pad_get_pad_template_caps() and gst_pad_get_pad_template()
95     return a new reference of the caps or template now and the return
96     value needs to be unreffed after usage.
97
98     gst_pad_set_caps() now pushes a CAPS event for backward compatibility.
99     Consider sending the CAPS event yourself. It is not possible anymore to set
100     NULL caps.
101
102     gst_pad_set_checkgetrange_function() and gst_pad_check_pull_range() are
103     gone, use the SCHEDULING query now.
104
105     gst_pad_set_blocked(), gst_pad_set_blocked_async(),
106     gst_pad_set_blocked_async_full() are removed, use the gst_pad_add_probe()
107     method with the GST_PAD_PROBE_TYPE_BLOCK to get the same result as the async
108     blocking version. There is no more sync version of blocking, this is in
109     general dangerous and can be implemented using the callbacks if needed.
110
111     gst_pad_add_data_probe(), gst_pad_add_data_probe_full(),
112     gst_pad_remove_data_probe(), gst_pad_add_event_probe(),
113     gst_pad_add_event_probe_full(), gst_pad_remove_event_probe(),
114     gst_pad_add_buffer_probe(), gst_pad_add_buffer_probe_full(),
115     gst_pad_remove_buffer_probe() are removed. Use gst_pad_add_probe() and
116     gst_pad_remove_probe() for equivalent functionality.
117
118     The have-data signal was removed from pads, it was never supposed to be used
119     without calling the _add_.*_probe() methods.
120
121     The request-link signal was removed. It was never used.
122
123     gst_pad_get_negotiated_caps() -> get_pad_get_current_caps()
124
125     GST_FLOW_UNEXPECTED -> GST_FLOW_EOS
126
127     GstActivateMode -> GstPadActivateMode, GST_ACTIVATE_* -> GST_PAD_ACTIVATE_*
128
129 * GstPadTemplate
130     gst_pad_template_get_caps() returns a new reference of the caps
131     and the return value needs to be unreffed after usage.
132
133     gst_pad_template_new() does not take ownership of the caps anymore.
134
135     GstPadTemplate is now created with a floating ref and
136     gst_element_class_add_pad_template() takes ownership of this floating ref.
137
138     GstPadTemplate instances are considered immutable and must not be
139     changed.
140
141 * GstMiniObject
142     A miniobject is now a simple refcounted structure holding the information
143     common to buffers, events, messages, queries and caps.
144
145     There is no more GST_TYPE_MINIOBJECT as the type for subclasses.
146     G_TYPE_BOXED can be used as the type of all GstMiniObject based types such
147     as buffers, events, messages, caps, etc. Signals, for example, would use the
148     boxed type if the argument include GstMiniObject derived types.
149
150     gst_mini_object_new() is removed. You would allocate memory with the the
151     methods specific for the derived type.
152
153     GstParamSpecMiniObject is removed, use boxed param spec now with the GType
154     of the specific GstMiniObject derived type. Also
155     gst_param_spec_mini_object().
156
157     gst_param_spec_mini_object() -> g_param_spec_boxed()
158
159     The specific gst_value_*_mini_object() methods are removed, used the generic
160     boxed methods instead.
161
162     gst_value_set_mini_object() -> g_value_set_boxed()
163     gst_value_take_mini_object() -> g_value_take_boxed()
164     gst_value_take_get_object() -> g_value_get_boxed()
165     gst_value_take_dup_object() -> g_value_dup_boxed()
166
167     GST_VALUE_HOLDS_MINI_OBJECT() was removed, use G_VALUE_HOLDS_BOXED() or
168     type-specific GST_VALUE_HOLDS_{BUFFER,CAPS,etc.}() instead.
169
170     The GST_MINI_OBJECT_READONLY flag was removed as it used to mark the
171     memory in buffers as READONLY. Marking memory READONLY can now be done
172     with the GstMemory API. Writability of miniobjects is now only done by using
173     the refcount.
174
175 * GstBuffer
176     A GstBuffer is now a simple boxed type this means that subclassing is not
177     possible anymore. 
178
179     To add data to the buffer you would now use gst_buffer_take_memory() with
180     a GstMemory object containing the data. Multiple memory blocks can added to
181     a GstBuffer that can then be retrieved with gst_buffer_peek_memory().
182
183     GST_BUFFER_DATA(), GST_BUFFER_MALLOCDATA(), GST_BUFFER_FREE_FUNC() and
184     GST_BUFFER_SIZE() are gone, along with the fields in GstBuffer. Use the
185     memory API to get access to the buffer data. GST_BUFFER_SIZE() can be
186     replaced with gst_buffer_get_size() but if also access to the data is
187     required, gst_buffer_map() can return both the size and data in one go.
188
189     The most common way to access all the data in a buffer is by using
190     gst_buffer_map() and gst_buffer_unmap(). These calls require you to specify
191     the access mode required to the data and will automatically merge and return
192     a writable copy of the data.
193
194     The buffer must be writable (gst_buffer_is_writable()) in order to modify
195     the fields, metadata or buffer memory. gst_buffer_make_writable() will not
196     automatically make a writable copy of the memory but will instead increase
197     the refcount of the memory. The _map() and _peek_memory() methods will
198     automatically create writable copies when needed.
199     
200     gst_buffer_make_metadata_writable() is gone, you can replace this safely
201     with gst_buffer_make_writable().
202
203     gst_buffer_create_sub() is gone and can be safely replaced with
204     gst_buffer_copy_region(). 
205
206     Changing the size of the buffer data can be done with gst_buffer_resize(),
207     which will also update the metadata fields correctly. gst_buffer_set_size()
208     is #defined to a special case of gst_buffer_resize() with a 0 offset.
209
210     gst_buffer_try_new_and_alloc() is replaced with gst_buffer_new_and_alloc(),
211     which now returns NULL when memory allocation fails.
212
213     GST_BUFFER_CAPS() is gone, caps are not set on buffers anymore but are set
214     on the pads where the buffer is pushed on. Likewise GST_BUFFER_COPY_CAPS is
215     not needed anymore. gst_buffer_get/set_caps() are gone too.
216
217     GST_BUFFER_TIMESTAMP is gone, use GST_BUFFER_PTS or GST_BUFFER_DTS instead.
218     Likewise GST_BUFFER_TIMESTAMP_IS_VALID() was changed to
219     GST_BUFFER_PTS_IS_VALID and GST_BUFFER_DTS_IS_VALID
220
221 * GstBufferList
222     The GstBufferList object is much simplified because most of the
223     functionality in the groups is now part of the GstMemory in buffers.
224     
225     The object is reduced to encapsulating an array of buffers that you can send
226     with the regular gst_pad_push_list. The iterator is not needed anymore
227     because you can simply use gst_buffer_list_length() and gst_buffer_list_get()
228     to iterate the array.
229
230     For dealing with the groups, it's now needed to add the memory blocks to
231     GstBuffer and use the normal buffer API to get and merge the groups.
232
233     gst_buffer_list_sized_new() -> gst_buffer_list_new_sized()
234     gst_buffer_list_len() -> gst_buffer_list_length()
235
236 * GstStructure
237
238     The GArray of the structure fields are moved to private part and are not
239     accessible from the application anymore. Use the methods to retrieve and
240     modify fields from the array.
241
242     gst_structure_empty_new() -> gst_structure_new_empty()
243     gst_structure_id_empty_new() -> gst_structure_new_id_empty()
244     gst_structure_id_new() -> gst_structure_new_id()
245
246 * GstEvent
247     GST_EVENT_SRC is removed. Don't use this anymore.
248
249     gst_event_new_qos_full() -> gst_event_new_qos()
250     gst_event_parse_qos_full() -> gst_event_parse_qos()
251
252     The GstStructure is removed from the public API, use the getters to get
253     a handle to a GstStructure.
254
255     GST_EVENT_NEWSEGMENT -> GST_EVENT_SEGMENT
256
257     gst_event_new_new_segment () -> gst_event_new_segment() and it takes a
258     GstSegment structure as an argument.
259     gst_event_parse_new_segment() -> gst_event_parse_segment() to retrieve the
260     GstSegment structure from the event.
261     gst_event_copy_segment() to fill a GstSegment structure.
262
263 * GstQuery
264     Boxed types derived from GstMiniObject.
265
266     The GstStructure is removed from the public API, use the getters to get
267     a handle to a GstStructure.
268
269     gst_query_new_application() -> gst_query_new_custom()
270
271     gst_query_parse_formats_length() -> gst_query_parse_n_formats()
272     gst_query_parse_formats_nth() -> gst_query_parse_nth_format()
273
274     Some query utility functions no longer use an inout parameter for the
275     destination/query format:
276
277       - gst_pad_query_position()
278       - gst_pad_query_duration()
279       - gst_pad_query_convert()
280       - gst_pad_query_peer_position()
281       - gst_pad_query_peer_duration()
282       - gst_pad_query_peer_convert()
283       - gst_element_query_position()
284       - gst_element_query_duration()
285       - gst_element_query_convert()
286
287 * GstBufferList
288     Is now a boxed type derived from GstMiniObject.
289
290 * GstMessage
291     Is now a boxed type derived from GstMiniObject
292
293     The GstStructure is removed from the public API, use the getters to get
294     a handle to a GstStructure.
295
296 * GstCaps
297     Is now a boxed type derived from GstMiniObject. 
298
299 * GstSegment
300     abs_rate was removed from the public fields, it can be trivially calculated
301     from the rate field.
302
303     accum was renamed to base. last_stop was renamed to position.
304
305     The segment info now contains all the information needed to convert buffer
306     timestamps to running_time and stream_time. There is no more segment
307     accumulation, the GstSegment is completely self contained.
308
309     gst_segment_set_duration() and gst_segment_set_last_stop() are removed,
310     simply modify the structure members duration and position respectively.
311
312     gst_segment_set_newsegment() is removed, it was used to accumulate segments
313     and is not needed anymore, use gst_segment_copy_into() or modify the segment
314     values directly.
315
316     gst_segment_set_seek() -> gst_segment_do_seek(). Updates the segment values
317     with seek parameters.
318
319 * GstPluginFeature
320     GST_PLUGIN_FEATURE_NAME() was removed, use GST_OBJECT_NAME() instead.
321
322 * GstTypeFind
323     gst_type_find_peek() returns a const guint8 * now.
324
325 * GstTask
326
327     gst_task_create() -> gst_task_new()
328
329 * GstAdapter
330     gst_adapter_peek() is removed, use gst_adapter_map() and gst_adapter_unmap()
331     to get access to raw data from the adapter.
332
333     Arguments changed from guint to gsize.
334
335     gst_adapter_prev_timestamp() is removed and should be replaced with
336     gst_adapter_prev_pts() and gst_adapter_prev_dts().
337
338 * GstBitReader, GstByteReader, GstByteWriter
339     gst_*_reader_new_from_buffer(), gst_*_reader_init_from_buffer() removed, get
340     access to the buffer data with _map() and then use the _new() functions.
341
342     gst_byte_reader_new_from_buffer() and gst_byte_reader_init_from_buffer()
343     removed, get access to the buffer data and then use the _new() functions.
344
345 * GstCollectPads
346     gst_collect_pads_read() removed, use _read_buffer() or _take_buffer() and
347     then use the memory API to get to the memory.
348
349 * GstBaseSrc, GstBaseTransform, GstBaseSink
350     GstBaseSrc::get_caps(), GstBaseTransform::transform_caps() and
351     GstBaseSink::get_caps() now take a filter GstCaps* parameter to
352     filter the caps and allow better negotiation decisions.
353  
354 * GstBaseTransform
355     GstBaseTransform::transform_caps() now gets the complete caps passed
356     instead of getting it passed structure by structure.
357
358     GstBaseTransform::event() was renamed to sink_event(). The old function
359     uses the return value to determine if the event should be forwarded or not.
360     The new function has a default implementation that always forwards the event
361     and the return value is simply returned as a result from the event handler.
362     The semantics of the sink_event are thus the same as those for the src_event
363     function.
364
365 * GstImplementsInterface
366     has been removed. Interfaces need to be updated to either have
367     is_ready/usable/available() methods, or have GError arguments
368     to their methods so we can return an appropriate error if a
369     particular interface isn't supported for a particular device.
370
371 * GstIterator
372     uses a GValue based API now that is similar to the 0.10 API but
373     allows bindings to properly use GstIterator and prevents complex
374     return value ownership issues.
375
376 * GstTagList
377     is now an opaque object instead of being typedefed to a GstStructure. Cast
378     to GstStructure or use gst_structure_* API on it at your own peril (it may
379     still work for now, but might be changed in future).
380
381     gst_tag_list_new() has been renamed to gst_tag_list_new_empty().
382     gst_tag_list_new_full*() have been renamed to gst_tag_list_new*().