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.

148 lines
3.5KB

  1. /*
  2. * Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <stdint.h>
  21. #include "frame.h"
  22. /**
  23. * List of possible 3D Types
  24. */
  25. enum AVStereo3DType {
  26. /**
  27. * Video is not stereoscopic (and metadata has to be there).
  28. */
  29. AV_STEREO3D_2D,
  30. /**
  31. * Views are next to each other.
  32. *
  33. * LLLLRRRR
  34. * LLLLRRRR
  35. * LLLLRRRR
  36. * ...
  37. */
  38. AV_STEREO3D_SIDEBYSIDE,
  39. /**
  40. * Views are on top of each other.
  41. *
  42. * LLLLLLLL
  43. * LLLLLLLL
  44. * RRRRRRRR
  45. * RRRRRRRR
  46. */
  47. AV_STEREO3D_TOPBOTTOM,
  48. /**
  49. * Views are alternated temporally.
  50. *
  51. * frame0 frame1 frame2 ...
  52. * LLLLLLLL RRRRRRRR LLLLLLLL
  53. * LLLLLLLL RRRRRRRR LLLLLLLL
  54. * LLLLLLLL RRRRRRRR LLLLLLLL
  55. * ... ... ...
  56. */
  57. AV_STEREO3D_FRAMESEQUENCE,
  58. /**
  59. * Views are packed in a checkerboard-like structure per pixel.
  60. *
  61. * LRLRLRLR
  62. * RLRLRLRL
  63. * LRLRLRLR
  64. * ...
  65. */
  66. AV_STEREO3D_CHECKERBOARD,
  67. /**
  68. * Views are next to each other, but when upscaling
  69. * apply a checkerboard pattern.
  70. *
  71. * LLLLRRRR L L L L R R R R
  72. * LLLLRRRR => L L L L R R R R
  73. * LLLLRRRR L L L L R R R R
  74. * LLLLRRRR L L L L R R R R
  75. */
  76. AV_STEREO3D_SIDEBYSIDE_QUINCUNX,
  77. /**
  78. * Views are packed per line, as if interlaced.
  79. *
  80. * LLLLLLLL
  81. * RRRRRRRR
  82. * LLLLLLLL
  83. * ...
  84. */
  85. AV_STEREO3D_LINES,
  86. /**
  87. * Views are packed per column.
  88. *
  89. * LRLRLRLR
  90. * LRLRLRLR
  91. * LRLRLRLR
  92. * ...
  93. */
  94. AV_STEREO3D_COLUMNS,
  95. };
  96. /**
  97. * Inverted views, Right/Bottom represents the left view.
  98. */
  99. #define AV_STEREO3D_FLAG_INVERT (1 << 0)
  100. /**
  101. * Stereo 3D type: this structure describes how two videos are packed
  102. * within a single video surface, with additional information as needed.
  103. *
  104. * @note The struct must be allocated with av_stereo3d_alloc() and
  105. * its size is not a part of the public ABI.
  106. */
  107. typedef struct AVStereo3D {
  108. /**
  109. * How views are packed within the video.
  110. */
  111. enum AVStereo3DType type;
  112. /**
  113. * Additional information about the frame packing.
  114. */
  115. int flags;
  116. } AVStereo3D;
  117. /**
  118. * Allocate an AVStereo3D structure and set its fields to default values.
  119. * The resulting struct can be freed using av_freep().
  120. *
  121. * @return An AVStereo3D filled with default values or NULL on failure.
  122. */
  123. AVStereo3D *av_stereo3d_alloc(void);
  124. /**
  125. * Allocate a complete AVFrameSideData and add it to the frame.
  126. *
  127. * @param frame The frame which side data is added to.
  128. *
  129. * @return The AVStereo3D structure to be filled by caller.
  130. */
  131. AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);