Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6134 → Rev 6135

/contrib/media/fplay/fplay.h
135,7 → 135,11
 
vframe_t *decoder_frame;
void *hwCtx; /* hardware context */
int hwdec; /* hardware decoder */
int hwdec:1; /* hardware decoder */
int blit_bitmap:1; /* hardware RGBA blitter */
int blit_texture:1; /* hardware RGBA blit and scale */
int blit_planar:1; /* hardbare YUV blit and scale */
int frame_reorder:1;
};
 
 
/contrib/media/fplay/vaapi.c
608,8 → 608,6
if(vframe->format != AV_PIX_FMT_NONE)
return;
 
ENTER();
 
status = vaDeriveImage(vaapi->display,v_surface_id[vframe->index],&vaimage);
if (!vaapi_check_status(status, "vaDeriveImage()"))
{
653,5 → 651,5
 
vaReleaseBufferHandle(vaapi->display, vaimage.buf);
vaDestroyImage(vaapi->display, vaimage.image_id);
LEAVE();
 
}
/contrib/media/fplay/video.c
76,32 → 76,63
 
static double dts = 0.0;
 
int decode_video(vst_t* vst)
static vframe_t *get_input_frame(vst_t *vst)
{
AVPacket pkt;
double pts;
int frameFinished;
vframe_t *vframe = NULL;
 
if(vst->decoder_frame == NULL)
{
mutex_lock(&vst->input_lock);
if(list_empty(&vst->input_list))
if(!list_empty(&vst->input_list))
{
mutex_unlock(&vst->input_lock);
return -1;
vframe = list_first_entry(&vst->input_list, vframe_t, list);
list_del(&vframe->list);
}
vst->decoder_frame = list_first_entry(&vst->input_list, vframe_t, list);
list_del(&vst->decoder_frame->list);
mutex_unlock(&vst->input_lock);
 
vframe_t *vframe = vst->decoder_frame;
return vframe;
}
 
static void put_output_frame(vst_t *vst, vframe_t *vframe)
{
mutex_lock(&vst->output_lock);
if(list_empty(&vst->output_list))
list_add_tail(&vframe->list, &vst->output_list);
else
{
vframe_t *cur;
 
cur = list_first_entry(&vst->output_list,vframe_t,list);
if(vframe->pts < cur->pts)
list_add_tail(&vframe->list, &vst->output_list);
else
{
list_for_each_entry_reverse(cur,&vst->output_list,list)
{
if(vframe->pts > cur->pts)
{
list_add(&vframe->list, &cur->list);
break;
};
};
};
};
mutex_unlock(&vst->output_lock);
};
 
if( get_packet(&vst->q_video, &pkt) == 0 )
int decode_video(vst_t* vst)
{
AVPacket pkt;
double pts;
int frameFinished;
 
if(vst->decoder_frame == NULL)
vst->decoder_frame = get_input_frame(vst);
 
if(vst->decoder_frame == NULL)
return 0;
};
 
if( get_packet(&vst->q_video, &pkt) == 0 )
return 0;
 
frameFinished = 0;
if(dts == 0)
dts = pkt.pts;
113,13 → 144,16
 
if(frameFinished)
{
vframe_t *vframe;
vframe_t *vframe = vst->decoder_frame;;
AVPicture *dst_pic;
 
if(vst->hwdec)
pts = pkt.pts;
else
pts = av_frame_get_best_effort_timestamp(Frame);
 
pts *= av_q2d(video_time_base);
 
vframe = vst->decoder_frame;
dst_pic = &vframe->picture;
 
if(vframe->is_hw_pic == 0)
134,35 → 168,8
vframe->pkt_dts = dts*av_q2d(video_time_base)*1000.0;
vframe->ready = 1;
 
put_output_frame(vst, vframe);
 
mutex_lock(&vst->output_lock);
 
if(list_empty(&vst->output_list))
list_add_tail(&vframe->list, &vst->output_list);
else
{
vframe_t *cur;
 
cur = list_first_entry(&vst->output_list,vframe_t,list);
if(vframe->pkt_pts < cur->pkt_pts)
{
list_add_tail(&vframe->list, &vst->output_list);
}
else
{
list_for_each_entry_reverse(cur,&vst->output_list,list)
{
if(vframe->pkt_pts > cur->pkt_pts)
{
list_add(&vframe->list, &cur->list);
break;
};
};
};
};
mutex_unlock(&vst->output_lock);
 
 
// printf("decoded index: %d pts: %f pkt_pts %f pkt_dts %f\n",
// vst->dfx, vst->vframe[vst->dfx].pts,
// vst->vframe[vst->dfx].pkt_pts, vst->vframe[vst->dfx].pkt_dts);