video streaming using websocket. but,streaming is very slower than 0.1fps.

Dependencies:   BaseUsbHost EthernetInterface WebSocketClient mbed-rtos mbed

Fork of BaseUsbHost_example by Norimasa Okamoto

viewer

Revision:
2:c10029b87439
Parent:
1:80205a2de336
Child:
3:6ae9a03a6145
--- a/example2_LifeCamVX700.cpp	Wed Dec 05 13:25:18 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-#if 0
-// example2_LifeCamVX700.cpp
-#include "mbed.h"
-#include "rtos.h"
-#include "BaseUsbHost.h"
-#define DEBUG
-#include "BaseUsbHostDebug.h"
-#define TEST
-#include "BaseUsbHostTest.h"
-#include "LifeCamVX700.h"
-#include "BaseJpegDecode.h"
-#include "Terminal.h"
-
-// LifeCamVX700
-#define WIDTH  160
-#define HEIGHT 120
-
-#define THRESHOLD 200
-
-DigitalOut led1(LED1), led2(LED2), led3(LED3), led4(LED4);
-Terminal term(USBTX, USBRX);
-
-class JpegDecode : public BaseJpegDecode {
-public:
-    uint32_t EOI_count;
-    int8_t m_buf[WIDTH/8*HEIGHT/8];
-    bool mode_CbCr;
-    JpegDecode() {
-        mode_CbCr = false;
-        EOI_count = 0;
-        memset(m_buf, 0, sizeof(m_buf));
-    }
-    virtual void outputDC(int mcu, int block, int value) {
-        if (mcu >= (WIDTH/16*HEIGHT/8)) {
-            return;
-        }
-        if (mode_CbCr) {
-            if (block == 2 || block == 3) {
-                value *= qt[1][0];
-                value /= 16;
-                m_buf[mcu*2+block-2] = value;
-            }
-        } else {
-            if (block == 0 || block == 1) {
-                value *= qt[0][0];
-                value /= 16;
-                m_buf[mcu*2+block] = value;
-            }
-        }
-    }
-    virtual void outputAC(int mcu, int block, int scan, int value){};
-    virtual void outputMARK(uint8_t c){
-        if (c == 0xd9) { // EOI
-            EOI_count++;
-            led3 = !led3;
-        }
-    };
-};
-
-JpegDecode* decode = NULL;
-void callback_motion_jpeg(uint16_t frame, uint8_t* buf, int len)
-{
-    if (decode) {
-        decode->input(buf+12, len-12);
-    }
-    if (buf[1]&1) { // FID
-        led1 = !led1;
-    }
-}
-
-BaseUsbHost *UsbHost;
-UsbHub* hub;
-ControlEp* ctlEp = NULL;
-LifeCamVX700* cam;
-
-void display_thread(void const *args) {
-    term.cls();
-    int n = 0;
-    while(1) {
-        int y;
-        for(y = 0; y < HEIGHT/8; y++) {
-            term.locate(0, y);
-            for(int x = 0; x < WIDTH/8; x++) {
-                int value = decode->m_buf[y*WIDTH/8+x];
-                term.printf("%+3d,", value);
-            }
-        }
-        term.locate(0, y);
-        term.printf("[%s width=%d height=%d yblock=%d %u]\n", decode->mode_CbCr ? "CbCr": "Y0Y1",  
-            decode->width, decode->height, decode->yblock, decode->EOI_count);
-        term.printf("[CC:"); 
-        for(int i = 0; i < 16; i++) {
-            term.printf(" %u", cam->report_cc_count[i]); 
-        }
-        term.printf("]\n"); 
-        term.printf("[PS:"); 
-        for(int i = 0; i < 16; i++) {
-            term.printf(" %u", cam->report_ps_cc_count[i]); 
-        }
-        term.printf("]\n"); 
-        Thread::wait(200);
-        //Thread::signal_wait(1, 2000);
-        led2 = !led2;
-        if (n++ > (20000/200)) {
-            n = 0;
-            decode->mode_CbCr = !decode->mode_CbCr;
-        }
-    }
-}
-
-int main() {
-    term.baud(921600);
-    term.printf("%s\n", __FILE__);
-
-    decode = new JpegDecode;
-    TEST_ASSERT(decode);
-
-    UsbHost = new BaseUsbHost;
-    TEST_ASSERT_TRUE(UsbHost);
-
-    UsbHub* hub = new UsbHub();
-    TEST_ASSERT_TRUE(hub);
-
-    for(int i = 0; i < MAX_HUB_PORT; i++) {
-        if (LifeCamVX700::check(hub->PortEp[i])) {
-            ctlEp = hub->PortEp[i];
-            break;
-        }
-    }
-    if (ctlEp == NULL) {
-        error("LifeCamVX700 not found\n");
-    }
-    
-    cam = new LifeCamVX700(VX700_160x120, _5FPS, ctlEp); 
-    TEST_ASSERT_TRUE(cam);
-    cam->setOnResult(callback_motion_jpeg);
-
-    Thread thread(display_thread, NULL, osPriorityBelowNormal);
- 
-    while(1) {
-        cam->poll();
-    }
-}
-#endif