Mercurial > libavformat.hg
comparison 4xm.c @ 824:779b1e87b865 libavformat
more non portable float parsing code ...
author | michael |
---|---|
date | Tue, 19 Jul 2005 15:32:43 +0000 |
parents | feca73904e67 |
children | da1d5db0ce5c |
comparison
equal
deleted
inserted
replaced
823:e8b4454b997d | 824:779b1e87b865 |
---|---|
73 int64_t audio_pts; | 73 int64_t audio_pts; |
74 int64_t video_pts; | 74 int64_t video_pts; |
75 float fps; | 75 float fps; |
76 } FourxmDemuxContext; | 76 } FourxmDemuxContext; |
77 | 77 |
78 static float get_le_float(unsigned char *buffer) | |
79 { | |
80 float f; | |
81 unsigned char *float_buffer = (unsigned char *)&f; | |
82 | |
83 #ifdef WORDS_BIGENDIAN | |
84 float_buffer[0] = buffer[3]; | |
85 float_buffer[1] = buffer[2]; | |
86 float_buffer[2] = buffer[1]; | |
87 float_buffer[3] = buffer[0]; | |
88 #else | |
89 float_buffer[0] = buffer[0]; | |
90 float_buffer[1] = buffer[1]; | |
91 float_buffer[2] = buffer[2]; | |
92 float_buffer[3] = buffer[3]; | |
93 #endif | |
94 | |
95 return f; | |
96 } | |
97 | |
98 static int fourxm_probe(AVProbeData *p) | 78 static int fourxm_probe(AVProbeData *p) |
99 { | 79 { |
100 if (p->buf_size < 12) | 80 if (p->buf_size < 12) |
101 return 0; | 81 return 0; |
102 | 82 |
145 for (i = 0; i < header_size - 8; i++) { | 125 for (i = 0; i < header_size - 8; i++) { |
146 fourcc_tag = LE_32(&header[i]); | 126 fourcc_tag = LE_32(&header[i]); |
147 size = LE_32(&header[i + 4]); | 127 size = LE_32(&header[i + 4]); |
148 | 128 |
149 if (fourcc_tag == std__TAG) { | 129 if (fourcc_tag == std__TAG) { |
150 fourxm->fps = get_le_float(&header[i + 12]); | 130 fourxm->fps = av_int2flt(LE_32(&header[i + 12])); |
151 } else if (fourcc_tag == vtrk_TAG) { | 131 } else if (fourcc_tag == vtrk_TAG) { |
152 /* check that there is enough data */ | 132 /* check that there is enough data */ |
153 if (size != vtrk_SIZE) { | 133 if (size != vtrk_SIZE) { |
154 av_free(header); | 134 av_free(header); |
155 return AVERROR_INVALIDDATA; | 135 return AVERROR_INVALIDDATA; |