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
42 #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF42 #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF
43#endif43#endif
44 44
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
45#include <avisynth/avisynth_c.h>52#include <avisynth/avisynth_c.h>
46 53
47typedef struct AviSynthLibrary {54typedef struct AviSynthLibrary {
@@ -513,16 +520,16 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) · 465 unmodified lines
513 st->codecpar->codec_id = AV_CODEC_ID_PCM_U8;520 st->codecpar->codec_id = AV_CODEC_ID_PCM_U8;
514 break;521 break;
515 case AVS_SAMPLE_INT16:522 case AVS_SAMPLE_INT16:
516 st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;523 st->codecpar->codec_id = PCM(S16);
517 break;524 break;
518 case AVS_SAMPLE_INT24:525 case AVS_SAMPLE_INT24:
519 st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;526 st->codecpar->codec_id = PCM(S24);
520 break;527 break;
521 case AVS_SAMPLE_INT32:528 case AVS_SAMPLE_INT32:
522 st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;529 st->codecpar->codec_id = PCM(S32);
523 break;530 break;
524 case AVS_SAMPLE_FLOAT:531 case AVS_SAMPLE_FLOAT:
525 st->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE;532 st->codecpar->codec_id = PCM(F32);
526 break;533 break;
527 default:534 default:
528 av_log(s, AV_LOG_ERROR,535 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