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
1fb47728
Commit
1fb47728
authored
Dec 19, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adxenc: use bytestream functions for header writing.
also add more documentation about the header structure
parent
656e606c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
adxenc.c
libavcodec/adxenc.c
+20
-11
No files found.
libavcodec/adxenc.c
View file @
1fb47728
...
...
@@ -19,9 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "adx.h"
#include "bytestream.h"
#include "put_bits.h"
/**
...
...
@@ -81,20 +81,29 @@ static void adx_encode(ADXContext *c, uint8_t *adx, const int16_t *wav,
flush_put_bits
(
&
pb
);
}
#define HEADER_SIZE 36
static
int
adx_encode_header
(
AVCodecContext
*
avctx
,
uint8_t
*
buf
,
int
bufsize
)
{
ADXContext
*
c
=
avctx
->
priv_data
;
AV_WB32
(
buf
+
0x00
,
0x80000000
|
0x20
);
AV_WB32
(
buf
+
0x04
,
0x03120400
|
avctx
->
channels
);
AV_WB32
(
buf
+
0x08
,
avctx
->
sample_rate
);
AV_WB32
(
buf
+
0x0c
,
0
);
AV_WB16
(
buf
+
0x10
,
c
->
cutoff
);
AV_WB32
(
buf
+
0x12
,
0x03000000
);
AV_WB32
(
buf
+
0x16
,
0x00000000
);
AV_WB32
(
buf
+
0x1a
,
0x00000000
);
memcpy
(
buf
+
0x1e
,
"(c)CRI"
,
6
);
return
0x20
+
4
;
bytestream_put_be16
(
&
buf
,
0x8000
);
/* header signature */
bytestream_put_be16
(
&
buf
,
HEADER_SIZE
-
4
);
/* copyright offset */
bytestream_put_byte
(
&
buf
,
3
);
/* encoding */
bytestream_put_byte
(
&
buf
,
BLOCK_SIZE
);
/* block size */
bytestream_put_byte
(
&
buf
,
4
);
/* sample size */
bytestream_put_byte
(
&
buf
,
avctx
->
channels
);
/* channels */
bytestream_put_be32
(
&
buf
,
avctx
->
sample_rate
);
/* sample rate */
bytestream_put_be32
(
&
buf
,
0
);
/* total sample count */
bytestream_put_be16
(
&
buf
,
c
->
cutoff
);
/* cutoff frequency */
bytestream_put_byte
(
&
buf
,
3
);
/* version */
bytestream_put_byte
(
&
buf
,
0
);
/* flags */
bytestream_put_be32
(
&
buf
,
0
);
/* unknown */
bytestream_put_be32
(
&
buf
,
0
);
/* loop enabled */
bytestream_put_be16
(
&
buf
,
0
);
/* padding */
bytestream_put_buffer
(
&
buf
,
"(c)CRI"
,
6
);
/* copyright signature */
return
HEADER_SIZE
;
}
static
av_cold
int
adx_encode_init
(
AVCodecContext
*
avctx
)
...
...
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