hinf.c
上传用户:sun1608
上传日期:2007-02-02
资源大小:6116k
文件大小:5k
源码类别:

流媒体/Mpeg4/MP4

开发平台:

Visual C++

  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. 2000, 2001.  All Rights Reserved.
  17.  * 
  18.  * Contributor(s): 
  19.  * Dave Mackie dmackie@cisco.com
  20.  */
  21. #include "quicktime.h"
  22. int quicktime_hinf_init(quicktime_hinf_t *hinf)
  23. {
  24. quicktime_trpy_init(&(hinf->trpy));
  25. quicktime_nump_init(&(hinf->nump));
  26. quicktime_tpyl_init(&(hinf->tpyl));
  27. quicktime_maxr_init(&(hinf->maxr));
  28. quicktime_dmed_init(&(hinf->dmed));
  29. quicktime_dimm_init(&(hinf->dimm));
  30. quicktime_drep_init(&(hinf->drep));
  31. quicktime_tmin_init(&(hinf->tmin));
  32. quicktime_tmax_init(&(hinf->tmax));
  33. quicktime_pmax_init(&(hinf->pmax));
  34. quicktime_dmax_init(&(hinf->dmax));
  35. quicktime_payt_init(&(hinf->payt));
  36. }
  37. int quicktime_hinf_delete(quicktime_hinf_t *hinf)
  38. {
  39. quicktime_trpy_delete(&(hinf->trpy));
  40. quicktime_nump_delete(&(hinf->nump));
  41. quicktime_tpyl_delete(&(hinf->tpyl));
  42. quicktime_maxr_delete(&(hinf->maxr));
  43. quicktime_dmed_delete(&(hinf->dmed));
  44. quicktime_dimm_delete(&(hinf->dimm));
  45. quicktime_drep_delete(&(hinf->drep));
  46. quicktime_tmin_delete(&(hinf->tmin));
  47. quicktime_tmax_delete(&(hinf->tmax));
  48. quicktime_pmax_delete(&(hinf->pmax));
  49. quicktime_dmax_delete(&(hinf->dmax));
  50. quicktime_payt_delete(&(hinf->payt));
  51. }
  52. int quicktime_hinf_dump(quicktime_hinf_t *hinf)
  53. {
  54. printf("   hinfn");
  55. quicktime_trpy_dump(&(hinf->trpy));
  56. quicktime_nump_dump(&(hinf->nump));
  57. quicktime_tpyl_dump(&(hinf->tpyl));
  58. quicktime_maxr_dump(&(hinf->maxr));
  59. quicktime_dmed_dump(&(hinf->dmed));
  60. quicktime_dimm_dump(&(hinf->dimm));
  61. quicktime_drep_dump(&(hinf->drep));
  62. quicktime_tmin_dump(&(hinf->tmin));
  63. quicktime_tmax_dump(&(hinf->tmax));
  64. quicktime_pmax_dump(&(hinf->pmax));
  65. quicktime_dmax_dump(&(hinf->dmax));
  66. quicktime_payt_dump(&(hinf->payt));
  67. }
  68. int quicktime_read_hinf(quicktime_t *file, quicktime_hinf_t *hinf, quicktime_atom_t *parent_atom)
  69. {
  70. quicktime_atom_t leaf_atom;
  71. do {
  72. quicktime_atom_read_header(file, &leaf_atom);
  73. if (quicktime_atom_is(&leaf_atom, "trpy")) {
  74. quicktime_read_trpy(file, &(hinf->trpy));
  75. } else if (quicktime_atom_is(&leaf_atom, "nump")) {
  76. quicktime_read_nump(file, &(hinf->nump));
  77. } else if (quicktime_atom_is(&leaf_atom, "tpyl")) {
  78. quicktime_read_tpyl(file, &(hinf->tpyl));
  79. } else if (quicktime_atom_is(&leaf_atom, "maxr")) {
  80. quicktime_read_maxr(file, &(hinf->maxr));
  81. } else if (quicktime_atom_is(&leaf_atom, "dmed")) {
  82. quicktime_read_dmed(file, &(hinf->dmed));
  83. } else if (quicktime_atom_is(&leaf_atom, "dimm")) {
  84. quicktime_read_dimm(file, &(hinf->dimm));
  85. } else if (quicktime_atom_is(&leaf_atom, "drep")) {
  86. quicktime_read_drep(file, &(hinf->drep));
  87. } else if (quicktime_atom_is(&leaf_atom, "tmin")) {
  88. quicktime_read_tmin(file, &(hinf->tmin));
  89. } else if (quicktime_atom_is(&leaf_atom, "tmax")) {
  90. quicktime_read_tmax(file, &(hinf->tmax));
  91. } else if (quicktime_atom_is(&leaf_atom, "pmax")) {
  92. quicktime_read_pmax(file, &(hinf->pmax));
  93. } else if (quicktime_atom_is(&leaf_atom, "dmax")) {
  94. quicktime_read_dmax(file, &(hinf->dmax));
  95. } else if (quicktime_atom_is(&leaf_atom, "payt")) {
  96. quicktime_read_payt(file, &(hinf->payt), &leaf_atom);
  97. } else {
  98. quicktime_atom_skip(file, &leaf_atom);
  99. }
  100. } while (quicktime_position(file) < parent_atom->end);
  101. }
  102. int quicktime_write_hinf(quicktime_t *file, quicktime_hinf_t *hinf)
  103. {
  104. quicktime_atom_t atom;
  105. quicktime_atom_write_header(file, &atom, "hinf");
  106. quicktime_write_trpy(file, &(hinf->trpy));
  107. quicktime_write_nump(file, &(hinf->nump));
  108. quicktime_write_tpyl(file, &(hinf->tpyl));
  109. quicktime_write_maxr(file, &(hinf->maxr));
  110. quicktime_write_dmed(file, &(hinf->dmed));
  111. quicktime_write_dimm(file, &(hinf->dimm));
  112. quicktime_write_drep(file, &(hinf->drep));
  113. quicktime_write_tmin(file, &(hinf->tmin));
  114. quicktime_write_tmax(file, &(hinf->tmax));
  115. quicktime_write_pmax(file, &(hinf->pmax));
  116. quicktime_write_dmax(file, &(hinf->dmax));
  117. quicktime_write_payt(file, &(hinf->payt));
  118. quicktime_atom_write_footer(file, &atom);
  119. }