You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
conversion to av_log
Originally committed as revision 2975 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@ -36,9 +36,6 @@
|
|||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
|
|
||||||
#define printf(...) {} //(f)printf() usage is forbidden in libavcodec, use av_log
|
|
||||||
#define fprintf(...) {}
|
|
||||||
|
|
||||||
#define CPAIR 2
|
#define CPAIR 2
|
||||||
#define CQUAD 4
|
#define CQUAD 4
|
||||||
#define COCTET 8
|
#define COCTET 8
|
||||||
@ -75,7 +72,7 @@ typedef struct SmcContext {
|
|||||||
total_blocks--; \
|
total_blocks--; \
|
||||||
if (total_blocks < 0) \
|
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; \
|
return; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -124,7 +121,7 @@ static void smc_decode_stream(SmcContext *s)
|
|||||||
chunk_size = BE_32(&s->buf[stream_ptr]) & 0x00FFFFFF;
|
chunk_size = BE_32(&s->buf[stream_ptr]) & 0x00FFFFFF;
|
||||||
stream_ptr += 4;
|
stream_ptr += 4;
|
||||||
if (chunk_size != s->size)
|
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);
|
||||||
|
|
||||||
chunk_size = s->size;
|
chunk_size = s->size;
|
||||||
@ -135,13 +132,13 @@ static void smc_decode_stream(SmcContext *s)
|
|||||||
/* sanity checks */
|
/* sanity checks */
|
||||||
/* make sure stream ptr hasn't gone out of bounds */
|
/* make sure stream ptr hasn't gone out of bounds */
|
||||||
if (stream_ptr > chunk_size) {
|
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);
|
stream_ptr, chunk_size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* make sure the row pointer hasn't gone wild */
|
/* make sure the row pointer hasn't gone wild */
|
||||||
if (row_ptr >= image_size) {
|
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);
|
row_ptr, image_size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -164,7 +161,7 @@ static void smc_decode_stream(SmcContext *s)
|
|||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if ((row_ptr == 0) && (pixel_ptr == 0)) {
|
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);
|
opcode & 0xF0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -198,7 +195,7 @@ static void smc_decode_stream(SmcContext *s)
|
|||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if ((row_ptr == 0) && (pixel_ptr < 2 * 4)) {
|
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);
|
opcode & 0xF0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -425,7 +422,7 @@ static void smc_decode_stream(SmcContext *s)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xF0:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -462,7 +459,7 @@ static int smc_decode_frame(AVCodecContext *avctx,
|
|||||||
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
|
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
|
||||||
FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
|
FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
|
||||||
if (avctx->reget_buffer(avctx, &s->frame)) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +36,6 @@
|
|||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
|
|
||||||
#define printf(...) {} //(f)printf() usage is forbidden in libavcodec, use av_log
|
|
||||||
#define fprintf(...) {}
|
|
||||||
|
|
||||||
#include "truemotion1data.h"
|
#include "truemotion1data.h"
|
||||||
|
|
||||||
typedef struct TrueMotion1Context {
|
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;
|
header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f;
|
||||||
if (s->buf[0] < 0x10)
|
if (s->buf[0] < 0x10)
|
||||||
{
|
{
|
||||||
printf("invalid header size\n");
|
av_log(s->avctx, AV_LOG_ERROR, "invalid header size\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +279,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (header.compression > 17) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +293,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
|
|||||||
if (header.vectable < 4)
|
if (header.vectable < 4)
|
||||||
sel_vector_table = tables[header.vectable - 1];
|
sel_vector_table = tables[header.vectable - 1];
|
||||||
else {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -305,7 +302,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
|
|||||||
{
|
{
|
||||||
if (compression_types[header.compression].algorithm == ALGO_RGB24H)
|
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
|
else
|
||||||
gen_vector_table(s, sel_vector_table);
|
gen_vector_table(s, sel_vector_table);
|
||||||
@ -354,7 +351,7 @@ static int truemotion1_decode_init(AVCodecContext *avctx)
|
|||||||
#define GET_NEXT_INDEX() \
|
#define GET_NEXT_INDEX() \
|
||||||
{\
|
{\
|
||||||
if (index_stream_index >= s->index_stream_size) { \
|
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; \
|
return; \
|
||||||
} \
|
} \
|
||||||
index = s->index_stream[index_stream_index++] * 4; \
|
index = s->index_stream[index_stream_index++] * 4; \
|
||||||
@ -542,7 +539,7 @@ static int truemotion1_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
s->frame.reference = 1;
|
s->frame.reference = 1;
|
||||||
if (avctx->get_buffer(avctx, &s->frame) < 0) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +558,7 @@ static int truemotion1_decode_frame(AVCodecContext *avctx,
|
|||||||
memcpy(s->frame.data[0], s->prev_frame.data[0],
|
memcpy(s->frame.data[0], s->prev_frame.data[0],
|
||||||
s->frame.linesize[0] * s->avctx->height);
|
s->frame.linesize[0] * s->avctx->height);
|
||||||
} else if (compression_types[s->compression].algorithm == ALGO_RGB24H) {
|
} 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 {
|
} else {
|
||||||
truemotion1_decode_16bit(s);
|
truemotion1_decode_16bit(s);
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,6 @@
|
|||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
|
|
||||||
#define printf(...) {} //(f)printf() usage is forbidden in libavcodec, use av_log
|
|
||||||
#define fprintf(...) {}
|
|
||||||
|
|
||||||
#define VMD_HEADER_SIZE 0x330
|
#define VMD_HEADER_SIZE 0x330
|
||||||
#define PALETTE_COUNT 256
|
#define PALETTE_COUNT 256
|
||||||
|
|
||||||
@ -245,7 +242,7 @@ static void vmd_decode(VmdVideoContext *s)
|
|||||||
}
|
}
|
||||||
} while (ofs < frame_width);
|
} while (ofs < frame_width);
|
||||||
if (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);
|
ofs, frame_width);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -283,7 +280,7 @@ static void vmd_decode(VmdVideoContext *s)
|
|||||||
}
|
}
|
||||||
} while (ofs < frame_width);
|
} while (ofs < frame_width);
|
||||||
if (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);
|
ofs, frame_width);
|
||||||
}
|
}
|
||||||
dp += s->frame.linesize[0];
|
dp += s->frame.linesize[0];
|
||||||
@ -311,7 +308,7 @@ static int vmdvideo_decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
/* make sure the VMD header made it */
|
/* make sure the VMD header made it */
|
||||||
if (s->avctx->extradata_size != VMD_HEADER_SIZE) {
|
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);
|
VMD_HEADER_SIZE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -350,7 +347,7 @@ static int vmdvideo_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
s->frame.reference = 1;
|
s->frame.reference = 1;
|
||||||
if (avctx->get_buffer(avctx, &s->frame)) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,6 +386,7 @@ static int vmdvideo_decode_end(AVCodecContext *avctx)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct VmdAudioContext {
|
typedef struct VmdAudioContext {
|
||||||
|
AVCodecContext *avctx;
|
||||||
int channels;
|
int channels;
|
||||||
int bits;
|
int bits;
|
||||||
int block_align;
|
int block_align;
|
||||||
@ -403,12 +401,13 @@ static int vmdaudio_decode_init(AVCodecContext *avctx)
|
|||||||
VmdAudioContext *s = (VmdAudioContext *)avctx->priv_data;
|
VmdAudioContext *s = (VmdAudioContext *)avctx->priv_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
s->avctx = avctx;
|
||||||
s->channels = avctx->channels;
|
s->channels = avctx->channels;
|
||||||
s->bits = avctx->bits_per_sample;
|
s->bits = avctx->bits_per_sample;
|
||||||
s->block_align = avctx->block_align;
|
s->block_align = avctx->block_align;
|
||||||
|
|
||||||
printf (" %d channels, %d bits/sample, block align = %d, sample rate = %d\n",
|
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);
|
s->channels, s->bits, s->block_align, avctx->sample_rate);
|
||||||
|
|
||||||
/* set up the steps8 and steps16 tables */
|
/* set up the steps8 and steps16 tables */
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
@ -465,8 +464,8 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
|
|||||||
int bytes_decoded = 0;
|
int bytes_decoded = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (silence)
|
if (silence)
|
||||||
printf (" silent block!\n");
|
av_log(s->avctx, AV_LOG_INFO, "silent block!\n");
|
||||||
if (s->channels == 2) {
|
if (s->channels == 2) {
|
||||||
|
|
||||||
/* stereo handling */
|
/* stereo handling */
|
||||||
@ -520,7 +519,6 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
|
|||||||
unsigned char *p = buf + 16;
|
unsigned char *p = buf + 16;
|
||||||
unsigned char *p_end = buf + buf_size;
|
unsigned char *p_end = buf + buf_size;
|
||||||
|
|
||||||
printf (" processing audio frame with %d bytes\n", buf_size);
|
|
||||||
if (buf_size < 16)
|
if (buf_size < 16)
|
||||||
return buf_size;
|
return buf_size;
|
||||||
|
|
||||||
@ -529,7 +527,6 @@ printf (" processing audio frame with %d bytes\n", buf_size);
|
|||||||
/* the chunk contains audio */
|
/* the chunk contains audio */
|
||||||
*data_size = vmdaudio_loadsound(s, output_samples, p, 0);
|
*data_size = vmdaudio_loadsound(s, output_samples, p, 0);
|
||||||
} else if (buf[6] == 2) {
|
} else if (buf[6] == 2) {
|
||||||
printf (" hey! audio case #2\n");
|
|
||||||
/* the chunk contains audio and silence mixed together */
|
/* the chunk contains audio and silence mixed together */
|
||||||
sound_flags = LE_32(p);
|
sound_flags = LE_32(p);
|
||||||
p += 4;
|
p += 4;
|
||||||
@ -549,13 +546,10 @@ printf (" hey! audio case #2\n");
|
|||||||
sound_flags >>= 1;
|
sound_flags >>= 1;
|
||||||
}
|
}
|
||||||
} else if (buf[6] == 3) {
|
} else if (buf[6] == 3) {
|
||||||
printf (" hey! audio case #3\n");
|
|
||||||
/* silent chunk */
|
/* silent chunk */
|
||||||
*data_size = vmdaudio_loadsound(s, output_samples, p, 1);
|
*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;
|
return buf_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user