📄 pipe_cmd.c.svn-base
字号:
#include <stdio.h>#include <assert.h>#include <stdlib.h>#include <string.h>#include <fcntl.h>#include <sys/types.h>#include <sys/uio.h>#include <unistd.h>#include "pipe_cmd_pub.h"#include "xwin_pub.h"#include "player_pub.h"pipe_cmd_t *pipe_cmd_new(player_t *player_p) { pipe_cmd_t *pipe_cmd_p = g_new(pipe_cmd_t,1); pipe_cmd_p->player_p = player_p; return pipe_cmd_p;}void pipe_cmd_run(pipe_cmd_t *pipe_cmd_p) { int fd; char *dq; char name[32]; char value[1024]; char tmpstr[1024]; int i,ox=0,oy=0; int err; player_t *player_p = pipe_cmd_p->player_p; xwin_t *xwin_p = player_p->xwin_p; fd=open(player_p->pipe_cmd_filename_p,O_NONBLOCK|O_RDONLY); fcntl(fd,F_SETFL,(fcntl(fd,F_GETFL,0)&(~O_NONBLOCK))); assert( fd > 0 ); while(1) { bzero(tmpstr,1024); for (i=0;i<1024;i++) { err=read(fd,&(tmpstr[i]),1); if (err!=1) { printf("err\n"); } if (tmpstr[i]==10) { tmpstr[i]=0; break; } } if (err!=1) continue; assert(pthread_mutex_lock(&xwin_p->win_mutex)==0); dq=tmpstr; while(*dq) { i=0; while((*dq!='=')&&(*dq!=0)) { name[i]=*dq; dq++; i++; } name[i]=0; dq++; i=0; while((*dq!=';')&&(*dq!=0)) { value[i]=*dq; dq++; i++; } value[i]=0; dq++; switch(name[0]) { case 'V': switch(name[1]) { case 'x': xwin_p->win_x=atoi(value); break; case 'y': xwin_p->win_y=atoi(value); break; case 'w': xwin_p->win_width=atoi(value); break; case 'h': xwin_p->win_height=atoi(value); break; }; break; case 'O': switch(name[1]) { case 'x': ox = atoi(value); break; case 'y': oy = atoi(value); break; case 'w': case 'h': break; } break; case 'F': break; // 文件名,作废 case 'D': //XXX 窗口销毁 xwin_p->win_destory = 1; break; default: break; }; } xwin_p->win_dirty=1; xwin_p->win_ox = ox - xwin_p->win_x; xwin_p->win_oy = oy - xwin_p->win_y; // 如果 vh 或 vw 任何一个为 0 ,则表明 flash 不可见 if ((xwin_p->win_width ==0 ) || (xwin_p->win_height == 0)) { xwin_p->win_visable = 0; } else { xwin_p->win_visable = 1; }; assert(pthread_mutex_unlock(&xwin_p->win_mutex)==0); // xwin_move_position(xwin_p); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -