Commit fd146758 authored by Alex Beregszaszi's avatar Alex Beregszaszi

conversion to av_log

Originally committed as revision 2975 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 6ce1a818
......@@ -36,9 +36,6 @@
#include "avcodec.h"
#include "dsputil.h"
#define printf(...) {} //(f)printf() usage is forbidden in libavcodec, use av_log
#define fprintf(...) {}
#define CPAIR 2
#define CQUAD 4
#define COCTET 8
......@@ -75,7 +72,7 @@ typedef struct SmcContext {
total_blocks--; \
if (total_blocks < 0) \
{ \
printf("warning: block counter just went negative (this should not happen)\n"); \
av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
return; \
} \
}
......@@ -124,7 +121,7 @@ static void smc_decode_stream(SmcContext *s)
chunk_size = BE_32(&s->buf[stream_ptr]) & 0x00FFFFFF;
stream_ptr += 4;
if (chunk_size != s->size)
printf("warning: MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n",
av_log(s->avctx, AV_LOG_INFO, "warning: MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n",
chunk_size, s->size);
chunk_size = s->size;
......@@ -135,13 +132,13 @@ static void smc_decode_stream(SmcContext *s)
/* sanity checks */
/* make sure stream ptr hasn't gone out of bounds */
if (stream_ptr > chunk_size) {
printf("SMC decoder just went out of bounds (stream ptr = %d, chunk size = %d)\n",
av_log(s->avctx, AV_LOG_INFO, "SMC decoder just went out of bounds (stream ptr = %d, chunk size = %d)\n",
stream_ptr, chunk_size);
return;
}
/* make sure the row pointer hasn't gone wild */
if (row_ptr >= image_size) {
printf("SMC decoder just went out of bounds (row ptr = %d, height = %d)\n",
av_log(s->avctx, AV_LOG_INFO, "SMC decoder just went out of bounds (row ptr = %d, height = %d)\n",
row_ptr, image_size);
return;
}
......@@ -164,7 +161,7 @@ static void smc_decode_stream(SmcContext *s)
/* sanity check */
if ((row_ptr == 0) && (pixel_ptr == 0)) {
printf("encountered repeat block opcode (%02X) but no blocks rendered yet\n",
av_log(s->avctx, AV_LOG_INFO, "encountered repeat block opcode (%02X) but no blocks rendered yet\n",
opcode & 0xF0);
break;
}
......@@ -198,7 +195,7 @@ static void smc_decode_stream(SmcContext *s)
/* sanity check */
if ((row_ptr == 0) && (pixel_ptr < 2 * 4)) {
printf("encountered repeat block opcode (%02X) but not enough blocks rendered yet\n",
av_log(s->avctx, AV_LOG_INFO, "encountered repeat block opcode (%02X) but not enough blocks rendered yet\n",
opcode & 0xF0);
break;
}
......@@ -425,7 +422,7 @@ static void smc_decode_stream(SmcContext *s)
break;
case 0xF0:
printf("0xF0 opcode seen in SMC chunk (xine developers would like to know)\n");
av_log(s->avctx, AV_LOG_INFO, "0xF0 opcode seen in SMC chunk (contact the developers)\n");
break;
}
}
......@@ -462,7 +459,7 @@ static int smc_decode_frame(AVCodecContext *avctx,
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
if (avctx->reget_buffer(avctx, &s->frame)) {
printf ("reget_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
......
......@@ -36,9 +36,6 @@
#include "avcodec.h"
#include "dsputil.h"
#define printf(...) {} //(f)printf() usage is forbidden in libavcodec, use av_log
#define fprintf(...) {}
#include "truemotion1data.h"
typedef struct TrueMotion1Context {
......@@ -232,7 +229,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f;
if (s->buf[0] < 0x10)
{
printf("invalid header size\n");
av_log(s->avctx, AV_LOG_ERROR, "invalid header size\n");
return -1;
}
......@@ -282,7 +279,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
}
if (header.compression > 17) {
printf("invalid compression type (%d)\n", header.compression);
av_log(s->avctx, AV_LOG_ERROR, "invalid compression type (%d)\n", header.compression);
return -1;
}
......@@ -296,7 +293,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
if (header.vectable < 4)
sel_vector_table = tables[header.vectable - 1];
else {
printf("invalid vector table id (%d)\n", header.vectable);
av_log(s->avctx, AV_LOG_ERROR, "invalid vector table id (%d)\n", header.vectable);
return -1;
}
}
......@@ -305,7 +302,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
{
if (compression_types[header.compression].algorithm == ALGO_RGB24H)
{
printf("24bit compression not yet supported\n");
av_log(s->avctx, AV_LOG_ERROR, "24bit compression not yet supported\n");
}
else
gen_vector_table(s, sel_vector_table);
......@@ -354,7 +351,7 @@ static int truemotion1_decode_init(AVCodecContext *avctx)
#define GET_NEXT_INDEX() \
{\
if (index_stream_index >= s->index_stream_size) { \
printf (" help! truemotion1 decoder went out of bounds\n"); \
av_log(s->avctx, AV_LOG_INFO, " help! truemotion1 decoder went out of bounds\n"); \
return; \
} \
index = s->index_stream[index_stream_index++] * 4; \
......@@ -542,7 +539,7 @@ static int truemotion1_decode_frame(AVCodecContext *avctx,
s->frame.reference = 1;
if (avctx->get_buffer(avctx, &s->frame) < 0) {
fprintf(stderr, "truemotion1: get_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, "truemotion1: get_buffer() failed\n");
return -1;
}
......@@ -561,7 +558,7 @@ static int truemotion1_decode_frame(AVCodecContext *avctx,
memcpy(s->frame.data[0], s->prev_frame.data[0],
s->frame.linesize[0] * s->avctx->height);
} else if (compression_types[s->compression].algorithm == ALGO_RGB24H) {
printf (" 24-bit Duck TrueMotion decoding not yet implemented\n");
av_log(s->avctx, AV_LOG_ERROR, "24bit compression not yet supported\n");
} else {
truemotion1_decode_16bit(s);
}
......
......@@ -47,9 +47,6 @@
#include "avcodec.h"
#include "dsputil.h"
#define printf(...) {} //(f)printf() usage is forbidden in libavcodec, use av_log
#define fprintf(...) {}
#define VMD_HEADER_SIZE 0x330
#define PALETTE_COUNT 256
......@@ -245,7 +242,7 @@ static void vmd_decode(VmdVideoContext *s)
}
} while (ofs < frame_width);
if (ofs > frame_width) {
printf (" VMD video: offset > width (%d > %d)\n",
av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
ofs, frame_width);
break;
}
......@@ -283,7 +280,7 @@ static void vmd_decode(VmdVideoContext *s)
}
} while (ofs < frame_width);
if (ofs > frame_width) {
printf (" VMD video: offset > width (%d > %d)\n",
av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
ofs, frame_width);
}
dp += s->frame.linesize[0];
......@@ -311,7 +308,7 @@ static int vmdvideo_decode_init(AVCodecContext *avctx)
/* make sure the VMD header made it */
if (s->avctx->extradata_size != VMD_HEADER_SIZE) {
printf(" VMD video: expected extradata size of %d\n",
av_log(s->avctx, AV_LOG_ERROR, "VMD video: expected extradata size of %d\n",
VMD_HEADER_SIZE);
return -1;
}
......@@ -350,7 +347,7 @@ static int vmdvideo_decode_frame(AVCodecContext *avctx,
s->frame.reference = 1;
if (avctx->get_buffer(avctx, &s->frame)) {
printf (" VMD Video: get_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, "VMD Video: get_buffer() failed\n");
return -1;
}
......@@ -389,6 +386,7 @@ static int vmdvideo_decode_end(AVCodecContext *avctx)
*/
typedef struct VmdAudioContext {
AVCodecContext *avctx;
int channels;
int bits;
int block_align;
......@@ -403,12 +401,13 @@ static int vmdaudio_decode_init(AVCodecContext *avctx)
VmdAudioContext *s = (VmdAudioContext *)avctx->priv_data;
int i;
s->avctx = avctx;
s->channels = avctx->channels;
s->bits = avctx->bits_per_sample;
s->block_align = avctx->block_align;
printf (" %d channels, %d bits/sample, block align = %d, sample rate = %d\n",
s->channels, s->bits, s->block_align, avctx->sample_rate);
av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n",
s->channels, s->bits, s->block_align, avctx->sample_rate);
/* set up the steps8 and steps16 tables */
for (i = 0; i < 8; i++) {
......@@ -465,8 +464,8 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
int bytes_decoded = 0;
int i;
if (silence)
printf (" silent block!\n");
if (silence)
av_log(s->avctx, AV_LOG_INFO, "silent block!\n");
if (s->channels == 2) {
/* stereo handling */
......@@ -520,7 +519,6 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
unsigned char *p = buf + 16;
unsigned char *p_end = buf + buf_size;
printf (" processing audio frame with %d bytes\n", buf_size);
if (buf_size < 16)
return buf_size;
......@@ -529,7 +527,6 @@ printf (" processing audio frame with %d bytes\n", buf_size);
/* the chunk contains audio */
*data_size = vmdaudio_loadsound(s, output_samples, p, 0);
} else if (buf[6] == 2) {
printf (" hey! audio case #2\n");
/* the chunk contains audio and silence mixed together */
sound_flags = LE_32(p);
p += 4;
......@@ -549,13 +546,10 @@ printf (" hey! audio case #2\n");
sound_flags >>= 1;
}
} else if (buf[6] == 3) {
printf (" hey! audio case #3\n");
/* silent chunk */
*data_size = vmdaudio_loadsound(s, output_samples, p, 1);
}
printf (" final sample count = %d, byte count = %d\n", (*data_size) / 2,
*data_size);
return buf_size;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment