lavf/segment: slight refactor to seg_write_packet