-int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
- AVPacket *avpkt)
+static int mjpeg_get_packet(AVCodecContext *avctx)
+{
+ MJpegDecodeContext *s = avctx->priv_data;
+ int ret;
+
+ av_packet_unref(s->pkt);
+ ret = ff_decode_get_packet(avctx, s->pkt);
+ if (ret < 0)
+ return ret;
+
+#if CONFIG_SP5X_DECODER || CONFIG_AMV_DECODER
+ if (avctx->codec_id == AV_CODEC_ID_SP5X ||
+ avctx->codec_id == AV_CODEC_ID_AMV) {
+ ret = ff_sp5x_process_packet(avctx, s->pkt);
+ if (ret < 0)
+ return ret;
+ }
+#endif
+
+ s->buf_size = s->pkt->size;
+
+ return 0;
+}
+
+int ff_mjpeg_receive_frame(AVCodecContext *avctx, AVFrame *frame)