Playback MP3 code under WinCE

Source: Internet
Author: User

// I have successfully runCode:

# Include "stdafx. H"
# Include <dshow. h>
# Include <streams. h>

# Pragma comment (Lib, "ole32.lib ")
# Pragma comment (Lib, "strmiids. lib ")

Void testmp3 (void );

Int winapi winmain (hinstance,
Hinstance hprevinstance,
Lptstr lpcmdline,
Int ncmdshow)
{
// Todo: Place code here.
Testmp3 ();
Return 0;
}
Void testmp3 ()
{
Igraphbuilder * pgraph;
/* Pointer to the filter graph */
Imediacontrol * pmediacontrol;
/* Pointer to the mediacontrol object */
/* Initialize, Program Run it once at startup */
Coinitialize (null );
/*************************************** ***********************************/
/* The following programs call each time they play an MP3 (or other format) file */
/* Create a filter graph manager */
Cocreateinstance (clsid_filtergraph, null, clsctx_inproc, iid_igraphbuilder, (void **) & pgraph );
Pgraph-> QueryInterface (iid_imediacontrol, (void **) & pmediacontrol );
/* Connect to the filter required for playing the specified file */
Pgraph-> renderfile (L "// test.mp3", null );
/* Start playing the specified file */
Pmediacontrol-> Run ();
/* The file is played in an independent thread in DirectShow. Wait here */
MessageBox (null, l "click [OK] To End playing", l "play MP3", mb_ OK );
Pmediacontrol-> stop ();
/* Stop playing */
Pmediacontrol-> release ();
/* Release the object */
Pgraph-> release ();
/*************************************** ***********************************/
/* Call when the program ends */
Couninitialize ();
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.