mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
Merge commit 'a1599f3f7ea8478d1f6a95e59e3bc6bc86d5f812'
* commit 'a1599f3f7ea8478d1f6a95e59e3bc6bc86d5f812': cdgraphics: switch to bytestream2 Conflicts: libavcodec/cdgraphics.c See: ad002e1a13a8df934bd6cb2c84175a4780ab8942 Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
91b4ed0918
@ -261,7 +261,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
|
|||||||
static int cdg_decode_frame(AVCodecContext *avctx,
|
static int cdg_decode_frame(AVCodecContext *avctx,
|
||||||
void *data, int *got_frame, AVPacket *avpkt)
|
void *data, int *got_frame, AVPacket *avpkt)
|
||||||
{
|
{
|
||||||
const uint8_t *buf = avpkt->data;
|
GetByteContext gb;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
int ret;
|
int ret;
|
||||||
uint8_t command, inst;
|
uint8_t command, inst;
|
||||||
@ -278,6 +278,8 @@ static int cdg_decode_frame(AVCodecContext *avctx,
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bytestream2_init(&gb, avpkt->data, avpkt->size);
|
||||||
|
|
||||||
if ((ret = ff_reget_buffer(avctx, cc->frame)) < 0)
|
if ((ret = ff_reget_buffer(avctx, cc->frame)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (!avctx->frame_number) {
|
if (!avctx->frame_number) {
|
||||||
@ -285,13 +287,11 @@ static int cdg_decode_frame(AVCodecContext *avctx,
|
|||||||
memset(cc->frame->data[1], 0, AVPALETTE_SIZE);
|
memset(cc->frame->data[1], 0, AVPALETTE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
command = bytestream_get_byte(&buf);
|
command = bytestream2_get_byte(&gb);
|
||||||
inst = bytestream_get_byte(&buf);
|
inst = bytestream2_get_byte(&gb);
|
||||||
inst &= CDG_MASK;
|
inst &= CDG_MASK;
|
||||||
buf += 2; /// skipping 2 unneeded bytes
|
bytestream2_skip(&gb, 2);
|
||||||
|
bytestream2_get_buffer(&gb, cdg_data, sizeof(cdg_data));
|
||||||
if (buf_size > CDG_HEADER_SIZE)
|
|
||||||
bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
|
|
||||||
|
|
||||||
if ((command & CDG_MASK) == CDG_COMMAND) {
|
if ((command & CDG_MASK) == CDG_COMMAND) {
|
||||||
switch (inst) {
|
switch (inst) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user