Merge commit '84bf64d3598c98a748e609195358ea04b0cfd140'

* commit '84bf64d3598c98a748e609195358ea04b0cfd140':
  bethsoftvid: simplify return handling

See: 5ee6527c43
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-10-29 22:21:49 +01:00
commit a8605be30f

View File

@ -180,7 +180,6 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
if ((ret = av_new_packet(pkt, vidbuf_nbytes)) < 0)
goto fail;
memcpy(pkt->data, vidbuf_start, vidbuf_nbytes);
av_free(vidbuf_start);
pkt->pos = position;
pkt->stream_index = vid->video_index;
@ -192,16 +191,17 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
if (vid->palette) {
uint8_t *pdata = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
BVID_PALETTE_SIZE);
if (pdata)
memcpy(pdata, vid->palette, BVID_PALETTE_SIZE);
else
if (!pdata) {
ret = AVERROR(ENOMEM);
av_log(s, AV_LOG_ERROR, "Failed to allocate palette side data\n");
goto fail;
}
memcpy(pdata, vid->palette, BVID_PALETTE_SIZE);
av_freep(&vid->palette);
}
vid->nframes--; // used to check if all the frames were read
return 0;
fail:
av_free(vidbuf_start);
return ret;