Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
b406f387
Commit
b406f387
authored
Jul 08, 2017
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/noise_bsf: add support for dropping packets
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
fe924220
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
bitstream_filters.texi
doc/bitstream_filters.texi
+11
-3
noise_bsf.c
libavcodec/noise_bsf.c
+8
-0
version.h
libavcodec/version.h
+1
-1
No files found.
doc/bitstream_filters.texi
View file @
b406f387
...
...
@@ -220,19 +220,27 @@ ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi
@section noise
Damages the contents of packets
without damaging the container. Can b
e
used for fuzzing or testing error resilience/concealment.
Damages the contents of packets
or simply drops them without damaging th
e
container. Can be
used for fuzzing or testing error resilience/concealment.
Parameters:
@table @option
@item amount
A numeral string, whose value is related to how often output bytes will
be modified. Therefore, values below or equal to 0 are forbidden, and
the lower the more frequent bytes will be modified, with 1 meaning
every byte is modified.
@item dropamount
A numeral string, whose value is related to how often packets will be dropped.
Therefore, values below or equal to 0 are forbidden, and the lower the more
frequent packets will be dropped, with 1 meaning every packet is dropped.
@end table
The following example applies the modification to every byte but does not drop
any packets.
@example
ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv
@end example
applies the modification to every byte.
@section null
This bitstream filter passes the packets through unchanged.
...
...
libavcodec/noise_bsf.c
View file @
b406f387
...
...
@@ -31,6 +31,7 @@
typedef
struct
NoiseContext
{
const
AVClass
*
class
;
int
amount
;
int
dropamount
;
unsigned
int
state
;
}
NoiseContext
;
...
...
@@ -48,6 +49,12 @@ static int noise(AVBSFContext *ctx, AVPacket *out)
if
(
ret
<
0
)
return
ret
;
if
(
s
->
dropamount
>
0
&&
s
->
state
%
s
->
dropamount
==
0
)
{
s
->
state
++
;
av_packet_free
(
&
in
);
return
AVERROR
(
EAGAIN
);
}
ret
=
av_new_packet
(
out
,
in
->
size
);
if
(
ret
<
0
)
goto
fail
;
...
...
@@ -73,6 +80,7 @@ fail:
#define OFFSET(x) offsetof(NoiseContext, x)
static
const
AVOption
options
[]
=
{
{
"amount"
,
NULL
,
OFFSET
(
amount
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
INT_MAX
},
{
"dropamount"
,
NULL
,
OFFSET
(
dropamount
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
INT_MAX
},
{
NULL
},
};
...
...
libavcodec/version.h
View file @
b406f387
...
...
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 100
#define LIBAVCODEC_VERSION_MICRO 10
3
#define LIBAVCODEC_VERSION_MICRO 10
4
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
...
...
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