gstcompat.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* GStreamer
  2. * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
  3. * 2004 Wim Taymans <wim@fluendo.com>
  4. *
  5. * gstcompat.h: backwards compatibility stuff
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  20. * Boston, MA 02110-1301, USA.
  21. */
  22. /* API compatibility stuff */
  23. #ifndef __GSTCOMPAT_H__
  24. #define __GSTCOMPAT_H__
  25. /**
  26. * SECTION:gstcompat
  27. * @short_description: Deprecated API entries
  28. *
  29. * Please do not use these in new code.
  30. * These symbols are only available by defining GST_DISABLE_DEPRECATED.
  31. * This can be done in CFLAGS for compiling old code.
  32. */
  33. #include <glib.h>
  34. #include <gst/gstpad.h>
  35. G_BEGIN_DECLS
  36. #define gst_buffer_new_and_alloc(s) gst_buffer_new_allocate(NULL, s, NULL)
  37. #define GST_BUFFER_TIMESTAMP GST_BUFFER_PTS
  38. #define GST_BUFFER_TIMESTAMP_IS_VALID GST_BUFFER_PTS_IS_VALID
  39. static inline gboolean
  40. gst_pad_set_caps (GstPad * pad, GstCaps * caps)
  41. {
  42. GstEvent *event;
  43. gboolean res = TRUE;
  44. g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
  45. g_return_val_if_fail (caps != NULL && gst_caps_is_fixed (caps), FALSE);
  46. event = gst_event_new_caps (caps);
  47. if (GST_PAD_IS_SRC (pad))
  48. res = gst_pad_push_event (pad, event);
  49. else
  50. res = gst_pad_send_event (pad, event);
  51. return res;
  52. }
  53. #ifndef GST_DISABLE_DEPRECATED
  54. /* added to ease the transition to 0.11 */
  55. #define gst_element_class_set_details_simple gst_element_class_set_metadata
  56. #define gst_element_factory_get_longname(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_LONGNAME)
  57. #define gst_element_factory_get_klass(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_KLASS)
  58. #define gst_element_factory_get_description(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_DESCRIPTION)
  59. #define gst_element_factory_get_author(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_AUTHOR)
  60. #define gst_element_factory_get_documentation_uri(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_DOC_URI)
  61. #define gst_element_factory_get_icon_name(f) gst_element_factory_get_metadata(f, GST_ELEMENT_METADATA_ICON_NAME)
  62. #define gst_pad_get_caps_reffed(p) gst_pad_get_caps(p)
  63. #define gst_pad_peer_get_caps_reffed(p) gst_pad_peer_get_caps(p)
  64. #define gst_adapter_prev_timestamp gst_adapter_prev_pts
  65. #define gst_tag_list_free(taglist) gst_tag_list_unref(taglist)
  66. #define GST_MESSAGE_DURATION GST_MESSAGE_DURATION_CHANGED
  67. #define gst_message_new_duration(src,fmt,dur) \
  68. gst_message_new_duration_changed(src)
  69. #define gst_message_parse_duration(msg,fmt,dur) \
  70. G_STMT_START { \
  71. GstFormat *p_fmt = fmt; \
  72. gint64 *p_dur = dur; \
  73. if (p_fmt) \
  74. *p_fmt = GST_FORMAT_TIME; \
  75. if (p_dur) \
  76. *p_dur = GST_CLOCK_TIME_NONE; \
  77. } G_STMT_END
  78. #endif /* not GST_DISABLE_DEPRECATED */
  79. G_END_DECLS
  80. #endif /* __GSTCOMPAT_H__ */