Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
f7d749e9
Commit
f7d749e9
authored
Aug 24, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: add MatchWare Screen Capture Codec
parent
38ec5b4a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
206 additions
and
1 deletion
+206
-1
Changelog
Changelog
+1
-0
configure
configure
+1
-0
Makefile
libavcodec/Makefile
+1
-0
allcodecs.c
libavcodec/allcodecs.c
+1
-0
avcodec.h
libavcodec/avcodec.h
+1
-0
codec_desc.c
libavcodec/codec_desc.c
+7
-0
mwsc.c
libavcodec/mwsc.c
+192
-0
version.h
libavcodec/version.h
+1
-1
riff.c
libavformat/riff.c
+1
-0
No files found.
Changelog
View file @
f7d749e9
...
@@ -19,6 +19,7 @@ version <next>:
...
@@ -19,6 +19,7 @@ version <next>:
- AVS2 video decoder via libdavs2
- AVS2 video decoder via libdavs2
- IMM4 video decoder
- IMM4 video decoder
- Brooktree ProSumer video decoder
- Brooktree ProSumer video decoder
- MatchWare Screen Capture Codec decoder
version 4.0:
version 4.0:
...
...
configure
View file @
f7d749e9
...
@@ -2700,6 +2700,7 @@ msmpeg4v3_decoder_select="h263_decoder"
...
@@ -2700,6 +2700,7 @@ msmpeg4v3_decoder_select="h263_decoder"
msmpeg4v3_encoder_select
=
"h263_encoder"
msmpeg4v3_encoder_select
=
"h263_encoder"
mss2_decoder_select
=
"mpegvideo qpeldsp vc1_decoder"
mss2_decoder_select
=
"mpegvideo qpeldsp vc1_decoder"
mts2_decoder_select
=
"mss34dsp"
mts2_decoder_select
=
"mss34dsp"
mwsc_decoder_deps
=
"zlib"
mxpeg_decoder_select
=
"mjpeg_decoder"
mxpeg_decoder_select
=
"mjpeg_decoder"
nellymoser_decoder_select
=
"mdct sinewin"
nellymoser_decoder_select
=
"mdct sinewin"
nellymoser_encoder_select
=
"audio_frame_queue mdct sinewin"
nellymoser_encoder_select
=
"audio_frame_queue mdct sinewin"
...
...
libavcodec/Makefile
View file @
f7d749e9
...
@@ -482,6 +482,7 @@ OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
...
@@ -482,6 +482,7 @@ OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
OBJS-$(CONFIG_MTS2_DECODER)
+=
mss4.o
OBJS-$(CONFIG_MTS2_DECODER)
+=
mss4.o
OBJS-$(CONFIG_MVC1_DECODER)
+=
mvcdec.o
OBJS-$(CONFIG_MVC1_DECODER)
+=
mvcdec.o
OBJS-$(CONFIG_MVC2_DECODER)
+=
mvcdec.o
OBJS-$(CONFIG_MVC2_DECODER)
+=
mvcdec.o
OBJS-$(CONFIG_MWSC_DECODER)
+=
mwsc.o
OBJS-$(CONFIG_MXPEG_DECODER)
+=
mxpegdec.o
OBJS-$(CONFIG_MXPEG_DECODER)
+=
mxpegdec.o
OBJS-$(CONFIG_NELLYMOSER_DECODER)
+=
nellymoserdec.o
nellymoser.o
OBJS-$(CONFIG_NELLYMOSER_DECODER)
+=
nellymoserdec.o
nellymoser.o
OBJS-$(CONFIG_NELLYMOSER_ENCODER)
+=
nellymoserenc.o
nellymoser.o
OBJS-$(CONFIG_NELLYMOSER_ENCODER)
+=
nellymoserenc.o
nellymoser.o
...
...
libavcodec/allcodecs.c
View file @
f7d749e9
...
@@ -213,6 +213,7 @@ extern AVCodec ff_mszh_decoder;
...
@@ -213,6 +213,7 @@ extern AVCodec ff_mszh_decoder;
extern
AVCodec
ff_mts2_decoder
;
extern
AVCodec
ff_mts2_decoder
;
extern
AVCodec
ff_mvc1_decoder
;
extern
AVCodec
ff_mvc1_decoder
;
extern
AVCodec
ff_mvc2_decoder
;
extern
AVCodec
ff_mvc2_decoder
;
extern
AVCodec
ff_mwsc_decoder
;
extern
AVCodec
ff_mxpeg_decoder
;
extern
AVCodec
ff_mxpeg_decoder
;
extern
AVCodec
ff_nuv_decoder
;
extern
AVCodec
ff_nuv_decoder
;
extern
AVCodec
ff_paf_video_decoder
;
extern
AVCodec
ff_paf_video_decoder
;
...
...
libavcodec/avcodec.h
View file @
f7d749e9
...
@@ -449,6 +449,7 @@ enum AVCodecID {
...
@@ -449,6 +449,7 @@ enum AVCodecID {
AV_CODEC_ID_FITS
,
AV_CODEC_ID_FITS
,
AV_CODEC_ID_IMM4
,
AV_CODEC_ID_IMM4
,
AV_CODEC_ID_PROSUMER
,
AV_CODEC_ID_PROSUMER
,
AV_CODEC_ID_MWSC
,
/* various PCM "codecs" */
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO
=
0x10000
,
///< A dummy id pointing at the start of audio codecs
AV_CODEC_ID_FIRST_AUDIO
=
0x10000
,
///< A dummy id pointing at the start of audio codecs
...
...
libavcodec/codec_desc.c
View file @
f7d749e9
...
@@ -1668,6 +1668,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
...
@@ -1668,6 +1668,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Brooktree ProSumer Video"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Brooktree ProSumer Video"
),
.
props
=
AV_CODEC_PROP_INTRA_ONLY
|
AV_CODEC_PROP_LOSSY
,
.
props
=
AV_CODEC_PROP_INTRA_ONLY
|
AV_CODEC_PROP_LOSSY
,
},
},
{
.
id
=
AV_CODEC_ID_MWSC
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
name
=
"mwsc"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"MatchWare Screen Capture Codec"
),
.
props
=
AV_CODEC_PROP_LOSSLESS
,
},
/* various PCM "codecs" */
/* various PCM "codecs" */
{
{
...
...
libavcodec/mwsc.c
0 → 100644
View file @
f7d749e9
/*
* MatchWare Screen Capture Codec decoder
*
* Copyright (c) 2018 Paul B Mahol
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include <zlib.h>
typedef
struct
MWSCContext
{
unsigned
int
decomp_size
;
uint8_t
*
decomp_buf
;
z_stream
zstream
;
AVFrame
*
prev_frame
;
}
MWSCContext
;
static
int
rle_uncompress
(
GetByteContext
*
gb
,
PutByteContext
*
pb
,
GetByteContext
*
gbp
,
int
width
,
int
height
,
int
stride
,
int
pb_linesize
,
int
gbp_linesize
)
{
int
intra
=
1
,
w
=
0
;
bytestream2_seek_p
(
pb
,
(
height
-
1
)
*
pb_linesize
,
SEEK_SET
);
while
(
bytestream2_get_bytes_left
(
gb
)
>
0
)
{
uint32_t
fill
=
bytestream2_get_le24
(
gb
);
unsigned
run
=
bytestream2_get_byte
(
gb
);
if
(
run
==
0
)
{
run
=
bytestream2_get_le32
(
gb
);
for
(
int
j
=
0
;
j
<
run
;
j
++
,
w
++
)
{
if
(
w
==
width
)
{
w
=
0
;
bytestream2_seek_p
(
pb
,
-
(
pb_linesize
+
stride
),
SEEK_CUR
);
}
bytestream2_put_le24
(
pb
,
fill
);
}
}
else
if
(
run
==
255
)
{
int
pos
=
bytestream2_tell_p
(
pb
);
bytestream2_seek
(
gbp
,
pos
,
SEEK_SET
);
for
(
int
j
=
0
;
j
<
fill
;
j
++
,
w
++
)
{
if
(
w
==
width
)
{
w
=
0
;
bytestream2_seek_p
(
pb
,
-
(
pb_linesize
+
stride
),
SEEK_CUR
);
bytestream2_seek
(
gbp
,
-
(
gbp_linesize
+
stride
),
SEEK_CUR
);
}
bytestream2_put_le24
(
pb
,
bytestream2_get_le24
(
gbp
));
}
intra
=
0
;
}
else
{
for
(
int
j
=
0
;
j
<
run
;
j
++
,
w
++
)
{
if
(
w
==
width
)
{
w
=
0
;
bytestream2_seek_p
(
pb
,
-
(
pb_linesize
+
stride
),
SEEK_CUR
);
}
bytestream2_put_le24
(
pb
,
fill
);
}
}
}
return
intra
;
}
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame
,
AVPacket
*
avpkt
)
{
MWSCContext
*
s
=
avctx
->
priv_data
;
AVFrame
*
frame
=
data
;
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
GetByteContext
gb
;
GetByteContext
gbp
;
PutByteContext
pb
;
int
ret
;
ret
=
inflateReset
(
&
s
->
zstream
);
if
(
ret
!=
Z_OK
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Inflate reset error: %d
\n
"
,
ret
);
return
AVERROR_EXTERNAL
;
}
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
);
if
(
ret
!=
Z_STREAM_END
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Inflate error: %d
\n
"
,
ret
);
return
AVERROR_EXTERNAL
;
}
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
,
AV_GET_BUFFER_FLAG_REF
))
<
0
)
return
ret
;
bytestream2_init
(
&
gb
,
s
->
decomp_buf
,
s
->
zstream
.
total_out
);
bytestream2_init
(
&
gbp
,
s
->
prev_frame
->
data
[
0
],
avctx
->
height
*
s
->
prev_frame
->
linesize
[
0
]);
bytestream2_init_writer
(
&
pb
,
frame
->
data
[
0
],
avctx
->
height
*
frame
->
linesize
[
0
]);
frame
->
key_frame
=
rle_uncompress
(
&
gb
,
&
pb
,
&
gbp
,
avctx
->
width
,
avctx
->
height
,
avctx
->
width
*
3
,
frame
->
linesize
[
0
],
s
->
prev_frame
->
linesize
[
0
]);
frame
->
pict_type
=
frame
->
key_frame
?
AV_PICTURE_TYPE_I
:
AV_PICTURE_TYPE_P
;
av_frame_unref
(
s
->
prev_frame
);
if
((
ret
=
av_frame_ref
(
s
->
prev_frame
,
frame
))
<
0
)
return
ret
;
*
got_frame
=
1
;
return
avpkt
->
size
;
}
static
av_cold
int
decode_init
(
AVCodecContext
*
avctx
)
{
MWSCContext
*
s
=
avctx
->
priv_data
;
int64_t
size
;
int
zret
;
avctx
->
pix_fmt
=
AV_PIX_FMT_BGR24
;
size
=
32LL
*
avctx
->
height
*
avctx
->
width
;
if
(
size
>=
INT32_MAX
)
return
AVERROR_INVALIDDATA
;
s
->
decomp_size
=
size
;
if
(
!
(
s
->
decomp_buf
=
av_malloc
(
s
->
decomp_size
)))
return
AVERROR
(
ENOMEM
);
s
->
zstream
.
zalloc
=
Z_NULL
;
s
->
zstream
.
zfree
=
Z_NULL
;
s
->
zstream
.
opaque
=
Z_NULL
;
zret
=
inflateInit
(
&
s
->
zstream
);
if
(
zret
!=
Z_OK
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Inflate init error: %d
\n
"
,
zret
);
return
AVERROR_EXTERNAL
;
}
s
->
prev_frame
=
av_frame_alloc
();
if
(
!
s
->
prev_frame
)
return
AVERROR
(
ENOMEM
);
return
0
;
}
static
av_cold
int
decode_close
(
AVCodecContext
*
avctx
)
{
MWSCContext
*
s
=
avctx
->
priv_data
;
av_frame_free
(
&
s
->
prev_frame
);
av_freep
(
&
s
->
decomp_buf
);
s
->
decomp_size
=
0
;
inflateEnd
(
&
s
->
zstream
);
return
0
;
}
AVCodec
ff_mwsc_decoder
=
{
.
name
=
"mwsc"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"MatchWare Screen Capture Codec"
),
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_MWSC
,
.
priv_data_size
=
sizeof
(
MWSCContext
),
.
init
=
decode_init
,
.
close
=
decode_close
,
.
decode
=
decode_frame
,
.
capabilities
=
AV_CODEC_CAP_DR1
,
.
caps_internal
=
FF_CODEC_CAP_INIT_THREADSAFE
|
FF_CODEC_CAP_INIT_CLEANUP
,
};
libavcodec/version.h
View file @
f7d749e9
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 2
5
#define LIBAVCODEC_VERSION_MINOR 2
6
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...
...
libavformat/riff.c
View file @
f7d749e9
...
@@ -472,6 +472,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
...
@@ -472,6 +472,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{
AV_CODEC_ID_SRGC
,
MKTAG
(
'S'
,
'R'
,
'G'
,
'C'
)
},
{
AV_CODEC_ID_SRGC
,
MKTAG
(
'S'
,
'R'
,
'G'
,
'C'
)
},
{
AV_CODEC_ID_IMM4
,
MKTAG
(
'I'
,
'M'
,
'M'
,
'4'
)
},
{
AV_CODEC_ID_IMM4
,
MKTAG
(
'I'
,
'M'
,
'M'
,
'4'
)
},
{
AV_CODEC_ID_PROSUMER
,
MKTAG
(
'B'
,
'T'
,
'2'
,
'0'
)
},
{
AV_CODEC_ID_PROSUMER
,
MKTAG
(
'B'
,
'T'
,
'2'
,
'0'
)
},
{
AV_CODEC_ID_MWSC
,
MKTAG
(
'M'
,
'W'
,
'S'
,
'C'
)
},
{
AV_CODEC_ID_NONE
,
0
}
{
AV_CODEC_ID_NONE
,
0
}
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment