我希望在 mpegvideo.c 文件之外调用 void ff_print_debug_info2(...)
。例如,我想在以下代码片段中调用此函数:
static int decode_packet(int *got_frame, int cached)
{
int ret = 0;
int decoded = pkt.size;
*got_frame = 0;
if (pkt.stream_index == video_stream_idx) {
/* decode video frame */
ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt);
if (ret < 0) {
fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret));
return ret;
}
if (*got_frame) {
/*here I want to print debug info*/
//void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_table, uint32_t *mbtype_table, int8_t *qscale_table, int16_t (*motion_val[2])[2], int *low_delay, int mb_width, int mb_height, int mb_stride, int quarter_sample)
}
}
return decoded;
}
我想知道这是否可能,我该如何将参数传递给 void ff_print_debug_info2(...)
?
ps:我已经知道的参数:
1.AVCodecContext *avctx
: video_dec_ctx
2.AVFrame *pict
: frame
3.int8_t *qscale_table
:frame->qscale_table
。
其他人呢?
最佳答案
这个函数已经是called H264解码器为您服务。它不受任何其他解码器的支持,会导致崩溃。您永远不需要手动调用它。如果您在 H264 帧解码后没有看到帧上打印任何调试信息,请尝试使用:
avctx->debug |= FF_DEBUG_VIS_QP |
FF_DEBUG_VIS_MB_TYPE |
FF_DEBUG_SKIP |
FF_DEBUG_QP |
FF_DEBUG_MB_TYPE;
avctx->debug_mv = FF_DEBUG_VIS_MV_P_FOR |
FF_DEBUG_VIS_MV_B_FOR |
FF_DEBUG_VIS_MV_B_BACK;
在(感谢更正!)您调用 avcodec_open2()
之后。之后,您应该会在框架 (*_VIS_*
) 或终端(其他)上看到相应的调试信息。
MPEG-1/2/4 解码器也支持这些标志,尽管它们是通过不同的函数 (ff_print_debug_info()
) 实现的。
关于在 mpegvideo.c 文件之外调用 ff_print_debug_info2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37456961/