lavc/h264: Add common code for level handling