Question

it is possible to use live555 lib with armv7s? Becasue I try to compile it with 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 =

then I try copy&paste program testMP3Reciver to my iOS project (yes I use .mm as postfix instead of .m, and include every header is needed), but still I got 14 errors Undefinded symbols for architecture armv7s

14 errors

My code:

#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

So I ask again, it's even posible to use live555 on armv7s? Maybe I should use another lib?


Solution/Update

I have to throw away armv7s, instead of it I use this project to create fat lib for iOS.

Step-by-step solution:

  1. Clone this project git clone git@github.com:weevilgenius/live555-ios.git
  2. Build lib, and copy to your project. At start I was have problem with finding compiled lib. So for those who don't know how to find it. After building lib in Xcode file tree open folder Products and right-click on libLive555.a then select "Show in Finder". Show in finder

  3. Add to your project every .hh. Those files are in folder include in every subfolder of folder Live555. Now everything should be just fine :)

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top