diff options
Diffstat (limited to 'ext/ffmpeg/gstffmpegdec.c')
-rw-r--r-- | ext/ffmpeg/gstffmpegdec.c | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 6f759ab..b4a35bb 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -146,7 +146,7 @@ struct _GstFFMpegDec gboolean can_allocate_aligned; /* Extra info which can determine codec Context on the Host side(QEMU) */ - CodecExtraInfo codecInfo; + CodecInfo codecInfo; }; typedef struct _GstFFMpegDecClass GstFFMpegDecClass; @@ -441,20 +441,6 @@ gst_ffmpegdec_init (GstFFMpegDec * ffmpegdec) ffmpegdec->context = avcodec_alloc_context (); ffmpegdec->picture = avcodec_alloc_frame (); -#if 0 -#ifndef EMUL_CODEC - CODEC_LOG (2, "allocate context and frame for emul\n"); - emul_avcodec_alloc_context (&ffmpegdec->codecInfo); - CODEC_LOG (2, "Context Index:%d\n", ffmpegdec->codecInfo.contextIndex); - if (ffmpegdec->codecInfo.contextIndex < 0) { - CODEC_LOG (1, "index of codec context is %d\n", - ffmpegdec->codecInfo.contextIndex); - } - emul_avcodec_alloc_frame (&ffmpegdec->codecInfo); - CODEC_LOG (2, "after allocate context and frame\n"); -#endif -#endif - ffmpegdec->pctx = NULL; ffmpegdec->pcache = NULL; ffmpegdec->par = NULL; @@ -481,21 +467,21 @@ gst_ffmpegdec_finalize (GObject * object) { GstFFMpegDec *ffmpegdec = (GstFFMpegDec *) object; +#ifndef EMUL_CODEC + CODEC_LOG (2, "free AVCodecContext and AVFrame\n"); + emul_close_codec_device (ffmpegdec->context->codec_type, + &ffmpegdec->codecInfo); +#endif + if (ffmpegdec->context != NULL) { - CODEC_LOG (2, "free AVCodecContext\n"); av_free (ffmpegdec->context); ffmpegdec->context = NULL; } if (ffmpegdec->picture != NULL) { - CODEC_LOG (2, "free AVFrame\n"); av_free (ffmpegdec->picture); ffmpegdec->picture = NULL; } -#ifndef EMUL_CODEC - emul_av_free (&ffmpegdec->codecInfo); - emul_close_codec_device (&ffmpegdec->codecInfo); -#endif G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1824,9 +1810,10 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec, /* now decode the frame */ gst_avpacket_init (&packet, data, size); - CODEC_LOG (2, "before decode data:%p, size:%d\n", data, size); CODEC_LOG (2, "before decoding video, codec_type:%d codec_id:%d\n", ffmpegdec->context->codec_type, ffmpegdec->context->codec_id); + CODEC_LOG (2, "decode data:%p, size:%d\n", data, size); + #ifdef EMUL_CODEC len = avcodec_decode_video2 (ffmpegdec->context, ffmpegdec->picture, &have_data, &packet); @@ -1834,12 +1821,7 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec, len = emul_avcodec_decode_video (ffmpegdec->context, ffmpegdec->picture, &have_data, &packet, &ffmpegdec->codecInfo); #endif - if (len == 0 || len < 0) { - CODEC_LOG (2, "after decoding video. idx:%ld, len:%d\n", dec_info->idx, - len); - } else { - CODEC_LOG (2, "after decode len : %d, input data:%p\n", len, data); - } + CODEC_LOG (2, "after decoding video. len:%d\n", len); /* restore previous state */ if (!decode) @@ -2229,6 +2211,7 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec, gst_avpacket_init (&packet, data, size); CODEC_LOG (2, "before avcodec_decode_audio. size:%d\n", size); + #ifdef EMUL_CODEC len = avcodec_decode_audio3 (ffmpegdec->context, (int16_t *) GST_BUFFER_DATA (*outbuf), &have_data, &packet); @@ -2237,6 +2220,7 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec, (int16_t *) GST_BUFFER_DATA (*outbuf), &have_data, &packet, &ffmpegdec->codecInfo); #endif + GST_DEBUG_OBJECT (ffmpegdec, "Decode audio: len=%d, have_data=%d", len, have_data); |