Skip to content

Commit

Permalink
parseHdaCodecString return codecCount, add showSelectCodec
Browse files Browse the repository at this point in the history
  • Loading branch information
benbaker76 committed Mar 5, 2020
1 parent 39ac617 commit 8eadea1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
Binary file not shown.
27 changes: 18 additions & 9 deletions PinConfigurator/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,20 @@ - (uint32_t)getPinDefault
return ((port << 30) | (location << 24) | (device << 20) | (connector << 16) | (color << 12) | (misc << 8) | (group << 4) | index);
}

- (void)showSelectCodec:(NSString *)configString
{
[_hdaCodecString release];

_hdaCodecString = [configString retain];

[_selectCodecOutlineView reloadData];

NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:0];
[[self selectCodecOutlineView] selectRowIndexes:indexSet byExtendingSelection:NO];

[NSApp beginSheet:_selectCodecPanel modalForWindow:[self mainWindow] modalDelegate:0 didEndSelector:0 contextInfo:0];
}

- (void)parseCodec:(HdaCodec *)hdaCodec
{
_nodeArray = [[NSMutableArray alloc] init];
Expand Down Expand Up @@ -867,19 +881,14 @@ - (void)parseCodec:(HdaCodec *)hdaCodec

- (void)parseConfigString:(NSString *)configString
{
int result = 0;
int codecCount = 0;

[self clear];

if ((result = [HdaCodec parseHdaCodecString:configString index:0 hdaCodec:&_hdaCodec hdaCodecArray:&_selectCodecArray]))
if ((codecCount = [HdaCodec parseHdaCodecString:configString index:0 hdaCodec:&_hdaCodec hdaCodecArray:&_selectCodecArray]))
{
if (result == 2)
{
[_hdaCodecString release];
_hdaCodecString = [configString retain];
[_selectCodecOutlineView reloadData];
[NSApp beginSheet:_selectCodecPanel modalForWindow:[self mainWindow] modalDelegate:0 didEndSelector:0 contextInfo:0];
}
if (codecCount > 1)
[self showSelectCodec:configString];
else
[self parseCodec:_hdaCodec];
}
Expand Down
2 changes: 1 addition & 1 deletion PinConfigurator/HdaCodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
- (NSMutableString *)codecString;
+ (bool)getHdaCodecArray_Linux:(NSString *)hdaCodecString hdaCodecArray:(NSMutableArray **)hdaCodecArray;
+ (bool)parseHdaCodecString_Linux:(NSString *)hdaCodecString index:(uint32_t)index hdaCodec:(HdaCodec *)hdaCodec;
+ (int)parseHdaCodecString:(NSString *)hdaCodecString index:(uint32_t)index hdaCodec:(HdaCodec **)hdaCodec hdaCodecArray:(NSMutableArray **)hdaCodecArray;
+ (uint32_t)parseHdaCodecString:(NSString *)hdaCodecString index:(uint32_t)index hdaCodec:(HdaCodec **)hdaCodec hdaCodecArray:(NSMutableArray **)hdaCodecArray;
+ (bool)parseHdaCodecData:(uint8_t *)hdaCodecData length:(uint32_t)length hdaCodec:(HdaCodec **)hdaCodec;
+ (bool)getWidget:(NSArray *)widgets nodeID:(uint8_t)nodeID hdaWidget:(HdaWidget **)hdaWidget;
+ (void)createPlatformsXml:(HdaCodec *)hdaCodec;
Expand Down
4 changes: 2 additions & 2 deletions PinConfigurator/HdaCodec.m
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ + (bool)parseHdaCodecString_Linux:(NSString *)hdaCodecString index:(uint32_t)ind
return true;
}

+ (int)parseHdaCodecString:(NSString *)hdaCodecString index:(uint32_t)index hdaCodec:(HdaCodec **)hdaCodec hdaCodecArray:(NSMutableArray **)hdaCodecArray
+ (uint32_t)parseHdaCodecString:(NSString *)hdaCodecString index:(uint32_t)index hdaCodec:(HdaCodec **)hdaCodec hdaCodecArray:(NSMutableArray **)hdaCodecArray
{
*hdaCodec = [[HdaCodec alloc] init];

Expand All @@ -1096,7 +1096,7 @@ + (int)parseHdaCodecString:(NSString *)hdaCodecString index:(uint32_t)index hdaC
[HdaCodec getHdaCodecArray_Linux:hdaCodecString hdaCodecArray:hdaCodecArray];

if ([*hdaCodecArray count] > 1)
return 2;
return (uint32_t)[*hdaCodecArray count];

return [HdaCodec parseHdaCodecString_Linux:hdaCodecString index:index hdaCodec:*hdaCodec];
}
Expand Down

0 comments on commit 8eadea1

Please sign in to comment.