Example 8 Solve the functional inequality $f(\sin x) \leqslant \cos 2 x$.


Solve $f(\sin x) \leqslant \cos 2 x$, i.e., $f(\sin x) \leqslant 1-2 \sin ^{2} x$, the solution is $f(x) \leqslant 1-2 x^{2}, x \in[-1,1]$.
Analysis If we directly introduce a parameter function $p(x)(\forall p(x) \leqslant 0, x \in \mathbf{R})$, and let $f(\sin x)=\cos 2 x+p(x)$, it becomes $f(\sin x)=1-2 \sin ^{2} x+p(x)$, it would be very difficult to write out the required solution.