Commit 12d82004 authored by Marton Balint's avatar Marton Balint Committed by Michael Niedermayer

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: 's avatarNicolas George <george@nsup.org>
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent 7ff0137a
...@@ -57,6 +57,7 @@ typedef struct { ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment