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
a5fd3a1a
Commit
a5fd3a1a
authored
Oct 08, 2015
by
Rodger Combs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: use lavf API for applying bitstream filters
parent
4caa3e1c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
44 deletions
+9
-44
ffmpeg.c
ffmpeg.c
+4
-42
ffmpeg.h
ffmpeg.h
+0
-1
ffmpeg_opt.c
ffmpeg_opt.c
+5
-1
No files found.
ffmpeg.c
View file @
a5fd3a1a
...
...
@@ -683,47 +683,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
if
(
bsfc
)
av_packet_split_side_data
(
pkt
);
while
(
bsfc
)
{
AVPacket
new_pkt
=
*
pkt
;
AVDictionaryEntry
*
bsf_arg
=
av_dict_get
(
ost
->
bsf_args
,
bsfc
->
filter
->
name
,
NULL
,
0
);
int
a
=
av_bitstream_filter_filter
(
bsfc
,
avctx
,
bsf_arg
?
bsf_arg
->
value
:
NULL
,
&
new_pkt
.
data
,
&
new_pkt
.
size
,
pkt
->
data
,
pkt
->
size
,
pkt
->
flags
&
AV_PKT_FLAG_KEY
);
if
(
a
==
0
&&
new_pkt
.
data
!=
pkt
->
data
)
{
uint8_t
*
t
=
av_malloc
(
new_pkt
.
size
+
AV_INPUT_BUFFER_PADDING_SIZE
);
//the new should be a subset of the old so cannot overflow
if
(
t
)
{
memcpy
(
t
,
new_pkt
.
data
,
new_pkt
.
size
);
memset
(
t
+
new_pkt
.
size
,
0
,
AV_INPUT_BUFFER_PADDING_SIZE
);
new_pkt
.
data
=
t
;
new_pkt
.
buf
=
NULL
;
a
=
1
;
}
else
a
=
AVERROR
(
ENOMEM
);
}
if
(
a
>
0
)
{
pkt
->
side_data
=
NULL
;
pkt
->
side_data_elems
=
0
;
av_packet_unref
(
pkt
);
new_pkt
.
buf
=
av_buffer_create
(
new_pkt
.
data
,
new_pkt
.
size
,
av_buffer_default_free
,
NULL
,
0
);
if
(
!
new_pkt
.
buf
)
exit_program
(
1
);
}
else
if
(
a
<
0
)
{
new_pkt
=
*
pkt
;
av_log
(
NULL
,
AV_LOG_ERROR
,
"Failed to open bitstream filter %s for stream %d with codec %s"
,
bsfc
->
filter
->
name
,
pkt
->
stream_index
,
avctx
->
codec
?
avctx
->
codec
->
name
:
"copy"
);
print_error
(
""
,
a
);
if
(
exit_on_error
)
exit_program
(
1
);
}
*
pkt
=
new_pkt
;
bsfc
=
bsfc
->
next
;
if
((
ret
=
av_apply_bitstream_filters
(
avctx
,
pkt
,
bsfc
))
<
0
)
{
print_error
(
""
,
ret
);
if
(
exit_on_error
)
exit_program
(
1
);
}
if
(
!
(
s
->
oformat
->
flags
&
AVFMT_NOTIMESTAMPS
))
{
...
...
@@ -4244,7 +4207,6 @@ static int transcode(void)
av_dict_free
(
&
ost
->
sws_dict
);
av_dict_free
(
&
ost
->
swr_opts
);
av_dict_free
(
&
ost
->
resample_opts
);
av_dict_free
(
&
ost
->
bsf_args
);
}
}
}
...
...
ffmpeg.h
View file @
a5fd3a1a
...
...
@@ -454,7 +454,6 @@ typedef struct OutputStream {
AVDictionary
*
sws_dict
;
AVDictionary
*
swr_opts
;
AVDictionary
*
resample_opts
;
AVDictionary
*
bsf_args
;
char
*
apad
;
OSTFinished
finished
;
/* no more packets should be written for this stream */
int
unavailable
;
/* true if the steram is unavailable (possibly temporarily) */
...
...
ffmpeg_opt.c
View file @
a5fd3a1a
...
...
@@ -1255,7 +1255,11 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
bsfc_prev
->
next
=
bsfc
;
else
ost
->
bitstream_filters
=
bsfc
;
av_dict_set
(
&
ost
->
bsf_args
,
bsfc
->
filter
->
name
,
arg
,
0
);
if
(
arg
)
if
(
!
(
bsfc
->
args
=
av_strdup
(
arg
)))
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Bitstream filter memory allocation failed
\n
"
);
exit_program
(
1
);
}
bsfc_prev
=
bsfc
;
bsf
=
next
;
...
...
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