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
a4ad9438
Commit
a4ad9438
authored
Mar 18, 2011
by
Benjamin Larsson
Committed by
Anton Khirnov
Jul 13, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wav: add an option for writing BEXT chunk
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
c7dd3e7e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
0 deletions
+83
-0
Changelog
Changelog
+4
-0
general.texi
doc/general.texi
+1
-0
wav.c
libavformat/wav.c
+78
-0
No files found.
Changelog
View file @
a4ad9438
...
@@ -2,6 +2,10 @@ Entries are sorted chronologically from oldest to youngest within each release,
...
@@ -2,6 +2,10 @@ Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
releases are sorted from youngest to oldest.
version <next>:
- BWF muxer
version 0.7:
version 0.7:
- E-AC-3 audio encoder
- E-AC-3 audio encoder
...
...
doc/general.texi
View file @
a4ad9438
...
@@ -66,6 +66,7 @@ library:
...
@@ -66,6 +66,7 @@ library:
@tab Used in Z and Z95 games.
@tab Used in Z and Z95 games.
@item Brute Force
&
Ignorance @tab @tab X
@item Brute Force
&
Ignorance @tab @tab X
@tab Used in the game Flash Traffic: City of Angels.
@tab Used in the game Flash Traffic: City of Angels.
@item BWF @tab X @tab
@item Interplay C93 @tab @tab X
@item Interplay C93 @tab @tab X
@tab Used in the game Cyberia from Interplay.
@tab Used in the game Cyberia from Interplay.
@item Delphine Software International CIN @tab @tab X
@item Delphine Software International CIN @tab @tab X
...
...
libavformat/wav.c
View file @
a4ad9438
...
@@ -23,22 +23,82 @@
...
@@ -23,22 +23,82 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include "libavutil/log.h"
#include "libavutil/mathematics.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avformat.h"
#include "avformat.h"
#include "avio_internal.h"
#include "avio_internal.h"
#include "pcm.h"
#include "pcm.h"
#include "riff.h"
#include "riff.h"
#include "avio.h"
#include "avio_internal.h"
typedef
struct
{
typedef
struct
{
const
AVClass
*
class
;
int64_t
data
;
int64_t
data
;
int64_t
data_end
;
int64_t
data_end
;
int64_t
minpts
;
int64_t
minpts
;
int64_t
maxpts
;
int64_t
maxpts
;
int
last_duration
;
int
last_duration
;
int
w64
;
int
w64
;
int
write_bext
;
}
WAVContext
;
}
WAVContext
;
#if CONFIG_WAV_MUXER
#if CONFIG_WAV_MUXER
static
inline
void
bwf_write_bext_string
(
AVFormatContext
*
s
,
const
char
*
key
,
int
maxlen
)
{
AVDictionaryEntry
*
tag
;
int
len
=
0
;
if
(
tag
=
av_dict_get
(
s
->
metadata
,
key
,
NULL
,
0
))
{
len
=
strlen
(
tag
->
value
);
len
=
FFMIN
(
len
,
maxlen
);
avio_write
(
s
->
pb
,
tag
->
value
,
len
);
}
ffio_fill
(
s
->
pb
,
0
,
maxlen
-
len
);
}
static
void
bwf_write_bext_chunk
(
AVFormatContext
*
s
)
{
AVDictionaryEntry
*
tmp_tag
;
uint64_t
time_reference
=
0
;
int64_t
bext
=
ff_start_tag
(
s
->
pb
,
"bext"
);
bwf_write_bext_string
(
s
,
"description"
,
256
);
bwf_write_bext_string
(
s
,
"originator"
,
32
);
bwf_write_bext_string
(
s
,
"originator_reference"
,
32
);
bwf_write_bext_string
(
s
,
"origination_date"
,
10
);
bwf_write_bext_string
(
s
,
"origination_time"
,
8
);
if
(
tmp_tag
=
av_dict_get
(
s
->
metadata
,
"time_reference"
,
NULL
,
0
))
time_reference
=
strtoll
(
tmp_tag
->
value
,
NULL
,
10
);
avio_wl64
(
s
->
pb
,
time_reference
);
avio_wl16
(
s
->
pb
,
1
);
// set version to 1
if
(
tmp_tag
=
av_dict_get
(
s
->
metadata
,
"umid"
,
NULL
,
0
))
{
unsigned
char
umidpart_str
[
17
]
=
{
0
};
int
i
;
uint64_t
umidpart
;
int
len
=
strlen
(
tmp_tag
->
value
+
2
);
for
(
i
=
0
;
i
<
len
/
16
;
i
++
)
{
memcpy
(
umidpart_str
,
tmp_tag
->
value
+
2
+
(
i
*
16
),
16
);
umidpart
=
strtoll
(
umidpart_str
,
NULL
,
16
);
avio_wb64
(
s
->
pb
,
umidpart
);
}
ffio_fill
(
s
->
pb
,
0
,
64
-
i
*
8
);
}
else
ffio_fill
(
s
->
pb
,
0
,
64
);
// zero UMID
ffio_fill
(
s
->
pb
,
0
,
190
);
// Reserved
if
(
tmp_tag
=
av_dict_get
(
s
->
metadata
,
"coding_history"
,
NULL
,
0
))
avio_put_str
(
s
->
pb
,
tmp_tag
->
value
);
ff_end_tag
(
s
->
pb
,
bext
);
}
static
int
wav_write_header
(
AVFormatContext
*
s
)
static
int
wav_write_header
(
AVFormatContext
*
s
)
{
{
WAVContext
*
wav
=
s
->
priv_data
;
WAVContext
*
wav
=
s
->
priv_data
;
...
@@ -65,6 +125,9 @@ static int wav_write_header(AVFormatContext *s)
...
@@ -65,6 +125,9 @@ static int wav_write_header(AVFormatContext *s)
ff_end_tag
(
pb
,
fact
);
ff_end_tag
(
pb
,
fact
);
}
}
if
(
wav
->
write_bext
)
bwf_write_bext_chunk
(
s
);
av_set_pts_info
(
s
->
streams
[
0
],
64
,
1
,
s
->
streams
[
0
]
->
codec
->
sample_rate
);
av_set_pts_info
(
s
->
streams
[
0
],
64
,
1
,
s
->
streams
[
0
]
->
codec
->
sample_rate
);
wav
->
maxpts
=
wav
->
last_duration
=
0
;
wav
->
maxpts
=
wav
->
last_duration
=
0
;
wav
->
minpts
=
INT64_MAX
;
wav
->
minpts
=
INT64_MAX
;
...
@@ -125,6 +188,20 @@ static int wav_write_trailer(AVFormatContext *s)
...
@@ -125,6 +188,20 @@ static int wav_write_trailer(AVFormatContext *s)
return
0
;
return
0
;
}
}
#define OFFSET(x) offsetof(WAVContext, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM
static
const
AVOption
options
[]
=
{
{
"write_bext"
,
"Write BEXT chunk."
,
OFFSET
(
write_bext
),
FF_OPT_TYPE_INT
,
{
0
},
0
,
1
,
ENC
},
{
NULL
},
};
static
const
AVClass
wav_muxer_class
=
{
.
class_name
=
"WAV muxer"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
AVOutputFormat
ff_wav_muxer
=
{
AVOutputFormat
ff_wav_muxer
=
{
"wav"
,
"wav"
,
NULL_IF_CONFIG_SMALL
(
"WAV format"
),
NULL_IF_CONFIG_SMALL
(
"WAV format"
),
...
@@ -137,6 +214,7 @@ AVOutputFormat ff_wav_muxer = {
...
@@ -137,6 +214,7 @@ AVOutputFormat ff_wav_muxer = {
wav_write_packet
,
wav_write_packet
,
wav_write_trailer
,
wav_write_trailer
,
.
codec_tag
=
(
const
AVCodecTag
*
const
[]){
ff_codec_wav_tags
,
0
},
.
codec_tag
=
(
const
AVCodecTag
*
const
[]){
ff_codec_wav_tags
,
0
},
.
priv_class
=
&
wav_muxer_class
,
};
};
#endif
/* CONFIG_WAV_MUXER */
#endif
/* CONFIG_WAV_MUXER */
...
...
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