Snape was talking to Dumbledore's headmaster portrait, at least in the book:
‘Headmaster! They are camping in the Forest of Dean! The Mudblood –’
‘Do not use that word!’
‘– the Granger girl, then, mentioned the place as she opened her bag
and I heard her!’
‘Good. Very good!’ cried the portrait of Dumbledore behind the
Headmaster’s chair. ‘Now, Severus, the sword! Do not forget that it
must be taken under conditions of need and valour – and he must not
know that you give it! If Voldemort should read Harry’s mind and see
you acting for him –’
‘I know,’ said Snape curtly. He approached the portrait of Dumbledore
and pulled at its side. It swung forwards, revealing a hidden cavity
behind it, from which he took the sword of Gryffindor. Deathly Hallows