/* close files */
for(i=0;i<nb_output_files;i++) {
- /* maybe av_close_output_file ??? */
AVFormatContext *s = output_files[i];
int j;
if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
url_fclose(s->pb);
- for(j=0;j<s->nb_streams;j++) {
- av_metadata_free(&s->streams[j]->metadata);
- av_free(s->streams[j]->codec);
- av_free(s->streams[j]->info);
- av_free(s->streams[j]);
- }
- for(j=0;j<s->nb_programs;j++) {
- av_metadata_free(&s->programs[j]->metadata);
- }
- for(j=0;j<s->nb_chapters;j++) {
- av_metadata_free(&s->chapters[j]->metadata);
- }
- av_metadata_free(&s->metadata);
- av_free(s);
+ avformat_free_context(s);
av_free(output_streams_for_file[i]);
}
for(i=0;i<nb_input_files;i++) {
fclose(vstats_file);
av_free(vstats_filename);
- av_free(opt_names);
av_free(streamid_map);
av_free(input_codecs);
av_free(output_codecs);
choose_pixel_fmt(st, codec);
}
- if(!st->codec->thread_count)
- st->codec->thread_count = 1;
- if(st->codec->thread_count>1)
- avcodec_thread_init(st->codec, st->codec->thread_count);
-
if(st->codec->flags & CODEC_FLAG_BITEXACT)
nopts = 1;
decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
/* XXX: allocate picture correctly */
avcodec_get_frame_defaults(&picture);
- ist->st->codec->reordered_opaque = pkt_pts;
+ avpkt.pts = pkt_pts;
+ avpkt.dts = ist->pts;
pkt_pts = AV_NOPTS_VALUE;
ret = avcodec_decode_video2(ist->st->codec,
/* no picture yet */
goto discard_packet;
}
- ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.reordered_opaque, ist->pts);
+ ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.pkt_pts, picture.pkt_dts);
if (ist->st->codec->time_base.num != 0) {
int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
ist->next_pts += ((int64_t)AV_TIME_BASE *
for(i=0;i<ic->nb_streams;i++) {
AVStream *st = ic->streams[i];
AVCodecContext *dec = st->codec;
- avcodec_thread_init(dec, thread_count);
+ dec->thread_count = thread_count;
input_codecs = grow_array(input_codecs, sizeof(*input_codecs), &nb_input_codecs, nb_input_codecs + 1);
switch (dec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
ost->bitstream_filters = video_bitstream_filters;
video_bitstream_filters= NULL;
- avcodec_thread_init(st->codec, thread_count);
+ st->codec->thread_count= thread_count;
video_enc = st->codec;
ost->bitstream_filters = audio_bitstream_filters;
audio_bitstream_filters= NULL;
- avcodec_thread_init(st->codec, thread_count);
+ st->codec->thread_count= thread_count;
audio_enc = st->codec;
audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;