425 | | // NOTE: currently in the generic AV/C unit |
---|
426 | | // bool |
---|
427 | | // Plug::discoverStreamFormat() |
---|
428 | | // { |
---|
429 | | // ExtendedStreamFormatCmd extStreamFormatCmd = |
---|
430 | | // setPlugAddrToStreamFormatCmd( ExtendedStreamFormatCmd::eSF_ExtendedStreamFormatInformationCommand ); |
---|
431 | | // extStreamFormatCmd.setVerbose( getDebugLevel() ); |
---|
432 | | // |
---|
433 | | // if ( !extStreamFormatCmd.fire() ) { |
---|
434 | | // debugError( "stream format command failed\n" ); |
---|
435 | | // return false; |
---|
436 | | // } |
---|
437 | | // |
---|
438 | | // if ( ( extStreamFormatCmd.getStatus() == ExtendedStreamFormatCmd::eS_NoStreamFormat ) |
---|
439 | | // || ( extStreamFormatCmd.getStatus() == ExtendedStreamFormatCmd::eS_NotUsed ) ) |
---|
440 | | // { |
---|
441 | | // debugOutput( DEBUG_LEVEL_VERBOSE, |
---|
442 | | // "No stream format information available\n" ); |
---|
443 | | // return true; |
---|
444 | | // } |
---|
445 | | // |
---|
446 | | // if ( !extStreamFormatCmd.getFormatInformation() ) { |
---|
447 | | // debugWarning( "No stream format information for plug found -> skip\n" ); |
---|
448 | | // return true; |
---|
449 | | // } |
---|
450 | | // |
---|
451 | | // if ( extStreamFormatCmd.getFormatInformation()->m_root |
---|
452 | | // != FormatInformation::eFHR_AudioMusic ) |
---|
453 | | // { |
---|
454 | | // debugWarning( "Format hierarchy root is not Audio&Music -> skip\n" ); |
---|
455 | | // return true; |
---|
456 | | // } |
---|
457 | | // |
---|
458 | | // FormatInformation* formatInfo = |
---|
459 | | // extStreamFormatCmd.getFormatInformation(); |
---|
460 | | // FormatInformationStreamsCompound* compoundStream |
---|
461 | | // = dynamic_cast< FormatInformationStreamsCompound* > ( |
---|
462 | | // formatInfo->m_streams ); |
---|
463 | | // if ( compoundStream ) { |
---|
464 | | // m_samplingFrequency = |
---|
465 | | // compoundStream->m_samplingFrequency; |
---|
466 | | // debugOutput( DEBUG_LEVEL_VERBOSE, |
---|
467 | | // "%s plug %d uses " |
---|
468 | | // "sampling frequency %d, nr of stream infos = %d\n", |
---|
469 | | // getName(), |
---|
470 | | // m_id, |
---|
471 | | // m_samplingFrequency, |
---|
472 | | // compoundStream->m_numberOfStreamFormatInfos ); |
---|
473 | | // |
---|
474 | | // for ( int i = 1; |
---|
475 | | // i <= compoundStream->m_numberOfStreamFormatInfos; |
---|
476 | | // ++i ) |
---|
477 | | // { |
---|
478 | | // ClusterInfo* clusterInfo = |
---|
479 | | // const_cast<ClusterInfo*>( getClusterInfoByIndex( i ) ); |
---|
480 | | // |
---|
481 | | // if ( !clusterInfo ) { |
---|
482 | | // debugError( "No matching cluster " |
---|
483 | | // "info found for index %d\n", i ); |
---|
484 | | // return false; |
---|
485 | | // } |
---|
486 | | // StreamFormatInfo* streamFormatInfo = |
---|
487 | | // compoundStream->m_streamFormatInfos[ i - 1 ]; |
---|
488 | | // |
---|
489 | | // debugOutput( DEBUG_LEVEL_VERBOSE, |
---|
490 | | // "number of channels = %d, stream format = %d\n", |
---|
491 | | // streamFormatInfo->m_numberOfChannels, |
---|
492 | | // streamFormatInfo->m_streamFormat ); |
---|
493 | | // |
---|
494 | | // int nrOfChannels = clusterInfo->m_nrOfChannels; |
---|
495 | | // if ( streamFormatInfo->m_streamFormat == |
---|
496 | | // FormatInformation::eFHL2_AM824_MIDI_CONFORMANT ) |
---|
497 | | // { |
---|
498 | | // // 8 logical midi channels fit into 1 channel |
---|
499 | | // nrOfChannels = ( ( nrOfChannels + 7 ) / 8 ); |
---|
500 | | // } |
---|
501 | | // // sanity check |
---|
502 | | // if ( nrOfChannels != streamFormatInfo->m_numberOfChannels ) |
---|
503 | | // { |
---|
504 | | // debugWarning( "Number of channels " |
---|
505 | | // "mismatch: '%s' plug discovering reported " |
---|
506 | | // "%d channels for cluster '%s', while stream " |
---|
507 | | // "format reported %d\n", |
---|
508 | | // getName(), |
---|
509 | | // nrOfChannels, |
---|
510 | | // clusterInfo->m_name.c_str(), |
---|
511 | | // streamFormatInfo->m_numberOfChannels); |
---|
512 | | // } |
---|
513 | | // clusterInfo->m_streamFormat = streamFormatInfo->m_streamFormat; |
---|
514 | | // |
---|
515 | | // debugOutput( DEBUG_LEVEL_VERBOSE, |
---|
516 | | // "%s plug %d cluster info %d ('%s'): " |
---|
517 | | // "stream format %d\n", |
---|
518 | | // getName(), |
---|
519 | | // m_id, |
---|
520 | | // i, |
---|
521 | | // clusterInfo->m_name.c_str(), |
---|
522 | | // clusterInfo->m_streamFormat ); |
---|
523 | | // } |
---|
524 | | // } |
---|
525 | | // |
---|
526 | | // FormatInformationStreamsSync* syncStream |
---|
527 | | // = dynamic_cast< FormatInformationStreamsSync* > ( |
---|
528 | | // formatInfo->m_streams ); |
---|
529 | | // if ( syncStream ) { |
---|
530 | | // m_samplingFrequency = |
---|
531 | | // syncStream->m_samplingFrequency; |
---|
532 | | // debugOutput( DEBUG_LEVEL_VERBOSE, |
---|
533 | | // "%s plug %d is sync stream with sampling frequency %d\n", |
---|
534 | | // getName(), |
---|
535 | | // m_id, |
---|
536 | | // m_samplingFrequency ); |
---|
537 | | // } |
---|
538 | | // |
---|
539 | | // |
---|
540 | | // if ( !compoundStream && !syncStream ) |
---|
541 | | // { |
---|
542 | | // debugError( "Unsupported stream format\n" ); |
---|
543 | | // return false; |
---|
544 | | // } |
---|
545 | | // |
---|
546 | | // return true; |
---|
547 | | // } |
---|
548 | | // |
---|
549 | | // bool |
---|
550 | | // Plug::discoverSupportedStreamFormats() |
---|
551 | | // { |
---|
552 | | // ExtendedStreamFormatCmd extStreamFormatCmd = |
---|
553 | | // setPlugAddrToStreamFormatCmd( |
---|
554 | | // ExtendedStreamFormatCmd::eSF_ExtendedStreamFormatInformationCommandList); |
---|
555 | | // extStreamFormatCmd.setVerbose( getDebugLevel() ); |
---|
556 | | // |
---|
557 | | // int i = 0; |
---|
558 | | // bool cmdSuccess = false; |
---|
559 | | // |
---|
560 | | // do { |
---|
561 | | // extStreamFormatCmd.setIndexInStreamFormat( i ); |
---|
562 | | // extStreamFormatCmd.setCommandType( AVCCommand::eCT_Status ); |
---|
563 | | // cmdSuccess = extStreamFormatCmd.fire(); |
---|
564 | | // if ( cmdSuccess |
---|
565 | | // && ( extStreamFormatCmd.getResponse() |
---|
566 | | // == AVCCommand::eR_Implemented ) ) |
---|
567 | | // { |
---|
568 | | // FormatInfo formatInfo; |
---|
569 | | // formatInfo.m_index = i; |
---|
570 | | // bool formatInfoIsValid = true; |
---|
571 | | // |
---|
572 | | // FormatInformationStreamsSync* syncStream |
---|
573 | | // = dynamic_cast< FormatInformationStreamsSync* > |
---|
574 | | // ( extStreamFormatCmd.getFormatInformation()->m_streams ); |
---|
575 | | // if ( syncStream ) { |
---|
576 | | // formatInfo.m_samplingFrequency = |
---|
577 | | // syncStream->m_samplingFrequency; |
---|
578 | | // formatInfo.m_isSyncStream = true ; |
---|
579 | | // } |
---|
580 | | // |
---|
581 | | // FormatInformationStreamsCompound* compoundStream |
---|
582 | | // = dynamic_cast< FormatInformationStreamsCompound* > |
---|
583 | | // ( extStreamFormatCmd.getFormatInformation()->m_streams ); |
---|
584 | | // if ( compoundStream ) { |
---|
585 | | // formatInfo.m_samplingFrequency = |
---|
586 | | // compoundStream->m_samplingFrequency; |
---|
587 | | // formatInfo.m_isSyncStream = false; |
---|
588 | | // for ( int j = 0; |
---|
589 | | // j < compoundStream->m_numberOfStreamFormatInfos; |
---|
590 | | // ++j ) |
---|
591 | | // { |
---|
592 | | // switch ( compoundStream->m_streamFormatInfos[j]->m_streamFormat ) { |
---|
593 | | // case AVC1394_STREAM_FORMAT_AM824_IEC60968_3: |
---|
594 | | // formatInfo.m_audioChannels += |
---|
595 | | // compoundStream->m_streamFormatInfos[j]->m_numberOfChannels; |
---|
596 | | // break; |
---|
597 | | // case AVC1394_STREAM_FORMAT_AM824_MULTI_BIT_LINEAR_AUDIO_RAW: |
---|
598 | | // formatInfo.m_audioChannels += |
---|
599 | | // compoundStream->m_streamFormatInfos[j]->m_numberOfChannels; |
---|
600 | | // break; |
---|
601 | | // case AVC1394_STREAM_FORMAT_AM824_MIDI_CONFORMANT: |
---|
602 | | // formatInfo.m_midiChannels += |
---|
603 | | // compoundStream->m_streamFormatInfos[j]->m_numberOfChannels; |
---|
604 | | // break; |
---|
605 | | // default: |
---|
606 | | // formatInfoIsValid = false; |
---|
607 | | // debugWarning("unknown stream format (0x%02x) for channel " |
---|
608 | | // "(%d)\n", |
---|
609 | | // compoundStream->m_streamFormatInfos[j]->m_streamFormat, |
---|
610 | | // j ); |
---|
611 | | // } |
---|
612 | | // } |
---|
613 | | // } |
---|
614 | | // |
---|
615 | | // if ( formatInfoIsValid ) { |
---|
616 | | // flushDebugOutput(); |
---|
617 | | // debugOutput( DEBUG_LEVEL_VERBOSE, |
---|
618 | | // "[%s:%d] formatInfo[%d].m_samplingFrequency " |
---|
619 | | // "= %d\n", |
---|
620 | | // getName(), m_id, |
---|
621 | | // i, formatInfo.m_samplingFrequency ); |
---|
622 | | // debugOutput( DEBUG_LEVEL_VERBOSE, |
---|
623 | | // "[%s:%d] formatInfo[%d].m_isSyncStream = %d\n", |
---|
624 | | // getName(), m_id, |
---|
625 | | // i, formatInfo.m_isSyncStream ); |
---|
626 | | // debugOutput( DEBUG_LEVEL_VERBOSE, |
---|
627 | | // "[%s:%d] formatInfo[%d].m_audioChannels = %d\n", |
---|
628 | | // getName(), m_id, |
---|
629 | | // i, formatInfo.m_audioChannels ); |
---|
630 | | // debugOutput( DEBUG_LEVEL_VERBOSE, |
---|
631 | | // "[%s:%d] formatInfo[%d].m_midiChannels = %d\n", |
---|
632 | | // getName(), m_id, |
---|
633 | | // i, formatInfo.m_midiChannels ); |
---|
634 | | // m_formatInfos.push_back( formatInfo ); |
---|
635 | | // flushDebugOutput(); |
---|
636 | | // } |
---|
637 | | // } |
---|
638 | | // |
---|
639 | | // ++i; |
---|
640 | | // } while ( cmdSuccess && ( extStreamFormatCmd.getResponse() |
---|
641 | | // == ExtendedStreamFormatCmd::eR_Implemented ) ); |
---|
642 | | // |
---|
643 | | // return true; |
---|
644 | | // } |
---|
645 | | |
---|
646 | | |
---|