選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

91 行
2.8KB

  1. #include "mov-internal.h"
  2. #include <assert.h>
  3. #include <stdlib.h>
  4. #include <errno.h>
  5. // Table 1 - List of Class Tags for Descriptors (p31)
  6. /*
  7. 0x10 MP4_IOD_Tag
  8. 0x11 MP4_OD_Tag
  9. */
  10. // 7.2.2.2 BaseDescriptor (p32)
  11. /*
  12. abstract aligned(8) expandable(2^28-1) class BaseDescriptor : bit(8) tag=0 {
  13. // empty. To be filled by classes extending this class.
  14. }
  15. */
  16. // 7.2.6.2 ObjectDescriptorBase (p42)
  17. /*
  18. abstract class ObjectDescriptorBase extends BaseDescriptor : bit(8)
  19. tag=[ObjectDescrTag..InitialObjectDescrTag] {
  20. // empty. To be filled by classes extending this class.
  21. }
  22. class ObjectDescriptor extends ObjectDescriptorBase : bit(8) tag=ObjectDescrTag {
  23. bit(10) ObjectDescriptorID;
  24. bit(1) URL_Flag;
  25. const bit(5) reserved=0b1111.1;
  26. if (URL_Flag) {
  27. bit(8) URLlength;
  28. bit(8) URLstring[URLlength];
  29. } else {
  30. ES_Descriptor esDescr[1 .. 255];
  31. OCI_Descriptor ociDescr[0 .. 255];
  32. IPMP_DescriptorPointer ipmpDescrPtr[0 .. 255];
  33. IPMP_Descriptor ipmpDescr [0 .. 255];
  34. }
  35. ExtensionDescriptor extDescr[0 .. 255];
  36. }
  37. */
  38. // 7.2.6.4 InitialObjectDescriptor (p44)
  39. /*
  40. class InitialObjectDescriptor extends ObjectDescriptorBase : bit(8)
  41. tag=InitialObjectDescrTag {
  42. bit(10) ObjectDescriptorID;
  43. bit(1) URL_Flag;
  44. bit(1) includeInlineProfileLevelFlag;
  45. const bit(4) reserved=0b1111;
  46. if (URL_Flag) {
  47. bit(8) URLlength;
  48. bit(8) URLstring[URLlength];
  49. } else {
  50. bit(8) ODProfileLevelIndication;
  51. bit(8) sceneProfileLevelIndication;
  52. bit(8) audioProfileLevelIndication;
  53. bit(8) visualProfileLevelIndication;
  54. bit(8) graphicsProfileLevelIndication;
  55. ES_Descriptor esDescr[1 .. 255];
  56. OCI_Descriptor ociDescr[0 .. 255];
  57. IPMP_DescriptorPointer ipmpDescrPtr[0 .. 255];
  58. IPMP_Descriptor ipmpDescr [0 .. 255];
  59. IPMP_ToolListDescriptor toolListDescr[0 .. 1];
  60. }
  61. ExtensionDescriptor extDescr[0 .. 255];
  62. }
  63. */
  64. size_t mov_write_iods(const struct mov_t* mov)
  65. {
  66. size_t size = 12 /* full box */ + 12 /* InitialObjectDescriptor */;
  67. mov_buffer_w32(&mov->io, 24); /* size */
  68. mov_buffer_write(&mov->io, "iods", 4);
  69. mov_buffer_w32(&mov->io, 0); /* version & flags */
  70. mov_buffer_w8(&mov->io, 0x10); // ISO_MP4_IOD_Tag
  71. mov_buffer_w8(&mov->io, (uint8_t)(0x80 | (7 >> 21)));
  72. mov_buffer_w8(&mov->io, (uint8_t)(0x80 | (7 >> 14)));
  73. mov_buffer_w8(&mov->io, (uint8_t)(0x80 | (7 >> 7)));
  74. mov_buffer_w8(&mov->io, (uint8_t)(0x7F & 7));
  75. mov_buffer_w16(&mov->io, 0x004f); // objectDescriptorId 1
  76. mov_buffer_w8(&mov->io, 0xff); // No OD capability required
  77. mov_buffer_w8(&mov->io, 0xff);
  78. mov_buffer_w8(&mov->io, 0xFF);
  79. mov_buffer_w8(&mov->io, 0xFF); // no visual capability required
  80. mov_buffer_w8(&mov->io, 0xff);
  81. return size;
  82. }