summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index e459368c22..be003f3b66 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -274,17 +274,17 @@ static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){
r= s->avctx->get_buffer(s->avctx, (AVFrame*)pic);
if(r<0 || !pic->age || !pic->type || !pic->data[0]){
- fprintf(stderr, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);
+ av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);
return -1;
}
if(s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])){
- fprintf(stderr, "get_buffer() failed (stride changed)\n");
+ av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (stride changed)\n");
return -1;
}
if(pic->linesize[1] != pic->linesize[2]){
- fprintf(stderr, "get_buffer() failed (uv stride missmatch)\n");
+ av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride missmatch)\n");
return -1;
}
@@ -625,7 +625,7 @@ int MPV_encode_init(AVCodecContext *avctx)
s->width = avctx->width;
s->height = avctx->height;
if(avctx->gop_size > 600){
- fprintf(stderr, "Warning keyframe interval too large! reducing it ...\n");
+ av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n");
avctx->gop_size=600;
}
s->gop_size = avctx->gop_size;
@@ -670,32 +670,32 @@ int MPV_encode_init(AVCodecContext *avctx)
s->progressive_sequence= !(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4){
- fprintf(stderr, "4MV not supporetd by codec\n");
+ av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n");
return -1;
}
if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){
- fprintf(stderr, "qpel not supporetd by codec\n");
+ av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n");
return -1;
}
if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){
- fprintf(stderr, "data partitioning not supporetd by codec\n");
+ av_log(avctx, AV_LOG_ERROR, "data partitioning not supported by codec\n");
return -1;
}
if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){
- fprintf(stderr, "b frames not supporetd by codec\n");
+ av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n");
return -1;
}
if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ //FIXME mpeg2 uses that too
- fprintf(stderr, "mpeg2 style quantization not supporetd by codec\n");
+ av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supporetd by codec\n");
return -1;
}
if((s->flags & CODEC_FLAG_CBP_RD) && !(s->flags & CODEC_FLAG_TRELLIS_QUANT)){
- fprintf(stderr, "CBP RD needs trellis quant\n");
+ av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n");
return -1;
}
@@ -753,7 +753,7 @@ int MPV_encode_init(AVCodecContext *avctx)
#ifdef CONFIG_RISKY
case CODEC_ID_H263:
if (h263_get_picture_format(s->width, s->height) == 7) {
- printf("Input picture size isn't suitable for h263 codec! try h263+\n");
+ av_log(avctx, AV_LOG_INFO, "Input picture size isn't suitable for h263 codec! try h263+\n");
return -1;
}
s->out_format = FMT_H263;
@@ -1078,7 +1078,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
if(!s->encoding){
for(i=0; i<MAX_PICTURE_COUNT; i++){
if(s->picture[i].data[0] && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference){
- fprintf(stderr, "releasing zombie picture\n");
+ av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n");
avctx->release_buffer(avctx, (AVFrame*)&s->picture[i]);
}
}
@@ -1128,7 +1128,7 @@ alloc:
if(s->next_picture_ptr) copy_picture(&s->next_picture, s->next_picture_ptr);
if(s->pict_type != I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL)){
- fprintf(stderr, "warning: first frame is no keyframe\n");
+ av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference
goto alloc;
}
@@ -1315,63 +1315,63 @@ void ff_print_debug_info(MpegEncContext *s, Picture *pict){
if(s->avctx->debug&FF_DEBUG_SKIP){
int count= s->mbskip_table[x + y*s->mb_stride];
if(count>9) count=9;
- printf("%1d", count);
+ av_log(s->avctx, AV_LOG_DEBUG, "%1d", count);
}
if(s->avctx->debug&FF_DEBUG_QP){
- printf("%2d", pict->qscale_table[x + y*s->mb_stride]);
+ av_log(s->avctx, AV_LOG_DEBUG, "%2d", pict->qscale_table[x + y*s->mb_stride]);
}
if(s->avctx->debug&FF_DEBUG_MB_TYPE){
int mb_type= pict->mb_type[x + y*s->mb_stride];
//Type & MV direction
if(IS_PCM(mb_type))
- printf("P");
+ av_log(s->avctx, AV_LOG_DEBUG, "P");
else if(IS_INTRA(mb_type) && IS_ACPRED(mb_type))
- printf("A");
+ av_log(s->avctx, AV_LOG_DEBUG, "A");
else if(IS_INTRA4x4(mb_type))
- printf("i");
+ av_log(s->avctx, AV_LOG_DEBUG, "i");
else if(IS_INTRA16x16(mb_type))
- printf("I");
+ av_log(s->avctx, AV_LOG_DEBUG, "I");
else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type))
- printf("d");
+ av_log(s->avctx, AV_LOG_DEBUG, "d");
else if(IS_DIRECT(mb_type))
- printf("D");
+ av_log(s->avctx, AV_LOG_DEBUG, "D");
else if(IS_GMC(mb_type) && IS_SKIP(mb_type))
- printf("g");
+ av_log(s->avctx, AV_LOG_DEBUG, "g");
else if(IS_GMC(mb_type))
- printf("G");
+ av_log(s->avctx, AV_LOG_DEBUG, "G");
else if(IS_SKIP(mb_type))
- printf("S");
+ av_log(s->avctx, AV_LOG_DEBUG, "S");
else if(!USES_LIST(mb_type, 1))
- printf(">");
+ av_log(s->avctx, AV_LOG_DEBUG, ">");
else if(!USES_LIST(mb_type, 0))
- printf("<");
+ av_log(s->avctx, AV_LOG_DEBUG, "<");
else{
assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
- printf("X");
+ av_log(s->avctx, AV_LOG_DEBUG, "X");
}
//segmentation
if(IS_8X8(mb_type))
- printf("+");
+ av_log(s->avctx, AV_LOG_DEBUG, "+");
else if(IS_16X8(mb_type))
- printf("-");
+ av_log(s->avctx, AV_LOG_DEBUG, "-");
else if(IS_8X16(mb_type))
- printf("¦");
+ av_log(s->avctx, AV_LOG_DEBUG, "¦");
else if(IS_INTRA(mb_type) || IS_16X16(mb_type))
- printf(" ");
+ av_log(s->avctx, AV_LOG_DEBUG, " ");
else
- printf("?");
+ av_log(s->avctx, AV_LOG_DEBUG, "?");
if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264)
- printf("=");
+ av_log(s->avctx, AV_LOG_DEBUG, "=");
else
- printf(" ");
+ av_log(s->avctx, AV_LOG_DEBUG, " ");
}
-// printf(" ");
+// av_log(s->avctx, AV_LOG_DEBUG, " ");
}
- printf("\n");
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
}
}
@@ -1457,7 +1457,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){
if(pic_arg->linesize[1] != s->uvlinesize) direct=0;
if(pic_arg->linesize[2] != s->uvlinesize) direct=0;
-// printf("%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize);
+// av_log(AV_LOG_DEBUG, "%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize);
if(direct){
i= ff_find_unused_picture(s, 1);
@@ -1564,7 +1564,7 @@ static void select_input_picture(MpegEncContext *s){
}
if(b_frames > s->max_b_frames){
- fprintf(stderr, "warning, too many bframes in a row\n");
+ av_log(s->avctx, AV_LOG_ERROR, "warning, too many bframes in a row\n");
b_frames = s->max_b_frames;
}
}else if(s->b_frame_strategy==0){
@@ -1589,14 +1589,14 @@ static void select_input_picture(MpegEncContext *s){
s->input_picture[i]->b_frame_score=0;
}
}else{
- fprintf(stderr, "illegal b frame strategy\n");
+ av_log(s->avctx, AV_LOG_ERROR, "illegal b frame strategy\n");
b_frames=0;
}
emms_c();
//static int b_count=0;
//b_count+= b_frames;
-//printf("b_frames: %d\n", b_count);
+//av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count);
s->reordered_input_picture[0]= s->input_picture[b_frames];
if( s->picture_in_gop_number + b_frames >= s->gop_size
@@ -1668,7 +1668,7 @@ int MPV_encode_picture(AVCodecContext *avctx,
int i;
if(avctx->pix_fmt != PIX_FMT_YUV420P){
- fprintf(stderr, "this codec supports only YUV420P\n");
+ av_log(avctx, AV_LOG_ERROR, "this codec supports only YUV420P\n");
return -1;
}
@@ -4002,7 +4002,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
break;
default:
motion_x=motion_y=0; //gcc warning fix
- printf("illegal MB type\n");
+ av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n");
}
encode_mb(s, motion_x, motion_y);