av_freep(&ost->avfilter);
av_freep(&ost->logfile_prefix);
+ av_freep(&ost->audio_channels_map);
+ ost->audio_channels_mapped = 0;
+
avcodec_free_context(&ost->enc_ctx);
av_freep(&output_streams[i]);
a = AVERROR(ENOMEM);
}
if (a > 0) {
+ pkt->side_data = NULL;
+ pkt->side_data_elems = 0;
av_free_packet(pkt);
new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size,
av_buffer_default_free, NULL, 0);
}
/* pkt = NULL means EOF (needed to flush decoder buffers) */
-static int output_packet(InputStream *ist, const AVPacket *pkt)
+static int process_input_packet(InputStream *ist, const AVPacket *pkt)
{
int ret = 0, i;
int got_output = 0;
if (!ist->saw_first_ts) {
ist->dts = ist->st->avg_frame_rate.num ? - ist->dec_ctx->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0;
ist->pts = 0;
- if (pkt != NULL && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) {
+ if (pkt && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) {
ist->dts += av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
ist->pts = ist->dts; //unused but better to set it to a value thats not totally wrong
}
if (ist->next_pts == AV_NOPTS_VALUE)
ist->next_pts = ist->pts;
- if (pkt == NULL) {
+ if (!pkt) {
/* EOF handling */
av_init_packet(&avpkt);
avpkt.data = NULL;
for (i = 0; i < ifile->nb_streams; i++) {
ist = input_streams[ifile->ist_index + i];
if (ist->decoding_needed) {
- ret = output_packet(ist, NULL);
+ ret = process_input_packet(ist, NULL);
if (ret>0)
return 0;
}
sub2video_heartbeat(ist, pkt.pts);
- ret = output_packet(ist, &pkt);
+ ret = process_input_packet(ist, &pkt);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d: %s\n",
ist->file_index, ist->st->index, av_err2str(ret));
for (i = 0; i < nb_input_streams; i++) {
ist = input_streams[i];
if (!input_files[ist->file_index]->eof_reached && ist->decoding_needed) {
- output_packet(ist, NULL);
+ process_input_packet(ist, NULL);
}
}
flush_encoders();