///\brief Parse a given stream configuration.
///\param in The requested configuration.
///\param out The new configuration after parsing.
void CheckStreams(JSON::Value & in, JSON::Value & out) {
    bool changed = false;

    //check for new streams and updates
    for (JSON::ObjIter jit = in.ObjBegin(); jit != in.ObjEnd(); jit++) {
        if (out.isMember(jit->first)) {
            if ( !streamsEqual(jit->second, out[jit->first])) {
                Log("STRM", std::string("Updated stream ") + jit->first);
                Util::Procs::Stop(jit->first);
                startStream(jit->first, jit->second);
            }
        } else {
            Log("STRM", std::string("New stream ") + jit->first);
            startStream(jit->first, jit->second);
        }
    }

    //check for deleted streams
    for (JSON::ObjIter jit = out.ObjBegin(); jit != out.ObjEnd(); jit++) {
        if ( !in.isMember(jit->first)) {
            Log("STRM", std::string("Deleted stream ") + jit->first);
            Util::Procs::Stop(jit->first);
        }
    }

    //update old-style configurations to new-style
    for (JSON::ObjIter jit = in.ObjBegin(); jit != in.ObjEnd(); jit++) {
        if (jit->second.isMember("channel")) {
            if ( !jit->second.isMember("source")) {
                jit->second["source"] = jit->second["channel"]["URL"];
            }
            jit->second.removeMember("channel");
        }
        if (jit->second.isMember("preset")) {
            jit->second.removeMember("preset");
        }
    }

    out = in;
}
 void CheckStreams(JSON::Value & in, JSON::Value & out){
   bool changed = false;
   for (JSON::ObjIter jit = in.ObjBegin(); jit != in.ObjEnd(); jit++){
     if (out.isMember(jit->first)){
       if ( !streamsEqual(jit->second, out[jit->first])){
         Log("STRM", std::string("Updated stream ") + jit->first);
         Util::Procs::Stop(jit->first);
         startStream(jit->first, jit->second);
       }
     }else{
       Log("STRM", std::string("New stream ") + jit->first);
       startStream(jit->first, jit->second);
     }
   }
   for (JSON::ObjIter jit = out.ObjBegin(); jit != out.ObjEnd(); jit++){
     if ( !in.isMember(jit->first)){
       Log("STRM", std::string("Deleted stream ") + jit->first);
       Util::Procs::Stop(jit->first);
     }
   }
   out = in;
 }