avd.h
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:7k
源码类别:

DVD

开发平台:

C/C++

  1. #ifndef __AVD_H
  2. #define __AVD_H
  3. #include "types.h"
  4. #ifndef EXTERN
  5. #define EXTERN extern
  6. #endif
  7. /*
  8. ** MPEG1 AV Decoder States.
  9. */
  10. enum
  11. {
  12.     STATE_IDLE              = 0x00, // 00
  13.     STATE_PLAY              = 0x10, // 10
  14.     STATE_PLAYONEROMSLIDE,          // 11
  15.     STATE_PLAYROMSLIDE,             // 12
  16.     STATE_PLAYSLIDE,                // 13
  17.     STATE_PLAYMP3,                  // 14
  18.     STATE_FAST,                     // 15
  19.     STATE_FREEZE,                   // 16
  20.     STATE_PAUSE,                    // 17
  21.     STATE_PREVIEW,     // 18
  22.     STATE_READCD,
  23.     STATE_SLOWMOTION,
  24.     STATE_SINGLESTEP,
  25.     STATE_FINDFIRSTNAV,
  26.     STATE_FINDFIRSTSEQ,
  27.     STATE_1STREF,
  28.     STATE_REFS, // play reference picture only
  29.     STATE_BACKWARD,
  30.     STATE_SEARCH            = 0x40,
  31. };
  32. /*
  33. ** VARIABLE
  34. ** AVD_state
  35. **
  36. ** MPEG A/V Decoder State
  37. */
  38. EXTERN BYTE AVD_state;
  39. EXTERN UINT8 AVD_playback_state;
  40. EXTERN UINT8 AVD_pause_mode;
  41. EXTERN INT8 AVD_fast_factor;
  42. EXTERN INT8 AVD_slow_factor;
  43. #define AVD_PAUSE_PAUSE 1
  44. #define AVD_PAUSE_STEP 2
  45. #define AVD_PAUSE_OFF 0
  46. //
  47. // LBA state
  48. EXTERN INT8 batch_fast_time;
  49. EXTERN INT8 ready_to_jump;
  50. EXTERN UINT8 VOBU_DIS;
  51. EXTERN UINT8 VOBU_PARSE;
  52. #define SetAVDState(x) (AVD_state=(x))
  53. //
  54. // VARIABLE
  55. // AVD_ctrl_flag
  56. //
  57. // MPEG A/V Decoder State Generated Flags.
  58. //
  59. #define AVD_REALTIME 0x20 /* realtime playback?? */
  60. #define AVD_SLIDE 0x10 /* playing current-decoding */
  61. #define AVD_PREVIEW 0x08 /* 9x9 preview?? */
  62. #define AVD_NOAUDIO 0x04
  63. #define AVD_PLAY_I 0x02 /* play I only */
  64. #define AVD_PLAY_IP 0x01 /* play IP only */
  65. EXTERN UINT8 AVD_ctrl_flag;
  66. #define IsAVDPlayIPB() ((AVD_ctrl_flag & (AVD_PLAY_I|AVD_PLAY_IP))==0)
  67. #define IsAVDRealTime() (AVD_ctrl_flag & AVD_REALTIME)
  68. #define IsAVDPreview() (AVD_ctrl_flag & AVD_PREVIEW)
  69. #define IsAVDSkipB()         0
  70. //
  71. // VARIABLE
  72. //
  73. // program playback state
  74. //
  75. // normal
  76. // fast-forward
  77. // fast-backward
  78. // slow-forward (slow-factor)
  79. // slow-backward (fast-factor)
  80. // step
  81. // pause
  82. //
  83. #define AVDST_PLAYBACK_NORMAL 0x10
  84. #define AVDST_PLAYBACK_FASTFORWARD 0x11
  85. #define AVDST_PLAYBACK_FASTBACKWARD 0x12
  86. #define AVDST_PLAYBACK_SLOWFORWARD 0x13
  87. #define AVDST_PLAYBACK_SLOWBACKWARD 0x14
  88. #define AVDST_PLAYBACK_STEP 0x15
  89. #define AVDST_PLAYBACK_PAUSE 0x16
  90. #define IsAVDPaused()         (P_frame<0)
  91. #define is_avd_playback_step() (P_frame>0)
  92. #define is_avd_playback_pause() (P_frame<0)
  93. #define is_avd_playback_fastforward() (AVD_fast_factor>0)
  94. #define is_avd_playback_fastbackward() (AVD_fast_factor<0)
  95. #define is_avd_playback_slowforward() (AVD_slow_factor>0)
  96. #define is_avd_playback_slowbackward() (AVD_slow_factor<0)
  97. // combo
  98. #define is_avd_playback_step_or_pause() (P_frame!=0)
  99. #define is_avd_playback_slow() (AVD_slow_factor)
  100. #define is_avd_playback_fast() (AVD_fast_factor)
  101. #define is_avd_no_audio() (AVD_ctrl_flag & AVD_NOAUDIO)
  102. #define get_avd_frame_to_play() (P_frame)
  103. #define set_avd_frame_to_play(n) (P_frame = (n))
  104. #define is_avd_play_romslide()          (AVD_state==STATE_PLAYROMSLIDE 
  105.                                         || AVD_state==STATE_PLAYONEROMSLIDE)
  106. #define is_avd_preview()                (IsAVDPreview())
  107. //
  108. // VARIABLE
  109. // AVD_video_flag
  110. //
  111. // video bitstream level status.
  112. //
  113. // 1. NTSC/PAL frame-rate
  114. // 2. NTSC/PAL size
  115. //
  116. EXTERN UINT8 AVD_video_flags;
  117. // decode type
  118. #define AVD_VIDEO_FRAMERATE_UNKNOWN 0
  119. #define AVD_VIDEO_FRAMERATE_NTSC        1
  120. #define AVD_VIDEO_FRAMERATE_PAL 2
  121. #define AVD_VIDEO_FRAMERATE_MOVIE 3
  122. #define AVD_VIDEO_FRAMERATE_MASK        3
  123. // decode size
  124. #define AVD_VIDEO_SIZE_PAL              (1<<2)
  125. #define AVD_VIDEO_SIZE_MASK             (1<<2)
  126. // decode framerate
  127. #define AVD_VIDEO_FRAMERATE             (1<<7)
  128. //
  129. // VARIABLE
  130. // AVD_video_status
  131. //
  132. // AVD_VIDEO_DECODED        has start to decoding at least 1 frame
  133. // AVD_VIDEO_DECODED_MULTI  has start to decoding more then 1 frame
  134. //
  135. EXTERN UINT8 AVD_video_status;
  136. #define AVD_VIDEO_DECODED (1<<2)
  137. #define AVD_VIDEO_DECODED_MULTI (1<<3)
  138. #define avd_set_decoded()
  139. do {    
  140.             unsigned status = AVD_video_status;     
  141.             if (status&AVD_VIDEO_DECODED) status |= AVD_VIDEO_DECODED_MULTI;    
  142.             AVD_video_status = status | AVD_VIDEO_DECODED;  
  143. } while (0)
  144. #define is_avd_decoded() (AVD_video_status & AVD_VIDEO_DECODED)
  145. #define is_avd_decoded_first() ((AVD_video_status & (AVD_VIDEO_DECODED|AVD_VIDEO_DECODED_MULTI))==AVD_VIDEO_DECODED)
  146. //
  147. // VARIABLE
  148. // AVD_media_status
  149. //
  150. // indicate current playback interrupt/timeout/end/error
  151. //
  152. // AVD_MEDIA_TIMEOUT
  153. // request to stop playback as soon as possible
  154. //
  155. // AVD_MEDIA_INTERRUPT
  156. // request to stop playback immediately
  157. //
  158. // AVD_MEDIA_ERROR
  159. // internal error, stop playback immediately.
  160. //
  161. #define AVD_MEDIA_TIMEOUT (1<<0)
  162. #define AVD_MEDIA_INTERRUPT (1<<1)
  163. #define AVD_MEDIA_ERROR (1<<7)
  164. EXTERN UINT8 AVD_media_status;
  165. int IsAVDMediaTimeout(void);
  166. int IsAVDMediaInterrupt(void);
  167. int IsAVDMediaError(void);
  168. int AVD_SetMediaTimeout(void);
  169. int AVD_SetMediaInterrupt(void);
  170. int AVD_SetMediaError(void);
  171. void AVD_ResetMediaStatus(void);
  172. //
  173. // VARIABLE
  174. // avd_src_realtime()
  175. //
  176. // DESCRIPTION
  177. // source is to be playbacked in realtime control
  178. // (rom-based slide has no realtime control)
  179. //
  180. EXTERN  UINT8   avd_src_realtime;
  181. #define is_avd_src_realtime() (avd_src_realtime)
  182. //
  183. // is_avd_tv_auto()
  184. // decide if we have to do tv-format auto-switching
  185. // don't auto-switch tv-format when (preview or rom-based title/fixed-sequence)
  186. //
  187. #define is_avd_tv_auto() (!(is_avd_play_romslide() || is_avd_preview()))
  188. EXTERN UINT8 avd_slow_factor;
  189. void avd_idle_state();
  190. void avd_play_state();
  191. void avd_fast_state();
  192. void avd_preview_state(void);
  193. void avd_playoneromslide_state(void);
  194. void avd_playromslide_state(void);
  195. void avd_pause_on();
  196. void avd_pause_off();
  197. void avd_step_state(int);
  198. void avd_slow_state(int);
  199. #define avd_play_frame(n) avd_step_state(n)
  200. #define avd_slow(n) avd_slow_state(n)
  201. //
  202. // VARIABLE
  203. // avd_interpolation
  204. // Display-Interpolation
  205. //
  206. #define AVD_DISP_INTP_AUTO 0
  207. #define AVD_DISP_INTP_PROGRESSIVE 1
  208. #define AVD_DISP_INTP_SINGLE 2
  209. EXTERN UINT8 avd_interpolation;
  210. #define avd_disp_intp_mode(md) (avd_interpolation = (md))
  211. #define is_avd_forced_progressive() (avd_interpolation==AVD_DISP_INTP_PROGRESSIVE)
  212. #define is_avd_forced_single() (avd_interpolation==AVD_DISP_INTP_SINGLE)
  213. //
  214. // VARIABLE
  215. // avd_pause_interpolation
  216. // Display-Interpolation during pause
  217. // (same definition as avd_interpolation)
  218. //
  219. EXTERN UINT8 avd_pause_interpolation;
  220. #define avd_disp_pause_intp_mode(md) (avd_pause_interpolation = (md))
  221. //
  222. // vcd/dvd
  223. #define avd_is_vcd() (cd_type_loaded==CDVCD20 || cd_type_loaded==CDVCD10)
  224. #define avd_is_dvd() (cd_type_loaded==CDDVD)
  225. #define avd_is_cdrom() (cd_type_loaded==CDROM)
  226. #define avd_is_svcd() (cd_type_loaded==CDSVCD)
  227. #define avd_is_cvd() (cd_type_loaded==CDCVD)
  228. #define avd_is_cdda() (cd_type_loaded==CDDA)
  229. extern  int avd_is_midi(void);
  230. #endif/*__AVD_H*/