Merge branch 'master' into windows
[ardour.git] / gtk2_ardour / video_image_frame.cc
index 9ba9b09ad0e3f8c51f7611d373fdeeaefb6683ed..310f3a68d3080a0c28cee394f12f517ca71387ca 100644 (file)
@@ -17,8 +17,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 */
-#ifdef WITH_VIDEOTIMELINE
-
 #include <sigc++/bind.h>
 #include "ardour/tempo.h"
 
@@ -199,11 +197,11 @@ http_get_thread (void *arg) {
        char *res = NULL;
        do {
                res=curl_http_get(url, &status);
-               if (status == 503) usleep(5000); // try-again
+               if (status == 503) Glib::usleep(5000); // try-again
        } while (status == 503 && --timeout > 0);
 
        if (status != 200 || !res) {
-               print("no-video frame: video-server returned http-status: %d\n", status);
+               printf("no-video frame: video-server returned http-status: %d\n", status);
        }
 
        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
@@ -248,7 +246,7 @@ VideoImageFrame::http_download_done (char *data){
 
        exposeimg();
        /* don't request frames too quickly, wait after user has zoomed */
-       usleep(40000);
+       Glib::usleep(40000);
 
        if (queued_request) {
                http_get_again(want_video_frame_number);
@@ -294,7 +292,7 @@ VideoImageFrame::http_get(framepos_t fn) {
 }
 
 void
-VideoImageFrame::http_get_again(framepos_t fn) {
+VideoImageFrame::http_get_again(framepos_t /*fn*/) {
        pthread_mutex_lock(&queue_lock);
        queued_request=false;
        req_video_frame_number=want_video_frame_number;
@@ -303,73 +301,3 @@ VideoImageFrame::http_get_again(framepos_t fn) {
        http_get_thread(this);
 }
 
-
-extern "C" {
-#include <curl/curl.h>
-
-       struct MemoryStruct {
-               char *data;
-               size_t size;
-       };
-
-       static size_t
-       WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) {
-               size_t realsize = size * nmemb;
-               struct MemoryStruct *mem = (struct MemoryStruct *)data;
-
-               mem->data = (char *)realloc(mem->data, mem->size + realsize + 1);
-               if (mem->data) {
-                       memcpy(&(mem->data[mem->size]), ptr, realsize);
-                       mem->size += realsize;
-                       mem->data[mem->size] = 0;
-               }
-               return realsize;
-       }
-
-       char *curl_http_get (const char *u, int *status) {
-               CURL *curl;
-               CURLcode res;
-               struct MemoryStruct chunk;
-               long int httpstatus;
-               if (status) *status = 0;
-               //usleep(500000); return NULL; // TEST & DEBUG
-               if (strncmp("http://", u, 7)) return NULL;
-
-               chunk.data=NULL;
-               chunk.size=0;
-
-               curl = curl_easy_init();
-               if(!curl) return NULL;
-               curl_easy_setopt(curl, CURLOPT_URL, u);
-
-               curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
-               curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
-               curl_easy_setopt(curl, CURLOPT_USERAGENT, ARDOUR_USER_AGENT);
-               curl_easy_setopt(curl, CURLOPT_TIMEOUT, ARDOUR_CURL_TIMEOUT);
-               curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
-#define CURLERRORDEBUG /* XXX */
-#ifdef CURLERRORDEBUG
-               char curlerror[CURL_ERROR_SIZE] = "";
-               curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curlerror);
-#endif
-
-               res = curl_easy_perform(curl);
-               curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpstatus);
-               curl_easy_cleanup(curl);
-               if (status) *status = httpstatus;
-               if (res) {
-#ifdef CURLERRORDEBUG
-                       printf("curl_http_get() failed: %s\n", curlerror);
-#endif
-                       return NULL;
-               }
-               if (httpstatus != 200) {
-                       free (chunk.data);
-                       chunk.data = NULL;
-               }
-               return (chunk.data);
-       }
-
-} /* end extern "C" */
-
-#endif /* WITH_VIDEOTIMELINE */