X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fimg2dec.c;h=efd637b31034a9edf8f243eb3b58bd5dfd6b4719;hb=c4ef6c883bb611388f9f0dcbe49dd65cb10613a2;hp=db4b4b75f4c51802dbf2e667579e4f0f5ed7dfe6;hpb=99f2a563889285b8be3e87fb5c5ba8c86a104785;p=ffmpeg diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index db4b4b75f4c..efd637b3103 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -225,6 +225,13 @@ int ff_img_read_header(AVFormatContext *s1) } if (!s->is_pipe) { + if (s->pattern_type == PT_DEFAULT) { + if (s1->pb) { + s->pattern_type = PT_NONE; + } else + s->pattern_type = PT_GLOB_SEQUENCE; + } + if (s->pattern_type == PT_GLOB_SEQUENCE) { s->use_glob = is_glob(s->path); if (s->use_glob) { @@ -370,6 +377,10 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) int size[3] = { 0 }, ret[3] = { 0 }; AVIOContext *f[3] = { NULL }; AVCodecContext *codec = s1->streams[0]->codec; + AVOpenCallback open_func = s1->open_cb; + + if (!open_func) + open_func = ffio_open2_wrapper; if (!s->is_pipe) { /* loop over input */ @@ -396,7 +407,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) !s->loop && !s->split_planes) { f[i] = s1->pb; - } else if (avio_open2(&f[i], filename, AVIO_FLAG_READ, + } else if (open_func(s1, &f[i], filename, AVIO_FLAG_READ, &s1->interrupt_callback, NULL) < 0) { if (i >= 1) break; @@ -557,7 +568,7 @@ const AVOption ff_img_options[] = { { "framerate", "set the video framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, DEC }, { "loop", "force loop over input file sequence", OFFSET(loop), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, DEC }, - { "pattern_type", "set pattern type", OFFSET(pattern_type), AV_OPT_TYPE_INT, {.i64=PT_GLOB_SEQUENCE}, 0, INT_MAX, DEC, "pattern_type"}, + { "pattern_type", "set pattern type", OFFSET(pattern_type), AV_OPT_TYPE_INT, {.i64=PT_DEFAULT}, 0, INT_MAX, DEC, "pattern_type"}, { "glob_sequence","select glob/sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX, DEC, "pattern_type" }, { "glob", "select glob pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX, DEC, "pattern_type" }, { "sequence", "select sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX, DEC, "pattern_type" },