Revision 3e62d187 libavformat/bethsoftvid.c

View differences:

libavformat/bethsoftvid.c
101 101
{
102 102
    uint8_t * vidbuf_start = NULL;
103 103
    int vidbuf_nbytes = 0;
104
    int rle_num_bytes;
104
    int code;
105 105
    int bytes_copied = 0;
106 106
    int position;
107 107
    size_t vidbuf_capacity;
......
130 130
        if(!vidbuf_start)
131 131
            return AVERROR_NOMEM;
132 132

  
133
        rle_num_bytes = get_byte(pb);
134
        vidbuf_start[vidbuf_nbytes++] = rle_num_bytes;
133
        code = get_byte(pb);
134
        vidbuf_start[vidbuf_nbytes++] = code;
135 135

  
136
        if(rle_num_bytes >= 0x80){ // rle sequence
136
        if(code >= 0x80){ // rle sequence
137 137
            if(block_type == VIDEO_I_FRAME)
138 138
                vidbuf_start[vidbuf_nbytes++] = get_byte(pb);
139
        } else if(rle_num_bytes){ // plain sequence
140
            if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], rle_num_bytes) != rle_num_bytes)
139
        } else if(code){ // plain sequence
140
            if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
141 141
                goto fail;
142
            vidbuf_nbytes += rle_num_bytes;
142
            vidbuf_nbytes += code;
143 143
        }
144
        bytes_copied += rle_num_bytes & 0x7F;
144
        bytes_copied += code & 0x7F;
145 145
        if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied
146 146
            // may contain a 0 byte even if read all pixels
147 147
            if(get_byte(pb))
......
150 150
        }
151 151
        if(bytes_copied > npixels)
152 152
            goto fail;
153
    } while(rle_num_bytes);
153
    } while(code);
154 154

  
155 155
    // copy data into packet
156 156
    if(av_new_packet(pkt, vidbuf_nbytes) < 0)

Also available in: Unified diff