0

可以将 live555 lib 与 armv7s 一起使用吗?因为我尝试用 config 编译它

# Change the following version number, if necessary, before running "genMakefiles iphoneos"
IOS_VERSION =       7.0

DEVELOPER_PATH =    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
TOOL_PATH =     $(DEVELOPER_PATH)/usr/bin
SDK_PATH =      $(DEVELOPER_PATH)/SDKs
SDK =           $(SDK_PATH)/iPhoneOS$(IOS_VERSION).sdk
COMPILE_OPTS =          $(INCLUDES) -I. $(EXTRA_LDFLAGS) -DBSD=1 -O2 -DSOCKLEN_T=socklen_t -DHAVE_SOCKADDR_LEN=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fPIC -arch armv7s --sysroot=$(SDK)
C =                     c
C_COMPILER =            $(TOOL_PATH)/gcc
C_FLAGS =               $(COMPILE_OPTS)
CPP =                   cpp
CPLUSPLUS_COMPILER =    $(TOOL_PATH)/g++
CPLUSPLUS_FLAGS =       $(COMPILE_OPTS) -Wall
OBJ =                   o
LINK =                  $(TOOL_PATH)/g++ -o 
LINK_OPTS =             -L. -arch armv7s --sysroot=$(SDK) -L$(SDK)/usr/lib/system
CONSOLE_LINK_OPTS =     $(LINK_OPTS)
LIBRARY_LINK =          libtool -s -o 
LIBRARY_LINK_OPTS =
LIB_SUFFIX =            a
LIBS_FOR_CONSOLE_APPLICATION =
LIBS_FOR_GUI_APPLICATION =
EXE =

然后我尝试将程序testMP3Reciver复制并粘贴到我的 iOS 项目中(是的,我使用 .mm 作为后缀而不是 .m,并包含需要的每个标题),但仍然出现 14 个错误Undefinded symbols for architecture armv7s

14 个错误

我的代码:

#import "TViewController.h"
#include "liveMedia.hh"
#include "GroupsockHelper.hh"
#include "BasicUsageEnvironment.hh"

@interface TViewController ()

@end

@implementation TViewController
UsageEnvironment* env;
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

struct sessionState_t {
    FramedSource* source;
    FileSink* sink;
    RTCPInstance* rtcpInstance;
} sessionState;

- (IBAction)start:(id)sender {
    if (!wasClicked) {
        //start
        [self startButton];
        wasClicked = true;
    } else {
        //stop
        [self stopButton];
        wasClicked = false;
    }
}

-(void)startButton{
    // Begin by setting up our usage environment:
    TaskScheduler* scheduler = BasicTaskScheduler::createNew();
    env = BasicUsageEnvironment::createNew(*scheduler);

    // Create the data sink for 'stdout':
    sessionState.sink = FileSink::createNew(*env, "stdout");
    // Note: The string "stdout" is handled as a special case.
    // A real file name could have been used instead.

    // Create 'groupsocks' for RTP and RTCP:
    char const* sessionAddressStr
#ifdef USE_SSM
    = "232.255.42.42";
#else
    = "239.255.42.42";
    // Note: If the session is unicast rather than multicast,
    // then replace this string with "0.0.0.0"
#endif
    const unsigned short rtpPortNum = 6666;
    const unsigned short rtcpPortNum = rtpPortNum+1;
#ifndef USE_SSM
    const unsigned char ttl = 1; // low, in case routers don't admin scope
#endif

    struct in_addr sessionAddress;
    sessionAddress.s_addr = our_inet_addr(sessionAddressStr);
    const Port rtpPort(rtpPortNum);
    const Port rtcpPort(rtcpPortNum);

#ifdef USE_SSM
    char* sourceAddressStr = "aaa.bbb.ccc.ddd";
    // replace this with the real source address
    struct in_addr sourceFilterAddress;
    sourceFilterAddress.s_addr = our_inet_addr(sourceAddressStr);

    Groupsock rtpGroupsock(*env, sessionAddress, sourceFilterAddress, rtpPort);
    Groupsock rtcpGroupsock(*env, sessionAddress, sourceFilterAddress, rtcpPort);
    rtcpGroupsock.changeDestinationParameters(sourceFilterAddress,0,~0);
    // our RTCP "RR"s are sent back using unicast
#else
    Groupsock rtpGroupsock(*env, sessionAddress, rtpPort, ttl);
    Groupsock rtcpGroupsock(*env, sessionAddress, rtcpPort, ttl);
#endif

    RTPSource* rtpSource;
#ifndef STREAM_USING_ADUS
    // Create the data source: a "MPEG Audio RTP source"
    rtpSource = MPEG1or2AudioRTPSource::createNew(*env, &rtpGroupsock);
#else
    // Create the data source: a "MP3 *ADU* RTP source"
    unsigned char rtpPayloadFormat = 96; // a dynamic payload type
    rtpSource
    = MP3ADURTPSource::createNew(*env, &rtpGroupsock, rtpPayloadFormat);
#endif

    // Create (and start) a 'RTCP instance' for the RTP source:
    const unsigned estimatedSessionBandwidth = 160; // in kbps; for RTCP b/w share
    const unsigned maxCNAMElen = 100;
    unsigned char CNAME[maxCNAMElen+1];
    gethostname((char*)CNAME, maxCNAMElen);
    CNAME[maxCNAMElen] = '\0'; // just in case
    sessionState.rtcpInstance
    = RTCPInstance::createNew(*env, &rtcpGroupsock,
                              estimatedSessionBandwidth, CNAME,
                              NULL /* we're a client */, rtpSource);
    // Note: This starts RTCP running automatically

    sessionState.source = rtpSource;
#ifdef STREAM_USING_ADUS
    // Add a filter that deinterleaves the ADUs after depacketizing them:
    sessionState.source
    = MP3ADUdeinterleaver::createNew(*env, sessionState.source);
    if (sessionState.source == NULL) {
        *env << "Unable to create an ADU deinterleaving filter for the source\n";
        exit(1);
    }

    // Add another filter that converts these ADUs to MP3s:
    sessionState.source
    = MP3FromADUSource::createNew(*env, sessionState.source);
    if (sessionState.source == NULL) {
        *env << "Unable to create an ADU->MP3 filter for the source\n";
        exit(1);
    }
#endif

    // Finally, start receiving the multicast stream:
    *env << "Beginning receiving multicast stream...\n";
    sessionState.sink->startPlaying(*sessionState.source, afterPlaying, NULL);

    env->taskScheduler().doEventLoop(); // does not return
}

void afterPlaying(void* /*clientData*/) {
    *env << "...done receiving\n";

    // End by closing the media:
    Medium::close(sessionState.rtcpInstance); // Note: Sends a RTCP BYE
    Medium::close(sessionState.sink);
    Medium::close(sessionState.source);
}

-(void)stopButton{
    afterPlaying;
}

@end

所以我再问一次,甚至可以在armv7s上使用live555吗?也许我应该使用另一个库?


解决方案/更新

我必须扔掉 armv7s,而不是使用这个项目来为 iOS 创建胖库。

分步解决方案:

  1. 克隆这个项目git clone git@github.com:weevilgenius/live555-ios.git
  2. 构建 lib,并复制到您的项目中。一开始我在查找已编译的库时遇到问题。所以对于那些不知道如何找到它的人。在 Xcode 文件树中构建 lib 后,打开文件夹 Products 并右键单击 libLive555.a 然后选择“在 Finder 中显示”。 在取景器中显示

  3. 每个.hh 添加到您的项目中。这些文件位于文件夹中,包括在文件夹Live555的每个子文件夹中。现在一切都应该很好:)

4

0 回答 0