| 920 | } |
| 921 | |
| 922 | static int finalize_frame(H264Context *h, AVFrame *dst, H264Picture *out, int *got_frame) |
| 923 | { |
| 924 | int ret; |
| 925 | |
| 926 | if (((h->avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT) || |
| 927 | (h->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL) || |
| 928 | out->recovered)) { |
| 929 | |
| 930 | if (h->skip_gray > 0 && |
| 931 | h->non_gray && out->gray && |
| 932 | !(h->avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL) |
| 933 | ) |
| 934 | return 0; |
| 935 | |
| 936 | if (!h->avctx->hwaccel && |
| 937 | (out->field_poc[0] == INT_MAX || |
| 938 | out->field_poc[1] == INT_MAX) |
| 939 | ) { |
| 940 | int p; |
| 941 | AVFrame *f = out->f; |
| 942 | int field = out->field_poc[0] == INT_MAX; |
| 943 | uint8_t *dst_data[4]; |
| 944 | int linesizes[4]; |
| 945 | const uint8_t *src_data[4]; |
| 946 | |
| 947 | av_log(h->avctx, AV_LOG_DEBUG, "Duplicating field %d to fill missing\n", field); |
| 948 | |
| 949 | for (p = 0; p<4; p++) { |
| 950 | dst_data[p] = f->data[p] + (field^1)*f->linesize[p]; |
| 951 | src_data[p] = f->data[p] + field *f->linesize[p]; |
| 952 | linesizes[p] = 2*f->linesize[p]; |
| 953 | } |
| 954 | |
| 955 | av_image_copy(dst_data, linesizes, src_data, linesizes, |
| 956 | f->format, f->width, f->height>>1); |
| 957 | } |
| 958 | |
| 959 | ret = output_frame(h, dst, out); |
| 960 | if (ret < 0) |
| 961 | return ret; |
| 962 | |
| 963 | *got_frame = 1; |
| 964 | |
| 965 | if (CONFIG_MPEGVIDEODEC) { |
| 966 | ff_print_debug_info2(h->avctx, dst, |
| 967 | out->mb_type, |
| 968 | out->qscale_table, |
| 969 | out->motion_val, |
| 970 | out->mb_width, out->mb_height, out->mb_stride, 1); |
| 971 | } |
| 972 | } |
| 973 | |
| 974 | return 0; |
| 975 | } |
| 976 | |
| 977 | static int send_next_delayed_frame(H264Context *h, AVFrame *dst_frame, |
| 978 | int *got_frame, int buf_index) |
no test coverage detected