diff options
author | Paul B Mahol <onemda@gmail.com> | 2017-04-16 18:44:57 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2017-04-18 15:04:12 +0200 |
commit | 61088051bd70e94224e8fbc95044ca1c6ca7240a (patch) | |
tree | 4d793bb8a2b01f8657b98a37ae147d26d659ccfb /libavcodec/mscc.c | |
parent | a96db6be06cfc7f179ed05f077e06bd1fa9d41ca (diff) | |
download | ffmpeg-61088051bd70e94224e8fbc95044ca1c6ca7240a.tar.gz |
avcodec: add Screen Recorder Gold Codec decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/mscc.c')
-rw-r--r-- | libavcodec/mscc.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c index c42889ae73..6e4dbb014d 100644 --- a/libavcodec/mscc.c +++ b/libavcodec/mscc.c @@ -121,6 +121,8 @@ static int decode_frame(AVCodecContext *avctx, { MSCCContext *s = avctx->priv_data; AVFrame *frame = data; + uint8_t *buf = avpkt->data; + int buf_size = avpkt->size; GetByteContext gb; PutByteContext pb; int ret, j; @@ -130,15 +132,19 @@ static int decode_frame(AVCodecContext *avctx, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - avpkt->data[2] ^= avpkt->data[0]; + if (avctx->codec_id == AV_CODEC_ID_MSCC) { + avpkt->data[2] ^= avpkt->data[0]; + buf += 2; + buf_size -= 2; + } ret = inflateReset(&s->zstream); if (ret != Z_OK) { av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", ret); return AVERROR_UNKNOWN; } - s->zstream.next_in = avpkt->data + 2; - s->zstream.avail_in = avpkt->size - 2; + s->zstream.next_in = buf; + s->zstream.avail_in = buf_size; s->zstream.next_out = s->decomp_buf; s->zstream.avail_out = s->decomp_size; ret = inflate(&s->zstream, Z_FINISH); @@ -229,3 +235,15 @@ AVCodec ff_mscc_decoder = { .decode = decode_frame, .capabilities = AV_CODEC_CAP_DR1, }; + +AVCodec ff_srgc_decoder = { + .name = "srgc", + .long_name = NULL_IF_CONFIG_SMALL("Screen Recorder Gold Codec"), + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_SRGC, + .priv_data_size = sizeof(MSCCContext), + .init = decode_init, + .close = decode_close, + .decode = decode_frame, + .capabilities = AV_CODEC_CAP_DR1, +}; |