diff --git a/FFmpegSource/ffbase.cpp b/FFmpegSource/ffbase.cpp
index b325cae38..4fe399baf 100644
--- a/FFmpegSource/ffbase.cpp
+++ b/FFmpegSource/ffbase.cpp
@@ -1,3 +1,23 @@
+// Copyright (c) 2007 Fredrik Mellbin
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
#include "ffmpegsource.h"
int FFBase::FrameFromDTS(int64_t ADTS) {
@@ -316,14 +336,14 @@ void FFBase::InitPP(int AWidth, int AHeight, const char *APPString, int AQuality
void FFBase::SetOutputFormat(int ACurrentFormat, IScriptEnvironment *Env) {
int Loss;
- int BestFormat = avcodec_find_best_pix_fmt((1 << PIX_FMT_YUVJ420P) | (1 << PIX_FMT_YUV420P) | (1 << PIX_FMT_YUYV422) | (1 << PIX_FMT_RGB32) | (1 << PIX_FMT_BGR24), ACurrentFormat, 1 /* Required to prevent pointless RGB32 => RGB24 conversion */, &Loss);
+ int BestFormat = avcodec_find_best_pix_fmt((1 << PIX_FMT_YUVJ420P) | (1 << PIX_FMT_YUV420P) | (1 << PIX_FMT_YUYV422) | (1 << PIX_FMT_RGB32) | (1 << PIX_FMT_RGB24), ACurrentFormat, 1 /* Required to prevent pointless RGB32 => RGB24 conversion */, &Loss);
switch (BestFormat) {
case PIX_FMT_YUVJ420P: // stupid yv12 distinctions, also inexplicably completely undeniably incompatible with all other supported output formats
case PIX_FMT_YUV420P: VI.pixel_type = VideoInfo::CS_I420; break;
case PIX_FMT_YUYV422: VI.pixel_type = VideoInfo::CS_YUY2; break;
case PIX_FMT_RGB32: VI.pixel_type = VideoInfo::CS_BGR32; break;
- case PIX_FMT_BGR24: VI.pixel_type = VideoInfo::CS_BGR24; break;
+ case PIX_FMT_RGB24: VI.pixel_type = VideoInfo::CS_BGR24; break;
default:
Env->ThrowError("FFmpegSource: No suitable output format found");
}
@@ -398,6 +418,7 @@ FFBase::FFBase() {
SWS = NULL;
DecodingBuffer = new uint8_t[AVCODEC_MAX_AUDIO_FRAME_SIZE];
FLACBuffer = new FLAC__int32[AVCODEC_MAX_AUDIO_FRAME_SIZE];
+ FCFile = NULL;
ConvertToFormat = PIX_FMT_NONE;
memset(&PPPicture, 0, sizeof(PPPicture));
DecodeFrame = avcodec_alloc_frame();
diff --git a/FFmpegSource/ffmatroskasource.cpp b/FFmpegSource/ffmatroskasource.cpp
index 6d0b077ab..0266b3136 100644
--- a/FFmpegSource/ffmatroskasource.cpp
+++ b/FFmpegSource/ffmatroskasource.cpp
@@ -1,3 +1,23 @@
+// Copyright (c) 2007 Fredrik Mellbin
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
#include "ffmpegsource.h"
#include "stdiostream.c"
diff --git a/FFmpegSource/ffmpegsource.cpp b/FFmpegSource/ffmpegsource.cpp
index 9adb49e15..0f19c8726 100644
--- a/FFmpegSource/ffmpegsource.cpp
+++ b/FFmpegSource/ffmpegsource.cpp
@@ -1,3 +1,23 @@
+// Copyright (c) 2007 Fredrik Mellbin
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
#include "ffmpegsource.h"
static DWORD WINAPI AVFindStreamInfoExecute(AVFormatContext *FormatContext) {
diff --git a/FFmpegSource/ffmpegsource.html b/FFmpegSource/ffmpegsource.html
index 40c8bd155..3d963bb20 100644
--- a/FFmpegSource/ffmpegsource.html
+++ b/FFmpegSource/ffmpegsource.html
@@ -9,6 +9,13 @@ FFmpegSource Documentation
Changes
+- 1.11
+- Now officially uses the MIT license
+- Supports more audio formats in matroska
+- RGB24 output no longer has swapped colors if the video is converted to it for output
+- Fixed an access violation on close when no audio is opened (introduced in 1.10)
+
+
- 1.10
- The audio cache compression level is now ignored if the source isn't 16bit and the raw format is used instead
- FLAC is now actually initialized properly so the cache actually works for files that aren't stereo (16bit limit still applies)
diff --git a/FFmpegSource/ffpp.cpp b/FFmpegSource/ffpp.cpp
index 7e12a6bcd..6eaaf1127 100644
--- a/FFmpegSource/ffpp.cpp
+++ b/FFmpegSource/ffpp.cpp
@@ -1,3 +1,23 @@
+// Copyright (c) 2007 Fredrik Mellbin
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
#include "ffmpegsource.h"
FFPP::FFPP(PClip AChild, const char *APPString, int AQuality, IScriptEnvironment *Env) : GenericVideoFilter(AChild) {
diff --git a/FFmpegSource/ffshared.cpp b/FFmpegSource/ffshared.cpp
index 09cf5bbd0..1ebf6fbd6 100644
--- a/FFmpegSource/ffshared.cpp
+++ b/FFmpegSource/ffshared.cpp
@@ -1,3 +1,23 @@
+// Copyright (c) 2007 Fredrik Mellbin
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
#include "ffmpegsource.h"
int GetPPCPUFlags(IScriptEnvironment *Env) {
diff --git a/FFmpegSource/matroskacodecs.cpp b/FFmpegSource/matroskacodecs.cpp
index 2bc91db89..7d35ca18d 100644
--- a/FFmpegSource/matroskacodecs.cpp
+++ b/FFmpegSource/matroskacodecs.cpp
@@ -1,3 +1,23 @@
+// Copyright (c) 2007 Fredrik Mellbin
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
#include "ffmpegsource.h"
CodecID MatroskaToFFCodecID(TrackInfo *TI) {
@@ -215,25 +235,38 @@ CodecID MatroskaToFFCodecID(TrackInfo *TI) {
return CODEC_ID_MP2; // correct?
else if (!strcmp(Codec, "A_DTS"))
return CODEC_ID_DTS;
-/*
- else if (!strcmp(Codec, "A_PCM/INT/LIT"))
- return CODEC_ID_PCM_S16LE;
- else if (!strcmp(Codec, "A_PCM/FLOAT/IEEE"))
- return CODEC_ID_PCM_S16LE;
-*/
+ else if (!strcmp(Codec, "A_PCM/INT/LIT")) {
+ switch (TI->AV.Audio.BitDepth) {
+ case 8: return CODEC_ID_PCM_S8;
+ case 16: return CODEC_ID_PCM_S16LE;
+ case 24: return CODEC_ID_PCM_S24LE;
+ case 32: return CODEC_ID_PCM_S32LE;
+ default: CODEC_ID_NONE;
+ }
+ } else if (!strcmp(Codec, "A_PCM/FLOAT/IEEE"))
+ return CODEC_ID_NONE; // no float codec id?
else if (!strcmp(Codec, "A_TTA1"))
return CODEC_ID_TTA;
else if (!strcmp(Codec, "A_WAVPACK4"))
return CODEC_ID_WAVPACK;
else if (!strcmp(Codec, "A_VORBIS"))
return CODEC_ID_VORBIS;
- else if (!strncmp(Codec, "A_REAL/", 7)) {
- // not supported
- return CODEC_ID_NONE;
- } else if (!strncmp(Codec, "A_AAC", 5))
+ else if (!strcmp(Codec, "A_REAL/14_4"))
+ return CODEC_ID_RA_144;
+ else if (!strcmp(Codec, "A_REAL/28_8"))
+ return CODEC_ID_RA_288;
+ else if (!strcmp(Codec, "A_REAL/COOK"))
+ return CODEC_ID_COOK;
+ else if (!strcmp(Codec, "A_REAL/SIPR"))
+ return CODEC_ID_NONE; // no sipr codec id?
+ else if (!strcmp(Codec, "A_REAL/ATRC"))
+ return CODEC_ID_ATRAC3;
+ else if (!strncmp(Codec, "A_AAC", 5))
return CODEC_ID_AAC;
else if (!strcmp(Codec, "A_MS/ACM")) {
- // not supported
+ // nothing useful here anyway?
+ //#include "Mmreg.h"
+ //((WAVEFORMATEX *)TI->CodecPrivate)->wFormatTag
return CODEC_ID_NONE;
} else
return CODEC_ID_NONE;