avcodec: add Screen Recorder Gold Codec decoder

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2017-04-16 18:44:57 +02:00
parent a96db6be06
commit 61088051bd
9 changed files with 35 additions and 4 deletions

1
configure vendored
View File

@ -2514,6 +2514,7 @@ sonic_decoder_select="golomb rangecoder"
sonic_encoder_select="golomb rangecoder"
sonic_ls_encoder_select="golomb rangecoder"
sp5x_decoder_select="mjpeg_decoder"
srgc_decoder_select="zlib"
svq1_decoder_select="hpeldsp"
svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"

View File

@ -857,6 +857,7 @@ following image formats are supported:
@tab used in some games by Entertainment Software Partners
@item ScreenPressor @tab @tab X
@item Screenpresso @tab @tab X
@item Screen Recorder Gold Codec @tab @tab X
@item Sierra VMD video @tab @tab X
@tab Used in Sierra VMD files.
@item Silicon Graphics Motion Video Compressor 1 (MVC1) @tab @tab X

View File

@ -541,6 +541,7 @@ OBJS-$(CONFIG_SONIC_ENCODER) += sonic.o
OBJS-$(CONFIG_SONIC_LS_ENCODER) += sonic.o
OBJS-$(CONFIG_SPEEDHQ_DECODER) += speedhq.o simple_idct.o
OBJS-$(CONFIG_SP5X_DECODER) += sp5xdec.o
OBJS-$(CONFIG_SRGC_DECODER) += mscc.o
OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o htmlsubtitles.o
OBJS-$(CONFIG_SRT_ENCODER) += srtenc.o ass_split.o
OBJS-$(CONFIG_STL_DECODER) += textdec.o ass.o

View File

@ -317,6 +317,7 @@ static void register_all(void)
REGISTER_ENCDEC (SNOW, snow);
REGISTER_DECODER(SP5X, sp5x);
REGISTER_DECODER(SPEEDHQ, speedhq);
REGISTER_DECODER(SRGC, srgc);
REGISTER_ENCDEC (SUNRAST, sunrast);
REGISTER_ENCDEC (SVQ1, svq1);
REGISTER_DECODER(SVQ3, svq3);

View File

@ -444,6 +444,7 @@ enum AVCodecID {
AV_CODEC_ID_AV1,
AV_CODEC_ID_BITPACKED,
AV_CODEC_ID_MSCC,
AV_CODEC_ID_SRGC,
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs

View File

@ -1395,6 +1395,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("Mandsoft Screen Capture Codec"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_SRGC,
.type = AVMEDIA_TYPE_VIDEO,
.name = "srgc",
.long_name = NULL_IF_CONFIG_SMALL("Screen Recorder Gold Codec"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
/* image codecs */
{

View File

@ -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,
};

View File

@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 92
#define LIBAVCODEC_VERSION_MINOR 93
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

View File

@ -453,6 +453,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ AV_CODEC_ID_CLEARVIDEO, MKTAG('U', 'C', 'O', 'D') },
{ AV_CODEC_ID_AV1, MKTAG('A', 'V', '0', '1') },
{ AV_CODEC_ID_MSCC, MKTAG('M', 'S', 'C', 'C') },
{ AV_CODEC_ID_SRGC, MKTAG('S', 'R', 'G', 'C') },
{ AV_CODEC_ID_NONE, 0 }
};