Index: video_filter.codecs.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/video_filter/video_filter.codecs.inc,v
retrieving revision 1.3.2.8
diff -u -r1.3.2.8 video_filter.codecs.inc
--- video_filter.codecs.inc	2 May 2009 10:56:30 -0000	1.3.2.8
+++ video_filter.codecs.inc	28 Jul 2009 13:54:12 -0000
@@ -100,6 +100,17 @@
     'regexp' => '/capped\.tv\/([a-zA-Z0-9\-_]+)/',
     'ratio' => 425 / 355,
   );
+  $codecs['bliptv'] = array(
+    'name' => t('Blip.tv'),
+    'callback' => 'video_filter_bliptv',
+    'regexp' => array(
+                  '@blip\.tv/rss/flash/([^"\&\?/]+)@i',
+                  '@blip\.tv/file/view/([^"\&\?/]+)@i',
+                  '@blip\.tv/file/([^"\&\?/]+)@i',
+                  '@blip\.tv/play/([^"\&\?/]+)@i',
+                ),
+    'ratio' => 480 / 335,
+  );
 
   return $codecs;
 }
@@ -206,4 +217,53 @@
   $video['source'] = 'http://capped.micksam7.com/playeralt.swf?vid='.$video['codec']['matches'][1];
 
   return video_filter_flash($video);
+}
+
+function video_filter_bliptv($video) {
+  $id = $video['codec']['matches'][1];
+  
+  // Since video ID in URL is different than in embed code, use API
+  // to lookup the embed code video ID. Adapted from emfield.module.
+  $result = drupal_http_request('http://blip.tv/file/' . $id . '?skin=api');
+
+  if ($result->code == 200) {
+    $parser = drupal_xml_parser_create($result->data);
+    $vals = array();
+    $index = array();
+    xml_parse_into_struct($parser, $result->data, $vals, $index);
+    xml_parser_free($parser);
+  
+    $response = array();
+    $response['_emfield_arghash'] = $arghash;
+    $level = array();
+    $start_level = 1;
+    foreach ($vals as $xml_elem) {
+      if ($xml_elem['type'] == 'open') {
+        if (array_key_exists('attributes', $xml_elem)) {
+          list($level[$xml_elem['level']], $extra) = array_values($xml_elem['attributes']);
+        }
+        else {
+          $level[$xml_elem['level']] = $xml_elem['tag'];
+        }
+      }
+      if ($xml_elem['type'] == 'complete') {
+        $php_stmt = '$response';
+        while ($start_level < $xml_elem['level']) {
+          $php_stmt .= '[$level['. $start_level .']]';
+          $start_level++;
+        }
+        $php_stmt .= '[$xml_elem[\'tag\']][] = $xml_elem[\'value\'];'. $php_stmt .'[$xml_elem[\'tag\']][] = $xml_elem[\'attributes\'];';
+        eval($php_stmt);
+        $start_level--;
+      }
+    }
+    $id = $response['EMBEDLOOKUP'][0];
+  }
+  
+  $video['source'] = 'http://blip.tv/play/' . $id;
+  $params = array(
+    'allowscriptaccess' => 'always',
+  );
+  
+  return video_filter_flash($video, $params);
 }
\ No newline at end of file
