concatdec: store eof condition in context

This is needed later for outpoint support which may leave the last file in a
not-eof state.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2015-07-04 23:34:17 +02:00 committed by Michael Niedermayer
parent 7ff0137a1f
commit 12d82004c5

View File

@ -57,6 +57,7 @@ typedef struct {
AVFormatContext *avf; AVFormatContext *avf;
int safe; int safe;
int seekable; int seekable;
int eof;
ConcatMatchMode stream_match_mode; ConcatMatchMode stream_match_mode;
unsigned auto_convert; unsigned auto_convert;
} ConcatContext; } ConcatContext;
@ -447,8 +448,10 @@ static int open_next_file(AVFormatContext *avf)
cat->cur_file->duration -= (cat->cur_file->inpoint - cat->cur_file->file_start_time); cat->cur_file->duration -= (cat->cur_file->inpoint - cat->cur_file->file_start_time);
} }
if (++fileno >= cat->nb_files) if (++fileno >= cat->nb_files) {
cat->eof = 1;
return AVERROR_EOF; return AVERROR_EOF;
}
return open_file(avf, fileno); return open_file(avf, fileno);
} }
@ -500,6 +503,9 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
ConcatStream *cs; ConcatStream *cs;
AVStream *st; AVStream *st;
if (cat->eof)
return AVERROR_EOF;
if (!cat->avf) if (!cat->avf)
return AVERROR(EIO); return AVERROR(EIO);
@ -631,6 +637,7 @@ static int concat_seek(AVFormatContext *avf, int stream,
cat->cur_file = cur_file_saved; cat->cur_file = cur_file_saved;
} else { } else {
avformat_close_input(&cur_avf_saved); avformat_close_input(&cur_avf_saved);
cat->eof = 0;
} }
return ret; return ret;
} }