Mercurial > libavformat.hg
comparison avienc.c @ 820:feca73904e67 libavformat
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
author | michael |
---|---|
date | Sun, 17 Jul 2005 22:24:36 +0000 |
parents | 75246147b635 |
children | 89897453def2 |
comparison
equal
deleted
inserted
replaced
819:a6c035e7f429 | 820:feca73904e67 |
---|---|
336 put_le32(pb, 14 * 4); | 336 put_le32(pb, 14 * 4); |
337 bitrate = 0; | 337 bitrate = 0; |
338 | 338 |
339 video_enc = NULL; | 339 video_enc = NULL; |
340 for(n=0;n<s->nb_streams;n++) { | 340 for(n=0;n<s->nb_streams;n++) { |
341 stream = &s->streams[n]->codec; | 341 stream = s->streams[n]->codec; |
342 bitrate += stream->bit_rate; | 342 bitrate += stream->bit_rate; |
343 if (stream->codec_type == CODEC_TYPE_VIDEO) | 343 if (stream->codec_type == CODEC_TYPE_VIDEO) |
344 video_enc = stream; | 344 video_enc = stream; |
345 } | 345 } |
346 | 346 |
374 /* stream list */ | 374 /* stream list */ |
375 for(i=0;i<n;i++) { | 375 for(i=0;i<n;i++) { |
376 list2 = start_tag(pb, "LIST"); | 376 list2 = start_tag(pb, "LIST"); |
377 put_tag(pb, "strl"); | 377 put_tag(pb, "strl"); |
378 | 378 |
379 stream = &s->streams[i]->codec; | 379 stream = s->streams[i]->codec; |
380 | 380 |
381 /* FourCC should really be set by the codec itself */ | 381 /* FourCC should really be set by the codec itself */ |
382 if (! stream->codec_tag) { | 382 if (! stream->codec_tag) { |
383 stream->codec_tag = codec_get_bmp_tag(stream->codec_id); | 383 stream->codec_tag = codec_get_bmp_tag(stream->codec_id); |
384 } | 384 } |
502 return -1; | 502 return -1; |
503 | 503 |
504 for (i=0;i<s->nb_streams;i++) { | 504 for (i=0;i<s->nb_streams;i++) { |
505 offset_t ix, pos; | 505 offset_t ix, pos; |
506 | 506 |
507 avi_stream2fourcc(&tag[0], i, s->streams[i]->codec.codec_type); | 507 avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type); |
508 ix_tag[3] = '0' + i; | 508 ix_tag[3] = '0' + i; |
509 | 509 |
510 /* Writing AVI OpenDML leaf index chunk */ | 510 /* Writing AVI OpenDML leaf index chunk */ |
511 ix = url_ftell(pb); | 511 ix = url_ftell(pb); |
512 put_tag(pb, &ix_tag[0]); /* ix?? */ | 512 put_tag(pb, &ix_tag[0]); /* ix?? */ |
574 } | 574 } |
575 empty = 0; | 575 empty = 0; |
576 } | 576 } |
577 if (!empty) { | 577 if (!empty) { |
578 avi_stream2fourcc(&tag[0], stream_id, | 578 avi_stream2fourcc(&tag[0], stream_id, |
579 s->streams[stream_id]->codec.codec_type); | 579 s->streams[stream_id]->codec->codec_type); |
580 put_tag(pb, &tag[0]); | 580 put_tag(pb, &tag[0]); |
581 put_le32(pb, ie->flags); | 581 put_le32(pb, ie->flags); |
582 put_le32(pb, ie->pos); | 582 put_le32(pb, ie->pos); |
583 put_le32(pb, ie->len); | 583 put_le32(pb, ie->len); |
584 entry[stream_id]++; | 584 entry[stream_id]++; |
589 /* Fill in frame/sample counters */ | 589 /* Fill in frame/sample counters */ |
590 file_size = url_ftell(pb); | 590 file_size = url_ftell(pb); |
591 nb_frames = 0; | 591 nb_frames = 0; |
592 for(n=0;n<s->nb_streams;n++) { | 592 for(n=0;n<s->nb_streams;n++) { |
593 if (avi->frames_hdr_strm[n] != 0) { | 593 if (avi->frames_hdr_strm[n] != 0) { |
594 stream = &s->streams[n]->codec; | 594 stream = s->streams[n]->codec; |
595 url_fseek(pb, avi->frames_hdr_strm[n], SEEK_SET); | 595 url_fseek(pb, avi->frames_hdr_strm[n], SEEK_SET); |
596 ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); | 596 ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); |
597 if (au_ssize == 0) { | 597 if (au_ssize == 0) { |
598 put_le32(pb, stream->frame_number); | 598 put_le32(pb, stream->frame_number); |
599 nb_frames += stream->frame_number; | 599 nb_frames += stream->frame_number; |
616 AVIContext *avi = s->priv_data; | 616 AVIContext *avi = s->priv_data; |
617 ByteIOContext *pb = &s->pb; | 617 ByteIOContext *pb = &s->pb; |
618 unsigned char tag[5]; | 618 unsigned char tag[5]; |
619 unsigned int flags=0; | 619 unsigned int flags=0; |
620 const int stream_index= pkt->stream_index; | 620 const int stream_index= pkt->stream_index; |
621 AVCodecContext *enc= &s->streams[stream_index]->codec; | 621 AVCodecContext *enc= s->streams[stream_index]->codec; |
622 int size= pkt->size; | 622 int size= pkt->size; |
623 | 623 |
624 // av_log(s, AV_LOG_DEBUG, "%lld %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index); | 624 // av_log(s, AV_LOG_DEBUG, "%lld %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index); |
625 while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avi->packet_count[stream_index]){ | 625 while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avi->packet_count[stream_index]){ |
626 AVPacket empty_packet; | 626 AVPacket empty_packet; |
703 url_fseek(pb, avi->odml_list - 8, SEEK_SET); | 703 url_fseek(pb, avi->odml_list - 8, SEEK_SET); |
704 put_tag(pb, "LIST"); /* Making this AVI OpenDML one */ | 704 put_tag(pb, "LIST"); /* Making this AVI OpenDML one */ |
705 url_fskip(pb, 16); | 705 url_fskip(pb, 16); |
706 | 706 |
707 for (n=nb_frames=0;n<s->nb_streams;n++) { | 707 for (n=nb_frames=0;n<s->nb_streams;n++) { |
708 AVCodecContext *stream = &s->streams[n]->codec; | 708 AVCodecContext *stream = s->streams[n]->codec; |
709 if (stream->codec_type == CODEC_TYPE_VIDEO) { | 709 if (stream->codec_type == CODEC_TYPE_VIDEO) { |
710 if (nb_frames < stream->frame_number) | 710 if (nb_frames < stream->frame_number) |
711 nb_frames = stream->frame_number; | 711 nb_frames = stream->frame_number; |
712 } else { | 712 } else { |
713 if (stream->codec_id == CODEC_ID_MP2 || stream->codec_id == CODEC_ID_MP3) { | 713 if (stream->codec_id == CODEC_ID_MP2 || stream->codec_id == CODEC_ID_MP3) { |