G-VEval: A Versatile Metric for Evaluating Image and Video Captions Using GPT-4o