Example 4 Given that the real number $x$ and the acute angle $\theta$ satisfy
$$
\begin{array}{l}
x^{2}+2 x \cos \theta=\sin \theta-\frac{5}{4} . \\
\text { Find the value of } \frac{x+\operatorname{tg} \theta}{x-\operatorname{tg} \theta} \text { . }
\end{array}
$$