summaryrefslogtreecommitdiffstats
path: root/demux/demux_mf.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--demux/demux_mf.c76
1 files changed, 67 insertions, 9 deletions
diff --git a/demux/demux_mf.c b/demux/demux_mf.c
index 8f7cb70..d971f04 100644
--- a/demux/demux_mf.c
+++ b/demux/demux_mf.c
@@ -95,7 +95,6 @@ static mf_t *open_mf_pattern(void *talloc_ctx, struct demuxer *d, char *filename
}
free_stream(s);
- mp_info(log, "number of files: %d\n", mf->nr_of_files);
goto exit_mf;
}
mp_info(log, "%s is not indirect filelist\n", filename + 1);
@@ -117,7 +116,6 @@ static mf_t *open_mf_pattern(void *talloc_ctx, struct demuxer *d, char *filename
}
talloc_free(fname2);
}
- mp_info(log, "number of files: %d\n", mf->nr_of_files);
goto exit_mf;
}
@@ -143,7 +141,6 @@ static mf_t *open_mf_pattern(void *talloc_ctx, struct demuxer *d, char *filename
continue;
mf_add(mf, gg.gl_pathv[i]);
}
- mp_info(log, "number of files: %d\n", mf->nr_of_files);
globfree(&gg);
goto exit_mf;
}
@@ -189,7 +186,9 @@ static mf_t *open_mf_pattern(void *talloc_ctx, struct demuxer *d, char *filename
// nspec==0 (zero specifiers) is rejected because fname wouldn't advance.
if (bad_spec || nspec != 1) {
- mp_err(log, "unsupported expr format: '%s'\n", filename);
+ mp_err(log,
+ "unsupported expr format: '%s' - exactly one format specifier of the form %%[.][NUM]d is expected\n",
+ filename);
goto exit_mf;
}
@@ -208,9 +207,8 @@ static mf_t *open_mf_pattern(void *talloc_ctx, struct demuxer *d, char *filename
}
}
- mp_info(log, "number of files: %d\n", mf->nr_of_files);
-
exit_mf:
+ mp_info(log, "number of files: %d\n", mf->nr_of_files);
return mf;
}
@@ -284,6 +282,65 @@ static bool demux_mf_read_packet(struct demuxer *demuxer,
return true;
}
+// map file extension/type to a codec name
+
+static const struct {
+ const char *type;
+ const char *codec;
+} type2format[] = {
+ { "bmp", "bmp" },
+ { "dpx", "dpx" },
+ { "j2c", "jpeg2000" },
+ { "j2k", "jpeg2000" },
+ { "jp2", "jpeg2000" },
+ { "jpc", "jpeg2000" },
+ { "jpeg", "mjpeg" },
+ { "jpg", "mjpeg" },
+ { "jps", "mjpeg" },
+ { "jls", "ljpeg" },
+ { "thm", "mjpeg" },
+ { "db", "mjpeg" },
+ { "pcd", "photocd" },
+ { "pfm", "pfm" },
+ { "phm", "phm" },
+ { "hdr", "hdr" },
+ { "pcx", "pcx" },
+ { "png", "png" },
+ { "pns", "png" },
+ { "ptx", "ptx" },
+ { "tga", "targa" },
+ { "tif", "tiff" },
+ { "tiff", "tiff" },
+ { "sgi", "sgi" },
+ { "sun", "sunrast" },
+ { "ras", "sunrast" },
+ { "rs", "sunrast" },
+ { "ra", "sunrast" },
+ { "im1", "sunrast" },
+ { "im8", "sunrast" },
+ { "im24", "sunrast" },
+ { "im32", "sunrast" },
+ { "sunras", "sunrast" },
+ { "xbm", "xbm" },
+ { "pam", "pam" },
+ { "pbm", "pbm" },
+ { "pgm", "pgm" },
+ { "pgmyuv", "pgmyuv" },
+ { "ppm", "ppm" },
+ { "pnm", "ppm" },
+ { "gif", "gif" }, // usually handled by demux_lavf
+ { "pix", "brender_pix" },
+ { "exr", "exr" },
+ { "pic", "pictor" },
+ { "qoi", "qoi" },
+ { "xface", "xface" },
+ { "xwd", "xwd" },
+ { "svg", "svg" },
+ { "webp", "webp" },
+ { "jxl", "jpegxl" },
+ {0}
+};
+
static const char *probe_format(mf_t *mf, char *type, enum demux_check check)
{
if (check > DEMUX_CHECK_REQUEST)
@@ -294,9 +351,10 @@ static const char *probe_format(mf_t *mf, char *type, enum demux_check check)
if (p)
type = p + 1;
}
- const char *codec = mp_map_type_to_image_codec(type);
- if (codec)
- return codec;
+ for (int i = 0; type2format[i].type; i++) {
+ if (type && strcasecmp(type, type2format[i].type) == 0)
+ return type2format[i].codec;
+ }
if (check == DEMUX_CHECK_REQUEST) {
if (!org_type) {
MP_ERR(mf, "file type was not set! (try --mf-type=ext)\n");