2 * Copyright (c) 2012 Nicolas George
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "libavutil/avassert.h"
22 #include "libavutil/avstring.h"
23 #include "libavutil/intreadwrite.h"
24 #include "libavutil/opt.h"
25 #include "libavutil/parseutils.h"
26 #include "libavutil/timestamp.h"
31 typedef enum ConcatMatchMode {
36 typedef struct ConcatStream {
37 AVBitStreamFilterContext *bsf;
38 AVCodecContext *avctx;
45 int64_t file_start_time;
48 ConcatStream *streams;
51 AVDictionary *metadata;
64 ConcatMatchMode stream_match_mode;
65 unsigned auto_convert;
66 int segment_time_metadata;
69 static int concat_probe(AVProbeData *probe)
71 return memcmp(probe->buf, "ffconcat version 1.0", 20) ?
72 0 : AVPROBE_SCORE_MAX;
75 static char *get_keyword(uint8_t **cursor)
77 char *ret = *cursor += strspn(*cursor, SPACE_CHARS);
78 *cursor += strcspn(*cursor, SPACE_CHARS);
81 *cursor += strspn(*cursor, SPACE_CHARS);
86 static int safe_filename(const char *f)
88 const char *start = f;
92 if (!((unsigned)((*f | 32) - 'a') < 26 ||
93 (unsigned)(*f - '0') < 10 || *f == '_' || *f == '-')) {
105 #define FAIL(retcode) do { ret = (retcode); goto fail; } while(0)
107 static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
108 unsigned *nb_files_alloc)
110 ConcatContext *cat = avf->priv_data;
114 size_t url_len, proto_len;
117 if (cat->safe > 0 && !safe_filename(filename)) {
118 av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename);
119 FAIL(AVERROR(EPERM));
122 proto = avio_find_protocol_name(filename);
123 proto_len = proto ? strlen(proto) : 0;
124 if (!memcmp(filename, proto, proto_len) &&
125 (filename[proto_len] == ':' || filename[proto_len] == ',')) {
129 url_len = strlen(avf->filename) + strlen(filename) + 16;
130 if (!(url = av_malloc(url_len)))
131 FAIL(AVERROR(ENOMEM));
132 ff_make_absolute_url(url, url_len, avf->filename, filename);
136 if (cat->nb_files >= *nb_files_alloc) {
137 size_t n = FFMAX(*nb_files_alloc * 2, 16);
138 ConcatFile *new_files;
139 if (n <= cat->nb_files || n > SIZE_MAX / sizeof(*cat->files) ||
140 !(new_files = av_realloc(cat->files, n * sizeof(*cat->files))))
141 FAIL(AVERROR(ENOMEM));
142 cat->files = new_files;
146 file = &cat->files[cat->nb_files++];
147 memset(file, 0, sizeof(*file));
151 file->start_time = AV_NOPTS_VALUE;
152 file->duration = AV_NOPTS_VALUE;
153 file->inpoint = AV_NOPTS_VALUE;
154 file->outpoint = AV_NOPTS_VALUE;
164 static int copy_stream_props(AVStream *st, AVStream *source_st)
168 if (st->codecpar->codec_id || !source_st->codecpar->codec_id) {
169 if (st->codecpar->extradata_size < source_st->codecpar->extradata_size) {
170 if (st->codecpar->extradata) {
171 av_freep(&st->codecpar->extradata);
172 st->codecpar->extradata_size = 0;
174 ret = ff_alloc_extradata(st->codecpar,
175 source_st->codecpar->extradata_size);
179 memcpy(st->codecpar->extradata, source_st->codecpar->extradata,
180 source_st->codecpar->extradata_size);
183 if ((ret = avcodec_parameters_copy(st->codecpar, source_st->codecpar)) < 0)
185 st->r_frame_rate = source_st->r_frame_rate;
186 st->avg_frame_rate = source_st->avg_frame_rate;
187 st->time_base = source_st->time_base;
188 st->sample_aspect_ratio = source_st->sample_aspect_ratio;
190 av_dict_copy(&st->metadata, source_st->metadata, 0);
194 static int detect_stream_specific(AVFormatContext *avf, int idx)
196 ConcatContext *cat = avf->priv_data;
197 AVStream *st = cat->avf->streams[idx];
198 ConcatStream *cs = &cat->cur_file->streams[idx];
199 AVBitStreamFilterContext *bsf;
202 if (cat->auto_convert && st->codecpar->codec_id == AV_CODEC_ID_H264 &&
203 (st->codecpar->extradata_size < 4 || AV_RB32(st->codecpar->extradata) != 1)) {
204 av_log(cat->avf, AV_LOG_INFO,
205 "Auto-inserting h264_mp4toannexb bitstream filter\n");
206 if (!(bsf = av_bitstream_filter_init("h264_mp4toannexb"))) {
207 av_log(avf, AV_LOG_ERROR, "h264_mp4toannexb bitstream filter "
208 "required for H.264 streams\n");
209 return AVERROR_BSF_NOT_FOUND;
213 cs->avctx = avcodec_alloc_context3(NULL);
215 return AVERROR(ENOMEM);
217 /* This really should be part of the bsf work.
218 Note: input bitstream filtering will not work with bsf that
219 create extradata from the first packet. */
220 av_freep(&st->codecpar->extradata);
221 st->codecpar->extradata_size = 0;
223 ret = avcodec_parameters_to_context(cs->avctx, st->codecpar);
225 avcodec_free_context(&cs->avctx);
233 static int match_streams_one_to_one(AVFormatContext *avf)
235 ConcatContext *cat = avf->priv_data;
239 for (i = cat->cur_file->nb_streams; i < cat->avf->nb_streams; i++) {
240 if (i < avf->nb_streams) {
241 st = avf->streams[i];
243 if (!(st = avformat_new_stream(avf, NULL)))
244 return AVERROR(ENOMEM);
246 if ((ret = copy_stream_props(st, cat->avf->streams[i])) < 0)
248 cat->cur_file->streams[i].out_stream_index = i;
253 static int match_streams_exact_id(AVFormatContext *avf)
255 ConcatContext *cat = avf->priv_data;
259 for (i = cat->cur_file->nb_streams; i < cat->avf->nb_streams; i++) {
260 st = cat->avf->streams[i];
261 for (j = 0; j < avf->nb_streams; j++) {
262 if (avf->streams[j]->id == st->id) {
263 av_log(avf, AV_LOG_VERBOSE,
264 "Match slave stream #%d with stream #%d id 0x%x\n",
266 if ((ret = copy_stream_props(avf->streams[j], st)) < 0)
268 cat->cur_file->streams[i].out_stream_index = j;
275 static int match_streams(AVFormatContext *avf)
277 ConcatContext *cat = avf->priv_data;
281 if (cat->cur_file->nb_streams >= cat->avf->nb_streams)
283 map = av_realloc(cat->cur_file->streams,
284 cat->avf->nb_streams * sizeof(*map));
286 return AVERROR(ENOMEM);
287 cat->cur_file->streams = map;
288 memset(map + cat->cur_file->nb_streams, 0,
289 (cat->avf->nb_streams - cat->cur_file->nb_streams) * sizeof(*map));
291 for (i = cat->cur_file->nb_streams; i < cat->avf->nb_streams; i++)
292 map[i].out_stream_index = -1;
293 switch (cat->stream_match_mode) {
294 case MATCH_ONE_TO_ONE:
295 ret = match_streams_one_to_one(avf);
298 ret = match_streams_exact_id(avf);
305 for (i = cat->cur_file->nb_streams; i < cat->avf->nb_streams; i++)
306 if ((ret = detect_stream_specific(avf, i)) < 0)
308 cat->cur_file->nb_streams = cat->avf->nb_streams;
312 static int open_file(AVFormatContext *avf, unsigned fileno)
314 ConcatContext *cat = avf->priv_data;
315 ConcatFile *file = &cat->files[fileno];
319 avformat_close_input(&cat->avf);
321 cat->avf = avformat_alloc_context();
323 return AVERROR(ENOMEM);
325 cat->avf->flags |= avf->flags;
326 cat->avf->interrupt_callback = avf->interrupt_callback;
328 if ((ret = ff_copy_whiteblacklists(cat->avf, avf)) < 0)
331 if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 ||
332 (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) {
333 av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url);
334 avformat_close_input(&cat->avf);
337 cat->cur_file = file;
338 if (file->start_time == AV_NOPTS_VALUE)
339 file->start_time = !fileno ? 0 :
340 cat->files[fileno - 1].start_time +
341 cat->files[fileno - 1].duration;
342 file->file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 : cat->avf->start_time;
343 file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? file->file_start_time : file->inpoint;
344 if (file->duration == AV_NOPTS_VALUE && file->outpoint != AV_NOPTS_VALUE)
345 file->duration = file->outpoint - file->file_inpoint;
347 if (cat->segment_time_metadata) {
348 av_dict_set_int(&file->metadata, "lavf.concatdec.start_time", file->start_time, 0);
349 if (file->duration != AV_NOPTS_VALUE)
350 av_dict_set_int(&file->metadata, "lavf.concatdec.duration", file->duration, 0);
353 if ((ret = match_streams(avf)) < 0)
355 if (file->inpoint != AV_NOPTS_VALUE) {
356 if ((ret = avformat_seek_file(cat->avf, -1, INT64_MIN, file->inpoint, file->inpoint, 0)) < 0)
362 static int concat_read_close(AVFormatContext *avf)
364 ConcatContext *cat = avf->priv_data;
367 for (i = 0; i < cat->nb_files; i++) {
368 av_freep(&cat->files[i].url);
369 for (j = 0; j < cat->files[i].nb_streams; j++) {
370 if (cat->files[i].streams[j].avctx)
371 avcodec_free_context(&cat->files[i].streams[j].avctx);
372 if (cat->files[i].streams[j].bsf)
373 av_bitstream_filter_close(cat->files[i].streams[j].bsf);
375 av_freep(&cat->files[i].streams);
376 av_dict_free(&cat->files[i].metadata);
379 avformat_close_input(&cat->avf);
380 av_freep(&cat->files);
384 static int concat_read_header(AVFormatContext *avf)
386 ConcatContext *cat = avf->priv_data;
388 uint8_t *cursor, *keyword;
389 int ret, line = 0, i;
390 unsigned nb_files_alloc = 0;
391 ConcatFile *file = NULL;
395 if ((ret = ff_get_line(avf->pb, buf, sizeof(buf))) <= 0)
399 keyword = get_keyword(&cursor);
400 if (!*keyword || *keyword == '#')
403 if (!strcmp(keyword, "file")) {
404 char *filename = av_get_token((const char **)&cursor, SPACE_CHARS);
406 av_log(avf, AV_LOG_ERROR, "Line %d: filename required\n", line);
407 FAIL(AVERROR_INVALIDDATA);
409 if ((ret = add_file(avf, filename, &file, &nb_files_alloc)) < 0)
411 } else if (!strcmp(keyword, "duration") || !strcmp(keyword, "inpoint") || !strcmp(keyword, "outpoint")) {
412 char *dur_str = get_keyword(&cursor);
415 av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n",
417 FAIL(AVERROR_INVALIDDATA);
419 if ((ret = av_parse_time(&dur, dur_str, 1)) < 0) {
420 av_log(avf, AV_LOG_ERROR, "Line %d: invalid %s '%s'\n",
421 line, keyword, dur_str);
424 if (!strcmp(keyword, "duration"))
425 file->duration = dur;
426 else if (!strcmp(keyword, "inpoint"))
428 else if (!strcmp(keyword, "outpoint"))
429 file->outpoint = dur;
430 } else if (!strcmp(keyword, "file_packet_metadata")) {
433 av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n",
435 FAIL(AVERROR_INVALIDDATA);
437 metadata = av_get_token((const char **)&cursor, SPACE_CHARS);
439 av_log(avf, AV_LOG_ERROR, "Line %d: packet metadata required\n", line);
440 FAIL(AVERROR_INVALIDDATA);
442 if ((ret = av_dict_parse_string(&file->metadata, metadata, "=", "", 0)) < 0) {
443 av_log(avf, AV_LOG_ERROR, "Line %d: failed to parse metadata string\n", line);
445 FAIL(AVERROR_INVALIDDATA);
448 } else if (!strcmp(keyword, "stream")) {
449 if (!avformat_new_stream(avf, NULL))
450 FAIL(AVERROR(ENOMEM));
451 } else if (!strcmp(keyword, "exact_stream_id")) {
452 if (!avf->nb_streams) {
453 av_log(avf, AV_LOG_ERROR, "Line %d: exact_stream_id without stream\n",
455 FAIL(AVERROR_INVALIDDATA);
457 avf->streams[avf->nb_streams - 1]->id =
458 strtol(get_keyword(&cursor), NULL, 0);
459 } else if (!strcmp(keyword, "ffconcat")) {
460 char *ver_kw = get_keyword(&cursor);
461 char *ver_val = get_keyword(&cursor);
462 if (strcmp(ver_kw, "version") || strcmp(ver_val, "1.0")) {
463 av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line);
464 FAIL(AVERROR_INVALIDDATA);
469 av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n",
471 FAIL(AVERROR_INVALIDDATA);
477 FAIL(AVERROR_INVALIDDATA);
479 for (i = 0; i < cat->nb_files; i++) {
480 if (cat->files[i].start_time == AV_NOPTS_VALUE)
481 cat->files[i].start_time = time;
483 time = cat->files[i].start_time;
484 if (cat->files[i].duration == AV_NOPTS_VALUE) {
485 if (cat->files[i].inpoint == AV_NOPTS_VALUE || cat->files[i].outpoint == AV_NOPTS_VALUE)
487 cat->files[i].duration = cat->files[i].outpoint - cat->files[i].inpoint;
489 time += cat->files[i].duration;
491 if (i == cat->nb_files) {
492 avf->duration = time;
496 cat->stream_match_mode = avf->nb_streams ? MATCH_EXACT_ID :
498 if ((ret = open_file(avf, 0)) < 0)
503 concat_read_close(avf);
507 static int open_next_file(AVFormatContext *avf)
509 ConcatContext *cat = avf->priv_data;
510 unsigned fileno = cat->cur_file - cat->files;
512 if (cat->cur_file->duration == AV_NOPTS_VALUE)
513 cat->cur_file->duration = cat->avf->duration - (cat->cur_file->file_inpoint - cat->cur_file->file_start_time);
515 if (++fileno >= cat->nb_files) {
519 return open_file(avf, fileno);
522 static int filter_packet(AVFormatContext *avf, ConcatStream *cs, AVPacket *pkt)
524 AVStream *st = avf->streams[cs->out_stream_index];
525 AVBitStreamFilterContext *bsf;
529 av_assert0(cs->out_stream_index >= 0);
530 for (bsf = cs->bsf; bsf; bsf = bsf->next) {
533 ret = av_bitstream_filter_filter(bsf, cs->avctx, NULL,
534 &pkt2.data, &pkt2.size,
535 pkt->data, pkt->size,
536 !!(pkt->flags & AV_PKT_FLAG_KEY));
538 av_packet_unref(pkt);
542 if (cs->avctx->extradata_size > st->codecpar->extradata_size) {
544 if (st->codecpar->extradata)
545 av_freep(&st->codecpar->extradata);
547 eret = ff_alloc_extradata(st->codecpar, cs->avctx->extradata_size);
549 av_packet_unref(pkt);
550 return AVERROR(ENOMEM);
552 st->codecpar->extradata_size = cs->avctx->extradata_size;
553 memcpy(st->codecpar->extradata, cs->avctx->extradata, cs->avctx->extradata_size);
556 av_assert0(pkt2.buf);
557 if (ret == 0 && pkt2.data != pkt->data) {
558 if ((ret = av_copy_packet(&pkt2, pkt)) < 0) {
565 av_packet_unref(pkt);
566 pkt2.buf = av_buffer_create(pkt2.data, pkt2.size,
567 av_buffer_default_free, NULL, 0);
570 return AVERROR(ENOMEM);
578 /* Returns true if the packet dts is greater or equal to the specified outpoint. */
579 static int packet_after_outpoint(ConcatContext *cat, AVPacket *pkt)
581 if (cat->cur_file->outpoint != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE) {
582 return av_compare_ts(pkt->dts, cat->avf->streams[pkt->stream_index]->time_base,
583 cat->cur_file->outpoint, AV_TIME_BASE_Q) >= 0;
588 static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
590 ConcatContext *cat = avf->priv_data;
603 ret = av_read_frame(cat->avf, pkt);
604 if (ret == AVERROR_EOF) {
605 if ((ret = open_next_file(avf)) < 0)
611 if ((ret = match_streams(avf)) < 0) {
612 av_packet_unref(pkt);
615 if (packet_after_outpoint(cat, pkt)) {
616 av_packet_unref(pkt);
617 if ((ret = open_next_file(avf)) < 0)
621 cs = &cat->cur_file->streams[pkt->stream_index];
622 if (cs->out_stream_index < 0) {
623 av_packet_unref(pkt);
626 pkt->stream_index = cs->out_stream_index;
629 if ((ret = filter_packet(avf, cs, pkt)))
632 st = cat->avf->streams[pkt->stream_index];
633 av_log(avf, AV_LOG_DEBUG, "file:%d stream:%d pts:%s pts_time:%s dts:%s dts_time:%s",
634 (unsigned)(cat->cur_file - cat->files), pkt->stream_index,
635 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
636 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
638 delta = av_rescale_q(cat->cur_file->start_time - cat->cur_file->file_inpoint,
640 cat->avf->streams[pkt->stream_index]->time_base);
641 if (pkt->pts != AV_NOPTS_VALUE)
643 if (pkt->dts != AV_NOPTS_VALUE)
645 av_log(avf, AV_LOG_DEBUG, " -> pts:%s pts_time:%s dts:%s dts_time:%s\n",
646 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
647 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
648 if (cat->cur_file->metadata) {
651 char* packed_metadata = av_packet_pack_dictionary(cat->cur_file->metadata, &metadata_len);
652 if (!packed_metadata)
653 return AVERROR(ENOMEM);
654 if (!(metadata = av_packet_new_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, metadata_len))) {
655 av_freep(&packed_metadata);
656 return AVERROR(ENOMEM);
658 memcpy(metadata, packed_metadata, metadata_len);
659 av_freep(&packed_metadata);
664 static void rescale_interval(AVRational tb_in, AVRational tb_out,
665 int64_t *min_ts, int64_t *ts, int64_t *max_ts)
667 *ts = av_rescale_q (* ts, tb_in, tb_out);
668 *min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out,
669 AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
670 *max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out,
671 AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX);
674 static int try_seek(AVFormatContext *avf, int stream,
675 int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
677 ConcatContext *cat = avf->priv_data;
678 int64_t t0 = cat->cur_file->start_time - cat->cur_file->file_inpoint;
681 min_ts = min_ts == INT64_MIN ? INT64_MIN : min_ts - t0;
682 max_ts = max_ts == INT64_MAX ? INT64_MAX : max_ts - t0;
684 if (stream >= cat->avf->nb_streams)
686 rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base,
687 &min_ts, &ts, &max_ts);
689 return avformat_seek_file(cat->avf, stream, min_ts, ts, max_ts, flags);
692 static int real_seek(AVFormatContext *avf, int stream,
693 int64_t min_ts, int64_t ts, int64_t max_ts, int flags, AVFormatContext *cur_avf)
695 ConcatContext *cat = avf->priv_data;
696 int ret, left, right;
699 if (stream >= avf->nb_streams)
700 return AVERROR(EINVAL);
701 rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q,
702 &min_ts, &ts, &max_ts);
706 right = cat->nb_files;
707 while (right - left > 1) {
708 int mid = (left + right) / 2;
709 if (ts < cat->files[mid].start_time)
715 if (cat->cur_file != &cat->files[left]) {
716 if ((ret = open_file(avf, left)) < 0)
722 ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);
724 left < cat->nb_files - 1 &&
725 cat->files[left + 1].start_time < max_ts) {
726 if (cat->cur_file == &cat->files[left])
728 if ((ret = open_file(avf, left + 1)) < 0)
730 ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);
735 static int concat_seek(AVFormatContext *avf, int stream,
736 int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
738 ConcatContext *cat = avf->priv_data;
739 ConcatFile *cur_file_saved = cat->cur_file;
740 AVFormatContext *cur_avf_saved = cat->avf;
744 return AVERROR(ESPIPE); /* XXX: can we use it? */
745 if (flags & (AVSEEK_FLAG_BYTE | AVSEEK_FLAG_FRAME))
746 return AVERROR(ENOSYS);
748 if ((ret = real_seek(avf, stream, min_ts, ts, max_ts, flags, cur_avf_saved)) < 0) {
749 if (cat->cur_file != cur_file_saved) {
751 avformat_close_input(&cat->avf);
753 cat->avf = cur_avf_saved;
754 cat->cur_file = cur_file_saved;
756 if (cat->cur_file != cur_file_saved) {
757 avformat_close_input(&cur_avf_saved);
764 #define OFFSET(x) offsetof(ConcatContext, x)
765 #define DEC AV_OPT_FLAG_DECODING_PARAM
767 static const AVOption options[] = {
768 { "safe", "enable safe mode",
769 OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, DEC },
770 { "auto_convert", "automatically convert bitstream format",
771 OFFSET(auto_convert), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC },
772 { "segment_time_metadata", "output file segment start time and duration as packet metadata",
773 OFFSET(segment_time_metadata), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC },
777 static const AVClass concat_class = {
778 .class_name = "concat demuxer",
779 .item_name = av_default_item_name,
781 .version = LIBAVUTIL_VERSION_INT,
785 AVInputFormat ff_concat_demuxer = {
787 .long_name = NULL_IF_CONFIG_SMALL("Virtual concatenation script"),
788 .priv_data_size = sizeof(ConcatContext),
789 .read_probe = concat_probe,
790 .read_header = concat_read_header,
791 .read_packet = concat_read_packet,
792 .read_close = concat_read_close,
793 .read_seek2 = concat_seek,
794 .priv_class = &concat_class,