From 06f68b888f98031031f7b230be58bdb1cd57674d Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Wed, 3 Sep 2014 22:18:59 +0200
Subject: applying patch vlc-0.8.6i.patch


diff --git a/configure.ac b/configure.ac
index 67d0ceb..ad7cfc3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -256,6 +256,7 @@ case "${target_os}" in
     VLC_ADD_LDFLAGS([vlc logger],[-lbe])
     VLC_ADD_LDFLAGS([beos],[-lbe -lmedia -ltranslation -ltracker -lgame])
     VLC_ADD_LDFLAGS([dvdnav dvdread],[-ldl])
+    VLC_ADD_LDFLAGS([access_file],[-lpoll])
     LDFLAGS_save="${LDFLAGS_save} -lintl"; LDFLAGS="${LDFLAGS_save}"
 
     dnl Check for BONE
@@ -270,11 +271,24 @@ case "${target_os}" in
         VLC_ADD_LDFLAGS([beos],[-lzeta])
     fi
     ;;
+  haiku*)
+    SYS=haiku
+    CFLAGS_save="${CFLAGS_save} -Wno-multichar"; CFLAGS="${CFLAGS_save}"
+    CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar"; CXXFLAGS="${CXXFLAGS_save}"
+    VLC_ADD_CXXFLAGS([haiku],[])
+    VLC_ADD_LDFLAGS([vlc logger],[-lbe])
+    VLC_ADD_LDFLAGS([beos],[-lbe -lmedia -ltranslation -ltracker -lgame])
+    VLC_ADD_LDFLAGS([dvdnav dvdread],[])
+    VLC_ADD_LDFLAGS([access_file],[-lroot])
+    LDFLAGS_save="${LDFLAGS_save} -lintl"; LDFLAGS="${LDFLAGS_save}"
+    VLC_ADD_LDFLAGS([access_file access_ftp access_mms access_output_udp telnet netsync sap ipv4 vlc growl],[-lnetwork])
+    ;;
   *)
     SYS="${target_os}"
     ;;
 esac
 AM_CONDITIONAL(HAVE_BEOS, test "${SYS}" = "beos")
+AM_CONDITIONAL(HAVE_HAIKU, test "${SYS}" = "haiku")
 AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
 AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
 AM_CONDITIONAL(HAVE_WINCE, test "${SYS}" = "mingwce")
@@ -444,12 +458,26 @@ AC_CHECK_FUNCS(connect,,[
   ])
 ])
 
+AC_CHECK_FUNCS(connect,,[
+  AC_CHECK_LIB(network,connect,[
+    VLC_ADD_LDFLAGS([vlc ipv4 ipv6 cdda cddax],-lnetwork)
+    LIBS_socket="-lnetwork"
+  ])
+])
+
+
 AC_CHECK_FUNCS(send,,[
   AC_CHECK_LIB(socket,send,[
     VLC_ADD_LDFLAGS([access_http access_mms access_udp access_tcp access_ftp sap access_output_udp stream_out_standard growl],[-lsocket])
   ])
 ])
 
+AC_CHECK_FUNCS(send,,[
+  AC_CHECK_LIB(network,send,[
+    VLC_ADD_LDFLAGS([access_http access_mms access_udp access_tcp access_ftp sap access_output_udp stream_out_standard growl],[-lnetwork])
+  ])
+])
+
 AC_CHECK_FUNCS(gethostbyname,,[
   AC_CHECK_LIB(nsl,gethostbyname,[
     VLC_ADD_LDFLAGS([cdda cddax ipv4 ipv6 vlc],[-lnsl])
@@ -460,11 +488,22 @@ AC_CHECK_FUNCS(gethostbyname,,[
   ])
 ])
 
+AC_CHECK_FUNCS(gethostbyname,,[
+  AC_CHECK_LIB(nsl,gethostbyname,[
+    VLC_ADD_LDFLAGS([cdda cddax ipv4 ipv6 vlc],[-lnsl])
+  ],[
+    AC_CHECK_LIB(network,gethostbyname,[
+      VLC_ADD_LDFLAGS([ipv4 access_mms],[-lnetwork])
+    ])
+  ])
+])
+
 dnl Check for socklen_t
 AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
   [AC_TRY_COMPILE(
      [#include <sys/types.h>
-      #include <sys/socket.h>],
+      #include <sys/socket.h>
+      #include <sys/select.h>],
      [socklen_t len = 42; return len;],
      ac_cv_type_socklen_t=yes,
      ac_cv_type_socklen_t=no)])
@@ -497,8 +536,10 @@ dnl  -lnsl and -lsocket are needed on Solaris;
 dnl  we purposedly make the test fail on Windows
 LIBS_save="${LIBS}"
 AH_TEMPLATE(HAVE_GETADDRINFO, [Define to 1 if you have the `getaddrinfo' function.])
+AC_SEARCH_LIBS([getaddrinfo], [nsl] [network], [AC_DEFINE(HAVE_GETADDRINFO)],, [${LIBS_socket}])
 AC_SEARCH_LIBS([getaddrinfo], [nsl], [AC_DEFINE(HAVE_GETADDRINFO)],, [${LIBS_socket}])
 
+
 dnl NOTE: we assume getaddrinfo will be present if getnameinfo or gai_strerro
 dnl are
 LIBS="${LIBS_gai}"
@@ -804,8 +845,6 @@ AC_PATH_XTRA()
 
 dnl it seems that autoconf do the pkg-config detection only for the first PKG_CHECK_MODULES in the configure.ac ( which is logical) but in our case it is nested in a if so it was not working if you're not on linux or have disable hal.
 
-PKG_PROG_PKG_CONFIG()
-
 dnl Check for hal
 AC_ARG_ENABLE(hal,
   [  --enable-hal            Linux HAL services discovery (default enabled)])
@@ -2742,28 +2781,12 @@ dnl Trying with pkg-config
       AC_CHECK_HEADERS(ffmpeg/avutil.h libavutil/avutil.h)
       AC_CHECK_HEADERS(postproc/postprocess.h libpostproc/postprocess.h)
 
-      AC_CHECK_LIB(avutil, av_crc_init, [
-        VLC_ADD_LDFLAGS([ffmpeg],[-lavutil])
-        LDAVUTIL="-lavutil"])
-
-      AC_CHECK_LIB(avcodec, avcodec_init, [
-        VLC_ADD_BUILTINS([ffmpeg])
-        VLC_ADD_LDFLAGS([ffmpeg],[-lavcodec])
-        if test "${enable_sout}" != "no"; then
-            VLC_ADD_BUILTINS([stream_out_switcher])
-        fi],
-         [ AC_MSG_ERROR([Could not find ffmpeg on your system: you may get it from http://ffmpeg.sf.net/ (svn version is recommended). Alternatively you can use --disable-ffmpeg to disable the ffmpeg plugins.]) ], [$LDAVUTIL])
-
-      
-      AC_CHECK_LIB(postproc, pp_postprocess, [
-        VLC_ADD_LDFLAGS([ffmpeg],[-lpostproc])],
-	AC_MSG_ERROR([Could not find libpostproc inside FFmpeg. You should configure FFmpeg with --enable-gpl --enable-pp.]),
-	[$LDAVUTIL])
-
-      AC_CHECK_LIB(avformat, av_open_input_stream, [
-        VLC_ADD_LDFLAGS([ffmpeg],[-lavformat -lz]) ], [], [-lavcodec -lz $LDAVUTIL])
-      LDFLAGS="${LDFLAGS_save}"
-      CPPFLAGS="${CPPFLAGS_save}"
+	VLC_ADD_BUILTINS([ffmpeg])
+	VLC_ADD_LDFLAGS([ffmpeg],[-lavutil]) 
+	LDAVUTIL="-lavutil"
+	VLC_ADD_LDFLAGS([ffmpeg],[-lpostproc])
+	VLC_ADD_LDFLAGS([ffmpeg],[-lavcodec])
+	VLC_ADD_LDFLAGS([ffmpeg],[-lavformat -lz])		
     ])
   fi
  fi 
@@ -4407,7 +4430,7 @@ dnl
 AC_ARG_WITH(,[Interface plugins:])
 
 dnl special case for BeOS
-if test "${SYS}" = "beos"
+if test "${SYS}" = "beos" || test "${SYS}" = "haiku"
 then
     VLC_ADD_BUILTINS([beos])
 fi
@@ -4418,8 +4441,7 @@ dnl
 AC_ARG_ENABLE(skins2,
   [  --enable-skins2         Skins2 interface module (experimental)])
 if test "${enable_skins2}" = "yes" ||
-  (test "${SYS}" != "darwin" && test "${SYS}" != "beos" &&
-   test "${SYS}" != "mingwce" && test "${enable_skins2}" != "no"); then
+  (test "${SYS}" != "darwin" && test "${SYS}" != "beos" && test "${SYS}" != "haiku" && test "${SYS}" != "mingwce" && test "${enable_skins2}" != "no"); then
 
   dnl test for the required libraries
   skins2_missing_lib="no"
diff --git a/extras/contrib/src/Makefile b/extras/contrib/src/Makefile
index 0ef86b0..790ef2c 100644
--- a/extras/contrib/src/Makefile
+++ b/extras/contrib/src/Makefile
@@ -153,9 +153,9 @@ else
  ifdef HAVE_BEOS
   ifeq ($(HOST),$(BUILD))
 # Native build: we need perl, autoconf, etc first
-   all: .perl .autoconf .automake .libtool .iconv .intl .freetype .fribidi \
+   all: .libtool .iconv .intl .freetype .fribidi \
 	.a52 .mpeg2 .id3tag .mad .ogg .vorbis .vorbisenc .theora \
-	.FLAC .speex .faad .faac .lame .ebml .matroska .ffmpeg .dvdcss \
+	.faad .lame .ebml .matroska .dvdcss \
 	.dvdnav .dvbpsi .aclocal .libdca
   else
 # Cross compiling: we already have the Linux tools, only build the
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 709228d..95e23c3 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -45,7 +45,7 @@
 #elif defined( HAVE_KERNEL_SCHEDULER_H )                             /* BeOS */
 #   include <kernel/OS.h>
 #   include <kernel/scheduler.h>
-#   include <byteorder.h>
+#   include <ByteOrder.h>
 
 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )  /* pthreads (like Linux & BSD) */
 #   include <pthread.h>
diff --git a/modules/codec/telx.c b/modules/codec/telx.c
index 4d3a30f..6ee55f1 100644
--- a/modules/codec/telx.c
+++ b/modules/codec/telx.c
@@ -27,7 +27,7 @@
  *****************************************************************************/
 #include <vlc/vlc.h>
 #include <assert.h>
-#include <stdint.h>
+#include <inttypes.h>
 
 #include <vlc/vout.h>
 #include <vlc/decoder.h>
@@ -450,7 +450,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
     vlc_bool_t b_update = VLC_FALSE;
     char psz_text[512], *pt = psz_text;
     char psz_line[256];
-    int i, total;
+    int i, total, mpag, row, magazine;
 
     if( pp_block == NULL || *pp_block == NULL ) return NULL;
     p_block = *pp_block;
@@ -473,8 +473,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
 /*         continue; */
 /*       } */
 
-        int mpag = (hamming_8_4( packet[4] ) << 4) | hamming_8_4( packet[5] );
-        int row, magazine;
+        mpag = (hamming_8_4( packet[4] ) << 4) | hamming_8_4( packet[5] );
         if ( mpag < 0 )
         {
             /* decode error */
diff --git a/modules/gui/beos/InterfaceWindow.cpp b/modules/gui/beos/InterfaceWindow.cpp
index 22094c4..f252085 100644
--- a/modules/gui/beos/InterfaceWindow.cpp
+++ b/modules/gui/beos/InterfaceWindow.cpp
@@ -319,10 +319,8 @@ InterfaceWindow::InterfaceWindow( intf_thread_t * _p_intf, BRect frame,
 
     /* Add the Show menu */
     fShowMenu = new BMenu( _("Window") );
-#if 0
     ADD_ELLIPSIS( _("Playlist") );
     fShowMenu->AddItem( new BMenuItem( psz_tmp, new BMessage( OPEN_PLAYLIST ), 'P') );
-#endif
     ADD_ELLIPSIS( _("Messages") );
     fShowMenu->AddItem( new BMenuItem( psz_tmp, new BMessage( OPEN_MESSAGES ), 'M' ) );
     ADD_ELLIPSIS( _("Preferences") );
diff --git a/src/input/input.c b/src/input/input.c
index 39cc01a..e7c6a09 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1886,7 +1886,7 @@ static int  UpdateMeta( input_thread_t *p_input, vlc_bool_t b_quick )
 {
     vlc_meta_t *p_meta = p_input->p_meta;
     int i;
-
+    char *psz_cat;
     if( !p_meta || p_meta->i_meta == 0 )
         return VLC_SUCCESS;
 
@@ -1917,7 +1917,6 @@ static int  UpdateMeta( input_thread_t *p_input, vlc_bool_t b_quick )
         if( tk->i_meta > 0 )
         {
             msg_Dbg( p_input, "  - track[%d]:", i );
-            char *psz_cat;
             if( asprintf( &psz_cat, "%s %d", _("Stream"), i ) != -1 )
             {
                 for( j = 0; j < tk->i_meta; j++ )
diff --git a/src/misc/threads.c b/src/misc/threads.c
index f7142c9..efefcdd 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -542,6 +542,7 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
          * function instead of CreateThread, otherwise you'll end up with
          * memory leaks and the signal functions not working (see Microsoft
          * Knowledge Base, article 104641) */
+
         p_this->thread_id =
 #if defined( UNDER_CE )
                 (HANDLE)CreateThread( NULL, 0, (PTHREAD_START) func,
@@ -636,7 +637,6 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
                          psz_name, psz_file, i_line, strerror(i_ret) );
         vlc_mutex_unlock( &p_this->object_lock );
     }
-
     return i_ret;
 }
 
@@ -689,7 +689,6 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file,
         }
     }
 #endif
-
     return 0;
 }
 
diff --git a/src/misc/vlm.c b/src/misc/vlm.c
index 651a5d0..bc7d1ab 100644
--- a/src/misc/vlm.c
+++ b/src/misc/vlm.c
@@ -1368,10 +1368,10 @@ static int64_t vlm_Date( void )
 
 vlm_schedule_t *vlm_ScheduleNew( vlm_t *vlm, const char *psz_name )
 {
+    vlm_schedule_t *p_sched = malloc( sizeof( vlm_schedule_t ) );
     if( !psz_name )
         return NULL;
 
-    vlm_schedule_t *p_sched = malloc( sizeof( vlm_schedule_t ) );
     if( !p_sched )
         return NULL;
 
diff --git a/src/network/httpd.c b/src/network/httpd.c
index ecd1a01..98b9b16 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -60,6 +60,10 @@
 #define HTTPD_CL_BUFSIZE 10000
 #endif
 
+
+#include<sys/select.h>
+
+
 static void httpd_ClientClean( httpd_client_t *cl );
 
 struct httpd_url_t
@@ -368,6 +372,7 @@ static int httpd_FileCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
     uint8_t **pp_body, *p_body;
     char *psz_connection = NULL;
     int *pi_body, i_body;
+    uint8_t *psz_args = query->psz_args;
 
     if( answer == NULL || query == NULL )
     {
@@ -402,7 +407,6 @@ static int httpd_FileCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
         /* msg_Warn not supported */
     }
 
-    uint8_t *psz_args = query->psz_args;
     file->pf_fill( file->p_sys, file, psz_args, pp_body, pi_body );
 
     if( query->i_type == HTTPD_MSG_HEAD && p_body != NULL )
@@ -487,6 +491,7 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c
 {
     httpd_handler_t *handler = (httpd_handler_t*)p_sys;
     char psz_remote_addr[NI_MAXNUMERICHOST];
+    uint8_t *psz_args = query->psz_args;
 
     if( answer == NULL || query == NULL )
     {
@@ -502,7 +507,6 @@ static int httpd_HandlerCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *c
     if( httpd_ClientIP( cl, psz_remote_addr ) == NULL )
         *psz_remote_addr = '\0';
 
-    uint8_t *psz_args = query->psz_args;
     handler->pf_fill( handler->p_sys, handler, query->psz_url, psz_args,
                       query->i_type, query->p_body, query->i_body,
                       psz_remote_addr, NULL,
-- 
2.2.2


From 9c98e262f8bd27c3d435d3df476158d89ce8039c Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 4 Sep 2014 22:36:37 +0200
Subject: FFmpeg 0.10 fix.


diff --git a/configure.ac b/configure.ac
index ad7cfc3..7eba486 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2792,16 +2792,6 @@ dnl Trying with pkg-config
  fi 
 fi
 
-dnl Check if we have (required) img_resample() in libavcodec
-if test "${enable_ffmpeg}" != "no"
-then
-     CFLAGS="${CFLAGS} ${CFLAGS_ffmpeg}"
-     LDFLAGS="${LDFLAGS} ${LDFLAGS_ffmpeg}"
-     AC_CHECK_LIB(avcodec, img_resample, ,
-       [AC_MSG_ERROR([Your FFmpeg library doesn't have the needed img_resample() function. You should rebuild it with software scaler disabled])], -lavutil)
-     VLC_RESTORE_FLAGS
-fi
-
 dnl Clean out environment
 LIBS="${LIBS_save}"
 
-- 
2.2.2


From 011b0e13bf81d7998f49d14dae9c50087b8b4f34 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 4 Sep 2014 22:37:02 +0200
Subject: ffmpeg 0.10 fixes.


diff --git a/modules/codec/ffmpeg/audio.c b/modules/codec/ffmpeg/audio.c
index 14b7ff7..1fe560e 100644
--- a/modules/codec/ffmpeg/audio.c
+++ b/modules/codec/ffmpeg/audio.c
@@ -111,7 +111,7 @@ int E_(InitAudioDec)( decoder_t *p_dec, AVCodecContext *p_context,
     p_sys->p_context->channels = p_dec->fmt_in.audio.i_channels;
     p_sys->p_context->block_align = p_dec->fmt_in.audio.i_blockalign;
     p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate;
-    p_sys->p_context->bits_per_sample = p_dec->fmt_in.audio.i_bitspersample;
+    p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.audio.i_bitspersample;
 
     if( ( p_sys->p_context->extradata_size = p_dec->fmt_in.i_extra ) > 0 )
     {
diff --git a/modules/codec/ffmpeg/ffmpeg.c b/modules/codec/ffmpeg/ffmpeg.c
index 158e412..2622005 100644
--- a/modules/codec/ffmpeg/ffmpeg.c
+++ b/modules/codec/ffmpeg/ffmpeg.c
@@ -38,6 +38,8 @@
 #   include <avcodec.h>
 #endif
 
+#include <libavutil/cpu.h>
+
 #if LIBAVCODEC_BUILD < 4680
 #   error You must have a libavcodec >= 4680 (get CVS)
 #endif
@@ -270,23 +272,23 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_context->dsp_mask = 0;
     if( !(p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_MMX) )
     {
-        p_context->dsp_mask |= FF_MM_MMX;
+        p_context->dsp_mask |= AV_CPU_FLAG_MMX;
     }
     if( !(p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_MMXEXT) )
     {
-        p_context->dsp_mask |= FF_MM_MMXEXT;
+        p_context->dsp_mask |= AV_CPU_FLAG_MMX2;
     }
     if( !(p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_3DNOW) )
     {
-        p_context->dsp_mask |= FF_MM_3DNOW;
+        p_context->dsp_mask |= AV_CPU_FLAG_3DNOW;
     }
     if( !(p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_SSE) )
     {
-        p_context->dsp_mask |= FF_MM_SSE;
+        p_context->dsp_mask |= AV_CPU_FLAG_SSE;
     }
     if( !(p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_SSE2) )
     {
-        p_context->dsp_mask |= FF_MM_SSE2;
+        p_context->dsp_mask |= AV_CPU_FLAG_SSE2;
     }
 
     switch( i_cat )
@@ -456,7 +458,7 @@ static struct
     { VLC_FOURCC('Y','V','U','9'), PIX_FMT_YUV410P },
 
     /* Packed YUV formats */
-    { VLC_FOURCC('Y','U','Y','2'), PIX_FMT_YUV422 },
+    { VLC_FOURCC('Y','U','Y','2'), PIX_FMT_YUYV422 },
 #if LIBAVCODEC_BUILD >= 4720
     { VLC_FOURCC('U','Y','V','Y'), PIX_FMT_UYVY422 },
 #endif
@@ -475,7 +477,7 @@ static struct
     { VLC_FOURCC('R','V','1','6'), PIX_FMT_RGB565 },
     { VLC_FOURCC('R','V','2','4'), PIX_FMT_RGB24 },
 #endif
-    { VLC_FOURCC('R','V','3','2'), PIX_FMT_RGBA32 },
+    { VLC_FOURCC('R','V','3','2'), PIX_FMT_RGB32 },
 #if defined(PIX_FMT_RGBA)
     { VLC_FOURCC('R','G','B','A'), PIX_FMT_RGBA },
 #endif
diff --git a/modules/codec/ffmpeg/video.c b/modules/codec/ffmpeg/video.c
index e8e72b5..46966a0 100644
--- a/modules/codec/ffmpeg/video.c
+++ b/modules/codec/ffmpeg/video.c
@@ -121,7 +121,7 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
     case PIX_FMT_YUVJ444P: /* Hacky but better then chroma conversion */
         return VLC_FOURCC('I','4','4','4');
 
-    case PIX_FMT_YUV422:
+    case PIX_FMT_YUYV422:
         return VLC_FOURCC('Y','U','Y','2');
 
     case PIX_FMT_RGB555:
@@ -130,7 +130,7 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
         return VLC_FOURCC('R','V','1','6');
     case PIX_FMT_RGB24:
         return VLC_FOURCC('R','V','2','4');
-    case PIX_FMT_RGBA32:
+    case PIX_FMT_RGB32:
         return VLC_FOURCC('R','V','3','2');
     case PIX_FMT_GRAY8:
         return VLC_FOURCC('G','R','E','Y');
@@ -259,12 +259,12 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
     p_sys->p_context->codec_tag = ffmpeg_CodecTag( p_dec->fmt_in.i_codec );
     p_sys->p_context->width  = p_dec->fmt_in.video.i_width;
     p_sys->p_context->height = p_dec->fmt_in.video.i_height;
-    p_sys->p_context->bits_per_sample = p_dec->fmt_in.video.i_bits_per_pixel;
+    p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.video.i_bits_per_pixel;
 
     /*  ***** Get configuration of ffmpeg plugin ***** */
     p_sys->p_context->workaround_bugs =
         config_GetInt( p_dec, "ffmpeg-workaround-bugs" );
-    p_sys->p_context->error_resilience =
+    p_sys->p_context->error_recognition =
         config_GetInt( p_dec, "ffmpeg-error-resilience" );
 
     var_Create( p_dec, "grayscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
@@ -448,7 +448,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
         b_drawpicture = 0;
         if( p_sys->i_late_frames < 8 )
         {
-            p_sys->p_context->hurry_up = 2;
+            p_sys->p_context->skip_frame = 2;
         }
         else
         {
@@ -466,19 +466,19 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
         if (!(p_block->i_flags & BLOCK_FLAG_PREROLL))
         {
             b_drawpicture = 1;
-            p_sys->p_context->hurry_up = 0;
+            p_sys->p_context->skip_frame = 0;
         }
         else
         {
             b_drawpicture = 0;
-            p_sys->p_context->hurry_up = 1;
+            p_sys->p_context->skip_frame = 1;
         }
     }
 
 
     if( p_sys->p_context->width <= 0 || p_sys->p_context->height <= 0 )
     {
-        p_sys->p_context->hurry_up = 5;
+        p_sys->p_context->skip_frame = 5;
         b_null_size = VLC_TRUE;
     }
 
@@ -516,19 +516,25 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
     {
         int i_used, b_gotpicture;
         picture_t *p_pic;
+ 		AVPacket pkt;
 
-        i_used = avcodec_decode_video( p_sys->p_context, p_sys->p_ff_pic,
+		av_init_packet(&pkt);
+		pkt.data = p_sys->p_buffer;
+		pkt.size = p_sys->i_buffer;
+
+        i_used = avcodec_decode_video2( p_sys->p_context, p_sys->p_ff_pic,
                                        &b_gotpicture,
-                                       (uint8_t*)p_sys->p_buffer, p_sys->i_buffer );
+                                       &pkt );
         if( b_null_size && p_sys->p_context->width > 0 &&
             p_sys->p_context->height > 0 )
         {
             /* Reparse it to not drop the I frame */
             b_null_size = VLC_FALSE;
-            p_sys->p_context->hurry_up = 0;
-            i_used = avcodec_decode_video( p_sys->p_context, p_sys->p_ff_pic,
+            p_sys->p_context->skip_frame = 0;
+
+            i_used = avcodec_decode_video2( p_sys->p_context, p_sys->p_ff_pic,
                                            &b_gotpicture,
-                                           (uint8_t*)p_sys->p_buffer, p_sys->i_buffer );
+                                           &pkt );
         }
 
         if( i_used < 0 )
diff --git a/modules/codec/ffmpeg/video_filter.c b/modules/codec/ffmpeg/video_filter.c
index 2eff2ba..fd9dc18 100644
--- a/modules/codec/ffmpeg/video_filter.c
+++ b/modules/codec/ffmpeg/video_filter.c
@@ -39,6 +39,7 @@
 #endif
 
 #include "ffmpeg.h"
+#include "resampleWrapper.h"
 
 void E_(InitLibavcodec) ( vlc_object_t *p_object );
 static int CheckInit( filter_t *p_filter );
-- 
2.2.2


From 23f6a0e6797dfef12d6738e64896ad0c387c113e Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 4 Sep 2014 23:00:02 +0200
Subject: Cinepak: gcc2 fixes.


diff --git a/modules/codec/cinepak.c b/modules/codec/cinepak.c
index b30ea78..c8fe9d1 100644
--- a/modules/codec/cinepak.c
+++ b/modules/codec/cinepak.c
@@ -288,11 +288,11 @@ static void cinepak_Getv4( cinepak_context_t *p_context,
     size_t y_siz = p_context->i_stride[0] * p_context->i_lines[0];
     size_t u_siz = p_context->i_stride[1] * p_context->i_lines[1];
     size_t v_siz = p_context->i_stride[2] * p_context->i_lines[2];
+    uint8_t *p_dst_y, *p_dst_u, *p_dst_v;
     /* boundary check */
     if( y_max >= y_siz || u_max >= u_siz || v_max >= v_siz )
         return;
 
-    uint8_t *p_dst_y, *p_dst_u, *p_dst_v;
 #define PIX_SET_Y( x, y, v ) \
     p_dst_y[(x) + (y)* p_context->i_stride[0]] = (v);
 
@@ -345,11 +345,11 @@ static void cinepak_Getv1( cinepak_context_t *p_context,
     size_t y_siz = p_context->i_stride[0] * p_context->i_lines[0];
     size_t u_siz = p_context->i_stride[1] * p_context->i_lines[1];
     size_t v_siz = p_context->i_stride[2] * p_context->i_lines[2];
+    uint8_t *p_dst_y, *p_dst_u, *p_dst_v;
     /* boundary check */
     if( y_max >= y_siz || u_max >= u_siz || v_max >= v_siz )
         return;
 
-    uint8_t *p_dst_y, *p_dst_u, *p_dst_v;
 #define PIX_SET_Y( x, y, v ) \
     p_dst_y[(x) + (y)* p_context->i_stride[0]] = (v);
 
-- 
2.2.2


From 4dc9d4f85fa00c5cfa83320643f585ae4424c5c7 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 11 Sep 2014 08:39:13 +0200
Subject: gcc2, BeOS vs Haiku and ffmpeg 0.10 fixes.

* C99 style variable declarations
* Update ffmpeg code to ffmpeg 0.10 API changes
* Hack configure script to enable BeOS code on Haiku

diff --git a/config.h.in b/config.h.in
index e60d9b1..f2be648 100644
--- a/config.h.in
+++ b/config.h.in
@@ -372,9 +372,6 @@
 /* Define to 1 if you have the <libavc1394/avc1394.h> header file. */
 #undef HAVE_LIBAVC1394_AVC1394_H
 
-/* Define to 1 if you have the `avcodec' library (-lavcodec). */
-#undef HAVE_LIBAVCODEC
-
 /* Define to 1 if you have the <libavcodec/avcodec.h> header file. */
 #undef HAVE_LIBAVCODEC_AVCODEC_H
 
@@ -880,6 +877,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
diff --git a/configure.ac b/configure.ac
index 7eba486..be0206a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -287,7 +287,7 @@ case "${target_os}" in
     SYS="${target_os}"
     ;;
 esac
-AM_CONDITIONAL(HAVE_BEOS, test "${SYS}" = "beos")
+AM_CONDITIONAL(HAVE_BEOS, test "${SYS}" = "haiku")
 AM_CONDITIONAL(HAVE_HAIKU, test "${SYS}" = "haiku")
 AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
 AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
diff --git a/include/main.h b/include/main.h
index 33332f5..5183da7 100644
--- a/include/main.h
+++ b/include/main.h
@@ -62,7 +62,7 @@ struct libvlc_t
 #if !defined( WIN32 )
     vlc_bool_t             b_daemon;
 #endif
-#if defined( SYS_BEOS )
+#if defined( SYS_BEOS ) || defined(__HAIKU__)
     vlc_object_t *         p_appthread;
     char *                 psz_vlcpath;
 #elif defined( __APPLE__ )
diff --git a/include/os_specific.h b/include/os_specific.h
index 2d6db18..d2b213f 100644
--- a/include/os_specific.h
+++ b/include/os_specific.h
@@ -26,7 +26,7 @@
 #   define _NEED_OS_SPECIFIC_H 1
 #endif
 
-#if defined( SYS_BEOS )
+#if defined( SYS_BEOS ) || defined(__HAIKU__)
 #   include "beos_specific.h"
 #elif defined( __APPLE__ )
 #   include "darwin_specific.h"
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 95e23c3..7ac43c4 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -42,7 +42,7 @@
 #elif defined( WIN32 )
 #   include <process.h>                                         /* Win32 API */
 
-#elif defined( HAVE_KERNEL_SCHEDULER_H )                             /* BeOS */
+#elif defined( HAVE_KERNEL_SCHEDULER_H ) || defined(__HAIKU__)                             /* BeOS */
 #   include <kernel/OS.h>
 #   include <kernel/scheduler.h>
 #   include <ByteOrder.h>
diff --git a/modules/codec/ffmpeg/chroma.c b/modules/codec/ffmpeg/chroma.c
index a9869cc..c3cbe0c 100644
--- a/modules/codec/ffmpeg/chroma.c
+++ b/modules/codec/ffmpeg/chroma.c
@@ -37,6 +37,7 @@
 #endif
 
 #include "ffmpeg.h"
+#include "resample.h"
 
 void E_(InitLibavcodec) ( vlc_object_t *p_object );
 static void ChromaConversion( vout_thread_t *, picture_t *, picture_t * );
diff --git a/modules/codec/ffmpeg/encoder.c b/modules/codec/ffmpeg/encoder.c
index c273b32..cd4c266 100644
--- a/modules/codec/ffmpeg/encoder.c
+++ b/modules/codec/ffmpeg/encoder.c
@@ -269,20 +269,20 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
     p_context->dsp_mask = 0;
     if( !(p_enc->p_libvlc->i_cpu & CPU_CAPABILITY_MMX) )
     {
-        p_context->dsp_mask |= FF_MM_MMX;
+        p_context->dsp_mask |= AV_CPU_FLAG_MMX;
     }
     if( !(p_enc->p_libvlc->i_cpu & CPU_CAPABILITY_MMXEXT) )
     {
-        p_context->dsp_mask |= FF_MM_MMXEXT;
+        p_context->dsp_mask |= AV_CPU_FLAG_MMX2;
     }
     if( !(p_enc->p_libvlc->i_cpu & CPU_CAPABILITY_3DNOW) )
     {
-        p_context->dsp_mask |= FF_MM_3DNOW;
+        p_context->dsp_mask |= AV_CPU_FLAG_3DNOW;
     }
     if( !(p_enc->p_libvlc->i_cpu & CPU_CAPABILITY_SSE) )
     {
-        p_context->dsp_mask |= FF_MM_SSE;
-        p_context->dsp_mask |= FF_MM_SSE2;
+        p_context->dsp_mask |= AV_CPU_FLAG_SSE;
+        p_context->dsp_mask |= AV_CPU_FLAG_SSE2;
     }
 
     sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
@@ -505,7 +505,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
         }
 
         if ( p_sys->b_trellis )
-            p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
+            p_context->trellis |= 1;
 
         if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax )
             p_context->flags |= CODEC_FLAG_QSCALE;
@@ -519,9 +519,9 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
             p_context->bit_rate_tolerance = p_sys->i_vtolerance;
 
         if( p_sys->i_qmin > 0 )
-            p_context->mb_qmin = p_context->qmin = p_sys->i_qmin;
+            p_context->qmin = p_sys->i_qmin;
         if( p_sys->i_qmax > 0 )
-            p_context->mb_qmax = p_context->qmax = p_sys->i_qmax;
+            p_context->qmax = p_sys->i_qmax;
         p_context->max_qdiff = 3;
 
         p_context->mb_decision = p_sys->i_hq;
@@ -809,7 +809,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
             if ( current_date + HURRY_UP_GUARD3 > frame.pts )
             {
                 p_sys->p_context->mb_decision = FF_MB_DECISION_SIMPLE;
-                p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
+                p_sys->p_context->trellis = 0;
                 msg_Dbg( p_enc, "hurry up mode 3" );
             }
             else
@@ -818,7 +818,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
 
                 if ( current_date + HURRY_UP_GUARD2 > frame.pts )
                 {
-                    p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
+                    p_sys->p_context->trellis = 0;
 #if LIBAVCODEC_BUILD >= 4690
                     p_sys->p_context->noise_reduction = p_sys->i_noise_reduction
                          + (HURRY_UP_GUARD2 + current_date - frame.pts) / 500;
@@ -828,7 +828,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
                 else
                 {
                     if ( p_sys->b_trellis )
-                        p_sys->p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
+                        p_sys->p_context->trellis |= 1;
 #if LIBAVCODEC_BUILD >= 4690
                     p_sys->p_context->noise_reduction =
                         p_sys->i_noise_reduction;
diff --git a/modules/codec/ffmpeg/postprocess.c b/modules/codec/ffmpeg/postprocess.c
index be87e11..286902d 100644
--- a/modules/codec/ffmpeg/postprocess.c
+++ b/modules/codec/ffmpeg/postprocess.c
@@ -54,8 +54,8 @@
  *****************************************************************************/
 typedef struct video_postproc_sys_t
 {
-    pp_context_t *pp_context;
-    pp_mode_t    *pp_mode;
+    pp_context *pp_context;
+    pp_mode    *pp_mode;
 
     vlc_bool_t   *pb_pp;
 
@@ -231,7 +231,7 @@ static int PPQCallback( vlc_object_t *p_this, char const *psz_cmd,
     {
         int  i_quality = newval.i_int;
         char *psz_name = config_GetPsz( p_dec, "ffmpeg-pp-name" );
-        pp_mode_t *pp_mode;
+        pp_mode *pp_mode;
 
         if( !psz_name )
         {
diff --git a/modules/codec/ffmpeg/resample.c b/modules/codec/ffmpeg/resample.c
new file mode 100644
index 0000000..57bb258
--- /dev/null
+++ b/modules/codec/ffmpeg/resample.c
@@ -0,0 +1,82 @@
+#if LIBAVCODEC_VERSION_MAJOR >= 52
+
+
+
+    void img_resample(ImgReSampleContext * context, AVPicture * pxOut, 
+const AVPicture * pxIn)
+    {
+        if (context != NULL && context->context != NULL)
+        {
+            AVPicture shiftedInput = {0};
+            shiftedInput.data[0] = pxIn->data[0] + pxIn->linesize[0] * 
+context->bandTop + context->bandLeft;
+            shiftedInput.data[1] = pxIn->data[1] + (pxIn->linesize[1] * 
+(context->bandTop / 2)) + (context->bandLeft+1) / 2;
+            shiftedInput.data[2] = pxIn->data[2] + (pxIn->linesize[2] * 
+(context->bandTop / 2)) + (context->bandLeft+1) / 2;
+            shiftedInput.linesize[0] = pxIn->linesize[0];
+            shiftedInput.linesize[1] = pxIn->linesize[1];
+            shiftedInput.linesize[2] = pxIn->linesize[2];
+            sws_scale(context->context, (uint8_t**)shiftedInput.data, 
+(int*)shiftedInput.linesize, 0, context->height - context->bandBottom - 
+context->bandTop, pxOut->data, pxOut->linesize);
+        }
+    }
+   
+
+
+    ImgReSampleContext * img_resample_full_init (int owidth, int 
+oheight, int iwidth, int iheight,
+                                                 int topBand, int 
+bottomBand, int leftBand, int rightBand,
+                                                 int padtop, int 
+padbottom, int padleft, int padright)
+    {
+        ImgReSampleContext * s = (ImgReSampleContext 
+*)av_malloc(sizeof(ImgReSampleContext));
+        int srcSurface = (iwidth - rightBand - leftBand)* (iheight - 
+topBand - bottomBand);
+        if (s == NULL) return NULL;
+        // We use bilinear when the source surface is big, and bicubic 
+		// when the number of pixels to handle is less than 1 MPixels
+        s->context = sws_getContext(iwidth - rightBand - leftBand, 
+iheight - topBand - bottomBand, PIX_FMT_YUV420P, owidth, oheight, 
+PIX_FMT_YUV420P, srcSurface > 1024000 ? SWS_FAST_BILINEAR : SWS_BICUBIC, 
+NULL, NULL, NULL);
+        if (s->context == NULL) { av_free(s); return NULL; }
+        s->bandLeft = leftBand;
+        s->bandRight = rightBand;
+        s->bandTop = topBand;
+        s->bandBottom = bottomBand;
+
+        s->padLeft = padleft;
+        s->padRight = padright;
+        s->padTop = padtop;
+        s->padBottom = padbottom;
+
+        s->width = iwidth;
+        s->height = iheight;
+
+        s->outWidth = owidth;
+        s->outHeight = oheight;
+
+        return s;
+    }
+
+    ImgReSampleContext * img_resample_init (int owidth, int oheight, int 
+iwidth, int iheight)
+    {
+        return img_resample_full_init(owidth, oheight, iwidth, iheight, 
+0, 0, 0, 0, 0, 0, 0, 0);
+    }
+
+    void img_resample_close(ImgReSampleContext * s)
+    {
+        if (s == NULL) return;
+        sws_freeContext(s->context);
+
+        av_free(s);   
+    }
+
+#endif
+
diff --git a/modules/codec/ffmpeg/resample.h b/modules/codec/ffmpeg/resample.h
new file mode 100644
index 0000000..827b304
--- /dev/null
+++ b/modules/codec/ffmpeg/resample.h
@@ -0,0 +1,48 @@
+#include <libavcodec/avcodec.h>
+#include <libswscale/swscale.h>
+#if LIBAVCODEC_VERSION_MAJOR >= 52
+    // Starting from this version, ImgReSampleContext doesn't exist anymore.
+    // This code implements the previous functions with a similar interface
+    typedef struct
+    {
+        /** The context used for resizing */
+        struct SwsContext *    context;
+        /** The source's width */
+        int             width;
+        /** The source's height */
+        int             height;
+        /** The banding used */
+        int             bandLeft;
+        /** The banding used */
+        int             bandRight;
+        /** The banding used */
+        int             bandTop;
+        /** The banding used */
+        int             bandBottom;
+        /** The padding used */
+        int             padLeft;
+        /** The padding used */
+        int             padRight;
+        /** The padding used */
+        int             padTop;
+        /** The padding used */
+        int             padBottom;
+        /** The output width */
+        int             outWidth;
+        /** The output height */
+        int             outHeight;
+    } ImgReSampleContext;
+
+void img_resample_close(ImgReSampleContext * s);
+void img_resample(ImgReSampleContext * context, AVPicture * out, const 
+AVPicture * in);
+ImgReSampleContext * img_resample_full_init (int owidth, int oheight, 
+int iwidth, int iheight,
+                                                 int topBand, int 
+bottomBand, int leftBand, int rightBand,
+                                                 int padtop, int 
+padbottom, int padleft, int padright);
+ImgReSampleContext * img_resample_init (int owidth, int oheight, int 
+iwidth, int iheight);
+#endif
+
diff --git a/modules/codec/ffmpeg/video_filter.c b/modules/codec/ffmpeg/video_filter.c
index fd9dc18..15e02b2 100644
--- a/modules/codec/ffmpeg/video_filter.c
+++ b/modules/codec/ffmpeg/video_filter.c
@@ -39,7 +39,8 @@
 #endif
 
 #include "ffmpeg.h"
-#include "resampleWrapper.h"
+#include "resample.h"
+#include "resample.c"
 
 void E_(InitLibavcodec) ( vlc_object_t *p_object );
 static int CheckInit( filter_t *p_filter );
diff --git a/modules/demux/a52.c b/modules/demux/a52.c
index fac71f7..ae419ec 100644
--- a/modules/demux/a52.c
+++ b/modules/demux/a52.c
@@ -87,6 +87,7 @@ static int Open( vlc_object_t * p_this )
     if( stream_Peek( p_demux->s, &p_peek, 12+8 ) == 12+8 &&
         !memcmp( p_peek, "RIFF", 4 ) && !memcmp( &p_peek[8], "WAVE", 4 ) )
     {
+		int i_size;
         /* Skip the wave header */
         i_peek = 12 + 8;
         while( memcmp( p_peek + i_peek - 8, "data", 4 ) )
@@ -104,7 +105,7 @@ static int Open( vlc_object_t * p_this )
 
         /* Some A52 wav files don't begin with a sync code so we do a more
          * extensive search */
-        int i_size = stream_Peek( p_demux->s, &p_peek, i_peek + A52_PACKET_SIZE * 2);
+        i_size = stream_Peek( p_demux->s, &p_peek, i_peek + A52_PACKET_SIZE * 2);
         i_size -= (PCM_FRAME_SIZE + A52_MAX_HEADER_SIZE);
 
         while( i_peek < i_size )
diff --git a/modules/demux/dts.c b/modules/demux/dts.c
index e33c1be..56de2ba 100644
--- a/modules/demux/dts.c
+++ b/modules/demux/dts.c
@@ -80,6 +80,8 @@ static int Open( vlc_object_t * p_this )
     if( stream_Peek( p_demux->s, &p_peek, 20 ) == 20 &&
         !memcmp( p_peek, "RIFF", 4 ) && !memcmp( &p_peek[8], "WAVE", 4 ) )
     {
+		uint32_t i_len;
+		int i_size;
         /* Find the wave format header */
         i_peek = 12 + 8;
         while( memcmp( p_peek + i_peek - 8, "fmt ", 4 ) )
@@ -94,7 +96,7 @@ static int Open( vlc_object_t * p_this )
         }
 
         /* Sanity check the wave format header */
-        uint32_t i_len = GetDWLE( p_peek + i_peek - 4 );
+        i_len = GetDWLE( p_peek + i_peek - 4 );
         if( i_len > DTS_PROBE_SIZE )
             return VLC_EGENERIC;
 
@@ -124,7 +126,7 @@ static int Open( vlc_object_t * p_this )
 
         /* Some DTS wav files don't begin with a sync code so we do a more
          * extensive search */
-        int i_size = stream_Peek( p_demux->s, &p_peek, DTS_PROBE_SIZE );
+        i_size = stream_Peek( p_demux->s, &p_peek, DTS_PROBE_SIZE );
         i_size -= DTS_MAX_HEADER_SIZE;
 
         while( i_peek < i_size )
diff --git a/modules/gui/beos/InterfaceWindow.cpp b/modules/gui/beos/InterfaceWindow.cpp
index f252085..ecc9aea 100644
--- a/modules/gui/beos/InterfaceWindow.cpp
+++ b/modules/gui/beos/InterfaceWindow.cpp
@@ -33,7 +33,6 @@
 #include <SupportKit.h>
 #include <malloc.h>
 #include <scsi.h>
-#include <scsiprobe_driver.h>
 #include <fs_info.h>
 #include <string.h>
 
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 95a695c..9baaa4f 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -219,13 +219,14 @@ static int Open( vlc_object_t *p_this )
         i_sps = (*p++)&0x1f;
         for( i = 0; i < i_sps; i++ )
         {
+            block_t *p_sps;
             uint16_t i_length = GetWBE( p ); p += 2;
             if( i_length >
                 (uint8_t*)p_dec->fmt_in.p_extra + p_dec->fmt_in.i_extra - p )
             {
                 return VLC_EGENERIC;
             }
-            block_t *p_sps = nal_get_annexeb( p_dec, p, i_length );
+            p_sps = nal_get_annexeb( p_dec, p, i_length );
             if( !p_sps )
                 return VLC_EGENERIC;
             p_sys->p_sps = block_Duplicate( p_sps );
@@ -237,13 +238,14 @@ static int Open( vlc_object_t *p_this )
         i_pps = *p++;
         for( i = 0; i < i_pps; i++ )
         {
+            block_t *p_pps;
             uint16_t i_length = GetWBE( p ); p += 2;
             if( i_length >
                 (uint8_t*)p_dec->fmt_in.p_extra + p_dec->fmt_in.i_extra - p )
             {
                 return VLC_EGENERIC;
             }
-            block_t *p_pps = nal_get_annexeb( p_dec, p, i_length );
+            p_pps = nal_get_annexeb( p_dec, p, i_length );
             if( !p_pps )
                 return VLC_EGENERIC;
             p_sys->p_pps = block_Duplicate( p_pps );
@@ -449,6 +451,7 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
         block_t *p_pic;
         int i_size = 0;
         int i;
+        block_t *p_part;
 
         for( i = 0; i < p_sys->i_avcC_length_size; i++ )
         {
@@ -462,7 +465,7 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
             break;
         }
 
-        block_t *p_part = nal_get_annexeb( p_dec, p, i_size );
+        p_part = nal_get_annexeb( p_dec, p, i_size );
         if( !p_part )
             break;
         p_part->i_dts = p_block->i_dts;
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index 41b57cc..1c83036 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -332,6 +332,7 @@ static int ADTSSyncInfo( decoder_t * p_dec, const byte_t * p_buf,
 {
     int i_profile, i_sample_rate_idx, i_frame_size;
     vlc_bool_t b_crc;
+    unsigned short i_raw_blocks_in_frame;
 
     /* Fixed header between frames */
     //int i_id = ( (p_buf[1] >> 3) & 0x01) ? 2 : 4; /* MPEG-2 or 4 */
@@ -350,7 +351,7 @@ static int ADTSSyncInfo( decoder_t * p_dec, const byte_t * p_buf,
     i_frame_size = ((p_buf[3] & 0x03) << 11) | (p_buf[4] << 3) |
                    ((p_buf[5] >> 5) /*& 0x7*/);
     //uint16_t buffer_fullness = ((p_buf[5] & 0x1f) << 6) | (p_buf[6] >> 2);
-    unsigned short i_raw_blocks_in_frame = p_buf[6] & 0x03;
+    i_raw_blocks_in_frame = p_buf[6] & 0x03;
 
     if( !*pi_sample_rate || !*pi_channels || !i_frame_size )
     {
@@ -436,15 +437,22 @@ static int Mpeg4GAProgramConfigElement( bs_t *s )
 {
     /* TODO compute channels count ? */
     int i_tag = bs_read( s, 4 );
+    int i_num_front;
+    int i_num_side;
+    int i_num_back;
+    int i_num_lfe;
+    int i_num_assoc_data;
+    int i_num_valid_cc;
+    int i_comment;
     if( i_tag != 0x05 )
         return -1;
     bs_skip( s, 2 + 4 ); // object type + sampling index
-    int i_num_front = bs_read( s, 4 );
-    int i_num_side = bs_read( s, 4 );
-    int i_num_back = bs_read( s, 4 );
-    int i_num_lfe = bs_read( s, 2 );
-    int i_num_assoc_data = bs_read( s, 3 );
-    int i_num_valid_cc = bs_read( s, 4 );
+    i_num_front = bs_read( s, 4 );
+    i_num_side = bs_read( s, 4 );
+    i_num_back = bs_read( s, 4 );
+    i_num_lfe = bs_read( s, 2 );
+    i_num_assoc_data = bs_read( s, 3 );
+    i_num_valid_cc = bs_read( s, 4 );
 
     if( bs_read1(s) )
         bs_skip( s, 4 ); // mono downmix
@@ -460,19 +468,20 @@ static int Mpeg4GAProgramConfigElement( bs_t *s )
     bs_skip( s, i_num_assoc_data * (4) );
     bs_skip( s, i_num_valid_cc * (5) );
     bs_align( s );
-    int i_comment = bs_read( s, 8 );
+    i_comment = bs_read( s, 8 );
     bs_skip( s, i_comment * 8 );
     return 0;
 }
 
 static int Mpeg4GASpecificConfig( mpeg4_cfg_t *p_cfg, bs_t *s )
 {
+    int i_extension_flag;
     p_cfg->i_frame_length = bs_read1(s) ? 960 : 1024;
 
     if( bs_read1( s ) )     // depend on core coder
         bs_skip( s, 14 );   // core coder delay
 
-    int i_extension_flag = bs_read1( s );
+    i_extension_flag = bs_read1( s );
     if( p_cfg->i_channel == 0 )
     {
         Mpeg4GAProgramConfigElement( s );
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 7c85ba4..301dbfc 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -339,11 +339,12 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
 
     if ( p_sys->p_decoder != NULL )
     {
+		void* p_owner;
         picture_t **pp_ring = p_sys->p_decoder->p_owner->pp_pics;
 
         if( p_sys->p_decoder->p_module )
             module_Unneed( p_sys->p_decoder, p_sys->p_decoder->p_module );
-        void *p_owner = p_sys->p_decoder->p_owner;
+        p_owner = p_sys->p_decoder->p_owner;
         vlc_object_detach( p_sys->p_decoder );
         vlc_object_destroy( p_sys->p_decoder );
 
diff --git a/modules/stream_out/switcher.c b/modules/stream_out/switcher.c
index f5c3a07..8d6cb19 100644
--- a/modules/stream_out/switcher.c
+++ b/modules/stream_out/switcher.c
@@ -357,20 +357,20 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
         id->ff_enc_c->dsp_mask = 0;
         if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_MMX) )
         {
-            id->ff_enc_c->dsp_mask |= FF_MM_MMX;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX;
         }
         if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_MMXEXT) )
         {
-            id->ff_enc_c->dsp_mask |= FF_MM_MMXEXT;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX2;
         }
         if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_3DNOW) )
         {
-            id->ff_enc_c->dsp_mask |= FF_MM_3DNOW;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_3DNOW;
         }
         if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_SSE) )
         {
-            id->ff_enc_c->dsp_mask |= FF_MM_SSE;
-            id->ff_enc_c->dsp_mask |= FF_MM_SSE2;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_SSE;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_SSE2;
         }
 
         id->ff_enc_c->sample_rate = p_fmt->audio.i_rate;
@@ -657,8 +657,9 @@ static void NetCommand( sout_stream_t *p_stream )
 
     if ( i_len > 0 )
     {
+		int i_cmd;
         psz_buffer[i_len] = '\0';
-        int i_cmd = strtol( psz_buffer, NULL, 0 );
+        i_cmd = strtol( psz_buffer, NULL, 0 );
         if ( i_cmd < -1 || i_cmd > p_sys->i_nb_pictures )
         {
             msg_Err( p_stream, "got a wrong command (%d)", i_cmd );
@@ -731,20 +732,20 @@ static mtime_t VideoCommand( sout_stream_t *p_stream, sout_stream_id_t *id )
         id->ff_enc_c->dsp_mask = 0;
         if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_MMX) )
         {
-            id->ff_enc_c->dsp_mask |= FF_MM_MMX;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX;
         }
         if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_MMXEXT) )
         {
-            id->ff_enc_c->dsp_mask |= FF_MM_MMXEXT;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX2;
         }
         if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_3DNOW) )
         {
-            id->ff_enc_c->dsp_mask |= FF_MM_3DNOW;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_3DNOW;
         }
         if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_SSE) )
         {
-            id->ff_enc_c->dsp_mask |= FF_MM_SSE;
-            id->ff_enc_c->dsp_mask |= FF_MM_SSE2;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_SSE;
+            id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_SSE2;
         }
 
         id->ff_enc_c->width = p_sys->p_pictures[p_sys->i_cmd-1].format.i_width;
-- 
2.2.2


From ed643155f745ac33c6cf9d9cb19ba0acee1a093a Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 15 Sep 2014 21:24:33 +0200
Subject: Fix build with modern libpng.

* Patch suggested by Diver.

diff --git a/modules/codec/png.c b/modules/codec/png.c
index 21aa111..5284dda 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -147,7 +147,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     p_info = png_create_info_struct( p_png );
     if( p_info == NULL )
     {
-        png_destroy_read_struct( &p_png, png_infopp_NULL, png_infopp_NULL );
+        png_destroy_read_struct( &p_png, (png_infopp)NULL, (png_infopp)NULL );
         block_Release( p_block ); *pp_block = NULL;
         return NULL;
     }
@@ -155,7 +155,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     p_end_info = png_create_info_struct( p_png );
     if( p_end_info == NULL )
     {
-        png_destroy_read_struct( &p_png, &p_info, png_infopp_NULL );
+        png_destroy_read_struct( &p_png, &p_info, (png_infopp)NULL );
         block_Release( p_block ); *pp_block = NULL;
         return NULL;
     }
-- 
2.2.2


From 912c838e4283cf098f748697d21090ae91a8b0bb Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 15 Sep 2014 21:45:27 +0200
Subject: Fix build with modern Matroska

* Patch suggested by Diver
* Code can safely be removed: it's only debug messages.

diff --git a/modules/demux/mkv.cpp b/modules/demux/mkv.cpp
index d3ae27f..9271f57 100644
--- a/modules/demux/mkv.cpp
+++ b/modules/demux/mkv.cpp
@@ -75,7 +75,6 @@
 #include "matroska/KaxSegment.h"
 #include "matroska/KaxTag.h"
 #include "matroska/KaxTags.h"
-#include "matroska/KaxTagMulti.h"
 #include "matroska/KaxTracks.h"
 #include "matroska/KaxTrackAudio.h"
 #include "matroska/KaxTrackVideo.h"
@@ -3871,74 +3870,6 @@ void matroska_segment_c::LoadTags( )
                     }
                     ep->Up();
                 }
-                else if( MKV_IS_ID( el, KaxTagGeneral ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + General" );
-                    ep->Down();
-                    while( ( el = ep->Get() ) != NULL )
-                    {
-                        msg_Dbg( &sys.demuxer, "|   |   + Unknown (%s)", typeid( *el ).name() );
-                    }
-                    ep->Up();
-                }
-                else if( MKV_IS_ID( el, KaxTagGenres ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Genres" );
-                    ep->Down();
-                    while( ( el = ep->Get() ) != NULL )
-                    {
-                        msg_Dbg( &sys.demuxer, "|   |   + Unknown (%s)", typeid( *el ).name() );
-                    }
-                    ep->Up();
-                }
-                else if( MKV_IS_ID( el, KaxTagAudioSpecific ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Audio Specific" );
-                    ep->Down();
-                    while( ( el = ep->Get() ) != NULL )
-                    {
-                        msg_Dbg( &sys.demuxer, "|   |   + Unknown (%s)", typeid( *el ).name() );
-                    }
-                    ep->Up();
-                }
-                else if( MKV_IS_ID( el, KaxTagImageSpecific ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Images Specific" );
-                    ep->Down();
-                    while( ( el = ep->Get() ) != NULL )
-                    {
-                        msg_Dbg( &sys.demuxer, "|   |   + Unknown (%s)", typeid( *el ).name() );
-                    }
-                    ep->Up();
-                }
-                else if( MKV_IS_ID( el, KaxTagMultiComment ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Multi Comment" );
-                }
-                else if( MKV_IS_ID( el, KaxTagMultiCommercial ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Multi Commercial" );
-                }
-                else if( MKV_IS_ID( el, KaxTagMultiDate ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Multi Date" );
-                }
-                else if( MKV_IS_ID( el, KaxTagMultiEntity ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Multi Entity" );
-                }
-                else if( MKV_IS_ID( el, KaxTagMultiIdentifier ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Multi Identifier" );
-                }
-                else if( MKV_IS_ID( el, KaxTagMultiLegal ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Multi Legal" );
-                }
-                else if( MKV_IS_ID( el, KaxTagMultiTitle ) )
-                {
-                    msg_Dbg( &sys.demuxer, "|   + Multi Title" );
-                }
                 else
                 {
                     msg_Dbg( &sys.demuxer, "|   + Unknown (%s)", typeid( *el ).name() );
-- 
2.2.2


From 732661f7aeb6bcdd28e8ca460c980464d1e285e9 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 15 Sep 2014 22:01:42 +0200
Subject: gcc2 fix.


diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 3a8def1..1745819 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -525,6 +525,7 @@ static int Init( vout_thread_t *p_vout )
 #ifdef OPENGL_MORE_EFFECT
 	else 
     {
+		float f_pov_x, f_pov_y, f_pov_z;
         /* Set the perpective */
         glMatrixMode( GL_PROJECTION );
         glLoadIdentity();
@@ -533,7 +534,6 @@ static int Init( vout_thread_t *p_vout )
         glLoadIdentity();
         glTranslatef( 0.0, 0.0, -3.0 );
 
-		float f_pov_x, f_pov_y, f_pov_z;
 		f_pov_x = var_CreateGetFloat( p_vout, "opengl-pov-x");
 		f_pov_y = var_CreateGetFloat( p_vout, "opengl-pov-y");
 		f_pov_z = var_CreateGetFloat( p_vout, "opengl-pov-z");
@@ -950,14 +950,14 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
 		   glBegin(GL_QUADS);								   
 		   for (i_i = 0; i_i < p_vout->fmt_out.i_visible_width; i_i += i_n_x) 
 		   {
+			  int i_m;
+			  int i_index_max = 0;
+					
 			  if ( i_i == i_n_x * i_n / 2) i_n_x += p_vout->fmt_out.i_visible_width % i_n;
 			  if ((i_i == (p_vout->fmt_out.i_visible_width / i_n) * i_n / 2 + i_n_x) &&
 				  (p_vout->fmt_out.i_visible_width / i_n != i_n_x))
 					i_n_x -= p_vout->fmt_out.i_visible_width % i_n; 
 	
-			  int i_m;
-			  int i_index_max = 0;
-					
 			  for (i_j = 0; i_j < p_vout->fmt_out.i_visible_height; i_j += i_n_y) 
 			  {
 				if ( i_j == i_n_y * i_n / 2) i_n_y += p_vout->fmt_out.i_visible_height % i_n;
-- 
2.2.2


From a089f84039e379bd873eb8b55d5fe2e8874769a2 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Tue, 16 Sep 2014 10:11:21 +0200
Subject: gnutls gcc2 fixes.


diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c
index dc3d686..b0bce86 100644
--- a/modules/misc/gnutls.c
+++ b/modules/misc/gnutls.c
@@ -361,13 +361,18 @@ static int
 gnutls_HandshakeAndValidate( tls_session_t *session )
 {
     int val = gnutls_ContinueHandshake( session );
+	tls_session_sys_t* p_sys;
+    unsigned status;
+	const gnutls_datum* data;
+	size_t v = 0;
+    gnutls_x509_crt cert;
+
     if( val )
         return val;
 
-    tls_session_sys_t *p_sys = (tls_session_sys_t *)(session->p_sys);
+    p_sys = (tls_session_sys_t *)(session->p_sys);
 
     /* certificates chain verification */
-    unsigned status;
     val = gnutls_certificate_verify_peers2( p_sys->session, &status );
 
     if( val )
@@ -398,15 +403,13 @@ gnutls_HandshakeAndValidate( tls_session_t *session )
     }
 
     /* certificate (host)name verification */
-    const gnutls_datum *data = gnutls_certificate_get_peers( p_sys->session,
-                                                             &(size_t){ 0 } );
+    data = gnutls_certificate_get_peers( p_sys->session, &v );
     if( data == NULL )
     {
         msg_Err( session, "Peer certificate not available" );
         goto error;
     }
 
-    gnutls_x509_crt cert;
     val = gnutls_x509_crt_init( &cert );
     if( val )
     {
@@ -1247,6 +1250,7 @@ Open( vlc_object_t *p_this )
 
     if( count.i_int == 0)
     {
+        const char *psz_version = gnutls_check_version( "1.2.9" );
 #ifdef NEED_THREAD_CONTEXT
         __p_gcry_data = VLC_OBJECT( p_this->p_vlc );
 #endif
@@ -1259,7 +1263,6 @@ Open( vlc_object_t *p_this )
             return VLC_EGENERIC;
         }
 
-        const char *psz_version = gnutls_check_version( "1.2.9" );
         if( psz_version == NULL )
         {
             gnutls_global_deinit( );
-- 
2.2.2


From 6dcfd6241bdb0b498f86d86e37e35ea34f8ef0ab Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Sat, 25 Apr 2015 17:15:11 +0200
Subject: Add rdef file.


diff --git a/vlc.rdef b/vlc.rdef
new file mode 100644
index 0000000..86a1d6c
--- /dev/null
+++ b/vlc.rdef
@@ -0,0 +1,47 @@
+
+resource app_flags B_SINGLE_LAUNCH | B_ARGV_ONLY;
+
+resource app_version {
+       major  = 0,
+       middle = 8,
+       minor  = 6,
+
+       variety = B_APPV_FINAL,
+       internal = 0,
+
+       short_info = "VideoLAN Client",
+       long_info = "A multi-platform multimedia player."
+};
+
+resource app_signature "application/x-vnd.videolan-vlc";
+
+resource file_types message {
+       "types" = "application/x-asf",
+       "types" = "audio",
+       "types" = "video"
+};
+
+resource vector_icon {
+       $"6E6369660A0500020006023B69C90000000000003B23A04AC3EF4AE6A9007C45"
+       $"03FFD3893303F2A541020006033D79BF0000000000003D324D49E2A74A24F500"
+       $"FFE8CF7FD18021FFF49119020006023AB37E0000000000003D324D4B3D534961"
+       $"EB00A94604FFDC7D0B020016033B480D0000000000003AC58F49C2784A87EA00"
+       $"FF7FCCFFE4020006033BDD210000000000003B67CD49C2A749821E00FFE8CF7F"
+       $"B96205FFD47505020006033AA07A0000000000003A50B649C2784A547F00FFE8"
+       $"CF7FC36E0AFFEA87130200060338E8A800000000000038905449C28F47E0EE00"
+       $"FFE8CF7FC57210FFF491190401780C0605E202426045574E6048604A60465746"
+       $"0605F2032E484C42B54E42B54EC06FB49E3D22BFB322BD632238B54EBCA8B49B"
+       $"38B54E0A063A3C224C224E425E584858460A073F523F42C738C1713A3C224C42"
+       $"5BC60BC5400A055846C738C1713F423F52C60BC5400A04425E425B584658480A"
+       $"04224E224C425B425E02062EC3102EC3102EC4993D52345246524CC3104CC499"
+       $"4CC310C3A2BFF9C3A2BFF949C18B3D4744473647B978BFFE31C18BB978BFFE02"
+       $"063D4736474447C3A2BFF94AC128C3A2BFF9C2C4BD00C2C4BD0047BE1B3D3E43"
+       $"3E373EBA5939BA85BE1BBA5939B978BFFEB978BFFE30C1280206C2C4BD0047BE"
+       $"1BC2C4BD00C1E3B9F8C1E3B9F845BB0D3D3542353835BB36B9FB35BB0DBB36B9"
+       $"FBBA5939BA593933BE1B3D3E373E433E0206C1E3B9F845BB0DC1E3B9F8C13CB7"
+       $"B4C13CB7B443B8613D2E412E392EBBE2B7A337B861BBE2B7A3BB36B9FBBB36B9"
+       $"FB35BB0D3D35383542350206C13CB7B443B861C13CB7B442B55342B553C06FB4"
+       $"A03D22BFB322BD632238B553BCA8B49E38B553BBE2B7A3BBE2B7A337B8613D2E"
+       $"392E412E0A0A090100000A000201021001178400040A010105000A020106000A"
+       $"030103000A040104000A060107000A070109000A0502080A000A08010B00"
+};
-- 
2.2.2

