Computing $\int_0^\pi \frac{dx}{1+a^2\cos^2(x)}$ 
I am trying to compute the following integral
  $$\int_0^\pi \frac{dx}{1+a^2\cos^2(x)}$$ 

But I got stuck on my way. 
Indeed, enforcing the change of variables $t =\cos^2x$ leads to 
$$\int_0^\pi \frac{d x}{1+a^2\cos^2(x)}= \int_{-1}^1 \frac{d x}{(1+a^2t^2)(1-t^2)^{1/2}}dx =2\int_{0}^1 \frac{d x}{(1+a^2t^2)(1-t^2)^{1/2}}dx$$
then what next? I though this was related the beta and Gamma function but it seems not. Can some help me here?

Bioche's rules say the right substitution should be $t=\tan x$.
Indeed, then $\; \mathrm d x=\dfrac{ \mathrm d t}{1+t^2}$, so that 
\begin{align}\int\frac{\mathrm d x}{1+a^2\cos^2(x)}&=\int\frac{\mathrm d t}{(1+t^2)\biggl(1+\cfrac{a^2}{1+t^2}\biggr)}=\int\frac{\mathrm d t}{1+a^2+t^2}\\&=\frac1{\sqrt{1+a^2}}\,\arctan \frac t{\sqrt{1+a^2}}.
\end{align}
