1
0

descriptors.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /*
  2. * The contents of this file are subject to the Mozilla Public
  3. * License Version 1.1 (the "License"); you may not use this file
  4. * except in compliance with the License. You may obtain a copy of
  5. * the License at http://www.mozilla.org/MPL/
  6. *
  7. * Software distributed under the License is distributed on an "AS
  8. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9. * implied. See the License for the specific language governing
  10. * rights and limitations under the License.
  11. *
  12. * The Original Code is MPEG4IP.
  13. *
  14. * The Initial Developer of the Original Code is Cisco Systems Inc.
  15. * Portions created by Cisco Systems Inc. are
  16. * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
  17. *
  18. * Contributor(s):
  19. * Dave Mackie [email protected]
  20. */
  21. #include "mp4common.h"
  22. MP4BaseDescriptor::MP4BaseDescriptor (u_int8_t tag) : MP4Descriptor(tag)
  23. {
  24. switch (tag) {
  25. case MP4ESIDIncDescrTag:
  26. AddProperty( /* 0 */
  27. new MP4Integer32Property("id"));
  28. break;
  29. case MP4ESIDRefDescrTag:
  30. AddProperty( /* 0 */
  31. new MP4Integer16Property("refIndex"));
  32. break;
  33. case MP4IPIPtrDescrTag:
  34. AddProperty( /* 0 */
  35. new MP4Integer16Property("IPIESId"));
  36. break;
  37. case MP4SupplContentIdDescrTag:
  38. AddProperty( /* 0 */
  39. new MP4BytesProperty("languageCode", 3));
  40. AddProperty( /* 1 */
  41. new MP4StringProperty("title", Counted));
  42. AddProperty( /* 2 */
  43. new MP4StringProperty("value", Counted));
  44. break;
  45. case MP4IPMPPtrDescrTag:
  46. AddProperty( /* 0 */
  47. new MP4Integer8Property("IPMPDescriptorId"));
  48. break;
  49. case MP4ExtProfileLevelDescrTag:
  50. AddProperty( /* 0 */
  51. new MP4Integer8Property("profileLevelIndicationIndex"));
  52. AddProperty( /* 1 */
  53. new MP4Integer8Property("ODProfileLevelIndication"));
  54. AddProperty( /* 2 */
  55. new MP4Integer8Property("sceneProfileLevelIndication"));
  56. AddProperty( /* 3 */
  57. new MP4Integer8Property("audioProfileLevelIndication"));
  58. AddProperty( /* 4 */
  59. new MP4Integer8Property("visualProfileLevelIndication"));
  60. AddProperty( /* 5 */
  61. new MP4Integer8Property("graphicsProfileLevelIndication"));
  62. AddProperty( /* 6 */
  63. new MP4Integer8Property("MPEGJProfileLevelIndication"));
  64. break;
  65. default:
  66. //MP4Printf("error in base descriptor - tag %u", tag);
  67. break;
  68. }
  69. }
  70. MP4BytesDescriptor::MP4BytesDescriptor (u_int8_t tag) : MP4Descriptor(tag)
  71. {
  72. m_size_offset = 0;
  73. m_bytes_index = 0;
  74. if (tag >= MP4ExtDescrTagsStart && tag <= MP4ExtDescrTagsEnd) {
  75. AddProperty( /* 0 */
  76. new MP4BytesProperty("data"));
  77. } else {
  78. switch (tag) {
  79. case MP4DecSpecificDescrTag:
  80. AddProperty( /* 0 */
  81. new MP4BytesProperty("info"));
  82. // no change to m_size
  83. break;
  84. case MP4IPMPDescrTag:
  85. AddProperty( /* 0 */
  86. new MP4Integer8Property("IPMPDescriptorId"));
  87. AddProperty( /* 1 */
  88. new MP4Integer16Property("IPMPSType"));
  89. AddProperty( /* 2 */
  90. new MP4BytesProperty("IPMPData"));
  91. /* note: if IPMPSType == 0, IPMPData is an URL */
  92. m_size_offset = 3;
  93. m_bytes_index = 2;
  94. break;
  95. case MP4RegistrationDescrTag:
  96. AddProperty( /* 0 */
  97. new MP4Integer32Property("formatIdentifier"));
  98. AddProperty( /* 1 */
  99. new MP4BytesProperty("additionalIdentificationInfo"));
  100. m_size_offset = 4;
  101. m_bytes_index = 1;
  102. break;
  103. default:
  104. //MP4Printf("error in bytes descriptor - tag %u", tag);
  105. break;
  106. }
  107. }
  108. }
  109. void MP4BytesDescriptor::Read(MP4File *pFile)
  110. {
  111. ReadHeader(pFile);
  112. /* byte properties need to know how long they are before reading */
  113. ((MP4BytesProperty*)m_pProperties[m_bytes_index])->SetValueSize(m_size - m_size_offset);
  114. ReadProperties(pFile);
  115. }
  116. MP4IODescriptor::MP4IODescriptor()
  117. : MP4Descriptor(MP4FileIODescrTag)
  118. {
  119. /* N.B. other member functions depend on the property indicies */
  120. AddProperty( /* 0 */
  121. new MP4BitfieldProperty("objectDescriptorId", 10));
  122. AddProperty( /* 1 */
  123. new MP4BitfieldProperty("URLFlag", 1));
  124. AddProperty( /* 2 */
  125. new MP4BitfieldProperty("includeInlineProfileLevelFlag", 1));
  126. AddProperty( /* 3 */
  127. new MP4BitfieldProperty("reserved", 4));
  128. AddProperty( /* 4 */
  129. new MP4StringProperty("URL", Counted));
  130. AddProperty( /* 5 */
  131. new MP4Integer8Property("ODProfileLevelId"));
  132. AddProperty( /* 6 */
  133. new MP4Integer8Property("sceneProfileLevelId"));
  134. AddProperty( /* 7 */
  135. new MP4Integer8Property("audioProfileLevelId"));
  136. AddProperty( /* 8 */
  137. new MP4Integer8Property("visualProfileLevelId"));
  138. AddProperty( /* 9 */
  139. new MP4Integer8Property("graphicsProfileLevelId"));
  140. AddProperty( /* 10 */
  141. new MP4DescriptorProperty("esIds",
  142. MP4ESIDIncDescrTag, 0, Required, Many));
  143. AddProperty( /* 11 */
  144. new MP4DescriptorProperty("ociDescr",
  145. MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many));
  146. AddProperty( /* 12 */
  147. new MP4DescriptorProperty("ipmpDescrPtr",
  148. MP4IPMPPtrDescrTag, 0, Optional, Many));
  149. AddProperty( /* 13 */
  150. new MP4DescriptorProperty("extDescr",
  151. MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many));
  152. SetReadMutate(2);
  153. }
  154. void MP4IODescriptor::Generate()
  155. {
  156. ((MP4BitfieldProperty*)m_pProperties[0])->SetValue(1);
  157. ((MP4BitfieldProperty*)m_pProperties[3])->SetValue(0xF);
  158. for (u_int32_t i = 5; i <= 9; i++) {
  159. ((MP4Integer8Property*)m_pProperties[i])->SetValue(0xFF);
  160. }
  161. }
  162. void MP4IODescriptor::Mutate()
  163. {
  164. bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
  165. m_pProperties[4]->SetImplicit(!urlFlag);
  166. for (u_int32_t i = 5; i <= 12; i++) {
  167. m_pProperties[i]->SetImplicit(urlFlag);
  168. }
  169. }
  170. MP4ODescriptor::MP4ODescriptor()
  171. : MP4Descriptor(MP4FileODescrTag)
  172. {
  173. /* N.B. other member functions depend on the property indicies */
  174. AddProperty( /* 0 */
  175. new MP4BitfieldProperty("objectDescriptorId", 10));
  176. AddProperty( /* 1 */
  177. new MP4BitfieldProperty("URLFlag", 1));
  178. AddProperty( /* 2 */
  179. new MP4BitfieldProperty("reserved", 5));
  180. AddProperty( /* 3 */
  181. new MP4StringProperty("URL", Counted));
  182. AddProperty( /* 4 */
  183. new MP4DescriptorProperty("esIds",
  184. MP4ESIDRefDescrTag, 0, Required, Many));
  185. AddProperty( /* 5 */
  186. new MP4DescriptorProperty("ociDescr",
  187. MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many));
  188. AddProperty( /* 6 */
  189. new MP4DescriptorProperty("ipmpDescrPtr",
  190. MP4IPMPPtrDescrTag, 0, Optional, Many));
  191. AddProperty( /* 7 */
  192. new MP4DescriptorProperty("extDescr",
  193. MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many));
  194. SetReadMutate(2);
  195. }
  196. void MP4ODescriptor::Generate()
  197. {
  198. ((MP4BitfieldProperty*)m_pProperties[2])->SetValue(0x1F);
  199. }
  200. void MP4ODescriptor::Mutate()
  201. {
  202. bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
  203. m_pProperties[3]->SetImplicit(!urlFlag);
  204. for (u_int32_t i = 4; i <= 6; i++) {
  205. m_pProperties[i]->SetImplicit(urlFlag);
  206. }
  207. }
  208. MP4ESDescriptor::MP4ESDescriptor()
  209. : MP4Descriptor(MP4ESDescrTag)
  210. {
  211. /* N.B. other class functions depend on the property indicies */
  212. AddProperty( /* 0 */
  213. new MP4Integer16Property("ESID"));
  214. AddProperty( /* 1 */
  215. new MP4BitfieldProperty("streamDependenceFlag", 1));
  216. AddProperty( /* 2 */
  217. new MP4BitfieldProperty("URLFlag", 1));
  218. AddProperty( /* 3 */
  219. new MP4BitfieldProperty("OCRstreamFlag", 1));
  220. AddProperty( /* 4 */
  221. new MP4BitfieldProperty("streamPriority", 5));
  222. AddProperty( /* 5 */
  223. new MP4Integer16Property("dependsOnESID"));
  224. AddProperty( /* 6 */
  225. new MP4StringProperty("URL", Counted));
  226. AddProperty( /* 7 */
  227. new MP4Integer16Property("OCRESID"));
  228. AddProperty( /* 8 */
  229. new MP4DescriptorProperty("decConfigDescr",
  230. MP4DecConfigDescrTag, 0, Required, OnlyOne));
  231. AddProperty( /* 9 */
  232. new MP4DescriptorProperty("slConfigDescr",
  233. MP4SLConfigDescrTag, 0, Required, OnlyOne));
  234. AddProperty( /* 10 */
  235. new MP4DescriptorProperty("ipiPtr",
  236. MP4IPIPtrDescrTag, 0, Optional, OnlyOne));
  237. AddProperty( /* 11 */
  238. new MP4DescriptorProperty("ipIds",
  239. MP4ContentIdDescrTag, MP4SupplContentIdDescrTag, Optional, Many));
  240. AddProperty( /* 12 */
  241. new MP4DescriptorProperty("ipmpDescrPtr",
  242. MP4IPMPPtrDescrTag, 0, Optional, Many));
  243. AddProperty( /* 13 */
  244. new MP4DescriptorProperty("langDescr",
  245. MP4LanguageDescrTag, 0, Optional, Many));
  246. AddProperty( /* 14 */
  247. new MP4DescriptorProperty("qosDescr",
  248. MP4QosDescrTag, 0, Optional, OnlyOne));
  249. AddProperty( /* 15 */
  250. new MP4DescriptorProperty("regDescr",
  251. MP4RegistrationDescrTag, 0, Optional, OnlyOne));
  252. AddProperty( /* 16 */
  253. new MP4DescriptorProperty("extDescr",
  254. MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many));
  255. SetReadMutate(5);
  256. }
  257. void MP4ESDescriptor::Mutate()
  258. {
  259. bool streamDependFlag =
  260. ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
  261. m_pProperties[5]->SetImplicit(!streamDependFlag);
  262. bool urlFlag =
  263. ((MP4BitfieldProperty*)m_pProperties[2])->GetValue();
  264. m_pProperties[6]->SetImplicit(!urlFlag);
  265. bool ocrFlag =
  266. ((MP4BitfieldProperty*)m_pProperties[3])->GetValue();
  267. m_pProperties[7]->SetImplicit(!ocrFlag);
  268. }
  269. MP4DecConfigDescriptor::MP4DecConfigDescriptor()
  270. : MP4Descriptor(MP4DecConfigDescrTag)
  271. {
  272. AddProperty( /* 0 */
  273. new MP4Integer8Property("objectTypeId"));
  274. AddProperty( /* 1 */
  275. new MP4BitfieldProperty("streamType", 6));
  276. AddProperty( /* 2 */
  277. new MP4BitfieldProperty("upStream", 1));
  278. AddProperty( /* 3 */
  279. new MP4BitfieldProperty("reserved", 1));
  280. AddProperty( /* 4 */
  281. new MP4BitfieldProperty("bufferSizeDB", 24));
  282. AddProperty( /* 5 */
  283. new MP4Integer32Property("maxBitrate"));
  284. AddProperty( /* 6 */
  285. new MP4Integer32Property("avgBitrate"));
  286. AddProperty( /* 7 */
  287. new MP4DescriptorProperty("decSpecificInfo",
  288. MP4DecSpecificDescrTag, 0, Optional, OnlyOne));
  289. AddProperty( /* 8 */
  290. new MP4DescriptorProperty("profileLevelIndicationIndexDescr",
  291. MP4ExtProfileLevelDescrTag, 0, Optional, Many));
  292. }
  293. void MP4DecConfigDescriptor::Generate()
  294. {
  295. ((MP4BitfieldProperty*)m_pProperties[3])->SetValue(1);
  296. }
  297. MP4SLConfigDescriptor::MP4SLConfigDescriptor()
  298. : MP4Descriptor(MP4SLConfigDescrTag)
  299. {
  300. AddProperty( /* 0 */
  301. new MP4Integer8Property("predefined"));
  302. AddProperty( /* 1 */
  303. new MP4BitfieldProperty("useAccessUnitStartFlag", 1));
  304. AddProperty( /* 2 */
  305. new MP4BitfieldProperty("useAccessUnitEndFlag", 1));
  306. AddProperty( /* 3 */
  307. new MP4BitfieldProperty("useRandomAccessPointFlag", 1));
  308. AddProperty( /* 4 */
  309. new MP4BitfieldProperty("hasRandomAccessUnitsOnlyFlag", 1));
  310. AddProperty( /* 5 */
  311. new MP4BitfieldProperty("usePaddingFlag", 1));
  312. AddProperty( /* 6 */
  313. new MP4BitfieldProperty("useTimeStampsFlag", 1));
  314. AddProperty( /* 7 */
  315. new MP4BitfieldProperty("useIdleFlag", 1));
  316. AddProperty( /* 8 */
  317. new MP4BitfieldProperty("durationFlag", 1));
  318. AddProperty( /* 9 */
  319. new MP4Integer32Property("timeStampResolution"));
  320. AddProperty( /* 10 */
  321. new MP4Integer32Property("OCRResolution"));
  322. AddProperty( /* 11 */
  323. new MP4Integer8Property("timeStampLength"));
  324. AddProperty( /* 12 */
  325. new MP4Integer8Property("OCRLength"));
  326. AddProperty( /* 13 */
  327. new MP4Integer8Property("AULength"));
  328. AddProperty( /* 14 */
  329. new MP4Integer8Property("instantBitrateLength"));
  330. AddProperty( /* 15 */
  331. new MP4BitfieldProperty("degradationPriortyLength", 4));
  332. AddProperty( /* 16 */
  333. new MP4BitfieldProperty("AUSeqNumLength", 5));
  334. AddProperty( /* 17 */
  335. new MP4BitfieldProperty("packetSeqNumLength", 5));
  336. AddProperty( /* 18 */
  337. new MP4BitfieldProperty("reserved", 2));
  338. // if durationFlag
  339. AddProperty( /* 19 */
  340. new MP4Integer32Property("timeScale"));
  341. AddProperty( /* 20 */
  342. new MP4Integer16Property("accessUnitDuration"));
  343. AddProperty( /* 21 */
  344. new MP4Integer16Property("compositionUnitDuration"));
  345. // if !useTimeStampsFlag
  346. AddProperty( /* 22 */
  347. new MP4BitfieldProperty("startDecodingTimeStamp", 64));
  348. AddProperty( /* 23 */
  349. new MP4BitfieldProperty("startCompositionTimeStamp", 64));
  350. }
  351. void MP4SLConfigDescriptor::Generate()
  352. {
  353. // by default all tracks in an mp4 file
  354. // use predefined SLConfig descriptor == 2
  355. ((MP4Integer8Property*)m_pProperties[0])->SetValue(2);
  356. // which implies UseTimestampsFlag = 1
  357. ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1);
  358. // reserved = 3
  359. ((MP4BitfieldProperty*)m_pProperties[18])->SetValue(3);
  360. }
  361. void MP4SLConfigDescriptor::Read(MP4File* pFile)
  362. {
  363. ReadHeader(pFile);
  364. // read the first property, 'predefined'
  365. ReadProperties(pFile, 0, 1);
  366. // if predefined == 0
  367. if (((MP4Integer8Property*)m_pProperties[0])->GetValue() == 0) {
  368. /* read the next 18 properties */
  369. ReadProperties(pFile, 1, 18);
  370. }
  371. // now mutate
  372. Mutate();
  373. // and read the remaining properties
  374. ReadProperties(pFile, 19);
  375. }
  376. void MP4SLConfigDescriptor::Mutate()
  377. {
  378. u_int32_t i;
  379. u_int8_t predefined =
  380. ((MP4Integer8Property*)m_pProperties[0])->GetValue();
  381. if (predefined) {
  382. // properties 1-18 are implicit
  383. for (i = 1; i < m_pProperties.Size(); i++) {
  384. m_pProperties[i]->SetImplicit(true);
  385. }
  386. if (predefined == 1) {
  387. // UseTimestampsFlag = 0
  388. ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(0);
  389. // TimestampResolution = 1000
  390. ((MP4Integer32Property*)m_pProperties[9])->SetValue(1000);
  391. // TimeStampLength = 32
  392. ((MP4Integer8Property*)m_pProperties[11])->SetValue(32);
  393. } else if (predefined == 2) {
  394. // UseTimestampsFlag = 1
  395. ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1);
  396. }
  397. } else {
  398. #if 1
  399. for (i = 1; i <= 18; i++) {
  400. m_pProperties[i]->SetImplicit(false);
  401. }
  402. ((MP4BitfieldProperty*)m_pProperties[18])->SetValue(3);
  403. #endif
  404. }
  405. bool durationFlag =
  406. ((MP4BitfieldProperty*)m_pProperties[8])->GetValue();
  407. for (i = 19; i <= 21; i++) {
  408. m_pProperties[i]->SetImplicit(!durationFlag);
  409. }
  410. bool useTimeStampsFlag =
  411. ((MP4BitfieldProperty*)m_pProperties[6])->GetValue();
  412. for (i = 22; i <= 23; i++) {
  413. m_pProperties[i]->SetImplicit(useTimeStampsFlag);
  414. u_int8_t timeStampLength = MIN(64,
  415. ((MP4Integer8Property*)m_pProperties[11])->GetValue());
  416. ((MP4BitfieldProperty*)m_pProperties[i])->SetNumBits(timeStampLength);
  417. // handle a nonsensical situation gracefully
  418. if (timeStampLength == 0) {
  419. m_pProperties[i]->SetImplicit(true);
  420. }
  421. }
  422. }
  423. MP4ContentIdDescriptor::MP4ContentIdDescriptor()
  424. : MP4Descriptor(MP4ContentIdDescrTag)
  425. {
  426. AddProperty( /* 0 */
  427. new MP4BitfieldProperty("compatibility", 2));
  428. AddProperty( /* 1 */
  429. new MP4BitfieldProperty("contentTypeFlag", 1));
  430. AddProperty( /* 2 */
  431. new MP4BitfieldProperty("contentIdFlag", 1));
  432. AddProperty( /* 3 */
  433. new MP4BitfieldProperty("protectedContent", 1));
  434. AddProperty( /* 4 */
  435. new MP4BitfieldProperty("reserved", 3));
  436. AddProperty( /* 5 */
  437. new MP4Integer8Property("contentType"));
  438. AddProperty( /* 6 */
  439. new MP4Integer8Property("contentIdType"));
  440. AddProperty( /* 7 */
  441. new MP4BytesProperty("contentId"));
  442. }
  443. void MP4ContentIdDescriptor::Read(MP4File* pFile)
  444. {
  445. ReadHeader(pFile);
  446. /* read the first property, 'compatiblity' */
  447. ReadProperties(pFile, 0, 1);
  448. /* if compatiblity != 0 */
  449. if (((MP4Integer8Property*)m_pProperties[0])->GetValue() != 0) {
  450. /* we don't understand it */
  451. VERBOSE_READ(pFile->GetVerbosity(),
  452. printf("incompatible content id descriptor\n"));
  453. return;
  454. }
  455. /* read the next four properties */
  456. ReadProperties(pFile, 1, 4);
  457. /* which allows us to reconfigure ourselves */
  458. Mutate();
  459. bool contentTypeFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
  460. bool contentIdFlag = ((MP4BitfieldProperty*)m_pProperties[2])->GetValue();
  461. if (contentIdFlag) {
  462. u_int32_t cIdOffset = 2;
  463. if (contentTypeFlag) {
  464. cIdOffset++;
  465. }
  466. ((MP4BytesProperty*)m_pProperties[7])->SetValueSize(m_size - cIdOffset);
  467. }
  468. /* read the remaining properties */
  469. ReadProperties(pFile, 5);
  470. }
  471. void MP4ContentIdDescriptor::Mutate()
  472. {
  473. bool contentTypeFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue();
  474. m_pProperties[5]->SetImplicit(!contentTypeFlag);
  475. bool contentIdFlag = ((MP4BitfieldProperty*)m_pProperties[2])->GetValue();
  476. m_pProperties[6]->SetImplicit(!contentIdFlag);
  477. m_pProperties[7]->SetImplicit(!contentIdFlag);
  478. }
  479. MP4Descriptor* MP4DescriptorProperty::CreateDescriptor(u_int8_t tag)
  480. {
  481. MP4Descriptor* pDescriptor = NULL;
  482. switch (tag) {
  483. case MP4ESDescrTag:
  484. pDescriptor = new MP4ESDescriptor();
  485. break;
  486. case MP4DecConfigDescrTag:
  487. pDescriptor = new MP4DecConfigDescriptor();
  488. break;
  489. case MP4DecSpecificDescrTag:
  490. case MP4IPMPDescrTag:
  491. case MP4RegistrationDescrTag:
  492. pDescriptor = new MP4BytesDescriptor(tag);
  493. break;
  494. case MP4SLConfigDescrTag:
  495. pDescriptor = new MP4SLConfigDescriptor();
  496. break;
  497. case MP4ContentIdDescrTag:
  498. pDescriptor = new MP4ContentIdDescriptor();
  499. break;
  500. case MP4ESIDIncDescrTag:
  501. case MP4ESIDRefDescrTag:
  502. case MP4IPIPtrDescrTag:
  503. case MP4SupplContentIdDescrTag:
  504. case MP4IPMPPtrDescrTag:
  505. case MP4ExtProfileLevelDescrTag:
  506. pDescriptor = new MP4BaseDescriptor(tag);
  507. break;
  508. case MP4QosDescrTag:
  509. pDescriptor = new MP4QosDescriptorBase(MP4QosDescrTag);
  510. break;
  511. case MP4IODescrTag:
  512. case MP4FileIODescrTag:
  513. pDescriptor = new MP4IODescriptor();
  514. pDescriptor->SetTag(tag);
  515. break;
  516. case MP4ODescrTag:
  517. case MP4FileODescrTag:
  518. pDescriptor = new MP4ODescriptor();
  519. pDescriptor->SetTag(tag);
  520. break;
  521. }
  522. if (pDescriptor == NULL) {
  523. if (tag >= MP4OCIDescrTagsStart && tag <= MP4OCIDescrTagsEnd) {
  524. pDescriptor = CreateOCIDescriptor(tag);
  525. }
  526. if (tag >= MP4ExtDescrTagsStart && tag <= MP4ExtDescrTagsEnd) {
  527. pDescriptor = new MP4BytesDescriptor(tag);
  528. }
  529. }
  530. return pDescriptor;
  531. }