ijksdl_codec_android_mediadef.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*****************************************************************************
  2. * ijksdl_codec_android_mediadef.h
  3. *****************************************************************************
  4. *
  5. * Copyright (c) 2014 Bilibili
  6. * copyright (c) 2014 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_ANDROID__ANDROID_CODEC_ANDROID_MEDIADEF_H
  25. #define IJKSDL_ANDROID__ANDROID_CODEC_ANDROID_MEDIADEF_H
  26. #include "../ijksdl_misc.h"
  27. typedef enum sdl_amedia_status_t {
  28. SDL_AMEDIA_OK = 0,
  29. SDL_AMEDIA_ERROR_BASE = -10000,
  30. SDL_AMEDIA_ERROR_UNKNOWN = SDL_AMEDIA_ERROR_BASE,
  31. SDL_AMEDIA_ERROR_MALFORMED = SDL_AMEDIA_ERROR_BASE - 1,
  32. SDL_AMEDIA_ERROR_UNSUPPORTED = SDL_AMEDIA_ERROR_BASE - 2,
  33. SDL_AMEDIA_ERROR_INVALID_OBJECT = SDL_AMEDIA_ERROR_BASE - 3,
  34. SDL_AMEDIA_ERROR_INVALID_PARAMETER = SDL_AMEDIA_ERROR_BASE - 4,
  35. SDL_AMEDIA_DRM_ERROR_BASE = -20000,
  36. SDL_AMEDIA_DRM_NOT_PROVISIONED = SDL_AMEDIA_DRM_ERROR_BASE - 1,
  37. SDL_AMEDIA_DRM_RESOURCE_BUSY = SDL_AMEDIA_DRM_ERROR_BASE - 2,
  38. SDL_AMEDIA_DRM_DEVICE_REVOKED = SDL_AMEDIA_DRM_ERROR_BASE - 3,
  39. SDL_AMEDIA_DRM_SHORT_BUFFER = SDL_AMEDIA_DRM_ERROR_BASE - 4,
  40. SDL_AMEDIA_DRM_SESSION_NOT_OPENED = SDL_AMEDIA_DRM_ERROR_BASE - 5,
  41. SDL_AMEDIA_DRM_TAMPER_DETECTED = SDL_AMEDIA_DRM_ERROR_BASE - 6,
  42. SDL_AMEDIA_DRM_VERIFY_FAILED = SDL_AMEDIA_DRM_ERROR_BASE - 7,
  43. SDL_AMEDIA_DRM_NEED_KEY = SDL_AMEDIA_DRM_ERROR_BASE - 8,
  44. SDL_AMEDIA_DRM_LICENSE_EXPIRED = SDL_AMEDIA_DRM_ERROR_BASE - 9,
  45. } sdl_amedia_status_t;
  46. #define SDL_AMIME_VIDEO_VP8 "video/x-vnd.on2.vp8" //- VP8 video (i.e. video in .webm)
  47. #define SDL_AMIME_VIDEO_VP9 "video/x-vnd.on2.vp9" //- VP9 video (i.e. video in .webm)
  48. #define SDL_AMIME_VIDEO_AVC "video/avc" //- H.264/AVC video
  49. #define SDL_AMIME_VIDEO_HEVC "video/hevc" //- H.265/HEVC video
  50. #define SDL_AMIME_VIDEO_MPEG2VIDEO "video/mpeg2" //- MPEG2 video
  51. #define SDL_AMIME_VIDEO_MPEG4 "video/mp4v-es" //- MPEG4 video
  52. #define SDL_AMIME_VIDEO_H263 "video/3gpp" //- H.263 video
  53. #define SDL_AMIME_AUDIO_AMR_NB "audio/3gpp" //- AMR narrowband audio
  54. #define SDL_AMIME_AUDIO_AMR_WB "audio/amr-wb" //- AMR wideband audio
  55. #define SDL_AMIME_AUDIO_MP3 "audio/mpeg" //- MPEG1/2 audio layer III
  56. #define SDL_AMIME_AUDIO_RAW_AAC "audio/mp4a-latm" //- AAC audio (note, this is raw AAC packets, not packaged in LATM!)
  57. #define SDL_AMIME_AUDIO_VORBIS "audio/vorbis" //- vorbis audio
  58. #define SDL_AMIME_AUDIO_G711_ALAW "audio/g711-alaw" //- G.711 alaw audio
  59. #define SDL_AMIME_AUDIO_G711_MLAW "audio/g711-mlaw" //- G.711 ulaw audio
  60. #if 0
  61. typedef enum sdl_amedia_format_key_t {
  62. AMEDIAFORMAT_KEY_AAC_PROFILE,
  63. AMEDIAFORMAT_KEY_BIT_RATE,
  64. AMEDIAFORMAT_KEY_CHANNEL_COUNT,
  65. AMEDIAFORMAT_KEY_CHANNEL_MASK,
  66. AMEDIAFORMAT_KEY_COLOR_FORMAT,
  67. AMEDIAFORMAT_KEY_DURATION,
  68. AMEDIAFORMAT_KEY_FLAC_COMPRESSION_LEVEL,
  69. AMEDIAFORMAT_KEY_FRAME_RATE,
  70. AMEDIAFORMAT_KEY_HEIGHT,
  71. AMEDIAFORMAT_KEY_IS_ADTS,
  72. AMEDIAFORMAT_KEY_IS_AUTOSELECT,
  73. AMEDIAFORMAT_KEY_IS_DEFAULT,
  74. AMEDIAFORMAT_KEY_IS_FORCED_SUBTITLE,
  75. AMEDIAFORMAT_KEY_I_FRAME_INTERVAL,
  76. AMEDIAFORMAT_KEY_LANGUAGE,
  77. AMEDIAFORMAT_KEY_MAX_HEIGHT,
  78. AMEDIAFORMAT_KEY_MAX_INPUT_SIZE,
  79. AMEDIAFORMAT_KEY_MAX_WIDTH,
  80. AMEDIAFORMAT_KEY_MIME,
  81. AMEDIAFORMAT_KEY_PUSH_BLANK_BUFFERS_ON_STOP,
  82. AMEDIAFORMAT_KEY_REPEAT_PREVIOUS_FRAME_AFTER,
  83. AMEDIAFORMAT_KEY_SAMPLE_RATE,
  84. AMEDIAFORMAT_KEY_WIDTH,
  85. AMEDIAFORMAT_KEY_STRIDE,
  86. } sdl_amedia_format_key_t;
  87. #else
  88. #define AMEDIAFORMAT_KEY_AAC_PROFILE "aac-profile"
  89. #define AMEDIAFORMAT_KEY_BIT_RATE "bitrate"
  90. #define AMEDIAFORMAT_KEY_CHANNEL_COUNT "channel-count"
  91. #define AMEDIAFORMAT_KEY_CHANNEL_MASK "channel-mask"
  92. #define AMEDIAFORMAT_KEY_COLOR_FORMAT "color-format"
  93. #define AMEDIAFORMAT_KEY_DURATION "durationUs"
  94. #define AMEDIAFORMAT_KEY_FLAC_COMPRESSION_LEVEL "flac-compression-level"
  95. #define AMEDIAFORMAT_KEY_FRAME_RATE "frame-rate"
  96. #define AMEDIAFORMAT_KEY_HEIGHT "height"
  97. #define AMEDIAFORMAT_KEY_IS_ADTS "is-adts"
  98. //#define AMEDIAFORMAT_KEY_IS_AUTOSELECT
  99. //#define AMEDIAFORMAT_KEY_IS_DEFAULT
  100. //#define AMEDIAFORMAT_KEY_IS_FORCED_SUBTITLE
  101. #define AMEDIAFORMAT_KEY_I_FRAME_INTERVAL "i-frame-interval"
  102. //#define AMEDIAFORMAT_KEY_LANGUAGE
  103. //#define AMEDIAFORMAT_KEY_MAX_HEIGHT
  104. #define AMEDIAFORMAT_KEY_MAX_INPUT_SIZE "max-input-size"
  105. //#define AMEDIAFORMAT_KEY_MAX_WIDTH
  106. #define AMEDIAFORMAT_KEY_MIME "mime"
  107. //#define AMEDIAFORMAT_KEY_PUSH_BLANK_BUFFERS_ON_STOP,
  108. //#define AMEDIAFORMAT_KEY_REPEAT_PREVIOUS_FRAME_AFTER,
  109. #define AMEDIAFORMAT_KEY_SAMPLE_RATE "sample-rate"
  110. #define AMEDIAFORMAT_KEY_WIDTH "width"
  111. //#define AMEDIAFORMAT_KEY_STRIDE
  112. #endif
  113. enum {
  114. AMEDIACODEC__INFO_OUTPUT_BUFFERS_CHANGED = -3,
  115. AMEDIACODEC__INFO_OUTPUT_FORMAT_CHANGED = -2,
  116. AMEDIACODEC__INFO_TRY_AGAIN_LATER = -1,
  117. AMEDIACODEC__UNKNOWN_ERROR = -1000,
  118. };
  119. enum {
  120. AMEDIACODEC__BUFFER_FLAG_KEY_FRAME = 0x01,
  121. AMEDIACODEC__BUFFER_FLAG_CODEC_CONFIG = 0x02,
  122. AMEDIACODEC__BUFFER_FLAG_END_OF_STREAM = 0x04,
  123. // extended
  124. AMEDIACODEC__BUFFER_FLAG_FAKE_FRAME = 0x1000,
  125. };
  126. enum {
  127. AMEDIACODEC__OMX_COLOR_FormatMonochrome = 1,
  128. AMEDIACODEC__OMX_COLOR_Format8bitRGB332 = 2,
  129. AMEDIACODEC__OMX_COLOR_Format12bitRGB444 = 3,
  130. AMEDIACODEC__OMX_COLOR_Format16bitARGB4444 = 4,
  131. AMEDIACODEC__OMX_COLOR_Format16bitARGB1555 = 5,
  132. AMEDIACODEC__OMX_COLOR_Format16bitRGB565 = 6,
  133. AMEDIACODEC__OMX_COLOR_Format16bitBGR565 = 7,
  134. AMEDIACODEC__OMX_COLOR_Format18bitRGB666 = 8,
  135. AMEDIACODEC__OMX_COLOR_Format18bitARGB1665 = 9,
  136. AMEDIACODEC__OMX_COLOR_Format19bitARGB1666 = 10,
  137. AMEDIACODEC__OMX_COLOR_Format24bitRGB888 = 11,
  138. AMEDIACODEC__OMX_COLOR_Format24bitBGR888 = 12,
  139. AMEDIACODEC__OMX_COLOR_Format24bitARGB1887 = 13,
  140. AMEDIACODEC__OMX_COLOR_Format25bitARGB1888 = 14,
  141. AMEDIACODEC__OMX_COLOR_Format32bitBGRA8888 = 15,
  142. AMEDIACODEC__OMX_COLOR_Format32bitARGB8888 = 16,
  143. AMEDIACODEC__OMX_COLOR_FormatYUV411Planar = 17,
  144. AMEDIACODEC__OMX_COLOR_FormatYUV411PackedPlanar = 18,
  145. AMEDIACODEC__OMX_COLOR_FormatYUV420Planar = 19,
  146. AMEDIACODEC__OMX_COLOR_FormatYUV420PackedPlanar = 20,
  147. AMEDIACODEC__OMX_COLOR_FormatYUV420SemiPlanar = 21,
  148. AMEDIACODEC__OMX_COLOR_FormatYUV422Planar = 22,
  149. AMEDIACODEC__OMX_COLOR_FormatYUV422PackedPlanar = 23,
  150. AMEDIACODEC__OMX_COLOR_FormatYUV422SemiPlanar = 24,
  151. AMEDIACODEC__OMX_COLOR_FormatYCbYCr = 25,
  152. AMEDIACODEC__OMX_COLOR_FormatYCrYCb = 26,
  153. AMEDIACODEC__OMX_COLOR_FormatCbYCrY = 27,
  154. AMEDIACODEC__OMX_COLOR_FormatCrYCbY = 28,
  155. AMEDIACODEC__OMX_COLOR_FormatYUV444Interleaved = 29,
  156. AMEDIACODEC__OMX_COLOR_FormatRawBayer8bit = 30,
  157. AMEDIACODEC__OMX_COLOR_FormatRawBayer10bit = 31,
  158. AMEDIACODEC__OMX_COLOR_FormatRawBayer8bitcompressed = 32,
  159. AMEDIACODEC__OMX_COLOR_FormatL2 = 33,
  160. AMEDIACODEC__OMX_COLOR_FormatL4 = 34,
  161. AMEDIACODEC__OMX_COLOR_FormatL8 = 35,
  162. AMEDIACODEC__OMX_COLOR_FormatL16 = 36,
  163. AMEDIACODEC__OMX_COLOR_FormatL24 = 37,
  164. AMEDIACODEC__OMX_COLOR_FormatL32 = 38,
  165. AMEDIACODEC__OMX_COLOR_FormatYUV420PackedSemiPlanar = 39,
  166. AMEDIACODEC__OMX_COLOR_FormatYUV422PackedSemiPlanar = 40,
  167. AMEDIACODEC__OMX_COLOR_Format18BitBGR666 = 41,
  168. AMEDIACODEC__OMX_COLOR_Format24BitARGB6666 = 42,
  169. AMEDIACODEC__OMX_COLOR_Format24BitABGR6666 = 43,
  170. // AMEDIACODEC__OMX_COLOR_TI_FormatYUV420PackedSemiPlanar = 0x7f000100,
  171. AMEDIACODEC__OMX_COLOR_FormatSurface = 0x7f000789,
  172. AMEDIACODEC__OMX_COLOR_FormatYUV420Flexible = 0x7f420888,
  173. // AMEDIACODEC__OMX_COLOR_QCOM_FormatYUV420SemiPlanar = 0x7fa30c00,
  174. // from hardware intel
  175. _AMEDIACODEC__OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar = 0x7FA00E00,
  176. _AMEDIACODEC__OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled = 0x7FA00F00,
  177. // from hardware qcom
  178. _AMEDIACODEC__OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00,
  179. _AMEDIACODEC__OMX_QCOM_COLOR_FormatYVU420PackedSemiPlanar32m4ka = 0x7FA30C01,
  180. _AMEDIACODEC__OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar16m2ka = 0x7FA30C02,
  181. _AMEDIACODEC__OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7FA30C03,
  182. _AMEDIACODEC__OMX_QCOM_COLOR_FORMATYUV420PackedSemiPlanar32m = 0x7FA30C04,
  183. _AMEDIACODEC__OMX_QCOM_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView = 0x7FA30C05,
  184. // from hardware samsung_slsi
  185. _AMEDIACODEC__OMX_SEC_COLOR_FormatNV12TPhysicalAddress = 0x7F000001,
  186. _AMEDIACODEC__OMX_SEC_COLOR_FormatNV12LPhysicalAddress = 0x7F000002,
  187. _AMEDIACODEC__OMX_SEC_COLOR_FormatNV12LVirtualAddress = 0x7F000003,
  188. _AMEDIACODEC__OMX_SEC_COLOR_FormatNV12Tiled = 0x7FC00002,
  189. _AMEDIACODEC__OMX_SEC_COLOR_FormatNV21LPhysicalAddress = 0x7F000010,
  190. _AMEDIACODEC__OMX_SEC_COLOR_FormatNV21Linear = 0x7F000011,
  191. // from hardware ti
  192. // _AMEDIACODEC__OMX_TI_COLOR_FormatRawBayer10bitStereo = 0x7F000002,
  193. _AMEDIACODEC__OMX_TI_COLOR_FormatYUV420PackedSemiPlanar = 0x7F000100,
  194. };
  195. const char *SDL_AMediaCodec_getColorFormatName(int colorFormat);
  196. //#define AMCTRACE ALOGI
  197. #define AMCTRACE(...)
  198. #endif