⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windows media audio compressor - the code project - managed c++.mht

📁 视频方面的资料
💻 MHT
📖 第 1 页 / 共 5 页
字号:
=20
            Mobile comp:<BR>Win a Samsung UMPC</A></DIV>
            <DIV style=3D"PADDING-TOP: 5px"><IMG=20
            style=3D"PADDING-RIGHT: 10px; FLOAT: left; MARGIN-LEFT: 7px; =
MARGIN-RIGHT: 10px"=20
            height=3D20 alt=3DComp=20
            =
src=3D"http://www.codeproject.com/script/images/prize_winner_sm.gif"=20
            width=3D10><A=20
            =
href=3D"http://www.codeproject.com/script/competitions/monthly/">Monthly =

            Competition</A></DIV></DIV>
            <CENTER>
            <SCRIPT language=3Djavascript>document.write("<a =
href=3D\"/script/admentor/admentorredir.asp?id=3D3033&way=3Dban\" =
target=3D_blank><img =
src=3D\"/script/ann/ServeImg.aspx?File=3D%2Fscript%2Fadmentor%2Fimages%2F=
Dundas%5FChartOLAP55%5F160x600%2Egif&C=3DFalse&id=3D3033&cb=3D1307599\" =
alt=3D\"\" border=3D0 width=3D160 height=3D600></a>");</SCRIPT>
            </CENTER><BR><BR><IMG height=3D1=20
            src=3D"http://www.codeproject.com/script/images/t.gif" =
width=3D160> </TD>
          <TD width=3D"100%">
            <TABLE class=3DSearchHeaderBar cellSpacing=3D0 =
width=3D"100%">
              <TBODY>
              <TR>
                <TD vAlign=3Dcenter noWrap align=3Dright width=3D"60%">
                  <FORM style=3D"MARGIN: 0px" name=3DSearch =
action=3D/info/search.asp=20
                  method=3Dpost><B>Search &nbsp;</B><INPUT =
class=3DsmallText=20
                  style=3D"WIDTH: 200px" name=3Dtarget> <SELECT=20
                  style=3D"FONT-WEIGHT: bold; FONT-SIZE: 8pt" name=3Dst> =
<OPTION=20
                    value=3Dkw selected>Articles</OPTION> <OPTION=20
                    value=3Dau>Authors</OPTION></SELECT> <INPUT =
style=3D"FONT-WEIGHT: bold; FONT-SIZE: 8pt" type=3Dsubmit value=3D" Go! =
">=20
                  &nbsp; </FORM></TD>
                <TD class=3DtinyText noWrap><A=20
                  =
href=3D"http://www.codeproject.com/info/search.asp">Advanced=20
                  Search</A><BR><A=20
                  =
href=3D"http://www.codeproject.com/script/articles/sections.asp">Sitemap<=
/A>=20
                </TD></TR></TBODY></TABLE>
            <TABLE width=3D"100%">
              <TBODY>
              <TR vAlign=3Dtop>
                <TD class=3DSmallText noWrap>
                  <TABLE>
                    <TBODY>
                    <TR>
                      <TD class=3DsmallText noWrap><IMG=20
                        =
src=3D"http://www.codeproject.com/images/print.gif"=20
                        align=3DabsMiddle> <A=20
                        =
href=3D"http://www.codeproject.com/managedcpp/WmaCompressor.asp?print=3Dt=
rue"=20
                        target=3D_print>Print</A></TD>
                      <TD class=3DsmallText noWrap><IMG=20
                        =
src=3D"http://www.codeproject.com/script/images/sitebuild_icon.gif"=20
                        align=3DabsMiddle><A=20
                        =
href=3D"http://www.codeproject.com/script/submit/ReportProblem.asp?GUID=3D=
WmaCompressor%2Fmanagedcpp4%2F9%2F2004">Broken=20
                        Article?</A></TD>
                      <TD class=3DsmallText noWrap><IMG=20
                        =
src=3D"http://www.codeproject.com/images/link.gif"=20
                        align=3DabsMiddle><A=20
                        =
href=3D"http://www.codeproject.com/script/profile/add_bookmark.asp?t=3D0&=
amp;ct=3D%2Fmanagedcpp%2FWmaCompressor%2Easp&amp;guid=3DWmaCompressor%2Fm=
anagedcpp4%2F9%2F2004">Bookmark</A></TD>
                      <TD class=3DsmallText noWrap><IMG=20
                        =
src=3D"http://www.codeproject.com/images/mail_small.gif"=20
                        align=3DabsMiddle> <A=20
                        =
href=3D"http://www.codeproject.com/managedcpp/WmaCompressor.asp#__comment=
s">Discuss</A></TD>
                      <TD class=3DsmallText noWrap><IMG=20
                        =
src=3D"http://www.codeproject.com/images/mail.gif"=20
                        align=3DabsMiddle> <A=20
                        =
href=3D"http://www.codeproject.com/script/recommend/form.asp?guid=3DWmaCo=
mpressor%2Fmanagedcpp4%2F9%2F2004">Send=20
                        to a friend</A></TD></TR></TBODY></TABLE></TD>
                <TD noWrap align=3Dright><A name=3D__top></A>
                  <TABLE>
                    <TBODY>
                    <TR>
                      <TD class=3DsmallText align=3Dright>18 votes for =
this=20
                        article.</TD>
                      <TD>
                        <TABLE cellSpacing=3D0 cellPadding=3D0 =
border=3D2>
                          <TBODY>
                          <TR>
                            <TD><IMG height=3D5=20
                              =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                              width=3D20 border=3D0></TD>
                            <TD><IMG height=3D5=20
                              =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                              width=3D20 border=3D0></TD>
                            <TD><IMG height=3D5=20
                              =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                              width=3D20 border=3D0></TD>
                            <TD><IMG height=3D5=20
                              =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                              width=3D20 border=3D0></TD>
                            <TD><IMG height=3D5=20
                              =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                              width=3D14 border=3D0><IMG height=3D5=20
                              =
src=3D"http://www.codeproject.com/script/images/white.gif"=20
                              width=3D6 =
border=3D0></TD></TR></TBODY></TABLE></TD></TR>
                    <TR>
                      <TD class=3DsmallText align=3Dright colSpan=3D2><A =

                        title=3D"Calculated as rating x Log10(# votes)"=20
                        =
href=3D"http://www.codeproject.com/script/articles/top_articles.asp?st=3D=
2">Popularity:=20
                        5.91</A>. Rating: <B>4.71</B> out of=20
                  =
5.</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=3DArticlePane>
            <UL style=3D"MARGIN-RIGHT: 20px; BACKGROUND-COLOR: #eeeeee">
              <LI=20
              style=3D"FONT-SIZE: 8pt; LIST-STYLE-IMAGE: =
url(/images/warning.gif)">You=20
              are signed up for one or more <A=20
              =
href=3D"http://www.codeproject.com/script/profile/subscribe.asp">newslett=
ers</A>=20
              but unfortunately we are unable to send you emails. Please =
click=20
              <A=20
              =
href=3D"http://www.codeproject.com/script/profile/SendConfirmRequest.asp"=
>here</A>=20
              to have an email sent that will allow us to confirm your =
email=20
              address.</LI></UL><SPAN id=3DintelliTXT>
            <DIV id=3Dcontentdiv><!-- Article Starts -->
            <UL class=3Ddownload>
              <LI><A=20
              =
href=3D"http://www.codeproject.com/managedcpp/WmaCompressor/WMACompressor=
.zip">Download=20
              source code and demo project - 193 Kb</A> </LI></UL>
            <P><IMG height=3D208 alt=3D"Sample Image - Audio Compress"=20
            =
src=3D"http://www.codeproject.com/managedcpp/WmaCompressor/WMACompressor.=
jpg"=20
            width=3D392></P>
            <H2>Introduction</H2>
            <P>As I mentioned in my previous article (<A=20
            =
href=3D"http://www.codeproject.com/csharp/CSharpRipper.asp">C Sharp=20
            MP3 Compressor</A>), I offer now a Windows Media Audio (WMA) =

            compressor. This time I used managed C++ instead of C# in =
order to=20
            avoid the translation of interfaces and structures of the =
Windows=20
            Media Format SDK (WMF SDK). Microsoft has provided very =
limited=20
            managed support for their Windows Media SDKs (e.g. for the =
Windows=20
            Media Services SDK), but not for the WMF SDK. I think that =
Microsoft=20
            will logically include managed support for their WMF SDK in =
future=20
            versions, that's why I decided to avoid doing any =
translation. What=20
            I did was to create managed C++ classes that use some =
unmanaged=20
            classes, and have those unmanaged classes interact directly =
with the=20
            various Windows Media Format objects and interfaces.</P>
            <P>In this work, there is code from the article <A=20
            href=3D"http://www.codeproject.com/cs/media/cswavplay.asp">A =
low level=20
            audio player in C#</A> by <A=20
            =
href=3D"http://www.codeproject.com/script/profile/whos_who.asp?id=3D90428=
">Ianier=20
            Munoz</A>.</P>
            <H2>Background</H2>
            <P>If you have never looked into the WMF SDK before, it is =
advisable=20
            that you take a look at the <A=20
            =
href=3D"http://msdn.microsoft.com/windowsmedia/downloads/default.aspx"=20
            target=3D_blank>Windows Media Format SDK</A> documentation =
for better=20
            understanding this article.</P>
            <P>The following diagram represents the steps to create an =
Advanced=20
            Systems Format stream (ASF: the container format for Windows =
Media=20
            Audio and Windows Media Video-based content) using the WMF =
SDK:</P>
            <P><IMG height=3D323 alt=3D"Writing ASF Streams"=20
            =
src=3D"http://www.codeproject.com/managedcpp/WmaCompressor/WmaWrite.gif" =

            width=3D394></P>
            <P><A name=3DFigure1>Figure 1</A>: Writing ASF Streams.</P>
            <P>This diagram shows how to create ASF streams using a =
custom=20
            "Writer Sink". Custom writer sinks are needed for writing =
the=20
            resulting ASF stream to any kind of stream (in this case, =
any class=20
            derived from <CODE>System.IO.Stream</CODE>). As the diagram =
shows,=20
            the process is relatively simple. For more details about ASF =

            creation, you can see <A=20
            =
href=3D"http://msdn.microsoft.com/library/en-us/wmform/htm/writingasffile=
s.asp"=20
            target=3D_blank>Writing ASF Files</A> and <A=20
            =
href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library/en-u=
s/wmform/htm/usingcustomsinks.asp"=20
            target=3D_blank>Using Custom Sinks</A> in the <A=20
            =
href=3D"http://msdn.microsoft.com/library/default.asp?url=3D/library/en-u=
s/wmform/htm/introducingwindowsmediaformat.asp"=20
            target=3D_blank>Windows Media Format SDK</A> =
documentation.</P>
            <H2>The compressor</H2>
            <P>The following figure is a simplified class diagram, which =

            describes the managed version of the WMA compressor:</P>
            <P><IMG height=3D305=20
            alt=3D"Windows Media Audio Compressor: Managed class =
diagram"=20
            =
src=3D"http://www.codeproject.com/managedcpp/WmaCompressor/ManClass.jpg" =

            width=3D600></P>
            <P><A name=3DFigure2>Figure 2</A>: Windows Media Audio =
Compressor:=20
            Managed class diagram.</P>
            <P>The main class is <CODE>WmaWriter</CODE>, which interacts =
with=20
            the WMF SDK through unmanaged wrapper classes. It also acts =
as the=20
            sink object so the buffers received by its <CODE>Write =
</CODE>method=20
            are sent to the WMF writer object, which in turn sends back =
the=20
            compressed buffers through the sink interface. Finally, =
those=20
            buffers are written to the destination stream. =
<CODE>WmaWriter=20
            </CODE>receives the profile information through the class=20
            <CODE>WmaWriterProfile</CODE>, which represents the WMF=20
            <CODE>IWMProfile</CODE>.</P>
            <P><CODE>WmaWriterProfileManger </CODE>is a static class =
that=20
            contains some methods to handle profile creation and =
information. It=20
            also contains an array of <CODE>WmaWriterProfile</CODE> =
instances=20
            whose values represent the WMF System Profiles (audio only). =
This=20
            list of profiles should be enough for most purposes, but =
other=20
            profiles could also be created.</P>
            <P><CODE>ManBuffer</CODE> is a utility class for interfacing =
with=20
            the WMF SDK. It is just a managed implementation of buffer =
objects=20
            that implement <CODE>INSSBuffer</CODE>. Finally,=20
            <CODE>ProfileManager</CODE> is a utility class that creates =
and=20
            holds the WMF Profile Manager =
(<CODE>IWMProfileManager</CODE>).</P>
            <P>If the WMF SDK was ported to managed code, this =
compressor could=20
            be implemented as shown in <A=20

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -