| 1188 | } |
| 1189 | |
| 1190 | static int ipvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame, |
| 1191 | int *got_frame, AVPacket *avpkt) |
| 1192 | { |
| 1193 | const uint8_t *buf = avpkt->data; |
| 1194 | int buf_size = avpkt->size; |
| 1195 | IpvideoContext *s = avctx->priv_data; |
| 1196 | int ret; |
| 1197 | int send_buffer; |
| 1198 | int frame_format; |
| 1199 | int video_data_size; |
| 1200 | |
| 1201 | if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) { |
| 1202 | av_frame_unref(s->last_frame); |
| 1203 | av_frame_unref(s->second_last_frame); |
| 1204 | av_frame_unref(s->cur_decode_frame); |
| 1205 | av_frame_unref(s->prev_decode_frame); |
| 1206 | } |
| 1207 | |
| 1208 | if (!s->cur_decode_frame->data[0]) { |
| 1209 | ret = ff_get_buffer(avctx, s->cur_decode_frame, 0); |
| 1210 | if (ret < 0) |
| 1211 | return ret; |
| 1212 | |
| 1213 | ret = ff_get_buffer(avctx, s->prev_decode_frame, 0); |
| 1214 | if (ret < 0) { |
| 1215 | av_frame_unref(s->cur_decode_frame); |
| 1216 | return ret; |
| 1217 | } |
| 1218 | } |
| 1219 | |
| 1220 | if (buf_size < 8) |
| 1221 | return AVERROR_INVALIDDATA; |
| 1222 | |
| 1223 | frame_format = AV_RL8(buf); |
| 1224 | send_buffer = AV_RL8(buf + 1); |
| 1225 | video_data_size = AV_RL16(buf + 2); |
| 1226 | s->decoding_map_size = AV_RL16(buf + 4); |
| 1227 | s->skip_map_size = AV_RL16(buf + 6); |
| 1228 | |
| 1229 | switch (frame_format) { |
| 1230 | case 0x06: |
| 1231 | if (s->decoding_map_size) { |
| 1232 | av_log(avctx, AV_LOG_ERROR, "Decoding map for format 0x06\n"); |
| 1233 | return AVERROR_INVALIDDATA; |
| 1234 | } |
| 1235 | |
| 1236 | if (s->skip_map_size) { |
| 1237 | av_log(avctx, AV_LOG_ERROR, "Skip map for format 0x06\n"); |
| 1238 | return AVERROR_INVALIDDATA; |
| 1239 | } |
| 1240 | |
| 1241 | if (s->is_16bpp) { |
| 1242 | av_log(avctx, AV_LOG_ERROR, "Video format 0x06 does not support 16bpp movies\n"); |
| 1243 | return AVERROR_INVALIDDATA; |
| 1244 | } |
| 1245 | |
| 1246 | /* Decoding map for 0x06 frame format is at the top of pixeldata */ |
| 1247 | s->decoding_map_size = ((s->avctx->width / 8) * (s->avctx->height / 8)) * 2; |
nothing calls this directly
no test coverage detected