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.

124 lines
3.8KB

  1. /*
  2. * MXF
  3. * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #ifndef AVFORMAT_MXF_H
  22. #define AVFORMAT_MXF_H
  23. #include "avformat.h"
  24. #include "libavcodec/avcodec.h"
  25. #include <stdint.h>
  26. typedef uint8_t UID[16];
  27. enum MXFMetadataSetType {
  28. AnyType,
  29. MaterialPackage,
  30. SourcePackage,
  31. SourceClip,
  32. TimecodeComponent,
  33. PulldownComponent,
  34. Sequence,
  35. MultipleDescriptor,
  36. Descriptor,
  37. Track,
  38. CryptoContext,
  39. Preface,
  40. Identification,
  41. ContentStorage,
  42. SubDescriptor,
  43. IndexTableSegment,
  44. EssenceContainerData,
  45. TypeBottom,// add metadata type before this
  46. };
  47. enum MXFFrameLayout {
  48. FullFrame = 0,
  49. SeparateFields,
  50. OneField,
  51. MixedFields,
  52. SegmentedFrame,
  53. };
  54. typedef struct KLVPacket {
  55. UID key;
  56. int64_t offset;
  57. uint64_t length;
  58. } KLVPacket;
  59. typedef struct MXFCodecUL {
  60. UID uid;
  61. unsigned matching_len;
  62. int id;
  63. } MXFCodecUL;
  64. typedef struct {
  65. struct AVRational time_base;
  66. int samples_per_frame[6];
  67. } MXFSamplesPerFrame;
  68. extern const MXFCodecUL ff_mxf_data_definition_uls[];
  69. extern const MXFCodecUL ff_mxf_codec_uls[];
  70. extern const MXFCodecUL ff_mxf_pixel_format_uls[];
  71. int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum AVPixelFormat *pix_fmt);
  72. const MXFSamplesPerFrame *ff_mxf_get_samples_per_frame(AVFormatContext *s, AVRational time_base);
  73. #define PRIxUID \
  74. "%02x.%02x.%02x.%02x." \
  75. "%02x.%02x.%02x.%02x." \
  76. "%02x.%02x.%02x.%02x." \
  77. "%02x.%02x.%02x.%02x"
  78. #define UID_ARG(x) \
  79. (x)[0], (x)[1], (x)[2], (x)[3], \
  80. (x)[4], (x)[5], (x)[6], (x)[7], \
  81. (x)[8], (x)[9], (x)[10], (x)[11], \
  82. (x)[12], (x)[13], (x)[14], (x)[15] \
  83. #ifdef DEBUG
  84. #define PRINT_KEY(pc, s, x) \
  85. av_log(pc, AV_LOG_VERBOSE, \
  86. "%s " \
  87. "0x%02x,0x%02x,0x%02x,0x%02x," \
  88. "0x%02x,0x%02x,0x%02x,0x%02x," \
  89. "0x%02x,0x%02x,0x%02x,0x%02x," \
  90. "0x%02x,0x%02x,0x%02x,0x%02x ", \
  91. s, \
  92. (x)[0], (x)[1], (x)[2], (x)[3], \
  93. (x)[4], (x)[5], (x)[6], (x)[7], \
  94. (x)[8], (x)[9], (x)[10], (x)[11], \
  95. (x)[12], (x)[13], (x)[14], (x)[15]); \
  96. av_log(pc, AV_LOG_INFO, \
  97. "%s " \
  98. "%02x.%02x.%02x.%02x." \
  99. "%02x.%02x.%02x.%02x." \
  100. "%02x.%02x.%02x.%02x." \
  101. "%02x.%02x.%02x.%02x\n", \
  102. s, \
  103. (x)[0], (x)[1], (x)[2], (x)[3], \
  104. (x)[4], (x)[5], (x)[6], (x)[7], \
  105. (x)[8], (x)[9], (x)[10], (x)[11], \
  106. (x)[12], (x)[13], (x)[14], (x)[15])
  107. #else
  108. #define PRINT_KEY(pc, s, x)
  109. #endif
  110. #endif /* AVFORMAT_MXF_H */