Ignore:
Timestamp:
04/22/12 23:07:50 (14 months ago)
Author:
reyalp
Message:

remove old protocol - note completely incompatible with previous test versions and chdkptp builds

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/reyalp-ptp-live/core/live_view.c

    r1821 r1824  
    88#ifdef CAM_CHDK_PTP 
    99 
    10 // PTP Live View functions 
    11  
    12 // Function used to send core live view info back to client 
    13 // this is data that does not change (including version info) 
    14 static int live_view_core_info(ptp_data *data) 
    15 { 
    16     int total_size;             // Calculated total size of data to transfer to client 
    17  
    18     // Structure to populate with live view info 
    19     lv_base_info details; 
    20  
    21     // Populate structure info 
    22     details.version_major       = LIVE_VIEW_VERSION_MAJOR; 
    23     details.version_minor       = LIVE_VIEW_VERSION_MINOR; 
    24     details.vp_max_width        = vid_get_viewport_max_width(); 
    25     details.vp_max_height       = vid_get_viewport_max_height(); 
    26     details.vp_buffer_width     = vid_get_viewport_buffer_width_proper(); 
    27     /* 
    28     details.bm_max_width        = ASPECT_XCORRECTION(vid_get_bitmap_screen_width()); 
    29     details.bm_max_height       = vid_get_bitmap_screen_height(); 
    30     details.bm_buffer_width     = vid_get_bitmap_buffer_width(); 
    31     */ 
    32     details.bm_max_width        = ASPECT_XCORRECTION(camera_screen.width); 
    33     details.bm_max_height       = camera_screen.height; 
    34     details.bm_buffer_width     = camera_screen.buffer_width; 
    35     details.lcd_aspect_ratio    = vid_get_aspect_ratio(); 
    36  
    37     total_size = sizeof(details); 
    38  
    39     // Send header structure (along with total size to be sent) 
    40     data->send_data(data->handle,(char*)&details,sizeof(details),total_size,0,0,0); 
    41  
    42     return total_size; 
    43 } 
    44  
    45 // Function used to get viewport, bitmap and palette data via PTP 
    46 // Address of this function sent back to client program which then 
    47 // calls this with options to determine what to transfer 
    48 int live_view_data_handler(ptp_data *data, int flags, int arg2) 
    49 { 
    50     int total_size;             // Calculated total size of data to transfer to client 
    51  
    52     if (flags & LV_TFR_CORE_DETAILS) 
    53     { 
    54         // Send base info including version 
    55         return live_view_core_info(data); 
    56     } 
    57  
    58     // Structure containing the info for the current live view frame 
    59     lv_vid_info vid_info; 
    60  
    61     // Populate the above structure with the current default details 
    62     vid_info.vp_xoffset = vid_get_viewport_xoffset_proper(); 
    63     vid_info.vp_yoffset = vid_get_viewport_yoffset_proper(); 
    64     vid_info.vp_width = vid_get_viewport_width_proper(); 
    65     vid_info.vp_height = vid_get_viewport_height_proper(); 
    66     vid_info.vp_buffer_start = 0; 
    67     vid_info.vp_buffer_size = 0; 
    68     vid_info.bm_buffer_start = 0; 
    69     vid_info.bm_buffer_size = 0; 
    70     vid_info.palette_type = vid_get_palette_type(); 
    71     vid_info.palette_buffer_start = 0; 
    72     vid_info.palette_buffer_size = 0; 
    73  
    74     total_size = sizeof(vid_info); 
    75  
    76     void *vp = vid_get_viewport_active_buffer(); 
    77     // Add viewport details if requested, and not null 
    78     if ( flags & LV_TFR_VIEWPORT && vp) // live buffer 
    79     { 
    80         vid_info.vp_buffer_start = total_size; 
    81         // TODO viewport buffer height can vary, e.g. a540 in 640x480 video=528, normal 240 
    82         // but shouldn't send max size when not in use 
    83         vid_info.vp_buffer_size = (vid_get_viewport_buffer_width_proper()*vid_get_viewport_max_height()*6)/4; 
    84         total_size += vid_info.vp_buffer_size; 
    85     } 
    86  
    87     // Add bitmap details if requested 
    88     if ( flags & LV_TFR_BITMAP ) // bitmap buffer 
    89     { 
    90         vid_info.bm_buffer_start = total_size; 
    91         //vid_info.bm_buffer_size = vid_get_bitmap_buffer_width()*vid_get_bitmap_screen_height(); 
    92         vid_info.bm_buffer_size = camera_screen.buffer_width*camera_screen.buffer_height; 
    93         total_size += vid_info.bm_buffer_size; 
    94     } 
    95  
    96     // Add palette detals if requested and available 
    97     if ( flags & LV_TFR_PALETTE  && vid_get_palette_size() ) // bitmap palette 
    98     { 
    99         vid_info.palette_buffer_start = total_size; 
    100         vid_info.palette_buffer_size = vid_get_palette_size(); 
    101         total_size += vid_info.palette_buffer_size; 
    102     } 
    103  
    104     // Send header structure (along with total size to be sent) 
    105     data->send_data(data->handle,(char*)&vid_info,sizeof(vid_info),total_size,0,0,0); 
    106  
    107     // Send viewport data if requested 
    108     if ( flags & LV_TFR_VIEWPORT && vp) 
    109     { 
    110         data->send_data(data->handle,vp,vid_info.vp_buffer_size,0,0,0,0); 
    111     } 
    112  
    113     // Send bitmap data if requested 
    114     if ( flags & LV_TFR_BITMAP ) 
    115     { 
    116         data->send_data(data->handle,vid_get_bitmap_active_buffer(),vid_info.bm_buffer_size,0,0,0,0); 
    117     } 
    118  
    119     // Send palette data if requested 
    120     // don't try to send zero sized palette data, since palette type is theoretically variable, 
    121     // doesn't make sense for clients to check before requesting 
    122     if ( (flags & LV_TFR_PALETTE) && vid_get_palette_size() ) 
    123     { 
    124         data->send_data(data->handle,vid_get_bitmap_active_palette(),vid_info.palette_buffer_size,0,0,0,0); 
    125     } 
    126  
    127     return total_size; 
    128 } 
    129  
    13010int live_view_get_data(ptp_data *data, int flags) { 
    13111    lv_data_header lv; 
     12    lv.version_major = LIVE_VIEW_VERSION_MAJOR; 
     13    lv.version_minor = LIVE_VIEW_VERSION_MINOR; 
     14 
    13215    lv.lcd_aspect_ratio    = vid_get_aspect_ratio(); 
    13316 
Note: See TracChangeset for help on using the changeset viewer.