• 1
  • 6
  • 7
  • 8(current)
  • 9
  • 10
  • 19
Hulu Plugin Development Thread - Developers only!
motd2k: this is generic to RTMP, not specific to RTMPE. And the official RTMP spec from Adobe is now public info. http://www.adobe.com/devnet/rtmp/pdf/rtm...on_1.0.pdf

The same bug exists in flvstreamer, last time I checked.
Reply
Yea its cool. RTMP is fine, i know its public - i've looked over librtmp alot recently.

If there's a bug (specific to rtmp) then thats fine. To what field are you refering by 'Channel ID' though? If you post a packet dump i'll get it fixed on SVN



motd
Reply
In section 6.1.1 of the spec, the Chunk Stream ID can be 1 to 3 bytes long. The current code only handles a 1 byte ID (values 0-63).

Probably easier for me to just give you the patch...
Code:
diff -wur old/rtmp.cpp new/rtmp.cpp
--- old/rtmp.cpp    2009-05-14 10:13:54.000000000 -0700
+++ new/rtmp.cpp    2009-07-26 19:14:03.000000000 -0700
@@ -1026,6 +1129,28 @@

   packet.m_headerType = (type & 0xc0) >> 6;
   packet.m_nChannel = (type & 0x3f);
+  if ( packet.m_nChannel == 0 )
+  {
+    if (ReadN(&type,1) != 1)
+    {
+      Log(LOGERROR, "%s, failed to read RTMP packet header 2nd byte", __FUNCTION__);
+      return false;
+    }
+    packet.m_nChannel = (unsigned)type;
+    packet.m_nChannel += 64;
+  } else if ( packet.m_nChannel == 1 )
+  {
+    char t[2];
+    int tmp;
+    if (ReadN(t,2) != 2)
+    {
+      Log(LOGERROR, "%s, failed to read RTMP packet header 3rd byte", __FUNCTION__);
+      return false;
+    }
+    tmp = (((unsigned)t[0])<<8) + (unsigned)t[1];
+    packet.m_nChannel = tmp + 64;
+    Log(LOGDEBUG, "%s, m_nChannel: %0x", __FUNCTION__, packet.m_nChannel);
+  }

   int nSize = packetSize[packet.m_headerType];
  
diff -wur old/rtmp.h new/rtmp.h
--- old/rtmp.h    2009-05-12 17:15:20.000000000 -0700
+++ new/rtmp.h    2009-07-26 19:56:43.000000000 -0700
@@ -205,14 +211,12 @@
       char *m_pBuffer;      // data read from socket
       char *m_pBufferStart; // pointer into m_pBuffer of next byte to process
       int  m_nBufferSize;   // number of unprocessed bytes in buffer
-      RTMPPacket m_vecChannelsIn[64];
-      RTMPPacket m_vecChannelsOut[64];
-      int  m_channelTimestamp[64]; // abs timestamp of last packet
+      RTMPPacket m_vecChannelsIn[65600];
+      RTMPPacket m_vecChannelsOut[65600];
+      int  m_channelTimestamp[65600]; // abs timestamp of last packet

       double m_fDuration; // duration of stream in seconds
   };
};

#endif
-
-
diff -wur old/rtmppacket.h new/rtmppacket.h
--- old/rtmppacket.h    2009-05-14 09:45:32.000000000 -0700
+++ new/rtmppacket.h    2009-07-13 22:33:23.000000000 -0700
@@ -56,7 +56,7 @@

       BYTE    m_headerType;
       BYTE    m_packetType;
-      BYTE    m_nChannel;
+      int    m_nChannel;
       int32_t    m_nInfoField1; // 3 first bytes
       int32_t    m_nInfoField2; // last 4 bytes in a long header, absolute timestamp for long headers, relative timestamp for short headers
       bool      m_hasAbsTimestamp; // timestamp absolute or relative?

I should point out, it's possible I have the 3 byte decode wrong; the text says the 3rd byte is most significant, but the Figure implies that it's the 2nd byte. So maybe it should be t[0] + t[1] << 8 instead. I suspect though that the actual value doesn't matter to us...
Reply
Cool, I see my patch has been added to flvstreamer's svn now.
Reply
The massive allocations were a problem, needed to convert to std vector but have had alot on the plate.
Reply
Is your C++ patch to fix an issue in XBMC that was causing the HULU plugin to no longer work? Or was the patch for flvstreamer?
Quote:Cool, I see my patch has been added to flvstreamer's svn now.
Reply
The patch was for a bug in flvstreamer. I haven't looked at the XBMC hulu plugin lately.
Reply
Reply
And one more patch to retrieve the v= parameter. (This must be applied on top of the previous patch.) Also I've formatted the output as perl source:

Code:
diff -u -r1.2 ./hulu-get-keys.c
--- ./hulu-get-keys.c    2009/10/28 03:05:45    1.2
+++ ./hulu-get-keys.c    2009/11/02 08:14:10
@@ -41,7 +41,7 @@
    SwfdecAsContext *ctx;
    SwfdecAsValue out;
    SwfdecAsObject *obj;
-    SwfdecAsObject *xmlkeys, *keypair;
+    SwfdecAsObject *keys, *keypair;
    struct _SwfdecSandbox *sbox;
    const char *txt, *a2, *a3;
    gboolean res;
@@ -96,14 +96,27 @@
    }
    obj = SWFDEC_AS_VALUE_GET_OBJECT(out);

+    txt = swfdec_as_context_get_string(ctx, "v");    
+    res = swfdec_as_object_call(obj, txt, 0, NULL, &out);
+    txt = swfdec_as_value_to_string(ctx,out);
+    printf("my $v='%s';\n", txt);
+
    txt = swfdec_as_context_get_string(ctx, "copyrighted_strings");    
    res = swfdec_as_object_get_variable(obj, txt, &out);
    if (!res) {
        fprintf(stderr, "class copyrighted_strings not found\n");
        return 1;
    }
-    txt = swfdec_as_value_to_string(ctx,out);
-    puts(txt);
+    keys = SWFDEC_AS_VALUE_GET_OBJECT(out);
+    nkeys = swfdec_as_array_get_length(keys);
+    printf("my @pid=(");
+    for (i=0; i<nkeys; i++) {
+        swfdec_as_array_get_value(keys, i, &out);
+        txt = swfdec_as_value_to_string(ctx,out);
+        if (i) printf(",");
+        printf("\n\t'%s'", txt);
+    }
+    printf(");\n");

    a2 = swfdec_as_context_get_string(ctx, "a2");    
    a3 = swfdec_as_context_get_string(ctx, "a3");    
@@ -113,10 +126,11 @@
        fprintf(stderr, "class xmldecskeys not found\n");
        return 1;
    }
-    xmlkeys = SWFDEC_AS_VALUE_GET_OBJECT(out);
-    nkeys = swfdec_as_array_get_length(xmlkeys);
+    keys = SWFDEC_AS_VALUE_GET_OBJECT(out);
+    nkeys = swfdec_as_array_get_length(keys);
+    printf("my @smil=(");
    for (i=0; i<nkeys; i++) {
-        swfdec_as_array_get_value(xmlkeys, i, &out);
+        swfdec_as_array_get_value(keys, i, &out);
        keypair = SWFDEC_AS_VALUE_GET_OBJECT(out);
        res = swfdec_as_object_get_variable(keypair, a2, &out);
        if (!res) {
@@ -124,7 +138,8 @@
            return 1;
        }
        txt = swfdec_as_value_to_string(ctx,out);
-        puts(txt);
+        if (i) printf(",");
+        printf("\n['%s', ", txt);

        res = swfdec_as_object_get_variable(keypair, a3, &out);
        if (!res) {
@@ -132,8 +147,9 @@
            return 1;
        }
        txt = swfdec_as_value_to_string(ctx,out);
-        puts(txt);
+        printf("'%s']", txt);
    }
+    printf(");\n");

    return !res;
}
Reply
http://code.google.com/p/xbmc-addons/iss...tail?id=49

Need some help figuring out why the buffering is broken. Perhaps it will work better in a newer SVN rev?

Yes, it works fine using r28276.
Reply
They are in the midst of migrating to a new CDN, and some of the parsing needs to be fixed again.

Is anyone using this plugin now, or am I just talking to myself? If no one's using it I'm not going to bother updating the patch.
Reply
highlandsun Wrote:Is anyone using this plugin now, or am I just talking to myself? If no one's using it I'm not going to bother updating the patch.

The plugin is working again? I've been following this thread as Hulu support in XBMC again has been my dream since it broke... I'm currently switching between XBMC and Boxee simply for the Hulu support. I'm not familiar with using a diff patch nor do I have the original Hulu plugin to patch it with, but I'll try to get this up and running today. Thanks!
Reply
ditto. It would be fantastic to get hulu support going again.

-Chris
Reply
You're going to need several customizations to get this working; the plugin uses some python crypto modules that aren't part of the default XBMC build. I guess you should be able to just install the modules in your ~/.xbmc directory but I don't know the details. (And since it does the crypto in python, you no longer need gnash or any other external programs.)

You also need to recompile XBMC anyway, incorporating the patch here http://trac.xbmc.org/ticket/8971 (which I also discussed in this thread http://forum.xbmc.org/showthread.php?tid=70512 )

Since I already have python 2.6 installed on my machine, I configured my XBMC build to use the system python instead of its internal one.

When applying the patch, I just replace xbmc/xbmc/lib/libRTMP with a symlink to rtmpdump/librtmp. That way I don't have to change any other link or compile paths.

I've uploaded my plugin to http://highlandsun.com/hyc/Hulu.zip, you should be able to just extract it in your plugins folder. (It's the actual source tree, so it contains a lot of extra junk you don't need. It also contains the SVN history so you can type "svn diff" to see what I fixed.)
Reply
I just noticed, this plugin is using the RSS feeds to populate the list of episodes. But the RSS feeds only show "new" material, stuff that was recently added. So e.g. if a show has 2 seasons, the RSS feed will likely only list the latest episodes in season 2. That whole part needs to be reworked...
Reply
  • 1
  • 6
  • 7
  • 8(current)
  • 9
  • 10
  • 19

Logout Mark Read Team Forum Stats Members Help
Hulu Plugin Development Thread - Developers only!1