summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-08-18 11:19:19 +0200
committerwm4 <wm4@nowhere>2012-08-20 15:36:04 +0200
commit53f6eba06cc5a44978c17faea1c2ec3ea8e0c117 (patch)
tree3e770abd8d110f2d8fa676fe306a4c62b57ce592 /libmpdemux
parent6a26b4a66504f701baf35e58467e55aea28c0ad5 (diff)
downloadmpv-53f6eba06cc5a44978c17faea1c2ec3ea8e0c117.tar.bz2
mpv-53f6eba06cc5a44978c17faea1c2ec3ea8e0c117.tar.xz
vd_ffmpeg, demux_mng: allow general raw formats, fix MNG demuxer
Change vd_ffmpeg such that if sh_video->format is a mplayer pixel format, and there's no other codec information, try to play it as raw video. (The case of no codec information happens if the "generic" ffmpeg decoder is instantiated, which is tried last. This means clashes with actual existing formats are less likely.) demux_mng did not initialize all fields of the bih, which made vd_ffmpeg do invalid memory accesses when trying to copy the extradata. Also, use IMGFMT_RGB32 instead of creating the FourCC directly. (They should be the same, but what if mplayer changes the IMGFMT_* values.) This also fixes demux_rawvideo.
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_mng.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libmpdemux/demux_mng.c b/libmpdemux/demux_mng.c
index d45add658f..ad08ba8c4b 100644
--- a/libmpdemux/demux_mng.c
+++ b/libmpdemux/demux_mng.c
@@ -31,6 +31,7 @@
#include "stream/stream.h"
#include "demuxer.h"
#include "stheader.h"
+#include "libmpcodecs/img_format.h"
#define MNG_SUPPORT_READ
#define MNG_SUPPORT_DISPLAY
@@ -436,14 +437,14 @@ static demuxer_t * demux_mng_open(demuxer_t * demuxer)
sh_video->ds = demuxer->video;
// set format of pixels in video packets
- sh_video->format = mmioFOURCC(32, 'B', 'G', 'R');
+ sh_video->format = IMGFMT_RGB32;
// set framerate to some value (MNG does not have a fixed framerate)
sh_video->fps = 5.0f;
sh_video->frametime = 1.0f / sh_video->fps;
// set video frame parameters
- sh_video->bih = malloc(sizeof(*sh_video->bih));
+ sh_video->bih = calloc(1, sizeof(*sh_video->bih));
sh_video->bih->biCompression = sh_video->format;
sh_video->bih->biWidth = mng_priv->width;
sh_video->bih->biHeight = mng_priv->height;