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
14cf0fd2
Commit
14cf0fd2
authored
13 years ago
by
Alex Converse
Committed by
Anton Khirnov
13 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add silence support for AV_SAMPLE_FMT_U8.
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
b8404847
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
ffmpeg.c
ffmpeg.c
+9
-1
No files found.
ffmpeg.c
View file @
14cf0fd2
...
@@ -1390,6 +1390,14 @@ static void print_report(AVFormatContext **output_files,
...
@@ -1390,6 +1390,14 @@ static void print_report(AVFormatContext **output_files,
}
}
}
}
static
void
generate_silence
(
uint8_t
*
buf
,
enum
AVSampleFormat
sample_fmt
,
size_t
size
)
{
int
fill_char
=
0x00
;
if
(
sample_fmt
==
AV_SAMPLE_FMT_U8
)
fill_char
=
0x80
;
memset
(
buf
,
fill_char
,
size
);
}
/* pkt = NULL means EOF (needed to flush decoder buffers) */
/* pkt = NULL means EOF (needed to flush decoder buffers) */
static
int
output_packet
(
AVInputStream
*
ist
,
int
ist_index
,
static
int
output_packet
(
AVInputStream
*
ist
,
int
ist_index
,
AVOutputStream
**
ost_table
,
int
nb_ostreams
,
AVOutputStream
**
ost_table
,
int
nb_ostreams
,
...
@@ -1732,7 +1740,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
...
@@ -1732,7 +1740,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
int
frame_bytes
=
enc
->
frame_size
*
osize
*
enc
->
channels
;
int
frame_bytes
=
enc
->
frame_size
*
osize
*
enc
->
channels
;
if
(
allocated_audio_buf_size
<
frame_bytes
)
if
(
allocated_audio_buf_size
<
frame_bytes
)
ffmpeg_exit
(
1
);
ffmpeg_exit
(
1
);
memset
(
audio_buf
+
fifo_bytes
,
0
,
frame_bytes
-
fifo_bytes
);
generate_silence
(
audio_buf
+
fifo_bytes
,
enc
->
sample_fmt
,
frame_bytes
-
fifo_bytes
);
}
}
ret
=
avcodec_encode_audio
(
enc
,
bit_buffer
,
bit_buffer_size
,
(
short
*
)
audio_buf
);
ret
=
avcodec_encode_audio
(
enc
,
bit_buffer
,
bit_buffer_size
,
(
short
*
)
audio_buf
);
...
...
This diff is collapsed.
Click to expand it.
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