#define CEDRUS_CAPABILITY_VP8_DEC      BIT(4)
 #define CEDRUS_CAPABILITY_H265_10_DEC  BIT(5)
 
-enum cedrus_codec {
-       CEDRUS_CODEC_MPEG2,
-       CEDRUS_CODEC_H264,
-       CEDRUS_CODEC_H265,
-       CEDRUS_CODEC_VP8,
-       CEDRUS_CODEC_LAST,
-};
-
 enum cedrus_irq_status {
        CEDRUS_IRQ_NONE,
        CEDRUS_IRQ_ERROR,
 
 {
        struct cedrus_dev *dev = ctx->dev;
 
-       cedrus_engine_enable(ctx, CEDRUS_CODEC_H264);
+       cedrus_engine_enable(ctx);
 
        cedrus_write(dev, VE_H264_SDROT_CTRL, 0);
        cedrus_write(dev, VE_H264_EXTRA_BUFFER1,
 
        }
 
        /* Activate H265 engine. */
-       cedrus_engine_enable(ctx, CEDRUS_CODEC_H265);
+       cedrus_engine_enable(ctx);
 
        /* Source offset and length in bits. */
 
 
 #include "cedrus_hw.h"
 #include "cedrus_regs.h"
 
-int cedrus_engine_enable(struct cedrus_ctx *ctx, enum cedrus_codec codec)
+int cedrus_engine_enable(struct cedrus_ctx *ctx)
 {
        u32 reg = 0;
 
        reg |= VE_MODE_REC_WR_MODE_2MB;
        reg |= VE_MODE_DDR_MODE_BW_128;
 
-       switch (codec) {
-       case CEDRUS_CODEC_MPEG2:
+       switch (ctx->src_fmt.pixelformat) {
+       case V4L2_PIX_FMT_MPEG2_SLICE:
                reg |= VE_MODE_DEC_MPEG;
                break;
 
        /* H.264 and VP8 both use the same decoding mode bit. */
-       case CEDRUS_CODEC_H264:
-       case CEDRUS_CODEC_VP8:
+       case V4L2_PIX_FMT_H264_SLICE:
+       case V4L2_PIX_FMT_VP8_FRAME:
                reg |= VE_MODE_DEC_H264;
                break;
 
-       case CEDRUS_CODEC_H265:
+       case V4L2_PIX_FMT_HEVC_SLICE:
                reg |= VE_MODE_DEC_H265;
                break;
 
 
 #ifndef _CEDRUS_HW_H_
 #define _CEDRUS_HW_H_
 
-int cedrus_engine_enable(struct cedrus_ctx *ctx, enum cedrus_codec codec);
+int cedrus_engine_enable(struct cedrus_ctx *ctx);
 void cedrus_engine_disable(struct cedrus_dev *dev);
 
 void cedrus_dst_format_set(struct cedrus_dev *dev,
 
        quantisation = run->mpeg2.quantisation;
 
        /* Activate MPEG engine. */
-       cedrus_engine_enable(ctx, CEDRUS_CODEC_MPEG2);
+       cedrus_engine_enable(ctx);
 
        /* Set intra quantisation matrix. */
        matrix = quantisation->intra_quantiser_matrix;
 
        int header_size;
        u32 reg;
 
-       cedrus_engine_enable(ctx, CEDRUS_CODEC_VP8);
+       cedrus_engine_enable(ctx);
 
        cedrus_write(dev, VE_H264_CTRL, VE_H264_CTRL_VP8);