History

avisynth: fix audio on big endian

AviSynth+ outputs audio in the same format as the OS, so assuming little endian formats as input on big endian OSes results in nothing but static.

Stephen Hutchinson committed 5 years ago

Commit 16e8ea01 parent 8b744581 file · +11 −4Browse files

Unified · Split

libavformat/avisynth.c+11−4
@@ -42,6 +42,13 @@ · 41 unmodified lines
4242 #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF
4343 #endif
4444
45+/* Endianness guards for audio */
46+#if HAVE_BIGENDIAN
47+ #define PCM(format) (AV_CODEC_ID_PCM_ ## format ## BE)
48+#else
49+ #define PCM(format) (AV_CODEC_ID_PCM_ ## format ## LE)
50+#endif
51+
4552 #include <avisynth/avisynth_c.h>
4653
4754 typedef struct AviSynthLibrary {
@@ -513,16 +520,16 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) · 465 unmodified lines
513520 st->codecpar->codec_id = AV_CODEC_ID_PCM_U8;
514521 break;
515522 case AVS_SAMPLE_INT16:
516− st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;
523+ st->codecpar->codec_id = PCM(S16);
517524 break;
518525 case AVS_SAMPLE_INT24:
519− st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;
526+ st->codecpar->codec_id = PCM(S24);
520527 break;
521528 case AVS_SAMPLE_INT32:
522− st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;
529+ st->codecpar->codec_id = PCM(S32);
523530 break;
524531 case AVS_SAMPLE_FLOAT:
525− st->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE;
532+ st->codecpar->codec_id = PCM(F32);
526533 break;
527534 default:
528535 av_log(s, AV_LOG_ERROR,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t