diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-18 16:47:10 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-08-18 16:47:10 -0400 |
| commit | 3e8610464106337dc3d32b015371c639994e9e57 (patch) | |
| tree | d38dd54c5b2b73cdd84d947767d2dea7e240fc69 /MediaBrowser.Controller | |
| parent | 59a3dcc8c1c6b41560bd48507cfcf4f0ca0a8862 (diff) | |
Moved ffmpeg to the controller project and added ffprobe
Diffstat (limited to 'MediaBrowser.Controller')
5 files changed, 102 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Configuration/ServerApplicationPaths.cs b/MediaBrowser.Controller/Configuration/ServerApplicationPaths.cs index bd33b1984..e008f7b17 100644 --- a/MediaBrowser.Controller/Configuration/ServerApplicationPaths.cs +++ b/MediaBrowser.Controller/Configuration/ServerApplicationPaths.cs @@ -1,4 +1,5 @@ using System.IO;
+using System.Reflection;
using MediaBrowser.Common.Configuration;
namespace MediaBrowser.Controller.Configuration
@@ -150,5 +151,94 @@ namespace MediaBrowser.Controller.Configuration }
}
+ private string _FFMpegDirectory = null;
+ /// <summary>
+ /// Gets the folder path to ffmpeg
+ /// </summary>
+ public string FFMpegDirectory
+ {
+ get
+ {
+ if (_FFMpegDirectory == null)
+ {
+ _FFMpegDirectory = Path.Combine(Kernel.Instance.ApplicationPaths.ProgramDataPath, "FFMpeg");
+
+ if (!Directory.Exists(_FFMpegDirectory))
+ {
+ Directory.CreateDirectory(_FFMpegDirectory);
+ }
+ }
+
+ return _FFMpegDirectory;
+ }
+ }
+
+ private string _FFMpegPath = null;
+ /// <summary>
+ /// Gets the path to ffmpeg.exe
+ /// </summary>
+ public string FFMpegPath
+ {
+ get
+ {
+ if (_FFMpegPath == null)
+ {
+ string filename = "ffmpeg.exe";
+
+ _FFMpegPath = Path.Combine(FFMpegDirectory, filename);
+
+ // Always re-extract the first time to handle new versions
+ if (File.Exists(_FFMpegPath))
+ {
+ File.Delete(_FFMpegPath);
+ }
+
+ // Extract exe
+ using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MediaBrowser.Controller.FFMpeg." + filename))
+ {
+ using (FileStream fileStream = new FileStream(_FFMpegPath, FileMode.Create))
+ {
+ stream.CopyTo(fileStream);
+ }
+ }
+ }
+
+ return _FFMpegPath;
+ }
+ }
+
+ private string _FFProbePath = null;
+ /// <summary>
+ /// Gets the path to ffprobe.exe
+ /// </summary>
+ public string FFProbePath
+ {
+ get
+ {
+ if (_FFProbePath == null)
+ {
+ string filename = "ffprobe.exe";
+
+ _FFProbePath = Path.Combine(FFMpegDirectory, filename);
+
+ // Always re-extract the first time to handle new versions
+ if (File.Exists(_FFProbePath))
+ {
+ File.Delete(_FFProbePath);
+ }
+
+ // Extract exe
+ using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MediaBrowser.Controller.FFMpeg." + filename))
+ {
+ using (FileStream fileStream = new FileStream(_FFProbePath, FileMode.Create))
+ {
+ stream.CopyTo(fileStream);
+ }
+ }
+ }
+
+ return _FFProbePath;
+ }
+ }
}
}
diff --git a/MediaBrowser.Controller/FFMpeg/ffmpeg.exe.REMOVED.git-id b/MediaBrowser.Controller/FFMpeg/ffmpeg.exe.REMOVED.git-id new file mode 100644 index 000000000..30743c054 --- /dev/null +++ b/MediaBrowser.Controller/FFMpeg/ffmpeg.exe.REMOVED.git-id @@ -0,0 +1 @@ +faf137524dd67edb423344830e1436dcdca83daf
\ No newline at end of file diff --git a/MediaBrowser.Controller/FFMpeg/ffprobe.exe.REMOVED.git-id b/MediaBrowser.Controller/FFMpeg/ffprobe.exe.REMOVED.git-id new file mode 100644 index 000000000..4ad2356c9 --- /dev/null +++ b/MediaBrowser.Controller/FFMpeg/ffprobe.exe.REMOVED.git-id @@ -0,0 +1 @@ +a304265e8410291c1f696e74a4f9b84970bb5753
\ No newline at end of file diff --git a/MediaBrowser.Controller/FFMpeg/readme.txt b/MediaBrowser.Controller/FFMpeg/readme.txt new file mode 100644 index 000000000..cdb039bdc --- /dev/null +++ b/MediaBrowser.Controller/FFMpeg/readme.txt @@ -0,0 +1,3 @@ +This is the 32-bit static build of ffmpeg, located at:
+
+http://ffmpeg.zeranoe.com/builds/
\ No newline at end of file diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 3000fd7a0..580b4d7b5 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -79,6 +79,13 @@ <ItemGroup>
<None Include="packages.config" />
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="FFMpeg\ffmpeg.exe" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="FFMpeg\ffprobe.exe" />
+ <Content Include="FFMpeg\readme.txt" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
|
