home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
Plugin Development
Featured Plugins
UPnP / DLNA Media Server
UPnP / DLNA Media Server for MediaPortal 2
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="morpheus_xx" data-source="post: 1154227" data-attributes="member: 48495"><p>[USER=119106]@henso[/USER] would you mind to make some more changes to classes?</p><p></p><p>For codec settings lookup I suggest such kind of structure:</p><p>[CODE=CSHARP]</p><p> public class EncodingConfig</p><p> {</p><p> public Dictionary<EncodingProfile, string> Profiles { get; set; }</p><p> public Dictionary<EncodingPreset, string> Presets { get; set; }</p><p></p><p> public EncodingConfig()</p><p> {</p><p> Profiles = new Dictionary<EncodingProfile, string>();</p><p> Presets = new Dictionary<EncodingPreset, string>();</p><p> }</p><p> }</p><p></p><p> public class VideoEncodingConfig : Dictionary<VideoCodec, EncodingConfig> { }</p><p></p><p> private readonly VideoEncodingConfig IntelCodecConfig = new VideoEncodingConfig</p><p> {</p><p> {</p><p> VideoCodec.Mpeg2,</p><p> new EncodingConfig</p><p> {</p><p> Profiles = new Dictionary<EncodingProfile, string></p><p> {</p><p> { EncodingProfile.Simple, "-profile:v simple" },</p><p> { EncodingProfile.Main, "-profile:v main" },</p><p> { EncodingProfile.High, "-profile:v high" }</p><p> },</p><p> Presets = new Dictionary<EncodingPreset, string></p><p> {</p><p> { EncodingPreset.Default, "-preset fast" },</p><p> { EncodingPreset.Ultrafast, "-preset fast" },</p><p> { EncodingPreset.Superfast, "-preset fast" },</p><p> { EncodingPreset.Veryfast, "-preset fast" },</p><p> { EncodingPreset.Faster, "-preset fast" },</p><p> { EncodingPreset.Fast, "-preset fast" },</p><p> { EncodingPreset.Medium, "-preset medium" },</p><p> { EncodingPreset.Slow, "-preset slow" },</p><p> { EncodingPreset.Slower, "-preset slow" },</p><p> { EncodingPreset.Veryslow, "-preset slow" }</p><p> }</p><p> }</p><p> },</p><p> {</p><p> VideoCodec.H264,</p><p> new EncodingConfig</p><p> {</p><p> Profiles = new Dictionary<EncodingProfile, string></p><p> {</p><p> { EncodingProfile.Baseline, "-profile:v baseline" },</p><p> { EncodingProfile.Main, "-profile:v main" },</p><p> { EncodingProfile.High, "-profile:v high" },</p><p> { EncodingProfile.High422, "-profile:v high" },</p><p> { EncodingProfile.High444, "-profile:v high" }</p><p> },</p><p> Presets = new Dictionary<EncodingPreset, string></p><p> {</p><p> { EncodingPreset.Default, "-preset veryfast" },</p><p> { EncodingPreset.Ultrafast, "-preset veryfast" },</p><p> { EncodingPreset.Superfast, "-preset veryfast" },</p><p> { EncodingPreset.Veryfast, "-preset veryfast" },</p><p> { EncodingPreset.Faster, "-preset faster" },</p><p> { EncodingPreset.Fast, "-preset fast" },</p><p> { EncodingPreset.Medium, "-preset medium" },</p><p> { EncodingPreset.Slow, "-preset slow" },</p><p> { EncodingPreset.Slower, "-preset slower" },</p><p> { EncodingPreset.Veryslow, "-preset veryslow" }</p><p> }</p><p> }</p><p> }</p><p> };</p><p>// TODO: NVidia, SW</p><p>[/CODE]</p><p></p><p>The main difference to current situation is to have on single object for each encoder (SW, Intel, NVidia).</p><p></p><p>This makes the later lookup even simpler, like:</p><p>[CODE=CSHARP] VideoEncodingConfig selectedConfig;</p><p> if (isIntel)</p><p> selectedConfig = IntelCodecConfig;</p><p> else if (isNvidia)</p><p> selectedConfig = NVidiaCodecConfig;</p><p> else</p><p> selectedConfig = SWCodecConfig;</p><p></p><p> EncodingConfig encodingConfig;</p><p> if (selectedConfig.TryGetValue(video.TargetVideoCodec, out encodingConfig))</p><p> {</p><p> string profile;</p><p> if (encodingConfig.Profiles.TryGetValue(video.TargetProfile, out profile) && !string.IsNullOrEmpty(profile))</p><p> data.OutputArguments.Add(profile);</p><p></p><p> string preset;</p><p> if (encodingConfig.Presets.TryGetValue(video.TargetPreset, out preset) && !string.IsNullOrEmpty(preset))</p><p> data.OutputArguments.Add(profile);</p><p> }</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="morpheus_xx, post: 1154227, member: 48495"] [USER=119106]@henso[/USER] would you mind to make some more changes to classes? For codec settings lookup I suggest such kind of structure: [CODE=CSHARP] public class EncodingConfig { public Dictionary<EncodingProfile, string> Profiles { get; set; } public Dictionary<EncodingPreset, string> Presets { get; set; } public EncodingConfig() { Profiles = new Dictionary<EncodingProfile, string>(); Presets = new Dictionary<EncodingPreset, string>(); } } public class VideoEncodingConfig : Dictionary<VideoCodec, EncodingConfig> { } private readonly VideoEncodingConfig IntelCodecConfig = new VideoEncodingConfig { { VideoCodec.Mpeg2, new EncodingConfig { Profiles = new Dictionary<EncodingProfile, string> { { EncodingProfile.Simple, "-profile:v simple" }, { EncodingProfile.Main, "-profile:v main" }, { EncodingProfile.High, "-profile:v high" } }, Presets = new Dictionary<EncodingPreset, string> { { EncodingPreset.Default, "-preset fast" }, { EncodingPreset.Ultrafast, "-preset fast" }, { EncodingPreset.Superfast, "-preset fast" }, { EncodingPreset.Veryfast, "-preset fast" }, { EncodingPreset.Faster, "-preset fast" }, { EncodingPreset.Fast, "-preset fast" }, { EncodingPreset.Medium, "-preset medium" }, { EncodingPreset.Slow, "-preset slow" }, { EncodingPreset.Slower, "-preset slow" }, { EncodingPreset.Veryslow, "-preset slow" } } } }, { VideoCodec.H264, new EncodingConfig { Profiles = new Dictionary<EncodingProfile, string> { { EncodingProfile.Baseline, "-profile:v baseline" }, { EncodingProfile.Main, "-profile:v main" }, { EncodingProfile.High, "-profile:v high" }, { EncodingProfile.High422, "-profile:v high" }, { EncodingProfile.High444, "-profile:v high" } }, Presets = new Dictionary<EncodingPreset, string> { { EncodingPreset.Default, "-preset veryfast" }, { EncodingPreset.Ultrafast, "-preset veryfast" }, { EncodingPreset.Superfast, "-preset veryfast" }, { EncodingPreset.Veryfast, "-preset veryfast" }, { EncodingPreset.Faster, "-preset faster" }, { EncodingPreset.Fast, "-preset fast" }, { EncodingPreset.Medium, "-preset medium" }, { EncodingPreset.Slow, "-preset slow" }, { EncodingPreset.Slower, "-preset slower" }, { EncodingPreset.Veryslow, "-preset veryslow" } } } } }; // TODO: NVidia, SW [/CODE] The main difference to current situation is to have on single object for each encoder (SW, Intel, NVidia). This makes the later lookup even simpler, like: [CODE=CSHARP] VideoEncodingConfig selectedConfig; if (isIntel) selectedConfig = IntelCodecConfig; else if (isNvidia) selectedConfig = NVidiaCodecConfig; else selectedConfig = SWCodecConfig; EncodingConfig encodingConfig; if (selectedConfig.TryGetValue(video.TargetVideoCodec, out encodingConfig)) { string profile; if (encodingConfig.Profiles.TryGetValue(video.TargetProfile, out profile) && !string.IsNullOrEmpty(profile)) data.OutputArguments.Add(profile); string preset; if (encodingConfig.Presets.TryGetValue(video.TargetPreset, out preset) && !string.IsNullOrEmpty(preset)) data.OutputArguments.Add(profile); } [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Featured Plugins
UPnP / DLNA Media Server
UPnP / DLNA Media Server for MediaPortal 2
Contact us
RSS
Top
Bottom