Mercurial > libavformat.hg
comparison mov.c @ 2967:2fc866d3614f libavformat
Only export packets which belong to the existing AVStream.
To export the others separate AVStreams must be created!
author | michael |
---|---|
date | Sat, 26 Jan 2008 20:07:30 +0000 |
parents | 354c859bbf66 |
children | bd458b341e40 |
comparison
equal
deleted
inserted
replaced
2966:354c859bbf66 | 2967:2fc866d3614f |
---|---|
105 int time_rate; | 105 int time_rate; |
106 int current_sample; | 106 int current_sample; |
107 unsigned int bytes_per_frame; | 107 unsigned int bytes_per_frame; |
108 unsigned int samples_per_frame; | 108 unsigned int samples_per_frame; |
109 int dv_audio_container; | 109 int dv_audio_container; |
110 int pseudo_stream_id; | |
110 } MOVStreamContext; | 111 } MOVStreamContext; |
111 | 112 |
112 typedef struct MOVContext { | 113 typedef struct MOVContext { |
113 AVFormatContext *fc; | 114 AVFormatContext *fc; |
114 int time_scale; | 115 int time_scale; |
579 unsigned int color_end; | 580 unsigned int color_end; |
580 int color_index; | 581 int color_index; |
581 int color_dec; | 582 int color_dec; |
582 int color_greyscale; | 583 int color_greyscale; |
583 const uint8_t *color_table; | 584 const uint8_t *color_table; |
584 int j; | 585 int j, pseudo_stream_id; |
585 unsigned char r, g, b; | 586 unsigned char r, g, b; |
586 | 587 |
587 get_byte(pb); /* version */ | 588 get_byte(pb); /* version */ |
588 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ | 589 get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ |
589 | 590 |
590 entries = get_be32(pb); | 591 entries = get_be32(pb); |
591 | 592 |
592 while(entries--) { //Parsing Sample description table | 593 for(pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) { //Parsing Sample description table |
593 enum CodecID id; | 594 enum CodecID id; |
594 MOV_atom_t a = { 0, 0, 0 }; | 595 MOV_atom_t a = { 0, 0, 0 }; |
595 offset_t start_pos = url_ftell(pb); | 596 offset_t start_pos = url_ftell(pb); |
596 int size = get_be32(pb); /* size */ | 597 int size = get_be32(pb); /* size */ |
597 format = get_le32(pb); /* data format */ | 598 format = get_le32(pb); /* data format */ |
605 seperate AVStream but this needs a few changes in the mov demuxer, patch | 606 seperate AVStream but this needs a few changes in the mov demuxer, patch |
606 welcome */ | 607 welcome */ |
607 url_fskip(pb, size - (url_ftell(pb) - start_pos)); | 608 url_fskip(pb, size - (url_ftell(pb) - start_pos)); |
608 continue; | 609 continue; |
609 } | 610 } |
611 sc->pseudo_stream_id= pseudo_stream_id; | |
610 | 612 |
611 st->codec->codec_tag = format; | 613 st->codec->codec_tag = format; |
612 id = codec_get_id(codec_movaudio_tags, format); | 614 id = codec_get_id(codec_movaudio_tags, format); |
613 if (id<=0 && (format&0xFFFF) == 'm' + ('s'<<8)) | 615 if (id<=0 && (format&0xFFFF) == 'm' + ('s'<<8)) |
614 id = codec_get_id(codec_wav_tags, bswap_32(format)&0xFFFF); | 616 id = codec_get_id(codec_wav_tags, bswap_32(format)&0xFFFF); |
1343 } | 1345 } |
1344 sample_size = sc->sample_size > 0 ? sc->sample_size : sc->sample_sizes[current_sample]; | 1346 sample_size = sc->sample_size > 0 ? sc->sample_size : sc->sample_sizes[current_sample]; |
1345 dprintf(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " | 1347 dprintf(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " |
1346 "size %d, distance %d, keyframe %d\n", st->index, current_sample, | 1348 "size %d, distance %d, keyframe %d\n", st->index, current_sample, |
1347 current_offset, current_dts, sample_size, distance, keyframe); | 1349 current_offset, current_dts, sample_size, distance, keyframe); |
1350 if(sc->sample_to_chunk[stsc_index].id - 1 == sc->pseudo_stream_id) | |
1348 av_add_index_entry(st, current_offset, current_dts, sample_size, distance, | 1351 av_add_index_entry(st, current_offset, current_dts, sample_size, distance, |
1349 keyframe ? AVINDEX_KEYFRAME : 0); | 1352 keyframe ? AVINDEX_KEYFRAME : 0); |
1350 current_offset += sample_size; | 1353 current_offset += sample_size; |
1351 assert(sc->stts_data[stts_index].duration % sc->time_rate == 0); | 1354 assert(sc->stts_data[stts_index].duration % sc->time_rate == 0); |
1352 current_dts += sc->stts_data[stts_index].duration / sc->time_rate; | 1355 current_dts += sc->stts_data[stts_index].duration / sc->time_rate; |