ijksdl_aout.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*****************************************************************************
  2. * ijksdl_aout.h
  3. *****************************************************************************
  4. *
  5. * Copyright (c) 2013 Bilibili
  6. * copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
  7. *
  8. * This file is part of ijkPlayer.
  9. *
  10. * ijkPlayer is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation; either
  13. * version 2.1 of the License, or (at your option) any later version.
  14. *
  15. * ijkPlayer is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with ijkPlayer; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. #ifndef IJKSDL__IJKSDL_AOUT_H
  25. #define IJKSDL__IJKSDL_AOUT_H
  26. #include "ijksdl_audio.h"
  27. #include "ijksdl_class.h"
  28. #include "ijksdl_mutex.h"
  29. typedef struct SDL_Aout_Opaque SDL_Aout_Opaque;
  30. typedef struct SDL_Aout SDL_Aout;
  31. struct SDL_Aout {
  32. SDL_mutex *mutex;
  33. double minimal_latency_seconds;
  34. SDL_Class *opaque_class;
  35. SDL_Aout_Opaque *opaque;
  36. void (*free_l)(SDL_Aout *vout);
  37. int (*open_audio)(SDL_Aout *aout, const SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
  38. void (*pause_audio)(SDL_Aout *aout, int pause_on);
  39. void (*flush_audio)(SDL_Aout *aout);
  40. void (*set_volume)(SDL_Aout *aout, float left, float right);
  41. void (*close_audio)(SDL_Aout *aout);
  42. double (*func_get_latency_seconds)(SDL_Aout *aout);
  43. void (*func_set_default_latency_seconds)(SDL_Aout *aout, double latency);
  44. // optional
  45. void (*func_set_playback_rate)(SDL_Aout *aout, float playbackRate);
  46. void (*func_set_playback_volume)(SDL_Aout *aout, float playbackVolume);
  47. int (*func_get_audio_persecond_callbacks)(SDL_Aout *aout);
  48. // Android only
  49. int (*func_get_audio_session_id)(SDL_Aout *aout);
  50. };
  51. int SDL_AoutOpenAudio(SDL_Aout *aout, const SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
  52. void SDL_AoutPauseAudio(SDL_Aout *aout, int pause_on);
  53. void SDL_AoutFlushAudio(SDL_Aout *aout);
  54. void SDL_AoutSetStereoVolume(SDL_Aout *aout, float left_volume, float right_volume);
  55. void SDL_AoutCloseAudio(SDL_Aout *aout);
  56. void SDL_AoutFree(SDL_Aout *aout);
  57. void SDL_AoutFreeP(SDL_Aout **paout);
  58. double SDL_AoutGetLatencySeconds(SDL_Aout *aout);
  59. void SDL_AoutSetDefaultLatencySeconds(SDL_Aout *aout, double latency);
  60. int SDL_AoutGetAudioPerSecondCallBacks(SDL_Aout *aout);
  61. // optional
  62. void SDL_AoutSetPlaybackRate(SDL_Aout *aout, float playbackRate);
  63. void SDL_AoutSetPlaybackVolume(SDL_Aout *aout, float volume);
  64. // android only
  65. int SDL_AoutGetAudioSessionId(SDL_Aout *aout);
  66. #endif