gstaudiocdsrc.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* GStreamer Audio CD Source Base Class
  2. * Copyright (C) 2005 Tim-Philipp Müller <tim centricular net>
  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_AUDIO_H__
  20. #include <gst/audio/audio.h>
  21. #endif
  22. #ifndef __GST_AUDIO_CD_SRC_H__
  23. #define __GST_AUDIO_CD_SRC_H__
  24. #include <gst/gst.h>
  25. #include <gst/base/gstpushsrc.h>
  26. G_BEGIN_DECLS
  27. #define GST_TYPE_AUDIO_CD_SRC (gst_audio_cd_src_get_type())
  28. #define GST_AUDIO_CD_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrc))
  29. #define GST_AUDIO_CD_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrcClass))
  30. #define GST_IS_AUDIO_CD_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AUDIO_CD_SRC))
  31. #define GST_IS_AUDIO_CD_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AUDIO_CD_SRC))
  32. #define GST_AUDIO_CD_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIO_CD_SRC, GstAudioCdSrcClass))
  33. typedef struct _GstAudioCdSrc GstAudioCdSrc;
  34. typedef struct _GstAudioCdSrcClass GstAudioCdSrcClass;
  35. typedef struct _GstAudioCdSrcTrack GstAudioCdSrcTrack;
  36. typedef struct _GstAudioCdSrcPrivate GstAudioCdSrcPrivate;
  37. /**
  38. * GstAudioCdSrcMode:
  39. * @GST_AUDIO_CD_SRC_MODE_NORMAL : each single track is a stream
  40. * @GST_AUDIO_CD_SRC_MODE_CONTINUOUS : the entire disc is a single stream
  41. *
  42. * Mode in which the CD audio source operates. Influences timestamping,
  43. * EOS handling and seeking.
  44. */
  45. typedef enum {
  46. GST_AUDIO_CD_SRC_MODE_NORMAL, /* stream = one track */
  47. GST_AUDIO_CD_SRC_MODE_CONTINUOUS /* stream = whole disc */
  48. } GstAudioCdSrcMode;
  49. #define GST_TYPE_AUDIO_CD_SRC_MODE (gst_audio_cd_src_mode_get_type ())
  50. /**
  51. * GstAudioCdSrcTrack:
  52. * @is_audio: Whether this is an audio track
  53. * @num: Track number in TOC (usually starts from 1, but not always)
  54. * @start: The first sector of this track (LBA)
  55. * @end: The last sector of this track (LBA)
  56. * @tags: Track-specific tags (e.g. from cd-text information), or NULL
  57. *
  58. * CD track abstraction to communicate TOC entries to the base class.
  59. *
  60. * This structure is only for use by sub-classed in connection with
  61. * gst_audio_cd_src_add_track().
  62. *
  63. * Applications will be informed of the available tracks via a TOC message
  64. * on the pipeline's #GstBus instead.
  65. */
  66. /* FIXME 2.0: remove this struct and pass values directly to _add_track() */
  67. struct _GstAudioCdSrcTrack {
  68. gboolean is_audio; /* TRUE if this is an audio track */
  69. guint num; /* real track number (usually starts from 1) */
  70. guint start; /* first sector of track (LBA, not LSN!) */
  71. guint end; /* last sector of track (LBA, not LSN!) */
  72. GstTagList *tags; /* NULL or tags for track (e.g. from cd-text) */
  73. /*< private >*/
  74. guint _gst_reserved1[GST_PADDING/2];
  75. gpointer _gst_reserved2[GST_PADDING/2];
  76. };
  77. struct _GstAudioCdSrc {
  78. GstPushSrc pushsrc;
  79. /*< protected >*/ /* for use by sub-classes only */
  80. GstTagList *tags; /* tags that apply to all tracks */
  81. /*< private >*/
  82. GstAudioCdSrcPrivate *priv;
  83. /*< private >*/
  84. guint _gst_reserved1[GST_PADDING/2];
  85. gpointer _gst_reserved2[GST_PADDING/2];
  86. };
  87. /**
  88. * GstAudioCdSrcClass:
  89. * @pushsrc_class: the parent class
  90. * @open: opening the device
  91. * @close: closing the device
  92. * @read_sector: reading a sector
  93. * @get_default_device: getting the default device
  94. * @probe_devices: probing possible devices
  95. *
  96. * Audio CD source base class.
  97. */
  98. struct _GstAudioCdSrcClass {
  99. GstPushSrcClass pushsrc_class;
  100. /* open/close the CD device */
  101. gboolean (*open) (GstAudioCdSrc *src, const gchar *device);
  102. void (*close) (GstAudioCdSrc *src);
  103. /* read one sector (LBA) */
  104. GstBuffer * (*read_sector) (GstAudioCdSrc *src, gint sector);
  105. #if 0
  106. /* return default device or NULL (optional) */
  107. gchar * (*get_default_device) (GstAudioCdSrc *src);
  108. /* return NULL-terminated string array of CD devices, or NULL (optional) */
  109. /* FIXME 0.11: reconsider for new probing/device discovery API, remove if in doubt */
  110. gchar ** (*probe_devices) (GstAudioCdSrc *src);
  111. #endif
  112. /*< private >*/
  113. gpointer _gst_reserved[GST_PADDING_LARGE];
  114. };
  115. GType gst_audio_cd_src_get_type (void);
  116. GType gst_audio_cd_src_mode_get_type (void);
  117. gboolean gst_audio_cd_src_add_track (GstAudioCdSrc * src,
  118. GstAudioCdSrcTrack * track);
  119. #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
  120. G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioCdSrc, gst_object_unref)
  121. #endif
  122. G_END_DECLS
  123. #endif /* __GST_AUDIO_CD_SRC_H__ */