[FFmpeg-cvslog] avcodec: add Screen Recorder Gold Codec decoder
Paul B Mahol
git at videolan.org
Tue Apr 18 16:12:05 EEST 2017
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Apr 16 18:44:57 2017 +0200| [61088051bd70e94224e8fbc95044ca1c6ca7240a] | committer: Paul B Mahol
avcodec: add Screen Recorder Gold Codec decoder
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61088051bd70e94224e8fbc95044ca1c6ca7240a
---
configure | 1 +
doc/general.texi | 1 +
libavcodec/Makefile | 1 +
libavcodec/allcodecs.c | 1 +
libavcodec/avcodec.h | 1 +
libavcodec/codec_desc.c | 7 +++++++
libavcodec/mscc.c | 24 +++++++++++++++++++++---
libavcodec/version.h | 2 +-
libavformat/riff.c | 1 +
9 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 2e2571493a..758607b502 100755
--- a/configure
+++ b/configure
@@ -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"
diff --git a/doc/general.texi b/doc/general.texi
index 72f02b1d18..065374e3f2 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -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
+ at 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
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7398657dc4..3275654a45 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -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
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 5a708b3c3d..7fcc26f2c1 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -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);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index da9d9dc256..fc928a1804 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -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
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index e342db714d..2d28f840af 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -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 */
{
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,
+};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index cb238dc867..46872b0562 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -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, \
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 294d11b1f0..ac902fde3b 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -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 }
};
More information about the ffmpeg-cvslog
mailing list