This allows scripts that serve both video and audio to actually
have audio served out without encountering errors.
Otherwise, video-only scripts work and audio-only scripts work,
but scripts that have both will only output a video stream - the
audio stream is marked as being there, but it's empty.
---
libavformat/avisynth.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 10a0740..040b90d 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -570,7 +570,10 @@ static int avisynth_read_packet_audio(AVFormatContext *s,
AVPacket *pkt,
if (!pkt->size)
return AVERROR_UNKNOWN;
- if (av_new_packet(pkt, pkt->size) < 0)
+ /* This ensures scripts that serve both video and audio
+ * have audio output */
+ pkt->data = av_malloc(pkt->size);
+ if (av_packet_from_data(pkt, pkt->data, pkt->size) < 0)
return AVERROR(ENOMEM);
avs_library.avs_get_audio(avs->clip, pkt->data, n, samples);
--
1.8.3.2
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel