webOS Userland
Native system APIs for webOS
NDL_directmedia_v1.h
1 /* NDL DirectMedia API 1 (pre-webOS 5) */
2 
3 #pragma once
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 #ifndef NDL_DIRECTMEDIA_API_VERSION
10 # define NDL_DIRECTMEDIA_API_VERSION 1
11 #elif (NDL_DIRECTMEDIA_API_VERSION != 1)
12 # error "this header requires NDL_DIRECTMEDIA_API_VERSION 1"
13 #endif
14 
15 #include "NDL_directmedia_common.h"
16 
17 static inline __attribute__((__const__)) NDL_DIRECTAUDIO_SAMPLING_FREQ NDL_DIRECTAUDIO_SAMPLING_FREQ_OF(int hertz) {
18  switch (hertz) {
19  case 4000:
20  return NDL_DIRECTAUDIO_SAMPLING_FREQ_4_KHZ;
21  case 8000:
22  return NDL_DIRECTAUDIO_SAMPLING_FREQ_8_KHZ;
23  case 11025:
24  return NDL_DIRECTAUDIO_SAMPLING_FREQ_11_025KHZ;
25  case 12000:
26  return NDL_DIRECTAUDIO_SAMPLING_FREQ_12_KHZ;
27  case 16000:
28  return NDL_DIRECTAUDIO_SAMPLING_FREQ_16_KHZ;
29  case 22050:
30  return NDL_DIRECTAUDIO_SAMPLING_FREQ_22_05KHZ;
31  case 24000:
32  return NDL_DIRECTAUDIO_SAMPLING_FREQ_24_KHZ;
33  case 32000:
34  return NDL_DIRECTAUDIO_SAMPLING_FREQ_32_KHZ;
35  case 44100:
36  return NDL_DIRECTAUDIO_SAMPLING_FREQ_44_1KHZ;
37  case 48000:
38  return NDL_DIRECTAUDIO_SAMPLING_FREQ_48_KHZ;
39  case 64000:
40  return NDL_DIRECTAUDIO_SAMPLING_FREQ_64_KHZ;
41  default:
42  return NDL_DIRECTAUDIO_SAMPLING_FREQ_NONE;
43  }
44 }
45 
46 typedef void (*NDLVideoPlayCallback)(unsigned long long);
47 
51 int NDL_DirectAudioOpen(NDL_DIRECTAUDIO_DATA_INFO_T *data);
52 
57 int NDL_DirectAudioClose(void);
58 
66 int NDL_DirectAudioPlay(void *buffer, unsigned int size);
67 
71 int NDL_DirectAudioResume(void);
72 
76 int NDL_DirectAudioPause(void);
77 
83 int NDL_DirectAudioCheckBufferSize(unsigned int *remain);
84 
88 int NDL_DirectVideoOpen(NDL_DIRECTVIDEO_DATA_INFO_T *data);
89 
93 int NDL_DirectVideoClose(void);
94 
102 int NDL_DirectVideoPlay(void *buffer, unsigned int size);
103 
107 int NDL_DirectVideoStop(void);
108 
112 int NDL_DirectVideoSetCallback(NDLVideoPlayCallback cb);
113 
117 int NDL_DirectVideoPlayWithCallback(const void *buffer, unsigned int size, unsigned long long userdata);
118 
119 #ifdef __cplusplus
120 }
121 #endif
Definition: NDL_directmedia_types.h:78
Definition: NDL_directmedia_types.h:91