Revision cb48fdf6 ffmpeg.c

View differences:

ffmpeg.c
1417 1417
    AVFormatContext *os;
1418 1418
    AVOutputStream *ost;
1419 1419
    int ret, i;
1420
    int got_picture;
1420
    int got_output;
1421 1421
    AVFrame picture;
1422 1422
    void *buffer_to_free;
1423 1423
    static unsigned int samples_size= 0;
......
1449 1449
        pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
1450 1450

  
1451 1451
    //while we have more to decode or while the decoder did output something on EOF
1452
    while (avpkt.size > 0 || (!pkt && ist->next_pts != ist->pts)) {
1452
    while (avpkt.size > 0 || (!pkt && got_output)) {
1453 1453
        uint8_t *data_buf, *decoded_data_buf;
1454 1454
        int data_size, decoded_data_size;
1455 1455
    handle_eof:
......
1485 1485
                avpkt.data += ret;
1486 1486
                avpkt.size -= ret;
1487 1487
                data_size   = ret;
1488
                got_output  = decoded_data_size > 0;
1488 1489
                /* Some bug in mpeg audio decoder gives */
1489 1490
                /* decoded_data_size < 0, it seems they are overflows */
1490
                if (decoded_data_size <= 0) {
1491
                if (!got_output) {
1491 1492
                    /* no audio frame */
1492 1493
                    continue;
1493 1494
                }
......
1504 1505
                    pkt_pts = AV_NOPTS_VALUE;
1505 1506

  
1506 1507
                    ret = avcodec_decode_video2(ist->st->codec,
1507
                                                &picture, &got_picture, &avpkt);
1508
                                                &picture, &got_output, &avpkt);
1508 1509
                    ist->st->quality= picture.quality;
1509 1510
                    if (ret < 0)
1510 1511
                        goto fail_decode;
1511
                    if (!got_picture) {
1512
                    if (!got_output) {
1512 1513
                        /* no picture yet */
1513 1514
                        goto discard_packet;
1514 1515
                    }
......
1523 1524
                    break;
1524 1525
            case AVMEDIA_TYPE_SUBTITLE:
1525 1526
                ret = avcodec_decode_subtitle2(ist->st->codec,
1526
                                               &subtitle, &got_picture, &avpkt);
1527
                                               &subtitle, &got_output, &avpkt);
1527 1528
                if (ret < 0)
1528 1529
                    goto fail_decode;
1529
                if (!got_picture) {
1530
                if (!got_output) {
1530 1531
                    goto discard_packet;
1531 1532
                }
1532 1533
                subtitle_to_free = &subtitle;

Also available in: Unified diff