Revision ca0eed7e

View differences:

libavcodec/crystalhd.c
814 814
    do {
815 815
        rec_ret = receive_frame(avctx, data, data_size, 0);
816 816
        if (rec_ret == RET_OK && *data_size == 0) {
817
                /*
818
                 * This case is for when the encoded fields are stored
819
                 * separately and we get a separate avpkt for each one. To keep
820
                 * the pipeline stable, we should return nothing and wait for
821
                 * the next time round to grab the second field.
822
                 * H.264 PAFF is an example of this.
823
                 */
824
                av_log(avctx, AV_LOG_VERBOSE, "Returning after first field.\n");
825
                avctx->has_b_frames--;
817
            /*
818
             * This case is for when the encoded fields are stored
819
             * separately and we get a separate avpkt for each one. To keep
820
             * the pipeline stable, we should return nothing and wait for
821
             * the next time round to grab the second field.
822
             * H.264 PAFF is an example of this.
823
             */
824
            av_log(avctx, AV_LOG_VERBOSE, "Returning after first field.\n");
825
            avctx->has_b_frames--;
826 826
        } else if (rec_ret == RET_COPY_NEXT_FIELD) {
827
                /*
828
                 * This case is for when the encoded fields are stored in a
829
                 * single avpkt but the hardware returns then separately. Unless
830
                 * we grab the second field before returning, we'll slip another
831
                 * frame in the pipeline and if that happens a lot, we're sunk.
832
                 * So we have to get that second field now.
833
                 * Interlaced mpeg2 and vc1 are examples of this.
834
                 */
835
                av_log(avctx, AV_LOG_VERBOSE, "Trying to get second field.\n");
836
                while (1) {
837
                    usleep(priv->decode_wait);
838
                    ret = DtsGetDriverStatus(dev, &decoder_status);
839
                    if (ret == BC_STS_SUCCESS &&
840
                        decoder_status.ReadyListCount > 0) {
841
                        rec_ret = receive_frame(avctx, data, data_size, 1);
842
                        if ((rec_ret == RET_OK && *data_size > 0) ||
843
                            rec_ret == RET_ERROR)
844
                            break;
845
                    }
827
            /*
828
             * This case is for when the encoded fields are stored in a
829
             * single avpkt but the hardware returns then separately. Unless
830
             * we grab the second field before returning, we'll slip another
831
             * frame in the pipeline and if that happens a lot, we're sunk.
832
             * So we have to get that second field now.
833
             * Interlaced mpeg2 and vc1 are examples of this.
834
             */
835
            av_log(avctx, AV_LOG_VERBOSE, "Trying to get second field.\n");
836
            while (1) {
837
                usleep(priv->decode_wait);
838
                ret = DtsGetDriverStatus(dev, &decoder_status);
839
                if (ret == BC_STS_SUCCESS &&
840
                    decoder_status.ReadyListCount > 0) {
841
                    rec_ret = receive_frame(avctx, data, data_size, 1);
842
                    if ((rec_ret == RET_OK && *data_size > 0) ||
843
                        rec_ret == RET_ERROR)
844
                        break;
846 845
                }
847
                av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Got second field.\n");
846
            }
847
            av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Got second field.\n");
848 848
        } else if (rec_ret == RET_SKIP_NEXT_COPY) {
849 849
            /*
850 850
             * Two input packets got turned into a field pair. Gawd.

Also available in: Unified diff