Windows Media Foundation Architecture


Above diagram shows a high-level view of the Media Foundation architecture.

Media Foundation provides two distinct programming models. The first model, shown on the left side of the diagram, uses an end-to-end pipeline for media data. The application initializes the pipeline—for example, by providing the URL of a file to play—and then calls methods to control streaming. In the second model, shown on the right side of the diagram, the application either pulls data from a source, or pushes it to a destination (or both). This model is particularly useful if you need to process the data, because the application has direct access to the data stream.


Primitives and Platform
Starting from the bottom of the diagram, the primitives are helper objects used throughout the Media Foundation API:

  • Attributes are a generic way to store information inside an object, as a list of key/value pairs.
  • Media Types describe the format of a media data stream.
  • Media Buffers hold chunks of media data, such as video frames and audio samples, and are used to transport data between objects.
  • Media Samples are containers for media buffers. They also contain metadata about the buffers, such as time stamps.
The Media Foundation Platform APIs provide some core functionality that is used by the Media Foundation pipeline, such as asynchronous callbacks and work queues. Certain applications might need to call these APIs directly; also, you will need them if you implement a custom source, transform, or sink for Media Foundation.

Media Pipeline

The media pipeline contains three types of object that generate or process media data:
  • Media Sources introduce data into the pipeline. A media source might get data from a local file, such as a video file; from a network stream; or from a hardware capture device.
  • Media Foundation Transforms (MFTs) process data from a stream. Encoders and decoders are implemented as MFTs.
  • Media Sinks consume the data; for example, by showing video on the display, playing audio, or writing the data to a media file.
Third parties can implement their own custom sources, sinks, and MFTs; for example, to support new media file formats.

The Media Session controls the flow of data through the pipeline, and handles tasks such as quality control, audio/video synchronization, and responding to format changes.

Source Reader and Sink Writer

The Source Reader and Sink Writer provide an alternative way to use the basic Media Foundation components (media sources, transforms, and media sinks). The source reader hosts a media source and zero or more decoders, while the sink writer hosts a media sink and zero or more encoders. You can use the source reader to get compressed or uncompressed data from a media source, and use the sink writer to encode data and send the data to a media sink.

Windows 8 App Platform Architecture


Using SMS in your Application

Android offers full access to SMS functionality from within your applications with the SMSManager. Using the SMS Manager, you can replace the native SMS application or create new applications that send text messages, react to incoming texts, or use SMS as a data transport layer. 

Sending SMS Messages:

SMS messaging in Android is handled by the SmsManager. You can get a reference to the SMS Manager using the static method SmsManger.getDefault, as shown in the snippet below.

SmsManager smsManager = SmsManager.getDefault(); 


To send SMS messages, your applications require the SEND_SMS permission. To request this permission, add it to the manifest using a uses-permission tag, as shown below: 

<uses-permission android:name=”android.permission.SEND_SMS”/>

Sending Text Messages:

To send a text message, use sendTextMessage from the SMS Manager, passing in the address (phone number) of your recipient and the text message you want to send, as shown in the snippet below: 

String sendTo = “5551234”;
String myMessage = “Sample SMS Text!”; 
smsManager.sendTextMessage(sendTo, null, myMessage, null, null); 

The second parameter can be used to specify the SMS service center to use; entering null as shown in the previous snippet uses the default service center for your carrier. 

The final two parameters let you specify Intents to track the transmission and successful delivery of your messages. 


To react to these Intents, create and register Broadcast Receivers. 

Tracking and Confirming SMS Message Delivery:
To track the transmission and delivery success of your outgoing SMS messages, implement and register Broadcast Receivers that listen for the actions you specify when creating the Pending Intents you pass in to the sendTextMessage method. 

The first Pending Intent parameter, sentIntent, is fired when the message is either successfully sent or fails to send. The result code for the Broadcast Receiver that receives this Intent will be one of: 

❑ Activity.RESULT_OK to indicate a successful transmission. 
❑ SmsManager.RESULT_ERROR_GENERIC_FAILURE To indicate a nonspecific failure. 
❑ SmsManager.RESULT_ERROR_RADIO_OFF When the connection radio is turned off. 
❑ SmsManager.RESULT_ERROR_NULL_PDU To indicate a PDU failure. 


Listening for SMS Messages:

When a new SMS message is received by the device, a new broadcast Intent is fired with the android.provider.Telephony.SMS_RECEIVED action.
For an application to listen for SMS Intent broadcasts, it first needs to be have the RECEIVE_SMS permission granted. Request this permission by adding a uses-permission tag to the application manifest, as shown in the following snippet: 

<uses-permission android:name=”android.permission.RECEIVE_SMS”/> 


The SMS broadcast Intent includes the incoming SMS details. To extract the array of SmsMessage objects packaged within the SMS broadcast Intent bundle, use the pdu key to extract an array of SMS pdus, each of which represents an SMS message. To convert each pdu byte array into an SMS Message object, call SmsMessage.createFromPdu, passing in each byte array as shown in the snippet below: 

Bundle bundle = intent.getExtras(); 
if (bundle != null) 

          Object[] pdus = (Object[]) bundle.get(“pdus”); 
          SmsMessage[] messages = new SmsMessage[pdus.length]; 
          for (int i = 0; i < pdus.length; i++) 
                  messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]); 


Each SmsMessage object contains the SMS message details, including the originating address (phone number), time stamp, and the message body. 

To listen for incoming messages, register the Broadcast Receiver using an Intent Filter that listens for the android.provider.Telephony.SMS_RECEIVED

C/C++ Quiz

Android Architecture


What is Android?

  • Android is a software stack for mobile devices that includes an operating system, middleware and key applications.
  • Android is a mobile operating system running on the Linux kernel. It was initially developed by Android Inc., a firm later purchased by Google, and later by the Open Handset Alliance.
  • It allows developers to write managed code in the Java language, controlling the device via Google-developed Java libraries.
  • The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.