From beca2400dd8c698dbb5013c2277371f58cb31639 Mon Sep 17 00:00:00 2001
From: Peter Wu <lekensteyn@gmail.com>
Date: Thu, 30 Aug 2012 16:40:43 +0200
Subject: [PATCH] Convert to Util::Stream::*

---
 src/buffer.cpp                | 3 ++-
 src/conn_http_dynamic.cpp     | 3 ++-
 src/conn_http_progressive.cpp | 3 ++-
 src/conn_raw.cpp              | 3 ++-
 src/conn_rtmp.cpp             | 6 ++++--
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/buffer.cpp b/src/buffer.cpp
index efd7d35c..fecab00c 100644
--- a/src/buffer.cpp
+++ b/src/buffer.cpp
@@ -14,6 +14,7 @@
 #include <sys/time.h>
 #include <mist/config.h>
 #include "buffer_stream.h"
+#include <mist/stream.h>
 
 /// Holds all code unique to the Buffer.
 namespace Buffer{
@@ -168,7 +169,7 @@ namespace Buffer{
 
     std::string name = conf.getString("stream_name");
 
-    SS = Socket::makeStream(name);
+    SS = Util::Stream::makeLive(name);
     if (!SS.connected()) {
       perror("Could not create stream socket");
       return 1;
diff --git a/src/conn_http_dynamic.cpp b/src/conn_http_dynamic.cpp
index 488deb05..c1e7a22f 100644
--- a/src/conn_http_dynamic.cpp
+++ b/src/conn_http_dynamic.cpp
@@ -21,6 +21,7 @@
 #include <mist/mp4.h>
 #include <mist/config.h>
 #include <sstream>
+#include <mist/stream.h>
 
 /// Holds everything unique to HTTP Dynamic Connector.
 namespace Connector_HTTP{
@@ -168,7 +169,7 @@ namespace Connector_HTTP{
       if (ready4data){
         if (!inited){
           //we are ready, connect the socket!
-          ss = Socket::getStream(streamname);
+          ss = Util::Stream::getStream(streamname);
           if (!ss.connected()){
             #if DEBUG >= 1
             fprintf(stderr, "Could not connect to server!\n");
diff --git a/src/conn_http_progressive.cpp b/src/conn_http_progressive.cpp
index db281a21..b13fe460 100644
--- a/src/conn_http_progressive.cpp
+++ b/src/conn_http_progressive.cpp
@@ -17,6 +17,7 @@
 #include <mist/flv_tag.h>
 #include <mist/amf.h>
 #include <mist/config.h>
+#include <mist/stream.h>
 
 /// Holds everything unique to HTTP Progressive Connector.
 namespace Connector_HTTP{
@@ -58,7 +59,7 @@ namespace Connector_HTTP{
       if (ready4data){
         if (!inited){
           //we are ready, connect the socket!
-          ss = Socket::getStream(streamname);
+          ss = Util::Stream::getStream(streamname);
           if (!ss.connected()){
             #if DEBUG >= 1
             fprintf(stderr, "Could not connect to server!\n");
diff --git a/src/conn_raw.cpp b/src/conn_raw.cpp
index 5061c581..860af85c 100644
--- a/src/conn_raw.cpp
+++ b/src/conn_raw.cpp
@@ -5,6 +5,7 @@
 #include <sstream>
 #include <mist/config.h>
 #include <mist/socket.h>
+#include <mist/stream.h>
 
 /// Contains the main code for the RAW connector.
 /// Expects a single commandline argument telling it which stream to connect to,
@@ -15,7 +16,7 @@ int main(int argc, char  ** argv) {
   conf.parseArgs(argc, argv);
 
   //connect to the proper stream
-  Socket::Connection S = Socket::getStream(conf.getString("stream_name"));
+  Socket::Connection S = Util::Stream::getStream(conf.getString("stream_name"));
   S.setBlocking(false);
   if (!S.connected()){
     std::cout << "Could not open stream " << conf.getString("stream_name") << std::endl;
diff --git a/src/conn_rtmp.cpp b/src/conn_rtmp.cpp
index 324a2a70..34ffd789 100644
--- a/src/conn_rtmp.cpp
+++ b/src/conn_rtmp.cpp
@@ -16,6 +16,7 @@
 #include <mist/flv_tag.h>
 #include <mist/amf.h>
 #include <mist/rtmpchunks.h>
+#include <mist/stream.h>
 
 /// Holds all functions and data unique to the RTMP Connector
 namespace Connector_RTMP{
@@ -76,7 +77,7 @@ int Connector_RTMP::Connector_RTMP(Socket::Connection conn){
     if (ready4data){
       if (!inited){
         //we are ready, connect the socket!
-        SS = Socket::getStream(streamname);
+        SS = Util::Stream::getStream(streamname);
         if (!SS.connected()){
           #if DEBUG >= 1
           fprintf(stderr, "Could not connect to server!\n");
@@ -405,7 +406,8 @@ void Connector_RTMP::parseAMFCommand(AMF::Object & amfdata, int messagetype, int
   if ((amfdata.getContentP(0)->StrValue() == "publish")){
     if (amfdata.getContentP(3)){
       streamname = amfdata.getContentP(3)->StrValue();
-      SS = Socket::getStream(streamname);
+      /// \todo implement push for MistPlayer or restrict and change to getLive
+      SS = Util::Stream::getStream(streamname);
       if (!SS.connected()){
         #if DEBUG >= 1
         fprintf(stderr, "Could not connect to server!\n");