[prev in list] [next in list] [prev in thread] [next in thread]
List: freebob-cvs
Subject: [Freebob-cvs] libfreebob/src/libfreebobavc avc_extended_subunit_info.h,NONE,1.1 avc_extended_subunit
From: Daniel Wagner <wagi () users ! sourceforge ! net>
Date: 2006-03-09 23:35:49
Message-ID: E1FHUfi-0001Tj-7H () mail ! sourceforge ! net
[Download RAW message or body]
Update of /cvsroot/freebob/libfreebob/src/libfreebobavc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29963/src/libfreebobavc
Modified Files:
avc_generic.cpp avc_extended_plug_info.cpp
avc_extended_cmd_generic.h avc_extended_cmd_generic.cpp
avc_definitions.h Makefile.am
Added Files:
avc_extended_subunit_info.h avc_extended_subunit_info.cpp
Log Message:
2006-03-10 Daniel Wagner <wagi@monom.org>
* src/libfreebobavc/Makefile.am: New files added.
* src/libfreebobavc/avc_extended_subunit_info.cpp: Likewise.
* src/libfreebobavc/avc_extended_subunit_info.h: Likewise
* src/libfreebobavc/avc_definitions.h: Several small improvements.
* src/libfreebobavc/avc_extended_cmd_generic.cpp: Likewise.
* src/libfreebobavc/avc_extended_cmd_generic.h: Likewise.
* src/libfreebobavc/avc_extended_plug_info.cpp: Likewise.
* src/libfreebobavc/avc_generic.cpp: Likewise.
Index: avc_extended_plug_info.cpp
===================================================================
RCS file: /cvsroot/freebob/libfreebob/src/libfreebobavc/avc_extended_plug_info.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** avc_extended_plug_info.cpp 28 Feb 2006 23:29:09 -0000 1.6
--- avc_extended_plug_info.cpp 9 Mar 2006 23:35:46 -0000 1.7
***************
*** 891,902 ****
switch ( getResponse() )
{
! case eR_Implemented:
! {
! BufferDeserialize de( resp->byte, sizeof( req ) );
! result = deserialize( de );
! }
! break;
! default:
! printf( "unexpected response received (0x%x)\n", getResponse() );
}
} else {
--- 891,908 ----
switch ( getResponse() )
{
! case eR_Implemented:
! {
! BufferDeserialize de( resp->byte, sizeof( req ) );
! result = deserialize( de );
! }
! break;
! case eR_Rejected:
! {
! BufferDeserialize de( resp->byte, sizeof( req ) );
! result = deserialize( de );
! }
! break;
! default:
! printf( "unexpected response received (0x%x)\n", getResponse() );
}
} else {
Index: avc_extended_cmd_generic.h
===================================================================
RCS file: /cvsroot/freebob/libfreebob/src/libfreebobavc/avc_extended_cmd_generic.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** avc_extended_cmd_generic.h 2 Mar 2006 00:41:38 -0000 1.4
--- avc_extended_cmd_generic.h 9 Mar 2006 23:35:46 -0000 1.5
***************
*** 224,229 ****
EPlugAddressMode plugAddressMode,
FunctionBlockPlugAddress& functionBlockPlugAddress );
! PlugAddress( EPlugDirection plugDirection,
! EPlugAddressMode plugAddressMode );
PlugAddress( const PlugAddress& pa );
--- 224,228 ----
EPlugAddressMode plugAddressMode,
FunctionBlockPlugAddress& functionBlockPlugAddress );
! PlugAddress( ); // undefined plug address
PlugAddress( const PlugAddress& pa );
--- NEW FILE: avc_extended_subunit_info.cpp ---
/* avc_extended_subunit_info.cpp
* Copyright (C) 2006 by Daniel Wagner
*
* This file is part of FreeBob.
*
* FreeBob is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* FreeBob is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FreeBob; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
*/
#include "avc_extended_subunit_info.h"
#include "serialize.h"
#include "ieee1394service.h"
#include <netinet/in.h>
#define NR_OF_PAGE_DATA 5
#define SIZE_OF_PAGE_ENTRY 5
ExtendedSubunitInfoPageData::ExtendedSubunitInfoPageData()
: IBusData()
, m_functionBlockType( 0xff )
, m_functionBlockId( 0xff )
, m_functionBlockSpecialPupose( eSP_NoSpecialPupose )
, m_noOfInputPlugs( 0xff )
, m_noOfOutputPlugs( 0xff )
{
}
ExtendedSubunitInfoPageData::~ExtendedSubunitInfoPageData()
{
}
bool
ExtendedSubunitInfoPageData::serialize( IOSSerialize& se )
{
se.write( m_functionBlockType, "ExtendedSubunitInfoPageData: function block type" \
); se.write( m_functionBlockId, "ExtendedSubunitInfoPageData: function block id" );
se.write( m_functionBlockSpecialPupose, "ExtendedSubunitInfoPageData: function \
block special purpose" ); se.write( m_noOfInputPlugs, "ExtendedSubunitInfoPageData: \
number of input plugs" ); se.write( m_noOfOutputPlugs, "ExtendedSubunitInfoPageData: \
number of output plugs" );
return true;
}
bool
ExtendedSubunitInfoPageData::deserialize( IISDeserialize& de )
{
de.read( &m_functionBlockType );
de.read( &m_functionBlockId );
de.read( &m_functionBlockSpecialPupose );
de.read( &m_noOfInputPlugs );
de.read( &m_noOfOutputPlugs );
return true;
}
ExtendedSubunitInfoPageData*
ExtendedSubunitInfoPageData::clone() const
{
return new ExtendedSubunitInfoPageData( *this );
}
//////////////////////////////////////////////
ExtendedSubunitInfoCmd::ExtendedSubunitInfoCmd( Ieee1394Service* ieee1394service )
: AVCCommand( ieee1394service, AVC1394_CMD_SUBUNIT_INFO )
, m_page( 0xff )
, m_fbType( eFBT_AllFunctinBlockType )
{
}
ExtendedSubunitInfoCmd::ExtendedSubunitInfoCmd( const ExtendedSubunitInfoCmd& rhs )
: AVCCommand( rhs )
, m_page( rhs.m_page )
, m_fbType( rhs.m_fbType )
{
for ( ExtendedSubunitInfoPageDataVector::const_iterator it =
rhs.m_infoPageDatas.begin();
it != rhs.m_infoPageDatas.end();
++it )
{
m_infoPageDatas.push_back( ( *it )->clone() );
}
}
ExtendedSubunitInfoCmd::~ExtendedSubunitInfoCmd()
{
for ( ExtendedSubunitInfoPageDataVector::iterator it =
m_infoPageDatas.begin();
it != m_infoPageDatas.end();
++it )
{
delete *it;
}
}
bool
ExtendedSubunitInfoCmd::serialize( IOSSerialize& se )
{
bool status = false;
status = AVCCommand::serialize( se );
status &= se.write( m_page, "ExtendedSubunitInfoCmd: page" );
status &= se.write( m_fbType, "ExtendedSubunitInfoCmd: function block type" );
for ( ExtendedSubunitInfoPageDataVector::const_iterator it =
m_infoPageDatas.begin();
it != m_infoPageDatas.end();
++it )
{
status &= ( *it )->serialize( se );
}
int startIndex = m_infoPageDatas.size() * SIZE_OF_PAGE_ENTRY;
int endIndex = SIZE_OF_PAGE_ENTRY * NR_OF_PAGE_DATA;
for ( int i = startIndex; i < endIndex; ++i ) {
byte_t dummy = 0xff;
se.write( dummy, "ExtendedSubunitInfoCmd: space fill" );
}
return status;
}
bool
ExtendedSubunitInfoCmd::deserialize( IISDeserialize& de )
{
bool status = false;
status = AVCCommand::deserialize( de );
status &= de.read( &m_page );
status &= de.read( &m_fbType );
for ( int i = 0; i < 5; ++i ) {
byte_t next;
de.peek( &next );
if ( next != 0xff ) {
ExtendedSubunitInfoPageData* infoPageData =
new ExtendedSubunitInfoPageData();
if ( !infoPageData->deserialize( de ) ) {
return false;
}
m_infoPageDatas.push_back( infoPageData );
} else {
return status;
}
}
return status;
}
bool
ExtendedSubunitInfoCmd::fire()
{
bool result = false;
#define STREAM_FORMAT_REQUEST_SIZE 20 // XXX random length
union UPacket {
quadlet_t quadlet[STREAM_FORMAT_REQUEST_SIZE];
unsigned char byte[STREAM_FORMAT_REQUEST_SIZE*4];
};
typedef union UPacket packet_t;
packet_t req;
packet_t* resp;
// initialize complete packet
memset( &req, 0xff, sizeof( req ) );
BufferSerialize se( req.byte, sizeof( req ) );
if ( !serialize( se ) ) {
printf( "ExtendedSubunitInfoCmd::fire: Could not serialize\n" );
return false;
}
if ( isVerbose() ) {
printf( "\n" );
printf( " idx type value\n" );
printf( "-------------------------------------\n" );
printf( " %02d ctype: 0x%02x\n", 0, req.byte[0] );
printf( " %02d subunit_type + subunit_id: 0x%02x\n", 1, req.byte[1] );
printf( " %02d opcode: 0x%02x\n", 2, req.byte[2] );
for ( int i = 3; i < STREAM_FORMAT_REQUEST_SIZE * 4; ++i ) {
printf( " %02d operand %2d: 0x%02x\n", i, i-3, \
req.byte[i] ); }
}
// reorder the bytes to the correct layout
for (int i = 0; i < STREAM_FORMAT_REQUEST_SIZE; ++i) {
req.quadlet[i] = ntohl( req.quadlet[i] );
}
if ( isVerbose() ) {
// debug output
puts("request:");
for (int i = 0; i < STREAM_FORMAT_REQUEST_SIZE; ++i) {
printf(" %2d: 0x%08x\n", i, req.quadlet[i]);
}
}
resp = reinterpret_cast<packet_t*>(
m_1394Service->transactionBlock( m_nodeId,
req.quadlet,
STREAM_FORMAT_REQUEST_SIZE ) );
if ( resp ) {
if ( isVerbose() ) {
// debug output
puts("response:");
for ( int i = 0; i < STREAM_FORMAT_REQUEST_SIZE; ++i ) {
printf( " %2d: 0x%08x\n", i, resp->quadlet[i] );
}
}
// reorder the bytes to the correct layout
for ( int i = 0; i < STREAM_FORMAT_REQUEST_SIZE; ++i ) {
resp->quadlet[i] = htonl( resp->quadlet[i] );
}
if ( isVerbose() ) {
// a more detailed debug output
printf( "\n" );
printf( " idx type value\n" );
printf( "-------------------------------------\n" );
printf( " %02d ctype: 0x%02x\n", 0, resp->byte[0] );
printf( " %02d subunit_type + subunit_id: 0x%02x\n", 1, resp->byte[1] );
printf( " %02d opcode: 0x%02x\n", 2, resp->byte[2] );
for ( int i = 3; i < STREAM_FORMAT_REQUEST_SIZE * 4; ++i ) {
printf( " %02d operand %2d: 0x%02x\n", i, i-3, \
resp->byte[i] ); }
}
// parse output
parseResponse( resp->byte[0] );
switch ( getResponse() )
{
case eR_Implemented:
{
BufferDeserialize de( resp->byte, sizeof( req ) );
result = deserialize( de );
break;
}
case eR_NotImplemented:
{
BufferDeserialize de( resp->byte, sizeof( req ) );
result = deserialize( de );
}
break;
default:
printf( "unexpected response received (0x%x)\n", getResponse() );
}
} else {
printf( "no response\n" );
}
return result;
}
Index: Makefile.am
===================================================================
RCS file: /cvsroot/freebob/libfreebob/src/libfreebobavc/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile.am 19 Jan 2006 00:21:39 -0000 1.2
--- Makefile.am 9 Mar 2006 23:35:46 -0000 1.3
***************
*** 19,46 ****
libfreebobavc_la_SOURCES = \
- avc_connect.h \
avc_connect.cpp \
! avc_definitions.h \
avc_definitions.cpp \
! avc_extended_cmd_generic.h \
avc_extended_cmd_generic.cpp \
! avc_extended_stream_format.h \
! avc_extended_stream_format.cpp \
! avc_extended_plug_info.h \
avc_extended_plug_info.cpp \
! avc_generic.h \
avc_generic.cpp \
! avc_plug_info.h \
avc_plug_info.cpp \
! avc_signal_source.h \
avc_signal_source.cpp \
! avc_unit_info.h \
! avc_unit_info.cpp \
! avc_subunit_info.h \
avc_subunit_info.cpp \
! serialize.h \
! serialize.cpp \
ieee1394service.h \
! ieee1394service.cpp
INCLUDES = $(LIBRAW1394_CFLAGS) $(LIBIEC61883_CFLAGS) $(LIBAVC1394_CFLAGS) \
--- 19,48 ----
libfreebobavc_la_SOURCES = \
avc_connect.cpp \
! avc_connect.h \
avc_definitions.cpp \
! avc_definitions.h \
avc_extended_cmd_generic.cpp \
! avc_extended_cmd_generic.h \
avc_extended_plug_info.cpp \
! avc_extended_plug_info.h \
! avc_extended_stream_format.cpp \
! avc_extended_stream_format.h \
! avc_extended_subunit_info.h \
! avc_extended_subunit_info.cpp \
avc_generic.cpp \
! avc_generic.h \
avc_plug_info.cpp \
! avc_plug_info.h \
avc_signal_source.cpp \
! avc_signal_source.h \
avc_subunit_info.cpp \
! avc_subunit_info.h \
! avc_unit_info.cpp \
! avc_unit_info.h \
! ieee1394service.cpp \
ieee1394service.h \
! serialize.cpp \
! serialize.h
INCLUDES = $(LIBRAW1394_CFLAGS) $(LIBIEC61883_CFLAGS) $(LIBAVC1394_CFLAGS) \
Index: avc_generic.cpp
===================================================================
RCS file: /cvsroot/freebob/libfreebob/src/libfreebobavc/avc_generic.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** avc_generic.cpp 26 Dec 2005 15:49:31 -0000 1.1.1.1
--- avc_generic.cpp 9 Mar 2006 23:35:46 -0000 1.2
***************
*** 149,153 ****
subunitTypeToString( subunit_type_t subunitType )
{
! if ( subunitType > sizeof( subunitTypeStrings ) ) {
return "unknown";
} else {
--- 149,157 ----
subunitTypeToString( subunit_type_t subunitType )
{
! if ( subunitType == AVCCommand::eST_Unit ) {
! return "Unit";
! }
! if ( subunitType > ( int ) ( sizeof( subunitTypeStrings )
! / sizeof( subunitTypeStrings[0] ) ) ) {
return "unknown";
} else {
Index: avc_extended_cmd_generic.cpp
===================================================================
RCS file: /cvsroot/freebob/libfreebob/src/libfreebobavc/avc_extended_cmd_generic.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** avc_extended_cmd_generic.cpp 2 Mar 2006 00:41:38 -0000 1.3
--- avc_extended_cmd_generic.cpp 9 Mar 2006 23:35:46 -0000 1.4
***************
*** 382,394 ****
}
! PlugAddress::PlugAddress( EPlugDirection plugDirection,
! EPlugAddressMode plugAddressMode )
! : m_plugDirection( plugDirection )
! , m_addressMode( plugAddressMode )
, m_plugAddressData( new UndefinedPlugAddress() )
{
}
-
PlugAddress::PlugAddress( const PlugAddress& pa )
: m_plugDirection( pa.m_plugDirection )
--- 382,392 ----
}
! PlugAddress::PlugAddress()
! : m_plugDirection( ePD_Undefined )
! , m_addressMode( ePAM_Undefined )
, m_plugAddressData( new UndefinedPlugAddress() )
{
}
PlugAddress::PlugAddress( const PlugAddress& pa )
: m_plugDirection( pa.m_plugDirection )
Index: avc_definitions.h
===================================================================
RCS file: /cvsroot/freebob/libfreebob/src/libfreebobavc/avc_definitions.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** avc_definitions.h 8 Jan 2006 18:44:18 -0000 1.3
--- avc_definitions.h 9 Mar 2006 23:35:46 -0000 1.4
***************
*** 59,62 ****
--- 59,67 ----
typedef byte_t port_type_t;
typedef byte_t number_of_output_plugs_t;
+ typedef byte_t function_block_type_t;
+ typedef byte_t function_block_id_t;
+ typedef byte_t function_block_special_purpose_t;
+ typedef byte_t no_of_input_plugs_t;
+ typedef byte_t no_of_output_plugs_t;
typedef quadlet_t company_id_t;
--- NEW FILE: avc_extended_subunit_info.h ---
/* avc_extended_subunit_info.h
* Copyright (C) 2006 by Daniel Wagner
*
* This file is part of FreeBob.
*
* FreeBob is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* FreeBob is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FreeBob; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
*/
#ifndef AVCEXTENDEDSUBUNITINFO_H
#define AVCEXTENDEDSUBUNITINFO_H
#include "avc_generic.h"
#include <libavc1394/avc1394.h>
#include <string>
#include <vector>
class ExtendedSubunitInfoPageData: public IBusData
{
public:
enum ESpecialPurpose {
eSP_InputGain = 0x00,
eSP_OutputVolume = 0x01,
eSP_NoSpecialPupose = 0xff,
};
ExtendedSubunitInfoPageData();
virtual ~ExtendedSubunitInfoPageData();
virtual bool serialize( IOSSerialize& se );
virtual bool deserialize( IISDeserialize& de );
virtual ExtendedSubunitInfoPageData* clone() const;
function_block_type_t m_functionBlockType;
function_block_id_t m_functionBlockId;
function_block_special_purpose_t m_functionBlockSpecialPupose;
no_of_input_plugs_t m_noOfInputPlugs;
no_of_output_plugs_t m_noOfOutputPlugs;
};
typedef std::vector<ExtendedSubunitInfoPageData*> ExtendedSubunitInfoPageDataVector;
class ExtendedSubunitInfoCmd: public AVCCommand
{
public:
enum EFunctionBlockType {
eFBT_AllFunctinBlockType = 0xff,
eFBT_AudioSubunitSelector = 0x80,
eFBT_AudioSubunitFeature = 0x81,
eFBT_AudioSubunitProcessing = 0x82,
eFBT_AudioSubunitCodec = 0x83,
};
enum EProcessingType {
ePT_Mixer = 0x01,
ePT_Generic = 0x02,
ePT_UpDown = 0x03,
ePT_DolbyProLogic = 0x04,
ePT_3DStereoExtender = 0x05,
ePT_Reverberation = 0x06,
ePT_Chorus = 0x07,
ePT_DynamicRangeCompression = 0x08,
ePT_EnhancedMixer = 0x82,
ePT_Reserved = 0xff,
};
enum ECodecType {
eCT_AC3Decoder = 0x01,
eCT_MPEGDecoder = 0x02,
eCT_DTSDecoder = 0x03,
eCT_Reserved = 0xff,
};
ExtendedSubunitInfoCmd( Ieee1394Service* ieee1394service );
ExtendedSubunitInfoCmd( const ExtendedSubunitInfoCmd& rhs );
virtual ~ExtendedSubunitInfoCmd();
virtual bool serialize( IOSSerialize& se );
virtual bool deserialize( IISDeserialize& de );
virtual bool fire();
page_t m_page;
function_block_type_t m_fbType;
ExtendedSubunitInfoPageDataVector m_infoPageDatas;
};
#endif
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freebob-cvs mailing list
Freebob-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freebob-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic