avisynth: Use av_packet_from_data for audio

If the audio changes from 9eac7c4 were merged as they were, this
would cause scripts with both video+audio to fail with a lot of
audio decoding errors (the video would be fine). Audio-only scripts
were unaffected.

Using av_packet_from_data allows video+audio scripts to work as
expected, without audio decoding errors.

Includes the remaining unmerged av_packet-related bits from 9eac7c4,
which were authored by Anton Khirnov <anton@khirnov.net>.
avisynth: Check av_malloc in read_packet_audio for errors
avisynth: Use packet_unref with packet_from_data, not av_freep