Exemplo n.º 1
0
        public Muxer(FormatId format)
            : base(format)
        {
            if (format == FormatId.M4a)
            {
                format = FormatId.Mp4;
            }

            AVOutputFormat *fmt = ffmpeg.av_guess_format(format.ToString().ToLower(), null, format.ToMime());

            if (fmt == null)
            {
                throw new Exception("Could not guess format:" + format.ToMime() + "|" + format.ToString().ToLower());
            }

            Context.Pointer->oformat = fmt;

            // Console.WriteLine("OUTPUT:" + Marshal.PtrToStringAnsi((IntPtr)fmt->long_name));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Override ToString() to provide a user friendly string representation.
 /// </summary>
 /// <returns>String representing the property key.</returns>
 public override string ToString()
 {
     return(string.Format(System.Globalization.CultureInfo.InvariantCulture,
                          "PropertyKeyFormatString",
                          FormatId.ToString("B"), PropertyId));
 }
Exemplo n.º 3
0
 /// <summary>
 /// override ToString()
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return("PKey: " + FormatId.ToString() + ":" + PropertyId.ToString(CultureInfo.InvariantCulture.NumberFormat));
 }
Exemplo n.º 4
0
 public override string ToString()
 {
     return($"{FormatId.ToString("B")}, {PropertyId}");
 }
Exemplo n.º 5
0
        public static string Canonicalize(this FormatId value)
        {
            switch (value)
            {
            // Applications
            case Json: return("JSON");

            // Audio
            case Aac: return("AAC");

            case Flac: return("FLAC");

            case M4a: return("M4A");

            case Mp3: return("MP3");

            case Opus: return("Opus");

            // Images
            case Bmp: return("BMP");

            case Bpg: return("BPG");

            case Gif: return("GIF");

            case Dng: return("DNG");

            case Heif: return("HEIF");

            case Ico: return("ICO");

            case Jpeg: return("JPEG");

            case Jp2: return("JP2");

            case Jxr: return("JXR");

            case Png: return("PNG");

            case Psd: return("PSD");

            case Svg: return("SVG");

            case Tiff: return("TIFF");

            case WebP: return("WebP");

            // Video
            case Mp4: return("MP4");

            case M4v: return("M4V");

            case WebM: return("WebM");

            // Fonts
            case Ttf: return("TTF");

            case Woff: return("WOFF");

            case Woff2: return("WOFF2");
            }

            return(value.ToString().ToUpper());
        }
Exemplo n.º 6
0
        public static Mime FromFormat(FormatId format)
        {
            switch (format)
            {
            // Audio
            case FormatId.Aac: return(Aac);

            case FormatId.Flac: return(Flac);

            case FormatId.M4a: return(M4a);

            case FormatId.Mp3: return(Mp3);

            case FormatId.Oga: return(Oga);

            case FormatId.Opus: return(Opus);

            // Images
            case FormatId.Bmp: return(Bmp);

            case FormatId.Bpg: return(Bpg);

            case FormatId.Gif: return(Gif);

            case FormatId.Dng: return(Dng);

            case FormatId.Heif: return(Heif);

            case FormatId.Ico: return(Ico);

            case FormatId.Jpeg: return(Jpeg);

            case FormatId.Jp2: return(Jp2);

            case FormatId.Jxr: return(Jxr);

            case FormatId.Png: return(Png);

            case FormatId.Psd: return(Psd);

            case FormatId.Svg: return(Svg);

            case FormatId.Tiff: return(Tiff);

            case FormatId.WebP: return(WebP);

            // Videos
            case FormatId.Mp4: return(Mp4);

            case FormatId.M4v: return(M4v);

            case FormatId.WebM: return(WebM);

            // Fonts
            case FormatId.Ttf: return(Ttf);

            case FormatId.Woff: return(Woff);

            case FormatId.Woff2: return(Woff2);
            }

            return(MimeHelper.FormatToMimeMap.TryGetValue(format.ToString().ToLower(), out Mime mime)
                ? mime
                : throw new Exception($"No mime found for '{format}'."));
        }
Exemplo n.º 7
0
        /*
         * <propertyDescription name="Microsoft.SDKSample.DirectoryLevel" formatID="{581CF603-2925-4acf-BB5A-3D3EB39EACD3}" propID="3">
         *  <description>Number of directory levels to this item.</description>
         *  <searchInfo inInvertedIndex="false" isColumn="false,
         *  <typeInfo canStackBy="false" type="Int32"/>
         *  <labelInfo label="Directory Level"/>
         * </propertyDescription>
         */
        internal XmlElement GetXmlPropertyDescription(XmlDocument doc)
        {
            var desc = doc.CreateElement("propertyDescription");

            desc.SetAttribute("name", CanonicalName);
            desc.SetAttribute("formatID", FormatId.ToString("B").ToUpper());
            desc.SetAttribute("propID", PropertyId.ToString());

            var search = doc.CreateElement("searchInfo");

            search.SetAttribute("inInvertedIndex", InInvertedIndex.ToString());
            if (IsColumn)
            {
                search.SetAttribute("isColumn", IsColumn.ToString());
                search.SetAttribute("isColumnSparse", IsColumnSparse.ToString());
                search.SetAttribute("columnIndexType", ColumnIndexType.ToString());
            }
            if (MaxSize != 512)
            {
                search.SetAttribute("maxSize", MaxSize.ToString());
            }
            if (Mnemonics != null && Mnemonics.Length > 0)
            {
                search.SetAttribute("mnemonics", Mnemonics);
            }
            desc.AppendChild(search);

            var label = doc.CreateElement("labelInfo");

            label.SetAttribute("label", DisplayName);
            label.SetAttribute("sortDescription", SortDescription.ToString());
            if (EditInvitation != null && EditInvitation.Length > 0)
            {
                label.SetAttribute("invitationText", EditInvitation);
            }
            if (HideLabel)
            {
                label.SetAttribute("hideLabel", HideLabel.ToString());
            }
            desc.AppendChild(label);

            var type = doc.CreateElement("typeInfo");

            type.SetAttribute("type", Type.ToString());
            if (GroupingRange != PropertyGroupingRange.Discrete)
            {
                type.SetAttribute("groupingRange", GroupingRange.ToString());
            }
            if (IsInnate)
            {
                type.SetAttribute("isInnate", IsInnate.ToString());
            }
            if (IsInnate && CanBePurged)
            {
                type.SetAttribute("canBePurged", CanBePurged.ToString());
            }
            //if (MultipleValues)
            type.SetAttribute("multipleValues", MultipleValues.ToString());
            if (IsGroup)
            {
                type.SetAttribute("isGroup", IsGroup.ToString());
            }
            if (AggregationType != PropertyAggregationType.Default)
            {
                type.SetAttribute("aggregationType", AggregationType.ToString());
            }
            if (IsTreeProperty)
            {
                type.SetAttribute("isTreeProperty", IsTreeProperty.ToString());
            }
            if (IsViewable)
            {
                type.SetAttribute("isViewable", IsViewable.ToString());
            }
            if (SearchRawValue)
            {
                type.SetAttribute("searchRawValue", SearchRawValue.ToString());
            }
            if (ConditionType != PropertyConditionType.String)
            {
                type.SetAttribute("conditionType", ConditionType.ToString());
            }
            if (ConditionOperation != ConditionOperationConfigured.Equal)
            {
                type.SetAttribute("defaultOperation", ConditionOperation.ToString());
            }
            desc.AppendChild(type);

            var display = doc.CreateElement("displayInfo");

            display.SetAttribute("displayType", DisplayType.ToString());
            if (DisplayType == PropertyDisplayType.String && StringFormat != StringFormat.General)
            {
                var format = doc.CreateElement("stringFormat");
                format.SetAttribute("formatAs", StringFormat.ToString());
                display.AppendChild(format);
            }
            if (DisplayType == PropertyDisplayType.Boolean && BooleanFormat != BooleanFormat.YesNo)
            {
                var format = doc.CreateElement("booleanFormat");
                format.SetAttribute("formatAs", BooleanFormat.ToString());
                display.AppendChild(format);
            }
            if (DisplayType == PropertyDisplayType.Number && NumberFormat != NumberFormat.General)
            {
                var format = doc.CreateElement("numberFormat");
                format.SetAttribute("formatAs", NumberFormat.ToString());
                display.AppendChild(format);
            }
            if (DisplayType == PropertyDisplayType.DateTime && DateTimeFormat != DateTimeFormat.General)
            {
                var format = doc.CreateElement("dateTimeFormat");
                format.SetAttribute("formatAs", DateTimeFormat.ToString());
                display.AppendChild(format);
            }



            if (DefaultColumnWidth != 20)
            {
                display.SetAttribute("defaultColumnWidth", DefaultColumnWidth.ToString());
            }
            if (Alignment != PropertyAlignmentType.Left)
            {
                display.SetAttribute("alignment", Alignment.ToString());
            }
            //if (RelativeDescriptionType != RelativeDescriptionType.General)
            //  display.SetAttribute("relativeDescriptionType", RelativeDescriptionType.ToString());
            if (DefaultSortDirection != SortDirection.Ascending)
            {
                display.SetAttribute("defaultSortDirection", DefaultSortDirection.ToString());
            }
            if (EditControl != EditControl.Default)
            {
                var edit = doc.CreateElement("editControl");
                edit.SetAttribute("control", EditControl.ToString());
                display.AppendChild(edit);
            }
            desc.AppendChild(display);

            return(desc);
        }