va_protected_content.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*
  2. * Copyright (c) 2018-2020 Intel Corporation. All Rights Reserved.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the
  6. * "Software"), to deal in the Software without restriction, including
  7. * without limitation the rights to use, copy, modify, merge, publish,
  8. * distribute, sub license, and/or sell copies of the Software, and to
  9. * permit persons to whom the Software is furnished to do so, subject to
  10. * the following conditions:
  11. *
  12. * The above copyright notice and this permission notice (including the
  13. * next paragraph) shall be included in all copies or substantial portions
  14. * of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  19. * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
  20. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  21. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  22. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23. */
  24. /**
  25. * \file va_protected_content.h
  26. * \brief Protection content general interface
  27. *
  28. * This file contains the \ref api_protected_content "Protected Content
  29. * Interface".
  30. */
  31. #ifndef VA_PROTECTED_CONTENT_H
  32. #define VA_PROTECTED_CONTENT_H
  33. #include <stdint.h>
  34. #include <va/va.h>
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. /**
  39. * \defgroup api_intel Protected Content(PC) API
  40. *
  41. * @{
  42. */
  43. /**\brief CENC status paramter, used for vendor content protection only.
  44. * The buffer corresponds to #VACencStatusParameters for va/cp*/
  45. #define VACencStatusParameterBufferType ((VABufferType)0x20002)
  46. /** \brief TeeExec Function Codes. */
  47. #define VA_TEE_EXEC_TEE_FUNCID_HW_UPDATE 0x40000002
  48. #define VA_TEE_EXEC_TEE_FUNCID_IS_SESSION_ALIVE 0x40000103
  49. /** \brief values for the encryption return status. */
  50. typedef enum {
  51. /** \brief Indicate encryption operation is successful.*/
  52. VA_ENCRYPTION_STATUS_SUCCESSFUL = 0,
  53. /** \brief Indicate encryption operation is incomplete. */
  54. VA_ENCRYPTION_STATUS_INCOMPLETE,
  55. /** \brief Indicate encryption operation is error.*/
  56. VA_ENCRYPTION_STATUS_ERROR,
  57. /** \brief Indicate the buf in VACencStatusBuf is full. */
  58. VA_ENCRYPTION_STATUS_BUFFER_FULL,
  59. /** \brief Indicate encryption operation is unsupport. */
  60. VA_ENCRYPTION_STATUS_UNSUPPORT
  61. } VAEncryptionStatus;
  62. /** \brief cenc status parameters, corresponding to
  63. * #VACencStatusParameterBufferType*/
  64. typedef struct _VACencStatusParameters {
  65. /** \brief The status report index feedback. */
  66. uint32_t status_report_index_feedback;
  67. /** \brief Reserved bytes for future use, must be zero */
  68. uint32_t va_reserved[VA_PADDING_MEDIUM];
  69. } VACencStatusParameters;
  70. /**
  71. * \brief Slice parameter for H.264 cenc decode in baseline, main & high
  72. * profiles.
  73. *
  74. * This structure holds information for \c
  75. * slice_layer_without_partitioning_rbsp() and nal_unit()of the slice
  76. * as defined by the H.264 specification.
  77. *
  78. */
  79. typedef struct _VACencSliceParameterBufferH264 {
  80. /** \brief Parameters from \c nal_unit() of the slice.*/
  81. /**@{*/
  82. /** \brief Same as the H.264 bitstream syntax element. */
  83. uint8_t nal_ref_idc;
  84. /** \brief Indicate if this is coded slice of an IDR picture.
  85. * Corresponds to IdrPicFlag as the H.264 specification.*/
  86. uint8_t idr_pic_flag;
  87. /**@}*/
  88. /** \brief Same as the H.264 bitstream syntax element. */
  89. uint8_t slice_type;
  90. /** \brief Indicate if this is a field or frame picture.
  91. * \c VA_FRAME_PICTURE, \c VA_TOP_FIELD, \c VA_BOTTOM_FIELD*/
  92. uint8_t field_frame_flag;
  93. /** \brief Same as the H.264 bitstream syntax element. */
  94. uint32_t frame_number;
  95. /** \brief Same as the H.264 bitstream syntax element. */
  96. uint32_t idr_pic_id;
  97. /** \brief Same as the H.264 bitstream syntax element. */
  98. int32_t pic_order_cnt_lsb;
  99. /** \brief Same as the H.264 bitstream syntax element. */
  100. int32_t delta_pic_order_cnt_bottom;
  101. /** \brief Same as the H.264 bitstream syntax element. */
  102. int32_t delta_pic_order_cnt[2];
  103. /**
  104. * \brief decoded reference picture marking. Information for \c
  105. * dec_ref_pic_marking() as defined by the H.264 specification.
  106. */
  107. /**@{*/
  108. union {
  109. struct {
  110. /** \brief Same as the H.264 bitstream syntax element. */
  111. uint32_t no_output_of_prior_pics_flag : 1;
  112. /** \brief Same as the H.264 bitstream syntax element. */
  113. uint32_t long_term_reference_flag : 1;
  114. /** \brief Same as the H.264 bitstream syntax element. */
  115. uint32_t adaptive_ref_pic_marking_mode_flag : 1;
  116. /** \brief number of decode reference picture marking. */
  117. uint32_t dec_ref_pic_marking_count : 8;
  118. /** \brief Reserved for future use, must be zero */
  119. uint32_t reserved : 21;
  120. } bits;
  121. uint32_t value;
  122. } ref_pic_fields;
  123. /** \brief Same as the H.264 bitstream syntax element. */
  124. uint8_t memory_management_control_operation[32];
  125. /** \brief Same as the H.264 bitstream syntax element. */
  126. int32_t difference_of_pic_nums_minus1[32];
  127. /** \brief Same as the H.264 bitstream syntax element. */
  128. int32_t long_term_pic_num[32];
  129. /** \brief Same as the H.264 bitstream syntax element. */
  130. int32_t max_long_term_frame_idx_plus1[32];
  131. /** \brief Same as the H.264 bitstream syntax element. */
  132. int32_t long_term_frame_idx[32];
  133. /**@}*/
  134. /** \brief Pointer to the next #VACencSliceParameterBufferH264 element,
  135. * or \c nullptr if there is none.*/
  136. void* next;
  137. /** \brief Reserved bytes for future use, must be zero */
  138. uint32_t va_reserved[VA_PADDING_MEDIUM];
  139. } VACencSliceParameterBufferH264;
  140. /** \brief Cenc Slice Buffer Type*/
  141. typedef enum {
  142. /** \brief Parsed slice parameters \c VACencSliceParameterBuffer* */
  143. VaCencSliceBufParamter = 1,
  144. /** \brief Raw slice header of bitstream*/
  145. VaCencSliceBufRaw = 2
  146. } VACencSliceBufType;
  147. /** \brief Buffer for CENC status reporting*/
  148. typedef struct _VACencStatusBuf {
  149. /** \brief Encryption status. VA_ENCRYPTION_STATUS_SUCCESSFUL if
  150. * hardware has returned detailed information, others mean the
  151. * CENC result is invalid */
  152. VAEncryptionStatus status;
  153. /* \brief feedback of status report index
  154. * This value is the feedback of status_report_number of
  155. * \ref VAEncryptionParameters to indicate the CENC workload*/
  156. uint32_t status_report_index_feedback;
  157. /** \brief Buf size in bytes. 0 means buf is invalid*/
  158. uint32_t buf_size;
  159. /** \brief Buffer formatted as raw data from bitstream for sequence parameter,
  160. * picture parameter, SEI parameters. Or \c nullptr means buf is invalid.*/
  161. void* buf;
  162. /** \brief Slice buffer type, see \c VACencSliceBufTypex */
  163. VACencSliceBufType slice_buf_type;
  164. /** \brief Slice buffer size in bytes. 0 means slice_buf is invalid*/
  165. uint32_t slice_buf_size;
  166. /** \brief Slice buffer, parsed slice header information. Or \c nullptr
  167. * means slice_buf is invalid.*/
  168. void* slice_buf;
  169. /** \brief Reserved bytes for future use, must be zero */
  170. uint32_t va_reserved[VA_PADDING_MEDIUM];
  171. } VACencStatusBuf;
  172. /**@}*/
  173. #ifdef __cplusplus
  174. }
  175. #endif
  176. #endif // VA_PROTECTED_CONTENT_H