gstplayer.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /* GStreamer
  2. *
  3. * Copyright (C) 2014-2015 Sebastian Dröge <sebastian@centricular.com>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public
  16. * License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef __GST_PLAYER_H__
  21. #define __GST_PLAYER_H__
  22. #include <gst/gst.h>
  23. #include <gst/player/gstplayer-types.h>
  24. #include <gst/player/gstplayer-signal-dispatcher.h>
  25. #include <gst/player/gstplayer-video-renderer.h>
  26. #include <gst/player/gstplayer-media-info.h>
  27. G_BEGIN_DECLS
  28. GType gst_player_state_get_type (void);
  29. #define GST_TYPE_PLAYER_STATE (gst_player_state_get_type ())
  30. /**
  31. * GstPlayerState:
  32. * @GST_PLAYER_STATE_STOPPED: the player is stopped.
  33. * @GST_PLAYER_STATE_BUFFERING: the player is buffering.
  34. * @GST_PLAYER_STATE_PAUSED: the player is paused.
  35. * @GST_PLAYER_STATE_PLAYING: the player is currently playing a
  36. * stream.
  37. */
  38. typedef enum
  39. {
  40. GST_PLAYER_STATE_STOPPED,
  41. GST_PLAYER_STATE_BUFFERING,
  42. GST_PLAYER_STATE_PAUSED,
  43. GST_PLAYER_STATE_PLAYING
  44. } GstPlayerState;
  45. const gchar *gst_player_state_get_name (GstPlayerState state);
  46. GQuark gst_player_error_quark (void);
  47. GType gst_player_error_get_type (void);
  48. #define GST_PLAYER_ERROR (gst_player_error_quark ())
  49. #define GST_TYPE_PLAYER_ERROR (gst_player_error_get_type ())
  50. /**
  51. * GstPlayerError:
  52. * @GST_PLAYER_ERROR_FAILED: generic error.
  53. */
  54. typedef enum {
  55. GST_PLAYER_ERROR_FAILED = 0
  56. } GstPlayerError;
  57. const gchar *gst_player_error_get_name (GstPlayerError error);
  58. GType gst_player_color_balance_type_get_type (void);
  59. #define GST_TYPE_PLAYER_COLOR_BALANCE_TYPE (gst_player_color_balance_type_get_type ())
  60. /**
  61. * GstPlayerColorBalanceType:
  62. * @GST_PLAYER_COLOR_BALANCE_BRIGHTNESS: brightness or black level.
  63. * @GST_PLAYER_COLOR_BALANCE_CONTRAST: contrast or luma gain.
  64. * @GST_PLAYER_COLOR_BALANCE_SATURATION: color saturation or chroma
  65. * gain.
  66. * @GST_PLAYER_COLOR_BALANCE_HUE: hue or color balance.
  67. */
  68. typedef enum
  69. {
  70. GST_PLAYER_COLOR_BALANCE_BRIGHTNESS,
  71. GST_PLAYER_COLOR_BALANCE_CONTRAST,
  72. GST_PLAYER_COLOR_BALANCE_SATURATION,
  73. GST_PLAYER_COLOR_BALANCE_HUE,
  74. } GstPlayerColorBalanceType;
  75. const gchar *gst_player_color_balance_type_get_name (GstPlayerColorBalanceType type);
  76. #define GST_TYPE_PLAYER (gst_player_get_type ())
  77. #define GST_IS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAYER))
  78. #define GST_IS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAYER))
  79. #define GST_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAYER, GstPlayerClass))
  80. #define GST_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAYER, GstPlayer))
  81. #define GST_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAYER, GstPlayerClass))
  82. #define GST_PLAYER_CAST(obj) ((GstPlayer*)(obj))
  83. GType gst_player_get_type (void);
  84. GstPlayer * gst_player_new (GstPlayerVideoRenderer * video_renderer, GstPlayerSignalDispatcher * signal_dispatcher);
  85. void gst_player_play (GstPlayer * player);
  86. void gst_player_pause (GstPlayer * player);
  87. void gst_player_stop (GstPlayer * player);
  88. void gst_player_seek (GstPlayer * player,
  89. GstClockTime position);
  90. void gst_player_set_rate (GstPlayer * player,
  91. gdouble rate);
  92. gdouble gst_player_get_rate (GstPlayer * player);
  93. void gst_player_set_position_update_interval (GstPlayer * player,
  94. guint interval);
  95. guint gst_player_get_position_update_interval (GstPlayer * player);
  96. gchar * gst_player_get_uri (GstPlayer * player);
  97. void gst_player_set_uri (GstPlayer * player,
  98. const gchar * uri);
  99. GstClockTime gst_player_get_position (GstPlayer * player);
  100. GstClockTime gst_player_get_duration (GstPlayer * player);
  101. gdouble gst_player_get_volume (GstPlayer * player);
  102. void gst_player_set_volume (GstPlayer * player,
  103. gdouble val);
  104. gboolean gst_player_get_mute (GstPlayer * player);
  105. void gst_player_set_mute (GstPlayer * player,
  106. gboolean val);
  107. GstElement * gst_player_get_pipeline (GstPlayer * player);
  108. void gst_player_set_video_track_enabled (GstPlayer * player,
  109. gboolean enabled);
  110. void gst_player_set_audio_track_enabled (GstPlayer * player,
  111. gboolean enabled);
  112. void gst_player_set_subtitle_track_enabled (GstPlayer * player,
  113. gboolean enabled);
  114. gboolean gst_player_set_audio_track (GstPlayer *player,
  115. gint stream_index);
  116. gboolean gst_player_set_video_track (GstPlayer *player,
  117. gint stream_index);
  118. gboolean gst_player_set_subtitle_track (GstPlayer *player,
  119. gint stream_index);
  120. GstPlayerMediaInfo * gst_player_get_media_info (GstPlayer * player);
  121. GstPlayerAudioInfo * gst_player_get_current_audio_track
  122. (GstPlayer * player);
  123. GstPlayerVideoInfo * gst_player_get_current_video_track
  124. (GstPlayer * player);
  125. GstPlayerSubtitleInfo * gst_player_get_current_subtitle_track
  126. (GstPlayer * player);
  127. gboolean gst_player_set_subtitle_uri (GstPlayer * player,
  128. const gchar *uri);
  129. gchar * gst_player_get_subtitle_uri (GstPlayer * player);
  130. gboolean gst_player_set_visualization (GstPlayer * player,
  131. const gchar *name);
  132. void gst_player_set_visualization_enabled (GstPlayer * player,
  133. gboolean enabled);
  134. gchar * gst_player_get_current_visualization (GstPlayer * player);
  135. gboolean gst_player_has_color_balance (GstPlayer * player);
  136. void gst_player_set_color_balance (GstPlayer * player,
  137. GstPlayerColorBalanceType type,
  138. gdouble value);
  139. gdouble gst_player_get_color_balance (GstPlayer * player,
  140. GstPlayerColorBalanceType type);
  141. G_END_DECLS
  142. #endif /* __GST_PLAYER_H__ */