comparison src/http/modules/ngx_http_mp4_module.c @ 4441:e30845779761 stable-1.0

Merge of r4383, r4403: MP4 fixes: *) Fixed mp4 if first entry in stsc was skipped (ticket #72). If first entry in stsc atom was skipped, and seek was to chunk boundary, than first_chunk in the generated stsc table wasn't set to 1. *) Fixed handling of mp4 above 2G and 32bit offsets (ticket #84).
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 05 Feb 2012 15:51:20 +0000
parents d2516d4ab842
children 4919fb357a5d
comparison
equal deleted inserted replaced
4440:97995d63aa36 4441:e30845779761
163 ((u_char *) (p))[5] = n2; \ 163 ((u_char *) (p))[5] = n2; \
164 ((u_char *) (p))[6] = n3; \ 164 ((u_char *) (p))[6] = n3; \
165 ((u_char *) (p))[7] = n4 165 ((u_char *) (p))[7] = n4
166 166
167 #define ngx_mp4_get_32value(p) \ 167 #define ngx_mp4_get_32value(p) \
168 ( (((u_char *) (p))[0] << 24) \ 168 ( ((uint32_t) ((u_char *) (p))[0] << 24) \
169 + (((u_char *) (p))[1] << 16) \ 169 + ( ((u_char *) (p))[1] << 16) \
170 + (((u_char *) (p))[2] << 8) \ 170 + ( ((u_char *) (p))[2] << 8) \
171 + (((u_char *) (p))[3]) ) 171 + ( ((u_char *) (p))[3]) )
172 172
173 #define ngx_mp4_set_32value(p, n) \ 173 #define ngx_mp4_set_32value(p, n) \
174 ((u_char *) (p))[0] = (u_char) ((n) >> 24); \ 174 ((u_char *) (p))[0] = (u_char) ((n) >> 24); \
175 ((u_char *) (p))[1] = (u_char) ((n) >> 16); \ 175 ((u_char *) (p))[1] = (u_char) ((n) >> 16); \
176 ((u_char *) (p))[2] = (u_char) ((n) >> 8); \ 176 ((u_char *) (p))[2] = (u_char) ((n) >> 8); \
2380 trak->start_chunk, trak->chunk_samples); 2380 trak->start_chunk, trak->chunk_samples);
2381 2381
2382 data->pos = (u_char *) entry; 2382 data->pos = (u_char *) entry;
2383 atom_size = sizeof(ngx_mp4_stsc_atom_t) + (data->last - data->pos); 2383 atom_size = sizeof(ngx_mp4_stsc_atom_t) + (data->last - data->pos);
2384 2384
2385 ngx_mp4_set_32value(entry->chunk, 1);
2386
2385 if (trak->chunk_samples) { 2387 if (trak->chunk_samples) {
2386 2388
2387 first = &trak->stsc_chunk_entry; 2389 first = &trak->stsc_chunk_entry;
2388 ngx_mp4_set_32value(first->chunk, 1); 2390 ngx_mp4_set_32value(first->chunk, 1);
2389 ngx_mp4_set_32value(first->samples, samples - trak->chunk_samples); 2391 ngx_mp4_set_32value(first->samples, samples - trak->chunk_samples);