Skip to content

Commit 6108805

Browse files
committed
avcodec: add Screen Recorder Gold Codec decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
1 parent a96db6b commit 6108805

File tree

9 files changed

+35
-4
lines changed

9 files changed

+35
-4
lines changed

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,6 +2514,7 @@ sonic_decoder_select="golomb rangecoder"
25142514
sonic_encoder_select="golomb rangecoder"
25152515
sonic_ls_encoder_select="golomb rangecoder"
25162516
sp5x_decoder_select="mjpeg_decoder"
2517+
srgc_decoder_select="zlib"
25172518
svq1_decoder_select="hpeldsp"
25182519
svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
25192520
svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"

doc/general.texi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,7 @@ following image formats are supported:
857857
@tab used in some games by Entertainment Software Partners
858858
@item ScreenPressor @tab @tab X
859859
@item Screenpresso @tab @tab X
860+
@item Screen Recorder Gold Codec @tab @tab X
860861
@item Sierra VMD video @tab @tab X
861862
@tab Used in Sierra VMD files.
862863
@item Silicon Graphics Motion Video Compressor 1 (MVC1) @tab @tab X

libavcodec/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ OBJS-$(CONFIG_SONIC_ENCODER) += sonic.o
541541
OBJS-$(CONFIG_SONIC_LS_ENCODER) += sonic.o
542542
OBJS-$(CONFIG_SPEEDHQ_DECODER) += speedhq.o simple_idct.o
543543
OBJS-$(CONFIG_SP5X_DECODER) += sp5xdec.o
544+
OBJS-$(CONFIG_SRGC_DECODER) += mscc.o
544545
OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o htmlsubtitles.o
545546
OBJS-$(CONFIG_SRT_ENCODER) += srtenc.o ass_split.o
546547
OBJS-$(CONFIG_STL_DECODER) += textdec.o ass.o

libavcodec/allcodecs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ static void register_all(void)
317317
REGISTER_ENCDEC (SNOW, snow);
318318
REGISTER_DECODER(SP5X, sp5x);
319319
REGISTER_DECODER(SPEEDHQ, speedhq);
320+
REGISTER_DECODER(SRGC, srgc);
320321
REGISTER_ENCDEC (SUNRAST, sunrast);
321322
REGISTER_ENCDEC (SVQ1, svq1);
322323
REGISTER_DECODER(SVQ3, svq3);

libavcodec/avcodec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ enum AVCodecID {
444444
AV_CODEC_ID_AV1,
445445
AV_CODEC_ID_BITPACKED,
446446
AV_CODEC_ID_MSCC,
447+
AV_CODEC_ID_SRGC,
447448

448449
/* various PCM "codecs" */
449450
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs

libavcodec/codec_desc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
13951395
.long_name = NULL_IF_CONFIG_SMALL("Mandsoft Screen Capture Codec"),
13961396
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
13971397
},
1398+
{
1399+
.id = AV_CODEC_ID_SRGC,
1400+
.type = AVMEDIA_TYPE_VIDEO,
1401+
.name = "srgc",
1402+
.long_name = NULL_IF_CONFIG_SMALL("Screen Recorder Gold Codec"),
1403+
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
1404+
},
13981405

13991406
/* image codecs */
14001407
{

libavcodec/mscc.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ static int decode_frame(AVCodecContext *avctx,
121121
{
122122
MSCCContext *s = avctx->priv_data;
123123
AVFrame *frame = data;
124+
uint8_t *buf = avpkt->data;
125+
int buf_size = avpkt->size;
124126
GetByteContext gb;
125127
PutByteContext pb;
126128
int ret, j;
@@ -130,15 +132,19 @@ static int decode_frame(AVCodecContext *avctx,
130132
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
131133
return ret;
132134

133-
avpkt->data[2] ^= avpkt->data[0];
135+
if (avctx->codec_id == AV_CODEC_ID_MSCC) {
136+
avpkt->data[2] ^= avpkt->data[0];
137+
buf += 2;
138+
buf_size -= 2;
139+
}
134140

135141
ret = inflateReset(&s->zstream);
136142
if (ret != Z_OK) {
137143
av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", ret);
138144
return AVERROR_UNKNOWN;
139145
}
140-
s->zstream.next_in = avpkt->data + 2;
141-
s->zstream.avail_in = avpkt->size - 2;
146+
s->zstream.next_in = buf;
147+
s->zstream.avail_in = buf_size;
142148
s->zstream.next_out = s->decomp_buf;
143149
s->zstream.avail_out = s->decomp_size;
144150
ret = inflate(&s->zstream, Z_FINISH);
@@ -229,3 +235,15 @@ AVCodec ff_mscc_decoder = {
229235
.decode = decode_frame,
230236
.capabilities = AV_CODEC_CAP_DR1,
231237
};
238+
239+
AVCodec ff_srgc_decoder = {
240+
.name = "srgc",
241+
.long_name = NULL_IF_CONFIG_SMALL("Screen Recorder Gold Codec"),
242+
.type = AVMEDIA_TYPE_VIDEO,
243+
.id = AV_CODEC_ID_SRGC,
244+
.priv_data_size = sizeof(MSCCContext),
245+
.init = decode_init,
246+
.close = decode_close,
247+
.decode = decode_frame,
248+
.capabilities = AV_CODEC_CAP_DR1,
249+
};

libavcodec/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "libavutil/version.h"
2929

3030
#define LIBAVCODEC_VERSION_MAJOR 57
31-
#define LIBAVCODEC_VERSION_MINOR 92
31+
#define LIBAVCODEC_VERSION_MINOR 93
3232
#define LIBAVCODEC_VERSION_MICRO 100
3333

3434
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

libavformat/riff.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
453453
{ AV_CODEC_ID_CLEARVIDEO, MKTAG('U', 'C', 'O', 'D') },
454454
{ AV_CODEC_ID_AV1, MKTAG('A', 'V', '0', '1') },
455455
{ AV_CODEC_ID_MSCC, MKTAG('M', 'S', 'C', 'C') },
456+
{ AV_CODEC_ID_SRGC, MKTAG('S', 'R', 'G', 'C') },
456457
{ AV_CODEC_ID_NONE, 0 }
457458
};
458459

0 commit comments

Comments
 (0)