summaryrefslogtreecommitdiffstats
path: root/video/decode/rpi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-05 17:24:35 +0100
committerwm4 <wm4@nowhere>2015-11-05 17:24:35 +0100
commit2cf9ee989c4b53f945fe4aa9f6fc17001c3a60e7 (patch)
treecee8878a3e2c7ffa34db71f158da88dfdf145d7a /video/decode/rpi.c
parent66ed50aa0024244cb12795182449b2769d633607 (diff)
downloadmpv-2cf9ee989c4b53f945fe4aa9f6fc17001c3a60e7.tar.bz2
mpv-2cf9ee989c4b53f945fe4aa9f6fc17001c3a60e7.tar.xz
rpi: add support for codecs other than h264
FFmpeg now supports h264 and mpeg2. At least vc-1 will probably follow.
Diffstat (limited to 'video/decode/rpi.c')
-rw-r--r--video/decode/rpi.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/video/decode/rpi.c b/video/decode/rpi.c
index 819369de0d..12816cdc86 100644
--- a/video/decode/rpi.c
+++ b/video/decode/rpi.c
@@ -18,6 +18,21 @@
#include "lavc.h"
#include "common/common.h"
+static const char *const codecs[][2] = {
+ {"h264", "h264_mmal"},
+ {"mpeg2video", "mpeg2_mmal"},
+ {0}
+};
+
+static const char *map_codec(const char *c)
+{
+ for (int n = 0; codecs[n][0]; n++) {
+ if (c && strcmp(codecs[n][0], c) == 0)
+ return codecs[n][1];
+ }
+ return NULL;
+}
+
static int init_decoder(struct lavc_ctx *ctx, int w, int h)
{
return 0;
@@ -35,14 +50,12 @@ static int init(struct lavc_ctx *ctx)
static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
const char *decoder)
{
- if (strcmp(decoder, "h264") != 0)
- return HWDEC_ERR_NO_CODEC;
- return 0;
+ return map_codec(decoder) ? 0 : HWDEC_ERR_NO_CODEC;
}
-static const char *get_codec(struct lavc_ctx *ctx)
+static const char *get_codec(struct lavc_ctx *ctx, const char *codec)
{
- return "h264_mmal";
+ return map_codec(codec);
}
const struct vd_lavc_hwdec mp_vd_lavc_rpi = {