Switch to unified view

a/src/main.cxx b/src/main.cxx
...
...
26
#include <stdio.h>             
26
#include <stdio.h>             
27
#include <stdlib.h>            
27
#include <stdlib.h>            
28
#include <sys/param.h>         
28
#include <sys/param.h>         
29
#include <unistd.h>            
29
#include <unistd.h>            
30
#include <grp.h>
30
#include <grp.h>
31
#include <assert.h>
31
32
32
#include <iostream>            
33
#include <iostream>            
33
#include <string>              
34
#include <string>              
34
#include <unordered_map>       
35
#include <unordered_map>       
35
#include <vector>              
36
#include <vector>              
...
...
279
    }
280
    }
280
281
281
    if (argc != 0 || msm < 0 || msm > 3) {
282
    if (argc != 0 || msm < 0 || msm > 3) {
282
        Usage();
283
        Usage();
283
    }
284
    }
284
    MSMode msmode = MSMode(msm);
285
    MSMode arg_msmode = MSMode(msm);
285
    
286
    
286
    UpMpd::Options opts;
287
    UpMpd::Options opts;
287
288
288
    string cachedir;
289
    string cachedir;
289
    if (!g_configfilename.empty()) {
290
    if (!g_configfilename.empty()) {
...
...
383
        // Server. We let a static ContentDirectory method decide this
384
        // Server. We let a static ContentDirectory method decide this
384
        // for us. The way we then implement it depends on the command
385
        // for us. The way we then implement it depends on the command
385
        // line option (see the enum comments near the top of the file):
386
        // line option (see the enum comments near the top of the file):
386
        enableMediaServer = ContentDirectory::mediaServerNeeded();
387
        enableMediaServer = ContentDirectory::mediaServerNeeded();
387
        if (enableMediaServer) {
388
        if (enableMediaServer) {
388
            switch (msmode) {
389
            switch (arg_msmode) {
389
            case MSOnly:
390
            case MSOnly:
390
                inprocessms = true;
391
                inprocessms = true;
391
                msonly = true;
392
                msonly = true;
392
                break;
393
                break;
393
            case Combined:
394
            case Combined:
...
...
415
    // is another way to do it besides the -m option
416
    // is another way to do it besides the -m option
416
    if (!enableOH && !enableAV) {
417
    if (!enableOH && !enableAV) {
417
        msonly = true;
418
        msonly = true;
418
    }
419
    }
419
    
420
    
420
    if (msmode == MSOnly && !enableMediaServer) {
421
    if (msonly && !enableMediaServer) {
421
        cerr << "Pure Media Server mode requested, but this is "
422
        cerr << "Pure Media Server mode requested, but this is "
422
            "disabled by the configuration or by absent Media Server "
423
            "disabled by the configuration or by absent Media Server "
423
            "modules.\n";
424
            "modules.\n";
424
        return 1;
425
        return 1;
425
    }
426
    }
...
...
659
    }
660
    }
660
661
661
    if (!enableAV)
662
    if (!enableAV)
662
        opts.options |= UpMpd::upmpdNoAV;
663
        opts.options |= UpMpd::upmpdNoAV;
663
664
664
    // Initialize the UPnP root device object. 
665
    UpMpd *mediarenderer = nullptr;
665
    UpMpd *mediarenderer = nullptr;
666
    if (!msonly) {
666
    if (!msonly) {
667
        mediarenderer = new UpMpd(string("uuid:") + UUID, friendlyname,
667
        mediarenderer = new UpMpd(string("uuid:") + UUID, friendlyname,
668
                                  ohProductDesc, files, mpdclip, opts);
668
                                  ohProductDesc, files, mpdclip, opts);
669
    }
669
    }
...
...
704
                args.push_back(sa);
704
                args.push_back(sa);
705
            }
705
            }
706
        }
706
        }
707
        cmd.startExec(cmdpath, args, false, false);
707
        cmd.startExec(cmdpath, args, false, false);
708
    }
708
    }
709
    UPMPD_UNUSED(mediaserver);
710
    
709
    
711
    // And forever generate state change events.
710
    // And forever generate state change events.
712
    LOGDEB("Entering event loop" << endl);
711
    LOGDEB("Entering event loop" << endl);
713
    setupsigs();
712
    setupsigs();
714
    if (msonly) {
713
    if (msonly) {
714
        assert(nullptr != mediaserver);
715
        dev = mediaserver;
715
        dev = mediaserver;
716
        LOGDEB("Media server event loop" << endl);
716
        LOGDEB("Media server event loop" << endl);
717
        mediaserver->eventloop();
717
        mediaserver->eventloop();
718
    } else {
718
    } else {
719
        LOGDEB("Renderer event loop" << endl);
719
        LOGDEB("Renderer event loop" << endl);
720
        assert(nullptr != mediarenderer);
720
        dev = mediarenderer;
721
        dev = mediarenderer;
721
        mediarenderer->eventloop();
722
        mediarenderer->eventloop();
722
    }
723
    }
723
    LOGDEB("Event loop returned" << endl);
724
    LOGDEB("Event loop returned" << endl);
724
    return 0;
725
    return 0;