| 857 | } |
| 858 | |
| 859 | static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp) |
| 860 | { |
| 861 | int ret; |
| 862 | |
| 863 | ret = av_frame_ref(dst, srcp->needs_fg ? srcp->f_grain : srcp->f); |
| 864 | if (ret < 0) |
| 865 | return ret; |
| 866 | |
| 867 | if (srcp->needs_fg && (ret = av_frame_copy_props(dst, srcp->f)) < 0) |
| 868 | return ret; |
| 869 | |
| 870 | if (srcp->decode_error_flags) { |
| 871 | atomic_int *decode_error = srcp->decode_error_flags; |
| 872 | /* The following is not supposed to provide synchronisation at all: |
| 873 | * given that srcp has already finished decoding, decode_error |
| 874 | * has already been set to its final value. */ |
| 875 | dst->decode_error_flags |= atomic_load_explicit(decode_error, memory_order_relaxed); |
| 876 | } |
| 877 | |
| 878 | av_dict_set(&dst->metadata, "stereo_mode", ff_h264_sei_stereo_mode(&h->sei.common.frame_packing), 0); |
| 879 | |
| 880 | if (srcp->sei_recovery_frame_cnt == 0) |
| 881 | dst->flags |= AV_FRAME_FLAG_KEY; |
| 882 | |
| 883 | if (h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS) { |
| 884 | ret = h264_export_enc_params(dst, srcp); |
| 885 | if (ret < 0) |
| 886 | goto fail; |
| 887 | } |
| 888 | |
| 889 | if (!(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN)) |
| 890 | av_frame_remove_side_data(dst, AV_FRAME_DATA_FILM_GRAIN_PARAMS); |
| 891 | |
| 892 | return 0; |
| 893 | fail: |
| 894 | av_frame_unref(dst); |
| 895 | return ret; |
| 896 | } |
| 897 | |
| 898 | static int is_avcc_extradata(const uint8_t *buf, int buf_size) |
| 899 | { |
no test coverage detected