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
fcef991a
Commit
fcef991a
authored
May 13, 2006
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add pcm 24/32 le/be support
Originally committed as revision 5375 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
08db8f18
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
23 deletions
+46
-23
movenc.c
libavformat/movenc.c
+46
-23
No files found.
libavformat/movenc.c
View file @
fcef991a
...
@@ -224,6 +224,14 @@ static int mov_write_damr_tag(ByteIOContext *pb)
...
@@ -224,6 +224,14 @@ static int mov_write_damr_tag(ByteIOContext *pb)
return
0x11
;
return
0x11
;
}
}
static
int
mov_write_enda_tag
(
ByteIOContext
*
pb
)
{
put_be32
(
pb
,
10
);
put_tag
(
pb
,
"enda"
);
put_be16
(
pb
,
1
);
/* little endian */
return
10
;
}
static
unsigned
int
descrLength
(
unsigned
int
len
)
static
unsigned
int
descrLength
(
unsigned
int
len
)
{
{
int
i
;
int
i
;
...
@@ -242,10 +250,8 @@ static void putDescr(ByteIOContext *pb, int tag, unsigned int size)
...
@@ -242,10 +250,8 @@ static void putDescr(ByteIOContext *pb, int tag, unsigned int size)
static
int
mov_write_esds_tag
(
ByteIOContext
*
pb
,
MOVTrack
*
track
)
// Basic
static
int
mov_write_esds_tag
(
ByteIOContext
*
pb
,
MOVTrack
*
track
)
// Basic
{
{
int
decoderSpecificInfoLen
;
offset_t
pos
=
url_ftell
(
pb
);
offset_t
pos
=
url_ftell
(
pb
);
int
decoderSpecificInfoLen
=
track
->
vosLen
?
descrLength
(
track
->
vosLen
)
:
0
;
decoderSpecificInfoLen
=
track
->
vosLen
?
descrLength
(
track
->
vosLen
)
:
0
;
put_be32
(
pb
,
0
);
// size
put_be32
(
pb
,
0
);
// size
put_tag
(
pb
,
"esds"
);
put_tag
(
pb
,
"esds"
);
...
@@ -302,17 +308,18 @@ static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack* track)
...
@@ -302,17 +308,18 @@ static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack* track)
put_be32
(
pb
,
12
);
/* size */
put_be32
(
pb
,
12
);
/* size */
put_tag
(
pb
,
"frma"
);
put_tag
(
pb
,
"frma"
);
put_tag
(
pb
,
"mp4a"
);
put_le32
(
pb
,
track
->
tag
);
put_be32
(
pb
,
12
);
/* size */
put_tag
(
pb
,
"mp4a"
);
put_be32
(
pb
,
0
);
mov_write_esds_tag
(
pb
,
track
);
if
(
track
->
enc
->
codec_id
==
CODEC_ID_AAC
)
{
put_be32
(
pb
,
12
);
/* size */
put_tag
(
pb
,
"mp4a"
);
put_be32
(
pb
,
0
);
put_be32
(
pb
,
12
);
/* size */
mov_write_esds_tag
(
pb
,
track
);
put_tag
(
pb
,
"srcq"
);
}
else
if
(
track
->
enc
->
codec_id
==
CODEC_ID_PCM_S24LE
||
put_be32
(
pb
,
0x40
);
track
->
enc
->
codec_id
==
CODEC_ID_PCM_S32LE
)
{
mov_write_enda_tag
(
pb
);
}
put_be32
(
pb
,
8
);
/* size */
put_be32
(
pb
,
8
);
/* size */
put_be32
(
pb
,
0
);
/* null tag */
put_be32
(
pb
,
0
);
/* null tag */
...
@@ -331,6 +338,10 @@ static const CodecTag codec_movaudio_tags[] = {
...
@@ -331,6 +338,10 @@ static const CodecTag codec_movaudio_tags[] = {
{
CODEC_ID_AMR_WB
,
MKTAG
(
's'
,
'a'
,
'w'
,
'b'
)
},
{
CODEC_ID_AMR_WB
,
MKTAG
(
's'
,
'a'
,
'w'
,
'b'
)
},
{
CODEC_ID_PCM_S16BE
,
MKTAG
(
't'
,
'w'
,
'o'
,
's'
)
},
{
CODEC_ID_PCM_S16BE
,
MKTAG
(
't'
,
'w'
,
'o'
,
's'
)
},
{
CODEC_ID_PCM_S16LE
,
MKTAG
(
's'
,
'o'
,
'w'
,
't'
)
},
{
CODEC_ID_PCM_S16LE
,
MKTAG
(
's'
,
'o'
,
'w'
,
't'
)
},
{
CODEC_ID_PCM_S24BE
,
MKTAG
(
'i'
,
'n'
,
'2'
,
'4'
)
},
{
CODEC_ID_PCM_S24LE
,
MKTAG
(
'i'
,
'n'
,
'2'
,
'4'
)
},
{
CODEC_ID_PCM_S32BE
,
MKTAG
(
'i'
,
'n'
,
'3'
,
'2'
)
},
{
CODEC_ID_PCM_S32LE
,
MKTAG
(
'i'
,
'n'
,
'3'
,
'2'
)
},
{
CODEC_ID_MP3
,
MKTAG
(
'.'
,
'm'
,
'p'
,
'3'
)
},
{
CODEC_ID_MP3
,
MKTAG
(
'.'
,
'm'
,
'p'
,
'3'
)
},
{
CODEC_ID_NONE
,
0
},
{
CODEC_ID_NONE
,
0
},
};
};
...
@@ -338,6 +349,10 @@ static const CodecTag codec_movaudio_tags[] = {
...
@@ -338,6 +349,10 @@ static const CodecTag codec_movaudio_tags[] = {
static
int
mov_write_audio_tag
(
ByteIOContext
*
pb
,
MOVTrack
*
track
)
static
int
mov_write_audio_tag
(
ByteIOContext
*
pb
,
MOVTrack
*
track
)
{
{
offset_t
pos
=
url_ftell
(
pb
);
offset_t
pos
=
url_ftell
(
pb
);
int
version
=
track
->
mode
==
MODE_MOV
&&
(
track
->
enc
->
codec_id
==
CODEC_ID_AAC
||
track
->
enc
->
codec_id
==
CODEC_ID_PCM_S32LE
||
track
->
enc
->
codec_id
==
CODEC_ID_PCM_S24LE
);
put_be32
(
pb
,
0
);
/* size */
put_be32
(
pb
,
0
);
/* size */
put_le32
(
pb
,
track
->
tag
);
// store it byteswapped
put_le32
(
pb
,
track
->
tag
);
// store it byteswapped
...
@@ -346,10 +361,7 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
...
@@ -346,10 +361,7 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
put_be16
(
pb
,
1
);
/* Data-reference index, XXX == 1 */
put_be16
(
pb
,
1
);
/* Data-reference index, XXX == 1 */
/* SoundDescription */
/* SoundDescription */
if
(
track
->
mode
==
MODE_MOV
&&
track
->
enc
->
codec_id
==
CODEC_ID_AAC
)
put_be16
(
pb
,
version
);
/* Version */
put_be16
(
pb
,
1
);
/* Version 1 */
else
put_be16
(
pb
,
0
);
/* Version 0 */
put_be16
(
pb
,
0
);
/* Revision level */
put_be16
(
pb
,
0
);
/* Revision level */
put_be32
(
pb
,
0
);
/* Reserved */
put_be32
(
pb
,
0
);
/* Reserved */
...
@@ -369,20 +381,23 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
...
@@ -369,20 +381,23 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
put_be16
(
pb
,
track
->
timescale
);
/* Time scale */
put_be16
(
pb
,
track
->
timescale
);
/* Time scale */
put_be16
(
pb
,
0
);
/* Reserved */
put_be16
(
pb
,
0
);
/* Reserved */
if
(
track
->
mode
==
MODE_MOV
&&
track
->
enc
->
codec_id
==
CODEC_ID_AAC
)
{
if
(
version
==
1
)
{
/* SoundDescription V1 extended info */
/* SoundDescription V1 extended info */
put_be32
(
pb
,
track
->
enc
->
frame_size
);
/* Samples per packet */
put_be32
(
pb
,
track
->
enc
->
frame_size
);
/* Samples per packet */
put_be32
(
pb
,
1536
);
/* Bytes per packet
*/
put_be32
(
pb
,
track
->
sampleDuration
);
/* Bytes per frame
*/
put_be32
(
pb
,
2
);
/* Bytes per fram
e */
put_be32
(
pb
,
8
);
/* Bytes per sampl
e */
put_be32
(
pb
,
2
);
/* Bytes per sample */
put_be32
(
pb
,
2
);
/* Bytes per sample */
}
}
if
(
track
->
enc
->
codec_id
==
CODEC_ID_AAC
)
{
if
(
track
->
enc
->
codec_id
==
CODEC_ID_AAC
)
{
if
(
track
->
mode
==
MODE_MOV
)
mov_write_wave_tag
(
pb
,
track
);
if
(
track
->
mode
==
MODE_MOV
)
mov_write_wave_tag
(
pb
,
track
);
else
mov_write_esds_tag
(
pb
,
track
);
else
mov_write_esds_tag
(
pb
,
track
);
}
}
else
if
(
track
->
enc
->
codec_id
==
CODEC_ID_AMR_NB
)
{
if
(
track
->
enc
->
codec_id
==
CODEC_ID_AMR_NB
)
mov_write_damr_tag
(
pb
);
mov_write_damr_tag
(
pb
);
}
else
if
(
track
->
enc
->
codec_id
==
CODEC_ID_PCM_S24LE
||
track
->
enc
->
codec_id
==
CODEC_ID_PCM_S32LE
)
{
mov_write_wave_tag
(
pb
,
track
);
}
return
updateSize
(
pb
,
pos
);
return
updateSize
(
pb
,
pos
);
}
}
...
@@ -1604,6 +1619,14 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -1604,6 +1619,14 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
case
CODEC_ID_PCM_S16LE
:
case
CODEC_ID_PCM_S16LE
:
samplesInChunk
=
size
/
(
2
*
enc
->
channels
);
samplesInChunk
=
size
/
(
2
*
enc
->
channels
);
break
;
break
;
case
CODEC_ID_PCM_S24BE
:
case
CODEC_ID_PCM_S24LE
:
samplesInChunk
=
size
/
(
3
*
enc
->
channels
);
break
;
case
CODEC_ID_PCM_S32BE
:
case
CODEC_ID_PCM_S32LE
:
samplesInChunk
=
size
/
(
4
*
enc
->
channels
);
break
;
default:
default:
samplesInChunk
=
1
;
samplesInChunk
=
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