avformat/utils: factorize h264/hevc checks out in compute_pkt_fields()