Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
ffmpeg
Commits
df96f22d
Commit
df96f22d
authored
Jun 02, 2011
by
Diego Biurrun
Browse files
Replace custom debug output functions by av_dlog().
parent
752207e3
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
161 additions
and
181 deletions
+161
-181
libavcodec/interplayvideo.c
libavcodec/interplayvideo.c
+8
-16
libavcodec/vorbisdec.c
libavcodec/vorbisdec.c
+101
-93
libavcodec/vqavideo.c
libavcodec/vqavideo.c
+6
-14
libavformat/ipmovie.c
libavformat/ipmovie.c
+46
-58
No files found.
libavcodec/interplayvideo.c
View file @
df96f22d
...
...
@@ -46,14 +46,6 @@
#define PALETTE_COUNT 256
/* debugging support */
#define DEBUG_INTERPLAY 0
#if DEBUG_INTERPLAY
#define debug_interplay(x,...) av_log(NULL, AV_LOG_DEBUG, x, __VA_ARGS__)
#else
static
inline
void
debug_interplay
(
const
char
*
format
,
...)
{
}
#endif
typedef
struct
IpvideoContext
{
AVCodecContext
*
avctx
;
...
...
@@ -141,7 +133,7 @@ static int ipvideo_decode_block_opcode_0x2(IpvideoContext *s)
y
=
8
+
((
B
-
56
)
/
29
);
}
debug_interplay
(
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
av_dlog
(
NULL
,
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
second_last_frame
,
x
,
y
);
}
...
...
@@ -169,7 +161,7 @@ static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s)
y
=
-
(
8
+
((
B
-
56
)
/
29
));
}
debug_interplay
(
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
av_dlog
(
NULL
,
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
current_frame
,
x
,
y
);
}
...
...
@@ -192,7 +184,7 @@ static int ipvideo_decode_block_opcode_0x4(IpvideoContext *s)
x
=
-
8
+
BL
;
y
=
-
8
+
BH
;
debug_interplay
(
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
av_dlog
(
NULL
,
" motion byte = %d, (x, y) = (%d, %d)
\n
"
,
B
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
last_frame
,
x
,
y
);
}
...
...
@@ -207,7 +199,7 @@ static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s)
x
=
*
s
->
stream_ptr
++
;
y
=
*
s
->
stream_ptr
++
;
debug_interplay
(
" motion bytes = %d, %d
\n
"
,
x
,
y
);
av_dlog
(
NULL
,
" motion bytes = %d, %d
\n
"
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
last_frame
,
x
,
y
);
}
...
...
@@ -588,7 +580,7 @@ static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s)
x
=
*
s
->
stream_ptr
++
;
y
=
*
s
->
stream_ptr
++
;
debug_interplay
(
" motion bytes = %d, %d
\n
"
,
x
,
y
);
av_dlog
(
NULL
,
" motion bytes = %d, %d
\n
"
,
x
,
y
);
return
copy_from
(
s
,
&
s
->
second_last_frame
,
x
,
y
);
}
...
...
@@ -965,7 +957,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
static
int
frame
=
0
;
GetBitContext
gb
;
debug_interplay
(
"------------------ frame %d
\n
"
,
frame
);
av_dlog
(
NULL
,
"------------------ frame %d
\n
"
,
frame
);
frame
++
;
if
(
!
s
->
is_16bpp
)
{
...
...
@@ -991,8 +983,8 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
for
(
x
=
0
;
x
<
s
->
avctx
->
width
;
x
+=
8
)
{
opcode
=
get_bits
(
&
gb
,
4
);
debug_interplay
(
" block @ (%3d, %3d): encoding 0x%X, data ptr @ %p
\n
"
,
x
,
y
,
opcode
,
s
->
stream_ptr
);
av_dlog
(
NULL
,
" block @ (%3d, %3d): encoding 0x%X, data ptr @ %p
\n
"
,
x
,
y
,
opcode
,
s
->
stream_ptr
);
if
(
!
s
->
is_16bpp
)
{
s
->
pixel_ptr
=
s
->
current_frame
.
data
[
0
]
+
x
...
...
libavcodec/vorbisdec.c
View file @
df96f22d
This diff is collapsed.
Click to expand it.
libavcodec/vqavideo.c
View file @
df96f22d
...
...
@@ -90,14 +90,6 @@
#define CPLZ_TAG MKBETAG('C', 'P', 'L', 'Z')
#define VPTZ_TAG MKBETAG('V', 'P', 'T', 'Z')
#define VQA_DEBUG 0
#if VQA_DEBUG
#define vqa_debug printf
#else
static
inline
void
vqa_debug
(
const
char
*
format
,
...)
{
}
#endif
typedef
struct
VqaContext
{
AVCodecContext
*
avctx
;
...
...
@@ -212,7 +204,7 @@ static void decode_format80(const unsigned char *src, int src_size,
while
(
src_index
<
src_size
)
{
vqa_debug
(
" opcode %02X: "
,
src
[
src_index
]);
av_dlog
(
NULL
,
" opcode %02X: "
,
src
[
src_index
]);
/* 0x80 means that frame is finished */
if
(
src
[
src_index
]
==
0x80
)
...
...
@@ -231,7 +223,7 @@ static void decode_format80(const unsigned char *src, int src_size,
src_index
+=
2
;
src_pos
=
AV_RL16
(
&
src
[
src_index
]);
src_index
+=
2
;
vqa_debug
(
"(1) copy %X bytes from absolute pos %X
\n
"
,
count
,
src_pos
);
av_dlog
(
NULL
,
"(1) copy %X bytes from absolute pos %X
\n
"
,
count
,
src_pos
);
CHECK_COUNT
();
for
(
i
=
0
;
i
<
count
;
i
++
)
dest
[
dest_index
+
i
]
=
dest
[
src_pos
+
i
];
...
...
@@ -243,7 +235,7 @@ static void decode_format80(const unsigned char *src, int src_size,
count
=
AV_RL16
(
&
src
[
src_index
]);
src_index
+=
2
;
color
=
src
[
src_index
++
];
vqa_debug
(
"(2) set %X bytes to %02X
\n
"
,
count
,
color
);
av_dlog
(
NULL
,
"(2) set %X bytes to %02X
\n
"
,
count
,
color
);
CHECK_COUNT
();
memset
(
&
dest
[
dest_index
],
color
,
count
);
dest_index
+=
count
;
...
...
@@ -253,7 +245,7 @@ static void decode_format80(const unsigned char *src, int src_size,
count
=
(
src
[
src_index
++
]
&
0x3F
)
+
3
;
src_pos
=
AV_RL16
(
&
src
[
src_index
]);
src_index
+=
2
;
vqa_debug
(
"(3) copy %X bytes from absolute pos %X
\n
"
,
count
,
src_pos
);
av_dlog
(
NULL
,
"(3) copy %X bytes from absolute pos %X
\n
"
,
count
,
src_pos
);
CHECK_COUNT
();
for
(
i
=
0
;
i
<
count
;
i
++
)
dest
[
dest_index
+
i
]
=
dest
[
src_pos
+
i
];
...
...
@@ -262,7 +254,7 @@ static void decode_format80(const unsigned char *src, int src_size,
}
else
if
(
src
[
src_index
]
>
0x80
)
{
count
=
src
[
src_index
++
]
&
0x3F
;
vqa_debug
(
"(4) copy %X bytes from source to dest
\n
"
,
count
);
av_dlog
(
NULL
,
"(4) copy %X bytes from source to dest
\n
"
,
count
);
CHECK_COUNT
();
memcpy
(
&
dest
[
dest_index
],
&
src
[
src_index
],
count
);
src_index
+=
count
;
...
...
@@ -273,7 +265,7 @@ static void decode_format80(const unsigned char *src, int src_size,
count
=
((
src
[
src_index
]
&
0x70
)
>>
4
)
+
3
;
src_pos
=
AV_RB16
(
&
src
[
src_index
])
&
0x0FFF
;
src_index
+=
2
;
vqa_debug
(
"(5) copy %X bytes from relpos %X
\n
"
,
count
,
src_pos
);
av_dlog
(
NULL
,
"(5) copy %X bytes from relpos %X
\n
"
,
count
,
src_pos
);
CHECK_COUNT
();
for
(
i
=
0
;
i
<
count
;
i
++
)
dest
[
dest_index
+
i
]
=
dest
[
dest_index
-
src_pos
+
i
];
...
...
libavformat/ipmovie.c
View file @
df96f22d
...
...
@@ -35,17 +35,6 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
/* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
* verbose information about the demux process */
#define DEBUG_IPMOVIE 0
#if DEBUG_IPMOVIE
#undef printf
#define debug_ipmovie printf
#else
static
inline
void
debug_ipmovie
(
const
char
*
format
,
...)
{
}
#endif
#define CHUNK_PREAMBLE_SIZE 4
#define OPCODE_PREAMBLE_SIZE 4
...
...
@@ -150,8 +139,8 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
s
->
audio_frame_count
+=
(
s
->
audio_chunk_size
-
6
)
/
s
->
audio_channels
;
debug_ipmovie
(
"sending audio frame with pts %"
PRId64
" (%d audio frames)
\n
"
,
pkt
->
pts
,
s
->
audio_frame_count
);
av_dlog
(
NULL
,
"sending audio frame with pts %"
PRId64
" (%d audio frames)
\n
"
,
pkt
->
pts
,
s
->
audio_frame_count
);
chunk_type
=
CHUNK_VIDEO
;
...
...
@@ -195,8 +184,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
pkt
->
stream_index
=
s
->
video_stream_index
;
pkt
->
pts
=
s
->
video_pts
;
debug_ipmovie
(
"sending video frame with pts %"
PRId64
"
\n
"
,
pkt
->
pts
);
av_dlog
(
NULL
,
"sending video frame with pts %"
PRId64
"
\n
"
,
pkt
->
pts
);
s
->
video_pts
+=
s
->
frame_pts_inc
;
...
...
@@ -244,36 +232,36 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
chunk_size
=
AV_RL16
(
&
chunk_preamble
[
0
]);
chunk_type
=
AV_RL16
(
&
chunk_preamble
[
2
]);
debug_ipmovie
(
"chunk type 0x%04X, 0x%04X bytes: "
,
chunk_type
,
chunk_size
);
av_dlog
(
NULL
,
"chunk type 0x%04X, 0x%04X bytes: "
,
chunk_type
,
chunk_size
);
switch
(
chunk_type
)
{
case
CHUNK_INIT_AUDIO
:
debug_ipmovie
(
"initialize audio
\n
"
);
av_dlog
(
NULL
,
"initialize audio
\n
"
);
break
;
case
CHUNK_AUDIO_ONLY
:
debug_ipmovie
(
"audio only
\n
"
);
av_dlog
(
NULL
,
"audio only
\n
"
);
break
;
case
CHUNK_INIT_VIDEO
:
debug_ipmovie
(
"initialize video
\n
"
);
av_dlog
(
NULL
,
"initialize video
\n
"
);
break
;
case
CHUNK_VIDEO
:
debug_ipmovie
(
"video (and audio)
\n
"
);
av_dlog
(
NULL
,
"video (and audio)
\n
"
);
break
;
case
CHUNK_SHUTDOWN
:
debug_ipmovie
(
"shutdown
\n
"
);
av_dlog
(
NULL
,
"shutdown
\n
"
);
break
;
case
CHUNK_END
:
debug_ipmovie
(
"end
\n
"
);
av_dlog
(
NULL
,
"end
\n
"
);
break
;
default:
debug_ipmovie
(
"invalid chunk
\n
"
);
av_dlog
(
NULL
,
"invalid chunk
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
...
...
@@ -299,29 +287,29 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
chunk_size
-=
OPCODE_PREAMBLE_SIZE
;
chunk_size
-=
opcode_size
;
if
(
chunk_size
<
0
)
{
debug_ipmovie
(
"chunk_size countdown just went negative
\n
"
);
av_dlog
(
NULL
,
"chunk_size countdown just went negative
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
debug_ipmovie
(
" opcode type %02X, version %d, 0x%04X bytes: "
,
opcode_type
,
opcode_version
,
opcode_size
);
av_dlog
(
NULL
,
" opcode type %02X, version %d, 0x%04X bytes: "
,
opcode_type
,
opcode_version
,
opcode_size
);
switch
(
opcode_type
)
{
case
OPCODE_END_OF_STREAM
:
debug_ipmovie
(
"end of stream
\n
"
);
av_dlog
(
NULL
,
"end of stream
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_END_OF_CHUNK
:
debug_ipmovie
(
"end of chunk
\n
"
);
av_dlog
(
NULL
,
"end of chunk
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_CREATE_TIMER
:
debug_ipmovie
(
"create timer
\n
"
);
av_dlog
(
NULL
,
"create timer
\n
"
);
if
((
opcode_version
>
0
)
||
(
opcode_size
>
6
))
{
debug_ipmovie
(
"bad create_timer opcode
\n
"
);
av_dlog
(
NULL
,
"bad create_timer opcode
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
...
...
@@ -331,14 +319,15 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
}
s
->
frame_pts_inc
=
((
uint64_t
)
AV_RL32
(
&
scratch
[
0
]))
*
AV_RL16
(
&
scratch
[
4
]);
debug_ipmovie
(
" %.2f frames/second (timer div = %d, subdiv = %d)
\n
"
,
1000000
.
0
/
s
->
frame_pts_inc
,
AV_RL32
(
&
scratch
[
0
]),
AV_RL16
(
&
scratch
[
4
]));
av_dlog
(
NULL
,
" %.2f frames/second (timer div = %d, subdiv = %d)
\n
"
,
1000000
.
0
/
s
->
frame_pts_inc
,
AV_RL32
(
&
scratch
[
0
]),
AV_RL16
(
&
scratch
[
4
]));
break
;
case
OPCODE_INIT_AUDIO_BUFFERS
:
debug_ipmovie
(
"initialize audio buffers
\n
"
);
av_dlog
(
NULL
,
"initialize audio buffers
\n
"
);
if
((
opcode_version
>
1
)
||
(
opcode_size
>
10
))
{
debug_ipmovie
(
"bad init_audio_buffers opcode
\n
"
);
av_dlog
(
NULL
,
"bad init_audio_buffers opcode
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
...
...
@@ -360,23 +349,22 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
s
->
audio_type
=
CODEC_ID_PCM_S16LE
;
else
s
->
audio_type
=
CODEC_ID_PCM_U8
;
debug_ipmovie
(
"audio: %d bits, %d Hz, %s, %s format
\n
"
,
s
->
audio_bits
,
s
->
audio_sample_rate
,
(
s
->
audio_channels
==
2
)
?
"stereo"
:
"mono"
,
(
s
->
audio_type
==
CODEC_ID_INTERPLAY_DPCM
)
?
"Interplay audio"
:
"PCM"
);
av_dlog
(
NULL
,
"audio: %d bits, %d Hz, %s, %s format
\n
"
,
s
->
audio_bits
,
s
->
audio_sample_rate
,
(
s
->
audio_channels
==
2
)
?
"stereo"
:
"mono"
,
(
s
->
audio_type
==
CODEC_ID_INTERPLAY_DPCM
)
?
"Interplay audio"
:
"PCM"
);
break
;
case
OPCODE_START_STOP_AUDIO
:
debug_ipmovie
(
"start/stop audio
\n
"
);
av_dlog
(
NULL
,
"start/stop audio
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_INIT_VIDEO_BUFFERS
:
debug_ipmovie
(
"initialize video buffers
\n
"
);
av_dlog
(
NULL
,
"initialize video buffers
\n
"
);
if
((
opcode_version
>
2
)
||
(
opcode_size
>
8
))
{
debug_ipmovie
(
"bad init_video_buffers opcode
\n
"
);
av_dlog
(
NULL
,
"bad init_video_buffers opcode
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
...
...
@@ -392,8 +380,8 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
}
else
{
s
->
video_bpp
=
16
;
}
debug_ipmovie
(
"video resolution: %d x %d
\n
"
,
s
->
video_width
,
s
->
video_height
);
av_dlog
(
NULL
,
"video resolution: %d x %d
\n
"
,
s
->
video_width
,
s
->
video_height
);
break
;
case
OPCODE_UNKNOWN_06
:
...
...
@@ -403,17 +391,17 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
case
OPCODE_UNKNOWN_13
:
case
OPCODE_UNKNOWN_14
:
case
OPCODE_UNKNOWN_15
:
debug_ipmovie
(
"unknown (but documented) opcode %02X
\n
"
,
opcode_type
);
av_dlog
(
NULL
,
"unknown (but documented) opcode %02X
\n
"
,
opcode_type
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_SEND_BUFFER
:
debug_ipmovie
(
"send buffer
\n
"
);
av_dlog
(
NULL
,
"send buffer
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_AUDIO_FRAME
:
debug_ipmovie
(
"audio frame
\n
"
);
av_dlog
(
NULL
,
"audio frame
\n
"
);
/* log position and move on for now */
s
->
audio_chunk_offset
=
avio_tell
(
pb
);
...
...
@@ -422,26 +410,26 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
case
OPCODE_SILENCE_FRAME
:
debug_ipmovie
(
"silence frame
\n
"
);
av_dlog
(
NULL
,
"silence frame
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_INIT_VIDEO_MODE
:
debug_ipmovie
(
"initialize video mode
\n
"
);
av_dlog
(
NULL
,
"initialize video mode
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_CREATE_GRADIENT
:
debug_ipmovie
(
"create gradient
\n
"
);
av_dlog
(
NULL
,
"create gradient
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_SET_PALETTE
:
debug_ipmovie
(
"set palette
\n
"
);
av_dlog
(
NULL
,
"set palette
\n
"
);
/* check for the logical maximum palette size
* (3 * 256 + 4 bytes) */
if
(
opcode_size
>
0x304
)
{
debug_ipmovie
(
"demux_ipmovie: set_palette opcode too large
\n
"
);
av_dlog
(
NULL
,
"demux_ipmovie: set_palette opcode too large
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
}
...
...
@@ -455,7 +443,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
last_color
=
first_color
+
AV_RL16
(
&
scratch
[
2
])
-
1
;
/* sanity check (since they are 16 bit values) */
if
((
first_color
>
0xFF
)
||
(
last_color
>
0xFF
))
{
debug_ipmovie
(
"demux_ipmovie: set_palette indexes out of range (%d -> %d)
\n
"
,
av_dlog
(
NULL
,
"demux_ipmovie: set_palette indexes out of range (%d -> %d)
\n
"
,
first_color
,
last_color
);
chunk_type
=
CHUNK_BAD
;
break
;
...
...
@@ -473,12 +461,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
case
OPCODE_SET_PALETTE_COMPRESSED
:
debug_ipmovie
(
"set palette compressed
\n
"
);
av_dlog
(
NULL
,
"set palette compressed
\n
"
);
avio_skip
(
pb
,
opcode_size
);
break
;
case
OPCODE_SET_DECODING_MAP
:
debug_ipmovie
(
"set decoding map
\n
"
);
av_dlog
(
NULL
,
"set decoding map
\n
"
);
/* log position and move on for now */
s
->
decode_map_chunk_offset
=
avio_tell
(
pb
);
...
...
@@ -487,7 +475,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
case
OPCODE_VIDEO_DATA
:
debug_ipmovie
(
"set video data
\n
"
);
av_dlog
(
NULL
,
"set video data
\n
"
);
/* log position and move on for now */
s
->
video_chunk_offset
=
avio_tell
(
pb
);
...
...
@@ -496,7 +484,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
break
;
default:
debug_ipmovie
(
"*** unknown opcode type
\n
"
);
av_dlog
(
NULL
,
"*** unknown opcode type
\n
"
);
chunk_type
=
CHUNK_BAD
;
break
;
...
...
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