OSDN Git Service

[MOVIE_LOADER] Fix scaling factor.Displaying video as correct width and height.
[csp-qt/common_source_project-fm7.git] / source / src / qt / osd_wrapper.cpp
index 41f5da8..fdf04c2 100644 (file)
@@ -92,7 +92,6 @@ void OSD::load_sound_file(int id, const _TCHAR *name, int16_t **data, int *dst_s
 
 void OSD::free_sound_file(int id, int16_t **data)
 {
-       void *pp;
        if(data == NULL) return;
        for(int i = 0; i < USE_SOUND_FILES; i++) {
                SOUND_LOADER *p = sound_file_obj[i];
@@ -319,20 +318,24 @@ int OSD::get_screen_height(void)
 void OSD::lock_vm(void)
 {
        locked_vm = true;
-       if(parent_thread != NULL) { 
-               if(!parent_thread->now_debugging()) VMSemaphore->acquire(1);
-       } else {
-               VMSemaphore->acquire(1);
-       }
+       vm_mutex->lock();
+       //if(parent_thread != NULL) { 
+               //if(!parent_thread->now_debugging()) VMSemaphore->acquire(1);
+               //VMSemaphore->acquire(1);
+       //} else {
+       //      VMSemaphore->acquire(1);
+       //}
 }
 
 void OSD::unlock_vm(void)
 {
-       if(parent_thread != NULL) { 
-               if(!parent_thread->now_debugging()) VMSemaphore->release(1);
-       } else {
-               VMSemaphore->release(1);
-       }
+       vm_mutex->unlock();
+       //if(parent_thread != NULL) { 
+       //      //if(!parent_thread->now_debugging()) VMSemaphore->release(1);
+       //      VMSemaphore->release(1);
+       //} else {
+       //      VMSemaphore->release(1);
+       //}
        locked_vm = false;
 }
 
@@ -344,16 +347,7 @@ bool OSD::is_vm_locked(void)
 
 void OSD::force_unlock_vm(void)
 {
-       if(parent_thread == NULL) {
-               while(VMSemaphore->available() < 1) VMSemaphore->release(1);
-               locked_vm = false;
-               return;
-       }
-       if(parent_thread->now_debugging()) {
-               locked_vm = false;
-               return;
-       }
-       while(VMSemaphore->available() < 1) VMSemaphore->release(1);
+       vm_mutex->unlock();
        locked_vm = false;
 }
 
@@ -363,11 +357,10 @@ void OSD::set_draw_thread(DrawThreadClass *handler)
        connect(this, SIGNAL(sig_update_screen(bitmap_t *)), handler, SLOT(do_update_screen(bitmap_t *)));
        connect(this, SIGNAL(sig_save_screen(const char *)), glv, SLOT(do_save_frame_screen(const char *)));
        connect(this, SIGNAL(sig_resize_vm_screen(QImage *, int, int)), glv, SLOT(do_set_texture_size(QImage *, int, int)));
+       connect(this, SIGNAL(sig_resize_vm_lines(int)), glv, SLOT(do_set_horiz_lines(int)));
        connect(parent_thread, SIGNAL(sig_debugger_input(QString)), this, SLOT(do_set_input_string(QString)));
        connect(parent_thread, SIGNAL(sig_quit_debugger()), this, SLOT(do_close_debugger_thread()));
        connect(this, SIGNAL(sig_close_window()), parent_thread, SLOT(doExit()));
-       connect(this, SIGNAL(sig_console_input_string(QString)), parent_thread, SLOT(do_call_debugger_command(QString)));
-       
 }
 
 void OSD::initialize_screen()
@@ -473,9 +466,9 @@ void OSD::close_movie_file()
 #include <limits.h>
 uint32_t OSD::get_cur_movie_frame()
 {
-       uint64_t pos;
 #if defined(USE_MOVIE_PLAYER) || defined(USE_VIDEO_CAPTURE)
        if(movie_loader != NULL) {
+               uint64_t pos;
                pos = movie_loader->get_current_frame();
                if(pos > UINT_MAX) {
                        return UINT_MAX;
@@ -504,7 +497,8 @@ void OSD::do_run_movie_audio_callback(uint8_t *data, long len)
 void OSD::do_decode_movie(int frames)
 {
 #if defined(USE_MOVIE_PLAYER) || defined(USE_VIDEO_CAPTURE)
-       movie_loader->do_decode_frames(frames, this->get_vm_window_width(), this->get_vm_window_height());
+       //movie_loader->do_decode_frames(frames, SCREEN_WIDTH, SCREEN_HEIGHT);
+       movie_loader->do_decode_frames(frames, vm_window_width_aspect, vm_window_height_aspect);
 #endif 
 }
 
@@ -522,16 +516,19 @@ int OSD::get_movie_sound_rate()
 #if defined(USE_MOVIE_PLAYER) || defined(USE_VIDEO_CAPTURE)
        return movie_loader->get_movie_sound_rate();
 #endif
+       return 44100;
 }
 
 void OSD::reset_vm_node()
 {
        device_node_t sp;
        device_node_list.clear();
+       csp_logger->reset();
        max_vm_nodes = 0;
        for(DEVICE *p = vm->first_device; p != NULL; p = p->next_device) {
                sp.id = p->this_device_id;
                sp.name = p->this_device_name;
+               csp_logger->set_device_name(sp.id, sp.name);
                csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL,  "Device %d :%s", sp.id, sp.name);
                device_node_list.append(sp);
                if(max_vm_nodes <= p->this_device_id) max_vm_nodes = p->this_device_id + 1;