I'm just thinking it looks too short for a rifle and too long for a pistol. So what was it?
I think it's a pistol. The hammer also looks more like percussion to me than flint lock but that could be because of the rust. Of course if it is percussiion it could still be Texas/Mexican War vintage since percussions date to about 1830.
I do realize there's no stock on the remants of the gun in answer to the question above. And I do recognize this to be a cap fired gun rather than a flintlock. It's got the hammer and a place to put a cap for the hammer to hit. If it were a flintlock it'd have a mechanism for clamping the flint in the hammer and a striker plate in front for the flint to hit and create it's sparks.
I made my comment just by the observation of the length of the barrel in relation to the size of the hammer mechanism. A rifler barrel would normally be 2 three times that length, yet a pistol barrel would normally be half that length. It kind of reminds me of some early equivalent to a sawed off shotgun!