Ramanujan's 'well known' integral, $\int\limits_{-\pi/2}^{\pi/2} (\cos x)^m e^{in x}dx$. $$\int_{-\pi/2}^{\pi/2} (\cos x)^m e^{in x}dx=\frac{\pi}{2^m} \frac{\Gamma(1+m)}{\Gamma \left(1+ \frac{m+n}{2}\right)\Gamma \left(1+ \frac{m-n}{2}\right)}$$
Appearing at the start of Ramanujan's paper 'A Class of Definite Integrals', the above is, cited as 'well known', particularly dispiriting as I can't prove it. Anyone know of a nice proof? 
$\Re(m)>-1$ and I assume that $m \in \mathbb{C}, n \in \mathbb{R}$. 

Assume that $n >m>-1$.
Then $$ \begin{align} \int_{-\pi /2}^{\pi /2} (\cos x)^{m} e^{inx} \, dx &= \int_{- \pi/2}^{\pi /2} \left( \frac{e^{ix}+e^{-ix}}{2} \right)^{m} e^{inx} \ dx \\ &= \frac{1}{i 2^{m}}  \int_{C} (z+z^{-1})^{m} z^{n-1} \, dz \\ &= \frac{1}{i2^{m}} \int_{C} \left(z^{2}+1 \right)^{m} z^{n-m-1} \, dz \\ &= \frac{1}{i2^{m}}  \int_{C} f(z) \, dz \end{align}$$
where $C$ is the right half of the unit circle traversed counterclockwise with quarter-circle indentations around the branch points at $z=-i$ and $z=i$.
Have the branch cut for $f(z)$ running down the imaginary axis from $z=i$, and define $f(z)$ to be real-valued on the positive real axis. 
Now close the contour with a vertical line segment just to the right of $[-i,i]$ with a half-circle indentation around the branch point at $z=0$.
Just to the right of the branch cut and above the origin, 
$$f(z) = |z^{2}+1|^{m} |z|^{n-m-1} e^{i \pi /2(n-m-1)} .$$
While just to the right of the branch cut and below the origin and above $z=-i$, 
$$f(z) =|z^{2}+1|^{m} |z|^{n-m-1} e^{-i \pi /2(n-m-1)} .$$
And under the assumption that $n>m>-1$, the contributions from all three indentations vanish in the limit.
For example, around $z=0$,
$$ \Big| \int_{\pi/2}^{- \pi/2} f(re^{it}) \ i r e^{it} \, dt \Big| \le \pi \ (r^{2}+1)^{m} r^{n-m}$$
which vanishes as $r \to 0$ since $n>m$.
Then going around the contour, we get
$$ \int_{C} f(z) \, dz + e^{i \pi /2 (n-m-1)}\int_{1}^{0} \left| (te^{i \pi /2})^{2} +1 \right|^{m} |te^{ i \pi /2}|^{n-m-1} e^{ i \pi /2} \, dt  $$
$$+ \ e^{-i \pi /2 (n-m-1)}\int_{0}^{1} \left| (te^{-i \pi /2})^{2} +1 \right|^{m} |te^{ -i \pi /2}|^{n-m-1} e^{ -i \pi /2} \, dt = 0 $$ 
which implies
$$ \begin{align} \int_{C} f(z) \ dz &= e^{ i \pi /2 (n-m)} \int_{0}^{1} (1-t^{2})^m t^{n-m-1} \, dt - e^{- i \pi /2 (n-m)} \int_{0}^{1} (1-t^{2})^{m} t^{n-m-1} \, dt  \\ &= 2 i \sin \left( \frac{\pi}{2} (n-m) \right) \int_{0}^{1}  (1-t^{2})^{m} t^{n-m-1} \, dt \\ &= i \sin \left( \frac{\pi}{2} (n-m) \right) \int_{0}^{1} (1-u)^{m} u^{n/2-m/2-1} \, du \\ &= i \sin \left( \frac{\pi}{2} (n-m) \right) B \left( \frac{n}{2} - \frac{m}{2}, m+1 \right) \\ &= i \sin \left( \frac{\pi}{2} (n-m) \right) \frac{\Gamma(\frac{n}{2} - \frac{m}{2}) \Gamma(m+1)}{\Gamma(\frac{m}{2}+\frac{n}{2} + 1)} .\end{align}$$
Then using the reflection formula for the gamma function, we get
$$ \int_{C} f(z) \ dz= i \pi  \, \frac{\Gamma(m+1)}{ \Gamma(1- \frac{n}{2} + \frac{m}{2})\Gamma(\frac{m}{2}+\frac{n}{2}+1)} .$$
Therefore,
$$ \begin{align} \int_{-\pi /2}^{\pi /2} (\cos x)^{m} e^{inx} \, dx &= \frac{1}{i2^{m}} \,  i \pi \, \frac{\Gamma(m+1)}{ \Gamma(1- \frac{n}{2} + \frac{m}{2})\Gamma(\frac{m}{2}+\frac{n}{2}+1)} \\ &=\frac{\pi}{2^m} \frac{\Gamma(1+m)}{\Gamma \left(1+ \frac{m+n}{2}\right)\Gamma \left(1+ \frac{m-n}{2}\right)} . \end{align} $$
