lavc: Add refcounted api to AVPacket

Provide a clean way to manipulate packets.