Difference between revisions of "Talk:LibVLC Tutorial 0.9"

From VideoLAN Wiki
Jump to navigation Jump to search
(The code wasn't tested)
Line 8: Line 8:
 
is used for the tutorial, that would be fine, if the
 
is used for the tutorial, that would be fine, if the
 
text mentioned that.
 
text mentioned that.
 +
 +
[[User:davidlallen|davidlallen]] 17:29, 19 August 2007 (PST)
  
 
--
 
--
  
 
The code wasn't tested, but should work using 0.9.0, or at least show how to use.--[[User:Pdherbemont|Pdherbemont]] 22:36, 19 August 2007 (CEST)
 
The code wasn't tested, but should work using 0.9.0, or at least show how to use.--[[User:Pdherbemont|Pdherbemont]] 22:36, 19 August 2007 (CEST)
 
---
 
 
I am new to this wiki, and I don't want to jump too far
 
ahead.  However, I have modified the tutorial code so
 
that it compiles and runs on cygwin gcc 3.4 and windows
 
XP, using the latest released vlc version 0.8.6c.
 
 
I will paste the code here, in the talk page, in
 
case it would be a violation of etiquette to just dump
 
the code on the main page.  Note the code on the main
 
page has syntax errors at least, and either it has
 
big prototyping problems or else the related API's
 
are substantially different in whatever vlc version the
 
author used to compile against.
 
 
Note for linux, remove <windows.h>, change
 
"Sleep (10000)" to "sleep (10)".
 
 
#include <stdio.h>
 
#include <windows.h>
 
#include <vlc/libvlc.h>
 
 
static void quit_on_exception (libvlc_exception_t *excp) {
 
  if (libvlc_exception_raised (excp)) {
 
      fprintf(stderr, "error: %s\n", libvlc_exception_get_message(excp));
 
      exit(-1);
 
  }
 
}
 
 
int main(int argc, char **argv) {
 
  libvlc_exception_t excp;
 
  libvlc_instance_t *inst;
 
  int item;
 
  char *myarg0 = "-I";  char *myarg1 = "dummy";
 
  char *myarg2 = "--plugin-path=c:\\program files\\videolan\\plugins";
 
  char *myargs[4] = {myarg0, myarg1, myarg2, NULL};
 
  char *filename = "c:\\video\\main\\Everybody_Hates_Chris_Feb_26.mpg";
 
 
  libvlc_exception_init (&excp);
 
  inst = libvlc_new (3, myargs, &excp);
 
  quit_on_exception (&excp);
 
  item = libvlc_playlist_add (inst, filename, NULL, &excp);
 
  quit_on_exception (&excp);
 
  libvlc_playlist_play (inst, item, 0, NULL, &excp);
 
  quit_on_exception (&excp);
 
  Sleep (10000);
 
  libvlc_destroy (inst);
 
  return 0;
 
}
 

Revision as of 00:31, 20 August 2007

This code doesn't appear to compile. I am using gcc 3.4. But some of the problems are obvious, eg line 6, the parentheses don't match.

What version of libvlc was used to create the tutorial? Functions libvlc_media_... don't appear to exist in the latest release version, 0.8.6c. If an unreleased version is used for the tutorial, that would be fine, if the text mentioned that.

davidlallen 17:29, 19 August 2007 (PST)

--

The code wasn't tested, but should work using 0.9.0, or at least show how to use.--Pdherbemont 22:36, 19 August 2007 (CEST)