int video_stop (dtvideo_context_t * vctx) { if (vctx->video_status > VIDEO_STATUS_INITED) { dtvideo_output_t *video_out = &vctx->video_out; video_output_stop (video_out); //dtvideo_filter_t *video_filter=&vctx->video_filt; //video_filter_stop(video_filter); dtvideo_decoder_t *video_decoder = &vctx->video_dec; video_decoder_stop (video_decoder); vctx->video_status = VIDEO_STATUS_STOPPED; } return 0; }
int video_init (dtvideo_context_t * vctx) { int ret = 0; dt_info (TAG, "[%s:%d] dtvideo_mgt start init\n", __FUNCTION__, __LINE__); //call init vctx->video_status = VIDEO_STATUS_INITING; vctx->current_pts = vctx->last_valid_pts = -1; dtvideo_decoder_t *video_dec = &vctx->video_dec; dtvideo_filter_t *video_filt = &vctx->video_filt; dtvideo_output_t *video_out = &vctx->video_out; //vf ctx init //vf will init in vd but used in vo memset (video_filt, 0, sizeof (dtvideo_filter_t)); memcpy (&video_filt->para, &vctx->video_para, sizeof (dtvideo_para_t)); video_filt->parent = vctx; //vd ctx init memset (video_dec, 0, sizeof (dtvideo_decoder_t)); memcpy (&video_dec->para, &vctx->video_para, sizeof (dtvideo_para_t)); video_dec->parent = vctx; ret = video_decoder_init (video_dec); if (ret < 0) goto err1; dt_info (TAG, "[%s:%d] vdecoder init ok\n", __FUNCTION__, __LINE__); //vo ctx init memset (video_out, 0, sizeof (dtvideo_output_t)); memcpy (&(video_out->para), &(vctx->video_para), sizeof (dtvideo_para_t)); video_out->parent = vctx; ret = video_output_init (video_out, vctx->video_para.video_output); if (ret < 0) goto err2; vctx->video_status = VIDEO_STATUS_INITED; dt_info (TAG, "dtvideo init ok,status:%d \n", vctx->video_status); return 0; err1: dt_info (TAG, "[%s:%d]video decoder init failed \n", __FUNCTION__, __LINE__); return -1; err2: video_decoder_stop (video_dec); dt_info (TAG, "[%s:%d]video output init failed \n", __FUNCTION__, __LINE__); return -3; }