This code is test.
The compiler the error petty to catch
Can you make a build.sh file ?
lib, include file send to email.
Can you library additional method and Build.sh which it will make the possibility of decreasing it is?
Thank you.
- Code: Select all Expand view RUN
#include "FiveLinux.ch"
FUNC Main()
loca oWnd, oBrw
DEFINE WINDOW oWnd TITLE "Testing Browses" SIZE 522, 317
@ 28, 2 BUTTON "_Ok" OF oWnd ACTION msginfo(TTIME())
@ 28, 10 BUTTON "_Exit" OF oWnd ACTION oWnd:End()
@ 28, 28 BUTTON "_Test" OF oWnd ACTION OPEN_PORT1(oWnd:hWnd, "testtetetete")
@ 28, 46 BUTTON "_Port" OF oWnd ACTION TEST()
ACTIVATE WINDOW oWnd
RETU NIL
/*----------------------------------------*/
#pragma BEGINDUMP
#include <hbapi.h>
//#include <hbdefs.h>
#include <gtk/gtk.h>
#define _LARGEFILE64_SOURCE 1
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <termios.h>
#define _DEFINE_FMP_TYPES_
#include <fmp.h>
#define PLAYING 1
#define PAUSED 0
#define FMPE_OK 0x00000000 /* No error */
#define FMPF_DVD 6 /* DVD demux */
#define NO_DRIVE 0xFF /* No DVD-ROM drive */
int peek = -1;
struct termios orig, new;
HB_FUNC( TTIME )
{
struct tm *tm_ptr;
int i;
char sm[50];
time_t the_time;
(void) time(&the_time);
tm_ptr = gmtime(&the_time);
sprintf(sm, "%02d:%02d:%02d", tm_ptr->tm_hour, tm_ptr->tm_min, tm_ptr->tm_sec);
hb_retc(sm);
}
HB_FUNC( TEST )
{
int fd;
int streamtype;
int bytesread=1,rc=FMPE_OK;
int buf, playfile_state;
int b_stopit = 0, b_getoutofit = 0;
streamtype=FMPF_DVD;
MPEGDriverEntry(NO_DRIVE);
FMPOpen(streamtype,32*1024,10, NULL, 0);
FMPPlay();
hb_retc("OK");
}
HB_FUNC( OPEN_PORT1 )
{
GtkWidget * hWnd, * hWndParent = NULL;
hWnd = hb_parnl(1);
CheckGtkInit();
if( gtk_window_list_toplevels() )
hWndParent = gtk_window_list_toplevels()->data;
hWnd = gtk_message_dialog_new( GTK_WINDOW( hWndParent ),
GTK_DIALOG_MODAL,
GTK_MESSAGE_INFO, GTK_BUTTONS_OK, hb_parc(2) );
gtk_window_set_transient_for( GTK_WINDOW( hWnd ), GTK_WINDOW( hWndParent ) );
gtk_window_set_policy( GTK_WINDOW( hWnd ), FALSE, FALSE, FALSE );
gtk_window_set_position( GTK_WINDOW( hWnd ), GTK_WIN_POS_CENTER );
gtk_dialog_run( GTK_DIALOG( hWnd ) );
gtk_widget_destroy( hWnd );
}
#pragma ENDDUMP
this code is RMPLAYFILE ->Makefile
- Code: Select all Expand view RUN
CFLAGS+=-D_BARBADOS_=1 -Wall -D_REENTRANT
INCLUDEDIR+=-I../include
LIBDIR+=-L../lib
ifeq ($(COMPILKIND),release)
CDEBUG=-O2
LDEBUG=-O2
else
CDEBUG=-g
LDEBUG=-g
endif
CFLAGS+=$(CDEBUG) $(INCLUDEDIR)
LDFLAGS+=$(LDEBUG) $(LIBDIR) -lpthread
progs = playfile.o
playfile: $(progs) ../lib/libEM84xx.so
$(CC) $(LDFLAGS) -lEM84xx $(progs) -o $@
ifeq ($(COMPILKIND),release)
strip $@
endif
clean:
$(RM) $(progs) *~ playfile
this code is RMPLAYFILE ->playfile.c code
- Code: Select all Expand view RUN
#define _LARGEFILE64_SOURCE 1
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <termios.h>
#define _DEFINE_FMP_TYPES_
#include "fmp.h"
#define PLAYING 1
#define PAUSED 0
int peek = -1;
struct termios orig, new;
void open_port()
{
if (tcgetattr(0,&orig)==-1)
{
printf("Could not tcgetattr");
exit(1);
}
new = orig;
/* settings for raw mode */
new.c_lflag &= ~ICANON;
new.c_lflag &= ~ECHO;
new.c_lflag &= ~ISIG;
new.c_cc[VMIN] = 1;
new.c_cc[VTIME] = 0;
if (tcsetattr(0,TCSANOW,&new)==-1)
{
printf("Could not tcsetattr");
exit(1);
}
}
void close_port()
{
tcsetattr(0, TCSANOW, &orig);
}
int kbhit()
{
char ch;
int nread;
if(peek != -1) return 1;
new.c_cc[VMIN] = 0;
tcsetattr(0, TCSANOW, &new);
nread = read(0, &ch, 1);
new.c_cc[VMIN] = 1;
tcsetattr(0, TCSANOW, &new);
if(nread == 1)
{
peek = ch;
return 1;
}
return 0;
}
int readch()
{
char ch;
if(peek != -1)
{
ch = peek;
peek = -1;
return ch;
}
read(0, &ch, 1);
return ch;
}
DWORD setOutputMode(DWORD newvgatv)
{
DWORD vgatv;
vgatv = FMPGet(FMPI_VIDEOOUT);
vgatv = vgatv & (~FMPV_VIDEOOUT_MODE_MASK);
vgatv = vgatv | newvgatv;
return FMPSet(FMPI_VIDEOOUT, vgatv);
}
int main(int argc,char **argv)
{
int fd;
int streamtype;
int bytesread=1,rc=FMPE_OK;
int buf, playfile_state;
int b_stopit = 0, b_getoutofit = 0;
if (argc!=3) {
fprintf(stderr,
"Syntax is playfile <streamtype> <filename>\n"
"<streamtype -> t (transport) d (dvd) s (system)\n"
" p (program) v (video) m (mpeg audio) a (mpeg2 ac3)>\n"
"Example: ./playfile s /samplempeg/movie.mpg\n"
"During the file playing use your keyboard:\n"
" 'r' to rewind from the beginning,\n"
" 'q' to stop, close and exit propely.\n"
);
exit(1);
}
switch (argv[1][0]) {
case 't':
streamtype=FMPF_TRANSPORT;
break;
case 'd':
streamtype=FMPF_DVD;
break;
case 's':
streamtype=FMPF_SYSTEM;
break;
case 'p':
streamtype=FMPF_PROGRAM;
break;
case 'v':
streamtype=FMPF_VIDEO;
break;
case 'm':
streamtype=FMPF_MPEG_AUDIO;
break;
case 'a':
streamtype=FMPF_AC3;
break;
default:
fprintf(stderr,
"Syntax is playfile <streamtype> <filename>\n"
"<streamtype -> t (transport) d (dvd) s (system)\n"
" p (program) v (video) m (mpeg audio) a (mpeg2 ac3)>\n"
"Example: ./playfile s /samplempeg/movie.mpg\n"
"During the file playing use your keyboard:\n"
" 'r' to rewind from the beginning,\n"
" 'q' to stop, close and exit propely.\n"
);
exit(1);
}
MPEGDriverEntry(NO_DRIVE);
FMPOpen(streamtype,32*1024,10, NULL, 0);
FMPPlay();
fd=open(argv[2],O_RDONLY|O_LARGEFILE);
if (fd==-1) {
perror("open failed");
exit(1);
}
open_port();
playfile_state = PLAYING;
while (rc==FMPE_OK && !b_getoutofit) {
while (bytesread && !b_stopit) {
FMP_BUFFER FMPBuf;
static int count=0;
if(kbhit())
{
buf = readch();
switch(buf)
{
case 'r':
b_stopit = 1;
fprintf(stdout,">> Rewind ...\n");
break;
case 'q':
b_stopit = 1;
b_getoutofit = 1;
break;
default:
break;
}
}
// get a pointer to a free buffer
rc = FMPGetBuffer (&FMPBuf, TRUE);
if (rc != FMPE_OK) {
printf ("FMPError : %s\n", FMPGetLastError(rc));
break;
}
// signals can cause harmless EINTR
while (((bytesread=read(fd,FMPBuf.pBuffer,FMPBuf.dwBufferSize))==-1)
&&(errno==EINTR));
if (bytesread==-1) bytesread=0;
FMPBuf.dwDataSize=bytesread;
// the buffer is ready to be queued
FMPPush (&FMPBuf);
count++;
#define ONEEVERY 20
if (count%ONEEVERY==0) printf("PTS %ld / STC %ld\n",
FMPGet (FMPI_PTS),
FMPGet (FMPI_STC));
}
FMPStop();
FMPPlay();
if(!b_getoutofit)
b_stopit = 0;
lseek (fd,0,SEEK_SET);
bytesread=1;
}
fprintf(stdout,">>Exited from playing loop !\n");
close_port();
close (fd);
FMPStop();
setOutputMode(FMPV_VIDEOOUT_VGA);
FMPClose();
MPEGDriverUnload();
fprintf(stdout,">>Driver is closed !\n");
exit(0);
}
FiveLinux User.