You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
4.4KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * Libav is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with Libav; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVCODEC_H264_SEI_H
  19. #define AVCODEC_H264_SEI_H
  20. #include "get_bits.h"
  21. /**
  22. * SEI message types
  23. */
  24. typedef enum {
  25. SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
  26. SEI_TYPE_PIC_TIMING = 1, ///< picture timing
  27. SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35
  28. SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
  29. SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
  30. SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
  31. SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation
  32. } SEI_Type;
  33. /**
  34. * pic_struct in picture timing SEI message
  35. */
  36. typedef enum {
  37. SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame
  38. SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field
  39. SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field
  40. SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order
  41. SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order
  42. SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order
  43. SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order
  44. SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling
  45. SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling
  46. } SEI_PicStructType;
  47. typedef struct H264SEIPictureTiming {
  48. int present;
  49. SEI_PicStructType pic_struct;
  50. /**
  51. * Bit set of clock types for fields/frames in picture timing SEI message.
  52. * For each found ct_type, appropriate bit is set (e.g., bit 1 for
  53. * interlaced).
  54. */
  55. int ct_type;
  56. /**
  57. * dpb_output_delay in picture timing SEI message, see H.264 C.2.2
  58. */
  59. int dpb_output_delay;
  60. /**
  61. * cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
  62. */
  63. int cpb_removal_delay;
  64. } H264SEIPictureTiming;
  65. typedef struct H264SEIAFD {
  66. int present;
  67. uint8_t active_format_description;
  68. } H264SEIAFD;
  69. typedef struct H264SEIA53Caption {
  70. int a53_caption_size;
  71. uint8_t *a53_caption;
  72. } H264SEIA53Caption;
  73. typedef struct H264SEIUnregistered {
  74. int x264_build;
  75. } H264SEIUnregistered;
  76. typedef struct H264SEIRecoveryPoint {
  77. /**
  78. * recovery_frame_cnt
  79. *
  80. * Set to -1 if no recovery point SEI message found or to number of frames
  81. * before playback synchronizes. Frames having recovery point are key
  82. * frames.
  83. */
  84. int recovery_frame_cnt;
  85. } H264SEIRecoveryPoint;
  86. typedef struct H264SEIBufferingPeriod {
  87. int present; ///< Buffering period SEI flag
  88. int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
  89. } H264SEIBufferingPeriod;
  90. typedef struct H264SEIFramePacking {
  91. int present;
  92. int arrangement_type;
  93. int content_interpretation_type;
  94. int quincunx_subsampling;
  95. } H264SEIFramePacking;
  96. typedef struct H264SEIDisplayOrientation {
  97. int present;
  98. int anticlockwise_rotation;
  99. int hflip, vflip;
  100. } H264SEIDisplayOrientation;
  101. typedef struct H264SEIContext {
  102. H264SEIPictureTiming picture_timing;
  103. H264SEIAFD afd;
  104. H264SEIA53Caption a53_caption;
  105. H264SEIUnregistered unregistered;
  106. H264SEIRecoveryPoint recovery_point;
  107. H264SEIBufferingPeriod buffering_period;
  108. H264SEIFramePacking frame_packing;
  109. H264SEIDisplayOrientation display_orientation;
  110. } H264SEIContext;
  111. struct H264ParamSets;
  112. int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
  113. const struct H264ParamSets *ps, void *logctx);
  114. /**
  115. * Reset SEI values at the beginning of the frame.
  116. */
  117. void ff_h264_sei_uninit(H264SEIContext *h);
  118. #endif /* AVCODEC_H264_SEI_H */