On date Saturday 2008-06-21 15:13:59 +0200, Stefano Falasca wrote:
> Thanks Stefano, for your suggest. I never used av_log then I looked around.
> I implemented the follow avlog callback, to log info into file.
>
> --------
> static void ffmpeg_avcodec_log(void *ptr, int val, const char * msg, va_list
> ap)
> {
> AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
>
> FILE *flog=fopen("MMedia.log","a");
> fprintf(flog, "[%s @ %p] ", avc->item_name(ptr), avc);
> vfprintf(flog, msg, ap);
> fclose(flog);
> }
> ---------
Yes, this is a way to define an av_log callback, anyway it isn't
strictly required since the default callback will print on stderr.
> And the new code is this:
>
> ---------
> int CFFDecode::Init(int codec_id, int width, int height, int fps)
> {
> if ((width & 1) == 1) return E_INVALIDARG;
> if ((height & 1) == 1) return E_INVALIDARG;
>
> av_log_set_callback( ffmpeg_avcodec_log );
>
> m_codec = avcodec_find_decoder((CodecID)codec_id);
> if (m_codec == NULL) {DbgOut("FFINIT OK");return E_FAIL;}
>
> m_c = avcodec_alloc_context();
> if (m_c == NULL)
> {DbgOut("avcodec_alloc_context error");return
> E_OUTOFMEMORY;}
>
> avcodec_get_context_defaults2(m_c, CODEC_TYPE_VIDEO);
> avcodec_get_frame_defaults(&m_picture);
>
> m_c->codec_id = (CodecID) codec_id;
> m_c->codec_type = CODEC_TYPE_VIDEO;
> m_c->strict_std_compliance = 0;
>
> m_c->width = width;
> m_c->height = height;
> m_c->time_base.den = fps;
> m_c->time_base.num = 1;
> m_c->gop_size = 12;
useless
> m_c->pix_fmt = PIX_FMT_BGR24;
useless
>
> /* open the codec */
> int iRetOpen = avcodec_open(m_c, m_codec);
> if ( iRetOpen < 0) {
> av_log(m_c, AV_LOG_DEBUG, "Fail avcodec_open\n");
> return E_FAIL;
>
> }
> --------------
>
> Into log file I've only this information!
>
> [NULL @ 68C432E0] Fail avcodec_open
>
> I can't undertand where is the problem
Since libavcodec logging doesn't help, then you need to debug the
code which fails, wmv3_decoder is defined in libavcodec/vc1.c and it
seems it fails in the vc1_decode_init() function.
Report back what youo discover and maybe we can improve the logging
regarded to your problem.
Regards.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user