comparison indeo3.c @ 9926:773041579748 libavcodec

Change iv_decode_frame to get AVCodecContext as argument, so that avcodec_check_dimensions can be called with a proper context instead of NULL.
author reimar
date Mon, 06 Jul 2009 16:45:12 +0000
parents fd3481a592b2
children f954ea120c78
comparison
equal deleted inserted replaced
9925:2978d5f0ac0a 9926:773041579748
973 iv_free_func(s); 973 iv_free_func(s);
974 974
975 return ret; 975 return ret;
976 } 976 }
977 977
978 static int iv_decode_frame(Indeo3DecodeContext *s, 978 static int iv_decode_frame(AVCodecContext *avctx,
979 const uint8_t *buf, int buf_size) 979 const uint8_t *buf, int buf_size)
980 { 980 {
981 Indeo3DecodeContext *s = avctx->priv_data;
981 unsigned int image_width, image_height, 982 unsigned int image_width, image_height,
982 chroma_width, chroma_height; 983 chroma_width, chroma_height;
983 unsigned long flags, cb_offset, data_size, 984 unsigned long flags, cb_offset, data_size,
984 y_offset, v_offset, u_offset, mc_vector_count; 985 y_offset, v_offset, u_offset, mc_vector_count;
985 const uint8_t *hdr_pos, *buf_pos; 986 const uint8_t *hdr_pos, *buf_pos;
992 cb_offset = *buf_pos++; 993 cb_offset = *buf_pos++;
993 buf_pos += 3; /* skip reserved byte and checksum */ 994 buf_pos += 3; /* skip reserved byte and checksum */
994 image_height = bytestream_get_le16(&buf_pos); 995 image_height = bytestream_get_le16(&buf_pos);
995 image_width = bytestream_get_le16(&buf_pos); 996 image_width = bytestream_get_le16(&buf_pos);
996 997
997 if(avcodec_check_dimensions(NULL, image_width, image_height)) 998 if(avcodec_check_dimensions(avctx, image_width, image_height))
998 return -1; 999 return -1;
999 1000
1000 chroma_height = ((image_height >> 2) + 3) & 0x7ffc; 1001 chroma_height = ((image_height >> 2) + 3) & 0x7ffc;
1001 chroma_width = ((image_width >> 2) + 3) & 0x7ffc; 1002 chroma_width = ((image_width >> 2) + 3) & 0x7ffc;
1002 y_offset = bytestream_get_le32(&buf_pos); 1003 y_offset = bytestream_get_le32(&buf_pos);
1068 int buf_size = avpkt->size; 1069 int buf_size = avpkt->size;
1069 Indeo3DecodeContext *s=avctx->priv_data; 1070 Indeo3DecodeContext *s=avctx->priv_data;
1070 uint8_t *src, *dest; 1071 uint8_t *src, *dest;
1071 int y; 1072 int y;
1072 1073
1073 if (iv_decode_frame(s, buf, buf_size) < 0) 1074 if (iv_decode_frame(avctx, buf, buf_size) < 0)
1074 return -1; 1075 return -1;
1075 1076
1076 if(s->frame.data[0]) 1077 if(s->frame.data[0])
1077 avctx->release_buffer(avctx, &s->frame); 1078 avctx->release_buffer(avctx, &s->frame);
1078 1079