"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "avconv.c" between
libav-12.2.tar.gz and libav-12.3.tar.gz

About: libav provides cross-platform tools ("avconv") and libraries to convert, manipulate and stream a wide range of multimedia (audio and video) formats and protocols.

avconv.c  (libav-12.2):avconv.c  (libav-12.3)
skipping to change at line 1327 skipping to change at line 1327
if (!dec->channel_layout) if (!dec->channel_layout)
return 0; return 0;
av_get_channel_layout_string(layout_name, sizeof(layout_name), av_get_channel_layout_string(layout_name, sizeof(layout_name),
dec->channels, dec->channel_layout); dec->channels, dec->channel_layout);
av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream " av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream "
"#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name); "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name);
} }
return 1; return 1;
} }
static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output,
int *decode_failed)
{ {
AVFrame *decoded_frame, *f; AVFrame *decoded_frame, *f;
AVCodecContext *avctx = ist->dec_ctx; AVCodecContext *avctx = ist->dec_ctx;
int i, ret, err = 0; int i, ret, err = 0;
if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc()))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc()))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
decoded_frame = ist->decoded_frame; decoded_frame = ist->decoded_frame;
ret = decode(avctx, decoded_frame, got_output, pkt); ret = decode(avctx, decoded_frame, got_output, pkt);
if (ret < 0)
*decode_failed = 1;
if (!*got_output || ret < 0) if (!*got_output || ret < 0)
return ret; return ret;
ist->samples_decoded += decoded_frame->nb_samples; ist->samples_decoded += decoded_frame->nb_samples;
ist->frames_decoded++; ist->frames_decoded++;
/* if the decoder provides a pts, use it instead of the last packet pts. /* if the decoder provides a pts, use it instead of the last packet pts.
the decoder could be delaying output by a packet or more. */ the decoder could be delaying output by a packet or more. */
if (decoded_frame->pts != AV_NOPTS_VALUE) if (decoded_frame->pts != AV_NOPTS_VALUE)
ist->next_dts = av_rescale_q(decoded_frame->pts, ist->st->time_base, AV_ TIME_BASE_Q); ist->next_dts = av_rescale_q(decoded_frame->pts, ist->st->time_base, AV_ TIME_BASE_Q);
skipping to change at line 1378 skipping to change at line 1381
err = ifilter_send_frame(ist->filters[i], f); err = ifilter_send_frame(ist->filters[i], f);
if (err < 0) if (err < 0)
break; break;
} }
av_frame_unref(ist->filter_frame); av_frame_unref(ist->filter_frame);
av_frame_unref(decoded_frame); av_frame_unref(decoded_frame);
return err < 0 ? err : ret; return err < 0 ? err : ret;
} }
static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output) static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output,
int *decode_failed)
{ {
AVFrame *decoded_frame, *f; AVFrame *decoded_frame, *f;
int i, ret = 0, err = 0; int i, ret = 0, err = 0;
if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc()))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc()))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
decoded_frame = ist->decoded_frame; decoded_frame = ist->decoded_frame;
ret = decode(ist->dec_ctx, decoded_frame, got_output, pkt); ret = decode(ist->dec_ctx, decoded_frame, got_output, pkt);
if (ret < 0)
*decode_failed = 1;
if (!*got_output || ret < 0) if (!*got_output || ret < 0)
return ret; return ret;
ist->frames_decoded++; ist->frames_decoded++;
if (ist->hwaccel_retrieve_data && decoded_frame->format == ist->hwaccel_pix_ fmt) { if (ist->hwaccel_retrieve_data && decoded_frame->format == ist->hwaccel_pix_ fmt) {
err = ist->hwaccel_retrieve_data(ist->dec_ctx, decoded_frame); err = ist->hwaccel_retrieve_data(ist->dec_ctx, decoded_frame);
if (err < 0) if (err < 0)
goto fail; goto fail;
} }
skipping to change at line 1430 skipping to change at line 1436
if (err < 0) if (err < 0)
break; break;
} }
fail: fail:
av_frame_unref(ist->filter_frame); av_frame_unref(ist->filter_frame);
av_frame_unref(decoded_frame); av_frame_unref(decoded_frame);
return err < 0 ? err : ret; return err < 0 ? err : ret;
} }
static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output) static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
int *decode_failed)
{ {
AVSubtitle subtitle; AVSubtitle subtitle;
int i, ret = avcodec_decode_subtitle2(ist->dec_ctx, int i, ret = avcodec_decode_subtitle2(ist->dec_ctx,
&subtitle, got_output, pkt); &subtitle, got_output, pkt);
if (ret < 0) if (ret < 0) {
*decode_failed = 1;
return ret; return ret;
}
if (!*got_output) if (!*got_output)
return ret; return ret;
ist->frames_decoded++; ist->frames_decoded++;
for (i = 0; i < nb_output_streams; i++) { for (i = 0; i < nb_output_streams; i++) {
OutputStream *ost = output_streams[i]; OutputStream *ost = output_streams[i];
if (!check_output_constraints(ist, ost) || !ost->encoding_needed) if (!check_output_constraints(ist, ost) || !ost->encoding_needed)
continue; continue;
skipping to change at line 1492 skipping to change at line 1501
avpkt = *pkt; avpkt = *pkt;
} }
if (pkt && pkt->dts != AV_NOPTS_VALUE) if (pkt && pkt->dts != AV_NOPTS_VALUE)
ist->next_dts = ist->last_dts = av_rescale_q(pkt->dts, ist->st->time_bas e, AV_TIME_BASE_Q); ist->next_dts = ist->last_dts = av_rescale_q(pkt->dts, ist->st->time_bas e, AV_TIME_BASE_Q);
// while we have more to decode or while the decoder did output something on EOF // while we have more to decode or while the decoder did output something on EOF
while (ist->decoding_needed && (!pkt || avpkt.size > 0)) { while (ist->decoding_needed && (!pkt || avpkt.size > 0)) {
int ret = 0; int ret = 0;
int got_output = 0; int got_output = 0;
int decode_failed = 0;
if (!repeating) if (!repeating)
ist->last_dts = ist->next_dts; ist->last_dts = ist->next_dts;
switch (ist->dec_ctx->codec_type) { switch (ist->dec_ctx->codec_type) {
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
ret = decode_audio (ist, repeating ? NULL : &avpkt, &got_output); ret = decode_audio (ist, repeating ? NULL : &avpkt, &got_output,
&decode_failed);
break; break;
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
ret = decode_video (ist, repeating ? NULL : &avpkt, &got_output); ret = decode_video (ist, repeating ? NULL : &avpkt, &got_output,
&decode_failed);
if (repeating && !got_output) if (repeating && !got_output)
; ;
else if (pkt && pkt->duration) else if (pkt && pkt->duration)
ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);
else if (ist->st->avg_frame_rate.num) else if (ist->st->avg_frame_rate.num)
ist->next_dts += av_rescale_q(1, av_inv_q(ist->st->avg_frame_rat e), ist->next_dts += av_rescale_q(1, av_inv_q(ist->st->avg_frame_rat e),
AV_TIME_BASE_Q); AV_TIME_BASE_Q);
else if (ist->dec_ctx->framerate.num != 0) { else if (ist->dec_ctx->framerate.num != 0) {
int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 :
ist->dec_ctx->ticks_per_frame ; ist->dec_ctx->ticks_per_frame ;
ist->next_dts += av_rescale_q(ticks, ist->dec_ctx->framerate, AV _TIME_BASE_Q); ist->next_dts += av_rescale_q(ticks, ist->dec_ctx->framerate, AV _TIME_BASE_Q);
} }
break; break;
case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_SUBTITLE:
if (repeating) if (repeating)
break; break;
ret = transcode_subtitles(ist, &avpkt, &got_output); ret = transcode_subtitles(ist, &avpkt, &got_output, &decode_failed);
break; break;
default: default:
return; return;
} }
if (ret < 0) { if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n", if (decode_failed) {
ist->file_index, ist->st->index); av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n
if (exit_on_error) ",
ist->file_index, ist->st->index);
} else {
av_log(NULL, AV_LOG_FATAL, "Error while processing the decoded "
"data for stream #%d:%d\n", ist->file_index, ist->st->ind
ex);
}
if (!decode_failed || exit_on_error)
exit_program(1); exit_program(1);
break; break;
} }
if (!got_output) if (!got_output)
break; break;
repeating = 1; repeating = 1;
} }
 End of changes. 12 change blocks. 
10 lines changed or deleted 29 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)