8 Abstractions For Programming

Multimedia Computing · Unit 8 · 5 hrs

Abstractions for programming

Exam-focused notes for Abstractions for programming (Multimedia Computing, CSC330): what the TU syllabus asks and how it has actually been tested, with 2 solved past questions from this unit.

Abstractions for programming in short

Programming continuous media, audio and video that unfold over time, can be approached at very different levels of detail, from raw hardware access up to fully object-oriented environments. This chapter works through that hierarchy of abstraction levels, the role each level plays, and how object-oriented techniques in particular are used to model multimedia data and devices.

Abstractions for programming: notes

Abstractions Levels

Programming for multimedia can be organised into a hierarchy of abstraction levels, each trading off detail for ease of use. From the bottom, a device is not itself part of the operating system, but is directly accessible to every component and application above it; device drivers are the implementation of device access and scheduling that sits just above the raw hardware; libraries are the simplest true abstraction level, bundling the functions needed to control the corresponding hardware; system software provides operating-system-level abstractions for continuous media; toolkits offer a simpler, uniform interface above system software; higher programming languages embed media-aware constructs directly into general-purpose code; and, at the top, an object-oriented environment gives the programmer the most flexibility, encapsulating multimedia data as objects with methods and properties. A multimedia application is not restricted to any one of these levels: depending on what it needs, it may access the hardware directly, call a library, or work entirely through an object-oriented framework.

Libraries

Processing continuous media is usually programmed through a library, a function or set of functions for controlling the corresponding hardware, and libraries are typically supplied together with the hardware they control; a large number of different audio and video cards, for instance, each came with their own library. Libraries differ in their degree of abstraction, and while they are very useful at the operating-system level, there is no universal agreement over which set of functions is best for a given kind of device. The result is a variety of interfaces and a correspondingly wide variety of different libraries in practical use.

System Software Toolkits

System software interacts directly with the hardware and manages it efficiently, and offers two important abstractions for continuous media. Under data as time capsules, each Logical Data Unit (LDU) carries a time capsule alongside it: its data type, its actual value, and its valid life span. This is especially useful for video, where each frame has a valid span of about 40 ms, and it lets the system implement VCR-style functions, fast forward, slow forward and rewind, either by changing an LDU's presentation life span or by skipping or repeating LDUs outright. Under data as streams, a stream denotes the continuous flow of audio or video data, established between one or more sources and one or more sinks, in much the way a connection is set up in a networked environment; operations such as play, fast forward, rewind and stop act on the stream as a whole. In Microsoft Windows, the Media Control Interface (MCI) exposes exactly this stream abstraction, giving access to continuous media streams and the devices behind them.

Toolkits sit a level above system software, offering a simpler programming approach for controlling audio and video processing. A toolkit abstracts away the physical layer, offers a uniform interface across different continuous-media devices, introduces a client-server paradigm, and hides the underlying process structure from the programmer; because toolkits represent an interface at the system-software level, they can themselves be embedded into a programming language or an object-oriented environment.

What this unit covers

  • Abstractions Levels
  • Libraries
  • System Software Toolkits
  • Higher Programming Languages
  • Object–Oriented Approaches

Abstractions Levels

2081 · 10 marks

Explain the abstraction levels of programming use in multimedia system with diagram.[10]

Show solved answer

Abstraction Levels of Programming in Multimedia Systems

Introduction

Abstraction levels in programming define different approaches with a varying degree of detail for representing, accessing, and manipulating data in a multimedia system. A multimedia application may access each level depending on its requirements. These levels range from direct hardware access at the lowest level to high-level object-oriented environments at the highest level.


Diagram: Abstraction Levels in Multimedia Programming

+--------------------------------------------------+
|        Object-Oriented Environment               |  <-- Highest Level
+--------------------------------------------------+
|        Higher Programming Languages (HLL)        |
|     (Media as Types / Media as Files)            |
+--------------------------------------------------+
|              Toolkits                            |
+--------------------------------------------------+
|           System Software                        |
|   (Data as Time Capsules / Data as Streams)      |
+--------------------------------------------------+
|              Libraries                           |
+--------------------------------------------------+
|            Device Drivers                        |
+--------------------------------------------------+
|              Hardware / Device                   |  <-- Lowest Level
+--------------------------------------------------+
         ^
         |
  Multimedia Application can access any level

Detailed Explanation of Each Level

1. Hardware / Device Level

  • A device is not part of the operating system but is directly accessible to every component and application.
  • This is the lowest level where physical audio/video hardware (sound cards, cameras, microphones) resides.
  • Direct hardware access is rarely used by application programmers due to complexity.

2. Device Drivers

  • Device drivers are simply the implementation of device access and scheduling.
  • They act as a bridge between the hardware and the software layers above.
  • They handle low-level communication with hardware devices and expose a simplified interface to upper layers.

3. Libraries

  • A library is the simplest abstraction level and includes the necessary functions for controlling the corresponding hardware with specific device access operations.
  • The processing of continuous media (audio and video) is based on a function or set of functions embedded into libraries.
  • Libraries are provided together with the corresponding hardware (e.g., audio/video hardware cards come with their own libraries).
  • Libraries differ in their degree of abstraction.
  • Libraries are very useful at the operating system level; however, there is no universal agreement over which functions are best, leading to a variety of interfaces and different libraries.

4. System Software

System software directly interacts with computer hardware and provides efficient management. At this level, two important abstractions are used:

a) Data as Time Capsules

  • Each Logical Data Unit (LDU) carries its time capsule along with:
    • Data type
    • Actual value
    • Valid life span
  • This concept is especially useful for video, where each frame has a valid span of 40 ms.
  • Presentation rate can be changed for VCR functions (fast forward, slow forward, rewind) by:
    • Changing the presentation life span of an LDU
    • Skipping or repeating LDUs

b) Data as Streams

  • A stream denotes the continuous flow of audio and video text.
  • The stream is established between source(s) and sink(s), equivalent to a connection setup in a networked environment.
  • Operations on a stream include: play, fast forward, rewind, and stop.
  • In Microsoft Windows, the Media Control Interface (MCI) provides the interface for processing multimedia data, allowing access to continuous media streams and their corresponding devices.

5. Toolkits

  • Toolkits provide a simpler approach than direct system software interface for controlling audio and video data processing.
  • Toolkits are used to:
    • Abstract from the actual physical layer
    • Allow a uniform interface for communication with all different devices of continuous media
    • Introduce the client-server paradigm
    • Hide process structures
  • Toolkits represent interfaces at the system software level and can be embedded into programming languages or object-oriented environments.

6. Higher Programming Languages (HLL)

  • In HLL, the processing of continuous data is influenced by a group of similarly constructed functions.
  • These calls are mostly hardware and driver-independent.
  • Their integration in HLLs leads to:
    • Better abstraction
    • Better programming style
    • Increased productivity

Two important concepts at this level are:

a) Media as Types

  • Data types for video and audio are defined (similar to how character is a type for text).
  • A program can address media through functions and sometimes directly through operators.
  • Operations include: copy, compare, delete, create, read from file, or store.
  • The smallest unit can be the LDU.

b) Media as Files

  • Continuous media is treated as files rather than data types.
  • Media streams are read and written as file-based continuous data.
  • Continuous data are often played from functions based on sources of non-persistent data (e.g., microphone and camera).

7. Object-Oriented Environment (Highest Level)

  • An object-oriented environment provides the most flexibility for programmers.
  • Multimedia data (audio, video, images) are encapsulated as objects with methods and properties.
  • This level supports reusability, modularity, and extensibility in multimedia application development.

Summary Table

LevelAbstractionExample
HardwareLowestSound card, Camera
Device DriversLowAudio driver
LibrariesMedium-LowHardware-specific API
System SoftwareMediumMCI, Streams, LDU
ToolkitsMedium-HighMultimedia toolkits
HLLHighMedia as Types/Files
Object-OrientedHighestOOP multimedia frameworks

Conclusion

The abstraction levels of programming in multimedia systems provide a structured hierarchy from raw hardware access to high-level object-oriented programming. A multimedia application may access each level depending on the requirement, but higher levels offer greater flexibility, portability, and ease of programming, while lower levels offer more direct control over hardware resources.

Open this answer on its own page →

2080 · 5 marks

Explain the abstraction levels of programming. [5]

Abstraction levels in programming define different approaches with a varying degree of detail for representing, accessing, and manipulating data. A multimedia application may access each level depending on its requirements. The levels range from low-level hardware access to high-level object-orie...

Open this answer on its own page →