Revision 9ce1d5f0 libavcodec/crystalhd.c

View differences:

libavcodec/crystalhd.c
102 102
 ****************************************************************************/
103 103

  
104 104
typedef enum {
105
    RET_ERROR          = -1,
106
    RET_OK             = 0,
107
    RET_COPY_AGAIN     = 1,
108
    RET_SKIP_NEXT_COPY = 2,
105
    RET_ERROR           = -1,
106
    RET_OK              = 0,
107
    RET_COPY_AGAIN      = 1,
108
    RET_SKIP_NEXT_COPY  = 2,
109
    RET_COPY_NEXT_FIELD = 3,
109 110
} CopyRet;
110 111

  
111 112
typedef struct OpaqueList {
......
624 625
        return RET_SKIP_NEXT_COPY;
625 626
    }
626 627

  
627
    return RET_OK;
628
    /*
629
     * Testing has shown that in all cases where we don't want to return the
630
     * full frame immediately, VDEC_FLAG_UNKNOWN_SRC is set.
631
     */
632
    return priv->need_second_field &&
633
           !(output->PicInfo.flags & VDEC_FLAG_UNKNOWN_SRC) ?
634
           RET_COPY_NEXT_FIELD : RET_OK;
628 635
}
629 636

  
630 637

  
......
806 813

  
807 814
    do {
808 815
        rec_ret = receive_frame(avctx, data, data_size, 0);
809
        if (rec_ret == 0 && *data_size == 0) {
810
            if (avctx->codec->id == CODEC_ID_H264) {
816
        if (rec_ret == RET_OK && *data_size == 0) {
811 817
                /*
812 818
                 * This case is for when the encoded fields are stored
813 819
                 * separately and we get a separate avpkt for each one. To keep
......
817 823
                 */
818 824
                av_log(avctx, AV_LOG_VERBOSE, "Returning after first field.\n");
819 825
                avctx->has_b_frames--;
820
            } else {
826
        } else if (rec_ret == RET_COPY_NEXT_FIELD) {
821 827
                /*
822 828
                 * This case is for when the encoded fields are stored in a
823 829
                 * single avpkt but the hardware returns then separately. Unless
......
833 839
                    if (ret == BC_STS_SUCCESS &&
834 840
                        decoder_status.ReadyListCount > 0) {
835 841
                        rec_ret = receive_frame(avctx, data, data_size, 1);
836
                        if ((rec_ret == 0 && *data_size > 0) ||
842
                        if ((rec_ret == RET_OK && *data_size > 0) ||
837 843
                            rec_ret == RET_ERROR)
838 844
                            break;
839 845
                    }
840 846
                }
841 847
                av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Got second field.\n");
842
            }
843 848
        } else if (rec_ret == RET_SKIP_NEXT_COPY) {
844 849
            /*
845 850
             * Two input packets got turned into a field pair. Gawd.

Also available in: Unified diff