gstaudiometa.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* GStreamer
  2. * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
  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 2 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, write to the
  16. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. #ifndef __GST_AUDIO_META_H__
  20. #define __GST_AUDIO_META_H__
  21. #include <gst/audio/audio.h>
  22. G_BEGIN_DECLS
  23. #define GST_AUDIO_DOWNMIX_META_API_TYPE (gst_audio_downmix_meta_api_get_type())
  24. #define GST_AUDIO_DOWNMIX_META_INFO (gst_audio_downmix_meta_get_info())
  25. typedef struct _GstAudioDownmixMeta GstAudioDownmixMeta;
  26. /**
  27. * GstAudioDownmixMeta:
  28. * @meta: parent #GstMeta
  29. * @from_position: the channel positions of the source
  30. * @to_position: the channel positions of the destination
  31. * @from_channels: the number of channels of the source
  32. * @to_channels: the number of channels of the destination
  33. * @matrix: the matrix coefficients.
  34. *
  35. * Extra buffer metadata describing audio downmixing matrix. This metadata is
  36. * attached to audio buffers and contains a matrix to downmix the buffer number
  37. * of channels to @channels.
  38. *
  39. * @matrix is an two-dimensional array of @to_channels times @from_channels
  40. * coefficients, i.e. the i-th output channels is constructed by multiplicating
  41. * the input channels with the coefficients in @matrix[i] and taking the sum
  42. * of the results.
  43. */
  44. struct _GstAudioDownmixMeta {
  45. GstMeta meta;
  46. GstAudioChannelPosition *from_position;
  47. GstAudioChannelPosition *to_position;
  48. gint from_channels, to_channels;
  49. gfloat **matrix;
  50. };
  51. GType gst_audio_downmix_meta_api_get_type (void);
  52. const GstMetaInfo * gst_audio_downmix_meta_get_info (void);
  53. #define gst_buffer_get_audio_downmix_meta(b) ((GstAudioDownmixMeta*)gst_buffer_get_meta((b), GST_AUDIO_DOWNMIX_META_API_TYPE))
  54. GstAudioDownmixMeta * gst_buffer_get_audio_downmix_meta_for_channels (GstBuffer *buffer,
  55. const GstAudioChannelPosition *to_position,
  56. gint to_channels);
  57. GstAudioDownmixMeta * gst_buffer_add_audio_downmix_meta (GstBuffer *buffer,
  58. const GstAudioChannelPosition *from_position,
  59. gint from_channels,
  60. const GstAudioChannelPosition *to_position,
  61. gint to_channels,
  62. const gfloat **matrix);
  63. #define GST_AUDIO_CLIPPING_META_API_TYPE (gst_audio_clipping_meta_api_get_type())
  64. #define GST_AUDIO_CLIPPING_META_INFO (gst_audio_clipping_meta_get_info())
  65. typedef struct _GstAudioClippingMeta GstAudioClippingMeta;
  66. /**
  67. * GstAudioClippingMeta:
  68. * @meta: parent #GstMeta
  69. * @format: GstFormat of @start and @stop, GST_FORMAT_DEFAULT is samples
  70. * @start: Amount of audio to clip from start of buffer
  71. * @end: Amount of to clip from end of buffer
  72. *
  73. * Extra buffer metadata describing how much audio has to be clipped from
  74. * the start or end of a buffer. This is used for compressed formats, where
  75. * the first frame usually has some additional samples due to encoder and
  76. * decoder delays, and the last frame usually has some additional samples to
  77. * be able to fill the complete last frame.
  78. *
  79. * This is used to ensure that decoded data in the end has the same amount of
  80. * samples, and multiply decoded streams can be gaplessly concatenated.
  81. *
  82. * Note: If clipping of the start is done by adjusting the segment, this meta
  83. * has to be dropped from buffers as otherwise clipping could happen twice.
  84. *
  85. * Since: 1.8
  86. */
  87. struct _GstAudioClippingMeta {
  88. GstMeta meta;
  89. GstFormat format;
  90. guint64 start;
  91. guint64 end;
  92. };
  93. GType gst_audio_clipping_meta_api_get_type (void);
  94. const GstMetaInfo * gst_audio_clipping_meta_get_info (void);
  95. #define gst_buffer_get_audio_clipping_meta(b) ((GstAudioClippingMeta*)gst_buffer_get_meta((b), GST_AUDIO_CLIPPING_META_API_TYPE))
  96. GstAudioClippingMeta * gst_buffer_add_audio_clipping_meta (GstBuffer *buffer,
  97. GstFormat format,
  98. guint64 start,
  99. guint64 end);
  100. G_END_DECLS
  101. #endif /* __GST_AUDIO_META_H__ */