Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-07 04:00:04 +0400
committerMichael Niedermayer <michaelni@gmx.at>2013-01-07 04:01:13 +0400
commitd30660306ceb070a3d74bca3b4a9f99a09b685dc (patch)
tree1b9e692b389a890a3f61be07b388e31e6f64cad3 /libavcodec/rl2.c
parent07f22d0b49332d9616ce5ff94679da5a01c19b0d (diff)
parent3c6e5a840c45fd3b832e86881602a72e47d46f19 (diff)
Merge commit '3c6e5a840c45fd3b832e86881602a72e47d46f19'
* commit '3c6e5a840c45fd3b832e86881602a72e47d46f19': rl2: use fixed-width integer types where appropriate rl2: return meaningful error codes. cljr: return a meaningful error code. fraps: cosmetics, reformat Conflicts: libavcodec/fraps.c libavcodec/rl2.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/rl2.c')
-rw-r--r--libavcodec/rl2.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/libavcodec/rl2.c b/libavcodec/rl2.c
index 642d31af32..a7115c555b 100644
--- a/libavcodec/rl2.c
+++ b/libavcodec/rl2.c
@@ -43,10 +43,10 @@ typedef struct Rl2Context {
AVCodecContext *avctx;
AVFrame frame;
- unsigned short video_base; ///< initial drawing offset
- unsigned int clr_count; ///< number of used colors (currently unused)
- unsigned char* back_frame; ///< background frame
- unsigned int palette[AVPALETTE_COUNT];
+ uint16_t video_base; ///< initial drawing offset
+ uint32_t clr_count; ///< number of used colors (currently unused)
+ uint8_t *back_frame; ///< background frame
+ uint32_t palette[AVPALETTE_COUNT];
} Rl2Context;
/**
@@ -58,16 +58,17 @@ typedef struct Rl2Context {
* @param stride stride of the output buffer
* @param video_base offset of the rle data inside the frame
*/
-static void rl2_rle_decode(Rl2Context *s,const unsigned char* in,int size,
- unsigned char* out,int stride,int video_base){
+static void rl2_rle_decode(Rl2Context *s, const uint8_t *in, int size,
+ uint8_t *out, int stride, int video_base)
+{
int base_x = video_base % s->avctx->width;
int base_y = video_base / s->avctx->width;
int stride_adj = stride - s->avctx->width;
int i;
- const unsigned char* back_frame = s->back_frame;
- const unsigned char* in_end = in + size;
- const unsigned char* out_end = out + stride * s->avctx->height;
- unsigned char* line_end;
+ const uint8_t *back_frame = s->back_frame;
+ const uint8_t *in_end = in + size;
+ const uint8_t *out_end = out + stride * s->avctx->height;
+ uint8_t *line_end;
/** copy start of the background frame */
for(i=0;i<=base_y;i++){
@@ -82,7 +83,7 @@ static void rl2_rle_decode(Rl2Context *s,const unsigned char* in,int size,
/** decode the variable part of the frame */
while(in < in_end){
- unsigned char val = *in++;
+ uint8_t val = *in++;
int len = 1;
if(val >= 0x80){
if(in >= in_end)
@@ -141,7 +142,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
/** parse extra data */
if(!avctx->extradata || avctx->extradata_size < EXTRADATA1_SIZE){
av_log(avctx, AV_LOG_ERROR, "invalid extradata size\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR(EINVAL);
}
/** get frame_offset */
@@ -161,7 +162,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
back_size = avctx->extradata_size - EXTRADATA1_SIZE;
if(back_size > 0){
- unsigned char* back_frame = av_mallocz(avctx->width*avctx->height);
+ uint8_t *back_frame = av_mallocz(avctx->width*avctx->height);
if(!back_frame)
return AVERROR(ENOMEM);
rl2_rle_decode(s,avctx->extradata + EXTRADATA1_SIZE,back_size,
@@ -177,9 +178,8 @@ static int rl2_decode_frame(AVCodecContext *avctx,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
+ int ret, buf_size = avpkt->size;
Rl2Context *s = avctx->priv_data;
- int ret;
if(s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);