codec-utils.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* GStreamer base utils library codec-specific utility functions
  2. * Copyright (C) 2010 Arun Raghavan <arun.raghavan@collabora.co.uk>
  3. * 2010 Collabora Multimedia
  4. * 2010 Nokia Corporation
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  19. * Boston, MA 02110-1301, USA.
  20. */
  21. #ifndef __GST_PB_UTILS_CODEC_UTILS_H__
  22. #define __GST_PB_UTILS_CODEC_UTILS_H__
  23. #include <gst/gst.h>
  24. G_BEGIN_DECLS
  25. /* AAC */
  26. guint gst_codec_utils_aac_get_sample_rate_from_index (guint sr_idx);
  27. gint gst_codec_utils_aac_get_index_from_sample_rate (guint rate);
  28. const gchar * gst_codec_utils_aac_get_profile (const guint8 * audio_config, guint len);
  29. const gchar * gst_codec_utils_aac_get_level (const guint8 * audio_config, guint len);
  30. gboolean gst_codec_utils_aac_caps_set_level_and_profile (GstCaps * caps,
  31. const guint8 * audio_config,
  32. guint len);
  33. /* H.264 */
  34. const gchar * gst_codec_utils_h264_get_profile (const guint8 * sps, guint len);
  35. const gchar * gst_codec_utils_h264_get_level (const guint8 * sps, guint len);
  36. guint8 gst_codec_utils_h264_get_level_idc (const gchar * level);
  37. gboolean gst_codec_utils_h264_caps_set_level_and_profile (GstCaps * caps,
  38. const guint8 * sps,
  39. guint len);
  40. /* H.265 */
  41. const gchar * gst_codec_utils_h265_get_profile (const guint8 * profile_tier_level,
  42. guint len);
  43. const gchar * gst_codec_utils_h265_get_tier (const guint8 * profile_tier_level,
  44. guint len);
  45. const gchar * gst_codec_utils_h265_get_level (const guint8 * profile_tier_level,
  46. guint len);
  47. guint8 gst_codec_utils_h265_get_level_idc (const gchar * level);
  48. gboolean gst_codec_utils_h265_caps_set_level_tier_and_profile (GstCaps * caps,
  49. const guint8 * profile_tier_level,
  50. guint len);
  51. /* MPEG-4 part 2 */
  52. const gchar * gst_codec_utils_mpeg4video_get_profile (const guint8 * vis_obj_seq, guint len);
  53. const gchar * gst_codec_utils_mpeg4video_get_level (const guint8 * vis_obj_seq, guint len);
  54. gboolean gst_codec_utils_mpeg4video_caps_set_level_and_profile (GstCaps * caps,
  55. const guint8 * vis_obj_seq,
  56. guint len);
  57. /* Opus */
  58. gboolean gst_codec_utils_opus_parse_caps (GstCaps * caps,
  59. guint32 * rate,
  60. guint8 * channels,
  61. guint8 * channel_mapping_family,
  62. guint8 * stream_count,
  63. guint8 * coupled_count,
  64. guint8 channel_mapping[256]);
  65. GstCaps * gst_codec_utils_opus_create_caps (guint32 rate,
  66. guint8 channels,
  67. guint8 channel_mapping_family,
  68. guint8 stream_count,
  69. guint8 coupled_count,
  70. const guint8 * channel_mapping);
  71. GstCaps * gst_codec_utils_opus_create_caps_from_header (GstBuffer * header, GstBuffer * comments);
  72. GstBuffer * gst_codec_utils_opus_create_header (guint32 rate,
  73. guint8 channels,
  74. guint8 channel_mapping_family,
  75. guint8 stream_count,
  76. guint8 coupled_count,
  77. const guint8 * channel_mapping,
  78. guint16 pre_skip,
  79. gint16 output_gain);
  80. gboolean gst_codec_utils_opus_parse_header (GstBuffer * header,
  81. guint32 * rate,
  82. guint8 * channels,
  83. guint8 * channel_mapping_family,
  84. guint8 * stream_count,
  85. guint8 * coupled_count,
  86. guint8 channel_mapping[256],
  87. guint16 * pre_skip,
  88. gint16 * output_gain);
  89. G_END_DECLS
  90. #endif /* __GST_PB_UTILS_CODEC_UTILS_H__ */