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
20789372
Commit
20789372
authored
Feb 23, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/shorten: support decoding AIFF-C variant
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
f5fa12d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
configure
configure
+1
-1
shorten.c
libavcodec/shorten.c
+15
-1
No files found.
configure
View file @
20789372
...
@@ -2513,7 +2513,7 @@ rv20_encoder_select="h263_encoder"
...
@@ -2513,7 +2513,7 @@ rv20_encoder_select="h263_encoder"
rv30_decoder_select
=
"golomb h264pred h264qpel mpegvideo rv34dsp"
rv30_decoder_select
=
"golomb h264pred h264qpel mpegvideo rv34dsp"
rv40_decoder_select
=
"golomb h264pred h264qpel mpegvideo rv34dsp"
rv40_decoder_select
=
"golomb h264pred h264qpel mpegvideo rv34dsp"
screenpresso_decoder_select
=
"zlib"
screenpresso_decoder_select
=
"zlib"
shorten_decoder_select
=
"golomb"
shorten_decoder_select
=
"golomb
bswapdsp
"
sipr_decoder_select
=
"lsp"
sipr_decoder_select
=
"lsp"
snow_decoder_select
=
"dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
snow_decoder_select
=
"dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
snow_encoder_select
=
"aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
snow_encoder_select
=
"aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
...
...
libavcodec/shorten.c
View file @
20789372
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include <limits.h>
#include <limits.h>
#include "avcodec.h"
#include "avcodec.h"
#include "bswapdsp.h"
#include "bytestream.h"
#include "bytestream.h"
#include "get_bits.h"
#include "get_bits.h"
#include "golomb.h"
#include "golomb.h"
...
@@ -109,6 +110,8 @@ typedef struct ShortenContext {
...
@@ -109,6 +110,8 @@ typedef struct ShortenContext {
int32_t
lpcqoffset
;
int32_t
lpcqoffset
;
int
got_header
;
int
got_header
;
int
got_quit_command
;
int
got_quit_command
;
int
swap
;
BswapDSPContext
bdsp
;
}
ShortenContext
;
}
ShortenContext
;
static
av_cold
int
shorten_decode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
shorten_decode_init
(
AVCodecContext
*
avctx
)
...
@@ -116,6 +119,8 @@ static av_cold int shorten_decode_init(AVCodecContext *avctx)
...
@@ -116,6 +119,8 @@ static av_cold int shorten_decode_init(AVCodecContext *avctx)
ShortenContext
*
s
=
avctx
->
priv_data
;
ShortenContext
*
s
=
avctx
->
priv_data
;
s
->
avctx
=
avctx
;
s
->
avctx
=
avctx
;
ff_bswapdsp_init
(
&
s
->
bdsp
);
return
0
;
return
0
;
}
}
...
@@ -202,6 +207,7 @@ static int init_offset(ShortenContext *s)
...
@@ -202,6 +207,7 @@ static int init_offset(ShortenContext *s)
static
int
decode_aiff_header
(
AVCodecContext
*
avctx
,
const
uint8_t
*
header
,
static
int
decode_aiff_header
(
AVCodecContext
*
avctx
,
const
uint8_t
*
header
,
int
header_size
)
int
header_size
)
{
{
ShortenContext
*
s
=
avctx
->
priv_data
;
int
len
,
bps
,
exp
;
int
len
,
bps
,
exp
;
GetByteContext
gb
;
GetByteContext
gb
;
uint64_t
val
;
uint64_t
val
;
...
@@ -217,7 +223,8 @@ static int decode_aiff_header(AVCodecContext *avctx, const uint8_t *header,
...
@@ -217,7 +223,8 @@ static int decode_aiff_header(AVCodecContext *avctx, const uint8_t *header,
bytestream2_skip
(
&
gb
,
4
);
/* chunk size */
bytestream2_skip
(
&
gb
,
4
);
/* chunk size */
tag
=
bytestream2_get_le32
(
&
gb
);
tag
=
bytestream2_get_le32
(
&
gb
);
if
(
tag
!=
MKTAG
(
'A'
,
'I'
,
'F'
,
'F'
))
{
if
(
tag
!=
MKTAG
(
'A'
,
'I'
,
'F'
,
'F'
)
&&
tag
!=
MKTAG
(
'A'
,
'I'
,
'F'
,
'C'
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"missing AIFF tag
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"missing AIFF tag
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -241,6 +248,8 @@ static int decode_aiff_header(AVCodecContext *avctx, const uint8_t *header,
...
@@ -241,6 +248,8 @@ static int decode_aiff_header(AVCodecContext *avctx, const uint8_t *header,
bps
=
bytestream2_get_be16
(
&
gb
);
bps
=
bytestream2_get_be16
(
&
gb
);
avctx
->
bits_per_coded_sample
=
bps
;
avctx
->
bits_per_coded_sample
=
bps
;
s
->
swap
=
tag
==
MKTAG
(
'A'
,
'I'
,
'F'
,
'C'
);
if
(
bps
!=
16
&&
bps
!=
8
)
{
if
(
bps
!=
16
&&
bps
!=
8
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported number of bits per sample: %d
\n
"
,
bps
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported number of bits per sample: %d
\n
"
,
bps
);
return
AVERROR
(
ENOSYS
);
return
AVERROR
(
ENOSYS
);
...
@@ -721,6 +730,11 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -721,6 +730,11 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
break
;
break
;
}
}
}
}
if
(
s
->
swap
&&
s
->
internal_ftype
!=
TYPE_U8
)
s
->
bdsp
.
bswap16_buf
(((
uint16_t
**
)
frame
->
extended_data
)[
chan
],
((
uint16_t
**
)
frame
->
extended_data
)[
chan
],
s
->
blocksize
);
}
}
*
got_frame_ptr
=
1
;
*
got_frame_ptr
=
1
;
...
...
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