# HG changeset patch
# User morphbr
# Date 1173131901 0
# Node ID 4184f56767b81232b992f48157e3de4339bbc7f8
# Parent  ab93678082df1ef0198d2e69c66fda5b5b696683
[svn r391] - Fixed ticket 1674323;
 - Fixed ticket 1674304 (pending);

diff -r ab93678082df -r 4184f56767b8 gmyth/src/gmyth_http.c
--- a/gmyth/src/gmyth_http.c	Sun Mar 04 06:53:50 2007 +0000
+++ b/gmyth/src/gmyth_http.c	Mon Mar 05 21:58:21 2007 +0000
@@ -625,17 +625,63 @@
 {
 
     if (profile->name != NULL && profile->group != NULL &&
-        profile->vcodec && profile->acodec)
+        profile->vcodec && profile->acodec && profile->options != NULL)
     {
         GString* command = g_string_new("");
         g_string_printf(command, "createRecProfiles?profilename=%s&"\
-                                "groupname=%s&vcodec=%s&acodec=%s",
-                                profile->name, profile->group,
-                                profile->vcodec, profile->acodec);
+                                 "groupname=%s&vcodec=%s&acodec=%s&"\
+                                 "transcodelossless=%d&transcoderesize=%d&"\
+                                 "width=%d&height=%d&rtjpegquality=%d&"\
+                                 "rtjpeglumafilter=%d&rtjpegchromafilter=%d&"\
+                                 "mpeg4bitrate=%d&mpeg4maxquality=%d&"\
+                                 "mpeg4minquality=%d&mpeg4qualdiff=%d&"\
+                                 "mpeg4scalebitrate=%d&mpeg4optionvhq=%d&"\
+                                 "mpeg4option4mv=%d&mpeg4optionidct=%d&"\
+                                 "mpeg4optionime=%d&hardwaremjpegquality=%d&"\
+                                 "hardwaremjpeghdecimation=%d&hardwaremjpegvdecimation=%d&"\
+                                 "mpeg2streamtype=%s&mpeg2aspectratio=%s&"\
+                                 "mpeg2bitrate=%d&mpeg2maxbitrate=%d&"\
+                                 "samplerate=%d&mp3quality=%d&"\
+                                 "volume=%d&mpeg2audtype=%s&"\
+                                 "mpeg2audbitratel1=%d&mpeg2audbitratel2=%d&"\
+                                 "mpeg2audvolume=%d",
+                                 profile->name, profile->group,
+                                 profile->vcodec, profile->acodec,
+                                 profile->options->transcodelossless,
+                                 profile->options->transcoderesize,
+                                 profile->options->width,
+                                 profile->options->height,
+                                 profile->options->rtjpegquality,
+                                 profile->options->rtjpeglumafilter,
+                                 profile->options->rtjpegchromafilter,
+                                 profile->options->mpeg4bitrate,
+                                 profile->options->mpeg4maxquality,
+                                 profile->options->mpeg4minquality,
+                                 profile->options->mpeg4qualdiff,
+                                 profile->options->mpeg4scalebitrate,
+                                 profile->options->mpeg4optionvhq,
+                                 profile->options->mpeg4option4mv,
+                                 profile->options->mpeg4optionidct,
+                                 profile->options->mpeg4optionime,
+                                 profile->options->hardwaremjpegquality,
+                                 profile->options->hardwaremjpeghdecimation,
+                                 profile->options->hardwaremjpegvdecimation,
+                                 profile->options->mpeg2streamtype,
+                                 profile->options->mpeg2aspectratio,
+                                 profile->options->mpeg2bitrate,
+                                 profile->options->mpeg2maxbitrate,
+                                 profile->options->samplerate,
+                                 profile->options->mp3quality,
+                                 profile->options->volume,
+                                 profile->options->mpeg2audtype,
+                                 profile->options->mpeg2audbitratel1,
+                                 profile->options->mpeg2audbitratel2,
+                                 profile->options->mpeg2audvolume
+                                );
 
 
         return rec_profile_common(backend_info, command);
-    } 
+    }
     else
         return -1;
 }
@@ -789,6 +835,9 @@
         field, so we provide one */
     curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0");
 
+    /* set timeout */
+    curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 20);
+
     /* get it! */
     curl_easy_perform(curl_handle);
 
diff -r ab93678082df -r 4184f56767b8 gmyth/src/gmyth_jobqueue.c
--- a/gmyth/src/gmyth_jobqueue.c	Sun Mar 04 06:53:50 2007 +0000
+++ b/gmyth/src/gmyth_jobqueue.c	Mon Mar 05 21:58:21 2007 +0000
@@ -79,6 +79,8 @@
     gmyth_string_list_append_string (retlist, command);
     gmyth_socket_write_stringlist (socket, retlist);
 
+    g_free(command);
+
     // receive answer
     gmyth_socket_read_stringlist (socket, retlist);
     return gmyth_string_list_get_string(retlist, 0);
@@ -134,7 +136,12 @@
         GString* ret = send_command(socket, "ADD", job, transcode->chanid,
                                     transcode->starttime, options->str);
 
-        return test_result(ret->str, "JOBQUEUE_OK");
+        g_free(options);
+        g_free(socket);
+        int res = test_result(ret->str, "JOBQUEUE_OK");
+        g_free(ret);
+
+        return res;
     }
     else
     {
@@ -161,7 +168,11 @@
                                     transcode->chanid,
                                     transcode->starttime, "");
 
-        return test_result(ret->str, "JOBQUEUE_CHANGED_CMD_OK");
+        g_free(socket);
+        int  res = test_result(ret->str, "JOBQUEUE_CHANGED_CMD_OK");
+        g_free(ret);
+
+        return res;
     }
     else
     {
diff -r ab93678082df -r 4184f56767b8 gmyth/src/gmyth_recprofile.c
--- a/gmyth/src/gmyth_recprofile.c	Sun Mar 04 06:53:50 2007 +0000
+++ b/gmyth/src/gmyth_recprofile.c	Mon Mar 05 21:58:21 2007 +0000
@@ -78,7 +78,10 @@
     if (recprofile->acodec)
         g_free(recprofile->acodec);
 
-	G_OBJECT_CLASS (gmyth_recprofile_parent_class)->dispose (object);
+    if (recprofile->options)
+        g_free(recprofile->options);
+
+    G_OBJECT_CLASS (gmyth_recprofile_parent_class)->dispose (object);
 }
 
 static void
@@ -104,6 +107,7 @@
     recprofile->group = NULL;
     recprofile->vcodec = NULL;
     recprofile->acodec = NULL;
+    recprofile->options = NULL;
 
     return recprofile;
 }
diff -r ab93678082df -r 4184f56767b8 gmyth/src/gmyth_recprofile.h
--- a/gmyth/src/gmyth_recprofile.h	Sun Mar 04 06:53:50 2007 +0000
+++ b/gmyth/src/gmyth_recprofile.h	Mon Mar 05 21:58:21 2007 +0000
@@ -45,6 +45,7 @@
 #define IS_GMYTH_RECPROFILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECPROFILE_TYPE))
 #define GMYTH_RECPROFILE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_RECPROFILE_TYPE, GMythRecProfileClass))
 
+typedef struct _Options                 Options;
 typedef struct _GMythRecProfile         GMythRecProfile;
 typedef struct _GMythRecProfileClass    GMythRecProfileClass;
 
@@ -57,14 +58,47 @@
 
 struct _GMythRecProfile
 {
-  gint	id;
-  gchar* name;
-  gchar* group;
-  gchar* vcodec;
-  gchar* acodec;
+    gint	id;
+    gchar* name;
+    gchar* group;
+    gchar* vcodec;
+    gchar* acodec;
+    Options* options;
 };
 
-
+struct _Options
+{
+    gint transcodelossless;
+    gint transcoderesize;
+    gint width;
+    gint height;
+    gint rtjpegquality;
+    gint rtjpeglumafilter;
+    gint rtjpegchromafilter;
+    gint mpeg4bitrate;
+    gint mpeg4maxquality;
+    gint mpeg4minquality;
+    gint mpeg4qualdiff;
+    gint mpeg4scalebitrate;
+    gint mpeg4optionvhq;
+    gint mpeg4option4mv;
+    gint mpeg4optionidct;
+    gint mpeg4optionime;
+    gint hardwaremjpegquality;
+    gint hardwaremjpeghdecimation;
+    gint hardwaremjpegvdecimation;
+    gchar* mpeg2streamtype;
+    gchar* mpeg2aspectratio;
+    gint mpeg2bitrate;
+    gint mpeg2maxbitrate;
+    gint samplerate;
+    gint mp3quality;
+    gint volume;
+    gchar* mpeg2audtype;
+    gint mpeg2audbitratel1;
+    gint mpeg2audbitratel2;
+    gint mpeg2audvolume;
+};
 
 GType gmyth_recprofile_type (void);
 
diff -r ab93678082df -r 4184f56767b8 gmyth/tests/gmyth_test_http.c
--- a/gmyth/tests/gmyth_test_http.c	Sun Mar 04 06:53:50 2007 +0000
+++ b/gmyth/tests/gmyth_test_http.c	Mon Mar 05 21:58:21 2007 +0000
@@ -11,15 +11,15 @@
 
     backend_info = gmyth_backend_info_new ();
 
-    gmyth_backend_info_set_hostname (backend_info, "192.168.3.165");
+    gmyth_backend_info_set_hostname (backend_info, "192.168.3.166");
     gmyth_backend_info_set_port (backend_info, 6543);
     gmyth_backend_info_set_status_port (backend_info, 6544);
     
-    //GTimeVal* start = gmyth_util_string_to_time_val("2006-01-01T00:00");
-    //GTimeVal* end = gmyth_util_string_to_time_val("2007-01-01T00:00");
-    //GMythEpg epg;
-    //epg  = gmyth_http_retrieve_epg(backend_info, start, end, 0, 2, "True");
-
+    GTimeVal* start = gmyth_util_string_to_time_val("2006-01-01T00:00");
+    GTimeVal* end = gmyth_util_string_to_time_val("2007-01-01T00:00");
+    GMythEpg epg;
+    epg  = gmyth_http_retrieve_epg(backend_info, start, end, 0, 2, "True");
+ 
     //GMythRecorded recorded;
     //recorded = gmyth_http_retrieve_recorded(backend_info);