Exemplo n.º 1
0
void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
                   int drop_frame, double pts, int *full_frame)
{
    mp_image_t *mpi = NULL;
    unsigned int t = GetTimer();
    unsigned int t2;
    double tt;
    int delay;
    int got_picture = 1;

    mpi = mpvdec->decode(sh_video, start, in_size, drop_frame);

    //------------------------ frame decoded. --------------------

    if (mpi && mpi->type == MP_IMGTYPE_INCOMPLETE) {
	got_picture = 0;
	mpi = NULL;
    }

    if (full_frame)
	*full_frame = got_picture;

    delay = get_current_video_decoder_lag(sh_video);
    if (correct_pts && pts != MP_NOPTS_VALUE
        && (got_picture || sh_video->num_buffered_pts < delay)) {
        if (sh_video->num_buffered_pts ==
            sizeof(sh_video->buffered_pts) / sizeof(double))
            mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n");
        else {
            int i, j;
            for (i = 0; i < sh_video->num_buffered_pts; i++)
                if (sh_video->buffered_pts[i] < pts)
                    break;
            for (j = sh_video->num_buffered_pts; j > i; j--)
                sh_video->buffered_pts[j] = sh_video->buffered_pts[j - 1];
            sh_video->buffered_pts[i] = pts;
            sh_video->num_buffered_pts++;
        }
    }
    if (correct_pts && mpi && drop_frame && sh_video->num_buffered_pts > 0)
        sh_video->num_buffered_pts--;

    // some codecs are broken, and doesn't restore MMX state :(
    // it happens usually with broken/damaged files.
    if (HAVE_AMD3DNOW_INLINE && gCpuCaps.has3DNow) {
        __asm__ volatile ("femms\n\t":::"memory");
    } else if (HAVE_MMX_INLINE && gCpuCaps.hasMMX) {
Exemplo n.º 2
0
void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
		   int drop_frame, double pts)
{
    mp_image_t *mpi = NULL;
    unsigned int t = GetTimer();
    unsigned int t2;
    double tt;

    if (correct_pts && pts != MP_NOPTS_VALUE) {
	int delay = get_current_video_decoder_lag(sh_video);
	if (delay >= 0) {
	    if (delay > sh_video->num_buffered_pts)
#if 0
		// this is disabled because vd_ffmpeg reports the same lag
		// after seek even when there are no buffered frames,
		// leading to incorrect error messages
		mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Not enough buffered pts\n");
#else
	    ;
#endif
	    else
		sh_video->num_buffered_pts = delay;
	}