The determination of emissivity of layered structures is critical in many applications, such as radiation thermometry, microelectronics, radiative cooling, and energy harvesting. Two different approaches, i.e., the "indirect" and "direct" methods, are commonly used for computing the emissivity of an object. For an opaque surface at a uniform temperature, the indirect method involves calculating the spectral directional-hemispherical reflectance to deduce the spectral directional emissivity based on Kirchhoff's law. On the other hand, a few studies have used a combination of Maxwell's equations with the fluctuation-dissipation theorem to directly calculate the emissivity. The present study aims at unifying the direct and indirect methods for calculating thermal emission from layered structures with a nonuniform temperature distribution. Formulations for both methods are given to illustrate the equivalence between the indirect and the direct methods. Thermal emission from an asymmetric Fabry-Perot resonance cavity with a nonuniform temperature distribution is taken as an example to show how to predict the intensity, emissivity, and the brightness temperature. The local density of states, however, can only be calculated using the direct method.