Skip to content
Browse files

Merge remote-tracking branch 'remotes/swiggin1/master'

  • Loading branch information...
2 parents f23cebf + 536bfac commit e6534c2f1176b6220fa3a546c5ec555d49ff483b @yari committed Apr 11, 2012
Showing with 82 additions and 52 deletions.
  1. +1 −0 .gitignore
  2. +6 −0 Source/Zencoder/MediaFileFormat.cs
  3. +75 −52 Source/Zencoder/Output.cs
View
1 .gitignore
@@ -8,3 +8,4 @@ bin/
obj/
TestResults/
Build/
+_ReSharper.Zencoder
View
6 Source/Zencoder/MediaFileFormat.cs
@@ -21,6 +21,12 @@ public enum MediaFileFormat
/// </summary>
[Description("mp4")]
MPFour = 0,
+
+ /// <summary>
+ /// Identifies the MP4 format.
+ /// </summary>
+ [Description("aac")]
+ AAC,
/// <summary>
/// Identifies the 3G2 format.
View
127 Source/Zencoder/Output.cs
@@ -4,22 +4,23 @@
// </copyright>
//-----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using Newtonsoft.Json;
+
namespace Zencoder
{
using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using Newtonsoft.Json;
/// <summary>
/// Represents job output settings.
/// </summary>
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class Output
{
- [JsonProperty("headers", NullValueHandling = NullValueHandling.Ignore)]
- private IDictionary<string, string> headers;
+ [JsonProperty("headers", NullValueHandling = NullValueHandling.Ignore)] private IDictionary<string, string> headers;
/// <summary>
/// Gets or sets the collection of custom S3 access grants to apply to the output
@@ -76,7 +77,7 @@ public class Output
/// Gets or sets a value indicating whether to apply an auto-level filter to the output video.
/// </summary>
[JsonProperty("auto_level", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? AutoLevel { get; set; }
/// <summary>
@@ -111,14 +112,14 @@ public class Output
/// Requires setting <see cref="VideoBitrate"/>. Cannot be used in conjuction with <see cref="Quality"/>.
/// </summary>
[JsonProperty("constant_bitrate", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? ConstantBitrate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to apply a deblocking filter to the output video.
/// </summary>
[JsonProperty("deblock", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? Deblock { get; set; }
/// <summary>
@@ -129,6 +130,20 @@ public class Output
public int? Decimate { get; set; }
/// <summary>
+ /// The max bitrate fed to the decoder via a buffer. Typically used only for streaming (RTMP or broadcast video), not for HTTP delivery of video.
+ /// Only use this number if you know what you are doing. This should typically only be used for streaming (or for device playback).
+ /// </summary>
+ [JsonProperty("decoder_bitrate_cap", NullValueHandling = NullValueHandling.Ignore)]
+ public int? DecoderBitrateCap { get; set; }
+
+ /// <summary>
+ /// The size of the buffer fed to the decoder when using a bitrate_cap, expressed in kbps. The buffer_size divided by bitrate_cap represents the size of the buffer in seconds; so if you set bitrate_cap to 1000 and buffer_size to 1000, the buffer is effectively 1.0 second. If bitrate_cap is 500 and buffer_size is 1000, the buffer is 2.0 seconds.
+ /// This is typically used only for streaming (RTMP or broadcast video), not for HTTP delivery of video. Only use this number if you know what you are doing. This should typically only be used for streaming (or for device playback).
+ /// </summary>
+ [JsonProperty("decoder_buffer_size", NullValueHandling = NullValueHandling.Ignore)]
+ public int? DecoderBufferSize { get; set; }
+
+ /// <summary>
/// Gets or sets the deinterlace mode to use.
/// </summary>
[JsonProperty("deinterlace", NullValueHandling = NullValueHandling.Ignore)]
@@ -146,7 +161,7 @@ public class Output
/// for more details on device profiles.
/// </summary>
[JsonProperty("device_profile", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(EnumDescriptionConverter))]
+ [JsonConverter(typeof (EnumDescriptionConverter))]
public DeviceProfile? DeviceProfile { get; set; }
/// <summary>
@@ -162,7 +177,7 @@ public class Output
/// allowing variability.
/// </summary>
[JsonProperty("fixed_keyframe_interval", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? FixedKeyframeInterval { get; set; }
/// <summary>
@@ -212,6 +227,14 @@ public class Output
[JsonProperty("height", NullValueHandling = NullValueHandling.Ignore)]
public int? Height { get; set; }
+
+ /// <summary>
+ /// Turn on hinting of MP4 files for RTP/RTSP. The default mtu_size is 1450 bytes; use the mtu_size option to change this.
+ /// </summary>
+ [JsonProperty("hint", NullValueHandling = NullValueHandling.Ignore)]
+ [JsonConverter(typeof (BooleanConverter))]
+ public bool? Hint { get; set; }
+
/// <summary>
/// Gets or sets the maximum number of frames between each keyframe.
/// Defaults to 250.
@@ -266,7 +289,7 @@ public class Output
/// <see cref="VideoBitrate"/> is set.
/// </summary>
[JsonProperty("onepass", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? Onepass { get; set; }
/// <summary>
@@ -280,7 +303,7 @@ public class Output
/// if the output is being placed in S3.
/// </summary>
[JsonProperty("public", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? Public { get; set; }
/// <summary>
@@ -304,7 +327,7 @@ public class Output
/// application when storing outputs on S3.
/// </summary>
[JsonProperty("rrs", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? Rrs { get; set; }
/// <summary>
@@ -317,21 +340,21 @@ public class Output
/// Gets or sets a value indicating whether to apply a sharpen filter to the output video.
/// </summary>
[JsonProperty("sharpet", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? Sharpen { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to skip the input audio track, if one is present.
/// </summary>
[JsonProperty("skip_audio", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? SkipAudio { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to skip the input video track, if one is present.
/// </summary>
[JsonProperty("skip_video", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? SkipVideo { get; set; }
/// <summary>
@@ -358,7 +381,7 @@ public class Output
/// rather than having the service move bad parameters into valid ranges.
/// </summary>
[JsonProperty("strict", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? Strict { get; set; }
/// <summary>
@@ -378,7 +401,7 @@ public class Output
/// up to the output resolution if necessary.
/// </summary>
[JsonProperty("upscale", NullValueHandling = NullValueHandling.Ignore)]
- [JsonConverter(typeof(BooleanConverter))]
+ [JsonConverter(typeof (BooleanConverter))]
public bool? Upscale { get; set; }
/// <summary>
@@ -420,7 +443,7 @@ public class Output
/// <returns>The instance.</returns>
public Output WithAccessControl(S3Access accessControl)
{
- return this.WithAccessControls(new S3Access[] { accessControl });
+ return this.WithAccessControls(new[] {accessControl});
}
/// <summary>
@@ -463,65 +486,65 @@ public Output WithClip(TimeSpan? startClip, TimeSpan? clipLength)
}
/// <summary>
- /// Sets this instance's <see cref="Thumbnails"/> property.
+ /// Appends a <see cref="Notification"/> to this instance's <see cref="Notification"/> collection.
/// </summary>
- /// <param name="thumbnails">The thumbnails to set.</param>
+ /// <param name="notification">The notification to append.</param>
/// <returns>This instance.</returns>
- public Output WithThumbnails(Thumbnails thumbnails)
+ public Output WithNotification(Notification notification)
{
- return this.WithThumbnails(thumbnails != null ? new Thumbnails[1] { thumbnails } : null);
+ if (notification != null)
+ {
+ return this.WithNotifications(new[] {notification});
+ }
+
+ return this;
}
/// <summary>
- /// Sets this instance's <see cref="Thumbnails"/> property.
+ /// Appends a collection of <see cref="Notification"/>s to this instance's <see cref="Notification"/> collection.
/// </summary>
- /// <param name="thumbnails">The thumbnails collection to set.</param>
+ /// <param name="notifications">The notifications to append.</param>
/// <returns>This instance.</returns>
- public Output WithThumbnails(IEnumerable<Thumbnails> thumbnails)
+ public Output WithNotifications(IEnumerable<Notification> notifications)
{
- Thumbnails[] t = thumbnails != null ? thumbnails.ToArray() : new Thumbnails[0];
- this.Thumbnails = t.Length > 0 ? t : null;
+ if (notifications != null)
+ {
+ this.Notifications = (this.Notifications ?? new Notification[0]).Concat(notifications).ToArray();
+ }
+
return this;
}
/// <summary>
- /// Sets the instance's <see cref="Url"/> property.
+ /// Sets this instance's <see cref="Thumbnails"/> property.
/// </summary>
- /// <param name="url">The URL to set.</param>
+ /// <param name="thumbnails">The thumbnails to set.</param>
/// <returns>This instance.</returns>
- public Output WithUrl(Uri url)
+ public Output WithThumbnails(Thumbnails thumbnails)
{
- this.Url = url.ToString();
- return this;
+ return this.WithThumbnails(thumbnails != null ? new Thumbnails[1] {thumbnails} : null);
}
/// <summary>
- /// Appends a <see cref="Notification"/> to this instance's <see cref="Notification"/> collection.
+ /// Sets this instance's <see cref="Thumbnails"/> property.
/// </summary>
- /// <param name="notification">The notification to append.</param>
+ /// <param name="thumbnails">The thumbnails collection to set.</param>
/// <returns>This instance.</returns>
- public Output WithNotification(Notification notification)
+ public Output WithThumbnails(IEnumerable<Thumbnails> thumbnails)
{
- if (notification != null)
- {
- return this.WithNotifications(new Notification[] { notification });
- }
-
+ Thumbnails[] t = thumbnails != null ? thumbnails.ToArray() : new Thumbnails[0];
+ this.Thumbnails = t.Length > 0 ? t : null;
return this;
}
/// <summary>
- /// Appends a collection of <see cref="Notification"/>s to this instance's <see cref="Notification"/> collection.
+ /// Sets the instance's <see cref="Url"/> property.
/// </summary>
- /// <param name="notifications">The notifications to append.</param>
+ /// <param name="url">The URL to set.</param>
/// <returns>This instance.</returns>
- public Output WithNotifications(IEnumerable<Notification> notifications)
+ public Output WithUrl(Uri url)
{
- if (notifications != null)
- {
- this.Notifications = (this.Notifications ?? new Notification[0]).Concat(notifications).ToArray();
- }
-
+ this.Url = url.ToString();
return this;
}
@@ -534,7 +557,7 @@ public Output WithWatermark(Watermark watermark)
{
if (watermark != null)
{
- return this.WithWatermarks(new Watermark[] { watermark });
+ return this.WithWatermarks(new[] {watermark});
}
return this;
@@ -555,4 +578,4 @@ public Output WithWatermarks(IEnumerable<Watermark> watermarks)
return this;
}
}
-}
+}

0 comments on commit e6534c2

Please sign in to comment.
Something went wrong with that request. Please try again.