You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
Merge commit 'b114f6d48a06a4dad6882bc83e07463905f004c4'
* commit 'b114f6d48a06a4dad6882bc83e07463905f004c4': avconv: factor out flushing the filters Conflicts: ffmpeg.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
48
ffmpeg.c
48
ffmpeg.c
@@ -1873,17 +1873,8 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
|
|||||||
if (*got_output || ret<0 || pkt->size)
|
if (*got_output || ret<0 || pkt->size)
|
||||||
decode_error_stat[ret<0] ++;
|
decode_error_stat[ret<0] ++;
|
||||||
|
|
||||||
if (!*got_output || ret < 0) {
|
if (!*got_output || ret < 0)
|
||||||
if (!pkt->size) {
|
|
||||||
for (i = 0; i < ist->nb_filters; i++)
|
|
||||||
#if 1
|
|
||||||
av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
|
|
||||||
#else
|
|
||||||
av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
ist->samples_decoded += decoded_frame->nb_samples;
|
ist->samples_decoded += decoded_frame->nb_samples;
|
||||||
ist->frames_decoded++;
|
ist->frames_decoded++;
|
||||||
@@ -2032,17 +2023,8 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*got_output || ret < 0) {
|
if (!*got_output || ret < 0)
|
||||||
if (!pkt->size) {
|
|
||||||
for (i = 0; i < ist->nb_filters; i++)
|
|
||||||
#if 1
|
|
||||||
av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
|
|
||||||
#else
|
|
||||||
av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
if(ist->top_field_first>=0)
|
if(ist->top_field_first>=0)
|
||||||
decoded_frame->top_field_first = ist->top_field_first;
|
decoded_frame->top_field_first = ist->top_field_first;
|
||||||
@@ -2187,6 +2169,21 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int send_filter_eof(InputStream *ist)
|
||||||
|
{
|
||||||
|
int i, ret;
|
||||||
|
for (i = 0; i < ist->nb_filters; i++) {
|
||||||
|
#if 1
|
||||||
|
ret = av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0);
|
||||||
|
#else
|
||||||
|
ret = av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
|
||||||
|
#endif
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* pkt = NULL means EOF (needed to flush decoder buffers) */
|
/* pkt = NULL means EOF (needed to flush decoder buffers) */
|
||||||
static int process_input_packet(InputStream *ist, const AVPacket *pkt)
|
static int process_input_packet(InputStream *ist, const AVPacket *pkt)
|
||||||
{
|
{
|
||||||
@@ -2271,7 +2268,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0 && !(!pkt && ist->decoding_needed))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
avpkt.dts=
|
avpkt.dts=
|
||||||
@@ -2291,6 +2288,15 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* after flushing, send an EOF on all the filter inputs attached to the stream */
|
||||||
|
if (!pkt && ist->decoding_needed && !got_output) {
|
||||||
|
int ret = send_filter_eof(ist);
|
||||||
|
if (ret < 0) {
|
||||||
|
av_log(NULL, AV_LOG_FATAL, "Error marking filters as finished\n");
|
||||||
|
exit_program(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* handle stream copy */
|
/* handle stream copy */
|
||||||
if (!ist->decoding_needed) {
|
if (!ist->decoding_needed) {
|
||||||
ist->dts = ist->next_dts;
|
ist->dts = ist->next_dts;
|
||||||
|
Reference in New Issue
Block a user