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
d67cfdeb
Commit
d67cfdeb
authored
Jan 16, 2014
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat: utils: Refactor duplicated PRINT macro
parent
54b2ce74
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
31 deletions
+23
-31
utils.c
libavformat/utils.c
+23
-31
No files found.
libavformat/utils.c
View file @
d67cfdeb
...
...
@@ -3008,11 +3008,7 @@ fail:
return
-
1
;
}
static
void
hex_dump_internal
(
void
*
avcl
,
FILE
*
f
,
int
level
,
const
uint8_t
*
buf
,
int
size
)
{
int
len
,
i
,
j
,
c
;
#define PRINT(...) \
#define HEXDUMP_PRINT(...) \
do { \
if (!f) \
av_log(avcl, level, __VA_ARGS__); \
...
...
@@ -3020,27 +3016,31 @@ static void hex_dump_internal(void *avcl, FILE *f, int level,
fprintf(f, __VA_ARGS__); \
} while (0)
static
void
hex_dump_internal
(
void
*
avcl
,
FILE
*
f
,
int
level
,
const
uint8_t
*
buf
,
int
size
)
{
int
len
,
i
,
j
,
c
;
for
(
i
=
0
;
i
<
size
;
i
+=
16
)
{
len
=
size
-
i
;
if
(
len
>
16
)
len
=
16
;
PRINT
(
"%08x "
,
i
);
HEXDUMP_
PRINT
(
"%08x "
,
i
);
for
(
j
=
0
;
j
<
16
;
j
++
)
{
if
(
j
<
len
)
PRINT
(
" %02x"
,
buf
[
i
+
j
]);
HEXDUMP_
PRINT
(
" %02x"
,
buf
[
i
+
j
]);
else
PRINT
(
" "
);
HEXDUMP_
PRINT
(
" "
);
}
PRINT
(
" "
);
HEXDUMP_
PRINT
(
" "
);
for
(
j
=
0
;
j
<
len
;
j
++
)
{
c
=
buf
[
i
+
j
];
if
(
c
<
' '
||
c
>
'~'
)
c
=
'.'
;
PRINT
(
"%c"
,
c
);
HEXDUMP_
PRINT
(
"%c"
,
c
);
}
PRINT
(
"
\n
"
);
HEXDUMP_
PRINT
(
"
\n
"
);
}
#undef PRINT
}
void
av_hex_dump
(
FILE
*
f
,
const
uint8_t
*
buf
,
int
size
)
...
...
@@ -3056,31 +3056,23 @@ void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
static
void
pkt_dump_internal
(
void
*
avcl
,
FILE
*
f
,
int
level
,
AVPacket
*
pkt
,
int
dump_payload
,
AVRational
time_base
)
{
#define PRINT(...) \
do { \
if (!f) \
av_log(avcl, level, __VA_ARGS__); \
else \
fprintf(f, __VA_ARGS__); \
} while (0)
PRINT
(
"stream #%d:
\n
"
,
pkt
->
stream_index
);
PRINT
(
" keyframe=%d
\n
"
,
((
pkt
->
flags
&
AV_PKT_FLAG_KEY
)
!=
0
));
PRINT
(
" duration=%0.3f
\n
"
,
pkt
->
duration
*
av_q2d
(
time_base
));
HEXDUMP_PRINT
(
"stream #%d:
\n
"
,
pkt
->
stream_index
);
HEXDUMP_PRINT
(
" keyframe=%d
\n
"
,
(
pkt
->
flags
&
AV_PKT_FLAG_KEY
)
!=
0
);
HEXDUMP_PRINT
(
" duration=%0.3f
\n
"
,
pkt
->
duration
*
av_q2d
(
time_base
));
/* DTS is _always_ valid after av_read_frame() */
PRINT
(
" dts="
);
HEXDUMP_
PRINT
(
" dts="
);
if
(
pkt
->
dts
==
AV_NOPTS_VALUE
)
PRINT
(
"N/A"
);
HEXDUMP_
PRINT
(
"N/A"
);
else
PRINT
(
"%0.3f"
,
pkt
->
dts
*
av_q2d
(
time_base
));
HEXDUMP_
PRINT
(
"%0.3f"
,
pkt
->
dts
*
av_q2d
(
time_base
));
/* PTS may not be known if B-frames are present. */
PRINT
(
" pts="
);
HEXDUMP_
PRINT
(
" pts="
);
if
(
pkt
->
pts
==
AV_NOPTS_VALUE
)
PRINT
(
"N/A"
);
HEXDUMP_
PRINT
(
"N/A"
);
else
PRINT
(
"%0.3f"
,
pkt
->
pts
*
av_q2d
(
time_base
));
PRINT
(
"
\n
"
);
PRINT
(
" size=%d
\n
"
,
pkt
->
size
);
#undef PRINT
HEXDUMP_PRINT
(
"%0.3f"
,
pkt
->
pts
*
av_q2d
(
time_base
));
HEXDUMP_PRINT
(
"
\n
"
);
HEXDUMP_PRINT
(
" size=%d
\n
"
,
pkt
->
size
);
if
(
dump_payload
)
av_hex_dump
(
f
,
pkt
->
data
,
pkt
->
size
);
}
...
...
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