Browse Source

linux-v4l2: Fix warnings in mjpeg

Previously the switch did not catch all cases issuing a quite large
warning. Also there was a const-ness warning for codecs on ffmpeg 5.0
that this addresses.
Kurt Kartaltepe 3 years ago
parent
commit
eff0148dd7
2 changed files with 3 additions and 2 deletions
  1. 2 1
      plugins/linux-v4l2/v4l2-mjpeg.c
  2. 1 1
      plugins/linux-v4l2/v4l2-mjpeg.h

+ 2 - 1
plugins/linux-v4l2/v4l2-mjpeg.c

@@ -75,7 +75,6 @@ void v4l2_destroy_mjpeg(struct v4l2_mjpeg_decoder *decoder)
 int v4l2_decode_mjpeg(struct obs_source_frame *out, uint8_t *data,
 		      size_t length, struct v4l2_mjpeg_decoder *decoder)
 {
-
 	decoder->packet->data = data;
 	decoder->packet->size = length;
 	if (avcodec_send_packet(decoder->context, decoder->packet) < 0) {
@@ -106,6 +105,8 @@ int v4l2_decode_mjpeg(struct obs_source_frame *out, uint8_t *data,
 	case AV_PIX_FMT_YUV444P:
 		out->format = VIDEO_FORMAT_I444;
 		break;
+	default:
+		break;
 	}
 
 	return 0;

+ 1 - 1
plugins/linux-v4l2/v4l2-mjpeg.h

@@ -29,7 +29,7 @@ extern "C" {
  * Data structure for mjpeg decoding
  */
 struct v4l2_mjpeg_decoder {
-	AVCodec *codec;
+	const AVCodec *codec;
 	AVCodecContext *context;
 	AVPacket *packet;
 	AVFrame *frame;