summaryrefslogtreecommitdiffstats
path: root/demux/mf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-16 19:12:56 +0100
committerwm4 <wm4@nowhere>2012-11-16 21:21:16 +0100
commit7a1396b6ca73d5db194dcc6cebc5ad92e9b22c89 (patch)
treecfe2387465387659a5564c18acfbd2a9d5aa2012 /demux/mf.c
parentf7163c80658651804437f9a7f5bed6fb34a32830 (diff)
downloadmpv-7a1396b6ca73d5db194dcc6cebc5ad92e9b22c89.tar.bz2
mpv-7a1396b6ca73d5db194dcc6cebc5ad92e9b22c89.tar.xz
demux_mf: allow displaying single image files, various cleanups
Enable autoprobing for demux_mf, so that image files can be directly displayed with e.g. "mpv file.jpg --pause". (The --pause switch is needed to prevent the window from closing immediately.) Since demux_mf doesn't have any real file format probing and goes by file extension only, move the demuxer down the demuxer list to ensure it's checked last. (ffmpeg's demux_mf equivalent, "image2", probes by file extensions too, and there doesn't seem to be anything that can probe typical image file formats from binary data.) Remove the --mf "w" and "h" suboptions. Don't pass the width/height to the video stream header. Both of these are useless, because the decoder reads the real image size at a later point from the file headers. Remove setting the BITMAPINFOHEADER as well, as vd_lavc doesn't need this. Enable --correct-pts by default. This fixes displaying a single image with vo_vdpau (as mentioned by uau). Keep around a pointer to the sh_video stream header instead of accessing demuxer->video->sh_video. Fixes a crash when deselecting the video track. Note that the format probing is incorrect when opening images from HTTP locations. File extensions don't have to match the actual file format. A correct implementation would require to check the MIME type, or to probe the binary data correctly.
Diffstat (limited to 'demux/mf.c')
-rw-r--r--demux/mf.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/demux/mf.c b/demux/mf.c
index 440156087e..6ab23b36e9 100644
--- a/demux/mf.c
+++ b/demux/mf.c
@@ -43,12 +43,11 @@
#include "mf.h"
-int mf_w = 0; //352; // let codecs to detect it
-int mf_h = 0; //288;
double mf_fps = 25.0;
char * mf_type = NULL; //"jpg";
-mf_t* open_mf(char * filename){
+mf_t* open_mf_pattern(char * filename)
+{
#if defined(HAVE_GLOB) || defined(__MINGW32__)
glob_t gg;
int i;
@@ -169,3 +168,12 @@ exit_mf:
return 0;
#endif
}
+
+mf_t* open_mf_single(char * filename)
+{
+ mf_t *mf = calloc(1, sizeof(mf_t));
+ mf->nr_of_files = 1;
+ mf->names = calloc(1, sizeof(char *));
+ mf->names[0] = strdup(filename);
+ return mf;
+}