Changeset 1902

Show
Ignore:
Timestamp:
09/19/10 05:00:27 (14 years ago)
Author:
jwoithe
Message:

MOTU: Create a define (USE_PORTGROUPS) which if defined will switch to the new PortGroups? methods of identifying audio streams in data packets. This is currently not defined, meaning the old PortEntry? method continues to be used by default.
MOTU: Make MotuDevice::getEventSize aware of the PortGroups? mechanism when necessary.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/motu/motu_avdevice.cpp

    r1892 r1902  
    5555 
    5656#include <libraw1394/csr.h> 
     57 
     58// FIXME: this allows for easy switching between the old PortEntry and 
     59// new PortEntryGroup methods of identifying audio streams in the iso 
     60// packets sent to/from the MOTU interfaces.  Leave undefined to use 
     61// the old method. 
     62// 
     63// #define USE_PORTGROUPS 
     64 
    5765 
    5866namespace Motu { 
     
    14851493 
    14861494    // Add audio capture ports 
    1487 #define USEOLD 
    1488 #ifdef USEOLD 
     1495#ifndef USE_PORTGROUPS 
    14891496    if (!addDirPorts(Streaming::Port::E_Capture, samp_freq, optical_in_mode_a, optical_in_mode_b)) { 
    14901497        return false; 
     
    15491556 
    15501557    // Add audio playback ports 
    1551 #ifdef USEOLD 
     1558#ifndef USE_PORTGROUPS 
    15521559    if (!addDirPorts(Streaming::Port::E_Playback, samp_freq, optical_out_mode_a, optical_out_mode_b)) { 
    15531560        return false; 
     
    19601967unsigned int flags = 0; 
    19611968unsigned int port_flags; 
     1969const DevicePropertyEntry *devprop = &DevicesProperty[m_motu_model-1]; 
    19621970 
    19631971    getOpticalMode(direction, &optical_mode_a, &optical_mode_b); 
     
    19851993    // Don't test for padding port flag here since we need to include such 
    19861994    // pseudo-ports when calculating the event size. 
    1987     for (i=0; i < DevicesProperty[m_motu_model-1].n_port_entries; i++) { 
    1988         port_flags = DevicesProperty[m_motu_model-1].port_entry[i].port_flags; 
     1995#ifndef USE_PORTGROUPS 
     1996    for (i=0; i < devprop->n_port_entries; i++) { 
     1997        port_flags = devprop->port_entry[i].port_flags; 
    19891998        /* Make sure the optical port tests return true for devices without 
    19901999         * one or both optical ports. 
     
    20032012        } 
    20042013    } 
     2014#else 
     2015    for (i=0; i<devprop->n_portgroup_entries; i++) { 
     2016        unsigned int portgroup_flags = devprop->portgroup_entry[i].flags; 
     2017        /* For devices without one or more optical ports, ensure the tests 
     2018         * on the optical ports always returns "true". 
     2019         */ 
     2020        if (optical_a_mode == MOTU_OPTICAL_MODE_NONE) { 
     2021            portgroup_flags |= MOTU_PA_OPTICAL_ANY; 
     2022        } 
     2023        if (optical_b_mode == MOTU_OPTICAL_MODE_NONE) { 
     2024            portgroup_flags |= MOTU_PA_MK3_OPT_B_ANY; 
     2025        } 
     2026        if (( portgroup_flags & dir ) && 
     2027            ( portgroup_flags & MOTU_PA_RATE_MASK & flags ) && 
     2028            ( portgroup_flags & MOTU_PA_OPTICAL_MASK & flags ) && 
     2029            ( portgroup_flags & MOTU_PA_MK3_OPT_B_MASK & flags )) { 
     2030            size += 3*devprop->portgroup_entry[i].n_channels; 
     2031        } 
     2032    } 
     2033#endif 
    20052034 
    20062035    // Finally round size up to the next quadlet boundary