[vlc-devel] Adding funtionality to VLC source code (version 1.0.2)

Srinidhi Devang m.g.srinidhidevang at gmail.com
Thu Jul 15 11:15:08 CEST 2010


Hi VLC developers,
I'm a newbie to VLC source code compilation. I'm tring to add some *additional
functionalites* to the existing VLC source code of version 1.0.2 .My aim is
to display the PSNR values to the OSD using marquee string.

Current work flow:
*)with a funtion i'm calculating  PSNR values in X264.c module of existing
vlc source code and  that calculated value i need to send to OSD using marq
marquee string command. I'm opening a socket in my program and in vlc GUI i
enabled RC interface,set the IP and port number.
*) now i'm writing below a  function to take the PSNR value which i was
calculating earlier as an argument to this function and by making use of
marq command i'm trying to send to OSD.This function i'm writing in the same
X264.c module. (both PSNR  calculation function and the below function both
i'm writing in the same X264.c module.)

//write_psnr_to_rc()  to write PSNR into OSD

 #include <sys/socket.h> //these are the header files required for my
function
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include<unistd.h>

void write_psnr_to_rc(int PSNR_val)
{
 static int sock;
 int i=0;
 char send_data[1024]="\0",*end;
 static struct hostent *host;
 addrinfo_sri server_addr;
 char line[128] = {0};
 static int index = 1;
 if(index == 1)
 {

  host = gethostbyname("XXX.XXX.XXX.XXX");

  if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
  {
   perror("Socket");
   exit(1);
  }
  server_addr.sin_family = AF_INET;
  server_addr.sin_port = htons(5555);
  server_addr.sin_addr = *((struct in_addr *)host->h_addr);
  bzero(&(server_addr.sin_zero),8);
  if (connect(sock, (struct sockaddr *)&server_addr,
     sizeof(struct sockaddr)) == -1)
  {
   perror("Connect");
   exit(1);
  }
 }

 snprintf(line, 128, "%d",PSNR_val);
 bzero(send_data, 1024);
 strcpy(send_data,"@marq marq-marquee PSNR="); //only  marq-marquee for 0.9
below and @marq marq-marquee for above 0.9 versions
 strcat(send_data,line);
 write(sock,&send_data[0], sizeof(send_data));//for writing into the socket
 sleep(1);
 bzero(line,128);
 ++index;
}



Need suggestions for the below:

*)Is there anything has to be changed in the above function so that my
function can work smoothly ??
*)May be i'm asking you a silly things but go easy on me..i'm a newbie to
this...:) i added the code and tried to compile but got the below errors.
could you explain y these errors are occuring??To compile i'm using cygwin.

x264.c: In function `write_psnr_to_rc':
x264.c:477: error: `SOCKET' undeclared (first use in this function)
x264.c:477: error: (Each undeclared identifier is reported only once
x264.c:477: error: for each function it appears in.)
x264.c:477: error: parse error before "n"
x264.c:478: error: implicit declaration of function `socket'
x264.c:478: error: `AF_INET' undeclared (first use in this function)
x264.c:478: error: `SOCK_STREAM' undeclared (first use in this function)
x264.c:484: error: structure has no member named `sin_family'
x264.c:485: error: structure has no member named `sin_port'
x264.c:485: error: implicit declaration of function `htons'
x264.c:486: error: structure has no member named `sin_addr'
x264.c:486: error: dereferencing pointer to incomplete type
x264.c:487: error: implicit declaration of function `bzero'
x264.c:487: error: structure has no member named `sin_zero'
x264.c:489: error: implicit declaration of function `connect'
x264.c:490: error: invalid application of `sizeof' to incomplete type
`sockaddr'


thanking you in advance,

with regards,
Srinidhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100715/87e2e435/attachment.html>


More information about the vlc-devel mailing list