• About
    • About WebM
    • FAQ
    • Discuss
    • Supporters
  • Developer
    • Overview & Code Repos
    • Contribute
    • Submitting Patches
    • Code Reviews
    • Workflow
    • Conventions
    • Bug Reporting
    • Build Prerequisites
    • Repository Layout
    • Releases
    • Roadmap
    • Hardware
  • Docs
    • libvpx API
    • RFC 6386: VP8 Data Format
    • WebM Container Format
    • VP8 RTP Proposal (Draft)
    • Encoder Examples
    • Wiki
  • Tools
  • Licenses
  • Blog
  • Home >
  • Code >
  • Contribute >
  • Conventions

Code Conventions

Show Contents

  • Platform Specific Code
  • Whitespace
  • Naming
  • Inconsistencies

This page describes our coding conventions.

Platform Specific Code

Platform specific code should use the predominant coding convention for that platform. Basically, DirectShow code should look familar to a Windows coder, and QuickTime code should look familiar to an Apple coder. Otherwise, we follow the conventions described here.

Whitespace

Our whitespace rules are defined by the following astyle transform:

astyle --style=bsd --min-conditional-indent=0 --break-blocks \
       --pad-oper --pad-header --unpad-paren \
       --align-pointer=name --indent-preprocessor \
       --indent-labels "$@"

This boils down to:

  • Don’t use tabs.
  • Braces on their own line
  • Spaces around operators (+, - , * , / , , etc.) and after control statements (if, while, etc.)

Naming

  • Most identifiers should be lowercase_delimited
  • Macros and enum values should be UPPERCASE_DELIMITED
  • Typedefs should be postfixed with _t, but …
  • Prefer to use types directly rather than type.

Inconsistencies

The code is not always consistent with these conventions, for historical reasons. These inconsistencies should be resolved, not propagated. i.e., if you find something that’s named inconsistently, submit a patch fixing it. Some identifiers conform to these conventions but are spelled funny (e.g. de_quantize) as a result of some automatic transforms. You can submit patches fixing these as well.

About
  • About WebM
  • FAQ
  • Discuss
  • Supporters
More
  • Tools
  • Hardware
  • Licenses
  • Downloads
Developer
  • Overview
  • Contribute
  • Submitting Patches
  • Code Reviews
  • Workflow
  • Conventions
  • Bug Reporting
  • Build Prerequisites
  • Repository Layout
  • Releases
  • Roadmap
Docs
  • libvpx API
  • RFC 6386: VP8 Data Format
  • WebM Container Format
  • VP8 RTP Proposal (Draft)
  • Encoder Examples
  • Wiki
Copyright 2010 - 2013
The WebM Project
HTML5 Powered with CSS3 / Styling, and Semantics
Follow @WebM
webmaster@webmproject.org