The battery is certainly a limiting factor, but not a big one as fully charged batteries can supply enough current to damage most headphones. Depends on the battery, of course. 9V batteries can supply far less current than AA, for example, and discharged batteries will of course supply less than fully charged ones. But the real limit is in the amp design. Some amps that use only an opamp as the output stage. Many of these cannot supply a lot of current (really power, which is voltage times current) to the load (I'm thinking of the CMOY here). It's also a little more complex, as some amps have current limits that prevent the maximum power to be realized at certain output voltages, but suffice it to say that the limits are built in, so the choice of opamp really is where the limit begins. Other amps that use higher power output designs have enough power to drive a small speaker. And of course, there's everything in between.
There's no way to calculate the maximum power output of a completely unknown amp. You need at least a little information on whats inside. If you knew what the output device was, you could make a guess from component specs. Or, with the right test equipment, you can measure it.
But the maximum power isn't usually the thing to be most concerned with. The interesting figure is output impedance, which has an actual sonic impact on some headphones. The general idea is for the amp to have a much lower output impedance than the headphones impedance. For example, if you had 30 ohm headphones, you'd want your amp to be around 3 to 5 ohms. Next, you want an amp with enough output capability to drive your headphones given their sensitivity. Higher sensitivity phones need less voltage to be loud, and of course the inverse is true. If you get those things right, it mostly works fine. Most of that can be found in specifications or review data.