Revision 199c18a7

View differences:

ffplay.c
1543 1543
{
1544 1544
    int len1, got_picture, i;
1545 1545

  
1546
        if (packet_queue_get(&is->videoq, pkt, 1) < 0)
1547
            return -1;
1548

  
1549
        if(pkt->data == flush_pkt.data){
1550
            avcodec_flush_buffers(is->video_st->codec);
1546
    if (packet_queue_get(&is->videoq, pkt, 1) < 0)
1547
        return -1;
1551 1548

  
1552
            SDL_LockMutex(is->pictq_mutex);
1553
            //Make sure there are no long delay timers (ideally we should just flush the que but thats harder)
1554
            for(i=0; i<VIDEO_PICTURE_QUEUE_SIZE; i++){
1555
                is->pictq[i].target_clock= 0;
1556
            }
1557
            while (is->pictq_size && !is->videoq.abort_request) {
1558
                SDL_CondWait(is->pictq_cond, is->pictq_mutex);
1559
            }
1560
            is->video_current_pos= -1;
1561
            SDL_UnlockMutex(is->pictq_mutex);
1549
    if (pkt->data == flush_pkt.data) {
1550
        avcodec_flush_buffers(is->video_st->codec);
1562 1551

  
1563
            init_pts_correction(&is->pts_ctx);
1564
            is->frame_last_pts= AV_NOPTS_VALUE;
1565
            is->frame_last_delay = 0;
1566
            is->frame_timer = (double)av_gettime() / 1000000.0;
1567
            is->skip_frames= 1;
1568
            is->skip_frames_index= 0;
1569
            return 0;
1552
        SDL_LockMutex(is->pictq_mutex);
1553
        //Make sure there are no long delay timers (ideally we should just flush the que but thats harder)
1554
        for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {
1555
            is->pictq[i].target_clock= 0;
1570 1556
        }
1557
        while (is->pictq_size && !is->videoq.abort_request) {
1558
            SDL_CondWait(is->pictq_cond, is->pictq_mutex);
1559
        }
1560
        is->video_current_pos = -1;
1561
        SDL_UnlockMutex(is->pictq_mutex);
1571 1562

  
1572
        /* NOTE: ipts is the PTS of the _first_ picture beginning in
1573
           this packet, if any */
1574
        is->video_st->codec->reordered_opaque= pkt->pts;
1575
        len1 = avcodec_decode_video2(is->video_st->codec,
1576
                                    frame, &got_picture,
1577
                                    pkt);
1563
        init_pts_correction(&is->pts_ctx);
1564
        is->frame_last_pts = AV_NOPTS_VALUE;
1565
        is->frame_last_delay = 0;
1566
        is->frame_timer = (double)av_gettime() / 1000000.0;
1567
        is->skip_frames = 1;
1568
        is->skip_frames_index = 0;
1569
        return 0;
1570
    }
1578 1571

  
1579
        if (got_picture) {
1580
            if (decoder_reorder_pts == -1) {
1581
                *pts = guess_correct_pts(&is->pts_ctx, frame->reordered_opaque, pkt->dts);
1582
            } else if (decoder_reorder_pts) {
1583
                *pts = frame->reordered_opaque;
1584
            } else {
1585
                *pts = pkt->dts;
1586
            }
1572
    /* NOTE: ipts is the PTS of the _first_ picture beginning in
1573
       this packet, if any */
1574
    is->video_st->codec->reordered_opaque = pkt->pts;
1575
    len1 = avcodec_decode_video2(is->video_st->codec,
1576
                                 frame, &got_picture,
1577
                                 pkt);
1587 1578

  
1588
            if (*pts == AV_NOPTS_VALUE) {
1589
                *pts = 0;
1590
            }
1579
    if (got_picture) {
1580
        if (decoder_reorder_pts == -1) {
1581
            *pts = guess_correct_pts(&is->pts_ctx, frame->reordered_opaque, pkt->dts);
1582
        } else if (decoder_reorder_pts) {
1583
            *pts = frame->reordered_opaque;
1584
        } else {
1585
            *pts = pkt->dts;
1591 1586
        }
1592 1587

  
1588
        if (*pts == AV_NOPTS_VALUE) {
1589
            *pts = 0;
1590
        }
1591
    }
1592

  
1593 1593
//            if (len1 < 0)
1594 1594
//                break;
1595 1595
    if (got_picture){

Also available in: Unified diff