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
4e81b5f5
Commit
4e81b5f5
authored
Jan 25, 2012
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: K&R reformatting cosmetics
parent
50639cbe
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
158 additions
and
133 deletions
+158
-133
aviocat.c
tools/aviocat.c
+4
-2
cws2fws.c
tools/cws2fws.c
+25
-31
graph2dot.c
tools/graph2dot.c
+22
-14
ismindex.c
tools/ismindex.c
+51
-44
lavfi-showfiltfmts.c
tools/lavfi-showfiltfmts.c
+4
-2
pktdumper.c
tools/pktdumper.c
+14
-10
probetest.c
tools/probetest.c
+17
-11
qt-faststart.c
tools/qt-faststart.c
+0
-1
trasher.c
tools/trasher.c
+21
-18
No files found.
tools/aviocat.c
View file @
4e81b5f5
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#include "libavformat/avformat.h"
#include "libavformat/avformat.h"
static
int
usage
(
const
char
*
argv0
,
int
ret
)
static
int
usage
(
const
char
*
argv0
,
int
ret
)
...
@@ -80,13 +81,14 @@ int main(int argc, char **argv)
...
@@ -80,13 +81,14 @@ int main(int argc, char **argv)
stream_pos
+=
n
;
stream_pos
+=
n
;
if
(
bps
)
{
if
(
bps
)
{
avio_flush
(
output
);
avio_flush
(
output
);
while
((
av_gettime
()
-
start_time
)
*
bps
/
AV_TIME_BASE
<
stream_pos
)
while
((
av_gettime
()
-
start_time
)
*
bps
/
AV_TIME_BASE
<
stream_pos
)
usleep
(
50
*
1000
);
usleep
(
50
*
1000
);
}
}
}
}
avio_flush
(
output
);
avio_flush
(
output
);
avio_close
(
output
);
avio_close
(
output
);
fail:
fail:
avio_close
(
input
);
avio_close
(
input
);
avformat_network_deinit
();
avformat_network_deinit
();
...
...
tools/cws2fws.c
View file @
4e81b5f5
...
@@ -26,46 +26,42 @@ int main(int argc, char *argv[])
...
@@ -26,46 +26,42 @@ int main(int argc, char *argv[])
z_stream
zstream
;
z_stream
zstream
;
struct
stat
statbuf
;
struct
stat
statbuf
;
if
(
argc
<
3
)
if
(
argc
<
3
)
{
{
printf
(
"Usage: %s <infile.swf> <outfile.swf>
\n
"
,
argv
[
0
]);
printf
(
"Usage: %s <infile.swf> <outfile.swf>
\n
"
,
argv
[
0
]);
return
1
;
return
1
;
}
}
fd_in
=
open
(
argv
[
1
],
O_RDONLY
);
fd_in
=
open
(
argv
[
1
],
O_RDONLY
);
if
(
fd_in
<
0
)
if
(
fd_in
<
0
)
{
{
perror
(
"Error opening input file"
);
perror
(
"Error opening input file"
);
return
1
;
return
1
;
}
}
fd_out
=
open
(
argv
[
2
],
O_WRONLY
|
O_CREAT
,
00644
);
fd_out
=
open
(
argv
[
2
],
O_WRONLY
|
O_CREAT
,
00644
);
if
(
fd_out
<
0
)
if
(
fd_out
<
0
)
{
{
perror
(
"Error opening output file"
);
perror
(
"Error opening output file"
);
close
(
fd_in
);
close
(
fd_in
);
return
1
;
return
1
;
}
}
if
(
read
(
fd_in
,
&
buf_in
,
8
)
!=
8
)
if
(
read
(
fd_in
,
&
buf_in
,
8
)
!=
8
)
{
{
printf
(
"Header error
\n
"
);
printf
(
"Header error
\n
"
);
close
(
fd_in
);
close
(
fd_in
);
close
(
fd_out
);
close
(
fd_out
);
return
1
;
return
1
;
}
}
if
(
buf_in
[
0
]
!=
'C'
||
buf_in
[
1
]
!=
'W'
||
buf_in
[
2
]
!=
'S'
)
if
(
buf_in
[
0
]
!=
'C'
||
buf_in
[
1
]
!=
'W'
||
buf_in
[
2
]
!=
'S'
)
{
{
printf
(
"Not a compressed flash file
\n
"
);
printf
(
"Not a compressed flash file
\n
"
);
return
1
;
return
1
;
}
}
fstat
(
fd_in
,
&
statbuf
);
fstat
(
fd_in
,
&
statbuf
);
comp_len
=
statbuf
.
st_size
;
comp_len
=
statbuf
.
st_size
;
uncomp_len
=
buf_in
[
4
]
|
(
buf_in
[
5
]
<<
8
)
|
(
buf_in
[
6
]
<<
16
)
|
(
buf_in
[
7
]
<<
24
);
uncomp_len
=
buf_in
[
4
]
|
(
buf_in
[
5
]
<<
8
)
|
(
buf_in
[
6
]
<<
16
)
|
(
buf_in
[
7
]
<<
24
);
printf
(
"Compressed size: %d Uncompressed size: %d
\n
"
,
comp_len
-
4
,
uncomp_len
-
4
);
printf
(
"Compressed size: %d Uncompressed size: %d
\n
"
,
comp_len
-
4
,
uncomp_len
-
4
);
// write out modified header
// write out modified header
buf_in
[
0
]
=
'F'
;
buf_in
[
0
]
=
'F'
;
...
@@ -75,36 +71,35 @@ int main(int argc, char *argv[])
...
@@ -75,36 +71,35 @@ int main(int argc, char *argv[])
}
}
zstream
.
zalloc
=
NULL
;
zstream
.
zalloc
=
NULL
;
zstream
.
zfree
=
NULL
;
zstream
.
zfree
=
NULL
;
zstream
.
opaque
=
NULL
;
zstream
.
opaque
=
NULL
;
inflateInit
(
&
zstream
);
inflateInit
(
&
zstream
);
for
(
i
=
0
;
i
<
comp_len
-
8
;)
for
(
i
=
0
;
i
<
comp_len
-
8
;)
{
{
int
ret
,
len
=
read
(
fd_in
,
&
buf_in
,
1024
);
int
ret
,
len
=
read
(
fd_in
,
&
buf_in
,
1024
);
dbgprintf
(
"read %d bytes
\n
"
,
len
);
dbgprintf
(
"read %d bytes
\n
"
,
len
);
last_out
=
zstream
.
total_out
;
last_out
=
zstream
.
total_out
;
zstream
.
next_in
=
&
buf_in
[
0
];
zstream
.
next_in
=
&
buf_in
[
0
];
zstream
.
avail_in
=
len
;
zstream
.
avail_in
=
len
;
zstream
.
next_out
=
&
buf_out
[
0
];
zstream
.
next_out
=
&
buf_out
[
0
];
zstream
.
avail_out
=
65536
;
zstream
.
avail_out
=
65536
;
ret
=
inflate
(
&
zstream
,
Z_SYNC_FLUSH
);
ret
=
inflate
(
&
zstream
,
Z_SYNC_FLUSH
);
if
(
ret
!=
Z_STREAM_END
&&
ret
!=
Z_OK
)
if
(
ret
!=
Z_STREAM_END
&&
ret
!=
Z_OK
)
{
{
printf
(
"Error while decompressing: %d
\n
"
,
ret
);
printf
(
"Error while decompressing: %d
\n
"
,
ret
);
inflateEnd
(
&
zstream
);
inflateEnd
(
&
zstream
);
return
1
;
return
1
;
}
}
dbgprintf
(
"a_in: %d t_in: %lu a_out: %d t_out: %lu -- %lu out
\n
"
,
dbgprintf
(
"a_in: %d t_in: %lu a_out: %d t_out: %lu -- %lu out
\n
"
,
zstream
.
avail_in
,
zstream
.
total_in
,
zstream
.
avail_out
,
zstream
.
tota
l_out
,
zstream
.
avail_in
,
zstream
.
total_in
,
zstream
.
avai
l_out
,
zstream
.
total_out
-
last_out
);
zstream
.
total_out
,
zstream
.
total_out
-
last_out
);
if
(
write
(
fd_out
,
&
buf_out
,
zstream
.
total_out
-
last_out
)
<
zstream
.
total_out
-
last_out
)
{
if
(
write
(
fd_out
,
&
buf_out
,
zstream
.
total_out
-
last_out
)
<
zstream
.
total_out
-
last_out
)
{
perror
(
"Error writing output file"
);
perror
(
"Error writing output file"
);
return
1
;
return
1
;
}
}
...
@@ -115,15 +110,14 @@ int main(int argc, char *argv[])
...
@@ -115,15 +110,14 @@ int main(int argc, char *argv[])
break
;
break
;
}
}
if
(
zstream
.
total_out
!=
uncomp_len
-
8
)
if
(
zstream
.
total_out
!=
uncomp_len
-
8
)
{
{
printf
(
"Size mismatch (%lu != %d), updating header...
\n
"
,
printf
(
"Size mismatch (%lu != %d), updating header...
\n
"
,
zstream
.
total_out
,
uncomp_len
-
8
);
zstream
.
total_out
,
uncomp_len
-
8
);
buf_in
[
0
]
=
(
zstream
.
total_out
+
8
)
&
0xff
;
buf_in
[
0
]
=
(
zstream
.
total_out
+
8
)
&
0xff
;
buf_in
[
1
]
=
((
zstream
.
total_out
+
8
)
>>
8
)
&
0xff
;
buf_in
[
1
]
=
((
zstream
.
total_out
+
8
)
>>
8
)
&
0xff
;
buf_in
[
2
]
=
((
zstream
.
total_out
+
8
)
>>
16
)
&
0xff
;
buf_in
[
2
]
=
((
zstream
.
total_out
+
8
)
>>
16
)
&
0xff
;
buf_in
[
3
]
=
((
zstream
.
total_out
+
8
)
>>
24
)
&
0xff
;
buf_in
[
3
]
=
((
zstream
.
total_out
+
8
)
>>
24
)
&
0xff
;
lseek
(
fd_out
,
4
,
SEEK_SET
);
lseek
(
fd_out
,
4
,
SEEK_SET
);
if
(
write
(
fd_out
,
&
buf_in
,
4
)
<
4
)
{
if
(
write
(
fd_out
,
&
buf_in
,
4
)
<
4
)
{
...
...
tools/graph2dot.c
View file @
4e81b5f5
...
@@ -63,19 +63,25 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
...
@@ -63,19 +63,25 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
char
dst_filter_ctx_label
[
128
];
char
dst_filter_ctx_label
[
128
];
const
AVFilterContext
*
dst_filter_ctx
=
link
->
dst
;
const
AVFilterContext
*
dst_filter_ctx
=
link
->
dst
;
snprintf
(
dst_filter_ctx_label
,
sizeof
(
dst_filter_ctx_label
),
"%s (%s)"
,
snprintf
(
dst_filter_ctx_label
,
sizeof
(
dst_filter_ctx_label
),
"%s (%s)"
,
dst_filter_ctx
->
name
,
dst_filter_ctx
->
name
,
dst_filter_ctx
->
filter
->
name
);
dst_filter_ctx
->
filter
->
name
);
fprintf
(
outfile
,
"
\"
%s
\"
->
\"
%s
\"
"
,
filter_ctx_label
,
dst_filter_ctx_label
);
fprintf
(
outfile
,
"
\"
%s
\"
->
\"
%s
\"
"
,
filter_ctx_label
,
dst_filter_ctx_label
);
if
(
link
->
type
==
AVMEDIA_TYPE_VIDEO
)
{
if
(
link
->
type
==
AVMEDIA_TYPE_VIDEO
)
{
fprintf
(
outfile
,
" [ label=
\"
fmt:%s w:%d h:%d tb:%d/%d
\"
]"
,
fprintf
(
outfile
,
" [ label=
\"
fmt:%s w:%d h:%d tb:%d/%d
\"
]"
,
av_pix_fmt_descriptors
[
link
->
format
].
name
,
av_pix_fmt_descriptors
[
link
->
format
].
name
,
link
->
w
,
link
->
h
,
link
->
time_base
.
num
,
link
->
time_base
.
den
);
link
->
w
,
link
->
h
,
link
->
time_base
.
num
,
link
->
time_base
.
den
);
}
else
if
(
link
->
type
==
AVMEDIA_TYPE_AUDIO
)
{
}
else
if
(
link
->
type
==
AVMEDIA_TYPE_AUDIO
)
{
char
buf
[
255
];
char
buf
[
255
];
av_get_channel_layout_string
(
buf
,
sizeof
(
buf
),
-
1
,
link
->
channel_layout
);
av_get_channel_layout_string
(
buf
,
sizeof
(
buf
),
-
1
,
fprintf
(
outfile
,
" [ label=
\"
fmt:%s sr:%"
PRId64
" cl:%s
\"
]"
,
link
->
channel_layout
);
fprintf
(
outfile
,
" [ label=
\"
fmt:%s sr:%"
PRId64
" cl:%s
\"
]"
,
av_get_sample_fmt_name
(
link
->
format
),
av_get_sample_fmt_name
(
link
->
format
),
link
->
sample_rate
,
buf
);
link
->
sample_rate
,
buf
);
}
}
...
@@ -89,17 +95,17 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
...
@@ -89,17 +95,17 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
const
char
*
outfilename
=
NULL
;
const
char
*
outfilename
=
NULL
;
const
char
*
infilename
=
NULL
;
const
char
*
infilename
=
NULL
;
FILE
*
outfile
=
NULL
;
FILE
*
outfile
=
NULL
;
FILE
*
infile
=
NULL
;
FILE
*
infile
=
NULL
;
char
*
graph_string
=
NULL
;
char
*
graph_string
=
NULL
;
AVFilterGraph
*
graph
=
av_mallocz
(
sizeof
(
AVFilterGraph
));
AVFilterGraph
*
graph
=
av_mallocz
(
sizeof
(
AVFilterGraph
));
char
c
;
char
c
;
av_log_set_level
(
AV_LOG_DEBUG
);
av_log_set_level
(
AV_LOG_DEBUG
);
while
((
c
=
getopt
(
argc
,
argv
,
"hi:o:"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"hi:o:"
))
!=
-
1
)
{
switch
(
c
)
{
switch
(
c
)
{
case
'h'
:
case
'h'
:
usage
();
usage
();
return
0
;
return
0
;
...
@@ -118,7 +124,8 @@ int main(int argc, char **argv)
...
@@ -118,7 +124,8 @@ int main(int argc, char **argv)
infilename
=
"/dev/stdin"
;
infilename
=
"/dev/stdin"
;
infile
=
fopen
(
infilename
,
"r"
);
infile
=
fopen
(
infilename
,
"r"
);
if
(
!
infile
)
{
if
(
!
infile
)
{
fprintf
(
stderr
,
"Impossible to open input file '%s': %s
\n
"
,
infilename
,
strerror
(
errno
));
fprintf
(
stderr
,
"Impossible to open input file '%s': %s
\n
"
,
infilename
,
strerror
(
errno
));
return
1
;
return
1
;
}
}
...
@@ -126,7 +133,8 @@ int main(int argc, char **argv)
...
@@ -126,7 +133,8 @@ int main(int argc, char **argv)
outfilename
=
"/dev/stdout"
;
outfilename
=
"/dev/stdout"
;
outfile
=
fopen
(
outfilename
,
"w"
);
outfile
=
fopen
(
outfilename
,
"w"
);
if
(
!
outfile
)
{
if
(
!
outfile
)
{
fprintf
(
stderr
,
"Impossible to open output file '%s': %s
\n
"
,
outfilename
,
strerror
(
errno
));
fprintf
(
stderr
,
"Impossible to open output file '%s': %s
\n
"
,
outfilename
,
strerror
(
errno
));
return
1
;
return
1
;
}
}
...
@@ -141,7 +149,7 @@ int main(int argc, char **argv)
...
@@ -141,7 +149,7 @@ int main(int argc, char **argv)
struct
line
*
new_line
=
av_malloc
(
sizeof
(
struct
line
));
struct
line
*
new_line
=
av_malloc
(
sizeof
(
struct
line
));
count
+=
strlen
(
last_line
->
data
);
count
+=
strlen
(
last_line
->
data
);
last_line
->
next
=
new_line
;
last_line
->
next
=
new_line
;
last_line
=
new_line
;
last_line
=
new_line
;
}
}
last_line
->
next
=
NULL
;
last_line
->
next
=
NULL
;
...
...
tools/ismindex.c
View file @
4e81b5f5
This diff is collapsed.
Click to expand it.
tools/lavfi-showfiltfmts.c
View file @
4e81b5f5
...
@@ -50,11 +50,13 @@ int main(int argc, char **argv)
...
@@ -50,11 +50,13 @@ int main(int argc, char **argv)
}
}
if
(
avfilter_open
(
&
filter_ctx
,
filter
,
NULL
)
<
0
)
{
if
(
avfilter_open
(
&
filter_ctx
,
filter
,
NULL
)
<
0
)
{
fprintf
(
stderr
,
"Inpossible to open filter with name '%s'
\n
"
,
filter_name
);
fprintf
(
stderr
,
"Inpossible to open filter with name '%s'
\n
"
,
filter_name
);
return
1
;
return
1
;
}
}
if
(
avfilter_init_filter
(
filter_ctx
,
filter_args
,
NULL
)
<
0
)
{
if
(
avfilter_init_filter
(
filter_ctx
,
filter_args
,
NULL
)
<
0
)
{
fprintf
(
stderr
,
"Impossible to init filter '%s' with arguments '%s'
\n
"
,
filter_name
,
filter_args
);
fprintf
(
stderr
,
"Impossible to init filter '%s' with arguments '%s'
\n
"
,
filter_name
,
filter_args
);
return
1
;
return
1
;
}
}
...
...
tools/pktdumper.c
View file @
4e81b5f5
...
@@ -24,9 +24,10 @@
...
@@ -24,9 +24,10 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <unistd.h>
#include <unistd.h>
#include "libavformat/avformat.h"
#include "libavformat/avformat.h"
#define PKTFILESUFF "_%08"
PRId64"_%02d_%010"PRId64
"_%06d_%c.bin"
#define PKTFILESUFF "_%08"
PRId64 "_%02d_%010" PRId64
"_%06d_%c.bin"
#undef strcat
#undef strcat
...
@@ -46,10 +47,10 @@ int main(int argc, char **argv)
...
@@ -46,10 +47,10 @@ int main(int argc, char **argv)
char
pktfilename
[
PATH_MAX
];
char
pktfilename
[
PATH_MAX
];
AVFormatContext
*
fctx
=
NULL
;
AVFormatContext
*
fctx
=
NULL
;
AVPacket
pkt
;
AVPacket
pkt
;
int64_t
pktnum
=
0
;
int64_t
pktnum
=
0
;
int64_t
maxpkts
=
0
;
int64_t
maxpkts
=
0
;
int
donotquit
=
0
;
int
donotquit
=
0
;
int
nowrite
=
0
;
int
nowrite
=
0
;
int
err
;
int
err
;
if
((
argc
>
1
)
&&
!
strncmp
(
argv
[
1
],
"-"
,
1
))
{
if
((
argc
>
1
)
&&
!
strncmp
(
argv
[
1
],
"-"
,
1
))
{
...
@@ -64,16 +65,16 @@ int main(int argc, char **argv)
...
@@ -64,16 +65,16 @@ int main(int argc, char **argv)
return
usage
(
1
);
return
usage
(
1
);
if
(
argc
>
2
)
if
(
argc
>
2
)
maxpkts
=
atoi
(
argv
[
2
]);
maxpkts
=
atoi
(
argv
[
2
]);
strncpy
(
fntemplate
,
argv
[
1
],
PATH_MAX
-
1
);
strncpy
(
fntemplate
,
argv
[
1
],
PATH_MAX
-
1
);
if
(
strrchr
(
argv
[
1
],
'/'
))
if
(
strrchr
(
argv
[
1
],
'/'
))
strncpy
(
fntemplate
,
strrchr
(
argv
[
1
],
'/'
)
+
1
,
PATH_MAX
-
1
);
strncpy
(
fntemplate
,
strrchr
(
argv
[
1
],
'/'
)
+
1
,
PATH_MAX
-
1
);
if
(
strrchr
(
fntemplate
,
'.'
))
if
(
strrchr
(
fntemplate
,
'.'
))
*
strrchr
(
fntemplate
,
'.'
)
=
'\0'
;
*
strrchr
(
fntemplate
,
'.'
)
=
'\0'
;
if
(
strchr
(
fntemplate
,
'%'
))
{
if
(
strchr
(
fntemplate
,
'%'
))
{
fprintf
(
stderr
,
"can't use filenames containing '%%'
\n
"
);
fprintf
(
stderr
,
"can't use filenames containing '%%'
\n
"
);
return
usage
(
1
);
return
usage
(
1
);
}
}
if
(
strlen
(
fntemplate
)
+
sizeof
(
PKTFILESUFF
)
>=
PATH_MAX
-
1
)
{
if
(
strlen
(
fntemplate
)
+
sizeof
(
PKTFILESUFF
)
>=
PATH_MAX
-
1
)
{
fprintf
(
stderr
,
"filename too long
\n
"
);
fprintf
(
stderr
,
"filename too long
\n
"
);
return
usage
(
1
);
return
usage
(
1
);
}
}
...
@@ -99,11 +100,14 @@ int main(int argc, char **argv)
...
@@ -99,11 +100,14 @@ int main(int argc, char **argv)
while
((
err
=
av_read_frame
(
fctx
,
&
pkt
))
>=
0
)
{
while
((
err
=
av_read_frame
(
fctx
,
&
pkt
))
>=
0
)
{
int
fd
;
int
fd
;
snprintf
(
pktfilename
,
PATH_MAX
-
1
,
fntemplate
,
pktnum
,
pkt
.
stream_index
,
pkt
.
pts
,
pkt
.
size
,
(
pkt
.
flags
&
AV_PKT_FLAG_KEY
)
?
'K'
:
'_'
);
snprintf
(
pktfilename
,
PATH_MAX
-
1
,
fntemplate
,
pktnum
,
printf
(
PKTFILESUFF
"
\n
"
,
pktnum
,
pkt
.
stream_index
,
pkt
.
pts
,
pkt
.
size
,
(
pkt
.
flags
&
AV_PKT_FLAG_KEY
)
?
'K'
:
'_'
);
pkt
.
stream_index
,
pkt
.
pts
,
pkt
.
size
,
(
pkt
.
flags
&
AV_PKT_FLAG_KEY
)
?
'K'
:
'_'
);
printf
(
PKTFILESUFF
"
\n
"
,
pktnum
,
pkt
.
stream_index
,
pkt
.
pts
,
pkt
.
size
,
(
pkt
.
flags
&
AV_PKT_FLAG_KEY
)
?
'K'
:
'_'
);
//printf("open(\"%s\")\n", pktfilename);
//printf("open(\"%s\")\n", pktfilename);
if
(
!
nowrite
)
{
if
(
!
nowrite
)
{
fd
=
open
(
pktfilename
,
O_WRONLY
|
O_CREAT
,
0644
);
fd
=
open
(
pktfilename
,
O_WRONLY
|
O_CREAT
,
0644
);
err
=
write
(
fd
,
pkt
.
data
,
pkt
.
size
);
err
=
write
(
fd
,
pkt
.
data
,
pkt
.
size
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
fprintf
(
stderr
,
"write: error %d
\n
"
,
err
);
fprintf
(
stderr
,
"write: error %d
\n
"
,
err
);
...
...
tools/probetest.c
View file @
4e81b5f5
...
@@ -39,7 +39,8 @@ static void probe(AVProbeData *pd, int type, int p, int size)
...
@@ -39,7 +39,8 @@ static void probe(AVProbeData *pd, int type, int p, int size)
int
score
=
fmt
->
read_probe
(
pd
);
int
score
=
fmt
->
read_probe
(
pd
);
if
(
score
>
score_array
[
i
]
&&
score
>
AVPROBE_SCORE_MAX
/
4
)
{
if
(
score
>
score_array
[
i
]
&&
score
>
AVPROBE_SCORE_MAX
/
4
)
{
score_array
[
i
]
=
score
;
score_array
[
i
]
=
score
;
fprintf
(
stderr
,
"Failure of %s probing code with score=%d type=%d p=%X size=%d
\n
"
,
fprintf
(
stderr
,
"Failure of %s probing code with score=%d type=%d p=%X size=%d
\n
"
,
fmt
->
name
,
score
,
type
,
p
,
size
);
fmt
->
name
,
score
,
type
,
p
,
size
);
failures
++
;
failures
++
;
}
}
...
@@ -75,9 +76,8 @@ int main(void)
...
@@ -75,9 +76,8 @@ int main(void)
init_put_bits
(
&
pb
,
pd
.
buf
,
size
);
init_put_bits
(
&
pb
,
pd
.
buf
,
size
);
switch
(
type
)
{
switch
(
type
)
{
case
0
:
case
0
:
for
(
i
=
0
;
i
<
size
*
8
;
i
++
)
{
for
(
i
=
0
;
i
<
size
*
8
;
i
++
)
put_bits
(
&
pb
,
1
,
(
av_lfg_get
(
&
state
)
&
0xFFFFFFFF
)
>
p
<<
20
);
put_bits
(
&
pb
,
1
,
(
av_lfg_get
(
&
state
)
&
0xFFFFFFFF
)
>
p
<<
20
);
}
break
;
break
;
case
1
:
case
1
:
for
(
i
=
0
;
i
<
size
*
8
;
i
++
)
{
for
(
i
=
0
;
i
<
size
*
8
;
i
++
)
{
...
@@ -89,10 +89,10 @@ int main(void)
...
@@ -89,10 +89,10 @@ int main(void)
break
;
break
;
case
2
:
case
2
:
for
(
i
=
0
;
i
<
size
*
8
;
i
++
)
{
for
(
i
=
0
;
i
<
size
*
8
;
i
++
)
{
unsigned
int
p2
=
(
p
>>
(
hist
*
3
))
&
7
;
unsigned
int
p2
=
(
p
>>
(
hist
*
3
))
&
7
;
unsigned
int
v
=
(
av_lfg_get
(
&
state
)
&
0xFFFFFFFF
)
>
p2
<<
29
;
unsigned
int
v
=
(
av_lfg_get
(
&
state
)
&
0xFFFFFFFF
)
>
p2
<<
29
;
put_bits
(
&
pb
,
1
,
v
);
put_bits
(
&
pb
,
1
,
v
);
hist
=
(
2
*
hist
+
v
)
&
3
;
hist
=
(
2
*
hist
+
v
)
&
3
;
}
}
break
;
break
;
case
3
:
case
3
:
...
@@ -100,12 +100,18 @@ int main(void)
...
@@ -100,12 +100,18 @@ int main(void)
int
c
=
0
;
int
c
=
0
;
while
(
p
&
63
)
{
while
(
p
&
63
)
{
c
=
(
av_lfg_get
(
&
state
)
&
0xFFFFFFFF
)
>>
24
;
c
=
(
av_lfg_get
(
&
state
)
&
0xFFFFFFFF
)
>>
24
;
if
(
c
>=
'a'
&&
c
<=
'z'
&&
(
p
&
1
))
break
;
if
(
c
>=
'a'
&&
c
<=
'z'
&&
(
p
&
1
))
else
if
(
c
>=
'A'
&&
c
<=
'Z'
&&
(
p
&
2
))
break
;
break
;
else
if
(
c
>=
'0'
&&
c
<=
'9'
&&
(
p
&
4
))
break
;
else
if
(
c
>=
'A'
&&
c
<=
'Z'
&&
(
p
&
2
))
else
if
(
c
==
' '
&&
(
p
&
8
))
break
;
break
;
else
if
(
c
==
0
&&
(
p
&
16
))
break
;
else
if
(
c
>=
'0'
&&
c
<=
'9'
&&
(
p
&
4
))
else
if
(
c
==
1
&&
(
p
&
32
))
break
;
break
;
else
if
(
c
==
' '
&&
(
p
&
8
))
break
;
else
if
(
c
==
0
&&
(
p
&
16
))
break
;
else
if
(
c
==
1
&&
(
p
&
32
))
break
;
}
}
pd
.
buf
[
i
]
=
c
;
pd
.
buf
[
i
]
=
c
;
}
}
...
...
tools/qt-faststart.c
View file @
4e81b5f5
...
@@ -138,7 +138,6 @@ int main(int argc, char *argv[])
...
@@ -138,7 +138,6 @@ int main(int argc, char *argv[])
}
}
start_offset
=
ftello
(
infile
);
start_offset
=
ftello
(
infile
);
}
else
{
}
else
{
/* 64-bit special case */
/* 64-bit special case */
if
(
atom_size
==
1
)
{
if
(
atom_size
==
1
)
{
if
(
fread
(
atom_bytes
,
ATOM_PREAMBLE_SIZE
,
1
,
infile
)
!=
1
)
{
if
(
fread
(
atom_bytes
,
ATOM_PREAMBLE_SIZE
,
1
,
infile
)
!=
1
)
{
...
...
tools/trasher.c
View file @
4e81b5f5
...
@@ -23,47 +23,50 @@
...
@@ -23,47 +23,50 @@
#include <inttypes.h>
#include <inttypes.h>
static
uint32_t
state
;
static
uint32_t
state
;
static
uint32_t
ran
(
void
){
static
uint32_t
ran
(
void
)
return
state
=
state
*
1664525
+
1013904223
;
{
return
state
=
state
*
1664525
+
1013904223
;
}
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
FILE
*
f
;
FILE
*
f
;
int
count
,
maxburst
,
length
;
int
count
,
maxburst
,
length
;
if
(
argc
<
5
){
if
(
argc
<
5
)
{
printf
(
"USAGE: trasher <filename> <count> <maxburst> <seed>
\n
"
);
printf
(
"USAGE: trasher <filename> <count> <maxburst> <seed>
\n
"
);
return
1
;
return
1
;
}
}
f
=
fopen
(
argv
[
1
],
"rb+"
);
f
=
fopen
(
argv
[
1
],
"rb+"
);
if
(
!
f
){
if
(
!
f
)
{
perror
(
argv
[
1
]);
perror
(
argv
[
1
]);
return
2
;
return
2
;
}
}
count
=
atoi
(
argv
[
2
]);
count
=
atoi
(
argv
[
2
]);
maxburst
=
atoi
(
argv
[
3
]);
maxburst
=
atoi
(
argv
[
3
]);
state
=
atoi
(
argv
[
4
]);
state
=
atoi
(
argv
[
4
]);
fseek
(
f
,
0
,
SEEK_END
);
fseek
(
f
,
0
,
SEEK_END
);
length
=
ftell
(
f
);
length
=
ftell
(
f
);
fseek
(
f
,
0
,
SEEK_SET
);
fseek
(
f
,
0
,
SEEK_SET
);
while
(
count
--
)
{
while
(
count
--
)
{
int
burst
=
1
+
ran
()
*
(
uint64_t
)
(
abs
(
maxburst
)
-
1
)
/
UINT32_MAX
;
int
burst
=
1
+
ran
()
*
(
uint64_t
)
(
abs
(
maxburst
)
-
1
)
/
UINT32_MAX
;
int
pos
=
ran
()
*
(
uint64_t
)
length
/
UINT32_MAX
;
int
pos
=
ran
()
*
(
uint64_t
)
length
/
UINT32_MAX
;
fseek
(
f
,
pos
,
SEEK_SET
);
fseek
(
f
,
pos
,
SEEK_SET
);
if
(
maxburst
<
0
)
burst
=
-
maxburst
;
if
(
maxburst
<
0
)
burst
=
-
maxburst
;
if
(
pos
+
burst
>
length
)
if
(
pos
+
burst
>
length
)
continue
;
continue
;
while
(
burst
--
)
{
while
(
burst
--
)
{
int
val
=
ran
()
*
256ULL
/
UINT32_MAX
;
int
val
=
ran
()
*
256ULL
/
UINT32_MAX
;
if
(
maxburst
<
0
)
val
=
0
;
if
(
maxburst
<
0
)
val
=
0
;
fwrite
(
&
val
,
1
,
1
,
f
);
fwrite
(
&
val
,
1
,
1
,
f
);
}
}
...
...
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