]> git.sesse.net Git - vlc/commitdiff
Merge branch 1.0-bugfix
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 20 May 2009 16:46:41 +0000 (19:46 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 20 May 2009 16:46:41 +0000 (19:46 +0300)
Conflicts:
modules/video_filter/extract.c
modules/video_filter/marq.c
projects/mozilla/control/npolibvlc.cpp
src/control/video.c

379 files changed:
NEWS
configure.ac
extras/contrib/src/Patches/gettext-win32.patch
include/vlc/deprecated.h
include/vlc/libvlc_events.h
include/vlc_aout.h
include/vlc_codec.h
include/vlc_codecs.h
include/vlc_es.h
include/vlc_filter.h
include/vlc_fourcc.h [new file with mode: 0644]
include/vlc_input.h
include/vlc_keys.h
include/vlc_osd.h
include/vlc_picture.h [new file with mode: 0644]
include/vlc_playlist.h
include/vlc_subpicture.h [new file with mode: 0644]
include/vlc_vout.h
modules/access/alsa.c
modules/access/dc1394.c
modules/access/dshow/crossbar.cpp
modules/access/dshow/dshow.cpp
modules/access/dshow/filter.cpp
modules/access/dv.c
modules/access/jack.c
modules/access/oss.c
modules/access/qtcapture.m
modules/access/rtp/rtp.c
modules/access/rtp/xiph.c
modules/access/rtsp/real.c
modules/access/rtsp/real_sdpplin.c
modules/access/screen/beos.cpp
modules/access/screen/mac.c
modules/access/screen/screen.c
modules/access/screen/win32.c
modules/access/screen/x11.c
modules/access/v4l.c
modules/access/v4l2.c
modules/audio_filter/channel_mixer/dolby.c
modules/audio_filter/channel_mixer/headphone.c
modules/audio_filter/channel_mixer/mono.c
modules/audio_filter/channel_mixer/simple.c
modules/audio_filter/channel_mixer/trivial.c
modules/audio_filter/converter/a52tofloat32.c
modules/audio_filter/converter/a52tospdif.c
modules/audio_filter/converter/dtstofloat32.c
modules/audio_filter/converter/dtstospdif.c
modules/audio_filter/converter/fixed.c
modules/audio_filter/converter/float.c
modules/audio_filter/converter/mpgatofixed32.c
modules/audio_filter/equalizer.c
modules/audio_filter/format.c
modules/audio_filter/normvol.c
modules/audio_filter/param_eq.c
modules/audio_filter/resampler/bandlimited.c
modules/audio_filter/resampler/linear.c
modules/audio_filter/resampler/trivial.c
modules/audio_filter/resampler/ugly.c
modules/audio_filter/scaletempo.c
modules/audio_filter/spatializer/spatializer.cpp
modules/audio_mixer/float32.c
modules/audio_mixer/trivial.c
modules/audio_output/alsa.c
modules/audio_output/auhal.c
modules/audio_output/directx.c
modules/audio_output/file.c
modules/audio_output/hd1000a.cpp
modules/audio_output/jack.c
modules/audio_output/oss.c
modules/audio_output/portaudio.c
modules/audio_output/pulse.c
modules/audio_output/sdl.c
modules/audio_output/waveout.c
modules/codec/a52.c
modules/codec/adpcm.c
modules/codec/aes3.c
modules/codec/araw.c
modules/codec/avcodec/audio.c
modules/codec/avcodec/chroma.c
modules/codec/avcodec/deinterlace.c
modules/codec/avcodec/encoder.c
modules/codec/avcodec/fourcc.c
modules/codec/avcodec/video.c
modules/codec/cc.c
modules/codec/cdg.c
modules/codec/cmml/cmml.c
modules/codec/csri.c
modules/codec/cvdsub.c
modules/codec/dirac.c
modules/codec/dmo/buffer.c
modules/codec/dmo/dmo.c
modules/codec/dts.c
modules/codec/dvbsub.c
modules/codec/faad.c
modules/codec/fake.c
modules/codec/flac.c
modules/codec/fluidsynth.c
modules/codec/invmem.c
modules/codec/kate.c
modules/codec/libass.c
modules/codec/libmpeg2.c
modules/codec/lpcm.c
modules/codec/mash.cpp
modules/codec/mpeg_audio.c
modules/codec/png.c
modules/codec/quicktime.c
modules/codec/rawvideo.c
modules/codec/realaudio.c
modules/codec/realvideo.c
modules/codec/schroedinger.c
modules/codec/sdl_image.c
modules/codec/shine/shine_mod.c
modules/codec/speex.c
modules/codec/spudec/parse.c
modules/codec/spudec/spudec.c
modules/codec/subtitles/subsass.c
modules/codec/subtitles/subsdec.c
modules/codec/subtitles/subsdec.h
modules/codec/subtitles/subsusf.c
modules/codec/subtitles/t140.c
modules/codec/svcdsub.c
modules/codec/tarkin.c
modules/codec/telx.c
modules/codec/theora.c
modules/codec/twolame.c
modules/codec/vorbis.c
modules/codec/wmafixed/wma.c
modules/codec/x264.c
modules/codec/xvmc/xxmc.c
modules/codec/zvbi.c
modules/control/dbus.c
modules/control/http/macro.c
modules/control/http/rpn.c
modules/control/http/util.c
modules/demux/Modules.am
modules/demux/asf/asf.c
modules/demux/au.c
modules/demux/avformat/Modules.am
modules/demux/avformat/demux.c
modules/demux/avformat/mux.c
modules/demux/avi/avi.c
modules/demux/avi/libavi.h
modules/demux/cdg.c
modules/demux/dirac.c
modules/demux/flac.c
modules/demux/live555.cpp
modules/demux/mjpeg.c
modules/demux/mkv/Modules.am
modules/demux/mkv/matroska_segment.cpp
modules/demux/mpc.c
modules/demux/mpeg/es.c
modules/demux/mpeg/h264.c
modules/demux/mpeg/mpgv.c
modules/demux/nuv.c
modules/demux/ogg.c
modules/demux/ps.c
modules/demux/ps.h
modules/demux/pva.c
modules/demux/rawaud.c
modules/demux/rawdv.c
modules/demux/rawvid.c
modules/demux/smf.c
modules/demux/subtitle.c
modules/demux/subtitle_asa.c
modules/demux/ts.c
modules/demux/tta.c
modules/demux/ty.c
modules/demux/vc1.c
modules/demux/vobsub.c
modules/demux/vobsub.h [new file with mode: 0644]
modules/demux/voc.c
modules/demux/wav.c
modules/gui/beos/AudioOutput.cpp
modules/gui/beos/VideoWindow.h
modules/gui/fbosd.c
modules/gui/macosx/playlist.m
modules/gui/macosx/voutgl.m
modules/gui/ncurses.c
modules/gui/pda/pda_callbacks.c
modules/gui/qnx/aout.c
modules/gui/qnx/vout.c
modules/gui/qt4/Modules.am
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/dialogs/external.cpp
modules/gui/qt4/dialogs/external.hpp
modules/gui/qt4/dialogs/mediainfo.cpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.hpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.hpp
modules/gui/qt4/recents.cpp
modules/gui/qt4/variables.cpp [new file with mode: 0644]
modules/gui/qt4/variables.hpp [new file with mode: 0644]
modules/gui/skins2/src/file_bitmap.cpp
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/vars/playtree.cpp
modules/gui/wince/playlist.cpp
modules/gui/wince/preferences.cpp
modules/gui/wince/preferences_widgets.cpp
modules/misc/dummy/aout.c
modules/misc/dummy/vout.c
modules/misc/freetype.c
modules/misc/lua/libs/playlist.c
modules/misc/notify/telepathy.c
modules/misc/osd/osd_menu.c
modules/misc/quartztext.c
modules/misc/rtsp.c
modules/misc/screensaver.c
modules/misc/stats/decoder.c
modules/misc/stats/encoder.c
modules/misc/stats/vout.c
modules/misc/svg.c
modules/misc/win32text.c
modules/mux/asf.c
modules/mux/avi.c
modules/mux/mp4.c
modules/mux/mpeg/pes.c
modules/mux/mpeg/ps.c
modules/mux/mpeg/ts.c
modules/mux/mpjpeg.c
modules/mux/ogg.c
modules/mux/wav.c
modules/packetizer/copy.c
modules/packetizer/dirac.c
modules/packetizer/h264.c
modules/packetizer/mlp.c
modules/packetizer/mpeg4audio.c
modules/packetizer/mpeg4video.c
modules/packetizer/mpegvideo.c
modules/packetizer/vc1.c
modules/stream_out/mosaic_bridge.c
modules/stream_out/raop.c
modules/stream_out/record.c
modules/stream_out/rtp.c
modules/stream_out/switcher.c
modules/stream_out/transcode.c
modules/stream_out/transrate/transrate.c
modules/video_chroma/grey_yuv.c
modules/video_chroma/i420_rgb.c
modules/video_chroma/i420_rgb16.c
modules/video_chroma/i420_rgb8.c
modules/video_chroma/i420_ymga.c
modules/video_chroma/i420_yuy2.c
modules/video_chroma/i422_i420.c
modules/video_chroma/i422_yuy2.c
modules/video_chroma/yuy2_i420.c
modules/video_chroma/yuy2_i422.c
modules/video_filter/adjust.c
modules/video_filter/alphamask.c
modules/video_filter/atmo/atmo.cpp
modules/video_filter/blend.c
modules/video_filter/blendbench.c
modules/video_filter/bluescreen.c
modules/video_filter/canvas.c
modules/video_filter/chain.c
modules/video_filter/colorthres.c
modules/video_filter/crop.c
modules/video_filter/croppadd.c
modules/video_filter/deinterlace.c
modules/video_filter/dynamicoverlay/dynamicoverlay.c
modules/video_filter/dynamicoverlay/dynamicoverlay.h
modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c
modules/video_filter/erase.c
modules/video_filter/extract.c
modules/video_filter/filter_picture.h
modules/video_filter/gaussianblur.c
modules/video_filter/gradient.c
modules/video_filter/grain.c
modules/video_filter/invert.c
modules/video_filter/logo.c
modules/video_filter/magnify.c
modules/video_filter/marq.c
modules/video_filter/mosaic.c
modules/video_filter/motionblur.c
modules/video_filter/motiondetect.c
modules/video_filter/noise.c
modules/video_filter/opencv_example.cpp
modules/video_filter/opencv_wrapper.c
modules/video_filter/osdmenu.c
modules/video_filter/panoramix.c
modules/video_filter/postproc.c
modules/video_filter/psychedelic.c
modules/video_filter/remoteosd.c
modules/video_filter/ripple.c
modules/video_filter/rotate.c
modules/video_filter/rss.c
modules/video_filter/rv32.c
modules/video_filter/scale.c
modules/video_filter/scene.c
modules/video_filter/sharpen.c
modules/video_filter/swscale.c
modules/video_filter/swscale_maemo.c
modules/video_filter/transform.c
modules/video_filter/wave.c
modules/video_filter/yuvp.c
modules/video_output/aa.c
modules/video_output/caca.c
modules/video_output/directfb.c
modules/video_output/drawable.c
modules/video_output/fb.c
modules/video_output/ggi.c
modules/video_output/hd1000v.cpp
modules/video_output/mga.c
modules/video_output/msw/direct3d.c
modules/video_output/msw/directx.c
modules/video_output/msw/wingdi.c
modules/video_output/omapfb.c
modules/video_output/opengl.c
modules/video_output/opengllayer.m
modules/video_output/qte/qte.cpp
modules/video_output/sdl.c
modules/video_output/snapshot.c
modules/video_output/svgalib.c
modules/video_output/vmem.c
modules/video_output/x11/xcommon.c
modules/video_output/xcb/x11.c
modules/video_output/xcb/xvideo.c
modules/video_output/yuv.c
modules/visualization/galaktos/plugin.c
modules/visualization/goom.c
modules/visualization/visual/visual.c
projects/activex/plugin.cpp
projects/mozilla/control/npolibvlc.cpp
projects/mozilla/control/nporuntime.cpp
projects/mozilla/control/nporuntime.h
projects/mozilla/test.html
projects/mozilla/vlcplugin.cpp
projects/mozilla/vlcshell.cpp
src/Makefile.am
src/audio_output/common.c
src/audio_output/output.c
src/config/file.c
src/control/event.c
src/control/libvlc_internal.h
src/control/media_list_path.h
src/control/media_list_player.c
src/control/media_player.c
src/control/playlist.c
src/control/video.c
src/input/control.c
src/input/decoder.c
src/input/es_out.c
src/input/event.c
src/input/event.h
src/input/input.c
src/libvlc.c
src/libvlc.sym
src/libvlccore.sym
src/misc/es_format.c
src/misc/fourcc.c [new file with mode: 0644]
src/misc/image.c
src/misc/pthread.c [new file with mode: 0644]
src/misc/threads.c
src/misc/w32thread.c [new file with mode: 0644]
src/osd/osd_text.c
src/osd/osd_widgets.c
src/playlist/engine.c
src/playlist/fetcher.c
src/playlist/item.c
src/playlist/playlist_internal.h
src/playlist/preparser.c
src/playlist/search.c
src/playlist/services_discovery.c
src/playlist/thread.c
src/playlist/tree.c
src/stream_output/stream_output.c
src/test/url.c
src/video_output/video_output.c
src/video_output/video_text.c
src/video_output/vout_intf.c
src/video_output/vout_pictures.c
src/video_output/vout_pictures.h
src/video_output/vout_subpictures.c
test/Makefile.am
test/libvlc/core.c

diff --git a/NEWS b/NEWS
index 9aac2686b0c54a8a02672283ebc76f9f07c70e49..d06b69006adb91569bc0fc209b02f5acf8c8f07d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Changes between 1.0.0-rc1 and 1.1.0-git:
+----------------------------------------
+
+
 Changes between 0.9.9a and 1.0.0-rc1:
 ------------------------------------
 
index 8d51b84b16197d34011ad385b39c8e6aafb896c9..c2e8b0507086c9a55bfb87b37dcff568622c38d7 100644 (file)
@@ -2,11 +2,11 @@ dnl Autoconf settings for vlc
 
 AC_COPYRIGHT([Copyright 2002-2009 the VideoLAN team])
 
-AC_INIT(vlc, 1.0.0-rc1)
+AC_INIT(vlc, 1.1.0-git)
 VERSION_MAJOR="1"
-VERSION_MINOR="0"
+VERSION_MINOR="1"
 VERSION_REVISION="0"
-VERSION_EXTRA="-rc1"
+VERSION_EXTRA="-git"
 PKGDIR="vlc"
 AC_SUBST(PKGDIR)
 
@@ -265,6 +265,8 @@ case "${host_os}" in
         echo "  Assuming --disable-skins2"
         enable_x11="no"
         echo "  Assuming --disable-x11"
+        enable_xcb="no"
+        echo "  Assuming --disable-xcb"
         enable_glx="no"
         echo "  Assuming --disable-glx"
         enable_xvideo="no"
@@ -2024,28 +2026,28 @@ AC_ARG_ENABLE(dc1394,
   [  --enable-dc1394         dc1394 access module (default disabled)])
 if test "${enable_dc1394}" = "yes"
 then
-  AC_CHECK_HEADERS(libraw1394/raw1394.h, [
-    AC_CHECK_LIB( raw1394, raw1394_get_nodecount, [
-        AC_CHECK_HEADERS(libdc1394/dc1394_control.h , [
-dnl         AC_CHECK_LIB( dc1394_control, dc1394_setup_capture, [
-              VLC_ADD_PLUGIN([dc1394])
-              VLC_ADD_LIBS([dc1394],[-ldc1394_control -lraw1394])
-dnl         ],
-dnl         [
-dnl           AC_MSG_ERROR([libdc1394 is mandatory for the dc1394 input module. try --disable-dc1394 or install this library])
-dnl         ])
-      ],
-      [
-        AC_MSG_ERROR([libdc1394 is mandatory for the dc1394 input module. try --disable-dc1394 or install this library])
-      ])
+  dnl
+  dnl Check for libraw1394
+  dnl
+  PKG_CHECK_MODULES(LIBRAW1394, libraw1394 >= 2.0.1,
+    [
+      VLC_ADD_LIBS([dc1394],[`${PKG_CONFIG} --libs libraw1394`])
+      VLC_ADD_CPPFLAGS([dc1394],[`${PKG_CONFIG} --cflags libraw1394`])
     ],
+    [AC_MSG_ERROR([Couldn't find libraw1394 >= 2.0.1, install libraw1394 development package])]
+  )
+
+  dnl
+  dnl Check for libdc1394
+  dnl
+  PKG_CHECK_MODULES(LIBDC1394, libdc1394-2 >= 2.0.2,
     [
-      AC_MSG_ERROR([libraw1394 is mandatory for the dc1394 input module. try --disable-dc1394 or install this library])
-    ])
-  ],
-  [
-    AC_MSG_ERROR([libraw1394 is mandatory for the dc1394 input module. try --disable-dc1394 or install this library])
-  ])
+      VLC_ADD_PLUGIN([dc1394])
+      VLC_ADD_LIBS([dc1394],[`${PKG_CONFIG} --libs libdc1394-2`])
+      VLC_ADD_CPPFLAGS([access_dv],[`${PKG_CONFIG} --cflags libdc1394-2`])
+    ],
+    [AC_MSG_ERROR([Couldn't find libdc1394 >= 2.0.2, install libdc1394 development package])]
+  )
 fi
 
 dnl
@@ -2055,120 +2057,28 @@ AC_ARG_ENABLE(dv,
 [  --enable-dv             dv input module (default disabled)])
 if test "${enable_dv}" = "yes"
 then
-  AC_ARG_WITH(dv-raw1394,
-  [    --with-dv-raw1394=PATH   libraw1394 headers and libraries])
-  AC_ARG_WITH(dv-raw1394-tree,
-  [    --with-dv-raw1394=PATH   libraw1394 tree for static linking])
-
-  if test -z "${with_dv_raw1394}" -a "${with_dv_raw1394}" != ""
-  then
-    AC_MSG_CHECKING(for raw1394 headers in ${with_dv_raw1394})
-    if test -f ${with_dv_raw1394}/include/libraw1394/raw1394.h
-    then
-      dnl  Use ${with_dv_raw1394}/include/libraw1394/raw1394.h
-      AC_MSG_RESULT(yes)
-      VLC_ADD_PLUGIN([access_dv])
-      VLC_ADD_LIBS([access_dv],[-L${with_dv_raw1394}/lib -lraw1394 -lpthread])
-      VLC_ADD_CPPFLAGS([access_dv],[-I${with_dv_raw1394}/include])
-    else
-      dnl  No libraw1394 could be found, sorry
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${with_dv_raw1394}/include/libraw1394/raw1394.h])
-    fi
-  else
-    AC_CHECK_HEADERS(libraw1394/raw1394.h,
-    [ VLC_ADD_PLUGIN([access_dv])
-        VLC_ADD_LIBS([access_dv],[-lraw1394 -lavc1394])
-    ],[
-        if test -n "${enable_dv}"
-        then
-          AC_MSG_ERROR([cannot find libraw1394 headers])
-        fi
-    ])
-  fi
-
-  dnl Check for static linking of libraw1394
-  if test -z "${with_dv_raw1394_tree}" -a "${with_dv_raw1394_tree}" != ""
-  then
-    AC_MSG_CHECKING(for libraw1394.a in ${with_dv_raw1394_tree})
-    real_dv_raw1394_tree="`cd ${with_dv_raw1394_tree} 2>/dev/null && pwd`"
-    if test -z "${real_dv_raw1394_tree}"
-    then
-      dnl  The given directory can't be found
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot cd to ${real_dv_raw1394_tree}])
-    fi
-    if test -f "${real_dv_raw1394_tree}/src/.libs/libraw1394.a"
-    then
-      dnl  Use a custom libraw1394
-      AC_MSG_RESULT(${real_dv_raw1394_tree}/src/.libs/libraw1394.a)
-      VLC_ADD_PLUGIN([access_dv])
-      VLC_ADD_LIBS([access_dv],[-L${real_dv_raw1394_tree}/src/.libs -lraw1394])
-      VLC_ADD_CPPFLAGS([access_dv],[-I${real_dv_raw1394_tree}])
-    else
-      dnl  The given libraw1394 wasn't built
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${real_dv_raw1394_tree}/src/.libs/libraw1394.a, make sure you compiled libraw1394 in ${with_dv_raw1394_tree}])
-    fi
-  fi
+  dnl
+  dnl Check for libraw1394
+  dnl
+  PKG_CHECK_MODULES(LIBRAW1394, libraw1394 >= 2.0.1,
+    [
+      VLC_ADD_LIBS([access_dv],[`${PKG_CONFIG} --libs libraw1394`])
+      VLC_ADD_CPPFLAGS([access_dv],[`${PKG_CONFIG} --cflags libraw1394`])
+    ],
+    [AC_MSG_ERROR([Couldn't find libraw1394 >= 2.0.1, install libraw1394 development package])]
+  )
 
   dnl
   dnl Check for libavc1394
   dnl
-
-  AC_ARG_WITH(dv-avc1394,
-  [    --with-dv-avc1394=PATH   libavc1394 headers and libraries])
-  AC_ARG_WITH(dv-avc1394-tree,
-  [    --with-dv-avc1394=PATH   libavc1394 tree for static linking])
-
-  if test -z "${with_dv_avc1394}" -a "${with_dv_avc1394}" != ""
-  then
-    AC_MSG_CHECKING(for avc1394 headers in ${with_dv_avc1394})
-    if test -f ${with_dv_avc1394}/include/libavc1394/avc1394.h
-    then
-      dnl  Use ${with_dv_avc1394}/include/libavc1394/avc1394.h
-      AC_MSG_RESULT(yes)
-      VLC_ADD_LIBS([access_dv],[-L${with_dv_avc1394}/lib -lavc1394 -lrom1394 -lpthread])
-      VLC_ADD_CPPFLAGS([access_dv],[-I${with_avc1394}/include])
-    else
-      dnl  No libavc1394 could be found, sorry
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${with_dv_avc1394}/include/libavc1394/avc1394.h])
-    fi
-  else
-    AC_CHECK_HEADERS(libavc1394/avc1394.h,
-    [ VLC_ADD_LIBS([access_dv],[-lavc1394 -lrom1394 -lpthread])
-    ],[
-        if test -n "${enable_dv}"
-        then
-          AC_MSG_ERROR([cannot find libavc1394 headers])
-        fi
-    ])
-  fi
-
-  dnl Check for static linking of libavc1394
-  if test -z "${with_dv_avc1394_tree}" -a "${with_dv_avc1394_tree}" != ""
-  then
-    AC_MSG_CHECKING(for libavc1394.a in ${with_dv_avc1394_tree})
-    real_dv_avc1394_tree="`cd ${with_dv_avc1394_tree} 2>/dev/null && pwd`"
-    if test -z "${real_dv_avc1394_tree}"
-    then
-      dnl  The given directory can't be found
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot cd to ${real_dv_avc1394_tree}])
-    fi
-    if test -f "${real_dv_avc1394_tree}/src/.libs/libavc1394.a"
-    then
-      dnl  Use a custom libavc1394
-      AC_MSG_RESULT(${real_dv_avc1394_tree}/src/.libs/libavc1394.a)
-      VLC_ADD_LIBS([access_dv],[-L${real_dv_avc1394_tree}/src/.libs -lavc1394 -lrom1394 -lpthread])
-      VLC_ADD_CPPFLAGS([access_dv],[-I${real_dv_avc1394_tree}])
-    else
-      dnl  The given libavc1394 wasn't built
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR([cannot find ${real_dv_avc1394_tree}/src/.libs/libavc1394.a, make sure you compiled libavc1394 in ${with_dv_avc1394_tree}])
-    fi
-  fi
+  PKG_CHECK_MODULES(LIBAVC1394, libavc1394 >= 0.5.3,
+    [
+      VLC_ADD_PLUGIN([access_dv])
+      VLC_ADD_LIBS([access_dv],[`${PKG_CONFIG} --libs libavc1394`])
+      VLC_ADD_CPPFLAGS([access_dv],[`${PKG_CONFIG} --cflags libavc1394`])
+    ],
+    [AC_MSG_ERROR([Couldn't find libavc1394 >= 0.5.1, install libavc1394 development package])]
+  )
 fi
 
 dnl
@@ -3990,7 +3900,7 @@ dnl
 
 AC_PATH_XTRA()
 AC_ARG_ENABLE(x11,
-  [  --enable-x11            X11 support (default enabled)],, [
+  [  --enable-x11            X11 support with Xlib (default enabled)],, [
   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"], [
     enable_x11="yes"
   ], [
@@ -4078,7 +3988,7 @@ dnl  XVMC module
 dnl  (disabled by default except on win32)
 dnl
 AC_ARG_ENABLE(xvmc,
-  [  --enable-xvmc           XVMC support (default disabled)],, [
+  [  --enable-xvmc           XvMC support (default disabled)],, [
   enable_xvmc="no"
 ])
 AS_IF([test "${enable_xvmc}" != "no"], [
@@ -4159,17 +4069,23 @@ CPPFLAGS="${CPPFLAGS_save}"
 
 dnl
 dnl  X C Bindings modules
-dnl  (work in progress)
 dnl
 AC_ARG_ENABLE(xcb,
-  [  --enable-xcb            X C Bindings work-in-progress (default disabled)],
-  ,[enable_xcb="no"])
+  [  --enable-xcb            X11 support with XCB (default enabled)],, [
+  AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"], [
+    enable_xcb="yes"
+  ], [
+    enable_xcb="no"
+  ])
+])
+
 AS_IF([test "${enable_xcb}" != "no"], [
   PKG_CHECK_MODULES(XPROTO, [xproto])
 
   dnl libxcb
   PKG_CHECK_MODULES(XCB, [xcb])
   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
+  VLC_ADD_PLUGIN([xcb])
 
   AS_IF([test "${enable_xvideo}" != "no"], [
     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [
@@ -4180,10 +4096,13 @@ AS_IF([test "${enable_xcb}" != "no"], [
   dnl xcb-utils
   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms])
 
-  VLC_ADD_PLUGIN([xcb])
   VLC_ADD_PLUGIN([xcb_window])
+  VLC_ADD_PLUGIN([globalhotkeys])
+  VLC_ADD_CFLAGS([globalhotkeys],[${XCB_KEYSYMS_CFLAGS} ${XCB_CFLAGS}] )
+  VLC_ADD_LIBS([globalhotkeys],[${XCB_KEYSYMS_LIBS} ${XCB_LIBS}] )
 ])
 
+
 dnl
 dnl  OpenGL module
 dnl  (enabled by default except on beos)
@@ -5024,7 +4943,7 @@ then
     VLC_ADD_LIBS([maemo],[${HILDON_LIBS}])
     VLC_ADD_PLUGIN([maemo])
     VLC_ADD_PLUGIN([swscale_maemo])
-    AC_DEFINE([BUILD_MAEMO], 1, [Define if you're using Maemo interfaces])
+    AC_DEFINE([BUILD_MAEMO], 1, [Define if you are using Maemo interfaces])
     ALIASES="${ALIASES} mvlc"
   ], [
     AS_IF([test "${enable_maemo}" = "yes"],[
@@ -5043,7 +4962,7 @@ AC_ARG_ENABLE(qt4,
   AS_IF([test "${SYS}" = "darwin"], [enable_qt4=no])
 ])
 AS_IF([test "${enable_qt4}" != "no"], [
-  PKG_CHECK_MODULES(QT4, [QtCore QtGui >= 4.3.0], [
+  PKG_CHECK_MODULES(QT4, [QtCore QtGui >= 4.4.0], [
     VLC_ADD_PLUGIN([qt4])
     AC_DEFINE([HAVE_QT4], 1, [Define to 1 if you have QT4 library.])
     ALIASES="${ALIASES} qvlc"
@@ -5373,18 +5292,6 @@ then
   fi
 fi
 
-dnl
-dnl Global hotkeys using XCB
-dnl
-PKG_CHECK_MODULES(XCB, [xcb], [
-  PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms], [
-    PKG_CHECK_MODULES(XPROTO, [xproto], [
-      VLC_ADD_PLUGIN([globalhotkeys])
-      VLC_ADD_CFLAGS([globalhotkeys],[${XCB_KEYSYMS_CFLAGS} ${XCB_CFLAGS}] )
-      VLC_ADD_LIBS([globalhotkeys],[${XCB_KEYSYMS_LIBS} ${XCB_LIBS}] )
-    ], [ AC_MSG_WARN( [Xproto not found] ) ])
-  ], [ AC_MSG_WARN( [XCB keysyms was not found]) ])
-], [ AC_MSG_WARN( [XCB was not found]) ])
 
 AC_ARG_WITH(,[Misc options:])
 
index aafdd662f388080d495d9a4ae944df62ce01fe20..bd9c45d857398e0fff05b05c514703370f2eb0cf 100644 (file)
 -        "-DPACKAGE_VERSION_MAJOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_major"` \
 -        "-DPACKAGE_VERSION_MINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_minor"` \
 -        "-DPACKAGE_VERSION_SUBMINOR="`echo '$(VERSION)' | sed -n -e "$$sed_extract_subminor"` \
-+      $(WINDRES) `$(top_srcdir)/../windows/windres-options --escape $(VERSION)`\
++      $(WINDRES) --use-temp-file `$(top_srcdir)/../windows/windres-options --escape $(VERSION)`\
          -i $(srcdir)/libintl.rc -o libintl.res --output-format=coff
  
  ref-add.sed: $(srcdir)/ref-add.sin
+--- gettext-0.17/gettext-runtime/intl/libintl.rc        2007-05-27 21:46:52.000000000 +0000
++++ gettext/gettext-runtime/intl/libintl.rc     2009-05-18 18:09:12.000000000 +0000
+@@ -22,13 +22,13 @@
+             VALUE "Comments", "This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\0"
+             VALUE "CompanyName", "Free Software Foundation\0"
+             VALUE "FileDescription", "LGPLed libintl for Windows NT/2000/XP/Vista and Windows 95/98/ME\0"
+-            VALUE "FileVersion", PACKAGE_VERSION_STRING "\0"
++            VALUE "FileVersion", "\0"
+             VALUE "InternalName", "intl.dll\0"
+             VALUE "LegalCopyright", "Copyright (C) 1995-2007\0"
+             VALUE "LegalTrademarks", "\0"
+             VALUE "OriginalFilename", "intl.dll\0"
+             VALUE "ProductName", "libintl: accessing NLS message catalogs\0"
+-            VALUE "ProductVersion", PACKAGE_VERSION_STRING "\0"
++            VALUE "ProductVersion", "\0"
+         END
+     END
+     BLOCK "VarFileInfo"
index 2cb82e11034c42b79115efd043f41fdfd06aa1eb..93053490ec6c97ca53f7f33fb25a711b68ac0b16 100644 (file)
@@ -71,88 +71,6 @@ VLC_DEPRECATED_API void libvlc_media_player_set_drawable ( libvlc_media_player_t
 VLC_DEPRECATED_API libvlc_drawable_t
                     libvlc_media_player_get_drawable ( libvlc_media_player_t *, libvlc_exception_t * );
 
-/**
- * Set the default video output's parent.
- *
- * This setting will be used as default for any video output.
- *
- * \param p_instance libvlc instance
- * \param drawable the new parent window
- *                 (see libvlc_media_player_set_drawable() for details)
- * \param p_e an initialized exception pointer
- * @deprecated Use libvlc_media_player_set_drawable
- */
-VLC_DEPRECATED_API void libvlc_video_set_parent( libvlc_instance_t *, libvlc_drawable_t, libvlc_exception_t * );
-
-/**
- * Set the default video output parent.
- *
- * This setting will be used as default for all video outputs.
- *
- * \param p_instance libvlc instance
- * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
- * \param p_e an initialized exception pointer
- * @deprecated Use libvlc_media_player_get_drawable
- */
-VLC_DEPRECATED_API libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *, libvlc_exception_t * );
-
-/**
- * Does nothing. Do not use this function.
- */
-VLC_DEPRECATED_API int libvlc_video_reparent( libvlc_media_player_t *, libvlc_drawable_t, libvlc_exception_t * );
-
-/**
- * Resize the current video output window.
- * This might crash. Please use libvlc_video_set_scale() instead.
- *
- * \param p_mi media player instance
- * \param width new width for video output window
- * \param height new height for video output window
- * \param p_e an initialized exception pointer
- * \return the success status (boolean)
- */
-VLC_DEPRECATED_API void libvlc_video_resize( libvlc_media_player_t *, int, int, libvlc_exception_t *);
-
-/**
- * Tell windowless video output to redraw rectangular area (MacOS X only).
- * This might crash. Do not use this function.
- *
- * \param p_mi media player instance
- * \param area coordinates within video drawable
- * \param p_e an initialized exception pointer
- */
-VLC_DEPRECATED_API void libvlc_video_redraw_rectangle( libvlc_media_player_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
-
-/**
- * Set the default video output size.
- * This setting will be used as default for all video outputs.
- *
- * \param p_instance libvlc instance
- * \param width new width for video drawable
- * \param height new height for video drawable
- * \param p_e an initialized exception pointer
- */
-VLC_DEPRECATED_API void libvlc_video_set_size( libvlc_instance_t *, int, int, libvlc_exception_t * );
-
-/**
- * Set the default video output viewport for a windowless video output
- * (MacOS X only). This might crash. Do not use this function.
- *
- * This setting will be used as default for all video outputs.
- *
- * \param p_instance libvlc instance
- * \param p_mi media player instance
- * \param view coordinates within video drawable
- * \param clip coordinates within video drawable
- * \param p_e an initialized exception pointer
- */
-VLC_DEPRECATED_API void libvlc_video_set_viewport( libvlc_instance_t *, libvlc_media_player_t *, const libvlc_rectangle_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
-
-/*
- * This function shall not be used at all. It may lead to crash and race condition.
- */
-VLC_DEPRECATED_API int libvlc_video_destroy( libvlc_media_player_t *, libvlc_exception_t *);
-
 /*****************************************************************************
  * Playlist (Deprecated)
  *****************************************************************************/
@@ -163,17 +81,6 @@ VLC_DEPRECATED_API int libvlc_video_destroy( libvlc_media_player_t *, libvlc_exc
  * @{
  */
 
-/**
- * Set the playlist's loop attribute. If set, the playlist runs continuously
- * and wraps around when it reaches the end.
- *
- * \param p_instance the playlist instance
- * \param loop the loop attribute. 1 sets looping, 0 disables it
- * \param p_e an initialized exception pointer
- */
-VLC_DEPRECATED_API void libvlc_playlist_loop( libvlc_instance_t* , int,
-                                          libvlc_exception_t * );
-
 /**
  * Start playing.
  *
@@ -191,158 +98,6 @@ VLC_DEPRECATED_API void libvlc_playlist_loop( libvlc_instance_t* , int,
 VLC_DEPRECATED_API void libvlc_playlist_play( libvlc_instance_t*, int, int,
                                           char **, libvlc_exception_t * );
 
-/**
- * Toggle the playlist's pause status.
- *
- * If the playlist was running, it is paused. If it was paused, it is resumed.
- *
- * \param p_instance the playlist instance to pause
- * \param p_e an initialized exception pointer
- */
-VLC_DEPRECATED_API void libvlc_playlist_pause( libvlc_instance_t *,
-                                           libvlc_exception_t * );
-
-/**
- * Checks whether the playlist is running
- *
- * \param p_instance the playlist instance
- * \param p_e an initialized exception pointer
- * \return 0 if the playlist is stopped or paused, 1 if it is running
- */
-VLC_DEPRECATED_API int libvlc_playlist_isplaying( libvlc_instance_t *,
-                                              libvlc_exception_t * );
-
-/**
- * Get the number of items in the playlist
- *
- * Expects the playlist instance to be locked already.
- *
- * \param p_instance the playlist instance
- * \param p_e an initialized exception pointer
- * \return the number of items
- */
-VLC_DEPRECATED_API int libvlc_playlist_items_count( libvlc_instance_t *,
-                                                libvlc_exception_t * );
-
-VLC_DEPRECATED_API int libvlc_playlist_get_current_index( libvlc_instance_t *,
-                                                 libvlc_exception_t *);
-/**
- * Lock the playlist.
- *
- * \param p_instance the playlist instance
- */
-VLC_DEPRECATED_API void libvlc_playlist_lock( libvlc_instance_t * );
-
-/**
- * Unlock the playlist.
- *
- * \param p_instance the playlist instance
- */
-VLC_DEPRECATED_API void libvlc_playlist_unlock( libvlc_instance_t * );
-
-/**
- * Stop playing.
- *
- * \param p_instance the playlist instance to stop
- * \param p_e an initialized exception pointer
- */
-VLC_DEPRECATED_API void libvlc_playlist_stop( libvlc_instance_t *,
-                                          libvlc_exception_t * );
-
-/**
- * Go to the next playlist item. If the playlist was stopped, playback
- * is started.
- *
- * \param p_instance the playlist instance
- * \param p_e an initialized exception pointer
- */
-VLC_DEPRECATED_API void libvlc_playlist_next( libvlc_instance_t *,
-                                          libvlc_exception_t * );
-
-/**
- * Go to the previous playlist item. If the playlist was stopped, playback
- * is started.
- *
- * \param p_instance the playlist instance
- * \param p_e an initialized exception pointer
- */
-VLC_DEPRECATED_API void libvlc_playlist_prev( libvlc_instance_t *,
-                                          libvlc_exception_t * );
-
-/**
- * Empty a playlist. All items in the playlist are removed.
- *
- * \param p_instance the playlist instance
- * \param p_e an initialized exception pointer
- */
-VLC_DEPRECATED_API void libvlc_playlist_clear( libvlc_instance_t *,
-                                           libvlc_exception_t * );
-
-/**
- * Append an item to the playlist. The item is added at the end. If more
- * advanced options are required, \see libvlc_playlist_add_extended instead.
- *
- * \param p_instance the playlist instance
- * \param psz_uri the URI to open, using VLC format
- * \param psz_name a name that you might want to give or NULL
- * \param p_e an initialized exception pointer
- * \return the identifier of the new item
- */
-VLC_DEPRECATED_API int libvlc_playlist_add( libvlc_instance_t *, const char *,
-                                        const char *, libvlc_exception_t * );
-
-/**
- * Append an item to the playlist. The item is added at the end, with
- * additional input options.
- *
- * \param p_instance the playlist instance
- * \param psz_uri the URI to open, using VLC format
- * \param psz_name a name that you might want to give or NULL
- * \param i_options the number of options to add
- * \param ppsz_options strings representing the options to add
- * \param p_e an initialized exception pointer
- * \return the identifier of the new item
- */
-VLC_DEPRECATED_API int libvlc_playlist_add_extended( libvlc_instance_t *, const char *,
-                                                 const char *, int, const char **,
-                                                 libvlc_exception_t * );
-
-/**
- * Append an item to the playlist. The item is added at the end, with
- * additional input options from an untrusted source.
- *
- * \param p_instance the playlist instance
- * \param psz_uri the URI to open, using VLC format
- * \param psz_name a name that you might want to give or NULL
- * \param i_options the number of options to add
- * \param ppsz_options strings representing the options to add
- * \param p_e an initialized exception pointer
- * \return the identifier of the new item
- */
-VLC_DEPRECATED_API int libvlc_playlist_add_extended_untrusted( libvlc_instance_t *, const char *,
-                                                 const char *, int, const char **,
-                                                 libvlc_exception_t * );
-
-/**
- * Delete the playlist item with the given ID.
- *
- * \param p_instance the playlist instance
- * \param i_id the id to remove
- * \param p_e an initialized exception pointer
- * \return 0 in case of success, a non-zero value otherwise
- */
-VLC_DEPRECATED_API int libvlc_playlist_delete_item( libvlc_instance_t *, int,
-                                                libvlc_exception_t * );
-
-/** Get the input that is currently being played by the playlist.
- *
- * \param p_instance the playlist instance to use
- * \param p_e an initialized exception pointern
- * \return a media instance object
- */
-VLC_DEPRECATED_API libvlc_media_player_t * libvlc_playlist_get_media_player(
-                                libvlc_instance_t *, libvlc_exception_t * );
-
 /** @}*/
 
 # ifdef __cplusplus
index 1004989475794db3dfdd9eb986ed003b1ad9e65b..57bb9a6a7e97a0b63aa5d894769386237d8e2598 100644 (file)
@@ -88,6 +88,7 @@ typedef enum libvlc_event_type_t {
 
     libvlc_MediaPlayerTitleChanged,
     libvlc_MediaPlayerSnapshotTaken,
+    libvlc_MediaPlayerLengthChanged,
     /* New event types HERE */
 } libvlc_event_type_t;
 
@@ -202,6 +203,11 @@ typedef struct libvlc_event_t
              char* psz_filename ;
         } media_player_snapshot_taken ;
 
+        /* Length changed */
+        struct
+        {
+            libvlc_time_t   new_length;
+        } media_player_length_changed;
     } u;
 } libvlc_event_t;
 
index 00b7e2e6b13cdf550528c25f8a06fe1014d17aa8..21b67fbdb6a47e4ed8a9a93ab569da508bed4cdc 100644 (file)
@@ -47,25 +47,14 @@ extern "C" {
       && ((p_first)->i_physical_channels == (p_second)->i_physical_channels)\
       && ((p_first)->i_original_channels == (p_second)->i_original_channels) )
 
-#ifdef WORDS_BIGENDIAN
-#   define AOUT_FMT_S16_NE VLC_FOURCC('s','1','6','b')
-#   define AOUT_FMT_U16_NE VLC_FOURCC('u','1','6','b')
-#   define AOUT_FMT_S24_NE VLC_FOURCC('s','2','4','b')
-#   define AOUT_FMT_S32_NE VLC_FOURCC('s','3','2','b')
-#   define AOUT_FMT_SPDIF_NE VLC_FOURCC('s','p','d','b')
-#else
-#   define AOUT_FMT_S16_NE VLC_FOURCC('s','1','6','l')
-#   define AOUT_FMT_U16_NE VLC_FOURCC('u','1','6','l')
-#   define AOUT_FMT_S24_NE VLC_FOURCC('s','2','4','l')
-#   define AOUT_FMT_S32_NE VLC_FOURCC('s','3','2','l')
-#   define AOUT_FMT_SPDIF_NE VLC_FOURCC('s','p','d','i')
-#endif
-
-#define AOUT_FMT_NON_LINEAR( p_format )                                    \
-    ( ((p_format)->i_format == VLC_FOURCC('s','p','d','i'))                \
-       || ((p_format)->i_format == VLC_FOURCC('s','p','d','b'))            \
-       || ((p_format)->i_format == VLC_FOURCC('a','5','2',' '))            \
-       || ((p_format)->i_format == VLC_FOURCC('d','t','s',' ')) )
+#define VLC_CODEC_SPDIFL VLC_FOURCC('s','p','d','i')
+#define VLC_CODEC_SPDIFB VLC_FOURCC('s','p','d','b')
+
+#define AOUT_FMT_NON_LINEAR( p_format )                 \
+    ( ((p_format)->i_format == VLC_CODEC_SPDIFL)       \
+       || ((p_format)->i_format == VLC_CODEC_SPDIFB)   \
+       || ((p_format)->i_format == VLC_CODEC_A52)       \
+       || ((p_format)->i_format == VLC_CODEC_DTS) )
 
 /* This is heavily borrowed from libmad, by Robert Leslie <rob@mars.org> */
 /*
index 291581c4731f74af61b310b4fe8cb3b673f310ba..512dcf3ae652faa9f9564a1e6ab1e67bddaa2e85 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <vlc_block.h>
 #include <vlc_es.h>
+#include <vlc_picture.h>
+#include <vlc_subpicture.h>
 
 /**
  * \file
index 85176d02054cc44f179e77c6f05e034d605b3726..42362954694e23125866849148fa10d311cd5703 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef VLC_CODECS_H
 #define VLC_CODECS_H 1
 
+#include <vlc_fourcc.h>
 /**
  * \file
  * This file defines codec related structures needed by the demuxers and decoders
@@ -302,35 +303,34 @@ wave_format_tag_to_fourcc[] =
     { WAVE_FORMAT_PCM,        VLC_FOURCC( 'a', 'r', 'a', 'w' ), "Raw audio" },
     { WAVE_FORMAT_ADPCM,      VLC_FOURCC( 'm', 's', 0x00,0x02), "ADPCM" },
     { WAVE_FORMAT_IEEE_FLOAT, VLC_FOURCC( 'a', 'f', 'l', 't' ), "IEEE Float audio" },
-    { WAVE_FORMAT_ALAW,       VLC_FOURCC( 'a', 'l', 'a', 'w' ), "A-Law" },
-    { WAVE_FORMAT_MULAW,      VLC_FOURCC( 'm', 'l', 'a', 'w' ), "Mu-Law" },
+    { WAVE_FORMAT_ALAW,       VLC_CODEC_ALAW,                   "A-Law" },
+    { WAVE_FORMAT_MULAW,      VLC_CODEC_MULAW,                  "Mu-Law" },
     { WAVE_FORMAT_IMA_ADPCM,  VLC_FOURCC( 'm', 's', 0x00,0x11), "Ima-ADPCM" },
-    { WAVE_FORMAT_GSM610,     VLC_FOURCC( 'a', 'g', 's', 'm' ), "Microsoft WAV GSM" },
-    { WAVE_FORMAT_G726,       VLC_FOURCC( 'g', '7', '2', '6' ), "G.726 ADPCM" },
-    { WAVE_FORMAT_MPEGLAYER3, VLC_FOURCC( 'm', 'p', 'g', 'a' ), "Mpeg Audio" },
-    { WAVE_FORMAT_MPEG,       VLC_FOURCC( 'm', 'p', 'g', 'a' ), "Mpeg Audio" },
-    { WAVE_FORMAT_A52,        VLC_FOURCC( 'a', '5', '2', ' ' ), "A/52" },
-    { WAVE_FORMAT_WMA1,       VLC_FOURCC( 'w', 'm', 'a', '1' ), "Window Media Audio v1" },
-    { WAVE_FORMAT_WMA2,       VLC_FOURCC( 'w', 'm', 'a', '2' ), "Window Media Audio v2" },
-    { WAVE_FORMAT_WMA2,       VLC_FOURCC( 'w', 'm', 'a', ' ' ), "Window Media Audio v2" },
-    { WAVE_FORMAT_WMAP,       VLC_FOURCC( 'w', 'm', 'a', 'p' ), "Window Media Audio 9 Professional" },
-    { WAVE_FORMAT_WMAL,       VLC_FOURCC( 'w', 'm', 'a', 'l' ), "Window Media Audio 9 Lossless" },
-    { WAVE_FORMAT_WMAS,       VLC_FOURCC( 'w', 'm', 'a', 's' ), "Window Media Audio 9 Speech" },
+    { WAVE_FORMAT_GSM610,     VLC_CODEC_GSM_MS,                 "Microsoft WAV GSM" },
+    { WAVE_FORMAT_G726,       VLC_CODEC_ADPCM_G726,             "G.726 ADPCM" },
+    { WAVE_FORMAT_MPEGLAYER3, VLC_CODEC_MPGA,                   "Mpeg Audio" },
+    { WAVE_FORMAT_MPEG,       VLC_CODEC_MPGA,                   "Mpeg Audio" },
+    { WAVE_FORMAT_A52,        VLC_CODEC_A52,                    "A/52" },
+    { WAVE_FORMAT_WMA1,       VLC_CODEC_WMA1,                   "Window Media Audio v1" },
+    { WAVE_FORMAT_WMA2,       VLC_CODEC_WMA2,                   "Window Media Audio v2" },
+    { WAVE_FORMAT_WMAP,       VLC_CODEC_WMAP,                   "Window Media Audio 9 Professional" },
+    { WAVE_FORMAT_WMAL,       VLC_CODEC_WMAL,                   "Window Media Audio 9 Lossless" },
+    { WAVE_FORMAT_WMAS,       VLC_CODEC_WMAS,                   "Window Media Audio 9 Speech" },
     { WAVE_FORMAT_DK3,        VLC_FOURCC( 'm', 's', 0x00,0x61), "Duck DK3" },
     { WAVE_FORMAT_DK4,        VLC_FOURCC( 'm', 's', 0x00,0x62), "Duck DK4" },
-    { WAVE_FORMAT_DTS,        VLC_FOURCC( 'd', 't', 's', ' ' ), "DTS Coherent Acoustics" },
-    { WAVE_FORMAT_DTS_MS,     VLC_FOURCC( 'd', 't', 's', ' ' ), "DTS Coherent Acoustics" },
-    { WAVE_FORMAT_DIVIO_AAC,  VLC_FOURCC( 'm', 'p', '4', 'a' ), "MPEG-4 Audio (Divio)" },
-    { WAVE_FORMAT_AAC,        VLC_FOURCC( 'm', 'p', '4', 'a' ), "MPEG-4 Audio" },
-    { WAVE_FORMAT_FFMPEG_AAC, VLC_FOURCC( 'm', 'p', '4', 'a' ), "MPEG-4 Audio" },
-    { WAVE_FORMAT_VORBIS,     VLC_FOURCC( 'v', 'o', 'r', 'b' ), "Vorbis Audio" },
+    { WAVE_FORMAT_DTS,        VLC_CODEC_DTS,                    "DTS Coherent Acoustics" },
+    { WAVE_FORMAT_DTS_MS,     VLC_CODEC_DTS,                    "DTS Coherent Acoustics" },
+    { WAVE_FORMAT_DIVIO_AAC,  VLC_CODEC_MP4A,                   "MPEG-4 Audio (Divio)" },
+    { WAVE_FORMAT_AAC,        VLC_CODEC_MP4A,                   "MPEG-4 Audio" },
+    { WAVE_FORMAT_FFMPEG_AAC, VLC_CODEC_MP4A,                   "MPEG-4 Audio" },
+    { WAVE_FORMAT_VORBIS,     VLC_CODEC_VORBIS,                 "Vorbis Audio" },
     { WAVE_FORMAT_VORB_1,     VLC_FOURCC( 'v', 'o', 'r', '1' ), "Vorbis 1 Audio" },
     { WAVE_FORMAT_VORB_1PLUS, VLC_FOURCC( 'v', 'o', '1', '+' ), "Vorbis 1+ Audio" },
     { WAVE_FORMAT_VORB_2,     VLC_FOURCC( 'v', 'o', 'r', '2' ), "Vorbis 2 Audio" },
     { WAVE_FORMAT_VORB_2PLUS, VLC_FOURCC( 'v', 'o', '2', '+' ), "Vorbis 2+ Audio" },
     { WAVE_FORMAT_VORB_3,     VLC_FOURCC( 'v', 'o', 'r', '3' ), "Vorbis 3 Audio" },
     { WAVE_FORMAT_VORB_3PLUS, VLC_FOURCC( 'v', 'o', '3', '+' ), "Vorbis 3+ Audio" },
-    { WAVE_FORMAT_SPEEX,      VLC_FOURCC( 's', 'p', 'x', ' ' ), "Speex Audio" },
+    { WAVE_FORMAT_SPEEX,      VLC_CODEC_SPEEX,                  "Speex Audio" },
     { WAVE_FORMAT_UNKNOWN,    VLC_FOURCC( 'u', 'n', 'd', 'f' ), "Unknown" }
 };
 
@@ -393,31 +393,4 @@ static inline void sf_tag_to_fourcc( GUID *guid_tag,
     if( ppsz_name ) *ppsz_name = sub_format_tag_to_fourcc[i].psz_name;
 }
 
-/**
- * Structure to hold information concerning subtitles.
- * Used between demuxers and decoders of subtitles.
- */
-typedef struct es_sys_t
-{
-    char               *psz_header; /* for 'ssa ' and 'subt' */
-
-    /* for spudec */
-    unsigned int        i_orig_height;
-    unsigned int        i_orig_width;
-    unsigned int        i_origin_x;
-    unsigned int        i_origin_y;
-    unsigned int        i_scale_h;
-    unsigned int        i_scale_v;
-    unsigned int        i_alpha;
-    bool          b_smooth;
-    mtime_t             i_fade_in;
-    mtime_t             i_fade_out;
-    unsigned int        i_align;
-    mtime_t             i_time_offset;
-    bool          b_forced_subs;
-    unsigned int        palette[16];
-    unsigned int        colors[4];
-
-} subtitle_data_t;
-
 #endif /* "codecs.h" */
index 8744f20f733e05d67f7e20dff8926a62b23590b9..c315c5fb92e68f9b1c798f26053a8ccfdd49a37d 100644 (file)
@@ -27,6 +27,7 @@
 /* FIXME: i'm not too sure about this include but it fixes compilation of
  * video chromas -- dionoea */
 #include "vlc_common.h"
+#include <vlc_fourcc.h>
 
 /**
  * \file
@@ -98,14 +99,6 @@ struct audio_format_t
     uint8_t      i_flavor;
 };
 
-#ifdef WORDS_BIGENDIAN
-#   define AUDIO_FMT_S16_NE VLC_FOURCC('s','1','6','b')
-#   define AUDIO_FMT_U16_NE VLC_FOURCC('u','1','6','b')
-#else
-#   define AUDIO_FMT_S16_NE VLC_FOURCC('s','1','6','l')
-#   define AUDIO_FMT_U16_NE VLC_FOURCC('u','1','6','l')
-#endif
-
 /**
  * video format description
  */
@@ -178,6 +171,12 @@ static inline void video_format_Clean( video_format_t *p_src )
     p_src->p_palette = NULL;
 }
 
+/**
+ * It will fill up a video_format_tvideo_format_t using the given arguments.
+ * Becarefull that the video_format_t must already be initialized.
+ */
+VLC_EXPORT( void, video_format_Setup, ( video_format_t *, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) );
+
 /**
  * subtitles format description
  */
@@ -227,8 +226,9 @@ typedef struct extra_languages_t
  */
 struct es_format_t
 {
-    int             i_cat;      /**< ES category @see es_format_category_e */
-    vlc_fourcc_t    i_codec;    /**< FOURCC value as used in vlc */
+    int             i_cat;              /**< ES category @see es_format_category_e */
+    vlc_fourcc_t    i_codec;            /**< FOURCC value as used in vlc */
+    vlc_fourcc_t    i_original_fourcc;  /**< original FOURCC from the container */
 
     int             i_id;       /**< es identifier, where means
                                     -1: let the core mark the right id
index a7404a74cee114d1ee4363977e7e5de4dc47ec0e..6dbb2f117ca115564918b3e12b8c530aa7516617 100644 (file)
@@ -26,6 +26,8 @@
 #define VLC_FILTER_H 1
 
 #include <vlc_es.h>
+#include <vlc_picture.h>
+#include <vlc_subpicture.h>
 
 /**
  * \file
diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
new file mode 100644 (file)
index 0000000..0fe0c2d
--- /dev/null
@@ -0,0 +1,353 @@
+/*****************************************************************************
+ * vlc_fourcc.h: Definition of various FOURCC and helpers
+ *****************************************************************************
+ * Copyright (C) 2009 Laurent Aimar
+ * $Id$
+ *
+ * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VLC_FOURCC_H
+#define VLC_FOURCC_H 1
+
+#include <vlc_common.h>
+#include <vlc_es.h>
+
+/* Video codec */
+#define VLC_CODEC_MPGV      VLC_FOURCC('m','p','g','v')
+#define VLC_CODEC_MP4V      VLC_FOURCC('m','p','4','v')
+#define VLC_CODEC_DIV1      VLC_FOURCC('D','I','V','1')
+#define VLC_CODEC_DIV2      VLC_FOURCC('D','I','V','2')
+#define VLC_CODEC_DIV3      VLC_FOURCC('D','I','V','3')
+#define VLC_CODEC_SVQ1      VLC_FOURCC('S','V','Q','1')
+#define VLC_CODEC_SVQ3      VLC_FOURCC('S','V','Q','3')
+#define VLC_CODEC_H264      VLC_FOURCC('h','2','6','4')
+#define VLC_CODEC_H263      VLC_FOURCC('h','2','6','3')
+#define VLC_CODEC_H263I     VLC_FOURCC('I','2','6','3')
+#define VLC_CODEC_H263P     VLC_FOURCC('I','L','V','R')
+#define VLC_CODEC_FLV1      VLC_FOURCC('F','L','V','1')
+#define VLC_CODEC_H261      VLC_FOURCC('h','2','6','1')
+#define VLC_CODEC_MJPG      VLC_FOURCC('M','J','P','G')
+#define VLC_CODEC_MJPGB     VLC_FOURCC('m','j','p','b')
+#define VLC_CODEC_LJPG      VLC_FOURCC('L','J','P','G')
+#define VLC_CODEC_WMV1      VLC_FOURCC('W','M','V','1')
+#define VLC_CODEC_WMV2      VLC_FOURCC('W','M','V','2')
+#define VLC_CODEC_WMV3      VLC_FOURCC('W','M','V','3')
+#define VLC_CODEC_WMVA      VLC_FOURCC('W','M','V','A')
+#define VLC_CODEC_VC1       VLC_FOURCC('V','C','-','1')
+#define VLC_CODEC_THEORA    VLC_FOURCC('t','h','e','o')
+#define VLC_CODEC_TARKIN    VLC_FOURCC('t','a','r','k')
+#define VLC_CODEC_SNOW      VLC_FOURCC('S','N','O','W')
+#define VLC_CODEC_DIRAC     VLC_FOURCC('d','r','a','c')
+#define VLC_CODEC_CAVS      VLC_FOURCC('C','A','V','S')
+#define VLC_CODEC_NUV       VLC_FOURCC('N','J','P','G')
+#define VLC_CODEC_RV10      VLC_FOURCC('R','V','1','0')
+#define VLC_CODEC_RV13      VLC_FOURCC('R','V','1','3')
+#define VLC_CODEC_RV20      VLC_FOURCC('R','V','2','0')
+#define VLC_CODEC_RV30      VLC_FOURCC('R','V','3','0')
+#define VLC_CODEC_RV40      VLC_FOURCC('R','V','4','0')
+#define VLC_CODEC_VP3       VLC_FOURCC('V','P','3',' ')
+#define VLC_CODEC_VP5       VLC_FOURCC('V','P','5',' ')
+#define VLC_CODEC_VP6       VLC_FOURCC('V','P','6','2')
+#define VLC_CODEC_VP6F      VLC_FOURCC('V','P','6','F')
+#define VLC_CODEC_VP6A      VLC_FOURCC('V','P','6','A')
+#define VLC_CODEC_MSVIDEO1  VLC_FOURCC('M','S','V','C')
+#define VLC_CODEC_FLIC      VLC_FOURCC('F','L','I','C')
+#define VLC_CODEC_SP5X      VLC_FOURCC('S','P','5','X')
+#define VLC_CODEC_DV        VLC_FOURCC('d','v',' ',' ')
+#define VLC_CODEC_MSRLE     VLC_FOURCC('m','r','l','e')
+#define VLC_CODEC_INDEO3    VLC_FOURCC('I','V','3','1')
+#define VLC_CODEC_HUFFYUV   VLC_FOURCC('H','F','Y','U')
+#define VLC_CODEC_FFVHUFF   VLC_FOURCC('F','F','V','H')
+#define VLC_CODEC_ASV1      VLC_FOURCC('A','S','V','1')
+#define VLC_CODEC_ASV2      VLC_FOURCC('A','S','V','2')
+#define VLC_CODEC_FFV1      VLC_FOURCC('F','F','V','1')
+#define VLC_CODEC_VCR1      VLC_FOURCC('V','C','R','1')
+#define VLC_CODEC_CLJR      VLC_FOURCC('C','L','J','R')
+#define VLC_CODEC_RPZA      VLC_FOURCC('r','p','z','a')
+#define VLC_CODEC_SMC       VLC_FOURCC('s','m','c',' ')
+#define VLC_CODEC_CINEPAK   VLC_FOURCC('C','V','I','D')
+#define VLC_CODEC_TSCC      VLC_FOURCC('T','S','C','C')
+#define VLC_CODEC_CSCD      VLC_FOURCC('C','S','C','D')
+#define VLC_CODEC_ZMBV      VLC_FOURCC('Z','M','B','V')
+#define VLC_CODEC_VMNC      VLC_FOURCC('V','M','n','c')
+#define VLC_CODEC_FRAPS     VLC_FOURCC('F','P','S','1')
+#define VLC_CODEC_TRUEMOTION1 VLC_FOURCC('D','U','C','K')
+#define VLC_CODEC_TRUEMOTION2 VLC_FOURCC('T','M','2','0')
+#define VLC_CODEC_QTRLE     VLC_FOURCC('r','l','e',' ')
+#define VLC_CODEC_QDRAW     VLC_FOURCC('q','d','r','w')
+#define VLC_CODEC_QPEG      VLC_FOURCC('Q','P','E','G')
+#define VLC_CODEC_ULTI      VLC_FOURCC('U','L','T','I')
+#define VLC_CODEC_VIXL      VLC_FOURCC('V','I','X','L')
+#define VLC_CODEC_LOCO      VLC_FOURCC('L','O','C','O')
+#define VLC_CODEC_WNV1      VLC_FOURCC('W','N','V','1')
+#define VLC_CODEC_AASC      VLC_FOURCC('A','A','S','C')
+#define VLC_CODEC_INDEO2    VLC_FOURCC('I','V','2','0')
+#define VLC_CODEC_FLASHSV   VLC_FOURCC('F','S','V','1')
+#define VLC_CODEC_KMVC      VLC_FOURCC('K','M','V','C')
+#define VLC_CODEC_SMACKVIDEO VLC_FOURCC('S','M','K','2')
+#define VLC_CODEC_DNXHD     VLC_FOURCC('A','V','d','n')
+#define VLC_CODEC_8BPS      VLC_FOURCC('8','B','P','S')
+#define VLC_CODEC_MIMIC     VLC_FOURCC('M','L','2','O')
+#define VLC_CODEC_INTERPLAY VLC_FOURCC('i','m','v','e')
+#define VLC_CODEC_IDCIN     VLC_FOURCC('I','D','C','I')
+#define VLC_CODEC_4XM       VLC_FOURCC('4','X','M','V')
+#define VLC_CODEC_ROQ       VLC_FOURCC('R','o','Q','v')
+#define VLC_CODEC_MDEC      VLC_FOURCC('M','D','E','C')
+#define VLC_CODEC_VMDVIDEO  VLC_FOURCC('V','M','D','V')
+#define VLC_CODEC_CDG       VLC_FOURCC('C','D','G',' ')
+
+/* Planar YUV 4:2:0 Y:V:U */
+#define VLC_CODEC_YV12      VLC_FOURCC('Y','V','1','2')
+/* Planar YUV 4:1:0 Y:U:V */
+#define VLC_CODEC_I410      VLC_FOURCC('I','4','1','0')
+/* Planar YUV 4:1:1 Y:U:V */
+#define VLC_CODEC_I411      VLC_FOURCC('I','4','1','1')
+/* Planar YUV 4:2:0 Y:U:V */
+#define VLC_CODEC_I420      VLC_FOURCC('I','4','2','0')
+/* Planar YUV 4:2:2 Y:U:V */
+#define VLC_CODEC_I422      VLC_FOURCC('I','4','2','2')
+/* Planar YUV 4:4:0 Y:U:V */
+#define VLC_CODEC_I440      VLC_FOURCC('I','4','4','0')
+/* Planar YUV 4:4:4 Y:U:V */
+#define VLC_CODEC_I444      VLC_FOURCC('I','4','4','4')
+/* Planar YUV 4:2:0 Y:U:V full scale */
+#define VLC_CODEC_J420      VLC_FOURCC('J','4','2','0')
+/* Planar YUV 4:2:2 Y:U:V full scale */
+#define VLC_CODEC_J422      VLC_FOURCC('J','4','2','2')
+/* Planar YUV 4:4:0 Y:U:V full scale */
+#define VLC_CODEC_J440      VLC_FOURCC('J','4','4','0')
+/* Planar YUV 4:4:4 Y:U:V full scale */
+#define VLC_CODEC_J444      VLC_FOURCC('J','4','4','4')
+/* Palettized YUV with palette element Y:U:V:A */
+#define VLC_CODEC_YUVP      VLC_FOURCC('Y','U','V','P')
+/* Planar YUV 4:4:4 Y:U:V:A */
+#define VLC_CODEC_YUVA      VLC_FOURCC('Y','U','V','A')
+/* Palettized RGB with palette element R:G:B */
+#define VLC_CODEC_RGBP      VLC_FOURCC('R','G','B','P')
+/* 8 bits RGB */
+#define VLC_CODEC_RGB8      VLC_FOURCC('R','G','B','2')
+/* 15 bits RGB stored on 16 bits */
+#define VLC_CODEC_RGB15     VLC_FOURCC('R','V','1','5')
+/* 16 bits RGB store on a 16 bits */
+#define VLC_CODEC_RGB16     VLC_FOURCC('R','V','1','6')
+/* 24 bits RGB */
+#define VLC_CODEC_RGB24     VLC_FOURCC('R','V','2','4')
+/* 32 bits RGB */
+#define VLC_CODEC_RGB32     VLC_FOURCC('R','V','3','2')
+/* 32 bits VLC RGBA */
+#define VLC_CODEC_RGBA      VLC_FOURCC('R','G','B','A')
+/* 8 bits grey */
+#define VLC_CODEC_GREY      VLC_FOURCC('G','R','E','Y')
+/* Packed YUV 4:2:2, U:Y:V:Y */
+#define VLC_CODEC_UYVY      VLC_FOURCC('U','Y','V','Y')
+/* Packed YUV 4:2:2, V:Y:U:Y */
+#define VLC_CODEC_VYUY      VLC_FOURCC('V','Y','U','Y')
+/* Packed YUV 4:2:2, Y:U:Y:V */
+#define VLC_CODEC_YUYV      VLC_FOURCC('Y','U','Y','2')
+/* Packed YUV 4:2:2, Y:V:Y:U */
+#define VLC_CODEC_YVYU      VLC_FOURCC('Y','V','Y','U')
+/* Packed YUV 2:1:1, Y:U:Y:V */
+#define VLC_CODEC_Y211      VLC_FOURCC('Y','2','1','1')
+/* Planar Y, packed UV, from Matrox */
+#define VLC_CODEC_YMGA      VLC_FOURCC('Y','M','G','A')
+/* Packed YUV 4:2:2, U:Y:V:Y, reverted */
+#define VLC_CODEC_CYUV      VLC_FOURCC('c','y','u','v')
+/* 10-bit 4:2:2 Component YCbCr */
+#define VLC_CODEC_V210      VLC_FOURCC('v','2','1','0')
+
+/* Image codec (video) */
+#define VLC_CODEC_PNG       VLC_FOURCC('p','n','g',' ')
+#define VLC_CODEC_PPM       VLC_FOURCC('p','p','m',' ')
+#define VLC_CODEC_PGM       VLC_FOURCC('p','g','m',' ')
+#define VLC_CODEC_PGMYUV    VLC_FOURCC('p','g','m','y')
+#define VLC_CODEC_PAM       VLC_FOURCC('p','a','m',' ')
+#define VLC_CODEC_JPEG      VLC_FOURCC('j','p','e','g')
+#define VLC_CODEC_JPEGLS    VLC_FOURCC('M','J','L','S')
+#define VLC_CODEC_BMP       VLC_FOURCC('b','m','p',' ')
+#define VLC_CODEC_TIFF      VLC_FOURCC('t','i','f','f')
+#define VLC_CODEC_GIF       VLC_FOURCC('g','i','f',' ')
+#define VLC_CODEC_TARGA     VLC_FOURCC('t','g','a',' ')
+#define VLC_CODEC_SGI       VLC_FOURCC('s','g','i',' ')
+#define VLC_CODEC_PNM       VLC_FOURCC('p','n','m',' ')
+#define VLC_CODEC_PCX       VLC_FOURCC('p','c','x',' ')
+
+
+/* Audio codec */
+#define VLC_CODEC_MPGA      VLC_FOURCC('m','p','g','a')
+#define VLC_CODEC_MP4A      VLC_FOURCC('m','p','4','a')
+#define VLC_CODEC_A52       VLC_FOURCC('a','5','2',' ')
+#define VLC_CODEC_EAC3      VLC_FOURCC('e','a','c','3')
+#define VLC_CODEC_DTS       VLC_FOURCC('d','t','s',' ')
+#define VLC_CODEC_WMA1      VLC_FOURCC('W','M','A','1')
+#define VLC_CODEC_WMA2      VLC_FOURCC('W','M','A','2')
+#define VLC_CODEC_WMAP      VLC_FOURCC('W','M','A','P')
+#define VLC_CODEC_WMAL      VLC_FOURCC('W','M','A','L')
+#define VLC_CODEC_WMAS      VLC_FOURCC('W','M','A','S')
+#define VLC_CODEC_FLAC      VLC_FOURCC('f','l','a','c')
+#define VLC_CODEC_MLP       VLC_FOURCC('m','l','p',' ')
+#define VLC_CODEC_TRUEHD    VLC_FOURCC('t','r','h','d')
+#define VLC_CODEC_DVAUDIO   VLC_FOURCC('d','v','a','u')
+#define VLC_CODEC_SPEEX     VLC_FOURCC('s','p','x',' ')
+#define VLC_CODEC_VORBIS    VLC_FOURCC('v','o','r','b')
+#define VLC_CODEC_MACE3     VLC_FOURCC('M','A','C','3')
+#define VLC_CODEC_MACE6     VLC_FOURCC('M','A','C','6')
+#define VLC_CODEC_MUSEPACK7 VLC_FOURCC('M','P','C',' ')
+#define VLC_CODEC_MUSEPACK8 VLC_FOURCC('M','P','C','K')
+#define VLC_CODEC_RA_144    VLC_FOURCC('1','4','_','4')
+#define VLC_CODEC_RA_288    VLC_FOURCC('2','8','_','8')
+#define VLC_CODEC_ADPCM_4XM VLC_FOURCC('4','x','m','a')
+#define VLC_CODEC_ADPCM_EA  VLC_FOURCC('A','D','E','A')
+#define VLC_CODEC_INTERPLAY_DPCM VLC_FOURCC('i','d','p','c')
+#define VLC_CODEC_ROQ_DPCM  VLC_FOURCC('R','o','Q','a')
+#define VLC_CODEC_DSICINAUDIO VLC_FOURCC('D','C','I','A')
+#define VLC_CODEC_ADPCM_XA  VLC_FOURCC('x','a',' ',' ')
+#define VLC_CODEC_ADPCM_ADX VLC_FOURCC('a','d','x',' ')
+#define VLC_CODEC_ADPCM_IMA_WS VLC_FOURCC('A','I','W','S')
+#define VLC_CODEC_VMDAUDIO  VLC_FOURCC('v','m','d','a')
+#define VLC_CODEC_ADPCM_G726 VLC_FOURCC('g','7','2','6')
+#define VLC_CODEC_AMR_NB    VLC_FOURCC('s','a','m','r')
+#define VLC_CODEC_AMR_WB    VLC_FOURCC('s','a','w','b')
+#define VLC_CODEC_ALAC      VLC_FOURCC('a','l','a','c')
+#define VLC_CODEC_QDM2      VLC_FOURCC('Q','D','M','2')
+#define VLC_CODEC_COOK      VLC_FOURCC('c','o','o','k')
+#define VLC_CODEC_TTA       VLC_FOURCC('T','T','A','1')
+#define VLC_CODEC_SHORTEN   VLC_FOURCC('s','h','n',' ')
+#define VLC_CODEC_WAVPACK   VLC_FOURCC('W','V','P','K')
+#define VLC_CODEC_GSM       VLC_FOURCC('g','s','m',' ')
+#define VLC_CODEC_GSM_MS    VLC_FOURCC('a','g','s','m')
+#define VLC_CODEC_ATRAC3    VLC_FOURCC('a','t','r','c')
+#define VLC_CODEC_SONIC     VLC_FOURCC('S','O','N','C')
+#define VLC_CODEC_IMC       VLC_FOURCC(0x1,0x4,0x0,0x0)
+#define VLC_CODEC_TRUESPEECH VLC_FOURCC(0x22,0x0,0x0,0x0)
+#define VLC_CODEC_NELLYMOSER VLC_FOURCC('N','E','L','L')
+#define VLC_CODEC_APE       VLC_FOURCC('A','P','E',' ')
+#define VLC_CODEC_QCELP     VLC_FOURCC('Q','c','l','p')
+#define VLC_CODEC_302M      VLC_FOURCC('3','0','2','m')
+#define VLC_CODEC_DVD_LPCM  VLC_FOURCC('l','p','c','m')
+#define VLC_CODEC_BD_LPCM   VLC_FOURCC('b','p','c','m')
+#define VLC_CODEC_SDDS      VLC_FOURCC('s','d','d','s')
+#define VLC_CODEC_MIDI      VLC_FOURCC('M','I','D','I')
+#define VLC_CODEC_S8        VLC_FOURCC('s','8',' ',' ')
+#define VLC_CODEC_U8        VLC_FOURCC('u','8',' ',' ')
+#define VLC_CODEC_S16L      VLC_FOURCC('s','1','6','l')
+#define VLC_CODEC_S16B      VLC_FOURCC('s','1','6','b')
+#define VLC_CODEC_U16L      VLC_FOURCC('u','1','6','l')
+#define VLC_CODEC_U16B      VLC_FOURCC('u','1','6','b')
+#define VLC_CODEC_S24L      VLC_FOURCC('s','2','4','l')
+#define VLC_CODEC_S24B      VLC_FOURCC('s','2','4','b')
+#define VLC_CODEC_U24L      VLC_FOURCC('u','2','4','l')
+#define VLC_CODEC_U24B      VLC_FOURCC('u','2','4','b')
+#define VLC_CODEC_S32L      VLC_FOURCC('s','3','2','l')
+#define VLC_CODEC_S32B      VLC_FOURCC('s','3','2','b')
+#define VLC_CODEC_U32L      VLC_FOURCC('u','3','2','l')
+#define VLC_CODEC_U32B      VLC_FOURCC('u','3','2','b')
+#define VLC_CODEC_ALAW      VLC_FOURCC('a','l','a','w')
+#define VLC_CODEC_MULAW     VLC_FOURCC('m','l','a','w')
+#define VLC_CODEC_S24DAUD   VLC_FOURCC('d','a','u','d')
+#define VLC_CODEC_FI32      VLC_FOURCC('f','i','3','2')
+#define VLC_CODEC_FL32      VLC_FOURCC('f','l','3','2')
+#define VLC_CODEC_FL64      VLC_FOURCC('f','l','6','4')
+
+/* Subtitle */
+#define VLC_CODEC_SPU       VLC_FOURCC('s','p','u',' ')
+#define VLC_CODEC_DVBS      VLC_FOURCC('d','v','b','s')
+#define VLC_CODEC_SUBT      VLC_FOURCC('s','u','b','t')
+#define VLC_CODEC_XSUB      VLC_FOURCC('X','S','U','B')
+#define VLC_CODEC_SSA       VLC_FOURCC('s','s','a',' ')
+#define VLC_CODEC_TEXT      VLC_FOURCC('T','E','X','T')
+#define VLC_CODEC_TELETEXT  VLC_FOURCC('t','e','l','x')
+#define VLC_CODEC_KATE      VLC_FOURCC('k','a','t','e')
+#define VLC_CODEC_CMML      VLC_FOURCC('c','m','m','l')
+#define VLC_CODEC_ITU_T140  VLC_FOURCC('t','1','4','0')
+#define VLC_CODEC_USF       VLC_FOURCC('u','s','f',' ')
+#define VLC_CODEC_OGT       VLC_FOURCC('o','g','t',' ')
+#define VLC_CODEC_CVD       VLC_FOURCC('c','v','d',' ')
+
+
+/* Special endian dependant values
+ * The suffic N means Native
+ * The suffix I means Inverted (ie non native) */
+#ifdef WORDS_BIGENDIAN
+#   define VLC_CODEC_S16N VLC_CODEC_S16B
+#   define VLC_CODEC_U16N VLC_CODEC_U16B
+#   define VLC_CODEC_S24N VLC_CODEC_S24B
+#   define VLC_CODEC_S32N VLC_CODEC_S32B
+
+#   define VLC_CODEC_S16I VLC_CODEC_S16L
+#   define VLC_CODEC_U16I VLC_CODEC_U16L
+#   define VLC_CODEC_S24I VLC_CODEC_S24L
+#   define VLC_CODEC_S32I VLC_CODEC_S32L
+#else
+#   define VLC_CODEC_S16N VLC_CODEC_S16L
+#   define VLC_CODEC_U16N VLC_CODEC_U16L
+#   define VLC_CODEC_S24N VLC_CODEC_S24L
+#   define VLC_CODEC_S32N VLC_CODEC_S32L
+
+#   define VLC_CODEC_S16I VLC_CODEC_S16B
+#   define VLC_CODEC_U16I VLC_CODEC_U16B
+#   define VLC_CODEC_S24I VLC_CODEC_S24B
+#   define VLC_CODEC_S32I VLC_CODEC_S32B
+#endif
+
+/* Non official codecs, used to force a profile in an encoder */
+/* MPEG-1 video */
+#define VLC_CODEC_MP1V      VLC_FOURCC('m','p','1','v')
+/* MPEG-2 video */
+#define VLC_CODEC_MP2V      VLC_FOURCC('m','p','2','v')
+/* MPEG-I/II layer 3 audio */
+#define VLC_CODEC_MP3       VLC_FOURCC('m','p','3',' ')
+
+/**
+ * It returns the codec associated to a fourcc within a ES category.
+ *
+ * If not found, it will return the given fourcc.
+ * If found, it will allways be one of the VLC_CODEC_ defined above.
+ *
+ * You may use UNKNOWN_ES for the ES category if you don't have the information.
+ */
+VLC_EXPORT( vlc_fourcc_t, vlc_fourcc_GetCodec, ( int i_cat, vlc_fourcc_t i_fourcc ) );
+
+/**
+ * It returns the codec associated to a fourcc store in a zero terminated
+ * string.
+ *
+ * If the string is NULL or does not have exactly 4 charateres, it will
+ * return 0, otherwise it behaves like vlc_fourcc_GetCodec.
+ *
+ * Provided for convenience.
+ */
+VLC_EXPORT( vlc_fourcc_t, vlc_fourcc_GetCodecFromString, ( int i_cat, const char * ) );
+
+/**
+ * It convert the gives fourcc to an audio codec when possible.
+ *
+ * The fourcc converted are aflt, araw/pcm , twos, sowt. When an incompatible i_bits
+ * is detected, 0 is returned.
+ * The other fourcc goes through vlc_fourcc_GetCodec and i_bits is not checked.
+ */
+VLC_EXPORT( vlc_fourcc_t, vlc_fourcc_GetCodecAudio, ( vlc_fourcc_t i_fourcc, int i_bits ) );
+
+/**
+ * It returns the description of the given fourcc or NULL if not found.
+ *
+ * You may use UNKNOWN_ES for the ES category if you don't have the information.
+ */
+VLC_EXPORT( const char *, vlc_fourcc_GetDescription, ( int i_cat, vlc_fourcc_t i_fourcc ) );
+
+#endif /* _VLC_FOURCC_H */
+
index 06f6fc2bf33010d1c238bf601cb5171e897766f5..561a75396481dfedb7c86ca6564c6399105c05fb 100644 (file)
@@ -383,8 +383,11 @@ typedef enum input_event_type_e
     /* "rate" has changed */
     INPUT_EVENT_RATE,
 
-    /* At least one of "position" or "time" or "length" has changed */
-    INPUT_EVENT_TIMES,
+    /* At least one of "position" or "time" */
+    INPUT_EVENT_POSITION,
+
+    /* "length" has changed */
+    INPUT_EVENT_LENGTH,
 
     /* A title has been added or removed or selected.
      * It imply that chapter has changed (not chapter event is sent) */
index 450a6f3213cdc007a04675ad06f84a313460601d..f78fd3a60dc1002da48d20b4b888716634e2dbcb 100644 (file)
@@ -108,6 +108,8 @@ static const struct key_descriptor_s vlc_modifiers[] =
     { "Meta", KEY_MODIFIER_META },
     { "Command", KEY_MODIFIER_COMMAND }
 };
+enum { vlc_num_modifiers=sizeof(vlc_modifiers)
+                        /sizeof(struct key_descriptor_s) };
 
 static const struct key_descriptor_s vlc_keys[] =
 {
@@ -221,11 +223,12 @@ static const struct key_descriptor_s vlc_keys[] =
     { "Media Stop", KEY_MEDIA_STOP },
     { "Media Play Pause", KEY_MEDIA_PLAY_PAUSE }
 };
+enum { vlc_num_keys=sizeof(vlc_keys)/sizeof(struct key_descriptor_s) };
 
 static inline const char *KeyToString( int i_key )
 {
-    unsigned int i = 0;
-    for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++ )
+    size_t i;
+    for ( i = 0; i < vlc_num_keys; ++i )
     {
         if ( vlc_keys[i].i_key_code == i_key )
         {
@@ -237,8 +240,8 @@ static inline const char *KeyToString( int i_key )
 
 static inline int StringToKey( char *psz_key )
 {
-    unsigned int i = 0;
-    for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++ )
+    size_t i;
+    for ( i = 0; i < vlc_num_keys; ++i )
     {
         if ( !strcmp( vlc_keys[i].psz_key_string, psz_key ))
         {
index df855f662e4fb643c955b753099255a3a68c609b..0aff210871579b4b731c49bac1a387e16ece3374 100644 (file)
@@ -265,8 +265,25 @@ struct text_style_t
 #define STYLE_UNDERLINE   32
 #define STYLE_STRIKEOUT   64
 
-static const text_style_t default_text_style = { NULL, 22, 0xffffff, 0xff, STYLE_OUTLINE,
-                0x000000, 0xff, 0x000000, 0xff, 0xffffff, 0x80, 0xffffff, 0xff, 1, 0, -1 };
+/**
+ * Create a default text style
+ */
+VLC_EXPORT( text_style_t *, text_style_New, ( void ) );
+
+/**
+ * Copy a text style into another
+ */
+VLC_EXPORT( text_style_t *, text_style_Copy, ( text_style_t *, const text_style_t * ) );
+
+/**
+ * Duplicate a text style
+ */
+VLC_EXPORT( text_style_t *, text_style_Duplicate, ( const text_style_t * ) );
+
+/**
+ * Delete a text style created by text_style_New or text_style_Duplicate
+ */
+VLC_EXPORT( void, text_style_Delete, ( text_style_t * ) );
 
 /**
  * OSD menu button states
@@ -590,8 +607,8 @@ static inline void osd_SetMenuUpdate( osd_menu_t *p_osd, bool b_value )
  * object. The types are declared in the include file include/vlc_osd.h
  * @see vlc_osd.h
  */
-VLC_EXPORT( int, osd_ShowTextRelative, ( spu_t *, int, const char *, text_style_t *, int, int, int, mtime_t ) );
-VLC_EXPORT( int, osd_ShowTextAbsolute, ( spu_t *, int, const char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
+VLC_EXPORT( int, osd_ShowTextRelative, ( spu_t *, int, const char *, const text_style_t *, int, int, int, mtime_t ) );
+VLC_EXPORT( int, osd_ShowTextAbsolute, ( spu_t *, int, const char *, const text_style_t *, int, int, int, mtime_t, mtime_t ) );
 VLC_EXPORT( void, osd_Message, ( spu_t *, int, char *, ... ) LIBVLC_FORMAT( 3, 4 ) );
 
 /**
@@ -611,34 +628,9 @@ VLC_EXPORT( int, osd_Icon, ( vlc_object_t *, spu_t *, int, int, int, int, int, s
  * Vout text and widget overlays
  **********************************************************************/
 
-/**
- * Show text on the video for some time
- * \param p_vout pointer to the vout the text is to be showed on
- * \param i_channel Subpicture channel
- * \param psz_string The text to be shown
- * \param p_style Pointer to a struct with text style info
- * \param i_flags flags for alignment and such
- * \param i_hmargin horizontal margin in pixels
- * \param i_vmargin vertical margin in pixels
- * \param i_duration Amount of time the text is to be shown.
- */
-VLC_EXPORT( int, vout_ShowTextRelative, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t ) );
+VLC_EXPORT( int, vout_ShowTextRelative, ( vout_thread_t *, int, char *, const text_style_t *, int, int, int, mtime_t ) );
 
-/**
- * Show text on the video from a given start date to a given end date
- * \param p_vout pointer to the vout the text is to be showed on
- * \param i_channel Subpicture channel
- * \param psz_string The text to be shown
- * \param p_style Pointer to a struct with text style info
- * \param i_flags flags for alignment and such
- * \param i_hmargin horizontal margin in pixels
- * \param i_vmargin vertical margin in pixels
- * \param i_start the time when this string is to appear on the video
- * \param i_stop the time when this string should stop to be displayed
- *               if this is 0 the string will be shown untill the next string
- *               is about to be shown
- */
-VLC_EXPORT( int, vout_ShowTextAbsolute, ( vout_thread_t *, int, const char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
+VLC_EXPORT( int, vout_ShowTextAbsolute, ( vout_thread_t *, int, const char *, const text_style_t *, int, int, int, mtime_t, mtime_t ) );
 
 /**
  * Write an informative message at the default location,
diff --git a/include/vlc_picture.h b/include/vlc_picture.h
new file mode 100644 (file)
index 0000000..a1f4b9f
--- /dev/null
@@ -0,0 +1,309 @@
+/*****************************************************************************
+ * vlc_picture.h: picture definitions
+ *****************************************************************************
+ * Copyright (C) 1999 - 2009 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Vincent Seguin <seguin@via.ecp.fr>
+ *          Samuel Hocevar <sam@via.ecp.fr>
+ *          Olivier Aubert <oaubert 47 videolan d07 org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VLC_PICTURE_H
+#define VLC_PICTURE_H 1
+
+/**
+ * \file
+ * This file defines picture structures and functions in vlc
+ */
+
+#include <vlc_es.h>
+
+/** Description of a planar graphic field */
+typedef struct plane_t
+{
+    uint8_t *p_pixels;                        /**< Start of the plane's data */
+
+    /* Variables used for fast memcpy operations */
+    int i_lines;           /**< Number of lines, including margins */
+    int i_pitch;           /**< Number of bytes in a line, including margins */
+
+    /** Size of a macropixel, defaults to 1 */
+    int i_pixel_pitch;
+
+    /* Variables used for pictures with margins */
+    int i_visible_lines;            /**< How many visible lines are there ? */
+    int i_visible_pitch;            /**< How many visible pixels are there ? */
+
+} plane_t;
+
+/**
+ * A private definition to help overloading picture release
+ */
+typedef struct picture_release_sys_t picture_release_sys_t;
+
+/**
+ * Video picture
+ *
+ * Any picture destined to be displayed by a video output thread should be
+ * stored in this structure from it's creation to it's effective display.
+ * Picture type and flags should only be modified by the output thread. Note
+ * that an empty picture MUST have its flags set to 0.
+ */
+struct picture_t
+{
+    /**
+     * The properties of the picture
+     */
+    video_frame_format_t format;
+
+    /** Picture data - data can always be freely modified, but p_data may
+     * NEVER be modified. A direct buffer can be handled as the plugin
+     * wishes, it can even swap p_pixels buffers. */
+    uint8_t        *p_data;
+    void           *p_data_orig;                /**< pointer before memalign */
+    plane_t         p[ VOUT_MAX_PLANES ];     /**< description of the planes */
+    int             i_planes;                /**< number of allocated planes */
+
+    /** \name Type and flags
+     * Should NOT be modified except by the vout thread
+     * @{*/
+    int             i_status;                             /**< picture flags */
+    int             i_type;                /**< is picture a direct buffer ? */
+    bool            b_slow;                 /**< is picture in slow memory ? */
+    /**@}*/
+
+    /** \name Picture management properties
+     * These properties can be modified using the video output thread API,
+     * but should never be written directly */
+    /**@{*/
+    unsigned        i_refcount;                  /**< link reference counter */
+    mtime_t         date;                                  /**< display date */
+    bool            b_force;
+    /**@}*/
+
+    /** \name Picture dynamic properties
+     * Those properties can be changed by the decoder
+     * @{
+     */
+    bool            b_progressive;          /**< is it a progressive frame ? */
+    unsigned int    i_nb_fields;                  /**< # of displayed fields */
+    bool            b_top_field_first;             /**< which field is first */
+    uint8_t        *p_q;                           /**< quantification table */
+    int             i_qstride;                    /**< quantification stride */
+    int             i_qtype;                       /**< quantification style */
+    /**@}*/
+
+    /* Some vouts require the picture to be locked before it can be modified */
+    int (* pf_lock) ( vout_thread_t *, picture_t * );
+    int (* pf_unlock) ( vout_thread_t *, picture_t * );
+
+    /** Private data - the video output plugin might want to put stuff here to
+     * keep track of the picture */
+    picture_sys_t * p_sys;
+
+    /** This way the picture_Release can be overloaded */
+    void (*pf_release)( picture_t * );
+    picture_release_sys_t *p_release_sys;
+
+    /** Next picture in a FIFO a pictures */
+    struct picture_t *p_next;
+};
+
+/**
+ * This function will create a new picture.
+ * The picture created will implement a default release management compatible
+ * with picture_Hold and picture_Release. This default management will release
+ * p_sys, p_q, p_data_orig fields if non NULL.
+ */
+VLC_EXPORT( picture_t *, picture_New, ( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) );
+
+/**
+ * This function will force the destruction a picture.
+ * The value of the picture reference count should be 0 before entering this
+ * function.
+ * Unless used for reimplementing pf_release, you should not use this
+ * function but picture_Release.
+ */
+VLC_EXPORT( void, picture_Delete, ( picture_t * ) );
+
+/**
+ * This function will increase the picture reference count.
+ * It will not have any effect on picture obtained from vout
+ */
+static inline void picture_Hold( picture_t *p_picture )
+{
+    if( p_picture->pf_release )
+        p_picture->i_refcount++;
+}
+/**
+ * This function will release a picture.
+ * It will not have any effect on picture obtained from vout
+ */
+static inline void picture_Release( picture_t *p_picture )
+{
+    /* FIXME why do we let pf_release handle the i_refcount ? */
+    if( p_picture->pf_release )
+        p_picture->pf_release( p_picture );
+}
+
+/**
+ * This function will return true if you are not the only owner of the
+ * picture.
+ *
+ * It is only valid if it is created using picture_New.
+ */
+static inline bool picture_IsReferenced( picture_t *p_picture )
+{
+    return p_picture->i_refcount > 1;
+}
+
+/**
+ * Cleanup quantization matrix data and set to 0
+ */
+static inline void picture_CleanupQuant( picture_t *p_pic )
+{
+    free( p_pic->p_q );
+    p_pic->p_q = NULL;
+    p_pic->i_qstride = 0;
+    p_pic->i_qtype = 0;
+}
+
+/**
+ * This function will copy all picture dynamic properties.
+ */
+static inline void picture_CopyProperties( picture_t *p_dst, const picture_t *p_src )
+{
+    p_dst->date = p_src->date;
+    p_dst->b_force = p_src->b_force;
+
+    p_dst->b_progressive = p_src->b_progressive;
+    p_dst->i_nb_fields = p_src->i_nb_fields;
+    p_dst->b_top_field_first = p_src->b_top_field_first;
+
+    /* FIXME: copy ->p_q and ->p_qstride */
+}
+
+/**
+ * This function will copy the picture pixels.
+ * You can safely copy between pictures that do not have the same size,
+ * only the compatible(smaller) part will be copied.
+ */
+VLC_EXPORT( void, picture_CopyPixels, ( picture_t *p_dst, const picture_t *p_src ) );
+VLC_EXPORT( void, plane_CopyPixels, ( plane_t *p_dst, const plane_t *p_src ) );
+
+/**
+ * This function will copy both picture dynamic properties and pixels.
+ * You have to notice that sometime a simple picture_Hold may do what
+ * you want without the copy overhead.
+ * Provided for convenience.
+ *
+ * \param p_dst pointer to the destination picture.
+ * \param p_src pointer to the source picture.
+ */
+static inline void picture_Copy( picture_t *p_dst, const picture_t *p_src )
+{
+    picture_CopyPixels( p_dst, p_src );
+    picture_CopyProperties( p_dst, p_src );
+}
+
+/**
+ * This function will export a picture to an encoded bitstream.
+ *
+ * pp_image will contain the encoded bitstream in psz_format format.
+ *
+ * p_fmt can be NULL otherwise it will be set with the format used for the
+ * picture before encoding.
+ *
+ * i_override_width/height allow to override the width and/or the height of the
+ * picture to be encoded. If at most one of them is > 0 then the picture aspect
+ * ratio will be kept.
+ */
+VLC_EXPORT( int, picture_Export, ( vlc_object_t *p_obj, block_t **pp_image, video_format_t *p_fmt, picture_t *p_picture, vlc_fourcc_t i_format, int i_override_width, int i_override_height ) );
+
+/**
+ * This function will setup all fields of a picture_t without allocating any
+ * memory.
+ * XXX The memory must already be initialized.
+ * It does not need to be released.
+ *
+ * It will return VLC_EGENERIC if the core does not understand the requested
+ * format.
+ *
+ * It can be usefull to get the properties of planes.
+ */
+VLC_EXPORT( int, picture_Setup, ( picture_t *, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) );
+
+/*****************************************************************************
+ * Flags used to describe the status of a picture
+ *****************************************************************************/
+
+/* Picture type
+ * FIXME are the values meaningfull ? */
+enum
+{
+    EMPTY_PICTURE = 0,                             /* empty buffer */
+    MEMORY_PICTURE = 100,                 /* heap-allocated buffer */
+    DIRECT_PICTURE = 200,                         /* direct buffer */
+};
+
+/* Picture status */
+enum
+{
+    FREE_PICTURE,                              /* free and not allocated */
+    RESERVED_PICTURE,                          /* allocated and reserved */
+    READY_PICTURE,                                  /* ready for display */
+    DISPLAYED_PICTURE,                   /* been displayed but is linked */
+    DESTROYED_PICTURE,                     /* allocated but no more used */
+};
+
+/* Quantification type */
+enum
+{
+    QTYPE_NONE,
+
+    QTYPE_MPEG1,
+    QTYPE_MPEG2,
+    QTYPE_H264,
+};
+
+/*****************************************************************************
+ * Shortcuts to access image components
+ *****************************************************************************/
+
+/* Plane indices */
+enum
+{
+    Y_PLANE = 0,
+    U_PLANE = 1,
+    V_PLANE = 2,
+    A_PLANE = 3,
+};
+
+/* Shortcuts */
+#define Y_PIXELS     p[Y_PLANE].p_pixels
+#define Y_PITCH      p[Y_PLANE].i_pitch
+#define U_PIXELS     p[U_PLANE].p_pixels
+#define U_PITCH      p[U_PLANE].i_pitch
+#define V_PIXELS     p[V_PLANE].p_pixels
+#define V_PITCH      p[V_PLANE].i_pitch
+#define A_PIXELS     p[A_PLANE].p_pixels
+#define A_PITCH      p[A_PLANE].i_pitch
+
+/**@}*/
+
+#endif /* VLC_PICTURE_H */
index fc2b8089865178e0d2d7f31fdc1afa5b6c72324b..d8de71caa0d64265d1f7919abd53da825e831418 100644 (file)
@@ -111,7 +111,7 @@ TYPEDEF_ARRAY(playlist_item_t*, playlist_item_array_t);
  * Generally speaking, playlist_NodeAddInput should not be used in newer code, it
  * will maybe become useful again when we merge VLM;
  *
- * To delete an item, use playlist_DeleteFromInput( input_id ) which will
+ * To delete an item, use playlist_DeleteFromInput( p_item ) which will
  * remove all occurrences of the input in both trees
  *
  *
@@ -322,7 +322,7 @@ VLC_EXPORT( bool, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const char
  ********************************************************/
 
 /*************************** Item deletion **************************/
-VLC_EXPORT( int,  playlist_DeleteFromInput, ( playlist_t *, int, bool ) );
+VLC_EXPORT( int,  playlist_DeleteFromInput, ( playlist_t *, input_item_t *, bool ) );
 
 /******************** Item addition ********************/
 VLC_EXPORT( int,  playlist_Add,    ( playlist_t *, const char *, const char *, int, int, bool, bool ) );
@@ -333,7 +333,6 @@ VLC_EXPORT( int, playlist_BothAddInput, ( playlist_t *, input_item_t *,playlist_
 /********************************** Item search *************************/
 VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int ) );
 VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInput, (playlist_t *,input_item_t * ) );
-VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInputId, (playlist_t *, int, playlist_item_t *) );
 
 VLC_EXPORT( int, playlist_LiveSearchUpdate, (playlist_t *, playlist_item_t *, const char *) );
 
diff --git a/include/vlc_subpicture.h b/include/vlc_subpicture.h
new file mode 100644 (file)
index 0000000..26f0cf6
--- /dev/null
@@ -0,0 +1,181 @@
+/*****************************************************************************
+ * vlc_subpicture.h: subpicture definitions
+ *****************************************************************************
+ * Copyright (C) 1999 - 2009 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Vincent Seguin <seguin@via.ecp.fr>
+ *          Samuel Hocevar <sam@via.ecp.fr>
+ *          Olivier Aubert <oaubert 47 videolan d07 org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VLC_SUBPICTURE_H
+#define VLC_SUBPICTURE_H 1
+
+/**
+ * \file
+ * This file defines subpicture structures and functions in vlc
+ */
+
+#include <vlc_picture.h>
+
+/**
+ * \defgroup subpicture Video Subpictures
+ * Subpictures are pictures that should be displayed on top of the video, like
+ * subtitles and OSD
+ * \ingroup video_output
+ * @{
+ */
+
+/**
+ * Video subtitle region spu core private
+ */
+typedef struct subpicture_region_private_t subpicture_region_private_t;
+
+/**
+ * Video subtitle region
+ *
+ * A subtitle region is defined by a picture (graphic) and its rendering
+ * coordinates.
+ * Subtitles contain a list of regions.
+ */
+struct subpicture_region_t
+{
+    video_format_t  fmt;                          /**< format of the picture */
+    picture_t       *p_picture;          /**< picture comprising this region */
+
+    int             i_x;                             /**< position of region */
+    int             i_y;                             /**< position of region */
+    int             i_align;                  /**< alignment within a region */
+    int             i_alpha;                               /**< transparency */
+
+    char            *psz_text;       /**< text string comprising this region */
+    char            *psz_html;       /**< HTML version of subtitle (NULL = use psz_text) */
+    text_style_t    *p_style;        /**< a description of the text style formatting */
+
+    subpicture_region_t *p_next;                /**< next region in the list */
+    subpicture_region_private_t *p_private;  /**< Private data for spu_t *only* */
+};
+
+/* Subpicture region position flags */
+#define SUBPICTURE_ALIGN_LEFT 0x1
+#define SUBPICTURE_ALIGN_RIGHT 0x2
+#define SUBPICTURE_ALIGN_TOP 0x4
+#define SUBPICTURE_ALIGN_BOTTOM 0x8
+#define SUBPICTURE_ALIGN_MASK ( SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT| \
+                                SUBPICTURE_ALIGN_TOP |SUBPICTURE_ALIGN_BOTTOM )
+
+/**
+ * This function will create a new subpicture region.
+ *
+ * You must use subpicture_region_Delete to destroy it.
+ */
+VLC_EXPORT( subpicture_region_t *, subpicture_region_New, ( const video_format_t *p_fmt ) );
+
+/**
+ * This function will destroy a subpicture region allocated by
+ * subpicture_region_New.
+ *
+ * You may give it NULL.
+ */
+VLC_EXPORT( void, subpicture_region_Delete, ( subpicture_region_t *p_region ) );
+
+/**
+ * This function will destroy a list of subpicture regions allocated by
+ * subpicture_region_New.
+ *
+ * Provided for convenience.
+ */
+VLC_EXPORT( void, subpicture_region_ChainDelete, ( subpicture_region_t *p_head ) );
+
+/**
+ * Video subtitle
+ *
+ * Any subtitle destined to be displayed by a video output thread should
+ * be stored in this structure from it's creation to it's effective display.
+ * Subtitle type and flags should only be modified by the output thread. Note
+ * that an empty subtitle MUST have its flags set to 0.
+ */
+struct subpicture_t
+{
+    /** \name Channel ID */
+    /**@{*/
+    int             i_channel;                    /**< subpicture channel ID */
+    /**@}*/
+
+    /** \name Type and flags
+       Should NOT be modified except by the vout thread */
+    /**@{*/
+    int64_t         i_order;                 /** an increasing unique number */
+    subpicture_t *  p_next;               /**< next subtitle to be displayed */
+    /**@}*/
+
+    /** \name Date properties */
+    /**@{*/
+    mtime_t         i_start;                  /**< beginning of display date */
+    mtime_t         i_stop;                         /**< end of display date */
+    bool            b_ephemer;    /**< If this flag is set to true the subtitle
+                                will be displayed untill the next one appear */
+    bool            b_fade;                               /**< enable fading */
+    /**@}*/
+
+    subpicture_region_t *p_region;  /**< region list composing this subtitle */
+
+    /** \name Display properties
+     * These properties are only indicative and may be
+     * changed by the video output thread, or simply ignored depending of the
+     * subtitle type. */
+    /**@{*/
+    int          i_original_picture_width;  /**< original width of the movie */
+    int          i_original_picture_height;/**< original height of the movie */
+    bool         b_subtitle;            /**< the picture is a movie subtitle */
+    bool         b_absolute;                       /**< position is absolute */
+    int          i_alpha;                                  /**< transparency */
+     /**@}*/
+
+    /** Pointer to function that renders this subtitle in a picture */
+    void ( *pf_render )  ( vout_thread_t *, picture_t *, const subpicture_t * );
+    /** Pointer to function that cleans up the private data of this subtitle */
+    void ( *pf_destroy ) ( subpicture_t * );
+
+    /** Pointer to functions for region management */
+    void (*pf_pre_render)    ( spu_t *, subpicture_t *, const video_format_t * );
+    void (*pf_update_regions)( spu_t *,
+                               subpicture_t *, const video_format_t *, mtime_t );
+
+    /** Private data - the subtitle plugin might want to put stuff here to
+     * keep track of the subpicture */
+    subpicture_sys_t *p_sys;                              /* subpicture data */
+};
+
+
+/**
+ * This function create a new empty subpicture.
+ *
+ * You must use subpicture_Delete to destroy it.
+ */
+VLC_EXPORT( subpicture_t *, subpicture_New, ( void ) );
+
+/**
+ * This function delete a subpicture created by subpicture_New.
+ * You may give it NULL.
+ */
+VLC_EXPORT( void,  subpicture_Delete, ( subpicture_t *p_subpic ) );
+
+/**@}*/
+
+#endif /* _VLC_VIDEO_H */
index 36b4b11de28c1f47e8d1572b75c0963321d0aa8c..4a706fcfd4172f5ea8183317685c033a76b228fe 100644 (file)
  * This file defines common video output structures and functions in vlc
  */
 
-#include <vlc_es.h>
+#include <vlc_picture.h>
 #include <vlc_filter.h>
-
-/** Description of a planar graphic field */
-typedef struct plane_t
-{
-    uint8_t *p_pixels;                        /**< Start of the plane's data */
-
-    /* Variables used for fast memcpy operations */
-    int i_lines;           /**< Number of lines, including margins */
-    int i_pitch;           /**< Number of bytes in a line, including margins */
-
-    /** Size of a macropixel, defaults to 1 */
-    int i_pixel_pitch;
-
-    /* Variables used for pictures with margins */
-    int i_visible_lines;            /**< How many visible lines are there ? */
-    int i_visible_pitch;            /**< How many visible pixels are there ? */
-
-} plane_t;
-
-/**
- * Video picture
- *
- * Any picture destined to be displayed by a video output thread should be
- * stored in this structure from it's creation to it's effective display.
- * Picture type and flags should only be modified by the output thread. Note
- * that an empty picture MUST have its flags set to 0.
- */
-struct picture_t
-{
-    /**
-     * The properties of the picture
-     */
-    video_frame_format_t format;
-
-    /** Picture data - data can always be freely modified, but p_data may
-     * NEVER be modified. A direct buffer can be handled as the plugin
-     * wishes, it can even swap p_pixels buffers. */
-    uint8_t        *p_data;
-    void           *p_data_orig;                /**< pointer before memalign */
-    plane_t         p[ VOUT_MAX_PLANES ];     /**< description of the planes */
-    int             i_planes;                /**< number of allocated planes */
-
-    /** \name Type and flags
-     * Should NOT be modified except by the vout thread
-     * @{*/
-    int             i_status;                             /**< picture flags */
-    int             i_type;                /**< is picture a direct buffer ? */
-    bool            b_slow;                 /**< is picture in slow memory ? */
-    /**@}*/
-
-    /** \name Picture management properties
-     * These properties can be modified using the video output thread API,
-     * but should never be written directly */
-    /**@{*/
-    unsigned        i_refcount;                  /**< link reference counter */
-    mtime_t         date;                                  /**< display date */
-    bool            b_force;
-    /**@}*/
-
-    /** \name Picture dynamic properties
-     * Those properties can be changed by the decoder
-     * @{
-     */
-    bool            b_progressive;          /**< is it a progressive frame ? */
-    unsigned int    i_nb_fields;                  /**< # of displayed fields */
-    bool            b_top_field_first;             /**< which field is first */
-    uint8_t        *p_q;                           /**< quantification table */
-    int             i_qstride;                    /**< quantification stride */
-    int             i_qtype;                       /**< quantification style */
-    /**@}*/
-
-    /** The picture heap we are attached to */
-    picture_heap_t* p_heap;
-
-    /* Some vouts require the picture to be locked before it can be modified */
-    int (* pf_lock) ( vout_thread_t *, picture_t * );
-    int (* pf_unlock) ( vout_thread_t *, picture_t * );
-
-    /** Private data - the video output plugin might want to put stuff here to
-     * keep track of the picture */
-    picture_sys_t * p_sys;
-
-    /** This way the picture_Release can be overloaded */
-    void (*pf_release)( picture_t * );
-
-    /** Next picture in a FIFO a pictures */
-    struct picture_t *p_next;
-};
-
-/**
- * This function will create a new picture.
- * The picture created will implement a default release management compatible
- * with picture_Hold and picture_Release. This default management will release
- * picture_sys_t *p_sys field if non NULL.
- */
-VLC_EXPORT( picture_t *, picture_New, ( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) );
-
-/**
- * This function will force the destruction a picture.
- * The value of the picture reference count should be 0 before entering this
- * function.
- * Unless used for reimplementing pf_release, you should not use this
- * function but picture_Release.
- */
-VLC_EXPORT( void, picture_Delete, ( picture_t * ) );
-
-/**
- * This function will increase the picture reference count.
- * It will not have any effect on picture obtained from vout
- */
-static inline void picture_Hold( picture_t *p_picture )
-{
-    if( p_picture->pf_release )
-        p_picture->i_refcount++;
-}
-/**
- * This function will release a picture.
- * It will not have any effect on picture obtained from vout
- */
-static inline void picture_Release( picture_t *p_picture )
-{
-    /* FIXME why do we let pf_release handle the i_refcount ? */
-    if( p_picture->pf_release )
-        p_picture->pf_release( p_picture );
-}
-
-/**
- * Cleanup quantization matrix data and set to 0
- */
-static inline void picture_CleanupQuant( picture_t *p_pic )
-{
-    free( p_pic->p_q );
-    p_pic->p_q = NULL;
-    p_pic->i_qstride = 0;
-    p_pic->i_qtype = 0;
-}
-
-/**
- * This function will copy all picture dynamic properties.
- */
-static inline void picture_CopyProperties( picture_t *p_dst, const picture_t *p_src )
-{
-    p_dst->date = p_src->date;
-    p_dst->b_force = p_src->b_force;
-
-    p_dst->b_progressive = p_src->b_progressive;
-    p_dst->i_nb_fields = p_src->i_nb_fields;
-    p_dst->b_top_field_first = p_src->b_top_field_first;
-
-    /* FIXME: copy ->p_q and ->p_qstride */
-}
-
-/**
- * This function will copy the picture pixels.
- * You can safely copy between pictures that do not have the same size,
- * only the compatible(smaller) part will be copied.
- */
-VLC_EXPORT( void, picture_CopyPixels, ( picture_t *p_dst, const picture_t *p_src ) );
-VLC_EXPORT( void, plane_CopyPixels, ( plane_t *p_dst, const plane_t *p_src ) );
-
-/**
- * This function will copy both picture dynamic properties and pixels.
- * You have to notice that sometime a simple picture_Hold may do what
- * you want without the copy overhead.
- * Provided for convenience.
- *
- * \param p_dst pointer to the destination picture.
- * \param p_src pointer to the source picture.
- */
-static inline void picture_Copy( picture_t *p_dst, const picture_t *p_src )
-{
-    picture_CopyPixels( p_dst, p_src );
-    picture_CopyProperties( p_dst, p_src );
-}
-
-/**
- * This function will export a picture to an encoded bitstream.
- *
- * pp_image will contain the encoded bitstream in psz_format format.
- *
- * p_fmt can be NULL otherwise it will be set with the format used for the
- * picture before encoding.
- *
- * i_override_width/height allow to override the width and/or the height of the
- * picture to be encoded. If at most one of them is > 0 then the picture aspect
- * ratio will be kept.
- */
-VLC_EXPORT( int, picture_Export, ( vlc_object_t *p_obj, block_t **pp_image, video_format_t *p_fmt, picture_t *p_picture, vlc_fourcc_t i_format, int i_override_width, int i_override_height ) );
-
+#include <vlc_subpicture.h>
 
 /**
  * Video picture heap, either render (to store pictures used
@@ -255,205 +67,6 @@ struct picture_heap_t
     void (* pf_setpalette) ( vout_thread_t *, uint16_t *, uint16_t *, uint16_t * );
 };
 
-/*****************************************************************************
- * Flags used to describe the status of a picture
- *****************************************************************************/
-
-/* Picture type
- * FIXME are the values meaningfull ? */
-enum
-{
-    EMPTY_PICTURE = 0,                             /* empty buffer */
-    MEMORY_PICTURE = 100,                 /* heap-allocated buffer */
-    DIRECT_PICTURE = 200,                         /* direct buffer */
-};
-
-/* Picture status */
-enum
-{
-    FREE_PICTURE,                              /* free and not allocated */
-    RESERVED_PICTURE,                          /* allocated and reserved */
-    READY_PICTURE,                                  /* ready for display */
-    DISPLAYED_PICTURE,                   /* been displayed but is linked */
-    DESTROYED_PICTURE,                     /* allocated but no more used */
-};
-
-/* Quantification type */
-enum
-{
-    QTYPE_NONE,
-
-    QTYPE_MPEG1,
-    QTYPE_MPEG2,
-    QTYPE_H264,
-};
-
-/*****************************************************************************
- * Shortcuts to access image components
- *****************************************************************************/
-
-/* Plane indices */
-enum
-{
-    Y_PLANE = 0,
-    U_PLANE = 1,
-    V_PLANE = 2,
-    A_PLANE = 3,
-};
-
-/* Shortcuts */
-#define Y_PIXELS     p[Y_PLANE].p_pixels
-#define Y_PITCH      p[Y_PLANE].i_pitch
-#define U_PIXELS     p[U_PLANE].p_pixels
-#define U_PITCH      p[U_PLANE].i_pitch
-#define V_PIXELS     p[V_PLANE].p_pixels
-#define V_PITCH      p[V_PLANE].i_pitch
-#define A_PIXELS     p[A_PLANE].p_pixels
-#define A_PITCH      p[A_PLANE].i_pitch
-
-/**
- * \defgroup subpicture Video Subpictures
- * Subpictures are pictures that should be displayed on top of the video, like
- * subtitles and OSD
- * \ingroup video_output
- * @{
- */
-
-/**
- * Video subtitle region spu core private
- */
-typedef struct subpicture_region_private_t subpicture_region_private_t;
-
-/**
- * Video subtitle region
- *
- * A subtitle region is defined by a picture (graphic) and its rendering
- * coordinates.
- * Subtitles contain a list of regions.
- */
-struct subpicture_region_t
-{
-    video_format_t  fmt;                          /**< format of the picture */
-    picture_t       *p_picture;          /**< picture comprising this region */
-
-    int             i_x;                             /**< position of region */
-    int             i_y;                             /**< position of region */
-    int             i_align;                  /**< alignment within a region */
-    int             i_alpha;                               /**< transparency */
-
-    char            *psz_text;       /**< text string comprising this region */
-    char            *psz_html;       /**< HTML version of subtitle (NULL = use psz_text) */
-    text_style_t    *p_style;        /**< a description of the text style formatting */
-
-    subpicture_region_t *p_next;                /**< next region in the list */
-    subpicture_region_private_t *p_private;  /**< Private data for spu_t *only* */
-};
-
-/* Subpicture region position flags */
-#define SUBPICTURE_ALIGN_LEFT 0x1
-#define SUBPICTURE_ALIGN_RIGHT 0x2
-#define SUBPICTURE_ALIGN_TOP 0x4
-#define SUBPICTURE_ALIGN_BOTTOM 0x8
-#define SUBPICTURE_ALIGN_MASK ( SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT| \
-                                SUBPICTURE_ALIGN_TOP |SUBPICTURE_ALIGN_BOTTOM )
-
-/**
- * This function will create a new subpicture region.
- *
- * You must use subpicture_region_Delete to destroy it.
- */
-VLC_EXPORT( subpicture_region_t *, subpicture_region_New, ( const video_format_t *p_fmt ) );
-
-/**
- * This function will destroy a subpicture region allocated by
- * subpicture_region_New.
- *
- * You may give it NULL.
- */
-VLC_EXPORT( void, subpicture_region_Delete, ( subpicture_region_t *p_region ) );
-
-/**
- * This function will destroy a list of subpicture regions allocated by
- * subpicture_region_New.
- *
- * Provided for convenience.
- */
-VLC_EXPORT( void, subpicture_region_ChainDelete, ( subpicture_region_t *p_head ) );
-
-/**
- * Video subtitle
- *
- * Any subtitle destined to be displayed by a video output thread should
- * be stored in this structure from it's creation to it's effective display.
- * Subtitle type and flags should only be modified by the output thread. Note
- * that an empty subtitle MUST have its flags set to 0.
- */
-struct subpicture_t
-{
-    /** \name Channel ID */
-    /**@{*/
-    int             i_channel;                    /**< subpicture channel ID */
-    /**@}*/
-
-    /** \name Type and flags
-       Should NOT be modified except by the vout thread */
-    /**@{*/
-    int64_t         i_order;                 /** an increasing unique number */
-    subpicture_t *  p_next;               /**< next subtitle to be displayed */
-    /**@}*/
-
-    /** \name Date properties */
-    /**@{*/
-    mtime_t         i_start;                  /**< beginning of display date */
-    mtime_t         i_stop;                         /**< end of display date */
-    bool            b_ephemer;    /**< If this flag is set to true the subtitle
-                                will be displayed untill the next one appear */
-    bool            b_fade;                               /**< enable fading */
-    /**@}*/
-
-    subpicture_region_t *p_region;  /**< region list composing this subtitle */
-
-    /** \name Display properties
-     * These properties are only indicative and may be
-     * changed by the video output thread, or simply ignored depending of the
-     * subtitle type. */
-    /**@{*/
-    int          i_original_picture_width;  /**< original width of the movie */
-    int          i_original_picture_height;/**< original height of the movie */
-    bool         b_subtitle;            /**< the picture is a movie subtitle */
-    bool         b_absolute;                       /**< position is absolute */
-    int          i_alpha;                                  /**< transparency */
-     /**@}*/
-
-    /** Pointer to function that renders this subtitle in a picture */
-    void ( *pf_render )  ( vout_thread_t *, picture_t *, const subpicture_t * );
-    /** Pointer to function that cleans up the private data of this subtitle */
-    void ( *pf_destroy ) ( subpicture_t * );
-
-    /** Pointer to functions for region management */
-    void (*pf_pre_render)    ( spu_t *, subpicture_t *, const video_format_t * );
-    void (*pf_update_regions)( spu_t *,
-                               subpicture_t *, const video_format_t *, mtime_t );
-
-    /** Private data - the subtitle plugin might want to put stuff here to
-     * keep track of the subpicture */
-    subpicture_sys_t *p_sys;                              /* subpicture data */
-};
-
-
-/**
- * This function create a new empty subpicture.
- *
- * You must use subpicture_Delete to destroy it.
- */
-VLC_EXPORT( subpicture_t *, subpicture_New, ( void ) );
-
-/**
- * This function delete a subpicture created by subpicture_New.
- * You may give it NULL.
- */
-VLC_EXPORT( void,  subpicture_Delete, ( subpicture_t *p_subpic ) );
-
 /* Default subpicture channel ID */
 #define DEFAULT_CHAN           1
 
@@ -461,19 +74,6 @@ VLC_EXPORT( void,  subpicture_Delete, ( subpicture_t *p_subpic ) );
  * Prototypes
  *****************************************************************************/
 
-/**
- * Initialise different fields of a picture_t (but does not allocate memory).
- * \param p_this a vlc object
- * \param p_pic pointer to the picture structure.
- * \param i_chroma the wanted chroma for the picture.
- * \param i_width the wanted width for the picture.
- * \param i_height the wanted height for the picture.
- * \param i_aspect the wanted aspect ratio for the picture.
- */
-#define vout_InitPicture(a,b,c,d,e,f) \
-        __vout_InitPicture(VLC_OBJECT(a),b,c,d,e,f)
-VLC_EXPORT( int, __vout_InitPicture, ( vlc_object_t *p_this, picture_t *p_pic, uint32_t i_chroma, int i_width, int i_height, int i_aspect ) );
-
 /**
  * Initialise different fields of a picture_t and allocates the picture buffer.
  * \param p_this a vlc object
@@ -704,7 +304,6 @@ VLC_EXPORT( int, vout_GetSnapshot, ( vout_thread_t *p_vout,
 VLC_EXPORT( int,             vout_ChromaCmp,      ( uint32_t, uint32_t ) );
 
 VLC_EXPORT( picture_t *,     vout_CreatePicture,  ( vout_thread_t *, bool, bool, unsigned int ) );
-VLC_EXPORT( void,            vout_InitFormat,     ( video_frame_format_t *, uint32_t, int, int, int ) );
 VLC_EXPORT( void,            vout_DestroyPicture, ( vout_thread_t *, picture_t * ) );
 VLC_EXPORT( void,            vout_DisplayPicture, ( vout_thread_t *, picture_t * ) );
 VLC_EXPORT( void,            vout_LinkPicture,    ( vout_thread_t *, picture_t * ) );
index 43bd16fe5a66897259d05eb752ad2b4e0093746e..d8b4b45759533f9b1c5e077360212bca9964de59 100644 (file)
@@ -44,7 +44,6 @@
 #include <vlc_access.h>
 #include <vlc_demux.h>
 #include <vlc_input.h>
-#include <vlc_vout.h>
 
 #include <ctype.h>
 #include <fcntl.h>
index 9fa05aa8f5dd7bf0ff7e99c02b41636b97d8ba1e..b79d38a50549071a892b11364812107e801a3c7b 100644 (file)
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_input.h>
-#include <vlc_vout.h>
 #include <vlc_demux.h>
 
 
@@ -215,7 +214,6 @@ static int Open( vlc_object_t *p_this )
     int i;
     int i_width;
     int i_height;
-    int i_aspect;
     int result = 0;
 
     if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
@@ -477,12 +475,16 @@ static int Open( vlc_object_t *p_this )
     i_width = p_sys->camera.frame_width;
     i_height = p_sys->camera.frame_height;
 
-    i_aspect = vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic,
-                    VLC_FOURCC('U', 'Y', 'V', 'Y'),
-                    i_width, i_height,
-                    i_width * VOUT_ASPECT_FACTOR / i_height );
+    if( picture_Setup( &p_sys->pic, VLC_CODEC_UYVY,
+                       i_width, i_height,
+                       i_width * VOUT_ASPECT_FACTOR / i_height ) )
+    {
+        msg_Err( p_demux ,"unknown chroma" );
+        Close( p_this );
+        return VLC_EGENERIC;
+    }
 
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC('U', 'Y', 'V', 'Y') );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_UYVY );
 
     fmt.video.i_width = i_width;
     fmt.video.i_height = i_height;
@@ -498,11 +500,11 @@ static int Open( vlc_object_t *p_this )
         if( p_sys->fd_audio >= 0 )
         {
             es_format_t fmt;
-            es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC('a','r','a','w') );
+            es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S16L ); /* FIXME: hmm, ?? */
 
             fmt.audio.i_channels = p_sys->channels ? p_sys->channels : 1;
             fmt.audio.i_rate = p_sys->i_sample_rate;
-            fmt.audio.i_bitspersample = 16; /* FIXME: hmm, ?? */
+            fmt.audio.i_bitspersample = 16;
             fmt.audio.i_blockalign = fmt.audio.i_channels *
                                      fmt.audio.i_bitspersample / 8;
             fmt.i_bitrate = fmt.audio.i_channels * fmt.audio.i_rate *
index c34b2902859926db148d870f363c4ff6a6771c30..653227ea6479610095cf2e5a3225e1f26f8667ec 100644 (file)
@@ -30,7 +30,6 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_vout.h>
 
 #ifndef _MSC_VER
     /* Work-around a bug in w32api-2.5 */
index 5dbce84fa6923adae5298bd6e98d62eb1ef98436..79c77f642aaba39a94e9363db8a42e3d1455a057 100644 (file)
@@ -38,7 +38,6 @@
 #include <vlc_input.h>
 #include <vlc_access.h>
 #include <vlc_demux.h>
-#include <vlc_vout.h>
 #include <vlc_dialog.h>
 #include <vlc_charset.h>
 
@@ -349,7 +348,8 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
 
     /* Get/parse options and open device(s) */
     string vdevname, adevname;
-    int i_width = 0, i_height = 0, i_chroma = 0;
+    int i_width = 0, i_height = 0;
+    vlc_fourcc_t i_chroma = 0;
     bool b_use_audio = true;
     bool b_use_video = true;
 
@@ -419,12 +419,9 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
     p_sys->b_chroma = false;
     var_Create( p_this, "dshow-chroma", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
     var_Get( p_this, "dshow-chroma", &val );
-    if( val.psz_string && strlen( val.psz_string ) >= 4 )
-    {
-        i_chroma = VLC_FOURCC( val.psz_string[0], val.psz_string[1],
-                               val.psz_string[2], val.psz_string[3] );
-        p_sys->b_chroma = true;
-    }
+
+    i_chroma = vlc_fourcc_GetCodecFromString( UNKNOWN_ES, val.psz_string );
+    p_sys->b_chroma = i_chroma != 0;
     free( val.psz_string );
 
     var_Create( p_this, "dshow-fps", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
@@ -488,11 +485,9 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
         if( p_stream->mt.majortype == MEDIATYPE_Video )
         {
             if( /* Raw DV stream */
-                p_stream->i_fourcc == VLC_FOURCC('d','v','s','l') ||
-                p_stream->i_fourcc == VLC_FOURCC('d','v','s','d') ||
-                p_stream->i_fourcc == VLC_FOURCC('d','v','h','d') ||
+                p_stream->i_fourcc == VLC_CODEC_DV ||
                 /* Raw MPEG video stream */
-                p_stream->i_fourcc == VLC_FOURCC('m','p','2','v') )
+                p_stream->i_fourcc == VLC_CODEC_MPGV )
             {
                 b_use_audio = false;
 
@@ -668,7 +663,7 @@ static int DemuxOpen( vlc_object_t *p_this )
             }
 
             /* Setup rgb mask for RGB formats */
-            if( p_stream->i_fourcc == VLC_FOURCC('R','V','2','4') )
+            if( p_stream->i_fourcc == VLC_CODEC_RGB24 )
             {
                 /* This is in BGR format */
                 fmt.video.i_bmask = 0x00ff0000;
@@ -725,14 +720,12 @@ static int AccessOpen( vlc_object_t *p_this )
     /* Check if we need to force demuxers */
     if( !p_access->psz_demux || !*p_access->psz_demux )
     {
-        if( p_stream->i_fourcc == VLC_FOURCC('d','v','s','l') ||
-            p_stream->i_fourcc == VLC_FOURCC('d','v','s','d') ||
-            p_stream->i_fourcc == VLC_FOURCC('d','v','h','d') )
+        if( p_stream->i_fourcc == VLC_CODEC_DV )
         {
             free( p_access->psz_demux );
             p_access->psz_demux = strdup( "rawdv" );
         }
-        else if( p_stream->i_fourcc == VLC_FOURCC('m','p','2','v') )
+        else if( p_stream->i_fourcc == VLC_CODEC_MPGV )
         {
             free( p_access->psz_demux );
             p_access->psz_demux = strdup( "mpgv" );
@@ -912,17 +905,17 @@ static int GetFourCCPriority( int i_fourcc )
 {
     switch( i_fourcc )
     {
-    case VLC_FOURCC('I','4','2','0'):
-    case VLC_FOURCC('f','l','3','2'):
+    case VLC_CODEC_I420:
+    case VLC_CODEC_FL32:
         return 9;
-    case VLC_FOURCC('Y','V','1','2'):
+    case VLC_CODEC_YV12:
     case VLC_FOURCC('a','r','a','w'):
         return 8;
-    case VLC_FOURCC('R','V','2','4'):
+    case VLC_CODEC_RGB24:
         return 7;
-    case VLC_FOURCC('Y','U','Y','2'):
-    case VLC_FOURCC('R','V','3','2'):
-    case VLC_FOURCC('R','G','B','A'):
+    case VLC_CODEC_YUYV:
+    case VLC_CODEC_RGB32:
+    case VLC_CODEC_RGBA:
         return 6;
     }
 
@@ -1478,7 +1471,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
                                     val = i_bitspersample;
                                     if( ! val )
                                     {
-                                        if( VLC_FOURCC('f', 'l', '3', '2') == i_current_fourcc )
+                                        if( VLC_CODEC_FL32 == i_current_fourcc )
                                             val = 32;
                                         else
                                             val = 16;
@@ -1655,7 +1648,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
                 {
                     // output format for 'Hauppauge WinTV PVR PCI II Capture'
                     // try I420 as an input format
-                    i_current_fourcc = VLC_FOURCC('I','4','2','0');
+                    i_current_fourcc = VLC_CODEC_I420;
                     if( !i_fourcc || i_fourcc == i_current_fourcc )
                     {
                         // return alternative media type
@@ -1680,7 +1673,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
                             ((VIDEOINFOHEADER *)p_mt->pbFormat)->bmiHeader.biHeight;
                         vh.bmiHeader.biPlanes      = 3;
                         vh.bmiHeader.biBitCount    = 12;
-                        vh.bmiHeader.biCompression = VLC_FOURCC('I','4','2','0');
+                        vh.bmiHeader.biCompression = VLC_CODEC_I420;
                         vh.bmiHeader.biSizeImage   = vh.bmiHeader.biWidth * 12 *
                             vh.bmiHeader.biHeight / 8;
                         mtr.lSampleSize            = vh.bmiHeader.biSizeImage;
index 456aa87597aad24cf0c62df4e7a6c5a90c78ce21..d061633d767726faa5a8593741bc0c76b97216c4 100644 (file)
@@ -30,7 +30,7 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_vout.h>
+#include <vlc_fourcc.h>
 
 #ifndef _MSC_VER
     /* Work-around a bug in w32api-2.5 */
@@ -242,67 +242,67 @@ int GetFourCCFromMediaType( const AM_MEDIA_TYPE &media_type )
             else if( media_type.subtype == MEDIASUBTYPE_RGB8 )
                i_fourcc = VLC_FOURCC( 'R', 'G', 'B', '8' );
             else if( media_type.subtype == MEDIASUBTYPE_RGB555 )
-               i_fourcc = VLC_FOURCC( 'R', 'V', '1', '5' );
+               i_fourcc = VLC_CODEC_RGB15;
             else if( media_type.subtype == MEDIASUBTYPE_RGB565 )
-               i_fourcc = VLC_FOURCC( 'R', 'V', '1', '6' );
+               i_fourcc = VLC_CODEC_RGB16;
             else if( media_type.subtype == MEDIASUBTYPE_RGB24 )
-               i_fourcc = VLC_FOURCC( 'R', 'V', '2', '4' );
+               i_fourcc = VLC_CODEC_RGB24;
             else if( media_type.subtype == MEDIASUBTYPE_RGB32 )
-               i_fourcc = VLC_FOURCC( 'R', 'V', '3', '2' );
+               i_fourcc = VLC_CODEC_RGB32;
             else if( media_type.subtype == MEDIASUBTYPE_ARGB32 )
-               i_fourcc = VLC_FOURCC( 'R', 'G', 'B', 'A' );
+               i_fourcc = VLC_CODEC_RGBA;
 
             /* Planar YUV formats */
             else if( media_type.subtype == MEDIASUBTYPE_I420 )
-               i_fourcc = VLC_FOURCC( 'I', '4', '2', '0' );
+               i_fourcc = VLC_CODEC_I420;
             else if( media_type.subtype == MEDIASUBTYPE_Y41P )
-               i_fourcc = VLC_FOURCC( 'I', '4', '1', '1' );
+               i_fourcc = VLC_CODEC_I411;
             else if( media_type.subtype == MEDIASUBTYPE_YV12 )
-               i_fourcc = VLC_FOURCC( 'Y', 'V', '1', '2' );
+               i_fourcc = VLC_CODEC_YV12;
             else if( media_type.subtype == MEDIASUBTYPE_IYUV )
-               i_fourcc = VLC_FOURCC( 'Y', 'V', '1', '2' );
+               i_fourcc = VLC_CODEC_YV12;
             else if( media_type.subtype == MEDIASUBTYPE_YVU9 )
-               i_fourcc = VLC_FOURCC( 'Y', 'V', 'U', '9' );
+               i_fourcc = VLC_CODEC_I410;
 
             /* Packed YUV formats */
             else if( media_type.subtype == MEDIASUBTYPE_YVYU )
-               i_fourcc = VLC_FOURCC( 'Y', 'V', 'Y', 'U' );
+               i_fourcc = VLC_CODEC_YVYU;
             else if( media_type.subtype == MEDIASUBTYPE_YUYV )
-               i_fourcc = VLC_FOURCC( 'Y', 'U', 'Y', '2' );
+               i_fourcc = VLC_CODEC_YUYV;
             else if( media_type.subtype == MEDIASUBTYPE_Y411 )
                i_fourcc = VLC_FOURCC( 'I', '4', '1', 'N' );
             else if( media_type.subtype == MEDIASUBTYPE_Y211 )
-               i_fourcc = VLC_FOURCC( 'Y', '2', '1', '1' );
+               i_fourcc = VLC_CODEC_Y211;
             else if( media_type.subtype == MEDIASUBTYPE_YUY2 )
-               i_fourcc = VLC_FOURCC( 'Y', 'U', 'Y', '2' );
+               i_fourcc = VLC_CODEC_YUYV;
             else if( media_type.subtype == MEDIASUBTYPE_UYVY )
-               i_fourcc = VLC_FOURCC( 'U', 'Y', 'V', 'Y' );
+               i_fourcc = VLC_CODEC_UYVY;
             /* HDYC uses UYVY sample positions but Rec709 colourimetry */
             /* FIXME: When VLC understands colourspace, something will need
              * to be added / changed here. Until then, just make it behave
              * like UYVY */
             else if( media_type.subtype == MEDIASUBTYPE_HDYC )
-                i_fourcc = VLC_FOURCC( 'U', 'Y', 'V', 'Y');
+                i_fourcc = VLC_CODEC_UYVY;
 
             /* MPEG2 video elementary stream */
             else if( media_type.subtype == MEDIASUBTYPE_MPEG2_VIDEO )
-               i_fourcc = VLC_FOURCC( 'm', 'p', '2', 'v' );
+               i_fourcc = VLC_CODEC_MPGV;
 
-        /* DivX video */
+            /* DivX video */
             else if( media_type.subtype == MEDIASUBTYPE_DIVX )
-               i_fourcc = VLC_FOURCC( 'D', 'I', 'V', 'X' );
+               i_fourcc = VLC_CODEC_MP4V;
 
             /* DV formats */
             else if( media_type.subtype == MEDIASUBTYPE_dvsl )
-               i_fourcc = VLC_FOURCC( 'd', 'v', 's', 'l' );
+               i_fourcc = VLC_CODEC_DV;
             else if( media_type.subtype == MEDIASUBTYPE_dvsd )
-               i_fourcc = VLC_FOURCC( 'd', 'v', 's', 'd' );
+               i_fourcc = VLC_CODEC_DV;
             else if( media_type.subtype == MEDIASUBTYPE_dvhd )
-               i_fourcc = VLC_FOURCC( 'd', 'v', 'h', 'd' );
+               i_fourcc = VLC_CODEC_DV;
 
             /* MJPEG format */
             else if( media_type.subtype == MEDIASUBTYPE_MJPG )
-                i_fourcc = VLC_FOURCC( 'M', 'J', 'P', 'G' );
+                i_fourcc = VLC_CODEC_MJPG;
 
         }
     }
@@ -314,7 +314,7 @@ int GetFourCCFromMediaType( const AM_MEDIA_TYPE &media_type )
             if( media_type.subtype == MEDIASUBTYPE_PCM )
                 i_fourcc = VLC_FOURCC( 'a', 'r', 'a', 'w' );
             else if( media_type.subtype == MEDIASUBTYPE_IEEE_FLOAT )
-                i_fourcc = VLC_FOURCC( 'f', 'l', '3', '2' );
+                i_fourcc = VLC_CODEC_FL32;
         }
     }
     else if( media_type.majortype == MEDIATYPE_Stream )
index 638440377d426dcf3b9bb6d32b7e3982b472898c..f611a04f4423fdfbda47ffb4340cb8520c6bbcd5 100644 (file)
@@ -232,7 +232,7 @@ static int Open( vlc_object_t *p_this )
         free( psz_name );
         return VLC_EGENERIC;
     }
+
     p_sys->p_ev->p_frame = NULL;
     p_sys->p_ev->pp_last = &p_sys->p_ev->p_frame;
     p_sys->p_ev->p_access = p_access;
@@ -340,14 +340,6 @@ static block_t *Block( access_t *p_access )
     access_sys_t *p_sys = p_access->p_sys;
     block_t *p_block = NULL;
 
-#if 0
-    if( !p_access->psz_demux )
-    {
-        free( p_access->psz_demux );
-        p_access->psz_demux = strdup( "rawdv" );
-    }
-#endif
-
     vlc_mutex_lock( &p_sys->lock );
     p_block = p_sys->p_frame;
     //msg_Dbg( p_access, "sending frame %p",p_block );
@@ -401,7 +393,7 @@ static int Raw1394Handler( raw1394handle_t handle, int channel, size_t length, q
     p_sys = p_access->p_sys;
 
     /* skip empty packets */
-    if ( length > 16 )
+    if( length > 16 )
     {
         unsigned char * p = ( unsigned char* ) &data[ 3 ];
         int section_type = p[ 0 ] >> 5;           /* section type is in bits 5 - 7 */
@@ -476,13 +468,13 @@ static int Raw1394GetNumPorts( access_t *p_access )
     raw1394handle_t handle;
 
     /* get a raw1394 handle */
-    if ( !( handle = raw1394_new_handle() ) )
+    if( !( handle = raw1394_new_handle() ) )
     {
         msg_Err( p_access, "raw1394 - failed to get handle: %m." );
         return VLC_EGENERIC;
     }
 
-    if ( ( n_ports = raw1394_get_port_info( handle, pinf, 16 ) ) < 0 )
+    if( ( n_ports = raw1394_get_port_info( handle, pinf, 16 ) ) < 0 )
     {
         msg_Err( p_access, "raw1394 - failed to get port info: %m." );
         raw1394_destroy_handle( handle );
@@ -500,21 +492,14 @@ static raw1394handle_t Raw1394Open( access_t *p_access, int port )
     raw1394handle_t handle;
 
     /* get a raw1394 handle */
-#ifdef RAW1394_V_0_8
-
-    handle = raw1394_get_handle();
-#else
-
     handle = raw1394_new_handle();
-#endif
-
-    if ( !handle )
+    if( !handle )
     {
         msg_Err( p_access, "raw1394 - failed to get handle: %m." );
         return NULL;
     }
 
-    if ( ( n_ports = raw1394_get_port_info( handle, pinf, 16 ) ) < 0 )
+    if( ( n_ports = raw1394_get_port_info( handle, pinf, 16 ) ) < 0 )
     {
         msg_Err( p_access, "raw1394 - failed to get port info: %m." );
         raw1394_destroy_handle( handle );
@@ -522,7 +507,7 @@ static raw1394handle_t Raw1394Open( access_t *p_access, int port )
     }
 
     /* tell raw1394 which host adapter to use */
-    if ( raw1394_set_port( handle, port ) < 0 )
+    if( raw1394_set_port( handle, port ) < 0 )
     {
         msg_Err( p_access, "raw1394 - failed to set set port: %m." );
         return NULL;
@@ -598,8 +583,8 @@ static int DiscoverAVC( access_t *p_access, int* port, uint64_t guid )
 static raw1394handle_t AVCOpen( access_t *p_access, int port )
 {
     access_sys_t *p_sys = p_access->p_sys;
-    int numcards;
     struct raw1394_portinfo pinf[ 16 ];
+    int numcards;
 
     p_sys->p_avc1394 = raw1394_new_handle();
     if( !p_sys->p_avc1394 )
@@ -627,7 +612,6 @@ static void AVCClose( access_t *p_access )
     }
 }
 
-
 static int AVCResetHandler( raw1394handle_t handle, unsigned int generation )
 {
     raw1394_update_generation( handle, generation );
index 8e05040d4a31b88256591ee4583e8dad96515b42..6b4c48994b0a13c56ce7913517d7e7494a91d5df 100644 (file)
@@ -41,7 +41,6 @@
 #include <vlc_plugin.h>
 #include <vlc_input.h>
 #include <vlc_demux.h>
-#include <vlc_vout.h>
 #include <vlc_codecs.h>
 #include <vlc_url.h>
 #include <vlc_strings.h>
@@ -305,7 +304,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->jack_sample_size = sizeof( jack_default_audio_sample_t );
 
     /* Define output format */
-    es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'f','l','3','2' ) );
+    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_FL32 );
     fmt.audio.i_channels =  p_sys->i_channels;
     fmt.audio.i_rate =  p_sys->jack_sample_rate;
     fmt.audio.i_bitspersample =  p_sys->jack_sample_size * 8;
index 7ea65275881bd78f28ebce2729d4b58c5e280971..4d8c746d52033c2a807ae4b883049a23bf118314 100644 (file)
@@ -37,7 +37,6 @@
 #include <vlc_access.h>
 #include <vlc_demux.h>
 #include <vlc_input.h>
-#include <vlc_vout.h>
 
 #include <ctype.h>
 #include <fcntl.h>
@@ -397,7 +396,7 @@ static int OpenAudioDev( demux_t *p_demux )
              p_sys->i_sample_rate );
 
     es_format_t fmt;
-    es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC('a','r','a','w') );
+    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S16L );
 
     fmt.audio.i_channels = p_sys->b_stereo ? 2 : 1;
     fmt.audio.i_rate = p_sys->i_sample_rate;
index 088378f74923c0aa8905692769ba3e09112161bf..9656949d2cffc75b673f0f797a885304e67faa5f 100644 (file)
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_input.h>
-#include <vlc_vout.h>
 #include <vlc_demux.h>
 #include <vlc_interface.h>
 #include <vlc_dialog.h>
@@ -171,8 +170,8 @@ static int qtchroma_to_fourcc( int i_qt )
     } qtchroma_to_fourcc[] =
     {
         /* Raw data types */
-        { k422YpCbCr8CodecType,    VLC_FOURCC('U','Y','V','Y') },
-        { kComponentVideoCodecType,VLC_FOURCC('Y','U','Y','2') },
+        { k422YpCbCr8CodecType,    VLC_CODEC_UYVY },
+        { kComponentVideoCodecType,VLC_CODEC_YUYV },
         { 0, 0 }
     };
     int i;
index 1f8c6f687104cd4641fdbfe581a5610ad8b95ca2..15075ad61767ec40c47f9dba6e84984f277697c2 100644 (file)
@@ -452,7 +452,7 @@ static void *pcmu_init (demux_t *demux)
 {
     es_format_t fmt;
 
-    es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('u', 'l', 'a', 'w'));
+    es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MULAW);
     fmt.audio.i_rate = 8000;
     fmt.audio.i_channels = 1;
     return codec_init (demux, &fmt);
@@ -465,7 +465,7 @@ static void *gsm_init (demux_t *demux)
 {
     es_format_t fmt;
 
-    es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('g', 's', 'm', ' '));
+    es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_GSM);
     fmt.audio.i_rate = 8000;
     fmt.audio.i_channels = 1;
     return codec_init (demux, &fmt);
@@ -478,7 +478,7 @@ static void *pcma_init (demux_t *demux)
 {
     es_format_t fmt;
 
-    es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('a', 'l', 'a', 'w'));
+    es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_ALAW);
     fmt.audio.i_rate = 8000;
     fmt.audio.i_channels = 1;
     return codec_init (demux, &fmt);
@@ -491,7 +491,7 @@ static void *l16s_init (demux_t *demux)
 {
     es_format_t fmt;
 
-    es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('s', '1', '6', 'b'));
+    es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B);
     fmt.audio.i_rate = 44100;
     fmt.audio.i_channels = 2;
     return codec_init (demux, &fmt);
@@ -501,7 +501,7 @@ static void *l16m_init (demux_t *demux)
 {
     es_format_t fmt;
 
-    es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('s', '1', '6', 'b'));
+    es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B);
     fmt.audio.i_rate = 44100;
     fmt.audio.i_channels = 1;
     return codec_init (demux, &fmt);
@@ -514,7 +514,7 @@ static void *qcelp_init (demux_t *demux)
 {
     es_format_t fmt;
 
-    es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('Q', 'c', 'l', 'p'));
+    es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_QCELP);
     fmt.audio.i_rate = 8000;
     fmt.audio.i_channels = 1;
     return codec_init (demux, &fmt);
@@ -527,7 +527,7 @@ static void *mpa_init (demux_t *demux)
 {
     es_format_t fmt;
 
-    es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('m', 'p', 'g', 'a'));
+    es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MPGA);
     fmt.audio.i_channels = 2;
     fmt.b_packetized = false;
     return codec_init (demux, &fmt);
@@ -555,7 +555,7 @@ static void *mpv_init (demux_t *demux)
 {
     es_format_t fmt;
 
-    es_format_Init (&fmt, VIDEO_ES, VLC_FOURCC ('m', 'p', 'g', 'v'));
+    es_format_Init (&fmt, VIDEO_ES, VLC_CODEC_MPGV);
     fmt.b_packetized = false;
     return codec_init (demux, &fmt);
 }
index 7f6492e64418a4b4b09a84ada00c0985494f3d15..8a98bd624a469143fea0a81130942b6607be4465 100644 (file)
@@ -250,7 +250,7 @@ static void vorbis_decode (demux_t *demux, void *data, block_t *block)
                     break;
 
                 es_format_t fmt;
-                es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC ('v','o','r','b'));
+                es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_VORBIS);
                 fmt.p_extra = extv;
                 fmt.i_extra = extc;
                 codec_destroy (demux, self->id);
index 95d48bf033d0270dd892c42ae84a205d7a40b9cc..b4444ecd980f161baa91e2ce75b38423c05beebf 100644 (file)
@@ -519,13 +519,13 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt
 
   rmff_fix_header(header);
 
-  if( desc ) sdpplin_free( desc );
+  sdpplin_free( desc );
   free( buf );
   return header;
 
 error:
-  if( desc ) sdpplin_free( desc );
-  if( header ) rmff_free_header( header );
+  sdpplin_free( desc );
+  rmff_free_header( header );
   free( buf );
   return NULL;
 }
@@ -725,7 +725,7 @@ rmff_header_t  *real_setup_and_get_header(rtsp_client_t *rtsp_session, int bandw
   return h;
 
 error:
-  if( h ) rmff_free_header( h );
+  rmff_free_header( h );
   free( challenge1 );
   free( session_id );
   free( description );
index 64e043af5431f0fed08769a6b62781b0f166cb7a..53542f90d8c7ebbb143fceb734a3a8242b8cf3ef 100644 (file)
  * sdp/sdpplin parser.
  *
  */
+
 #include "real.h"
+#include "vlc_strings.h"
 #define BUFLEN 32000
 
-/*
- * Decodes base64 strings (based upon b64 package)
- */
-
-static char *b64_decode(const char *in, char *out, int *size) {
-
-  char dtable[256];              /* Encode / decode table */
-  int i,k;
-  unsigned int j;
-
-  for( i = 0; i < 256; i++ )
-    dtable[i] = 0x80;
-
-  for( i = 'A'; i <= 'Z'; i++ )
-    dtable[i] = 0 + (i - 'A');
-
-  for( i = 'a'; i <= 'z'; i++ )
-    dtable[i] = 26 + (i - 'a');
-
-  for( i = '0'; i <= '9'; i++ )
-    dtable[i] = 52 + (i - '0');
-
-  dtable['+'] = 62;
-  dtable['/'] = 63;
-  dtable['='] = 0;
-
-  k=0;
-  /*CONSTANTCONDITION*/
-  int in_len = strlen(in);
-  for (j=0; j < in_len; j+=4) {
-    char a[4], b[4];
-
-    for (i = 0; i < 4 && j + i < in_len; i++) {
-      int c = in[i+j];
-
-      if (dtable[c] & 0x80) {
-        printf("Illegal character '%c' in input.\n", c);
-        exit(1);
-      }
-      a[i] = (char) c;
-      b[i] = (char) dtable[c];
-    }
-    //xine_buffer_ensure_size(out, k+3);
-    out[k++] = (b[0] << 2) | (b[1] >> 4);
-    out[k++] = (b[1] << 4) | (b[2] >> 2);
-    out[k++] = (b[2] << 6) | b[3];
-    i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3);
-    if (i < 3) {
-      out[k]=0;
-      *size=k;
-      return out;
-    }
-  }
-  out[k]=0;
-  *size=k;
-  return out;
-}
-
-static char *nl(char *data) {
-
+static inline char *nl(char *data) {
   char *nlptr = (data) ? strchr(data,'\n') : NULL;
   return (nlptr) ? nlptr + 1 : NULL;
 }
@@ -198,8 +140,9 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
       *data=nl(*data);
     }
     if(filter(*data,"a=OpaqueData:buffer;",&buf, BUFLEN)) {
-      decoded = b64_decode(buf, decoded, &(desc->mlti_data_size));
-      if ( decoded != NULL ) {
+      desc->mlti_data_size =
+          vlc_b64_decode_binary_to_buffer(decoded, BUFLEN, buf );
+      if ( desc->mlti_data_size ) {
           desc->mlti_data = malloc(desc->mlti_data_size);
           memcpy(desc->mlti_data, decoded, desc->mlti_data_size);
           handled=1;
@@ -281,35 +224,31 @@ sdpplin_t *sdpplin_parse(char *data)
         continue;
     }
     if(filter(data,"a=Title:buffer;",&buf, BUFLEN)) {
-      decoded=b64_decode(buf, decoded, &len);
-         if ( decoded != NULL ) {
-          desc->title=strdup(decoded);
-          handled=1;
-          data=nl(data);
+      desc->title=vlc_b64_decode(buf);
+      if(desc->title) {
+        handled=1;
+        data=nl(data);
       }
     }
     if(filter(data,"a=Author:buffer;",&buf, BUFLEN)) {
-      decoded=b64_decode(buf, decoded, &len);
-         if ( decoded != NULL ) {
-          desc->author=strdup(decoded);
-          handled=1;
-          data=nl(data);
+      desc->author=vlc_b64_decode(buf);
+      if(desc->author) {
+        handled=1;
+        data=nl(data);
       }
     }
     if(filter(data,"a=Copyright:buffer;",&buf, BUFLEN)) {
-      decoded=b64_decode(buf, decoded, &len);
-         if ( decoded != NULL ) {
-          desc->copyright=strdup(decoded);
-          handled=1;
-          data=nl(data);
+      desc->copyright=vlc_b64_decode(buf);
+      if(desc->copyright) {
+        handled=1;
+        data=nl(data);
       }
     }
     if(filter(data,"a=Abstract:buffer;",&buf, BUFLEN)) {
-      decoded=b64_decode(buf, decoded, &len);
-      if ( decoded != NULL ) {
-           desc->abstract=strdup(decoded);
-           handled=1;
-           data=nl(data);
+      desc->abstract=vlc_b64_decode(buf);
+      if(desc->abstract) {
+        handled=1;
+        data=nl(data);
       }
     }
     if(filter(data,"a=StreamCount:integer;",&buf, BUFLEN)) {
index 165250c9c301dc59741e1456decda7db7c354281..5f70cdc66b2637c242978e99c9445dedc43ae6fe 100644 (file)
@@ -61,11 +61,11 @@ int screen_InitCapture( demux_t *p_demux )
     switch( p_data->p_screen->ColorSpace() )
     {
         case B_RGB32:
-            i_chroma = VLC_FOURCC('R','V','3','2');
+            i_chroma = VLC_CODEC_RGB32;
             i_bits_per_pixel = 32;
             break;
         case B_RGB16:
-            i_chroma = VLC_FOURCC('R','V','1','6');
+            i_chroma = VLC_CODEC_RGB16;
             i_bits_per_pixel = 16;
             break;
         default:
index 5b14fdd610773963176644ee76abcd8d5e1d8590..f469bac99476b3bda622c3d096b884d91e43d132 100644 (file)
@@ -129,7 +129,7 @@ int screen_InitCapture( demux_t *p_demux )
     CGLSetOffScreen( p_data->scaled, p_data->dest_width, p_data->dest_height,
                      p_data->dest_width * 4, p_data->scaled_image );
     
-    es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_FOURCC( 'R','V','3','2' ) );
+    es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_CODEC_RGB32 );
     
     /* p_sys->fmt.video.i_* must set to screen size, not subscreen size */
     p_sys->fmt.video.i_width = p_data->screen_width;
index e70b168e28e73de7807a70069f1f642b720f6b1d..55169f02782f9d8f505da4b1edce9180acb4d95e 100644 (file)
@@ -212,7 +212,7 @@ static int Open( vlc_object_t *p_this )
         msg_Dbg( p_demux, "Using %s for the mouse pointer image", psz_mouse );
         memset( &fmt_in, 0, sizeof( fmt_in ) );
         memset( &fmt_out, 0, sizeof( fmt_out ) );
-        fmt_out.i_chroma = VLC_FOURCC('R','G','B','A');
+        fmt_out.i_chroma = VLC_CODEC_RGBA;
         p_image = image_HandlerCreate( p_demux );
         if( p_image )
         {
@@ -336,18 +336,18 @@ void RenderCursor( demux_t *p_demux, int i_x, int i_y,
 {
     demux_sys_t *p_sys = p_demux->p_sys;
     if( !p_sys->dst.i_planes )
-        vout_InitPicture( p_demux, &p_sys->dst,
-                          p_sys->fmt.video.i_chroma,
-                          p_sys->fmt.video.i_width,
-                          p_sys->fmt.video.i_height,
-                          p_sys->fmt.video.i_aspect );
+        picture_Setup( &p_sys->dst,
+                       p_sys->fmt.video.i_chroma,
+                       p_sys->fmt.video.i_width,
+                       p_sys->fmt.video.i_height,
+                       p_sys->fmt.video.i_aspect );
     if( !p_sys->p_blend )
     {
         p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) );
         if( p_sys->p_blend )
         {
             es_format_Init( &p_sys->p_blend->fmt_in, VIDEO_ES,
-                            VLC_FOURCC('R','G','B','A') );
+                            VLC_CODEC_RGBA );
             p_sys->p_blend->fmt_in.video = p_sys->p_mouse->format;
             p_sys->p_blend->fmt_out = p_sys->fmt;
             p_sys->p_blend->p_module =
index e0cfd7abfb53add3df95916eb02c6d91a0e9aacb..01cac097c9d8711324ea49465ffc669950ef2a04 100644 (file)
@@ -81,14 +81,14 @@ int screen_InitCapture( demux_t *p_demux )
     switch( i_bits_per_pixel )
     {
     case 8: /* FIXME: set the palette */
-        i_chroma = VLC_FOURCC('R','G','B','2'); break;
+        i_chroma = VLC_CODEC_RGB8; break;
     case 15:
     case 16:    /* Yes it is really 15 bits (when using BI_RGB) */
-        i_chroma = VLC_FOURCC('R','V','1','5'); break;
+        i_chroma = VLC_CODEC_RGB15; break;
     case 24:
-        i_chroma = VLC_FOURCC('R','V','2','4'); break;
+        i_chroma = VLC_CODEC_RGB24; break;
     case 32:
-        i_chroma = VLC_FOURCC('R','V','3','2'); break;
+        i_chroma = VLC_CODEC_RGB32; break;
     default:
         msg_Err( p_demux, "unknown screen depth %i",
                  p_sys->fmt.video.i_bits_per_pixel );
@@ -108,17 +108,17 @@ int screen_InitCapture( demux_t *p_demux )
 
     switch( i_chroma )
     {
-    case VLC_FOURCC('R','V','1','5'):
+    case VLC_CODEC_RGB15:
         p_sys->fmt.video.i_rmask = 0x7c00;
         p_sys->fmt.video.i_gmask = 0x03e0;
         p_sys->fmt.video.i_bmask = 0x001f;
         break;
-    case VLC_FOURCC('R','V','2','4'):
+    case VLC_CODEC_RGB24:
         p_sys->fmt.video.i_rmask = 0x00ff0000;
         p_sys->fmt.video.i_gmask = 0x0000ff00;
         p_sys->fmt.video.i_bmask = 0x000000ff;
         break;
-    case VLC_FOURCC('R','V','3','2'):
+    case VLC_CODEC_RGB32:
         p_sys->fmt.video.i_rmask = 0x00ff0000;
         p_sys->fmt.video.i_gmask = 0x0000ff00;
         p_sys->fmt.video.i_bmask = 0x000000ff;
index 8723f150149cfdd333398818eae0d209ee2295b8..1cb4a5564490e0343623912ae240cdbb1595b4a5 100644 (file)
@@ -68,14 +68,14 @@ int screen_InitCapture( demux_t *p_demux )
     switch( win_info.depth )
     {
     case 8: /* FIXME: set the palette */
-        i_chroma = VLC_FOURCC('R','G','B','2'); break;
+        i_chroma = VLC_CODEC_RGB8; break;
     case 15:
-        i_chroma = VLC_FOURCC('R','V','1','5'); break;
+        i_chroma = VLC_CODEC_RGB15; break;
     case 16:
-        i_chroma = VLC_FOURCC('R','V','1','6'); break;
+        i_chroma = VLC_CODEC_RGB16; break;
     case 24:
     case 32:
-        i_chroma = VLC_FOURCC('R','V','3','2');
+        i_chroma = VLC_CODEC_RGB32;
         win_info.depth = 32;
         break;
     default:
index 11261e7c30e395f81f8bd0df39ca3101146c3536..b564ad21dc47bf2f9f1d8975e1b354c354b602ad 100644 (file)
@@ -37,7 +37,7 @@
 #include <vlc_input.h>
 #include <vlc_demux.h>
 #include <vlc_access.h>
-#include <vlc_vout.h>
+#include <vlc_picture.h>
 
 #include <sys/ioctl.h>
 #include <sys/mman.h>
@@ -212,27 +212,25 @@ struct quicktime_mjpeg_app1
 static const struct
 {
     int i_v4l;
-    int i_fourcc;
+    vlc_fourcc_t i_fourcc;
 
 } v4lchroma_to_fourcc[] =
 {
-    { VIDEO_PALETTE_GREY, VLC_FOURCC( 'G', 'R', 'E', 'Y' ) },
+    { VIDEO_PALETTE_GREY, VLC_CODEC_GREY },
     { VIDEO_PALETTE_HI240, VLC_FOURCC( 'I', '2', '4', '0' ) },
-    { VIDEO_PALETTE_RGB565, VLC_FOURCC( 'R', 'V', '1', '6' ) },
-    { VIDEO_PALETTE_RGB555, VLC_FOURCC( 'R', 'V', '1', '5' ) },
-    { VIDEO_PALETTE_RGB24, VLC_FOURCC( 'R', 'V', '2', '4' ) },
-    { VIDEO_PALETTE_RGB32, VLC_FOURCC( 'R', 'V', '3', '2' ) },
-    { VIDEO_PALETTE_YUV422, VLC_FOURCC( 'Y', 'U', 'Y', '2' ) },
-    { VIDEO_PALETTE_YUV422, VLC_FOURCC( 'Y', 'U', 'Y', 'V' ) },
-    { VIDEO_PALETTE_YUYV, VLC_FOURCC( 'Y', 'U', 'Y', '2' ) },
-    { VIDEO_PALETTE_YUYV, VLC_FOURCC( 'Y', 'U', 'Y', 'V' ) },
-    { VIDEO_PALETTE_UYVY, VLC_FOURCC( 'U', 'Y', 'V', 'Y' ) },
+    { VIDEO_PALETTE_RGB565, VLC_CODEC_RGB16 },
+    { VIDEO_PALETTE_RGB555, VLC_CODEC_RGB15 },
+    { VIDEO_PALETTE_RGB24, VLC_CODEC_RGB24 },
+    { VIDEO_PALETTE_RGB32, VLC_CODEC_RGB32 },
+    { VIDEO_PALETTE_YUV422, VLC_CODEC_YUYV },
+    { VIDEO_PALETTE_YUYV, VLC_CODEC_YUYV },
+    { VIDEO_PALETTE_UYVY, VLC_CODEC_UYVY },
     { VIDEO_PALETTE_YUV420, VLC_FOURCC( 'I', '4', '2', 'N' ) },
     { VIDEO_PALETTE_YUV411, VLC_FOURCC( 'I', '4', '1', 'N' ) },
     { VIDEO_PALETTE_RAW, VLC_FOURCC( 'G', 'R', 'A', 'W' ) },
-    { VIDEO_PALETTE_YUV422P, VLC_FOURCC( 'I', '4', '2', '2' ) },
-    { VIDEO_PALETTE_YUV420P, VLC_FOURCC( 'I', '4', '2', '0' ) },
-    { VIDEO_PALETTE_YUV411P, VLC_FOURCC( 'I', '4', '1', '1' ) },
+    { VIDEO_PALETTE_YUV422P, VLC_CODEC_I422 },
+    { VIDEO_PALETTE_YUV420P, VLC_CODEC_I420 },
+    { VIDEO_PALETTE_YUV411P, VLC_CODEC_I411 },
     { 0, 0 }
 };
 
@@ -354,18 +352,18 @@ static int Open( vlc_object_t *p_this )
     /* Setup rgb mask for RGB formats */
     switch( p_sys->i_fourcc )
     {
-        case VLC_FOURCC('R','V','1','5'):
+        case VLC_CODEC_RGB15:
             fmt.video.i_rmask = 0x001f;
             fmt.video.i_gmask = 0x03e0;
             fmt.video.i_bmask = 0x7c00;
             break;
-        case VLC_FOURCC('R','V','1','6'):
+        case VLC_CODEC_RGB16:
             fmt.video.i_rmask = 0x001f;
             fmt.video.i_gmask = 0x07e0;
             fmt.video.i_bmask = 0xf800;
             break;
-        case VLC_FOURCC('R','V','2','4'):
-        case VLC_FOURCC('R','V','3','2'):
+        case VLC_CODEC_RGB24:
+        case VLC_CODEC_RGB32:
             fmt.video.i_rmask = 0x00ff0000;
             fmt.video.i_gmask = 0x0000ff00;
             fmt.video.i_bmask = 0x000000ff;
@@ -977,10 +975,12 @@ static int OpenVideoDev( demux_t *p_demux, char *psz_device )
             p_sys->i_fourcc = 0;
 
             psz = var_CreateGetString( p_demux, "v4l-chroma" );
-            if( strlen( psz ) >= 4 )
+
+            const vlc_fourcc_t i_chroma =
+                vlc_fourcc_GetCodecFromString( VIDEO_ES, psz );
+            if( i_chroma )
             {
                 vid_picture.palette = 0;
-                int i_chroma = VLC_FOURCC( psz[0], psz[1], psz[2], psz[3] );
 
                 /* Find out v4l chroma code */
                 for( i = 0; v4lchroma_to_fourcc[i].i_v4l != 0; i++ )
@@ -1056,7 +1056,7 @@ static int OpenVideoDev( demux_t *p_demux, char *psz_device )
             goto vdev_failed;
         }
 
-        p_sys->i_fourcc  = VLC_FOURCC( 'm','j','p','g' );
+        p_sys->i_fourcc  = VLC_CODEC_MJPG;
         p_sys->i_frame_pos = -1;
 
         /* queue up all the frames */
@@ -1072,10 +1072,9 @@ static int OpenVideoDev( demux_t *p_demux, char *psz_device )
     else
     {
         /* Fill in picture_t fields */
-        vout_InitPicture( VLC_OBJECT(p_demux), &p_sys->pic, p_sys->i_fourcc,
-                          p_sys->i_width, p_sys->i_height, p_sys->i_width *
-                          VOUT_ASPECT_FACTOR / p_sys->i_height );
-        if( !p_sys->pic.i_planes )
+        if( picture_Setup( &p_sys->pic, p_sys->i_fourcc,
+                           p_sys->i_width, p_sys->i_height, p_sys->i_width *
+                           VOUT_ASPECT_FACTOR / p_sys->i_height ) )
         {
             msg_Err( p_demux, "unsupported chroma" );
             goto vdev_failed;
index 31dae6643f3445a6549b225e2e42f9e133a91ca5..27c139fe7d33cc82337830c8e8f2296ab68e7b3f 100644 (file)
@@ -393,42 +393,41 @@ static int AccessControlResetCallback( vlc_object_t *p_this,
 static const struct
 {
     unsigned int i_v4l2;
-    int i_fourcc;
+    vlc_fourcc_t i_fourcc;
     int i_rmask;
     int i_gmask;
     int i_bmask;
 } v4l2chroma_to_fourcc[] =
 {
     /* Raw data types */
-    { V4L2_PIX_FMT_GREY,    VLC_FOURCC('G','R','E','Y'), 0, 0, 0 },
+    { V4L2_PIX_FMT_GREY,    VLC_CODEC_GREY, 0, 0, 0 },
     { V4L2_PIX_FMT_HI240,   VLC_FOURCC('I','2','4','0'), 0, 0, 0 },
-    { V4L2_PIX_FMT_RGB555,  VLC_FOURCC('R','V','1','5'), 0x001f,0x03e0,0x7c00 },
-    { V4L2_PIX_FMT_RGB565,  VLC_FOURCC('R','V','1','6'), 0x001f,0x07e0,0xf800 },
+    { V4L2_PIX_FMT_RGB555,  VLC_CODEC_RGB15, 0x001f,0x03e0,0x7c00 },
+    { V4L2_PIX_FMT_RGB565,  VLC_CODEC_RGB16, 0x001f,0x07e0,0xf800 },
     /* Won't work since we don't know how to handle such gmask values
      * correctly
-    { V4L2_PIX_FMT_RGB555X, VLC_FOURCC('R','V','1','5'), 0x007c,0xe003,0x1f00 },
-    { V4L2_PIX_FMT_RGB565X, VLC_FOURCC('R','V','1','6'), 0x00f8,0xe007,0x1f00 },
+    { V4L2_PIX_FMT_RGB555X, VLC_CODEC_RGB15, 0x007c,0xe003,0x1f00 },
+    { V4L2_PIX_FMT_RGB565X, VLC_CODEC_RGB16, 0x00f8,0xe007,0x1f00 },
     */
-    { V4L2_PIX_FMT_BGR24,   VLC_FOURCC('R','V','2','4'), 0xff0000,0xff00,0xff },
-    { V4L2_PIX_FMT_RGB24,   VLC_FOURCC('R','V','2','4'), 0xff,0xff00,0xff0000 },
-    { V4L2_PIX_FMT_BGR32,   VLC_FOURCC('R','V','3','2'), 0xff0000,0xff00,0xff },
-    { V4L2_PIX_FMT_RGB32,   VLC_FOURCC('R','V','3','2'), 0xff,0xff00,0xff0000 },
-    { V4L2_PIX_FMT_YUYV,    VLC_FOURCC('Y','U','Y','2'), 0, 0, 0 },
-    { V4L2_PIX_FMT_YUYV,    VLC_FOURCC('Y','U','Y','V'), 0, 0, 0 },
-    { V4L2_PIX_FMT_UYVY,    VLC_FOURCC('U','Y','V','Y'), 0, 0, 0 },
+    { V4L2_PIX_FMT_BGR24,   VLC_CODEC_RGB24, 0xff0000,0xff00,0xff },
+    { V4L2_PIX_FMT_RGB24,   VLC_CODEC_RGB24, 0xff,0xff00,0xff0000 },
+    { V4L2_PIX_FMT_BGR32,   VLC_CODEC_RGB32, 0xff0000,0xff00,0xff },
+    { V4L2_PIX_FMT_RGB32,   VLC_CODEC_RGB32, 0xff,0xff00,0xff0000 },
+    { V4L2_PIX_FMT_YUYV,    VLC_CODEC_YUYV, 0, 0, 0 },
+    { V4L2_PIX_FMT_UYVY,    VLC_CODEC_UYVY, 0, 0, 0 },
     { V4L2_PIX_FMT_Y41P,    VLC_FOURCC('I','4','1','N'), 0, 0, 0 },
-    { V4L2_PIX_FMT_YUV422P, VLC_FOURCC('I','4','2','2'), 0, 0, 0 },
-    { V4L2_PIX_FMT_YVU420,  VLC_FOURCC('Y','V','1','2'), 0, 0, 0 },
-    { V4L2_PIX_FMT_YUV411P, VLC_FOURCC('I','4','1','1'), 0, 0, 0 },
-    { V4L2_PIX_FMT_YUV410,  VLC_FOURCC('I','4','1','0'), 0, 0, 0 },
+    { V4L2_PIX_FMT_YUV422P, VLC_CODEC_I422, 0, 0, 0 },
+    { V4L2_PIX_FMT_YVU420,  VLC_CODEC_YV12, 0, 0, 0 },
+    { V4L2_PIX_FMT_YUV411P, VLC_CODEC_I411, 0, 0, 0 },
+    { V4L2_PIX_FMT_YUV410,  VLC_CODEC_I410, 0, 0, 0 },
 
     /* Raw data types, not in V4L2 spec but still in videodev2.h and supported
      * by VLC */
-    { V4L2_PIX_FMT_YUV420,  VLC_FOURCC('I','4','2','0'), 0, 0, 0 },
-    /* FIXME { V4L2_PIX_FMT_RGB444,  VLC_FOURCC('R','V','3','2') }, */
+    { V4L2_PIX_FMT_YUV420,  VLC_CODEC_I420, 0, 0, 0 },
+    /* FIXME { V4L2_PIX_FMT_RGB444,  VLC_CODEC_RGB32 }, */
 
     /* Compressed data types */
-    { V4L2_PIX_FMT_MJPEG,   VLC_FOURCC('M','J','P','G'), 0, 0, 0 },
+    { V4L2_PIX_FMT_MJPEG,   VLC_CODEC_MJPG, 0, 0, 0 },
 #if 0
     { V4L2_PIX_FMT_JPEG,    VLC_FOURCC('J','P','E','G') },
     { V4L2_PIX_FMT_DV,      VLC_FOURCC('?','?','?','?') },
@@ -1946,21 +1945,18 @@ static int OpenVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys, bool b_demux )
 
     /* Test and set Chroma */
     fmt.fmt.pix.pixelformat = 0;
-    if( p_sys->psz_requested_chroma && strlen( p_sys->psz_requested_chroma ) > 0 )
+    if( p_sys->psz_requested_chroma && *p_sys->psz_requested_chroma )
     {
         /* User specified chroma */
-        if( strlen( p_sys->psz_requested_chroma ) >= 4 )
+        const vlc_fourcc_t i_requested_fourcc =
+            vlc_fourcc_GetCodecFromString( VIDEO_ES, p_sys->psz_requested_chroma );
+
+        for( int i = 0; v4l2chroma_to_fourcc[i].i_v4l2 != 0; i++ )
         {
-            int i_requested_fourcc = VLC_FOURCC(
-                p_sys->psz_requested_chroma[0], p_sys->psz_requested_chroma[1],
-                p_sys->psz_requested_chroma[2], p_sys->psz_requested_chroma[3] );
-            for( int i = 0; v4l2chroma_to_fourcc[i].i_v4l2 != 0; i++ )
+            if( v4l2chroma_to_fourcc[i].i_fourcc == i_requested_fourcc )
             {
-                if( v4l2chroma_to_fourcc[i].i_fourcc == i_requested_fourcc )
-                {
-                    fmt.fmt.pix.pixelformat = v4l2chroma_to_fourcc[i].i_v4l2;
-                    break;
-                }
+                fmt.fmt.pix.pixelformat = v4l2chroma_to_fourcc[i].i_v4l2;
+                break;
             }
         }
         /* Try and set user chroma */
index 3b54cae2c2105a372943cfe7ce5b3b98f599b306..5e3810b19a89f02e7227af4b347c9267b105db24 100644 (file)
@@ -97,8 +97,8 @@ static int Create( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if ( p_filter->input.i_format != VLC_CODEC_FL32
+          || p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         return VLC_EGENERIC;
     }
index 42d1bcdb474e5e053ac78b9742f111418397074f..c659cdf11d6e96a54aea567799775b62992f74f5 100644 (file)
@@ -372,12 +372,12 @@ static int Create( vlc_object_t *p_this )
         p_filter->input.i_original_channels =
                                         p_filter->output.i_original_channels;
     }
-    if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if( p_filter->input.i_format != VLC_CODEC_FL32
+          || p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         b_fit = false;
-        p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
-        p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
+        p_filter->input.i_format = VLC_CODEC_FL32;
+        p_filter->output.i_format = VLC_CODEC_FL32;
     }
     if( p_filter->input.i_rate != p_filter->output.i_rate )
     {
@@ -580,12 +580,12 @@ static int OpenFilter( vlc_object_t *p_this )
         p_filter->fmt_in.audio.i_original_channels =
                                         p_filter->fmt_out.audio.i_original_channels;
     }
-    if( p_filter->fmt_in.audio.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->fmt_out.audio.i_format != VLC_FOURCC('f','l','3','2') )
+    if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
+          || p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
     {
         b_fit = false;
-        p_filter->fmt_in.audio.i_format = VLC_FOURCC('f','l','3','2');
-        p_filter->fmt_out.audio.i_format = VLC_FOURCC('f','l','3','2');
+        p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
+        p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
     }
     if( p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate )
     {
index 77bc29f2b1e346cb46283e28396c7e3a086cf369..7e4af3d792bfe3ea1ac0efbba3383d93aac8c9a5 100644 (file)
@@ -358,8 +358,8 @@ static int OpenFilter( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    if( (p_filter->fmt_in.i_codec != AOUT_FMT_S16_NE) ||
-        (p_filter->fmt_out.i_codec != AOUT_FMT_S16_NE) )
+    if( (p_filter->fmt_in.i_codec != VLC_CODEC_S16N) ||
+        (p_filter->fmt_out.i_codec != VLC_CODEC_S16N) )
     {
         /*msg_Err( p_this, "filter discarded (invalid format)" );*/
         return VLC_EGENERIC;
@@ -367,8 +367,8 @@ static int OpenFilter( vlc_object_t *p_this )
 
     if( (p_filter->fmt_in.audio.i_format != p_filter->fmt_out.audio.i_format) &&
         (p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate) &&
-        (p_filter->fmt_in.audio.i_format != AOUT_FMT_S16_NE) &&
-        (p_filter->fmt_out.audio.i_format != AOUT_FMT_S16_NE) &&
+        (p_filter->fmt_in.audio.i_format != VLC_CODEC_S16N) &&
+        (p_filter->fmt_out.audio.i_format != VLC_CODEC_S16N) &&
         (p_filter->fmt_in.audio.i_bitspersample !=
                                     p_filter->fmt_out.audio.i_bitspersample))
     {
index 443c3cf19fd2b4758ec5b0a3fe9f0a4ec3bb67f3..c6cf8b04ead3586bbc34d82be60be72e386d56f5 100644 (file)
@@ -291,7 +291,7 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block )
  *****************************************************************************/
 static bool IsSupported( const audio_format_t *p_input, const audio_format_t *p_output )
 {
-    if( p_input->i_format != VLC_FOURCC('f','l','3','2') ||
+    if( p_input->i_format != VLC_CODEC_FL32 ||
           p_input->i_format != p_output->i_format ||
           p_input->i_rate != p_output->i_rate )
         return false;
index ee393ed48deac87a410381317b587a827b08d844..42ac93e6231418e5dc662de808239caf875fbc22 100644 (file)
@@ -65,8 +65,8 @@ static int Create( vlc_object_t *p_this )
                == p_filter->output.i_original_channels)
           || p_filter->input.i_format != p_filter->output.i_format
           || p_filter->input.i_rate != p_filter->output.i_rate
-          || (p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-               && p_filter->input.i_format != VLC_FOURCC('f','i','3','2')) )
+          || (p_filter->input.i_format != VLC_CODEC_FL32
+               && p_filter->input.i_format != VLC_CODEC_FI32) )
     {
         return -1;
     }
index ad18a0ed907b34a1460a1d52faa5783f7f407930..083caf79a91c665be6d79bf317ee79566f09d84d 100644 (file)
@@ -122,11 +122,11 @@ static int Create( vlc_object_t *p_this )
     filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
     int i_ret;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('a','5','2',' ')
+    if ( p_filter->input.i_format != VLC_CODEC_A52
 #ifdef LIBA52_FIXED
-          || p_filter->output.i_format != VLC_FOURCC('f','i','3','2') )
+          || p_filter->output.i_format != VLC_CODEC_FI32 )
 #else
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+          || p_filter->output.i_format != VLC_CODEC_FL32 )
 #endif
     {
         return -1;
@@ -416,16 +416,16 @@ static int OpenFilter( vlc_object_t *p_this )
     filter_sys_t *p_sys;
     int i_ret;
 
-    if( p_filter->fmt_in.i_codec != VLC_FOURCC('a','5','2',' ')  )
+    if( p_filter->fmt_in.i_codec != VLC_CODEC_A52  )
     {
         return VLC_EGENERIC;
     }
 
     p_filter->fmt_out.audio.i_format =
 #ifdef LIBA52_FIXED
-        p_filter->fmt_out.i_codec = VLC_FOURCC('f','i','3','2');
+        p_filter->fmt_out.i_codec = VLC_CODEC_FI32;
 #else
-        p_filter->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+        p_filter->fmt_out.i_codec = VLC_CODEC_FL32;
 #endif
     p_filter->fmt_out.audio.i_bitspersample =
         aout_BitsPerSample( p_filter->fmt_out.i_codec );
index f43855135934775fb62bfe36ae13ba7a1e202755..7bfc5809a20a775623ed146582f9925094e556b8 100644 (file)
@@ -64,9 +64,9 @@ static int Create( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('a','5','2',' ') ||
-         ( p_filter->output.i_format != VLC_FOURCC('s','p','d','b') &&
-           p_filter->output.i_format != VLC_FOURCC('s','p','d','i') ) )
+    if ( p_filter->input.i_format != VLC_CODEC_A52 ||
+         ( p_filter->output.i_format != VLC_CODEC_SPDIFB &&
+           p_filter->output.i_format != VLC_CODEC_SPDIFL ) )
     {
         return -1;
     }
@@ -95,7 +95,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     uint8_t * p_out = p_out_buf->p_buffer;
 
     /* Copy the S/PDIF headers. */
-    if( p_filter->output.i_format == VLC_FOURCC('s','p','d','b') )
+    if( p_filter->output.i_format == VLC_CODEC_SPDIFB )
     {
         vlc_memcpy( p_out, p_sync_be, 6 );
         p_out[4] = p_in[5] & 0x7; /* bsmod */
index 0028e13cab822bc9e08b9e3b02e32afc7864c596..0d48406bd749e39d31445512e9f15ccbff7e4cb6 100644 (file)
@@ -112,8 +112,8 @@ static int Create( vlc_object_t *p_this )
     filter_sys_t *p_sys;
     int i_ret;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('d','t','s',' ')
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if ( p_filter->input.i_format != VLC_CODEC_DTS
+          || p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         return -1;
     }
@@ -385,13 +385,13 @@ static int OpenFilter( vlc_object_t *p_this )
     filter_sys_t *p_sys;
     int i_ret;
 
-    if( p_filter->fmt_in.i_codec != VLC_FOURCC('d','t','s',' ')  )
+    if( p_filter->fmt_in.i_codec != VLC_CODEC_DTS  )
     {
         return VLC_EGENERIC;
     }
 
     p_filter->fmt_out.audio.i_format =
-        p_filter->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+        p_filter->fmt_out.i_codec = VLC_CODEC_FL32;
     p_filter->fmt_out.audio.i_bitspersample =
         aout_BitsPerSample( p_filter->fmt_out.i_codec );
 
index d55446d11bbfff66d9a358b406e164b7bbc0e5ea..7ae39323caa3e6a78c6ec3ea0bc2a631a9be7335 100644 (file)
@@ -81,9 +81,9 @@ static int Create( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if( p_filter->input.i_format != VLC_FOURCC('d','t','s',' ') ||
-        ( p_filter->output.i_format != VLC_FOURCC('s','p','d','i') &&
-          p_filter->output.i_format != VLC_FOURCC('s','p','d','b') ) )
+    if( p_filter->input.i_format != VLC_CODEC_DTS ||
+        ( p_filter->output.i_format != VLC_CODEC_SPDIFL &&
+          p_filter->output.i_format != VLC_CODEC_SPDIFB ) )
     {
         return -1;
     }
@@ -170,7 +170,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
         }
 
         /* Copy the S/PDIF headers. */
-        if( p_filter->output.i_format == VLC_FOURCC('s','p','d','b') )
+        if( p_filter->output.i_format == VLC_CODEC_SPDIFB )
         {
             vlc_memcpy( p_out, p_sync_be, 6 );
             p_out[5] = i_ac5_spdif_type;
@@ -185,8 +185,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
             p_out[7] = (( i_length ) >> 5 ) & 0xFF;
         }
 
-        if( ( (p_in[0] == 0x1F || p_in[0] == 0x7F) && p_filter->output.i_format == VLC_FOURCC('s','p','d','i') ) ||
-            ( (p_in[0] == 0xFF || p_in[0] == 0xFE) && p_filter->output.i_format == VLC_FOURCC('s','p','d','b') ) )
+        if( ( (p_in[0] == 0x1F || p_in[0] == 0x7F) && p_filter->output.i_format == VLC_CODEC_SPDIFL ) ||
+            ( (p_in[0] == 0xFF || p_in[0] == 0xFE) && p_filter->output.i_format == VLC_CODEC_SPDIFB ) )
         {
             /* We are dealing with a big endian bitstream and a little endian output
              * or a little endian bitstream and a big endian output.
index 1282838feffc00011b3ddca11ad2830324e07929..c77027903a2e0a2a8dc97afadf30a2c2c0b1e968 100644 (file)
@@ -73,8 +73,8 @@ static int Create_F32ToS16( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('f','i','3','2')
-          || p_filter->output.i_format != AOUT_FMT_S16_NE )
+    if ( p_filter->input.i_format != VLC_CODEC_FI32
+          || p_filter->output.i_format != VLC_CODEC_S16N )
     {
         return -1;
     }
@@ -157,8 +157,8 @@ static int Create_S16ToF32( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->output.i_format != VLC_FOURCC('f','i','3','2')
-          || p_filter->input.i_format != AOUT_FMT_S16_NE )
+    if ( p_filter->output.i_format != VLC_CODEC_FI32
+          || p_filter->input.i_format != VLC_CODEC_S16N )
     {
         return -1;
     }
@@ -203,8 +203,8 @@ static int Create_U8ToF32( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('u','8',' ',' ')
-          || p_filter->output.i_format != VLC_FOURCC('f','i','3','2') )
+    if ( p_filter->input.i_format != VLC_CODEC_U8
+          || p_filter->output.i_format != VLC_CODEC_FI32 )
     {
         return -1;
     }
index 223aa1e3ad82eb065f614647d08a915624f42c47..b92717511dd5d2f77c858ba7f42a7bc412f88364 100644 (file)
@@ -132,10 +132,10 @@ static int Create_F32ToFL32( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if( ( p_filter->input.i_format != VLC_FOURCC('f','i','3','2')
-           || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
-      && ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-            || p_filter->output.i_format != VLC_FOURCC('f','i','3','2') ) )
+    if( ( p_filter->input.i_format != VLC_CODEC_FI32
+           || p_filter->output.i_format != VLC_CODEC_FL32 )
+      && ( p_filter->input.i_format != VLC_CODEC_FL32
+            || p_filter->output.i_format != VLC_CODEC_FI32 ) )
     {
         return -1;
     }
@@ -145,7 +145,7 @@ static int Create_F32ToFL32( vlc_object_t *p_this )
         return -1;
     }
 
-    if( p_filter->input.i_format == VLC_FOURCC('f','i','3','2') )
+    if( p_filter->input.i_format == VLC_CODEC_FI32 )
     {
         p_filter->pf_do_work = Do_F32ToFL32;
     }
@@ -202,8 +202,8 @@ static int Create_FL32ToS16( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != AOUT_FMT_S16_NE )
+    if ( p_filter->input.i_format != VLC_CODEC_FL32
+          || p_filter->output.i_format != VLC_CODEC_S16N )
     {
         return -1;
     }
@@ -257,8 +257,8 @@ static int Create_FL32ToS8( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != VLC_FOURCC('s','8',' ',' ') )
+    if ( p_filter->input.i_format != VLC_CODEC_FL32
+          || p_filter->output.i_format != VLC_CODEC_S8 )
     {
         return -1;
     }
@@ -302,8 +302,8 @@ static int Create_FL32ToU16( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != AOUT_FMT_U16_NE )
+    if ( p_filter->input.i_format != VLC_CODEC_FL32
+          || p_filter->output.i_format != VLC_CODEC_U16N )
     {
         return -1;
     }
@@ -347,8 +347,8 @@ static int Create_FL32ToU8( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != VLC_FOURCC('u','8',' ',' ') )
+    if ( p_filter->input.i_format != VLC_CODEC_FL32
+          || p_filter->output.i_format != VLC_CODEC_U8 )
     {
         return -1;
     }
@@ -392,10 +392,10 @@ static int Create_S16ToFL32( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( ( p_filter->input.i_format != AOUT_FMT_S16_NE &&
-           p_filter->input.i_format != AOUT_FMT_S24_NE &&
-           p_filter->input.i_format != AOUT_FMT_S32_NE )
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if ( ( p_filter->input.i_format != VLC_CODEC_S16N &&
+           p_filter->input.i_format != VLC_CODEC_S24N &&
+           p_filter->input.i_format != VLC_CODEC_S32N )
+          || p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         return -1;
     }
@@ -405,9 +405,9 @@ static int Create_S16ToFL32( vlc_object_t *p_this )
         return -1;
     }
 
-    if( p_filter->input.i_format == AOUT_FMT_S32_NE )
+    if( p_filter->input.i_format == VLC_CODEC_S32N )
         p_filter->pf_do_work = Do_S32ToFL32;
-    else if( p_filter->input.i_format == AOUT_FMT_S24_NE )
+    else if( p_filter->input.i_format == VLC_CODEC_S24N )
         p_filter->pf_do_work = Do_S24ToFL32;
     else
         p_filter->pf_do_work = Do_S16ToFL32;
@@ -505,10 +505,10 @@ static int Create_S16ToFL32_SW( vlc_object_t *p_this )
         return -1;
     }
 
-    if ( (p_filter->input.i_format == VLC_FOURCC('s','1','6','l') ||
-         p_filter->input.i_format == VLC_FOURCC('s','1','6','b'))
-         && p_filter->output.i_format == VLC_FOURCC('f','l','3','2')
-         && p_filter->input.i_format != AOUT_FMT_S16_NE )
+    if ( (p_filter->input.i_format == VLC_CODEC_S16L ||
+         p_filter->input.i_format == VLC_CODEC_S16B)
+         && p_filter->output.i_format == VLC_CODEC_FL32
+         && p_filter->input.i_format != VLC_CODEC_S16N )
     {
         p_filter->pf_do_work = Do_S16ToFL32_SW;
         p_filter->b_in_place = true;
@@ -516,10 +516,10 @@ static int Create_S16ToFL32_SW( vlc_object_t *p_this )
         return 0;
     }
 
-    if ( (p_filter->input.i_format == VLC_FOURCC('s','2','4','l') ||
-         p_filter->input.i_format == VLC_FOURCC('s','2','4','b'))
-         && p_filter->output.i_format == VLC_FOURCC('f','l','3','2')
-         && p_filter->input.i_format != AOUT_FMT_S24_NE )
+    if ( (p_filter->input.i_format == VLC_CODEC_S24L ||
+         p_filter->input.i_format == VLC_CODEC_S24B)
+         && p_filter->output.i_format == VLC_CODEC_FL32
+         && p_filter->input.i_format != VLC_CODEC_S24N )
     {
         p_filter->pf_do_work = Do_S24ToFL32_SW;
         p_filter->b_in_place = true;
@@ -527,10 +527,10 @@ static int Create_S16ToFL32_SW( vlc_object_t *p_this )
         return 0;
     }
 
-    if ( (p_filter->input.i_format == VLC_FOURCC('s','3','2','l') ||
-         p_filter->input.i_format == VLC_FOURCC('s','3','2','b'))
-         && p_filter->output.i_format == VLC_FOURCC('f','l','3','2')
-         && p_filter->input.i_format != AOUT_FMT_S32_NE )
+    if ( (p_filter->input.i_format == VLC_CODEC_S32L ||
+         p_filter->input.i_format == VLC_CODEC_S32B)
+         && p_filter->output.i_format == VLC_CODEC_FL32
+         && p_filter->input.i_format != VLC_CODEC_S32N )
     {
         p_filter->pf_do_work = Do_S32ToFL32_SW;
         p_filter->b_in_place = true;
@@ -623,8 +623,8 @@ static int Create_S8ToFL32( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('s','8',' ',' ')
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if ( p_filter->input.i_format != VLC_CODEC_S8
+          || p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         return -1;
     }
@@ -667,8 +667,8 @@ static int Create_U8ToFL32( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('u','8',' ',' ')
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if ( p_filter->input.i_format != VLC_CODEC_U8
+          || p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         return -1;
     }
index 357ccb8b6c88cab7bd1dff3f5e83e2c6c58171cb..1bee61dc33eff45508f3f22b3601c8047947a6eb 100644 (file)
@@ -87,10 +87,10 @@ static int Create( vlc_object_t *p_this )
     aout_filter_t *p_filter = (aout_filter_t *)p_this;
     struct filter_sys_t *p_sys;
 
-    if ( (p_filter->input.i_format != VLC_FOURCC('m','p','g','a')
+    if ( (p_filter->input.i_format != VLC_CODEC_MPGA
            && p_filter->input.i_format != VLC_FOURCC('m','p','g','3'))
-            || (p_filter->output.i_format != VLC_FOURCC('f','l','3','2')
-                 && p_filter->output.i_format != VLC_FOURCC('f','i','3','2')) )
+            || (p_filter->output.i_format != VLC_CODEC_FL32
+                 && p_filter->output.i_format != VLC_CODEC_FI32) )
     {
         return -1;
     }
@@ -147,7 +147,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
 
     if( p_sys->i_reject_count > 0 )
     {
-        if( p_filter->output.i_format == VLC_FOURCC('f','l','3','2') )
+        if( p_filter->output.i_format == VLC_CODEC_FL32 )
         {
             int i;
             int i_size = p_out_buf->i_nb_bytes / sizeof(float);
@@ -167,7 +167,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
 
     mad_synth_frame( &p_sys->mad_synth, &p_sys->mad_frame );
 
-    if ( p_filter->output.i_format == VLC_FOURCC('f','i','3','2') )
+    if ( p_filter->output.i_format == VLC_CODEC_FI32 )
     {
         /* Interleave and keep buffers in mad_fixed_t format */
         mad_fixed_t * p_samples = (mad_fixed_t *)p_out_buf->p_buffer;
@@ -304,7 +304,7 @@ static int OpenFilter( vlc_object_t *p_this )
     filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
-    if( p_filter->fmt_in.i_codec != VLC_FOURCC('m','p','g','a') &&
+    if( p_filter->fmt_in.i_codec != VLC_CODEC_MPGA &&
         p_filter->fmt_in.i_codec != VLC_FOURCC('m','p','g','3') )
     {
         return VLC_EGENERIC;
@@ -325,9 +325,9 @@ static int OpenFilter( vlc_object_t *p_this )
     mad_stream_options( &p_sys->mad_stream, MAD_OPTION_IGNORECRC );
 
     if( vlc_CPU() & CPU_CAPABILITY_FPU )
-        p_filter->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+        p_filter->fmt_out.i_codec = VLC_CODEC_FL32;
     else
-        p_filter->fmt_out.i_codec = VLC_FOURCC('f','i','3','2');
+        p_filter->fmt_out.i_codec = VLC_CODEC_FI32;
     p_filter->fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
     p_filter->fmt_out.audio.i_bitspersample =
         aout_BitsPerSample( p_filter->fmt_out.i_codec );
index 33b646943764a176179bd5e4029dc2bf41023c4e..e10696f82aceb0b9394cb76ef1835ac4372f9d19 100644 (file)
@@ -147,12 +147,12 @@ static int Open( vlc_object_t *p_this )
     aout_filter_sys_t *p_sys;
     bool         b_fit = true;
 
-    if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' ) ||
-        p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if( p_filter->input.i_format != VLC_CODEC_FL32 ||
+        p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         b_fit = false;
-        p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
-        p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
+        p_filter->input.i_format = VLC_CODEC_FL32;
+        p_filter->output.i_format = VLC_CODEC_FL32;
         msg_Warn( p_filter, "bad input or output format" );
     }
     if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
index 0811231b104a31ce661f3fde102299723099b0e7..6f8a6046557d723b6ee6ee15e8845b48d91e2dae 100644 (file)
 #include <vlc_block.h>
 #include "vlc_filter.h"
 
-#ifdef WORDS_BIGENDIAN
-#   define AOUT_FMT_S24_IE VLC_FOURCC('s','2','4','l')
-#   define AOUT_FMT_S16_IE VLC_FOURCC('s','1','6','l')
-#   define AOUT_FMT_U16_IE VLC_FOURCC('u','1','6','l')
-#else
-#   define AOUT_FMT_S24_IE VLC_FOURCC('s','2','4','b')
-#   define AOUT_FMT_S16_IE VLC_FOURCC('s','1','6','b')
-#   define AOUT_FMT_U16_IE VLC_FOURCC('u','1','6','b')
-#endif
-
-
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -125,74 +114,74 @@ static const struct
 } ConvertTable[] =
 {
     /* From fl32 */
-    { VLC_FOURCC('f','l','3','2'), AOUT_FMT_S24_NE, Float32toS24 },
-    { VLC_FOURCC('f','l','3','2'), AOUT_FMT_S16_NE, Float32toS16 },
-    { VLC_FOURCC('f','l','3','2'), AOUT_FMT_U16_NE, Float32toU16 },
-    { VLC_FOURCC('f','l','3','2'), AOUT_FMT_S24_IE, Float32toS24Invert },
-    { VLC_FOURCC('f','l','3','2'), AOUT_FMT_S16_IE, Float32toS16Invert },
-    { VLC_FOURCC('f','l','3','2'), AOUT_FMT_U16_IE, Float32toU16Invert },
-    { VLC_FOURCC('f','l','3','2'), VLC_FOURCC('s','8',' ',' '), Float32toS8 },
-    { VLC_FOURCC('f','l','3','2'), VLC_FOURCC('u','8',' ',' '), Float32toU8 },
+    { VLC_CODEC_FL32, VLC_CODEC_S24N, Float32toS24 },
+    { VLC_CODEC_FL32, VLC_CODEC_S16N, Float32toS16 },
+    { VLC_CODEC_FL32, VLC_CODEC_U16N, Float32toU16 },
+    { VLC_CODEC_FL32, VLC_CODEC_S24I, Float32toS24Invert },
+    { VLC_CODEC_FL32, VLC_CODEC_S16I, Float32toS16Invert },
+    { VLC_CODEC_FL32, VLC_CODEC_U16I, Float32toU16Invert },
+    { VLC_CODEC_FL32, VLC_CODEC_S8, Float32toS8 },
+    { VLC_CODEC_FL32, VLC_CODEC_U8, Float32toU8 },
 
     /* From s24 invert */
-    { AOUT_FMT_S24_NE, VLC_FOURCC('f','l','3','2'), S24toFloat32 },
-    { AOUT_FMT_S24_NE, AOUT_FMT_S24_IE,             Swap24 },
-    { AOUT_FMT_S24_NE, AOUT_FMT_S16_NE,             S24toS16 },
-    { AOUT_FMT_S24_NE, AOUT_FMT_S16_IE,             S24toS16Invert },
+    { VLC_CODEC_S24N, VLC_CODEC_FL32, S24toFloat32 },
+    { VLC_CODEC_S24N, VLC_CODEC_S24I,             Swap24 },
+    { VLC_CODEC_S24N, VLC_CODEC_S16N,             S24toS16 },
+    { VLC_CODEC_S24N, VLC_CODEC_S16I,             S24toS16Invert },
 
     /* From s16 */
-    { AOUT_FMT_S16_NE, VLC_FOURCC('f','l','3','2'), S16toFloat32 },
-    { AOUT_FMT_S16_NE, AOUT_FMT_S24_NE,             S16toS24 },
-    { AOUT_FMT_S16_NE, AOUT_FMT_S24_IE,             S16toS24Invert },
-    { AOUT_FMT_S16_NE, AOUT_FMT_S16_IE,             Swap16 },
-    { AOUT_FMT_S16_NE, AOUT_FMT_U16_IE,             S16toU16 },
-    { AOUT_FMT_S16_NE, VLC_FOURCC('s','8',' ',' '), S16toS8 },
-    { AOUT_FMT_S16_NE, VLC_FOURCC('u','8',' ',' '), S16toU8 },
+    { VLC_CODEC_S16N, VLC_CODEC_FL32, S16toFloat32 },
+    { VLC_CODEC_S16N, VLC_CODEC_S24N,             S16toS24 },
+    { VLC_CODEC_S16N, VLC_CODEC_S24I,             S16toS24Invert },
+    { VLC_CODEC_S16N, VLC_CODEC_S16I,             Swap16 },
+    { VLC_CODEC_S16N, VLC_CODEC_U16I,             S16toU16 },
+    { VLC_CODEC_S16N, VLC_CODEC_S8, S16toS8 },
+    { VLC_CODEC_S16N, VLC_CODEC_U8, S16toU8 },
 
     /* From u16 */
-    { AOUT_FMT_U16_NE, VLC_FOURCC('f','l','3','2'), U16toFloat32 },
-    { AOUT_FMT_U16_NE, AOUT_FMT_U16_IE,             Swap16 },
-    { AOUT_FMT_U16_NE, AOUT_FMT_S16_IE,             U16toS16 },
-    { AOUT_FMT_U16_NE, VLC_FOURCC('s','8',' ',' '), U16toS8 },
-    { AOUT_FMT_U16_NE, VLC_FOURCC('u','8',' ',' '), U16toU8 },
+    { VLC_CODEC_U16N, VLC_CODEC_FL32, U16toFloat32 },
+    { VLC_CODEC_U16N, VLC_CODEC_U16I,             Swap16 },
+    { VLC_CODEC_U16N, VLC_CODEC_S16I,             U16toS16 },
+    { VLC_CODEC_U16N, VLC_CODEC_S8, U16toS8 },
+    { VLC_CODEC_U16N, VLC_CODEC_U8, U16toU8 },
 
     /* From s8 */
-    { VLC_FOURCC('s','8',' ',' '), VLC_FOURCC('f','l','3','2'), S8toFloat32 },
-    { VLC_FOURCC('s','8',' ',' '), AOUT_FMT_S16_NE,             S8toS16 },
-    { VLC_FOURCC('s','8',' ',' '), AOUT_FMT_S16_IE,             S8toS16Invert },
-    { VLC_FOURCC('s','8',' ',' '), AOUT_FMT_U16_NE,             S8toU16 },
-    { VLC_FOURCC('s','8',' ',' '), AOUT_FMT_U16_IE,             S8toU16Invert },
-    { VLC_FOURCC('s','8',' ',' '), VLC_FOURCC('u','8',' ',' '), S8toU8 },
+    { VLC_CODEC_S8, VLC_CODEC_FL32, S8toFloat32 },
+    { VLC_CODEC_S8, VLC_CODEC_S16N,             S8toS16 },
+    { VLC_CODEC_S8, VLC_CODEC_S16I,             S8toS16Invert },
+    { VLC_CODEC_S8, VLC_CODEC_U16N,             S8toU16 },
+    { VLC_CODEC_S8, VLC_CODEC_U16I,             S8toU16Invert },
+    { VLC_CODEC_S8, VLC_CODEC_U8, S8toU8 },
  
     /* From u8 */
-    { VLC_FOURCC('u','8',' ',' '), VLC_FOURCC('f','l','3','2'), U8toFloat32 },
-    { VLC_FOURCC('u','8',' ',' '), AOUT_FMT_S16_NE,             U8toS16 },
-    { VLC_FOURCC('u','8',' ',' '), AOUT_FMT_S16_IE,             U8toS16Invert },
-    { VLC_FOURCC('u','8',' ',' '), AOUT_FMT_U16_NE,             U8toU16 },
-    { VLC_FOURCC('u','8',' ',' '), AOUT_FMT_U16_IE,             U8toU16Invert },
-    { VLC_FOURCC('u','8',' ',' '), VLC_FOURCC('s','8',' ',' '), U8toS8 },
+    { VLC_CODEC_U8, VLC_CODEC_FL32, U8toFloat32 },
+    { VLC_CODEC_U8, VLC_CODEC_S16N,             U8toS16 },
+    { VLC_CODEC_U8, VLC_CODEC_S16I,             U8toS16Invert },
+    { VLC_CODEC_U8, VLC_CODEC_U16N,             U8toU16 },
+    { VLC_CODEC_U8, VLC_CODEC_U16I,             U8toU16Invert },
+    { VLC_CODEC_U8, VLC_CODEC_S8, U8toS8 },
 
     /* From s24 invert */
-    { AOUT_FMT_S24_IE, VLC_FOURCC('f','l','3','2'), S24InverttoFloat32 },
-    { AOUT_FMT_S24_IE, AOUT_FMT_S24_NE,             Swap24 },
-    { AOUT_FMT_S24_IE, AOUT_FMT_S16_NE,             S24InverttoS16 },
-    { AOUT_FMT_S24_IE, AOUT_FMT_S16_IE,             S24InverttoS16Invert },
+    { VLC_CODEC_S24I, VLC_CODEC_FL32, S24InverttoFloat32 },
+    { VLC_CODEC_S24I, VLC_CODEC_S24N,             Swap24 },
+    { VLC_CODEC_S24I, VLC_CODEC_S16N,             S24InverttoS16 },
+    { VLC_CODEC_S24I, VLC_CODEC_S16I,             S24InverttoS16Invert },
 
     /* From s16 invert */
-    { AOUT_FMT_S16_IE, VLC_FOURCC('f','l','3','2'), S16InverttoFloat32 },
-    { AOUT_FMT_S16_IE, AOUT_FMT_S24_NE,             S16InverttoS24 },
-    { AOUT_FMT_S16_IE, AOUT_FMT_S24_IE,             S16InverttoS24Invert },
-    { AOUT_FMT_S16_IE, AOUT_FMT_S16_NE,             Swap16 },
-    { AOUT_FMT_S16_IE, AOUT_FMT_U16_NE,             S16InverttoU16 },
-    { AOUT_FMT_S16_IE, VLC_FOURCC('s','8',' ',' '), S16InverttoS8 },
-    { AOUT_FMT_S16_IE, VLC_FOURCC('u','8',' ',' '), S16InverttoU8 },
+    { VLC_CODEC_S16I, VLC_CODEC_FL32, S16InverttoFloat32 },
+    { VLC_CODEC_S16I, VLC_CODEC_S24N,             S16InverttoS24 },
+    { VLC_CODEC_S16I, VLC_CODEC_S24I,             S16InverttoS24Invert },
+    { VLC_CODEC_S16I, VLC_CODEC_S16N,             Swap16 },
+    { VLC_CODEC_S16I, VLC_CODEC_U16N,             S16InverttoU16 },
+    { VLC_CODEC_S16I, VLC_CODEC_S8, S16InverttoS8 },
+    { VLC_CODEC_S16I, VLC_CODEC_U8, S16InverttoU8 },
 
     /* From u16 invert */
-    { AOUT_FMT_U16_IE, VLC_FOURCC('f','l','3','2'), U16InverttoFloat32 },
-    { AOUT_FMT_U16_IE, AOUT_FMT_U16_NE,             Swap16 },
-    { AOUT_FMT_U16_IE, AOUT_FMT_S16_NE,             U16InverttoS16 },
-    { AOUT_FMT_U16_IE, VLC_FOURCC('s','8',' ',' '), U16InverttoS8 },
-    { AOUT_FMT_U16_IE, VLC_FOURCC('u','8',' ',' '), U16InverttoU8 },
+    { VLC_CODEC_U16I, VLC_CODEC_FL32, U16InverttoFloat32 },
+    { VLC_CODEC_U16I, VLC_CODEC_U16N,             Swap16 },
+    { VLC_CODEC_U16I, VLC_CODEC_S16N,             U16InverttoS16 },
+    { VLC_CODEC_U16I, VLC_CODEC_S8, U16InverttoS8 },
+    { VLC_CODEC_U16I, VLC_CODEC_U8, U16InverttoU8 },
 
     { 0, 0, NULL },
 };
index d0a2e351f3a9060cdc86d6f71cfbec24935741ea..7ec974e85377eecc08d0587b64a0d7c891244eff 100644 (file)
@@ -103,12 +103,12 @@ static int Open( vlc_object_t *p_this )
     int i_channels;
     aout_filter_sys_t *p_sys;
 
-    if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' ) ||
-        p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if( p_filter->input.i_format != VLC_CODEC_FL32 ||
+        p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         b_fit = false;
-        p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
-        p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
+        p_filter->input.i_format = VLC_CODEC_FL32;
+        p_filter->output.i_format = VLC_CODEC_FL32;
         msg_Warn( p_filter, "bad input or output format" );
     }
 
index b20a84a6e5a81212da79f5605d47e980e611d96b..fa8c19417a78e2dffd092e4cafb0751a472d0842 100644 (file)
@@ -110,12 +110,12 @@ static int Open( vlc_object_t *p_this )
     bool         b_fit = true;
     int                i_samplerate;
 
-    if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' ) ||
-        p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if( p_filter->input.i_format != VLC_CODEC_FL32 ||
+        p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         b_fit = false;
-        p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
-        p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
+        p_filter->input.i_format = VLC_CODEC_FL32;
+        p_filter->output.i_format = VLC_CODEC_FL32;
         msg_Warn( p_filter, "bad input or output format" );
     }
     if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
index 9ec0714af3e6f2fc64c4dc07b260b24b216210de..485f320150f86368c0ec538b9c6d4f7a03587ed5 100644 (file)
@@ -121,7 +121,7 @@ static int Create( vlc_object_t *p_this )
               != p_filter->output.i_physical_channels
           || p_filter->input.i_original_channels
               != p_filter->output.i_original_channels
-          || p_filter->input.i_format != VLC_FOURCC('f','l','3','2') )
+          || p_filter->input.i_format != VLC_CODEC_FL32 )
     {
         return VLC_EGENERIC;
     }
@@ -475,7 +475,7 @@ static int OpenFilter( vlc_object_t *p_this )
     int i_filter_wing;
 
     if( p_filter->fmt_in.audio.i_rate == p_filter->fmt_out.audio.i_rate ||
-        p_filter->fmt_in.i_codec != VLC_FOURCC('f','l','3','2') )
+        p_filter->fmt_in.i_codec != VLC_CODEC_FL32 )
     {
         return VLC_EGENERIC;
     }
index 161b754a0fd1da759487067833f9b305dc0179e2..41be20b4e1c362fe9a46f538c575777736c8c405 100644 (file)
@@ -90,7 +90,7 @@ static int Create( vlc_object_t *p_this )
               != p_filter->output.i_physical_channels
           || p_filter->input.i_original_channels
               != p_filter->output.i_original_channels
-          || p_filter->input.i_format != VLC_FOURCC('f','l','3','2') )
+          || p_filter->input.i_format != VLC_CODEC_FL32 )
     {
         return VLC_EGENERIC;
     }
@@ -248,7 +248,7 @@ static int OpenFilter( vlc_object_t *p_this )
     int i_out_rate  = p_filter->fmt_out.audio.i_rate;
 
     if( p_filter->fmt_in.audio.i_rate == p_filter->fmt_out.audio.i_rate ||
-        p_filter->fmt_in.i_codec != VLC_FOURCC('f','l','3','2') )
+        p_filter->fmt_in.i_codec != VLC_CODEC_FL32 )
     {
         return VLC_EGENERIC;
     }
index 75586041e7d12fe361eeab406bada93ecb21d993..16918681e19af08ea9e1f6d52e575cd35fa63fd9 100644 (file)
@@ -65,8 +65,8 @@ static int Create( vlc_object_t *p_this )
               != p_filter->output.i_physical_channels
           || p_filter->input.i_original_channels
               != p_filter->output.i_original_channels
-          || (p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-               && p_filter->input.i_format != VLC_FOURCC('f','i','3','2')) )
+          || (p_filter->input.i_format != VLC_CODEC_FL32
+               && p_filter->input.i_format != VLC_CODEC_FI32) )
     {
         return -1;
     }
index 28e38e7f76479a278c85b08eae5acbb140742e9f..059d0074c0e14a45225bc237486fc6205ed6eb4a 100644 (file)
@@ -65,8 +65,8 @@ static int Create( vlc_object_t *p_this )
               != p_filter->output.i_physical_channels
           || p_filter->input.i_original_channels
               != p_filter->output.i_original_channels
-          || (p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-               && p_filter->input.i_format != VLC_FOURCC('f','i','3','2')) )
+          || (p_filter->input.i_format != VLC_CODEC_FL32
+               && p_filter->input.i_format != VLC_CODEC_FI32) )
     {
         return VLC_EGENERIC;
     }
index a40435d45ee500213e1434230cfa2235f2aa65d3..3137bf1cd7468ce1233d7aba5f947aff4207b57a 100644 (file)
@@ -392,11 +392,11 @@ static int Open( vlc_object_t *p_this )
     aout_filter_sys_t *p_sys;
     bool b_fit = true;
 
-    if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' ) ||
-        p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if( p_filter->input.i_format != VLC_CODEC_FL32 ||
+        p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         b_fit = false;
-        p_filter->input.i_format = p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
+        p_filter->input.i_format = p_filter->output.i_format = VLC_CODEC_FL32;
         msg_Warn( p_filter, "bad input or output format" );
     }
     if( ! AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
index 2fbecc931444073a375ef2d5d3398bdb24f03b89..1e843c2256ea3c5597a8eac434099935275bf65a 100644 (file)
@@ -134,12 +134,12 @@ static int Open( vlc_object_t *p_this )
     bool         b_fit = true;
     msg_Dbg(p_this, "Opening filter spatializer %s %s %d", __FILE__,__func__,__LINE__);
 
-    if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' ) ||
-        p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if( p_filter->input.i_format != VLC_CODEC_FL32 ||
+        p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         b_fit = false;
-        p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
-        p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
+        p_filter->input.i_format = VLC_CODEC_FL32;
+        p_filter->output.i_format = VLC_CODEC_FL32;
         msg_Warn( p_filter, "bad input or output format" );
     }
     if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
index e3f905464dc6abe0d9c08edeed121d3a7970afec..474dd520a60c7621e04241f424d3d29f7c0822b2 100644 (file)
@@ -59,7 +59,7 @@ static int Create( vlc_object_t *p_this )
 {
     aout_instance_t * p_aout = (aout_instance_t *)p_this;
 
-    if ( p_aout->mixer.mixer.i_format != VLC_FOURCC('f','l','3','2') )
+    if ( p_aout->mixer.mixer.i_format != VLC_CODEC_FL32 )
     {
         return -1;
     }
index 2512981ae52ce5f94e2b7452b5da8d9673c4bf74..3cdd04c16c19b049f15ccdf91ad2d4d2a8a60d4f 100644 (file)
@@ -59,8 +59,8 @@ static int Create( vlc_object_t *p_this )
 {
     aout_instance_t * p_aout = (aout_instance_t *)p_this;
 
-    if ( p_aout->mixer.mixer.i_format != VLC_FOURCC('f','l','3','2')
-          && p_aout->mixer.mixer.i_format != VLC_FOURCC('f','i','3','2') )
+    if ( p_aout->mixer.mixer.i_format != VLC_CODEC_FL32
+          && p_aout->mixer.mixer.i_format != VLC_CODEC_FI32 )
     {
         return -1;
     }
index 2d03d1da2785dfa25057dc5e41d1b0bfad11d44e..fb2f45c1aae6e7555cd09d2c27a7e54b8198d03d 100644 (file)
@@ -360,12 +360,12 @@ static int Open( vlc_object_t *p_this )
        and float32) */
     if( vlc_CPU() & CPU_CAPABILITY_FPU )
     {
-        i_vlc_pcm_format = VLC_FOURCC('f','l','3','2');
+        i_vlc_pcm_format = VLC_CODEC_FL32;
         i_snd_pcm_format = SND_PCM_FORMAT_FLOAT;
     }
     else
     {
-        i_vlc_pcm_format = AOUT_FMT_S16_NE;
+        i_vlc_pcm_format = VLC_CODEC_S16N;
         i_snd_pcm_format = SND_PCM_FORMAT_S16;
     }
 
@@ -442,7 +442,7 @@ static int Open( vlc_object_t *p_this )
         i_snd_pcm_format = SND_PCM_FORMAT_S16;
         i_channels = 2;
 
-        i_vlc_pcm_format = VLC_FOURCC('s','p','d','i');
+        i_vlc_pcm_format = VLC_CODEC_SPDIFL;
         p_aout->output.i_nb_samples = i_period_size = ALSA_SPDIF_PERIOD_SIZE;
         p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
         p_aout->output.output.i_frame_length = A52_FRAME_NB;
@@ -540,14 +540,14 @@ static int Open( vlc_object_t *p_this )
                 goto error;
             }
         }
-        if( i_vlc_pcm_format != VLC_FOURCC('s','p','d','i') )
+        if( i_vlc_pcm_format != VLC_CODEC_SPDIFL )
         switch( i_snd_pcm_format )
         {
         case SND_PCM_FORMAT_FLOAT:
-            i_vlc_pcm_format = VLC_FOURCC('f','l','3','2');
+            i_vlc_pcm_format = VLC_CODEC_FL32;
             break;
         case SND_PCM_FORMAT_S16:
-            i_vlc_pcm_format = AOUT_FMT_S16_NE;
+            i_vlc_pcm_format = VLC_CODEC_S16N;
             break;
         }
         p_aout->output.output.i_format = i_vlc_pcm_format;
@@ -624,7 +624,7 @@ static int Open( vlc_object_t *p_this )
             {
                 b_retry = true;
                 i_snd_pcm_format = SND_PCM_FORMAT_S16;
-                p_aout->output.output.i_format = AOUT_FMT_S16_NE;
+                p_aout->output.output.i_format = VLC_CODEC_S16N;
                 msg_Warn( p_aout, "unable to commit hardware configuration "
                                   "with fl32 samples. Retrying with s16l (%s)",                                     snd_strerror( i_snd_rc ) );
             }
@@ -865,7 +865,7 @@ static void ALSAFill( aout_instance_t * p_aout )
     }
 
     p_buffer = aout_OutputNextBuffer( p_aout, next_date,
-           (p_aout->output.output.i_format ==  VLC_FOURCC('s','p','d','i')) );
+           (p_aout->output.output.i_format ==  VLC_CODEC_SPDIFL) );
 
     /* Audio output buffer shortage -> stop the fill process and wait */
     if( p_buffer == NULL )
index 1effe5b26b1c03d000378273b41c9594a36b543b..edb438cbd5208ee02e61d440565d4562d10a731d 100644 (file)
@@ -513,7 +513,7 @@ static int OpenAnalog( aout_instance_t *p_aout )
     DeviceFormat.mFormatID = kAudioFormatLinearPCM;
 
     /* We use float 32. It's the best supported format by both VLC and Coreaudio */
-    p_aout->output.output.i_format = VLC_FOURCC( 'f','l','3','2');
+    p_aout->output.output.i_format = VLC_CODEC_FL32;
     DeviceFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
     DeviceFormat.mBitsPerChannel = 32;
     DeviceFormat.mChannelsPerFrame = aout_FormatNbChannels( &p_aout->output.output );
@@ -768,9 +768,9 @@ static int OpenSPDIF( aout_instance_t * p_aout )
 
     /* Set the format flags */
     if( p_sys->stream_format.mFormatFlags & kAudioFormatFlagIsBigEndian )
-        p_aout->output.output.i_format = VLC_FOURCC('s','p','d','b');
+        p_aout->output.output.i_format = VLC_CODEC_SPDIFB;
     else
-        p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i');
+        p_aout->output.output.i_format = VLC_CODEC_SPDIFL;
     p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
     p_aout->output.output.i_frame_length = A52_FRAME_NB;
     p_aout->output.i_nb_samples = p_aout->output.output.i_frame_length;
index c05d3cbdd0efc3c0cace60cc9188dd98b55bd7be..98ce3147fd48389ba0678edc5d1e3cfc7ce96ac2 100644 (file)
@@ -331,7 +331,7 @@ static int OpenAudio( vlc_object_t *p_this )
     /* Open the device */
     if( val.i_int == AOUT_VAR_SPDIF )
     {
-        p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i');
+        p_aout->output.output.i_format = VLC_CODEC_SPDIFL;
 
         /* Calculate the frame size in bytes */
         p_aout->output.i_nb_samples = A52_FRAME_NB;
@@ -340,7 +340,7 @@ static int OpenAudio( vlc_object_t *p_this )
         p_aout->output.p_sys->i_frame_size =
             p_aout->output.output.i_bytes_per_frame;
 
-        if( CreateDSBuffer( p_aout, VLC_FOURCC('s','p','d','i'),
+        if( CreateDSBuffer( p_aout, VLC_CODEC_SPDIFL,
                             p_aout->output.output.i_physical_channels,
                             aout_FormatNbChannels( &p_aout->output.output ),
                             p_aout->output.output.i_rate,
@@ -647,7 +647,7 @@ static void Probe( aout_instance_t * p_aout )
     /* Test for SPDIF support */
     if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
     {
-        if( CreateDSBuffer( p_aout, VLC_FOURCC('s','p','d','i'),
+        if( CreateDSBuffer( p_aout, VLC_CODEC_SPDIFL,
                             p_aout->output.output.i_physical_channels,
                             aout_FormatNbChannels( &p_aout->output.output ),
                             p_aout->output.output.i_rate,
@@ -870,7 +870,7 @@ static int CreateDSBuffer( aout_instance_t *p_aout, int i_format,
 
     switch( i_format )
     {
-    case VLC_FOURCC('s','p','d','i'):
+    case VLC_CODEC_SPDIFL:
         i_nb_channels = 2;
         /* To prevent channel re-ordering */
         waveformat.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
@@ -881,7 +881,7 @@ static int CreateDSBuffer( aout_instance_t *p_aout, int i_format,
         waveformat.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
         break;
 
-    case VLC_FOURCC('f','l','3','2'):
+    case VLC_CODEC_FL32:
         waveformat.Format.wBitsPerSample = sizeof(float) * 8;
         waveformat.Samples.wValidBitsPerSample =
             waveformat.Format.wBitsPerSample;
@@ -889,7 +889,7 @@ static int CreateDSBuffer( aout_instance_t *p_aout, int i_format,
         waveformat.SubFormat = _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
         break;
 
-    case VLC_FOURCC('s','1','6','l'):
+    case VLC_CODEC_S16L:
         waveformat.Format.wBitsPerSample = 16;
         waveformat.Samples.wValidBitsPerSample =
             waveformat.Format.wBitsPerSample;
@@ -991,12 +991,12 @@ static int CreateDSBufferPCM( aout_instance_t *p_aout, int *i_format,
     /* Float32 audio samples are not supported for 5.1 output on the emu101k */
     if( !var_GetBool( p_aout, "directx-audio-float32" ) ||
         i_nb_channels > 2 ||
-        CreateDSBuffer( p_aout, VLC_FOURCC('f','l','3','2'),
+        CreateDSBuffer( p_aout, VLC_CODEC_FL32,
                         i_channels, i_nb_channels, i_rate,
                         FRAME_SIZE * 4 * i_nb_channels, b_probe )
         != VLC_SUCCESS )
     {
-        if ( CreateDSBuffer( p_aout, VLC_FOURCC('s','1','6','l'),
+        if ( CreateDSBuffer( p_aout, VLC_CODEC_S16L,
                              i_channels, i_nb_channels, i_rate,
                              FRAME_SIZE * 2 * i_nb_channels, b_probe )
              != VLC_SUCCESS )
@@ -1005,13 +1005,13 @@ static int CreateDSBufferPCM( aout_instance_t *p_aout, int *i_format,
         }
         else
         {
-            *i_format = VLC_FOURCC('s','1','6','l');
+            *i_format = VLC_CODEC_S16L;
             return VLC_SUCCESS;
         }
     }
     else
     {
-        *i_format = VLC_FOURCC('f','l','3','2');
+        *i_format = VLC_CODEC_FL32;
         return VLC_SUCCESS;
     }
 }
@@ -1117,7 +1117,7 @@ static void* DirectSoundThread( vlc_object_t *p_this )
     int canc = vlc_savecancel ();
 
     /* We don't want any resampling when using S/PDIF output */
-    b_sleek = p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i');
+    b_sleek = p_aout->output.output.i_format == VLC_CODEC_SPDIFL;
 
     msg_Dbg( p_notif, "DirectSoundThread ready" );
 
index f6f851aa436c976444c80f1d8ed5e6adf7f536ad..cb9bc0c8897ab001d86caf46a1f60439f4d86e13 100644 (file)
@@ -95,16 +95,16 @@ static void    Play        ( aout_instance_t * );
 static const char *const format_list[] = { "u8", "s8", "u16", "s16", "u16_le",
                                      "s16_le", "u16_be", "s16_be", "fixed32",
                                      "float32", "spdif" };
-static const int format_int[] = { VLC_FOURCC('u','8',' ',' '),
-                                  VLC_FOURCC('s','8',' ',' '),
-                                  AOUT_FMT_U16_NE, AOUT_FMT_S16_NE,
-                                  VLC_FOURCC('u','1','6','l'),
-                                  VLC_FOURCC('s','1','6','l'),
-                                  VLC_FOURCC('u','1','6','b'),
-                                  VLC_FOURCC('s','1','6','b'),
-                                  VLC_FOURCC('f','i','3','2'),
-                                  VLC_FOURCC('f','l','3','2'),
-                                  VLC_FOURCC('s','p','i','f') };
+static const int format_int[] = { VLC_CODEC_U8,
+                                  VLC_CODEC_S8,
+                                  VLC_CODEC_U16N, VLC_CODEC_S16N,
+                                  VLC_CODEC_U16L,
+                                  VLC_CODEC_S16L,
+                                  VLC_CODEC_U16B,
+                                  VLC_CODEC_S16B,
+                                  VLC_CODEC_FI32,
+                                  VLC_CODEC_FL32,
+                                  VLC_CODEC_SPDIFL };
 
 #define FILE_TEXT N_("Output file")
 #define FILE_LONGTEXT N_("File to which the audio samples will be written to. (\"-\" for stdout")
@@ -227,15 +227,15 @@ static int Open( vlc_object_t * p_this )
 
         switch( p_aout->output.output.i_format )
         {
-        case VLC_FOURCC('f','l','3','2'):
+        case VLC_CODEC_FL32:
             wh->Format     = WAVE_FORMAT_IEEE_FLOAT;
             wh->BitsPerSample = sizeof(float) * 8;
             break;
-        case VLC_FOURCC('u','8',' ',' '):
+        case VLC_CODEC_U8:
             wh->Format     = WAVE_FORMAT_PCM;
             wh->BitsPerSample = 8;
             break;
-        case VLC_FOURCC('s','1','6','l'):
+        case VLC_CODEC_S16L:
         default:
             wh->Format     = WAVE_FORMAT_PCM;
             wh->BitsPerSample = 16;
index 78a77d1cba7e0d3ea85d5b06ad594884c0fe7ab0..1b736dabc2c5871f82d57bd8cde12cf097f2e4cd 100644 (file)
@@ -156,7 +156,7 @@ static int Open( vlc_object_t * p_this )
         }
     }
 
-    p_aout->output.output.i_format = AOUT_FMT_S16_NE;
+    p_aout->output.output.i_format = VLC_CODEC_S16N;
     p_aout->output.i_nb_samples = FRAME_SIZE;
     p_aout->output.output.i_physical_channels
             = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
index aeb203fc0a7e51cd67225e6c0f4ce60fb136fdac..db5d0445b452a800602f16248da8097c2c69c97e 100644 (file)
@@ -131,7 +131,7 @@ static int Open( vlc_object_t *p_this )
     aout_VolumeSoftInit( p_aout );
 
     /* JACK only supports fl32 format */
-    p_aout->output.output.i_format = VLC_FOURCC('f','l','3','2');
+    p_aout->output.output.i_format = VLC_CODEC_FL32;
     // TODO add buffer size callback
     p_aout->output.i_nb_samples = jack_get_buffer_size( p_sys->p_jack_client );
     p_aout->output.output.i_rate = jack_get_sample_rate( p_sys->p_jack_client );
index e6154656b84ac97a154c986a5aa9e0bc8df69930..6ee0688655bd63e73786d86170262f0b672fc5da 100644 (file)
@@ -326,11 +326,11 @@ static int Open( vlc_object_t *p_this )
 
     if ( val.i_int == AOUT_VAR_SPDIF )
     {
-        p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i');
+        p_aout->output.output.i_format = VLC_CODEC_SPDIFL;
     }
     else if ( val.i_int == AOUT_VAR_5_1 )
     {
-        p_aout->output.output.i_format = AOUT_FMT_S16_NE;
+        p_aout->output.output.i_format = VLC_CODEC_S16N;
         p_aout->output.output.i_physical_channels
             = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
                | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
@@ -338,20 +338,20 @@ static int Open( vlc_object_t *p_this )
     }
     else if ( val.i_int == AOUT_VAR_2F2R )
     {
-        p_aout->output.output.i_format = AOUT_FMT_S16_NE;
+        p_aout->output.output.i_format = VLC_CODEC_S16N;
         p_aout->output.output.i_physical_channels
             = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
                | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
     }
     else if ( val.i_int == AOUT_VAR_STEREO )
     {
-        p_aout->output.output.i_format = AOUT_FMT_S16_NE;
+        p_aout->output.output.i_format = VLC_CODEC_S16N;
         p_aout->output.output.i_physical_channels
             = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
     }
     else if ( val.i_int == AOUT_VAR_MONO )
     {
-        p_aout->output.output.i_format = AOUT_FMT_S16_NE;
+        p_aout->output.output.i_format = VLC_CODEC_S16N;
         p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER;
     }
     else
@@ -388,7 +388,7 @@ static int Open( vlc_object_t *p_this )
             return VLC_EGENERIC;
         }
 
-        p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i');
+        p_aout->output.output.i_format = VLC_CODEC_SPDIFL;
         p_aout->output.i_nb_samples = A52_FRAME_NB;
         p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
         p_aout->output.output.i_frame_length = A52_FRAME_NB;
@@ -415,22 +415,22 @@ static int Open( vlc_object_t *p_this )
         switch ( i_format )
         {
         case AFMT_U8:
-            p_aout->output.output.i_format = VLC_FOURCC('u','8',' ',' ');
+            p_aout->output.output.i_format = VLC_CODEC_U8;
             break;
         case AFMT_S8:
-            p_aout->output.output.i_format = VLC_FOURCC('s','8',' ',' ');
+            p_aout->output.output.i_format = VLC_CODEC_S8;
             break;
         case AFMT_U16_LE:
-            p_aout->output.output.i_format = VLC_FOURCC('u','1','6','l');
+            p_aout->output.output.i_format = VLC_CODEC_U16L;
             break;
         case AFMT_S16_LE:
-            p_aout->output.output.i_format = VLC_FOURCC('s','1','6','l');
+            p_aout->output.output.i_format = VLC_CODEC_S16L;
             break;
         case AFMT_U16_BE:
-            p_aout->output.output.i_format = VLC_FOURCC('u','1','6','b');
+            p_aout->output.output.i_format = VLC_CODEC_U16B;
             break;
         case AFMT_S16_BE:
-            p_aout->output.output.i_format = VLC_FOURCC('s','1','6','b');
+            p_aout->output.output.i_format = VLC_CODEC_S16B;
             break;
         default:
             msg_Err( p_aout, "OSS fell back to an unknown format (%d)",
@@ -598,7 +598,7 @@ static void* OSSThread( vlc_object_t *p_this )
         int i_tmp, i_size;
         uint8_t * p_bytes;
 
-        if ( p_aout->output.output.i_format != VLC_FOURCC('s','p','d','i') )
+        if ( p_aout->output.output.i_format != VLC_CODEC_SPDIFL )
         {
             mtime_t buffered = BufferDuration( p_aout );
 
index f73ce9bf7eacfdebcb4814eedb5934e40f30757b..9611a22c80407d5220f80f8cc9e1f560cdd3df98 100644 (file)
@@ -434,7 +434,7 @@ static int PAOpenDevice( aout_instance_t *p_aout )
     }
 
     /* Audio format is paFloat32 (always supported by portaudio v19) */
-    p_aout->output.output.i_format = VLC_FOURCC('f','l','3','2');
+    p_aout->output.output.i_format = VLC_CODEC_FL32;
 
     return VLC_SUCCESS;
 
index 86bd6dd4c7d2d7626ec05a99dbd7d72484ed455b..bacd55ca2343ebe32be8f12aef1e09732acc31d3 100644 (file)
@@ -169,7 +169,7 @@ static int Open ( vlc_object_t *p_this )
 
     ss.rate = p_aout->output.output.i_rate;
     ss.format = PA_SAMPLE_FLOAT32NE;
-    p_aout->output.output.i_format = VLC_FOURCC('f','l','3','2');
+    p_aout->output.output.i_format = VLC_CODEC_FL32;
 
     if (!pa_sample_spec_valid(&ss)) {
         msg_Err(p_aout,"Invalid sample spec");
index 10d6eb7f7257c894ce639814072625b9a7f82799..f8425fadb948574d1eeb4facb8cc97de49cc2585 100644 (file)
@@ -151,17 +151,17 @@ static int Open ( vlc_object_t *p_this )
     switch ( obtained.format )
     {
     case AUDIO_S16LSB:
-        p_aout->output.output.i_format = VLC_FOURCC('s','1','6','l'); break;
+        p_aout->output.output.i_format = VLC_CODEC_S16L; break;
     case AUDIO_S16MSB:
-        p_aout->output.output.i_format = VLC_FOURCC('s','1','6','b'); break;
+        p_aout->output.output.i_format = VLC_CODEC_S16B; break;
     case AUDIO_U16LSB:
-        p_aout->output.output.i_format = VLC_FOURCC('u','1','6','l'); break;
+        p_aout->output.output.i_format = VLC_CODEC_U16L; break;
     case AUDIO_U16MSB:
-        p_aout->output.output.i_format = VLC_FOURCC('u','1','6','b'); break;
+        p_aout->output.output.i_format = VLC_CODEC_U16B; break;
     case AUDIO_S8:
-        p_aout->output.output.i_format = VLC_FOURCC('s','8',' ',' '); break;
+        p_aout->output.output.i_format = VLC_CODEC_S8; break;
     case AUDIO_U8:
-        p_aout->output.output.i_format = VLC_FOURCC('u','8',' ',' '); break;
+        p_aout->output.output.i_format = VLC_CODEC_U8; break;
     }
     /* Volume is entirely done in software. */
     aout_VolumeSoftInit( p_aout );
index 8bea3e34959b44a42524d3466b5b99a04fec0439..27f2561f4bf6c44d7b62a411529c86a4ef338635 100644 (file)
@@ -313,11 +313,11 @@ static int Open( vlc_object_t *p_this )
     /* Open the device */
     if( val.i_int == AOUT_VAR_SPDIF )
     {
-        p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i');
+        p_aout->output.output.i_format = VLC_CODEC_SPDIFL;
 
         if( OpenWaveOut( p_aout,
                          p_aout->output.p_sys->i_wave_device_id,
-                         VLC_FOURCC('s','p','d','i'),
+                         VLC_CODEC_SPDIFL,
                          p_aout->output.output.i_physical_channels,
                          aout_FormatNbChannels( &p_aout->output.output ),
                          p_aout->output.output.i_rate, false )
@@ -539,7 +539,7 @@ static void Probe( aout_instance_t * p_aout )
     {
         if( OpenWaveOut( p_aout,
                          p_aout->output.p_sys->i_wave_device_id,
-                         VLC_FOURCC('s','p','d','i'),
+                         VLC_CODEC_SPDIFL,
                          p_aout->output.output.i_physical_channels,
                          aout_FormatNbChannels( &p_aout->output.output ),
                          p_aout->output.output.i_rate, true )
@@ -692,7 +692,7 @@ static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_for
 
     switch( i_format )
     {
-    case VLC_FOURCC('s','p','d','i'):
+    case VLC_CODEC_SPDIFL:
         i_nb_channels = 2;
         /* To prevent channel re-ordering */
         waveformat.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
@@ -703,7 +703,7 @@ static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_for
         waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
         break;
 
-    case VLC_FOURCC('f','l','3','2'):
+    case VLC_CODEC_FL32:
         waveformat.Format.wBitsPerSample = sizeof(float) * 8;
         waveformat.Samples.wValidBitsPerSample =
             waveformat.Format.wBitsPerSample;
@@ -711,7 +711,7 @@ static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_for
         waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
         break;
 
-    case VLC_FOURCC('s','1','6','l'):
+    case VLC_CODEC_S16L:
         waveformat.Format.wBitsPerSample = 16;
         waveformat.Samples.wValidBitsPerSample =
             waveformat.Format.wBitsPerSample;
@@ -809,11 +809,11 @@ static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id, int *i
 {
     bool b_use_float32 = var_CreateGetBool( p_aout, "waveout-float32");
 
-    if( !b_use_float32 || OpenWaveOut( p_aout, i_device_id, VLC_FOURCC('f','l','3','2'),
+    if( !b_use_float32 || OpenWaveOut( p_aout, i_device_id, VLC_CODEC_FL32,
                                    i_channels, i_nb_channels, i_rate, b_probe )
         != VLC_SUCCESS )
     {
-        if ( OpenWaveOut( p_aout, i_device_id, VLC_FOURCC('s','1','6','l'),
+        if ( OpenWaveOut( p_aout, i_device_id, VLC_CODEC_S16L,
                           i_channels, i_nb_channels, i_rate, b_probe )
              != VLC_SUCCESS )
         {
@@ -821,13 +821,13 @@ static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id, int *i
         }
         else
         {
-            *i_format = VLC_FOURCC('s','1','6','l');
+            *i_format = VLC_CODEC_S16L;
             return VLC_SUCCESS;
         }
     }
     else
     {
-        *i_format = VLC_FOURCC('f','l','3','2');
+        *i_format = VLC_CODEC_FL32;
         return VLC_SUCCESS;
     }
 }
@@ -982,7 +982,7 @@ static void* WaveOutThread( vlc_object_t *p_this )
     int canc = vlc_savecancel ();
 
     /* We don't want any resampling when using S/PDIF */
-    b_sleek = p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i');
+    b_sleek = p_aout->output.output.i_format == VLC_CODEC_SPDIFL;
 
     // wait for first call to "play()"
     while( !p_sys->start_date && vlc_object_alive (p_aout) )
index 474a1d0063f6498f8001ea0b3067785b34ab6c64..38c7d7cca1942ea28ead8527f4f6bcef4b7754e8 100644 (file)
@@ -114,16 +114,15 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
 
     switch( p_dec->fmt_in.i_codec )
     {
-    case VLC_FOURCC('a','5','2',' '):
-    case VLC_FOURCC('a','5','2','b'):
-        i_codec = VLC_FOURCC('a','5','2',' ');
+    case VLC_CODEC_A52:
+        i_codec = VLC_CODEC_A52;
         break;
-    case VLC_FOURCC('e','a','c','3'):
+    case VLC_CODEC_EAC3:
         /* XXX ugly hack, a52 does not support eac3 so no eac3 pass-through
          * support */
         if( !b_packetizer )
             return VLC_EGENERIC;
-        i_codec = VLC_FOURCC('e','a','c','3');
+        i_codec = VLC_CODEC_EAC3;
         break;
     default:
         return VLC_EGENERIC;
index d62cdaa5bffc305d03fbdf33994821f577ba1a4c..61f749fd107757f2707d549a3aef976092332d46 100644 (file)
@@ -247,7 +247,7 @@ static int OpenDecoder( vlc_object_t *p_this )
              p_sys->i_samplesperblock );
 
     p_dec->fmt_out.i_cat = AUDIO_ES;
-    p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
+    p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
     p_dec->fmt_out.audio.i_rate = p_dec->fmt_in.audio.i_rate;
     p_dec->fmt_out.audio.i_channels = p_dec->fmt_in.audio.i_channels;
     p_dec->fmt_out.audio.i_physical_channels =
index 986fa787cd5923c81e965d47fa8e3980c96a0bee..e1fd62656bb20c6707e1769e7e1105728eaf7022 100644 (file)
@@ -233,7 +233,7 @@ static int Open( decoder_t *p_dec, bool b_packetizer )
 {
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('a','e','s','3') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_302M )
         return VLC_EGENERIC;
 
     /* Allocate the memory needed to store the decoder's structure */
@@ -253,7 +253,7 @@ static int Open( decoder_t *p_dec, bool b_packetizer )
     /* Set callback */
     if( b_packetizer )
     {
-        p_dec->fmt_out.i_codec = VLC_FOURCC('a','e','s','3');
+        p_dec->fmt_out.i_codec = VLC_CODEC_302M;
 
         p_dec->pf_decode_audio = NULL;
         p_dec->pf_packetize    = Packetize;
@@ -345,7 +345,7 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
     }
     else
     {
-        p_dec->fmt_out.i_codec = i_bits == 16 ? VLC_FOURCC('s','1','6','l') : VLC_FOURCC('s','2','4','l');
+        p_dec->fmt_out.i_codec = i_bits == 16 ? VLC_CODEC_S16L : VLC_CODEC_S24L;
         p_dec->fmt_out.audio.i_bitspersample = i_bits == 16 ? 16 : 24;
     }
 
index 7a5ec825eb6e065671e49f17184cc1aee4534cf2..4196a9ce129519c0efc9765cdca40d7f4a64dbec 100644 (file)
@@ -188,23 +188,19 @@ static int DecoderOpen( vlc_object_t *p_this )
     /* _signed_ little endian samples (mov)*/
     case VLC_FOURCC('s','o','w','t'):
 
-    case VLC_FOURCC('a','l','a','w'):
-    case VLC_FOURCC('u','l','a','w'):
-    case VLC_FOURCC('m','l','a','w'):
-
-    case VLC_FOURCC('f','l','6','4'):
-    case VLC_FOURCC('f','l','3','2'):
-    case VLC_FOURCC('s','3','2','l'):
-    case VLC_FOURCC('s','3','2','b'):
-    case VLC_FOURCC('s','2','4','l'):
-    case VLC_FOURCC('s','2','4','b'):
-    case VLC_FOURCC('s','1','6','l'):
-    case VLC_FOURCC('s','1','6','b'):
-    case VLC_FOURCC('s','8',' ',' '):
-    case VLC_FOURCC('u','8',' ',' '):
-    case VLC_FOURCC('i','n','2','4'): /* Quicktime in24, bigendian int24 */
-    case VLC_FOURCC('4','2','n','i'): /* Quicktime in24, little-endian int24 */
-    case VLC_FOURCC('i','n','3','2'): /* Quicktime in32, bigendian int32 */
+    case VLC_CODEC_ALAW:
+    case VLC_CODEC_MULAW:
+
+    case VLC_CODEC_FL64:
+    case VLC_CODEC_FL32:
+    case VLC_CODEC_S32L:
+    case VLC_CODEC_S32B:
+    case VLC_CODEC_S24L:
+    case VLC_CODEC_S24B:
+    case VLC_CODEC_S16L:
+    case VLC_CODEC_S16B:
+    case VLC_CODEC_S8:
+    case VLC_CODEC_U8:
         break;
 
     default:
@@ -236,150 +232,63 @@ static int DecoderOpen( vlc_object_t *p_this )
              p_dec->fmt_in.audio.i_rate, p_dec->fmt_in.audio.i_channels,
              p_dec->fmt_in.audio.i_bitspersample );
 
-    if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'f', 'l', '6', '4' ) )
+    if( p_dec->fmt_in.i_codec == VLC_CODEC_FL64 )
     {
         p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec;
         p_dec->fmt_in.audio.i_bitspersample = 64;
     }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'f', 'l', '3', '2' ) )
+    else if( p_dec->fmt_in.i_codec == VLC_CODEC_FL32 )
     {
         p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec;
         p_dec->fmt_in.audio.i_bitspersample = 32;
     }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '3', '2', 'l' ) ||
-             p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '3', '2', 'b' ) )
+    else if( p_dec->fmt_in.i_codec == VLC_CODEC_S32L ||
+             p_dec->fmt_in.i_codec == VLC_CODEC_S32B )
     {
         p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec;
         p_dec->fmt_in.audio.i_bitspersample = 32;
     }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'i', 'n', '3', '2' ) )
-    {
-        /* FIXME: mplayer uses bigendian for in24 .... but here it works
-         * with little endian ... weird */
-        p_dec->fmt_out.i_codec = VLC_FOURCC( 's', '3', '2', 'l' );
-        p_dec->fmt_in.audio.i_bitspersample = 32;
-    }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '2', '4', 'l' ) ||
-             p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '2', '4', 'b' ) )
+    else if( p_dec->fmt_in.i_codec == VLC_CODEC_S24L ||
+             p_dec->fmt_in.i_codec == VLC_CODEC_S24B )
     {
         p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec;
         p_dec->fmt_in.audio.i_bitspersample = 24;
     }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'i', 'n', '2', '4' ) )
-    {
-        p_dec->fmt_out.i_codec = VLC_FOURCC( 's', '2', '4', 'b' );
-        p_dec->fmt_in.audio.i_bitspersample = 24;
-    }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( '4', '2', 'n', 'i' ) )
-    {
-        p_dec->fmt_out.i_codec = VLC_FOURCC( 's', '2', '4', 'l' );
-        p_dec->fmt_in.audio.i_bitspersample = 24;
-    }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '1', '6', 'l' ) ||
-             p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '1', '6', 'b' ) )
+    else if( p_dec->fmt_in.i_codec == VLC_CODEC_S16L ||
+             p_dec->fmt_in.i_codec == VLC_CODEC_S16B )
     {
         p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec;
         p_dec->fmt_in.audio.i_bitspersample = 16;
     }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 's', '8', ' ', ' ' ) ||
-             p_dec->fmt_in.i_codec == VLC_FOURCC( 'u', '8', ' ', ' ' ) )
+    else if( p_dec->fmt_in.i_codec == VLC_CODEC_S8 ||
+             p_dec->fmt_in.i_codec == VLC_CODEC_U8 )
     {
         p_dec->fmt_out.i_codec = p_dec->fmt_in.i_codec;
         p_dec->fmt_in.audio.i_bitspersample = 8;
     }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'f', 'l', 't' ) )
+    else if( p_dec->fmt_in.i_codec == VLC_CODEC_ALAW )
     {
-        switch( ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8 )
-        {
-        case 4:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
-            break;
-        case 8:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','6','4');
-            break;
-        default:
-            msg_Err( p_dec, "bad parameters(bits/sample)" );
-            return VLC_EGENERIC;
-        }
-    }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'r', 'a', 'w' ) ||
-             p_dec->fmt_in.i_codec == VLC_FOURCC( 'p', 'c', 'm', ' ' ) )
-    {
-        switch( ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8 )
-        {
-        case 1:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('u','8',' ',' ');
-            break;
-        case 2:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','1','6','l');
-            break;
-        case 3:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','2','4','l');
-            break;
-        case 4:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','3','2','l');
-            break;
-        default:
-            msg_Err( p_dec, "bad parameters(bits/sample)" );
-            return VLC_EGENERIC;
-        }
+        p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
+        p_sys->p_logtos16  = alawtos16;
+        p_dec->fmt_in.audio.i_bitspersample = 8;
     }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 't', 'w', 'o', 's' ) )
+    else if( p_dec->fmt_in.i_codec == VLC_CODEC_MULAW )
     {
-        switch( ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8 )
-        {
-        case 1:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','8',' ',' ');
-            break;
-        case 2:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','1','6','b');
-            break;
-        case 3:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','2','4','b');
-            break;
-        case 4:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','3','2','b');
-            break;
-        default:
-            msg_Err( p_dec, "bad parameters(bits/sample)" );
-            return VLC_EGENERIC;
-        }
+        p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
+        p_sys->p_logtos16  = ulawtos16;
+        p_dec->fmt_in.audio.i_bitspersample = 8;
     }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 's', 'o', 'w', 't' ) )
+    else
     {
-        switch( ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8 )
+        p_dec->fmt_out.i_codec =
+            vlc_fourcc_GetCodecAudio( p_dec->fmt_in.i_codec,
+                                      p_dec->fmt_in.audio.i_bitspersample );
+        if( !p_dec->fmt_out.i_codec )
         {
-        case 1:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','8',' ',' ');
-            break;
-        case 2:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','1','6','l');
-            break;
-        case 3:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','2','4','l');
-            break;
-        case 4:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','3','2','l');
-            break;
-        default:
             msg_Err( p_dec, "bad parameters(bits/sample)" );
             return VLC_EGENERIC;
         }
     }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'l', 'a', 'w' ) )
-    {
-        p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
-        p_sys->p_logtos16  = alawtos16;
-        p_dec->fmt_in.audio.i_bitspersample = 8;
-    }
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'u', 'l', 'a', 'w' ) ||
-             p_dec->fmt_in.i_codec == VLC_FOURCC( 'm', 'l', 'a', 'w' ) )
-    {
-        p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
-        p_sys->p_logtos16  = ulawtos16;
-        p_dec->fmt_in.audio.i_bitspersample = 8;
-    }
-    else return VLC_EGENERIC;
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
@@ -396,9 +305,8 @@ static int DecoderOpen( vlc_object_t *p_this )
         p_dec->fmt_out.audio.i_original_channels =
             p_dec->fmt_in.audio.i_original_channels;
 
-    if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'l', 'a', 'w' ) ||
-        p_dec->fmt_in.i_codec == VLC_FOURCC( 'u', 'l', 'a', 'w' ) ||
-        p_dec->fmt_in.i_codec == VLC_FOURCC( 'm', 'l', 'a', 'w' ) )
+    if( p_dec->fmt_in.i_codec == VLC_CODEC_ALAW ||
+        p_dec->fmt_in.i_codec == VLC_CODEC_MULAW )
     {
         p_dec->fmt_out.audio.i_bitspersample = 16;
     }
@@ -1378,40 +1286,37 @@ static int EncoderOpen( vlc_object_t *p_this )
     encoder_t *p_enc = (encoder_t *)p_this;
     encoder_sys_t *p_sys;
 
-    if( p_enc->fmt_out.i_codec == VLC_FOURCC('u','8',' ',' ') ||
-        p_enc->fmt_out.i_codec == VLC_FOURCC('s','8',' ',' ') ||
-        p_enc->fmt_out.i_codec == VLC_FOURCC('a','l','a','w') ||
-        p_enc->fmt_out.i_codec == VLC_FOURCC('u','l','a','w') ||
-        p_enc->fmt_out.i_codec == VLC_FOURCC('m','l','a','w'))
+    if( p_enc->fmt_out.i_codec == VLC_CODEC_U8 ||
+        p_enc->fmt_out.i_codec == VLC_CODEC_S8 ||
+        p_enc->fmt_out.i_codec == VLC_CODEC_ALAW ||
+        p_enc->fmt_out.i_codec == VLC_CODEC_MULAW)
     {
         p_enc->fmt_out.audio.i_bitspersample = 8;
     }
-    else if( p_enc->fmt_out.i_codec == VLC_FOURCC('u','1','6','l') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('u','1','6','b') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('s','1','6','l') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('s','1','6','b') )
+    else if( p_enc->fmt_out.i_codec == VLC_CODEC_U16L ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_U16B ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_S16L ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_S16B )
     {
         p_enc->fmt_out.audio.i_bitspersample = 16;
     }
-    else if( p_enc->fmt_out.i_codec == VLC_FOURCC('u','2','4','l') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('u','2','4','b') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('s','2','4','l') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('s','2','4','b') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('i','n','2','4') )
+    else if( p_enc->fmt_out.i_codec == VLC_CODEC_U24L ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_U24B ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_S24L ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_S24B )
     {
         p_enc->fmt_out.audio.i_bitspersample = 24;
     }
-    else if( p_enc->fmt_out.i_codec == VLC_FOURCC('u','3','2','l') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('u','3','2','b') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('s','3','2','l') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('s','3','2','b') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('i','n','3','2') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('f','i','3','2') ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC('f','l','3','2') )
+    else if( p_enc->fmt_out.i_codec == VLC_CODEC_U32L ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_U32B ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_S32L ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_S32B ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_FI32 ||
+             p_enc->fmt_out.i_codec == VLC_CODEC_FL32 )
     {
         p_enc->fmt_out.audio.i_bitspersample = 32;
     }
-    else if( p_enc->fmt_out.i_codec == VLC_FOURCC('f','l','6','4') )
+    else if( p_enc->fmt_out.i_codec == VLC_CODEC_FL64 )
     {
         p_enc->fmt_out.audio.i_bitspersample = 64;
     }
@@ -1429,17 +1334,16 @@ static int EncoderOpen( vlc_object_t *p_this )
     p_enc->fmt_in.i_codec = p_enc->fmt_out.i_codec;
     p_sys->i_s16tolog = 0;
 
-    if( p_enc->fmt_out.i_codec == VLC_FOURCC( 'a', 'l', 'a', 'w' ))
+    if( p_enc->fmt_out.i_codec == VLC_CODEC_ALAW)
     {
         p_enc->fmt_in.audio.i_bitspersample = 16;
-        p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
+        p_enc->fmt_in.i_codec = VLC_CODEC_S16N;
         p_sys->i_s16tolog = ALAW;
     }
-    else if( p_enc->fmt_out.i_codec == VLC_FOURCC( 'u', 'l', 'a', 'w' ) ||
-             p_enc->fmt_out.i_codec == VLC_FOURCC( 'm', 'l', 'a', 'w' ) )
+    else if( p_enc->fmt_out.i_codec == VLC_CODEC_MULAW )
     {
         p_enc->fmt_in.audio.i_bitspersample = 16;
-        p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
+        p_enc->fmt_in.i_codec = VLC_CODEC_S16N;
         p_sys->i_s16tolog = ULAW;
     }
 
index cb89dd19226321001cd4daad96e68dc8a1ad6ec5..8a6f8024caeffbd2c6ea295da1e75fe5c534d266 100644 (file)
@@ -120,12 +120,12 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
         int i_offset;
         int i_size;
 
-        if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'f', 'l', 'a', 'c' ) )
+        if( p_dec->fmt_in.i_codec == VLC_CODEC_FLAC )
         {
             i_offset = 8;
             i_size = p_dec->fmt_in.i_extra - 8;
         }
-        else if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'l', 'a', 'c' ) )
+        else if( p_dec->fmt_in.i_codec == VLC_CODEC_ALAC )
         {
             static const uint8_t p_pattern[] = { 0, 0, 0, 36, 'a', 'l', 'a', 'c' };
             /* Find alac atom XXX it is a bit ugly */
@@ -454,30 +454,30 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
     switch( p_sys->p_context->sample_fmt )
     {
     case SAMPLE_FMT_U8:
-        p_dec->fmt_out.i_codec = VLC_FOURCC('u','8',' ',' ');
+        p_dec->fmt_out.i_codec = VLC_CODEC_U8;
         p_dec->fmt_out.audio.i_bitspersample = 8;
         break;
     case SAMPLE_FMT_S32:
-        p_dec->fmt_out.i_codec = AOUT_FMT_S32_NE;
+        p_dec->fmt_out.i_codec = VLC_CODEC_S32N;
         p_dec->fmt_out.audio.i_bitspersample = 32;
         break;
     case SAMPLE_FMT_FLT:
-        p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+        p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
         p_dec->fmt_out.audio.i_bitspersample = 32;
         break;
     case SAMPLE_FMT_DBL:
-        p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','6','4');
+        p_dec->fmt_out.i_codec = VLC_CODEC_FL64;
         p_dec->fmt_out.audio.i_bitspersample = 64;
         break;
 
     case SAMPLE_FMT_S16:
     default:
-        p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
+        p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
         p_dec->fmt_out.audio.i_bitspersample = 16;
         break;
     }
 #else
-    p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
+    p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
     p_dec->fmt_out.audio.i_bitspersample = 16;
 #endif
     p_dec->fmt_out.audio.i_rate     = p_sys->p_context->sample_rate;
index 6913a427a67b6bfc34b4030d4e7f271c653398e4..6e13170a3485f731c4cea5d59f3cc38dc7353ca0 100644 (file)
@@ -66,52 +66,52 @@ static const struct
 } chroma_table[] =
 {
     /* Planar YUV formats */
-    {VLC_FOURCC('I','4','4','4'), PIX_FMT_YUV444P, 0, 0, 0 },
-    {VLC_FOURCC('J','4','4','4'), PIX_FMT_YUVJ444P, 0, 0, 0 },
+    {VLC_CODEC_I444, PIX_FMT_YUV444P, 0, 0, 0 },
+    {VLC_CODEC_J444, PIX_FMT_YUVJ444P, 0, 0, 0 },
 
 #if LIBAVUTIL_VERSION_INT >= ((49<<16)+(5<<8)+0)
-    {VLC_FOURCC('I','4','4','0'), PIX_FMT_YUV440P, 0, 0, 0 },
-    {VLC_FOURCC('J','4','4','0'), PIX_FMT_YUVJ440P, 0, 0, 0 },
+    {VLC_CODEC_I440, PIX_FMT_YUV440P, 0, 0, 0 },
+    {VLC_CODEC_J440, PIX_FMT_YUVJ440P, 0, 0, 0 },
 #endif
 
-    {VLC_FOURCC('I','4','2','2'), PIX_FMT_YUV422P, 0, 0, 0 },
-    {VLC_FOURCC('J','4','2','2'), PIX_FMT_YUVJ422P, 0, 0, 0 },
+    {VLC_CODEC_I422, PIX_FMT_YUV422P, 0, 0, 0 },
+    {VLC_CODEC_J422, PIX_FMT_YUVJ422P, 0, 0, 0 },
 
-    {VLC_FOURCC('I','4','2','0'), PIX_FMT_YUV420P, 0, 0, 0 },
-    {VLC_FOURCC('Y','V','1','2'), PIX_FMT_YUV420P, 0, 0, 0 },
+    {VLC_CODEC_I420, PIX_FMT_YUV420P, 0, 0, 0 },
+    {VLC_CODEC_YV12, PIX_FMT_YUV420P, 0, 0, 0 },
     {VLC_FOURCC('I','Y','U','V'), PIX_FMT_YUV420P, 0, 0, 0 },
-    {VLC_FOURCC('J','4','2','0'), PIX_FMT_YUVJ420P, 0, 0, 0 },
-    {VLC_FOURCC('I','4','1','1'), PIX_FMT_YUV411P, 0, 0, 0 },
-    {VLC_FOURCC('I','4','1','0'), PIX_FMT_YUV410P, 0, 0, 0 },
+    {VLC_CODEC_J420, PIX_FMT_YUVJ420P, 0, 0, 0 },
+    {VLC_CODEC_I411, PIX_FMT_YUV411P, 0, 0, 0 },
+    {VLC_CODEC_I410, PIX_FMT_YUV410P, 0, 0, 0 },
     {VLC_FOURCC('Y','V','U','9'), PIX_FMT_YUV410P, 0, 0, 0 },
 
     {VLC_FOURCC('N','V','1','2'), PIX_FMT_NV12, 0, 0, 0 },
     {VLC_FOURCC('N','V','2','1'), PIX_FMT_NV21, 0, 0, 0 },
 
     /* Packed YUV formats */
-    {VLC_FOURCC('Y','U','Y','2'), PIX_FMT_YUYV422, 0, 0, 0 },
+    {VLC_CODEC_YUYV, PIX_FMT_YUYV422, 0, 0, 0 },
     {VLC_FOURCC('Y','U','Y','V'), PIX_FMT_YUYV422, 0, 0, 0 },
-    {VLC_FOURCC('U','Y','V','Y'), PIX_FMT_UYVY422, 0, 0, 0 },
+    {VLC_CODEC_UYVY, PIX_FMT_UYVY422, 0, 0, 0 },
     {VLC_FOURCC('Y','4','1','1'), PIX_FMT_UYYVYY411, 0, 0, 0 },
 
     /* Packed RGB formats */
     VLC_RGB( VLC_FOURCC('R','G','B','4'), PIX_FMT_RGB4, PIX_FMT_BGR4, 0x10, 0x06, 0x01 )
     VLC_RGB( VLC_FOURCC('R','G','B','8'), PIX_FMT_RGB8, PIX_FMT_BGR8, 0xC0, 0x38, 0x07 )
 
-    VLC_RGB( VLC_FOURCC('R','V','1','5'), PIX_FMT_BGR555, PIX_FMT_RGB555, 0x7c00, 0x03e0, 0x001f )
-    VLC_RGB( VLC_FOURCC('R','V','1','6'), PIX_FMT_BGR565, PIX_FMT_RGB565, 0xf800, 0x07e0, 0x001f )
-    VLC_RGB( VLC_FOURCC('R','V','2','4'), PIX_FMT_BGR24, PIX_FMT_RGB24, 0xff0000, 0x00ff00, 0x0000ff )
+    VLC_RGB( VLC_CODEC_RGB15, PIX_FMT_BGR555, PIX_FMT_RGB555, 0x7c00, 0x03e0, 0x001f )
+    VLC_RGB( VLC_CODEC_RGB16, PIX_FMT_BGR565, PIX_FMT_RGB565, 0xf800, 0x07e0, 0x001f )
+    VLC_RGB( VLC_CODEC_RGB24, PIX_FMT_BGR24, PIX_FMT_RGB24, 0xff0000, 0x00ff00, 0x0000ff )
 
-    VLC_RGB( VLC_FOURCC('R','V','3','2'), PIX_FMT_RGB32, PIX_FMT_BGR32, 0x00ff0000, 0x0000ff00, 0x000000ff )
-    VLC_RGB( VLC_FOURCC('R','V','3','2'), PIX_FMT_RGB32_1, PIX_FMT_BGR32_1, 0xff000000, 0x00ff0000, 0x0000ff00 )
+    VLC_RGB( VLC_CODEC_RGB32, PIX_FMT_RGB32, PIX_FMT_BGR32, 0x00ff0000, 0x0000ff00, 0x000000ff )
+    VLC_RGB( VLC_CODEC_RGB32, PIX_FMT_RGB32_1, PIX_FMT_BGR32_1, 0xff000000, 0x00ff0000, 0x0000ff00 )
 
 #if defined(PIX_FMT_RGBA)
-    {VLC_FOURCC('R','G','B','A'), PIX_FMT_RGBA, 0xff000000, 0x00ff0000, 0x0000ff00},
+    {VLC_CODEC_RGBA, PIX_FMT_RGBA, 0xff000000, 0x00ff0000, 0x0000ff00},
 #endif
-    {VLC_FOURCC('G','R','E','Y'), PIX_FMT_GRAY8, 0, 0, 0},
+    {VLC_CODEC_GREY, PIX_FMT_GRAY8, 0, 0, 0},
 
      /* Paletized RGB */
-    {VLC_FOURCC('R','G','B','P'), PIX_FMT_PAL8, 0, 0, 0},
+    {VLC_CODEC_RGBP, PIX_FMT_PAL8, 0, 0, 0},
 
 
     { 0, 0, 0, 0, 0 }
index 4b97455b15fb98b4642b0293860e377b00956e88..9006346e08204dbe3e6d22b6ad3d6691ebc18c60 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 #include <vlc_filter.h>
 
 /* ffmpeg header */
index 092090d731689019063aa48a18caea9f2485adb0..86b44baea565985d96e6bbc8af90265ac2650f10 100644 (file)
@@ -33,7 +33,6 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_vout.h>
 #include <vlc_aout.h>
 #include <vlc_sout.h>
 #include <vlc_codec.h>
@@ -453,8 +452,9 @@ int OpenEncoder( vlc_object_t *p_this )
             __MAX( __MIN( p_sys->i_b_frames, FF_MAX_B_FRAMES ), 0 );
         p_context->b_frame_strategy = 0;
         if( !p_context->max_b_frames  &&
-            (  p_enc->fmt_out.i_codec == VLC_FOURCC('m', 'p', '2', 'v') ||
-               p_enc->fmt_out.i_codec == VLC_FOURCC('m', 'p', '1', 'v') ) )
+            (  p_enc->fmt_out.i_codec == VLC_CODEC_MPGV ||
+               p_enc->fmt_out.i_codec == VLC_CODEC_MP2V ||
+               p_enc->fmt_out.i_codec == VLC_CODEC_MP1V ) )
             p_context->flags |= CODEC_FLAG_LOW_DELAY;
 
         av_reduce( &i_aspect_num, &i_aspect_den,
@@ -470,7 +470,7 @@ int OpenEncoder( vlc_object_t *p_this )
             p_sys->i_buffer_out = FF_MIN_BUFFER_SIZE;
         p_sys->p_buffer_out = malloc( p_sys->i_buffer_out );
 
-        p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
+        p_enc->fmt_in.i_codec = VLC_CODEC_I420;
         p_enc->fmt_in.video.i_chroma = p_enc->fmt_in.i_codec;
         GetFfmpegChroma( &p_context->pix_fmt, p_enc->fmt_in.video );
 
@@ -583,11 +583,11 @@ int OpenEncoder( vlc_object_t *p_this )
         if( i_codec_id == CODEC_ID_MP3 && p_enc->fmt_in.audio.i_channels > 2 )
             p_enc->fmt_in.audio.i_channels = 2;
 
-        p_enc->fmt_in.i_codec  = AOUT_FMT_S16_NE;
+        p_enc->fmt_in.i_codec  = VLC_CODEC_S16N;
         p_context->sample_rate = p_enc->fmt_out.audio.i_rate;
         p_context->channels    = p_enc->fmt_out.audio.i_channels;
 
-        if ( p_enc->fmt_out.i_codec == VLC_FOURCC('m','p','4','a') )
+        if ( p_enc->fmt_out.i_codec == VLC_CODEC_MP4A )
         {
             /* XXX: FAAC does resample only when setting the INPUT samplerate
              * to the desired value (-R option of the faac frontend)
@@ -872,7 +872,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
     frame.top_field_first = !!p_pict->b_top_field_first;
 
     /* Set the pts of the frame being encoded (segfaults with mpeg4!)*/
-    if( p_enc->fmt_out.i_codec != VLC_FOURCC( 'm', 'p', '4', 'v' ) )
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_MP4V )
     {
         frame.pts = p_pict->date ? p_pict->date : (int64_t)AV_NOPTS_VALUE;
 
index 79f993d76dc9257c34c35a3102701c21e72268ce..51d0c598f62aed7b828ed2fb8076cfd9a42d23c8 100644 (file)
@@ -46,770 +46,185 @@ static const struct
     vlc_fourcc_t  i_fourcc;
     int  i_codec;
     int  i_cat;
-    const char psz_name[36];
 } codecs_table[] =
 {
     /*
      * Video Codecs
      */
 
-    /* MPEG-1 Video */
-    { VLC_FOURCC('m','p','1','v'), CODEC_ID_MPEG1VIDEO,
-      VIDEO_ES, "MPEG-1 Video" },
-    { VLC_FOURCC('m','p','e','g'), CODEC_ID_MPEG1VIDEO,
-      VIDEO_ES, "MPEG-1 Video" },
-    { VLC_FOURCC('m','p','g','1'), CODEC_ID_MPEG1VIDEO,
-      VIDEO_ES, "MPEG-1 Video" },
-    { VLC_FOURCC('P','I','M','1'), CODEC_ID_MPEG1VIDEO,
-      VIDEO_ES, "Pinnacle DC1000 (MPEG-1 Video)" },
-
-    /* MPEG-2 Video */
-    { VLC_FOURCC('m','p','2','v'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG-2 Video" },
-    { VLC_FOURCC('M','P','E','G'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG-2 Video" },
-    { VLC_FOURCC('m','p','g','v'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG-2 Video" },
-    { VLC_FOURCC('m','p','g','2'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG-2 Video" },
-    { VLC_FOURCC('h','d','v','1'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "HDV 720p30 (MPEG-2 Video)" },
-    { VLC_FOURCC('h','d','v','2'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "Sony HDV (MPEG-2 Video)" },
-    { VLC_FOURCC('h','d','v','3'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "FCP HDV (MPEG-2 Video)" },
-    { VLC_FOURCC('h','d','v','5'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "HDV 720p25 (MPEG-2 Video)" },
-    { VLC_FOURCC('h','d','v','6'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "HDV 1080p24 (MPEG-2 Video)" },
-    { VLC_FOURCC('h','d','v','7'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "HDV 1080p25 (MPEG-2 Video)" },
-    { VLC_FOURCC('h','d','v','8'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "HDV 1080p30 (MPEG-2 Video)" },
-
-    { VLC_FOURCC('m','x','5','n'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG2 IMX NTSC 525/60 50mb/s (FCP)" },
-    { VLC_FOURCC('m','x','5','p'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG2 IMX PAL 625/60 50mb/s (FCP)" },
-    { VLC_FOURCC('m','x','4','n'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG2 IMX NTSC 525/60 40mb/s (FCP)" },
-    { VLC_FOURCC('m','x','4','p'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG2 IMX PAL 625/50 40mb/s (FCP)" },
-    { VLC_FOURCC('m','x','3','n'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG2 IMX NTSC 525/60 30mb/s (FCP)" },
-    { VLC_FOURCC('m','x','3','p'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "MPEG2 IMX NTSC 625/50 30mb/s (FCP)" },
-    { VLC_FOURCC('x','d','v','2'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "XDCAM HD 1080i60" },
-    { VLC_FOURCC('A','V','m','p'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "AVID IMX PAL" },
-    /* ATI VCR2 */
-    { VLC_FOURCC('V','C','R','2'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "ATI VCR2 Video" },
-    { VLC_FOURCC('M','M','E','S'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "Matrox MPEG-2" },
-    { VLC_FOURCC('m','m','e','s'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "Matrox MPEG-2" },
-    { VLC_FOURCC('P','I','M','2'), CODEC_ID_MPEG2VIDEO,
-      VIDEO_ES, "Pinnacle DC1000 (MPEG-2 Video)" },
-
-    /* MPEG-4 Video */
-    { VLC_FOURCC('D','I','V','X'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('d','i','v','x'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('M','P','4','S'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('m','p','4','s'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('M','4','S','2'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('m','4','s','2'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    /* XVID flavours */
-    { VLC_FOURCC('x','v','i','d'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('X','V','I','D'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('X','v','i','D'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('X','V','I','X'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('x','v','i','x'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    /* DX50 */
-    { VLC_FOURCC('D','X','5','0'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('d','x','5','0'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('B','L','Z','0'), CODEC_ID_MPEG4,
-      VIDEO_ES, "Blizzard MPEG-4 Video" },
-    { VLC_FOURCC('D','X','G','M'), CODEC_ID_MPEG4,
-      VIDEO_ES, "Electronic Arts Game MPEG-4 Video" },
-    { VLC_FOURCC('m','p','4','v'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('M','P','4','V'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC( 4,  0,  0,  0 ), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('m','4','c','c'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('M','4','C','C'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('F','M','P','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('f','m','p','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
+    { VLC_CODEC_MPGV, CODEC_ID_MPEG2VIDEO, VIDEO_ES },
+
+    { VLC_CODEC_MP4V, CODEC_ID_MPEG4, VIDEO_ES },
     /* 3ivx delta 3.5 Unsupported
      * putting it here gives extreme distorted images
-    { VLC_FOURCC('3','I','V','1'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('3','i','v','1'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" }, */
-    /* 3ivx delta 4 */
-    { VLC_FOURCC('3','I','V','2'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('3','i','v','2'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('U','M','P','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "UB MPEG-4 Video" },
-    { VLC_FOURCC('W','V','1','F'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('S','E','D','G'), CODEC_ID_MPEG4,
-      VIDEO_ES, "Samsung MPEG-4 Video" },
-    { VLC_FOURCC('R','M','P','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "REALmagic MPEG-4 Video" },
-    { VLC_FOURCC('H','D','X','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)" },
-    { VLC_FOURCC('h','d','x','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)" },
-    { VLC_FOURCC('S','M','P','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "Samsung SMP4 (MPEG-4 Video)" },
-    { VLC_FOURCC('s','m','p','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "Samsung SMP4 (MPEG-4 Video)" },
-    { VLC_FOURCC('f','v','f','w'), CODEC_ID_MPEG4,
-      VIDEO_ES, "FFmpeg MPEG-4" },
-    { VLC_FOURCC('F','V','F','W'), CODEC_ID_MPEG4,
-      VIDEO_ES, "FFmpeg MPEG-4" },
-    { VLC_FOURCC('F','F','D','S'), CODEC_ID_MPEG4,
-      VIDEO_ES, "FFDShow MPEG-4" },
-    { VLC_FOURCC('V','I','D','M'), CODEC_ID_MPEG4,
-      VIDEO_ES, "vidm 4.01 codec" },
-    { VLC_FOURCC('D','C','O','D'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('f','m','p','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('M','V','X','M'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('P','M','4','V'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('f','m','p','4'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('M','4','T','3'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('G','E','O','X'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('D','M','K','2'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('D','I','G','I'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('I','N','M','C'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('S','N','4','0'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-    { VLC_FOURCC('E','P','H','V'), CODEC_ID_MPEG4,
-      VIDEO_ES, "MPEG-4 Video" },
-
-    /* MSMPEG4 v1 */
-    { VLC_FOURCC('D','I','V','1'), CODEC_ID_MSMPEG4V1,
-      VIDEO_ES, "MS MPEG-4 Video v1" },
-    { VLC_FOURCC('d','i','v','1'), CODEC_ID_MSMPEG4V1,
-      VIDEO_ES, "MS MPEG-4 Video v1" },
-    { VLC_FOURCC('M','P','G','4'), CODEC_ID_MSMPEG4V1,
-      VIDEO_ES, "MS MPEG-4 Video v1" },
-    { VLC_FOURCC('m','p','g','4'), CODEC_ID_MSMPEG4V1,
-      VIDEO_ES, "MS MPEG-4 Video v1" },
-    { VLC_FOURCC('m','p','4','1'), CODEC_ID_MSMPEG4V1,
-      VIDEO_ES, "MS MPEG-4 Video v1" },
-
-    /* MSMPEG4 v2 */
-    { VLC_FOURCC('D','I','V','2'), CODEC_ID_MSMPEG4V2,
-      VIDEO_ES, "MS MPEG-4 Video v2" },
-    { VLC_FOURCC('d','i','v','2'), CODEC_ID_MSMPEG4V2,
-      VIDEO_ES, "MS MPEG-4 Video v2" },
-    { VLC_FOURCC('M','P','4','2'), CODEC_ID_MSMPEG4V2,
-      VIDEO_ES, "MS MPEG-4 Video v2" },
-    { VLC_FOURCC('m','p','4','2'), CODEC_ID_MSMPEG4V2,
-      VIDEO_ES, "MS MPEG-4 Video v2" },
-
-    /* MSMPEG4 v3 / M$ mpeg4 v3 */
-    { VLC_FOURCC('M','P','G','3'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('m','p','g','3'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('d','i','v','3'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('M','P','4','3'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('m','p','4','3'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    /* DivX 3.20 */
-    { VLC_FOURCC('D','I','V','3'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('D','I','V','4'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('d','i','v','4'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('D','I','V','5'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('d','i','v','5'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('D','I','V','6'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('d','i','v','6'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    /* Cool Codec */
-    { VLC_FOURCC('C','O','L','1'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('c','o','l','1'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('C','O','L','0'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('c','o','l','0'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    /* AngelPotion stuff */
-    { VLC_FOURCC('A','P','4','1'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    /* 3ivx doctered divx files */
-    { VLC_FOURCC('3','I','V','D'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('3','i','v','d'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    /* who knows? */
-    { VLC_FOURCC('3','V','I','D'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-    { VLC_FOURCC('3','v','i','d'), CODEC_ID_MSMPEG4V3,
-      VIDEO_ES, "MS MPEG-4 Video v3" },
-
-    /* Sorenson v1 */
-    { VLC_FOURCC('S','V','Q','1'), CODEC_ID_SVQ1,
-      VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
-    { VLC_FOURCC('s','v','q','1'), CODEC_ID_SVQ1,
-      VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
-    { VLC_FOURCC('s','v','q','i'), CODEC_ID_SVQ1,
-      VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
-
-    /* Sorenson v3 */
-    { VLC_FOURCC('S','V','Q','3'), CODEC_ID_SVQ3,
-      VIDEO_ES, "SVQ-3 (Sorenson Video v3)" },
-
-    /* h264 */
-    { VLC_FOURCC('h','2','6','4'), CODEC_ID_H264,
-      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
-    { VLC_FOURCC('H','2','6','4'), CODEC_ID_H264,
-      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
-    { VLC_FOURCC('x','2','6','4'), CODEC_ID_H264,
-      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
-    { VLC_FOURCC('X','2','6','4'), CODEC_ID_H264,
-      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
-    /* avc1: special case h264 */
-    { VLC_FOURCC('a','v','c','1'), CODEC_ID_H264,
-      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
-    { VLC_FOURCC('A','V','C','1'), CODEC_ID_H264,
-      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
-    { VLC_FOURCC('V','S','S','H'), CODEC_ID_H264,
-      VIDEO_ES, "Vanguard VSS H264" },
-    { VLC_FOURCC('V','S','S','W'), CODEC_ID_H264,
-      VIDEO_ES, "Vanguard VSS H264" },
-    { VLC_FOURCC('v','s','s','h'), CODEC_ID_H264,
-      VIDEO_ES, "Vanguard VSS H264" },
-    { VLC_FOURCC('D','A','V','C'), CODEC_ID_H264,
-      VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC" },
-    { VLC_FOURCC('d','a','v','c'), CODEC_ID_H264,
-      VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC" },
-
-/* H263 and H263i */
-/* H263(+) is also known as Real Video 1.0 */
-
-    /* H263 */
-    { VLC_FOURCC('D','2','6','3'), CODEC_ID_H263,
-      VIDEO_ES, "DEC H263" },
-    { VLC_FOURCC('H','2','6','3'), CODEC_ID_H263,
-      VIDEO_ES, "H263" },
-    { VLC_FOURCC('h','2','6','3'), CODEC_ID_H263,
-      VIDEO_ES, "H263" },
-    { VLC_FOURCC('L','2','6','3'), CODEC_ID_H263,
-      VIDEO_ES, "LEAD H263" },
-    { VLC_FOURCC('s','2','6','3'), CODEC_ID_H263,
-      VIDEO_ES, "H263" },
-    { VLC_FOURCC('S','2','6','3'), CODEC_ID_H263,
-      VIDEO_ES, "H263" },
-    { VLC_FOURCC('M','2','6','3'), CODEC_ID_H263,
-      VIDEO_ES, "Microsoft H263" },
-    { VLC_FOURCC('X','2','6','3'), CODEC_ID_H263,
-      VIDEO_ES, "Xirlink H263" },
-    { VLC_FOURCC('V','X','1','K'), CODEC_ID_H263,
-      VIDEO_ES, "H263" },
-
-    /* Zygo (partial) */
-    { VLC_FOURCC('Z','y','G','o'), CODEC_ID_H263,
-      VIDEO_ES, "ITU H263+" },
-
-    /* H263i */
-    { VLC_FOURCC('I','2','6','3'), CODEC_ID_H263I,
-      VIDEO_ES, "I263.I" },
-    { VLC_FOURCC('i','2','6','3'), CODEC_ID_H263I,
-      VIDEO_ES, "I263.I" },
-
-    /* H263P */
-    { VLC_FOURCC('v','i','v','1'), CODEC_ID_H263P,
-      VIDEO_ES, "H263+" },
-    { VLC_FOURCC('v','i','v','O'), CODEC_ID_H263P,
-      VIDEO_ES, "H263+" },
-    { VLC_FOURCC('v','i','v','2'), CODEC_ID_H263P,
-      VIDEO_ES, "H263+" },
-    { VLC_FOURCC('U','2','6','3'), CODEC_ID_H263P,
-      VIDEO_ES, "UB H263+" },
-    { VLC_FOURCC('I','L','V','R'), CODEC_ID_H263P,
-      VIDEO_ES, "ITU H263+" },
-
-    /* Flash (H263) variant */
-    { VLC_FOURCC('F','L','V','1'), CODEC_ID_FLV1,
-      VIDEO_ES, "Flash Video" },
-
-    /* H261 */
-    { VLC_FOURCC('H','2','6','1'), CODEC_ID_H261,
-      VIDEO_ES, "H.261" },
-    { VLC_FOURCC('h','2','6','1'), CODEC_ID_H261,
-      VIDEO_ES, "H.261" },
-
-    { VLC_FOURCC('F','L','I','C'), CODEC_ID_FLIC,
-      VIDEO_ES, "Flic Video" },
-
-    /* MJPEG */
-    { VLC_FOURCC( 'M','J','P','G' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Motion JPEG Video" },
-    { VLC_FOURCC( 'm','j','p','g' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Motion JPEG Video" },
-    { VLC_FOURCC( 'm','j','p','a' ), CODEC_ID_MJPEG, /* for mov file */
-      VIDEO_ES, "Motion JPEG Video" },
-    { VLC_FOURCC( 'j','p','e','g' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Motion JPEG Video" },
-    { VLC_FOURCC( 'J','P','E','G' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Motion JPEG Video" },
-    { VLC_FOURCC( 'J','F','I','F' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Motion JPEG Video" },
-    { VLC_FOURCC( 'J','P','G','L' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Motion JPEG Video" },
-    { VLC_FOURCC( 'A','V','D','J' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Motion JPEG Video" },
-    { VLC_FOURCC( 'm','j','p','b' ), CODEC_ID_MJPEGB, /* for mov file */
-      VIDEO_ES, "Motion JPEG B Video" },
-    { VLC_FOURCC( 'L','J','P','G' ), CODEC_ID_LJPEG,
-      VIDEO_ES, "Lead Motion JPEG Video" },
-    { VLC_FOURCC( 'L','J','P','G' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Lead Motion JPEG Video" },
-    /* AVID MJPEG */
-    { VLC_FOURCC( 'A','V','R','n' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Avid Motion JPEG" },
-    { VLC_FOURCC( 'A','D','J','V' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Avid Motion JPEG" },
-    { VLC_FOURCC( 'd','m','b','1' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Motion JPEG OpenDML Video" },
-    { VLC_FOURCC( 'I','J','P','G' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "Intergraph JPEG Video" },
-    { VLC_FOURCC( 'A','C','D','V' ), CODEC_ID_MJPEG,
-      VIDEO_ES, "ACD Systems Digital" },
-
-    /* SP5x */
-    { VLC_FOURCC( 'S','P','5','X' ), CODEC_ID_SP5X,
-      VIDEO_ES, "Sunplus Motion JPEG Video" },
-    { VLC_FOURCC( 'S','P','5','3' ), CODEC_ID_SP5X,
-      VIDEO_ES, "Sunplus Motion JPEG Video" },
-    { VLC_FOURCC( 'S','P','5','4' ), CODEC_ID_SP5X,
-      VIDEO_ES, "Sunplus Motion JPEG Video" },
-    { VLC_FOURCC( 'S','P','5','5' ), CODEC_ID_SP5X,
-      VIDEO_ES, "Sunplus Motion JPEG Video" },
-    { VLC_FOURCC( 'S','P','5','6' ), CODEC_ID_SP5X,
-      VIDEO_ES, "Sunplus Motion JPEG Video" },
-    { VLC_FOURCC( 'S','P','5','7' ), CODEC_ID_SP5X,
-      VIDEO_ES, "Sunplus Motion JPEG Video" },
-    { VLC_FOURCC( 'S','P','5','8' ), CODEC_ID_SP5X,
-      VIDEO_ES, "Sunplus Motion JPEG Video" },
-
-    /* DV */
-    { VLC_FOURCC('d','v','s','l'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','s','d'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('D','V','S','D'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','h','d'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','h','p'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','h','q'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','h','1'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','h','3'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','h','5'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','h','6'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','c',' '), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','2','5'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video" },
-    { VLC_FOURCC('d','v','c','p'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video PAL" },
-    { VLC_FOURCC('d','v','p',' '), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video Pro" },
-    { VLC_FOURCC('d','v','p','p'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video Pro PAL" },
-    { VLC_FOURCC('C','D','V','C'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "Canopus DV Video" },
-    { VLC_FOURCC('c','d','v','c'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "Canopus DV Video" },
-    { VLC_FOURCC('C','D','V','H'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "Canopus DV Video" },
-    { VLC_FOURCC('d','v','5','p'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video C Pro 50 PAL" },
-    { VLC_FOURCC('d','v','5','n'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "DV Video C Pro 50 NTSC" },
-    { VLC_FOURCC('A','V','d','v'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "AVID DV" },
-    { VLC_FOURCC('A','V','d','1'), CODEC_ID_DVVIDEO,
-      VIDEO_ES, "AVID DV" },
-
-
-    /* Windows Media Video */
-    { VLC_FOURCC('W','M','V','1'), CODEC_ID_WMV1,
-      VIDEO_ES, "Windows Media Video 1" },
-    { VLC_FOURCC('w','m','v','1'), CODEC_ID_WMV1,
-      VIDEO_ES, "Windows Media Video 1" },
-    { VLC_FOURCC('W','M','V','2'), CODEC_ID_WMV2,
-      VIDEO_ES, "Windows Media Video 2" },
-    { VLC_FOURCC('w','m','v','2'), CODEC_ID_WMV2,
-      VIDEO_ES, "Windows Media Video 2" },
+    { VLC_FOURCC('3','I','V','1'), CODEC_ID_MPEG4, VIDEO_ES },
+    { VLC_FOURCC('3','i','v','1'), CODEC_ID_MPEG4, VIDEO_ES }, */
+
+    { VLC_CODEC_DIV1, CODEC_ID_MSMPEG4V1, VIDEO_ES },
+    { VLC_CODEC_DIV2, CODEC_ID_MSMPEG4V2, VIDEO_ES },
+    { VLC_CODEC_DIV3, CODEC_ID_MSMPEG4V3, VIDEO_ES },
+
+    { VLC_CODEC_SVQ1, CODEC_ID_SVQ1, VIDEO_ES },
+    { VLC_CODEC_SVQ3, CODEC_ID_SVQ3, VIDEO_ES },
+
+    { VLC_CODEC_H264, CODEC_ID_H264, VIDEO_ES },
+    { VLC_CODEC_H263, CODEC_ID_H263, VIDEO_ES },
+    { VLC_CODEC_H263I,CODEC_ID_H263I,VIDEO_ES },
+    { VLC_CODEC_H263P,CODEC_ID_H263P,VIDEO_ES },
+
+    { VLC_CODEC_FLV1, CODEC_ID_FLV1, VIDEO_ES },
+
+    { VLC_CODEC_H261, CODEC_ID_H261, VIDEO_ES },
+    { VLC_CODEC_FLIC, CODEC_ID_FLIC, VIDEO_ES },
+
+    { VLC_CODEC_MJPG, CODEC_ID_MJPEG, VIDEO_ES },
+    { VLC_CODEC_MJPGB,CODEC_ID_MJPEGB,VIDEO_ES },
+    { VLC_CODEC_LJPG, CODEC_ID_LJPEG, VIDEO_ES },
+
+    { VLC_CODEC_SP5X, CODEC_ID_SP5X, VIDEO_ES },
+
+    { VLC_CODEC_DV,   CODEC_ID_DVVIDEO, VIDEO_ES },
+
+    { VLC_CODEC_WMV1, CODEC_ID_WMV1, VIDEO_ES },
+    { VLC_CODEC_WMV2, CODEC_ID_WMV2, VIDEO_ES },
+    { VLC_CODEC_WMV3, CODEC_ID_WMV3, VIDEO_ES },
+
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 10, 1 )
-    { VLC_FOURCC('W','M','V','3'), CODEC_ID_WMV3,
-      VIDEO_ES, "Windows Media Video 3" },
-    { VLC_FOURCC('w','m','v','3'), CODEC_ID_WMV3,
-      VIDEO_ES, "Windows Media Video 3" },
-    { VLC_FOURCC('W','V','C','1'), CODEC_ID_VC1,
-      VIDEO_ES, "Windows Media Video VC1" },
-    { VLC_FOURCC('w','v','c','1'), CODEC_ID_VC1,
-      VIDEO_ES, "Windows Media Video VC1" },
-    { VLC_FOURCC('v','c','-','1'), CODEC_ID_VC1,
-      VIDEO_ES, "Windows Media Video VC1" },
-    { VLC_FOURCC('V','C','-','1'), CODEC_ID_VC1,
-      VIDEO_ES, "Windows Media Video VC1" },
-    /* WMVA is the VC-1 codec before the standardization proces,
-       it is not bitstream compatible and deprecated  */
-    { VLC_FOURCC('W','M','V','A'), CODEC_ID_VC1,
-      VIDEO_ES, "Windows Media Video Advanced Profile" },
+    { VLC_CODEC_VC1,  CODEC_ID_VC1, VIDEO_ES },
 #endif
 
-    /* Microsoft Video 1 */
-    { VLC_FOURCC('M','S','V','C'), CODEC_ID_MSVIDEO1,
-      VIDEO_ES, "Microsoft Video 1" },
-    { VLC_FOURCC('m','s','v','c'), CODEC_ID_MSVIDEO1,
-      VIDEO_ES, "Microsoft Video 1" },
-    { VLC_FOURCC('C','R','A','M'), CODEC_ID_MSVIDEO1,
-      VIDEO_ES, "Microsoft Video 1" },
-    { VLC_FOURCC('c','r','a','m'), CODEC_ID_MSVIDEO1,
-      VIDEO_ES, "Microsoft Video 1" },
-    { VLC_FOURCC('W','H','A','M'), CODEC_ID_MSVIDEO1,
-      VIDEO_ES, "Microsoft Video 1" },
-    { VLC_FOURCC('w','h','a','m'), CODEC_ID_MSVIDEO1,
-      VIDEO_ES, "Microsoft Video 1" },
-
-    /* Microsoft RLE */
-    { VLC_FOURCC('m','r','l','e'), CODEC_ID_MSRLE,
-      VIDEO_ES, "Microsoft RLE Video" },
-    { VLC_FOURCC('W','R','L','E'), CODEC_ID_MSRLE,
-      VIDEO_ES, "Microsoft RLE Video" },
-    { VLC_FOURCC(0x1,0x0,0x0,0x0), CODEC_ID_MSRLE,
-      VIDEO_ES, "Microsoft RLE Video" },
-    { VLC_FOURCC(0x2,0x0,0x0,0x0), CODEC_ID_MSRLE,
-      VIDEO_ES, "Microsoft RLE Video" },
+    { VLC_CODEC_MSVIDEO1, CODEC_ID_MSVIDEO1, VIDEO_ES },
+    { VLC_CODEC_MSRLE, CODEC_ID_MSRLE, VIDEO_ES },
 
+    { VLC_CODEC_INDEO2, CODEC_ID_INDEO2, VIDEO_ES },
     /* Indeo Video Codecs (Quality of this decoder on ppc is not good) */
-    { VLC_FOURCC('I','V','3','1'), CODEC_ID_INDEO3,
-      VIDEO_ES, "Indeo Video v3" },
-    { VLC_FOURCC('i','v','3','1'), CODEC_ID_INDEO3,
-      VIDEO_ES, "Indeo Video v3" },
-    { VLC_FOURCC('I','V','3','2'), CODEC_ID_INDEO3,
-      VIDEO_ES, "Indeo Video v3" },
-    { VLC_FOURCC('i','v','3','2'), CODEC_ID_INDEO3,
-      VIDEO_ES, "Indeo Video v3" },
-
-    /* Huff YUV */
-    { VLC_FOURCC('H','F','Y','U'), CODEC_ID_HUFFYUV,
-      VIDEO_ES, "Huff YUV Video" },
-    { VLC_FOURCC('F','F','V','H'), CODEC_ID_FFVHUFF,
-      VIDEO_ES, "Huff YUV Video" },
-
-    /* Creative YUV */
-    { VLC_FOURCC('C','Y','U','V'), CODEC_ID_CYUV,
-      VIDEO_ES, "Creative YUV Video" },
-    { VLC_FOURCC('c','y','u','v'), CODEC_ID_CYUV,
-      VIDEO_ES, "Creative YUV Video" },
-
-    /* On2 VP3 Video Codecs */
-    { VLC_FOURCC('V','P','3',' '), CODEC_ID_VP3,
-      VIDEO_ES, "On2's VP3 Video" },
-    { VLC_FOURCC('V','P','3','0'), CODEC_ID_VP3,
-      VIDEO_ES, "On2's VP3 Video" },
-    { VLC_FOURCC('V','P','3','1'), CODEC_ID_VP3,
-      VIDEO_ES, "On2's VP3 Video" },
-    { VLC_FOURCC('v','p','3','1'), CODEC_ID_VP3,
-      VIDEO_ES, "On2's VP3 Video" },
-
-    /* On2  VP5, VP6 codecs */
+    { VLC_CODEC_INDEO3, CODEC_ID_INDEO3, VIDEO_ES },
+
+    { VLC_CODEC_HUFFYUV, CODEC_ID_HUFFYUV, VIDEO_ES },
+    { VLC_CODEC_FFVHUFF, CODEC_ID_FFVHUFF, VIDEO_ES },
+    { VLC_CODEC_CYUV, CODEC_ID_CYUV, VIDEO_ES },
+
+    { VLC_CODEC_VP3, CODEC_ID_VP3, VIDEO_ES },
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 14, 0 )
-    { VLC_FOURCC('V','P','5',' '), CODEC_ID_VP5,
-      VIDEO_ES, "On2's VP5 Video" },
-    { VLC_FOURCC('V','P','5','0'), CODEC_ID_VP5,
-      VIDEO_ES, "On2's VP5 Video" },
-    { VLC_FOURCC('V','P','6','2'), CODEC_ID_VP6,
-      VIDEO_ES, "On2's VP6.2 Video" },
-    { VLC_FOURCC('v','p','6','2'), CODEC_ID_VP6,
-      VIDEO_ES, "On2's VP6.2 Video" },
-    { VLC_FOURCC('V','P','6','F'), CODEC_ID_VP6F,
-      VIDEO_ES, "On2's VP6.2 Video (Flash)" },
+    { VLC_CODEC_VP5, CODEC_ID_VP5, VIDEO_ES },
 #endif
-
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 27, 0 )
-    { VLC_FOURCC('V','P','6','0'), CODEC_ID_VP6,
-      VIDEO_ES, "On2's VP6.0 Video" },
-    { VLC_FOURCC('V','P','6','1'), CODEC_ID_VP6,
-      VIDEO_ES, "On2's VP6.1 Video" },
+    { VLC_CODEC_VP6, CODEC_ID_VP6, VIDEO_ES },
+    { VLC_CODEC_VP6F, CODEC_ID_VP6F, VIDEO_ES },
 #endif
-
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 47, 0 )
-    { VLC_FOURCC('V','P','6','A'), CODEC_ID_VP6A,
-      VIDEO_ES, "On2's VP6 A Video" },
+    { VLC_CODEC_VP6A, CODEC_ID_VP6A, VIDEO_ES },
 #endif
 
-    /* Xiph.org theora */
-    { VLC_FOURCC('t','h','e','o'), CODEC_ID_THEORA,
-      VIDEO_ES, "Xiph.org's Theora Video" },
-    { VLC_FOURCC('T','h','r','a'), CODEC_ID_THEORA,
-      VIDEO_ES, "Xiph.org's Theora Video" },
+    { VLC_CODEC_THEORA, CODEC_ID_THEORA, VIDEO_ES },
 
 #if ( !defined( WORDS_BIGENDIAN ) )
     /* Asus Video (Another thing that doesn't work on PPC) */
-    { VLC_FOURCC('A','S','V','1'), CODEC_ID_ASV1,
-      VIDEO_ES, "Asus V1 Video" },
-    { VLC_FOURCC('A','S','V','2'), CODEC_ID_ASV2,
-      VIDEO_ES, "Asus V2 Video" },
+    { VLC_CODEC_ASV1, CODEC_ID_ASV1, VIDEO_ES },
+    { VLC_CODEC_ASV2, CODEC_ID_ASV2, VIDEO_ES },
 #endif
 
-    /* FFMPEG Video 1 (lossless codec) */
-    { VLC_FOURCC('F','F','V','1'), CODEC_ID_FFV1,
-      VIDEO_ES, "FFMpeg Video 1" },
+    { VLC_CODEC_FFV1, CODEC_ID_FFV1, VIDEO_ES },
 
-    /* ATI VCR1 */
-    { VLC_FOURCC('V','C','R','1'), CODEC_ID_VCR1,
-      VIDEO_ES, "ATI VCR1 Video" },
+    { VLC_CODEC_VCR1, CODEC_ID_VCR1, VIDEO_ES },
 
-    /* Cirrus Logic AccuPak */
-    { VLC_FOURCC('C','L','J','R'), CODEC_ID_CLJR,
-      VIDEO_ES, "Creative Logic AccuPak" },
+    { VLC_CODEC_CLJR, CODEC_ID_CLJR, VIDEO_ES },
 
     /* Real Video */
-    { VLC_FOURCC('R','V','1','0'), CODEC_ID_RV10,
-      VIDEO_ES, "Real Video 1.0" },
-    { VLC_FOURCC('r','v','1','0'), CODEC_ID_RV10,
-      VIDEO_ES, "Real Video 1.0" },
-    { VLC_FOURCC('R','V','1','3'), CODEC_ID_RV10,
-      VIDEO_ES, "Real Video 1.3" },
-    { VLC_FOURCC('r','v','1','3'), CODEC_ID_RV10,
-      VIDEO_ES, "Real Video 1.3" },
+    { VLC_CODEC_RV10, CODEC_ID_RV10, VIDEO_ES },
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 15, 1 )
-    { VLC_FOURCC('R','V','2','0'), CODEC_ID_RV20,
-      VIDEO_ES, "Real Video 2.0" },
-    { VLC_FOURCC('r','v','2','0'), CODEC_ID_RV20,
-      VIDEO_ES, "Real Video 2.0" },
+    { VLC_CODEC_RV20, CODEC_ID_RV20, VIDEO_ES },
 #endif
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 8, 0 )
-    { VLC_FOURCC('R','V','3','0'), CODEC_ID_RV30,
-      VIDEO_ES, "Real Video 3.0" },
-    { VLC_FOURCC('r','v','3','0'), CODEC_ID_RV30,
-      VIDEO_ES, "Real Video 3.0" },
+    { VLC_CODEC_RV30, CODEC_ID_RV30, VIDEO_ES },
 #endif
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 5, 0 )
-    { VLC_FOURCC('R','V','4','0'), CODEC_ID_RV40,
-      VIDEO_ES, "Real Video 4.0" },
-    { VLC_FOURCC('r','v','4','0'), CODEC_ID_RV40,
-      VIDEO_ES, "Real Video 4.0" },
+    { VLC_CODEC_RV40, CODEC_ID_RV40, VIDEO_ES },
 #endif
 
+    { VLC_CODEC_RPZA, CODEC_ID_RPZA, VIDEO_ES },
 
-    /* Apple Video */
-    { VLC_FOURCC('r','p','z','a'), CODEC_ID_RPZA,
-      VIDEO_ES, "Apple Video" },
-    { VLC_FOURCC('a','z','p','r'), CODEC_ID_RPZA,
-      VIDEO_ES, "Apple Video" },
-
-    { VLC_FOURCC('s','m','c',' '), CODEC_ID_SMC,
-      VIDEO_ES, "Apple graphics" },
+    { VLC_CODEC_SMC, CODEC_ID_SMC, VIDEO_ES },
 
- /* CINEPAK. We have our own decoder with an higher priority,
-       but this can't harm */
-    { VLC_FOURCC('C','V','I','D'), CODEC_ID_CINEPAK,
-      VIDEO_ES, "Cinepak Video" },
-    { VLC_FOURCC('c','v','i','d'), CODEC_ID_CINEPAK,
-      VIDEO_ES, "Cinepak Video" },
+    { VLC_CODEC_CINEPAK, CODEC_ID_CINEPAK, VIDEO_ES },
 
-    /* Screen Capture Video Codecs */
-    { VLC_FOURCC('t','s','c','c'), CODEC_ID_TSCC,
-      VIDEO_ES, "TechSmith Camtasia Screen Capture" },
-    { VLC_FOURCC('T','S','C','C'), CODEC_ID_TSCC,
-      VIDEO_ES, "TechSmith Camtasia Screen Capture" },
+    { VLC_CODEC_TSCC, CODEC_ID_TSCC, VIDEO_ES },
 
-    { VLC_FOURCC('C','S','C','D'), CODEC_ID_CSCD,
-      VIDEO_ES, "CamStudio Screen Codec" },
-    { VLC_FOURCC('c','s','c','d'), CODEC_ID_CSCD,
-      VIDEO_ES, "CamStudio Screen Codec" },
+    { VLC_CODEC_CSCD, CODEC_ID_CSCD, VIDEO_ES },
 
-    { VLC_FOURCC('Z','M','B','V'), CODEC_ID_ZMBV,
-      VIDEO_ES, "DosBox Capture Codec" },
+    { VLC_CODEC_ZMBV, CODEC_ID_ZMBV, VIDEO_ES },
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 13, 0 )
-    { VLC_FOURCC('V','M','n','c'), CODEC_ID_VMNC,
-      VIDEO_ES, "VMware Video" },
+    { VLC_CODEC_VMNC, CODEC_ID_VMNC, VIDEO_ES },
 #endif
-    { VLC_FOURCC('F','P','S','1'), CODEC_ID_FRAPS,
-      VIDEO_ES, "FRAPS: Realtime Video Capture" },
-    { VLC_FOURCC('f','p','s','1'), CODEC_ID_FRAPS,
-      VIDEO_ES, "FRAPS: Realtime Video Capture" },
-
-    /* Duck TrueMotion */
-    { VLC_FOURCC('D','U','C','K'), CODEC_ID_TRUEMOTION1,
-      VIDEO_ES, "Duck TrueMotion v1 Video" },
-    { VLC_FOURCC('T','M','2','0'), CODEC_ID_TRUEMOTION2,
-      VIDEO_ES, "Duck TrueMotion v2.0 Video" },
-
-    /* FFMPEG's SNOW wavelet codec */
-    { VLC_FOURCC('S','N','O','W'), CODEC_ID_SNOW,
-      VIDEO_ES, "FFMpeg SNOW wavelet Video" },
-    { VLC_FOURCC('s','n','o','w'), CODEC_ID_SNOW,
-      VIDEO_ES, "FFMpeg SNOW wavelet Video" },
-
-    { VLC_FOURCC('r','l','e',' '), CODEC_ID_QTRLE,
-      VIDEO_ES, "Apple QuickTime RLE Video" },
-
-    { VLC_FOURCC('q','d','r','w'), CODEC_ID_QDRAW,
-      VIDEO_ES, "Apple QuickDraw Video" },
-
-    { VLC_FOURCC('Q','P','E','G'), CODEC_ID_QPEG,
-      VIDEO_ES, "QPEG Video" },
-    { VLC_FOURCC('Q','1','.','0'), CODEC_ID_QPEG,
-      VIDEO_ES, "QPEG Video" },
-    { VLC_FOURCC('Q','1','.','1'), CODEC_ID_QPEG,
-      VIDEO_ES, "QPEG Video" },
-
-    { VLC_FOURCC('U','L','T','I'), CODEC_ID_ULTI,
-      VIDEO_ES, "IBM Ultimotion Video" },
-
-    { VLC_FOURCC('V','I','X','L'), CODEC_ID_VIXL,
-      VIDEO_ES, "Miro/Pinnacle VideoXL Video" },
-    { VLC_FOURCC('P','I','X','L'), CODEC_ID_VIXL,
-      VIDEO_ES, "Pinnacle VideoXL Video" },
-
-    { VLC_FOURCC('L','O','C','O'), CODEC_ID_LOCO,
-      VIDEO_ES, "LOCO Video" },
-
-    { VLC_FOURCC('W','N','V','1'), CODEC_ID_WNV1,
-      VIDEO_ES, "Winnov WNV1 Video" },
-
-    { VLC_FOURCC('A','A','S','C'), CODEC_ID_AASC,
-      VIDEO_ES, "Autodesc RLE Video" },
-
-    { VLC_FOURCC('I','V','2','0'), CODEC_ID_INDEO2,
-      VIDEO_ES, "Indeo Video v2" },
-    { VLC_FOURCC('R','T','2','1'), CODEC_ID_INDEO2,
-      VIDEO_ES, "Indeo Video v2" },
-
-        /* Flash Screen Video */
+    { VLC_CODEC_FRAPS, CODEC_ID_FRAPS, VIDEO_ES },
+
+    { VLC_CODEC_TRUEMOTION1, CODEC_ID_TRUEMOTION1, VIDEO_ES },
+    { VLC_CODEC_TRUEMOTION2, CODEC_ID_TRUEMOTION2, VIDEO_ES },
+
+    { VLC_CODEC_SNOW, CODEC_ID_SNOW, VIDEO_ES },
+
+    { VLC_CODEC_QTRLE, CODEC_ID_QTRLE, VIDEO_ES },
+
+    { VLC_CODEC_QDRAW, CODEC_ID_QDRAW, VIDEO_ES },
+
+    { VLC_CODEC_QPEG, CODEC_ID_QPEG, VIDEO_ES },
+
+    { VLC_CODEC_ULTI, CODEC_ID_ULTI, VIDEO_ES },
+
+    { VLC_CODEC_VIXL, CODEC_ID_VIXL, VIDEO_ES },
+
+    { VLC_CODEC_LOCO, CODEC_ID_LOCO, VIDEO_ES },
+
+    { VLC_CODEC_WNV1, CODEC_ID_WNV1, VIDEO_ES },
+
+    { VLC_CODEC_AASC, CODEC_ID_AASC, VIDEO_ES },
+
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 11, 0 )
-    { VLC_FOURCC('F','S','V','1'), CODEC_ID_FLASHSV,
-              VIDEO_ES, "Flash Screen Video" },
+    { VLC_CODEC_FLASHSV, CODEC_ID_FLASHSV, VIDEO_ES },
 #endif
-   { VLC_FOURCC('K','M','V','C'), CODEC_ID_KMVC,
-      VIDEO_ES, "Karl Morton's Video Codec (Worms)" },
+    { VLC_CODEC_KMVC, CODEC_ID_KMVC, VIDEO_ES },
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 13, 0 )
-    { VLC_FOURCC('N','U','V','1'), CODEC_ID_NUV,
-      VIDEO_ES, "Nuppel Video" },
-    { VLC_FOURCC('R','J','P','G'), CODEC_ID_NUV,
-      VIDEO_ES, "Nuppel Video" },
+    { VLC_CODEC_NUV, CODEC_ID_NUV, VIDEO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 8, 0 )
-    /* CODEC_ID_SMACKVIDEO */
-    { VLC_FOURCC('S','M','K','2'), CODEC_ID_SMACKVIDEO,
-      VIDEO_ES, "Smacker Video" },
-    { VLC_FOURCC('S','M','K','4'), CODEC_ID_SMACKVIDEO,
-      VIDEO_ES, "Smacker Video" },
+    { VLC_CODEC_SMACKVIDEO, CODEC_ID_SMACKVIDEO, VIDEO_ES },
 #endif
 
     /* Chinese AVS - Untested */
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 8, 0 )
-    { VLC_FOURCC('C','A','V','S'), CODEC_ID_CAVS,
-      VIDEO_ES, "Chinese AVS" },
-    { VLC_FOURCC('A','V','s','2'), CODEC_ID_CAVS,
-      VIDEO_ES, "Chinese AVS" },
+    { VLC_CODEC_CAVS, CODEC_ID_CAVS, VIDEO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 40, 0 )
     /* Untested yet */
-    { VLC_FOURCC('A','V','d','n'), CODEC_ID_DNXHD,
-      VIDEO_ES, "DNxHD" },
+    { VLC_CODEC_DNXHD, CODEC_ID_DNXHD, VIDEO_ES },
 #endif
-    { VLC_FOURCC('8','B','P','S'), CODEC_ID_8BPS,
-      VIDEO_ES, "8BPS" },
+    { VLC_CODEC_8BPS, CODEC_ID_8BPS, VIDEO_ES },
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 52, 0 )
-    { VLC_FOURCC('M','L','2','O'), CODEC_ID_MIMIC,
-      VIDEO_ES, "Mimic" },
+    { VLC_CODEC_MIMIC, CODEC_ID_MIMIC, VIDEO_ES },
+#endif
+
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 29, 0 )
+    { VLC_CODEC_V210, CODEC_ID_V210, VIDEO_ES },
 #endif
 
     /* Videogames Codecs */
 
-    /* Interplay MVE */
-    { VLC_FOURCC('i','m','v','e'), CODEC_ID_INTERPLAY_VIDEO,
-      VIDEO_ES, "Interplay MVE Video" },
-    { VLC_FOURCC('I','N','P','V'), CODEC_ID_INTERPLAY_VIDEO,
-      VIDEO_ES, "Interplay MVE Video" },
+    { VLC_CODEC_INTERPLAY, CODEC_ID_INTERPLAY_VIDEO, VIDEO_ES },
 
-    /* Id Quake II CIN */
-    { VLC_FOURCC('I','D','C','I'), CODEC_ID_IDCIN,
-      VIDEO_ES, "Id Quake II CIN Video" },
+    { VLC_CODEC_IDCIN, CODEC_ID_IDCIN, VIDEO_ES },
 
-    /* 4X Technologies */
-    { VLC_FOURCC('4','x','m','v'), CODEC_ID_4XM,
-      VIDEO_ES, "4X Technologies Video" },
-    { VLC_FOURCC('4','X','M','V'), CODEC_ID_4XM,
-      VIDEO_ES, "4X Technologies Video" },
+    { VLC_CODEC_4XM, CODEC_ID_4XM, VIDEO_ES },
 
-    /* Id RoQ */
-    { VLC_FOURCC('R','o','Q','v'), CODEC_ID_ROQ,
-      VIDEO_ES, "Id RoQ Video" },
+    { VLC_CODEC_ROQ, CODEC_ID_ROQ, VIDEO_ES },
 
-    /* Sony Playstation MDEC */
-    { VLC_FOURCC('M','D','E','C'), CODEC_ID_MDEC,
-      VIDEO_ES, "PSX MDEC Video" },
+    { VLC_CODEC_MDEC, CODEC_ID_MDEC, VIDEO_ES },
 
-    /* Sierra VMD */
-    { VLC_FOURCC('v','m','d','v'), CODEC_ID_VMDVIDEO,
-      VIDEO_ES, "Sierra VMD Video" },
-    { VLC_FOURCC('V','M','D','V'), CODEC_ID_VMDVIDEO,
-      VIDEO_ES, "Sierra VMD Video" },
+    { VLC_CODEC_VMDVIDEO, CODEC_ID_VMDVIDEO, VIDEO_ES },
 
 #if 0
 /*    UNTESTED VideoGames*/
@@ -838,339 +253,187 @@ static const struct
     /*
      *  Image codecs
      */
-    { VLC_FOURCC('p','n','g',' '), CODEC_ID_PNG,
-      VIDEO_ES, "PNG Image" },
-    { VLC_FOURCC('p','p','m',' '), CODEC_ID_PPM,
-      VIDEO_ES, "PPM Image" },
-    { VLC_FOURCC('p','g','m',' '), CODEC_ID_PGM,
-      VIDEO_ES, "PGM Image" },
-    { VLC_FOURCC('p','g','m','y'), CODEC_ID_PGMYUV,
-      VIDEO_ES, "PGM YUV Image" },
-    { VLC_FOURCC('p','a','m',' '), CODEC_ID_PAM,
-      VIDEO_ES, "PAM Image" },
-    { VLC_FOURCC('M','J','L','S'), CODEC_ID_JPEGLS,
-      VIDEO_ES, "PAM Image" },
+    { VLC_CODEC_PNG, CODEC_ID_PNG, VIDEO_ES },
+    { VLC_CODEC_PPM, CODEC_ID_PPM, VIDEO_ES },
+    { VLC_CODEC_PGM, CODEC_ID_PGM, VIDEO_ES },
+    { VLC_CODEC_PGMYUV, CODEC_ID_PGMYUV, VIDEO_ES },
+    { VLC_CODEC_PAM, CODEC_ID_PAM, VIDEO_ES },
+    { VLC_CODEC_JPEGLS, CODEC_ID_JPEGLS, VIDEO_ES },
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 0, 0 )
-    { VLC_FOURCC('b','m','p',' '), CODEC_ID_BMP,
-      VIDEO_ES, "BMP Image" },
+    { VLC_CODEC_BMP, CODEC_ID_BMP, VIDEO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 40, 1 )
-    { VLC_FOURCC('t','i','f','f'), CODEC_ID_TIFF,
-      VIDEO_ES, "TIFF Image" },
-    { VLC_FOURCC('g','i','f',' '), CODEC_ID_GIF,
-      VIDEO_ES, "GIF Image" },
-    { VLC_FOURCC('t','g','a',' '), CODEC_ID_TARGA,
-      VIDEO_ES, "Truevision Targa Image" },
-    { VLC_FOURCC('m','t','g','a'), CODEC_ID_TARGA,
-      VIDEO_ES, "Truevision Targa Image" },
-    { VLC_FOURCC('M','T','G','A'), CODEC_ID_TARGA,
-      VIDEO_ES, "Truevision Targa Image" },
+    { VLC_CODEC_TIFF, CODEC_ID_TIFF, VIDEO_ES },
+    { VLC_CODEC_GIF, CODEC_ID_GIF, VIDEO_ES },
+    { VLC_CODEC_TARGA, CODEC_ID_TARGA, VIDEO_ES },
 #endif
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 40, 3 )
-    { VLC_FOURCC('s','g','i',' '), CODEC_ID_SGI,
-      VIDEO_ES, "SGI Image" },
+    { VLC_CODEC_SGI, CODEC_ID_SGI, VIDEO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 55, 0 )
-    { VLC_FOURCC('d','r','a','c'), CODEC_ID_DIRAC,
-      VIDEO_ES, "Dirac" },
+    { VLC_CODEC_DIRAC, CODEC_ID_DIRAC, VIDEO_ES },
 #endif
 
     /*
      *  Audio Codecs
      */
 
-    /* Windows Media Audio 1 */
-    { VLC_FOURCC('W','M','A','1'), CODEC_ID_WMAV1,
-      AUDIO_ES, "Windows Media Audio 1" },
-    { VLC_FOURCC('w','m','a','1'), CODEC_ID_WMAV1,
-      AUDIO_ES, "Windows Media Audio 1" },
-
-    /* Windows Media Audio 2 */
-    { VLC_FOURCC('W','M','A','2'), CODEC_ID_WMAV2,
-      AUDIO_ES, "Windows Media Audio 2" },
-    { VLC_FOURCC('w','m','a','2'), CODEC_ID_WMAV2,
-      AUDIO_ES, "Windows Media Audio 2" },
-
-    /* DV Audio */
-    { VLC_FOURCC('d','v','a','u'), CODEC_ID_DVAUDIO,
-      AUDIO_ES, "DV Audio" },
-    { VLC_FOURCC('v','d','v','a'), CODEC_ID_DVAUDIO,
-      AUDIO_ES, "DV Audio" },
-    { VLC_FOURCC('d','v','c','a'), CODEC_ID_DVAUDIO,
-      AUDIO_ES, "DV Audio" },
-    { VLC_FOURCC('R','A','D','V'), CODEC_ID_DVAUDIO,
-      AUDIO_ES, "DV Audio" },
-
-    /* MACE-3 Audio */
-    { VLC_FOURCC('M','A','C','3'), CODEC_ID_MACE3,
-      AUDIO_ES, "MACE-3 Audio" },
-
-    /* MACE-6 Audio */
-    { VLC_FOURCC('M','A','C','6'), CODEC_ID_MACE6,
-      AUDIO_ES, "MACE-6 Audio" },
+    { VLC_CODEC_WMA1, CODEC_ID_WMAV1, AUDIO_ES },
+    { VLC_CODEC_WMA2, CODEC_ID_WMAV2, AUDIO_ES },
+
+    { VLC_CODEC_DVAUDIO, CODEC_ID_DVAUDIO, AUDIO_ES },
+
+    { VLC_CODEC_MACE3, CODEC_ID_MACE3, AUDIO_ES },
+    { VLC_CODEC_MACE6, CODEC_ID_MACE6, AUDIO_ES },
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 41, 1 )
-    /* MUSEPACK7 Audio */
-    { VLC_FOURCC('M','P','C',' '), CODEC_ID_MUSEPACK7,
-      AUDIO_ES, "MUSEPACK7 Audio" },
+    { VLC_CODEC_MUSEPACK7, CODEC_ID_MUSEPACK7, AUDIO_ES },
 #endif
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 48, 0 )
-    /* MUSEPACK8 Audio */
-    { VLC_FOURCC('M','P','C','K'), CODEC_ID_MUSEPACK8,
-      AUDIO_ES, "MUSEPACK8 Audio" },
-    { VLC_FOURCC('M','P','C','8'), CODEC_ID_MUSEPACK8,
-      AUDIO_ES, "MUSEPACK8 Audio" },
+    { VLC_CODEC_MUSEPACK8, CODEC_ID_MUSEPACK8, AUDIO_ES },
 #endif
 
-    /* RealAudio 1.0 */
-    { VLC_FOURCC('1','4','_','4'), CODEC_ID_RA_144,
-      AUDIO_ES, "RealAudio 1.0" },
-    { VLC_FOURCC('l','p','c','J'), CODEC_ID_RA_144,
-      AUDIO_ES, "RealAudio 1.0" },
-
-    /* RealAudio 2.0 */
-    { VLC_FOURCC('2','8','_','8'), CODEC_ID_RA_288,
-      AUDIO_ES, "RealAudio 2.0" },
-
-    /* MPEG Audio layer 1/2/3 */
-    { VLC_FOURCC('m','p','g','a'), CODEC_ID_MP2,
-      AUDIO_ES, "MPEG Audio layer 1/2" },
-    { VLC_FOURCC('m','p','3',' '), CODEC_ID_MP3,
-      AUDIO_ES, "MPEG Audio layer 1/2/3" },
-    { VLC_FOURCC('.','m','p','3'), CODEC_ID_MP3,
-      AUDIO_ES, "MPEG Audio layer 1/2/3" },
-    { VLC_FOURCC('M','P','3',' '), CODEC_ID_MP3,
-      AUDIO_ES, "MPEG Audio layer 1/2/3" },
-    { VLC_FOURCC('L','A','M','E'), CODEC_ID_MP3,
-      AUDIO_ES, "MPEG Audio layer 1/2/3" },
-
-    /* A52 Audio (aka AC3) */
-    { VLC_FOURCC('a','5','2',' '), CODEC_ID_AC3,
-      AUDIO_ES, "A52 Audio (aka AC3)" },
-    { VLC_FOURCC('a','5','2','b'), CODEC_ID_AC3, /* VLC specific hack */
-      AUDIO_ES, "A52 Audio (aka AC3)" },
+    { VLC_CODEC_RA_144, CODEC_ID_RA_144, AUDIO_ES },
+    { VLC_CODEC_RA_288, CODEC_ID_RA_288, AUDIO_ES },
+
+    { VLC_CODEC_MPGA, CODEC_ID_MP3, AUDIO_ES },
+
+    { VLC_CODEC_A52, CODEC_ID_AC3, AUDIO_ES },
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 0, 0 )
-    { VLC_FOURCC('e','a','c','3'), CODEC_ID_EAC3,
-      AUDIO_ES, "A/52 B Audio (aka E-AC3)" },
+    { VLC_CODEC_EAC3, CODEC_ID_EAC3, AUDIO_ES },
 #endif
 
-    /* DTS Audio */
-    { VLC_FOURCC('d','t','s',' '), CODEC_ID_DTS,
-      AUDIO_ES, "DTS Audio" },
-
-    /* AAC audio */
-    { VLC_FOURCC('m','p','4','a'), CODEC_ID_AAC,
-      AUDIO_ES, "MPEG AAC Audio" },
-    { VLC_FOURCC('a','a','c',' '), CODEC_ID_AAC,
-      AUDIO_ES, "MPEG AAC Audio" },
+    { VLC_CODEC_DTS, CODEC_ID_DTS, AUDIO_ES },
 
-    /* AC-3 Audio (Dolby Digital) */
-    { VLC_FOURCC('a','c','-','3'), CODEC_ID_AC3,
-      AUDIO_ES, "AC-3 Audio (Dolby Digital)" },
+    { VLC_CODEC_MP4A, CODEC_ID_AAC, AUDIO_ES },
 
-    /* 4X Technologies */
-    { VLC_FOURCC('4','x','m','a'), CODEC_ID_ADPCM_4XM,
-      AUDIO_ES, "4X Technologies Audio" },
+    { VLC_CODEC_ADPCM_4XM, CODEC_ID_ADPCM_4XM, AUDIO_ES },
 
-    /* EA ADPCM */
-    { VLC_FOURCC('A','D','E','A'), CODEC_ID_ADPCM_EA,
-      AUDIO_ES, "EA ADPCM Audio" },
+    { VLC_CODEC_ADPCM_EA, CODEC_ID_ADPCM_EA, AUDIO_ES },
 
-    /* Interplay DPCM */
-    { VLC_FOURCC('i','d','p','c'), CODEC_ID_INTERPLAY_DPCM,
-      AUDIO_ES, "Interplay DPCM Audio" },
+    { VLC_CODEC_INTERPLAY_DPCM, CODEC_ID_INTERPLAY_DPCM, AUDIO_ES },
 
-    /* Id RoQ */
-    { VLC_FOURCC('R','o','Q','a'), CODEC_ID_ROQ_DPCM,
-      AUDIO_ES, "Id RoQ DPCM Audio" },
+    { VLC_CODEC_ROQ_DPCM, CODEC_ID_ROQ_DPCM, AUDIO_ES },
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 27, 0 )
-    /* DCIN Audio */
-    { VLC_FOURCC('D','C','I','A'), CODEC_ID_DSICINAUDIO,
-      AUDIO_ES, "Delphine CIN Audio" },
+    { VLC_CODEC_DSICINAUDIO, CODEC_ID_DSICINAUDIO, AUDIO_ES },
 #endif
 
-    /* Sony Playstation XA ADPCM */
-    { VLC_FOURCC('x','a',' ',' '), CODEC_ID_ADPCM_XA,
-      AUDIO_ES, "PSX XA ADPCM Audio" },
-
-    /* ADX ADPCM */
-    { VLC_FOURCC('a','d','x',' '), CODEC_ID_ADPCM_ADX,
-      AUDIO_ES, "ADX ADPCM Audio" },
-
-    /* Westwood ADPCM */
-    { VLC_FOURCC('A','I','W','S'), CODEC_ID_ADPCM_IMA_WS,
-      AUDIO_ES, "Westwood IMA ADPCM audio" },
+    { VLC_CODEC_ADPCM_XA, CODEC_ID_ADPCM_XA, AUDIO_ES },
+    { VLC_CODEC_ADPCM_ADX, CODEC_ID_ADPCM_ADX, AUDIO_ES },
+    { VLC_CODEC_ADPCM_IMA_WS, CODEC_ID_ADPCM_IMA_WS, AUDIO_ES },
 
-    /* Sierra VMD */
-    { VLC_FOURCC('v','m','d','a'), CODEC_ID_VMDAUDIO,
-      AUDIO_ES, "Sierra VMD Audio" },
+    { VLC_CODEC_VMDAUDIO, CODEC_ID_VMDAUDIO, AUDIO_ES },
 
-    /* G.726 ADPCM */
-    { VLC_FOURCC('g','7','2','6'), CODEC_ID_ADPCM_G726,
-      AUDIO_ES, "G.726 ADPCM Audio" },
+    { VLC_CODEC_ADPCM_G726, CODEC_ID_ADPCM_G726, AUDIO_ES },
 
-    /* AMR */
-    { VLC_FOURCC('s','a','m','r'), CODEC_ID_AMR_NB,
-      AUDIO_ES, "AMR narrow band" },
-    { VLC_FOURCC('s','a','w','b'), CODEC_ID_AMR_WB,
-      AUDIO_ES, "AMR wide band" },
+    { VLC_CODEC_AMR_NB, CODEC_ID_AMR_NB, AUDIO_ES },
+    { VLC_CODEC_AMR_WB, CODEC_ID_AMR_WB, AUDIO_ES },
 
-    /* FLAC */
-    { VLC_FOURCC('f','l','a','c'), CODEC_ID_FLAC,
-      AUDIO_ES, "FLAC (Free Lossless Audio Codec)" },
+    { VLC_CODEC_FLAC, CODEC_ID_FLAC, AUDIO_ES },
 
-    /* ALAC */
-    { VLC_FOURCC('a','l','a','c'), CODEC_ID_ALAC,
-      AUDIO_ES, "Apple Lossless Audio Codec" },
+    { VLC_CODEC_ALAC, CODEC_ID_ALAC, AUDIO_ES },
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 50, 0, 1 )
-    /* QDM2 */
-    { VLC_FOURCC('Q','D','M','2'), CODEC_ID_QDM2,
-      AUDIO_ES, "QDM2 Audio" },
+    { VLC_CODEC_QDM2, CODEC_ID_QDM2, AUDIO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 0, 0 )
-    /* COOK */
-    { VLC_FOURCC('c','o','o','k'), CODEC_ID_COOK,
-      AUDIO_ES, "Cook Audio" },
+    { VLC_CODEC_COOK, CODEC_ID_COOK, AUDIO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 4, 0 )
-    /* TTA: The Lossless True Audio */
-    { VLC_FOURCC('T','T','A','1'), CODEC_ID_TTA,
-      AUDIO_ES, "The Lossless True Audio" },
+    { VLC_CODEC_TTA, CODEC_ID_TTA, AUDIO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 8, 0 )
-    /* Shorten */
-    { VLC_FOURCC('s','h','n',' '), CODEC_ID_SHORTEN,
-      AUDIO_ES, "Shorten Lossless Audio" },
-    { VLC_FOURCC('s','h','r','n'), CODEC_ID_SHORTEN,
-      AUDIO_ES, "Shorten Lossless Audio" },
+    { VLC_CODEC_SHORTEN, CODEC_ID_SHORTEN, AUDIO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 16, 0 )
-    { VLC_FOURCC('w','v','p','k'), CODEC_ID_WAVPACK,
-      AUDIO_ES, "WavPack" },
-    { VLC_FOURCC('W','V','P','K'), CODEC_ID_WAVPACK,
-      AUDIO_ES, "WavPack" },
+    { VLC_CODEC_WAVPACK, CODEC_ID_WAVPACK, AUDIO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 34, 0 )
-    { VLC_FOURCC('g','s','m',' '), CODEC_ID_GSM,
-      AUDIO_ES, "GSM Audio" },
-    { VLC_FOURCC('a','g','s','m'), CODEC_ID_GSM_MS, /* According to http://wiki.multimedia.cx/index.php?title=GSM */
-      AUDIO_ES, "Microsoft GSM Audio" },
+    { VLC_CODEC_GSM, CODEC_ID_GSM, AUDIO_ES },
+    { VLC_CODEC_GSM_MS, CODEC_ID_GSM_MS, AUDIO_ES },
 #endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 40, 4 )
-    { VLC_FOURCC('a','t','r','c'), CODEC_ID_ATRAC3,
-      AUDIO_ES, "atrac 3" },
-    { VLC_FOURCC(0x70,0x2,0x0,0x0), CODEC_ID_ATRAC3,
-      AUDIO_ES, "atrac 3" },
+    { VLC_CODEC_ATRAC3, CODEC_ID_ATRAC3, AUDIO_ES },
 #endif
 
-    { VLC_FOURCC('S','O','N','C'), CODEC_ID_SONIC,
-      AUDIO_ES, "Sonic" },
+    { VLC_CODEC_SONIC, CODEC_ID_SONIC, AUDIO_ES },
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 34, 0 )
-    { VLC_FOURCC(0x1,0x4,0x0,0x0), CODEC_ID_IMC,
-      AUDIO_ES, "IMC" },
+    { VLC_CODEC_IMC, CODEC_ID_IMC, AUDIO_ES },
 #endif
-    { VLC_FOURCC(0x22,0x0,0x0,0x0), CODEC_ID_TRUESPEECH,
-      AUDIO_ES, "TrueSpeech" },
+    { VLC_CODEC_TRUESPEECH, CODEC_ID_TRUESPEECH, AUDIO_ES },
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 46, 0 )
-    { VLC_FOURCC('N','E','L','L'), CODEC_ID_NELLYMOSER,
-      AUDIO_ES, "NellyMoser ASAO" },
+    { VLC_CODEC_NELLYMOSER, CODEC_ID_NELLYMOSER, AUDIO_ES },
 #endif
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 44, 0 )
-    { VLC_FOURCC('A','P','E',' '), CODEC_ID_APE,
-      AUDIO_ES, "Monkey's Audio" },
+    { VLC_CODEC_APE, CODEC_ID_APE, AUDIO_ES },
 #endif
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 58, 0 )
-    { VLC_FOURCC('m','l','p',' '), CODEC_ID_MLP,
-      AUDIO_ES, "MLP/TrueHD Audio" },
+    { VLC_CODEC_MLP, CODEC_ID_MLP, AUDIO_ES },
 #endif
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 22, 0 )
-    { VLC_FOURCC('t','r','h','d'), CODEC_ID_TRUEHD,
-      AUDIO_ES, "TrueHD Audio" },
+    { VLC_CODEC_TRUEHD, CODEC_ID_TRUEHD, AUDIO_ES },
 #endif
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 6, 0 )
-    { VLC_FOURCC('Q','c','l','p'), CODEC_ID_QCELP,
-      AUDIO_ES, "QCELP Audio" },
+    { VLC_CODEC_QCELP, CODEC_ID_QCELP, AUDIO_ES },
 #endif
 
     /* PCM */
-    { VLC_FOURCC('s','8',' ',' '), CODEC_ID_PCM_S8,
-      AUDIO_ES, "PCM S8" },
-    { VLC_FOURCC('u','8',' ',' '), CODEC_ID_PCM_U8,
-      AUDIO_ES, "PCM U8" },
-    { VLC_FOURCC('s','1','6','l'), CODEC_ID_PCM_S16LE,
-      AUDIO_ES, "PCM S16 LE" },
-    { VLC_FOURCC('s','1','6','b'), CODEC_ID_PCM_S16BE,
-      AUDIO_ES, "PCM S16 BE" },
-    { VLC_FOURCC('u','1','6','l'), CODEC_ID_PCM_U16LE,
-      AUDIO_ES, "PCM U16 LE" },
-    { VLC_FOURCC('u','1','6','b'), CODEC_ID_PCM_U16BE,
-      AUDIO_ES, "PCM U16 BE" },
-    { VLC_FOURCC('s','2','4','l'), CODEC_ID_PCM_S24LE,
-      AUDIO_ES, "PCM S24 LE" },
-    { VLC_FOURCC('s','2','4','b'), CODEC_ID_PCM_S24BE,
-      AUDIO_ES, "PCM S24 BE" },
-    { VLC_FOURCC('u','2','4','l'), CODEC_ID_PCM_U24LE,
-      AUDIO_ES, "PCM U24 LE" },
-    { VLC_FOURCC('u','2','4','b'), CODEC_ID_PCM_U24BE,
-      AUDIO_ES, "PCM U24 BE" },
-    { VLC_FOURCC('s','3','2','l'), CODEC_ID_PCM_S32LE,
-      AUDIO_ES, "PCM S32 LE" },
-    { VLC_FOURCC('s','3','2','b'), CODEC_ID_PCM_S32BE,
-      AUDIO_ES, "PCM S32 BE" },
-    { VLC_FOURCC('u','3','2','l'), CODEC_ID_PCM_U32LE,
-      AUDIO_ES, "PCM U32 LE" },
-    { VLC_FOURCC('u','3','2','b'), CODEC_ID_PCM_U32BE,
-      AUDIO_ES, "PCM U32 BE" },
-    { VLC_FOURCC('a','l','a','w'), CODEC_ID_PCM_ALAW,
-      AUDIO_ES, "PCM ALAW" },
-    { VLC_FOURCC('u','l','a','w'), CODEC_ID_PCM_MULAW,
-      AUDIO_ES, "PCM ULAW" },
-    { VLC_FOURCC('d','a','u','d'), CODEC_ID_PCM_S24DAUD,
-      AUDIO_ES, "PCM ULAW" },
+    { VLC_CODEC_S8, CODEC_ID_PCM_S8, AUDIO_ES },
+    { VLC_CODEC_U8, CODEC_ID_PCM_U8, AUDIO_ES },
+    { VLC_CODEC_S16L, CODEC_ID_PCM_S16LE, AUDIO_ES },
+    { VLC_CODEC_S16B, CODEC_ID_PCM_S16BE, AUDIO_ES },
+    { VLC_CODEC_U16L, CODEC_ID_PCM_U16LE, AUDIO_ES },
+    { VLC_CODEC_U16B, CODEC_ID_PCM_U16BE, AUDIO_ES },
+    { VLC_CODEC_S24L, CODEC_ID_PCM_S24LE, AUDIO_ES },
+    { VLC_CODEC_S24B, CODEC_ID_PCM_S24BE, AUDIO_ES },
+    { VLC_CODEC_U24L, CODEC_ID_PCM_U24LE, AUDIO_ES },
+    { VLC_CODEC_U24B, CODEC_ID_PCM_U24BE, AUDIO_ES },
+    { VLC_CODEC_S32L, CODEC_ID_PCM_S32LE, AUDIO_ES },
+    { VLC_CODEC_S32B, CODEC_ID_PCM_S32BE, AUDIO_ES },
+    { VLC_CODEC_U32L, CODEC_ID_PCM_U32LE, AUDIO_ES },
+    { VLC_CODEC_U32B, CODEC_ID_PCM_U32BE, AUDIO_ES },
+    { VLC_CODEC_ALAW, CODEC_ID_PCM_ALAW, AUDIO_ES },
+    { VLC_CODEC_MULAW, CODEC_ID_PCM_MULAW, AUDIO_ES },
+    { VLC_CODEC_S24DAUD, CODEC_ID_PCM_S24DAUD, AUDIO_ES },
 
     /* Subtitle streams */
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 41, 0 )
     /* Before this version, subs were too experimental */
-    { VLC_FOURCC('s','p','u',' '), CODEC_ID_DVD_SUBTITLE,
-      SPU_ES, "DVD Subtitles" },
-    { VLC_FOURCC('d','v','b','s'), CODEC_ID_DVB_SUBTITLE,
-      SPU_ES, "DVB Subtitles" },
-    { VLC_FOURCC('s','u','b','t'), CODEC_ID_TEXT,
-      SPU_ES, "Plain text subtitles" },
-    { VLC_FOURCC('D','X','S','B'), CODEC_ID_XSUB,
-      SPU_ES, "DivX XSUB subtitles" },
+    { VLC_CODEC_SPU, CODEC_ID_DVD_SUBTITLE, SPU_ES },
+    { VLC_CODEC_DVBS, CODEC_ID_DVB_SUBTITLE, SPU_ES },
+    { VLC_CODEC_SUBT, CODEC_ID_TEXT, SPU_ES },
+    { VLC_CODEC_XSUB, CODEC_ID_XSUB, SPU_ES },
 #endif
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 51, 50, 0 )
-    { VLC_FOURCC('s','s','a',' '), CODEC_ID_SSA,
-      SPU_ES, "SubStation Alpha subtitles" },
+    { VLC_CODEC_SSA, CODEC_ID_SSA, SPU_ES },
 #endif
 
-    { 0, 0, 0, "" }
+    { 0, 0, UNKNOWN_ES }
 };
 
 int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
                     int *pi_ffmpeg_codec, const char **ppsz_name )
 {
+    i_fourcc = vlc_fourcc_GetCodec( UNKNOWN_ES, i_fourcc );
     for( unsigned i = 0; codecs_table[i].i_fourcc != 0; i++ )
     {
         if( codecs_table[i].i_fourcc == i_fourcc )
         {
             if( pi_cat ) *pi_cat = codecs_table[i].i_cat;
             if( pi_ffmpeg_codec ) *pi_ffmpeg_codec = codecs_table[i].i_codec;
-            if( ppsz_name ) *ppsz_name = (char *)codecs_table[i].psz_name;
+            if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( UNKNOWN_ES, i_fourcc );//char *)codecs_table[i].psz_name;
 
             return true;
         }
@@ -1187,7 +450,7 @@ int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
         {
             if( pi_cat ) *pi_cat = codecs_table[i].i_cat;
             if( pi_fourcc ) *pi_fourcc = codecs_table[i].i_fourcc;
-            if( ppsz_name ) *ppsz_name = codecs_table[i].psz_name;
+            if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( codecs_table[i].i_cat, codecs_table[i].i_fourcc );
 
             return true;
         }
index 1c2a2efc8eaa73d6279458041dcf17e0cfe0d206..8acbcaae892bf1ad289af1be2762b0f2fcb4e1f8 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 #include <vlc_codecs.h>                               /* BITMAPINFOHEADER */
 #include <vlc_avcodec.h>
 
@@ -128,7 +127,7 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
     if( GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) != VLC_SUCCESS )
     {
         /* we are doomed, but not really, because most codecs set their pix_fmt much later */
-        p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
+        p_dec->fmt_out.i_codec = VLC_CODEC_I420;
     }
     p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma;
 
@@ -195,7 +194,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     p_sys->b_delayed_open = true;
 
     /* ***** Fill p_context with init values ***** */
-    p_sys->p_context->codec_tag = ffmpeg_CodecTag( p_dec->fmt_in.i_codec );
+    p_sys->p_context->codec_tag = ffmpeg_CodecTag( p_dec->fmt_in.i_original_fourcc ?: p_dec->fmt_in.i_codec );
 
     /*  ***** Get configuration of ffmpeg plugin ***** */
     p_sys->p_context->workaround_bugs =
@@ -340,7 +339,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     if( GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) != VLC_SUCCESS )
     {
         /* we are doomed. but not really, because most codecs set their pix_fmt later on */
-        p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
+        p_dec->fmt_out.i_codec = VLC_CODEC_I420;
     }
     p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma;
 
index 419d576626823f8374ed551d73c73be5bb465683..59614a161707ed0fc6e4d332035efa9f63329242 100644 (file)
@@ -39,7 +39,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_input.h>
 
@@ -210,7 +209,7 @@ static int Open( vlc_object_t *p_this )
     Eia608Init( &p_sys->eia608 );
 
     p_dec->fmt_out.i_cat = SPU_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('T','E','X','T');
+    p_dec->fmt_out.i_codec = VLC_CODEC_TEXT;
 
     return VLC_SUCCESS;
 }
@@ -340,7 +339,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_height = 0;
     fmt.i_x_offset = fmt.i_y_offset = 0;
index c1a3e754a014daecd5def969713962d1d3070999..8b3d574e59ea275670e967c5f4fa79eac30d3f89 100644 (file)
@@ -31,7 +31,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 
 /*****************************************************************************
  * decoder_sys_t : decoder descriptor
@@ -99,7 +98,7 @@ static int Open( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('C','D','G',' ') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_CDG )
         return VLC_EGENERIC;
 
     /* Allocate the memory needed to store the decoder's structure */
@@ -114,7 +113,7 @@ static int Open( vlc_object_t *p_this )
     /* Set output properties
      * TODO maybe it would be better to use RV16 or RV24 ? */
     p_dec->fmt_out.i_cat = VIDEO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('R','V','3','2');
+    p_dec->fmt_out.i_codec = VLC_CODEC_RGB32;
     p_dec->fmt_out.video.i_width = CDG_DISPLAY_WIDTH;
     p_dec->fmt_out.video.i_height = CDG_DISPLAY_HEIGHT;
     p_dec->fmt_out.video.i_aspect =
index 109d346505b81c5106802a757365c6b5e5f29fae..fa69d525e427f104ecd1fdc5b1fe01325722f32f 100644 (file)
@@ -93,7 +93,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     input_thread_t * p_input;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('c','m','m','l') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_CMML )
         return VLC_EGENERIC;
 
     p_dec->pf_decode_sub = DecodeBlock;
index 3802f4a3322a7d95d9f0e65125257f1830fa770c..d7d7909bf971d0deadff8474b14046aca00e30f7 100644 (file)
@@ -34,7 +34,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_osd.h>
 #include <vlc_input.h>
@@ -102,7 +101,7 @@ static int Create( vlc_object_t *p_this )
     csri_rend *p_render;
     struct csri_stream_ext *p_stream_ext;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('s','s','a',' ') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_SSA )
         return VLC_EGENERIC;
 
     p_render = csri_renderer_default();
@@ -131,7 +130,7 @@ static int Create( vlc_object_t *p_this )
                                                    p_dec->fmt_in.p_extra ? strnlen( p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra ) : 0,
                                                    NULL);
     p_dec->fmt_out.i_cat = SPU_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('R','G','B','A');
+    p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
 
     return VLC_SUCCESS;
 }
@@ -268,7 +267,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
     /* XXX On x86 at least our RGBA is mapped to their BGRA
      * TODO confirm that is the same on big endian cpu */
     fmt = *p_fmt;
-    fmt.i_chroma = VLC_FOURCC('R','G','B','A');
+    fmt.i_chroma = VLC_CODEC_RGBA;
     fmt.i_width = fmt.i_visible_width;
     fmt.i_height = fmt.i_visible_height;
     fmt.i_bits_per_pixel = 0;
index dbd59164dc718ef19ce7bc339ed0386a40b5ebb4..adec5547f40d23e8209690f66304e505fbc9f845 100644 (file)
@@ -33,7 +33,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 
 #include "vlc_bits.h"
@@ -111,10 +110,8 @@ static int DecoderOpen( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC( 'c','v','d',' ' ) )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_CVD )
         return VLC_EGENERIC;
-    }
 
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
     if( !p_sys )
@@ -129,7 +126,7 @@ static int DecoderOpen( vlc_object_t *p_this )
     p_dec->pf_packetize  = Packetize;
 
     p_dec->fmt_out.i_cat = SPU_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('Y','U','V','P');
+    p_dec->fmt_out.i_codec = VLC_CODEC_YUVP;
 
     return VLC_SUCCESS;
 }
@@ -512,7 +509,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
 
     /* Create new SPU region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','P');
+    fmt.i_chroma = VLC_CODEC_YUVP;
     fmt.i_aspect = VOUT_ASPECT_FACTOR;
     fmt.i_width = fmt.i_visible_width = p_sys->i_width;
     fmt.i_height = fmt.i_visible_height = p_sys->i_height;
index f397ba281a829f9073778fc0356d9cfe7cd5b746..f24dd18b0e3ee9a6a1fe5f87d8f9ca53e9135a25 100644 (file)
@@ -41,7 +41,6 @@
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 
 #include <libdirac_encoder/dirac_encoder.h>
 
@@ -443,7 +442,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     float f_tmp;
     char *psz_tmp;
 
-    if( p_enc->fmt_out.i_codec != VLC_FOURCC('d','r','a','c') &&
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_DIRAC &&
         !p_enc->b_force )
     {
         return VLC_EGENERIC;
@@ -462,7 +461,7 @@ static int OpenEncoder( vlc_object_t *p_this )
 
     p_enc->p_sys = p_sys;
     p_enc->pf_encode_video = Encode;
-    p_enc->fmt_out.i_codec = VLC_FOURCC('d','r','a','c');
+    p_enc->fmt_out.i_codec = VLC_CODEC_DIRAC;
     p_enc->fmt_out.i_cat = VIDEO_ES;
 
     if( ( p_sys->p_dts_fifo = block_FifoNew() ) == NULL )
@@ -519,19 +518,19 @@ static int OpenEncoder( vlc_object_t *p_this )
     if( !psz_tmp )
         goto error;
     else if( !strcmp( psz_tmp, "420" ) ) {
-        p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
+        p_enc->fmt_in.i_codec = VLC_CODEC_I420;
         p_enc->fmt_in.video.i_bits_per_pixel = 12;
         p_sys->ctx.src_params.chroma = format420;
         p_sys->i_buffer_in = p_enc->fmt_in.video.i_width * p_enc->fmt_in.video.i_height * 3 / 2;
     }
     else if( !strcmp( psz_tmp, "422" ) ) {
-        p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','2');
+        p_enc->fmt_in.i_codec = VLC_CODEC_I422;
         p_enc->fmt_in.video.i_bits_per_pixel = 16;
         p_sys->ctx.src_params.chroma = format422;
         p_sys->i_buffer_in = p_enc->fmt_in.video.i_width * p_enc->fmt_in.video.i_height * 2;
     }
     else if( !strcmp( psz_tmp, "444" ) ) {
-        p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','4','4');
+        p_enc->fmt_in.i_codec = VLC_CODEC_I444;
         p_enc->fmt_in.video.i_bits_per_pixel = 24;
         p_sys->ctx.src_params.chroma = format444;
         p_sys->i_buffer_in = p_enc->fmt_in.video.i_width * p_enc->fmt_in.video.i_height * 3;
index 321709df219adb552a9ec4c0ce392b698c022a55..5f66b58a811803b5543b2d9fc2891d03601f91a7 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 
 #ifndef WIN32
 #    define LOADER
index 2e51be23f589e8159819e91cd22fe854a98615b5..4be0bf315a4b67e0f8ef3e3e7da42a271ce0afa0 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 #include <vlc_aout.h>
 
 #ifndef WIN32
@@ -186,44 +185,30 @@ typedef struct
 static const codec_dll decoders_table[] =
 {
     /* WVC1 */
-    { VLC_FOURCC('W','V','C','1'), "wvc1dmod.dll", &guid_wvc1 },
-    { VLC_FOURCC('w','v','c','1'), "wvc1dmod.dll", &guid_wvc1 },
+    { VLC_CODEC_VC1,    "wvc1dmod.dll", &guid_wvc1 },
     /* WMV3 */
-    { VLC_FOURCC('W','M','V','3'), "wmv9dmod.dll", &guid_wmv9 },
-    { VLC_FOURCC('w','m','v','3'), "wmv9dmod.dll", &guid_wmv9 },
-    { VLC_FOURCC('W','M','V','P'), "wmv9dmod.dll", &guid_wmv9 },
-    { VLC_FOURCC('w','m','v','p'), "wmv9dmod.dll", &guid_wmv9 },
+    { VLC_CODEC_WMV3,   "wmv9dmod.dll", &guid_wmv9 },
     /* WMV2 */
-    { VLC_FOURCC('W','M','V','2'), "wmvdmod.dll", &guid_wmv },
-    { VLC_FOURCC('w','m','v','2'), "wmvdmod.dll", &guid_wmv },
+    { VLC_CODEC_WMV2,   "wmvdmod.dll", &guid_wmv },
     /* WMV1 */
-    { VLC_FOURCC('W','M','V','1'), "wmvdmod.dll", &guid_wmv },
-    { VLC_FOURCC('w','m','v','1'), "wmvdmod.dll", &guid_wmv },
+    { VLC_CODEC_WMV1,   "wmvdmod.dll", &guid_wmv },
     /* Screen codecs */
     { VLC_FOURCC('M','S','S','2'), "wmsdmod.dll", &guid_wms },
     { VLC_FOURCC('m','s','s','2'), "wmsdmod.dll", &guid_wms },
     { VLC_FOURCC('M','S','S','1'), "wmsdmod.dll", &guid_wms },
     { VLC_FOURCC('m','s','s','1'), "wmsdmod.dll", &guid_wms },
     /* Windows Media Video Adv */
-    { VLC_FOURCC('W','M','V','A'), "wmvadvd.dll", &guid_wmva },
-    { VLC_FOURCC('w','m','v','a'), "wmvadvd.dll", &guid_wmva },
-    { VLC_FOURCC('W','V','P','2'), "wmvadvd.dll", &guid_wmva },
-    { VLC_FOURCC('w','v','p','2'), "wmvadvd.dll", &guid_wmva },
+    { VLC_CODEC_WMVA,   "wmvadvd.dll", &guid_wmva },
 
     /* WMA 3 */
-    { VLC_FOURCC('W','M','A','3'), "wma9dmod.dll", &guid_wma9 },
-    { VLC_FOURCC('w','m','a','3'), "wma9dmod.dll", &guid_wma9 },
-    { VLC_FOURCC('W','M','A','P'), "wma9dmod.dll", &guid_wma9 },
-    { VLC_FOURCC('w','m','a','p'), "wma9dmod.dll", &guid_wma9 },
-    { VLC_FOURCC('W','M','A','L'), "wma9dmod.dll", &guid_wma9 },
-    { VLC_FOURCC('w','m','a','l'), "wma9dmod.dll", &guid_wma9 },
+    { VLC_CODEC_WMAP,   "wma9dmod.dll", &guid_wma9 },
+    { VLC_CODEC_WMAL,   "wma9dmod.dll", &guid_wma9 },
+
     /* WMA 2 */
-    { VLC_FOURCC('W','M','A','2'), "wma9dmod.dll", &guid_wma9 },
-    { VLC_FOURCC('w','m','a','2'), "wma9dmod.dll", &guid_wma9 },
+    { VLC_CODEC_WMA2,   "wma9dmod.dll", &guid_wma9 },
 
     /* WMA Speech */
-    { VLC_FOURCC('W','M','A','S'), "wmspdmod.dll", &guid_wma },
-    { VLC_FOURCC('w','m','a','s'), "wmspdmod.dll", &guid_wma },
+    { VLC_CODEC_WMAS,   "wmspdmod.dll", &guid_wma },
 
     /* */
     { 0, NULL, NULL }
@@ -232,21 +217,16 @@ static const codec_dll decoders_table[] =
 static const codec_dll encoders_table[] =
 {
     /* WMV3 */
-    { VLC_FOURCC('W','M','V','3'), "wmvdmoe2.dll", &guid_wmv_enc2 },
-    { VLC_FOURCC('w','m','v','3'), "wmvdmoe2.dll", &guid_wmv_enc2 },
+    { VLC_CODEC_WMV3, "wmvdmoe2.dll", &guid_wmv_enc2 },
     /* WMV2 */
-    { VLC_FOURCC('W','M','V','2'), "wmvdmoe2.dll", &guid_wmv_enc2 },
-    { VLC_FOURCC('w','m','v','2'), "wmvdmoe2.dll", &guid_wmv_enc2 },
+    { VLC_CODEC_WMV2, "wmvdmoe2.dll", &guid_wmv_enc2 },
     /* WMV1 */
-    { VLC_FOURCC('W','M','V','1'), "wmvdmoe2.dll", &guid_wmv_enc2 },
-    { VLC_FOURCC('w','m','v','1'), "wmvdmoe2.dll", &guid_wmv_enc2 },
+    { VLC_CODEC_WMV1, "wmvdmoe2.dll", &guid_wmv_enc2 },
 
     /* WMA 3 */
-    { VLC_FOURCC('W','M','A','3'), "wmadmoe.dll", &guid_wma_enc },
-    { VLC_FOURCC('w','m','a','3'), "wmadmoe.dll", &guid_wma_enc },
+    { VLC_CODEC_WMAP, "wmadmoe.dll", &guid_wma_enc },
     /* WMA 2 */
-    { VLC_FOURCC('W','M','A','2'), "wmadmoe.dll", &guid_wma_enc },
-    { VLC_FOURCC('w','m','a','2'), "wmadmoe.dll", &guid_wma_enc },
+    { VLC_CODEC_WMA2, "wmadmoe.dll", &guid_wma_enc },
 
     /* */
     { 0, NULL, NULL }
@@ -418,7 +398,7 @@ static int DecOpen( decoder_t *p_dec )
 
         dmo_input_type.majortype  = MEDIATYPE_Audio;
         dmo_input_type.subtype    = dmo_input_type.majortype;
-        dmo_input_type.subtype.Data1 = p_dec->fmt_in.i_codec;
+        dmo_input_type.subtype.Data1 = p_dec->fmt_in.i_original_fourcc ?: p_dec->fmt_in.i_codec;
         fourcc_to_wf_tag( p_dec->fmt_in.i_codec, &i_tag );
         if( i_tag ) dmo_input_type.subtype.Data1 = i_tag;
 
@@ -449,7 +429,7 @@ static int DecOpen( decoder_t *p_dec )
             memcpy( &p_vih[1], p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
 
         p_bih = &p_vih->bmiHeader;
-        p_bih->biCompression = p_dec->fmt_in.i_codec;
+        p_bih->biCompression = p_dec->fmt_in.i_original_fourcc ?: p_dec->fmt_in.i_codec;
         p_bih->biWidth = p_dec->fmt_in.video.i_width;
         p_bih->biHeight = p_dec->fmt_in.video.i_height;
         p_bih->biBitCount = p_dec->fmt_in.video.i_bits_per_pixel;
@@ -464,7 +444,7 @@ static int DecOpen( decoder_t *p_dec )
 
         dmo_input_type.majortype  = MEDIATYPE_Video;
         dmo_input_type.subtype    = dmo_input_type.majortype;
-        dmo_input_type.subtype.Data1 = p_dec->fmt_in.i_codec;
+        dmo_input_type.subtype.Data1 = p_dec->fmt_in.i_original_fourcc ?: p_dec->fmt_in.i_codec;
         dmo_input_type.formattype = FORMAT_VideoInfo;
         dmo_input_type.bFixedSizeSamples = 0;
         dmo_input_type.bTemporalCompression = 1;
@@ -486,7 +466,7 @@ static int DecOpen( decoder_t *p_dec )
     if( p_dec->fmt_in.i_cat == AUDIO_ES )
     {
         /* Setup the format */
-        p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
+        p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
         p_dec->fmt_out.audio.i_rate     = p_dec->fmt_in.audio.i_rate;
         p_dec->fmt_out.audio.i_channels = p_dec->fmt_in.audio.i_channels;
         p_dec->fmt_out.audio.i_bitspersample = 16;//p_dec->fmt_in.audio.i_bitspersample; We request 16
@@ -517,14 +497,14 @@ static int DecOpen( decoder_t *p_dec )
     {
         BITMAPINFOHEADER *p_bih;
         DMO_MEDIA_TYPE mt;
-        unsigned i_chroma = VLC_FOURCC('Y','U','Y','2');
+        unsigned i_chroma = VLC_CODEC_YUYV;
         int i_planes = 1, i_bpp = 16;
         int i = 0;
 
         /* Find out which chroma to use */
         while( !p_dmo->vt->GetOutputType( p_dmo, 0, i++, &mt ) )
         {
-            if( mt.subtype.Data1 == VLC_FOURCC('Y','V','1','2') )
+            if( mt.subtype.Data1 == VLC_CODEC_YV12 )
             {
                 i_chroma = mt.subtype.Data1;
                 i_planes = 3; i_bpp = 12;
@@ -533,8 +513,8 @@ static int DecOpen( decoder_t *p_dec )
             DMOFreeMediaType( &mt );
         }
 
-        p_dec->fmt_out.i_codec = i_chroma == VLC_FOURCC('Y','V','1','2') ?
-            VLC_FOURCC('I','4','2','0') : i_chroma;
+        p_dec->fmt_out.i_codec = i_chroma == VLC_CODEC_YV12 ?
+            VLC_CODEC_I420 : i_chroma;
         p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
         p_dec->fmt_out.video.i_height = p_dec->fmt_in.video.i_height;
         p_dec->fmt_out.video.i_bits_per_pixel = i_bpp;
@@ -696,7 +676,7 @@ static int LoadDMO( vlc_object_t *p_this, HINSTANCE *p_hmsdmo_dll,
         uint16_t i_tag;
         dmo_partial_type.type = MEDIATYPE_Audio;
         dmo_partial_type.subtype = dmo_partial_type.type;
-        dmo_partial_type.subtype.Data1 = p_fmt->i_codec;
+        dmo_partial_type.subtype.Data1 = p_fmt->i_original_fourcc ?: p_fmt->i_codec;
         fourcc_to_wf_tag( p_fmt->i_codec, &i_tag );
         if( i_tag ) dmo_partial_type.subtype.Data1 = i_tag;
     }
@@ -704,7 +684,7 @@ static int LoadDMO( vlc_object_t *p_this, HINSTANCE *p_hmsdmo_dll,
     {
         dmo_partial_type.type = MEDIATYPE_Video;
         dmo_partial_type.subtype = dmo_partial_type.type;
-        dmo_partial_type.subtype.Data1 = p_fmt->i_codec;
+        dmo_partial_type.subtype.Data1 = p_fmt->i_original_fourcc ?: p_fmt->i_codec;
     }
 
 #ifndef LOADER
@@ -1145,7 +1125,7 @@ static int EncoderSetVideoType( encoder_t *p_enc, IMediaObject *p_dmo )
     memset( &vih, 0, sizeof(VIDEOINFOHEADER) );
 
     p_bih = &vih.bmiHeader;
-    p_bih->biCompression = VLC_FOURCC('I','4','2','0');
+    p_bih->biCompression = VLC_CODEC_I420;
     p_bih->biWidth = p_enc->fmt_in.video.i_width;
     p_bih->biHeight = p_enc->fmt_in.video.i_height;
     p_bih->biBitCount = p_enc->fmt_in.video.i_bits_per_pixel;
@@ -1260,7 +1240,7 @@ static int EncoderSetVideoType( encoder_t *p_enc, IMediaObject *p_dmo )
     i_err = p_dmo->vt->SetOutputType( p_dmo, 0, &dmo_type, 0 );
 
     p_vih = (VIDEOINFOHEADER *)dmo_type.pbFormat;
-    p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
+    p_enc->fmt_in.i_codec = VLC_CODEC_I420;
 
     DMOFreeMediaType( &dmo_type );
     if( i_err )
@@ -1288,7 +1268,7 @@ static int EncoderSetAudioType( encoder_t *p_enc, IMediaObject *p_dmo )
     fourcc_to_wf_tag( p_enc->fmt_out.i_codec, &i_tag );
     if( i_tag == 0 ) return VLC_EGENERIC;
 
-    p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
+    p_enc->fmt_in.i_codec = VLC_CODEC_S16N;
     p_enc->fmt_in.audio.i_bitspersample = 16;
 
     /* We first need to choose an output type from the predefined
index 9b4ac47f8d2a92ecf1fe9c414570e584a99bfa5a..163609d3422bae1ea0e9572df26d50f06a4e4622 100644 (file)
@@ -140,11 +140,8 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('d','t','s',' ') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('d','t','s','b') )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_DTS )
         return VLC_EGENERIC;
-    }
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys = malloc(sizeof(*p_sys)) ) == NULL )
@@ -160,7 +157,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('d','t','s',' ');
+    p_dec->fmt_out.i_codec = VLC_CODEC_DTS;
     p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
 
     /* Set callback */
index b102cd069c810500b6cc883c54448476fc9aeb69..3345eeb2e7e159dccfae9642face022177ad7e82 100644 (file)
@@ -45,7 +45,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_sout.h>
 
@@ -296,7 +295,7 @@ static int Open( vlc_object_t *p_this )
     vlc_value_t    val;
     int i_posx, i_posy;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('d','v','b','s') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_DVBS )
     {
         return VLC_EGENERIC;
     }
@@ -1537,12 +1536,12 @@ static subpicture_t *render( decoder_t *p_dec )
             continue;
         }
 
-        /* FIXME: don't create a subpicture region with VLC_FOURCC YUVP 
+        /* FIXME: don't create a subpicture region with VLC CODEC YUVP 
          * when it actually is a TEXT region */
 
         /* Create new SPU region */
         memset( &fmt, 0, sizeof(video_format_t) );
-        fmt.i_chroma = VLC_FOURCC('Y','U','V','P');
+        fmt.i_chroma = VLC_CODEC_YUVP;
         fmt.i_aspect = 0; /* 0 means use aspect ratio of background video */
         fmt.i_width = fmt.i_visible_width = p_region->i_width;
         fmt.i_height = fmt.i_visible_height = p_region->i_height;
@@ -1595,7 +1594,7 @@ static subpicture_t *render( decoder_t *p_dec )
 
             /* Create new SPU region */
             memset( &fmt, 0, sizeof(video_format_t) );
-            fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+            fmt.i_chroma = VLC_CODEC_TEXT;
             fmt.i_aspect = VOUT_ASPECT_FACTOR;
             fmt.i_width = fmt.i_visible_width = p_region->i_width;
             fmt.i_height = fmt.i_visible_height = p_region->i_height;
@@ -1659,7 +1658,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_sys_t *p_sys;
     vlc_value_t val;
 
-    if( ( p_enc->fmt_out.i_codec != VLC_FOURCC('d','v','b','s') ) &&
+    if( ( p_enc->fmt_out.i_codec != VLC_CODEC_DVBS ) &&
         !p_enc->b_force )
     {
         return VLC_EGENERIC;
@@ -1671,7 +1670,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->p_sys = p_sys;
 
     p_enc->pf_encode_sub = Encode;
-    p_enc->fmt_out.i_codec = VLC_FOURCC('d','v','b','s');
+    p_enc->fmt_out.i_codec = VLC_CODEC_DVBS;
     p_enc->fmt_out.subs.dvb.i_id  = 1 << 16 | 1;
 
     config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
@@ -1692,8 +1691,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     return VLC_SUCCESS;
 }
 
-/* FIXME: this routine is a hack to convert VLC_FOURCC('Y','U','V','A')
- *        into VLC_FOURCC('Y','U','V','P')
+/* FIXME: this routine is a hack to convert VLC_CODEC_YUVA
+ *        into VLC_CODEC_YUVP
  */
 static subpicture_t *YuvaYuvp( subpicture_t *p_subpic )
 {
@@ -1722,7 +1721,7 @@ static subpicture_t *YuvaYuvp( subpicture_t *p_subpic )
 #ifdef DEBUG_DVBSUB
         msg_Dbg( p_enc, "YuvaYuvp: i_pixels=%d, i_iterator=%d", i_pixels, i_iterator );
 #endif
-        p_fmt->i_chroma = VLC_FOURCC('Y','U','V','P');
+        p_fmt->i_chroma = VLC_CODEC_YUVP;
         p_fmt->p_palette = (video_palette_t *) malloc( sizeof( video_palette_t ) );
         if( !p_fmt->p_palette ) break;
         p_fmt->p_palette->i_entries = 0;
@@ -1909,11 +1908,11 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
 
     if( !p_subpic || !p_subpic->p_region ) return NULL;
 
-    /* FIXME: this is a hack to convert VLC_FOURCC('Y','U','V','A') into
-     *  VLC_FOURCC('Y','U','V','P')
+    /* FIXME: this is a hack to convert VLC_CODEC_YUVA into
+     *  VLC_CODEC_YUVP
      */
     p_region = p_subpic->p_region;
-    if( p_region->fmt.i_chroma == VLC_FOURCC('Y','U','V','A') )
+    if( p_region->fmt.i_chroma == VLC_CODEC_YUVA )
     {
         p_temp = YuvaYuvp( p_subpic );
         if( !p_temp )
@@ -1927,8 +1926,8 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
     /* Sanity check */
     if( !p_region ) return NULL;
 
-    if( ( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') ) &&
-        ( p_region->fmt.i_chroma != VLC_FOURCC('Y','U','V','P') ) )
+    if( ( p_region->fmt.i_chroma != VLC_CODEC_TEXT ) &&
+        ( p_region->fmt.i_chroma != VLC_CODEC_YUVP ) )
     {
         char psz_fourcc[5];
         memset( &psz_fourcc, 0, sizeof( psz_fourcc ) );
@@ -2113,7 +2112,7 @@ static void encode_clut( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic )
     /* Sanity check */
     if( !p_region ) return;
 
-    if( p_region->fmt.i_chroma == VLC_FOURCC('Y','U','V','P') )
+    if( p_region->fmt.i_chroma == VLC_CODEC_YUVP )
     {
         p_pal = p_region->fmt.p_palette;
     }
@@ -2167,7 +2166,7 @@ static void encode_region_composition( encoder_t *p_enc, bs_t *s,
     {
         int i_entries = 4, i_depth = 0x1, i_bg = 0;
         bool b_text =
-            ( p_region->fmt.i_chroma == VLC_FOURCC('T','E','X','T') );
+            ( p_region->fmt.i_chroma == VLC_CODEC_TEXT );
 
         if( !b_text )
         {
@@ -2253,10 +2252,10 @@ static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic )
         /* object coding method */
         switch( p_region->fmt.i_chroma )
         {
-        case VLC_FOURCC( 'Y','U','V','P' ):
+        case VLC_CODEC_YUVP:
             bs_write( s, 2, 0 );
             break;
-        case VLC_FOURCC( 'T','E','X','T' ):
+        case VLC_CODEC_TEXT:
             bs_write( s, 2, 1 );
             break;
         default:
@@ -2267,7 +2266,7 @@ static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic )
         bs_write( s, 1, 0 ); /* non modifying color flag */
         bs_write( s, 1, 0 ); /* Reserved */
 
-        if( p_region->fmt.i_chroma == VLC_FOURCC( 'T','E','X','T' ) )
+        if( p_region->fmt.i_chroma == VLC_CODEC_TEXT )
         {
             int i_size, i;
 
@@ -2326,7 +2325,7 @@ static void encode_pixel_data( encoder_t *p_enc, bs_t *s,
     unsigned int i_line;
 
     /* Sanity check */
-    if( p_region->fmt.i_chroma != VLC_FOURCC('Y','U','V','P') ) return;
+    if( p_region->fmt.i_chroma != VLC_CODEC_YUVP ) return;
 
     /* Encode line by line */
     for( i_line = !b_top; i_line < p_region->fmt.i_visible_height;
index e050a94bc0e15293f45ca1502f5998f249bd1437..3633bc893dfa6d6f89c72ecd7837845fc85980bb 100644 (file)
@@ -117,7 +117,7 @@ static int Open( vlc_object_t *p_this )
     decoder_sys_t *p_sys = p_dec->p_sys;
     faacDecConfiguration *cfg;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','4','a') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MP4A )
     {
         return VLC_EGENERIC;
     }
@@ -138,9 +138,9 @@ static int Open( vlc_object_t *p_this )
     p_dec->fmt_out.i_cat = AUDIO_ES;
 
     if (vlc_CPU() & CPU_CAPABILITY_FPU)
-        p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+        p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
     else
-        p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
+        p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
     p_dec->pf_decode_audio = DecodeBlock;
 
     p_dec->fmt_out.audio.i_physical_channels =
index 0696eb1b8d5b2571d8a10d86b3cb32aa6da5b129..a13b6717905b3f786f89c04d8a670ebc477fbfae 100644 (file)
@@ -169,17 +169,11 @@ static int OpenDecoder( vlc_object_t *p_this )
     var_AddCallback( p_dec, "fake-file-reload", FakeCallback , p_dec );
 
     psz_chroma = var_CreateGetString( p_dec, "fake-chroma" );
-    if( strlen( psz_chroma ) != 4 )
+    fmt_out.i_chroma = vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_chroma );
+    if( !fmt_out.i_chroma )
     {
         msg_Warn( p_dec, "Invalid chroma (%s). Using I420.", psz_chroma );
-        fmt_out.i_chroma = VLC_FOURCC('I','4','2','0');
-    }
-    else
-    {
-        fmt_out.i_chroma = VLC_FOURCC( psz_chroma[0],
-                                       psz_chroma[1],
-                                       psz_chroma[2],
-                                       psz_chroma[3] );
+        fmt_out.i_chroma = VLC_CODEC_I420;
     }
     free( psz_chroma );
 
index be411d5489e14e3a49ef35fe41006c99c038e8e0..856019b004a4f0efdc3b3a8c578924985ad35512 100644 (file)
@@ -210,7 +210,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('f','l','a','c') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_FLAC )
     {
         return VLC_EGENERIC;
     }
@@ -270,7 +270,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+    p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
 
     /* Set callbacks */
 #ifdef USE_LIBFLAC
@@ -294,7 +294,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
     p_dec->pf_packetize    = PacketizeBlock;
 
     /* Set output properties */
-    p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','a','c');
+    p_dec->fmt_out.i_codec = VLC_CODEC_FLAC;
 
     if( i_ret != VLC_SUCCESS )
     {
@@ -359,7 +359,7 @@ static void ProcessHeader( decoder_t *p_dec )
 
     if( !p_sys->b_stream_info ) return;
 
-    if( p_dec->fmt_out.i_codec == VLC_FOURCC('f','l','a','c') )
+    if( p_dec->fmt_out.i_codec == VLC_CODEC_FLAC )
     {
         p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
         p_dec->fmt_out.p_extra =
@@ -685,18 +685,18 @@ static void DecoderMetadataCallback( const FLAC__StreamDecoder *decoder,
         switch( metadata->data.stream_info.bits_per_sample )
         {
         case 8:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','8',' ',' ');
+            p_dec->fmt_out.i_codec = VLC_CODEC_S8;
             break;
         case 16:
-            p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
+            p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
             break;
         case 24:
-            p_dec->fmt_out.i_codec = AOUT_FMT_S24_NE;
+            p_dec->fmt_out.i_codec = VLC_CODEC_S24N;
             break;
         default:
             msg_Dbg( p_dec, "strange bit/sample value: %d",
                      metadata->data.stream_info.bits_per_sample );
-            p_dec->fmt_out.i_codec = VLC_FOURCC('f','i','3','2');
+            p_dec->fmt_out.i_codec = VLC_CODEC_FI32;
             break;
         }
     }
@@ -1284,7 +1284,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_t *p_enc = (encoder_t *)p_this;
     encoder_sys_t *p_sys;
 
-    if( p_enc->fmt_out.i_codec != VLC_FOURCC('f','l','a','c') &&
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_FLAC &&
         !p_enc->b_force )
     {
         return VLC_EGENERIC;
@@ -1295,7 +1295,7 @@ static int OpenEncoder( vlc_object_t *p_this )
         return VLC_ENOMEM;
     p_enc->p_sys = p_sys;
     p_enc->pf_encode_audio = Encode;
-    p_enc->fmt_out.i_codec = VLC_FOURCC('f','l','a','c');
+    p_enc->fmt_out.i_codec = VLC_CODEC_FLAC;
 
     p_sys->i_headers = 0;
     p_sys->p_buffer = 0;
@@ -1316,7 +1316,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     FLAC__stream_encoder_set_sample_rate( p_sys->p_flac,
                                           p_enc->fmt_in.audio.i_rate );
     FLAC__stream_encoder_set_bits_per_sample( p_sys->p_flac, 16 );
-    p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
+    p_enc->fmt_in.i_codec = VLC_CODEC_S16N;
 
     /* Get and store the STREAMINFO metadata block as a p_extra */
     p_sys->p_chain = 0;
index f0ef618cf91cb266744a1850ce4e387e9389368e..ae08aeff7cdc04587158a9511fb8ed7545dfe921 100644 (file)
@@ -66,7 +66,7 @@ static int Open (vlc_object_t *p_this)
     decoder_t *p_dec = (decoder_t *)p_this;
     decoder_sys_t *p_sys;
 
-    if (p_dec->fmt_in.i_codec != VLC_FOURCC ('M', 'I', 'D', 'I'))
+    if (p_dec->fmt_in.i_codec != VLC_CODEC_MIDI)
         return VLC_EGENERIC;
 
     char *font_path = var_CreateGetNonEmptyString (p_this, "soundfont");
@@ -82,7 +82,7 @@ static int Open (vlc_object_t *p_this)
     p_dec->fmt_out.audio.i_original_channels =
     p_dec->fmt_out.audio.i_physical_channels =
         AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('f', 'l', '3', '2');
+    p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
     p_dec->fmt_out.audio.i_bitspersample = 32;
 
     p_dec->pf_decode_audio = DecodeBlock;
index 396e80c58ad677126e6583f3817a4ad9e97dd46d..2990644f16584d2b5b0a6157e52bb36f124f5167 100644 (file)
@@ -151,8 +151,8 @@ static int OpenDecoder( vlc_object_t *p_this )
     }
 
     /* Set output properties */
-    //p_dec->fmt_out.i_codec = VLC_FOURCC('R','G','B','A');
-    p_dec->fmt_out.i_codec = VLC_FOURCC('R','V','2','4');
+    //p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
+    p_dec->fmt_out.i_codec = VLC_CODEC_RGB24;
     p_dec->fmt_out.video.i_width = p_dec->p_sys->i_width;
     p_dec->fmt_out.video.i_height = p_dec->p_sys->i_height;
     p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->p_sys->i_width / p_dec->p_sys->i_height;
@@ -189,7 +189,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     if( p_sys->p_pic != NULL )
         picture_Release( p_sys->p_pic );
     p_sys->p_pic = decoder_NewPicture( p_dec );
-    p_sys->p_pic = p_dec->pf_vout_buffer_new( p_dec );
     p_sys->p_pic->b_force = true;
     p_sys->p_pic->p->i_pitch = p_dec->p_sys->i_pitch;
     p_sys->p_pic->date = p_block->i_pts > 0 ? p_block->i_pts : p_block->i_dts;
index a6d8ef4156f315111baeccd42811453277dfa0b8..b85bf2e7c17b1f978d36cbb04ac6a14c1a76436c 100644 (file)
@@ -346,7 +346,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
     int            i_ret;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('k','a','t','e') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_KATE )
     {
         return VLC_EGENERIC;
     }
@@ -450,7 +450,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
     if( i_ret == VLC_SUCCESS )
     {
         p_dec->p_sys->b_packetizer = true;
-        p_dec->fmt_out.i_codec = VLC_FOURCC( 'k', 'a', 't', 'e' );
+        p_dec->fmt_out.i_codec = VLC_CODEC_KATE;
     }
 
     return i_ret;
@@ -952,7 +952,7 @@ static void TigerUpdateRegions( spu_t *p_spu, subpicture_t *p_subpic, const vide
 
     /* create a full frame region - this will also tell Tiger the size of the frame */
     fmt = *p_fmt;
-    fmt.i_chroma = VLC_FOURCC('R','G','B','A');
+    fmt.i_chroma = VLC_CODEC_RGBA;
     fmt.i_width = fmt.i_visible_width;
     fmt.i_height = fmt.i_visible_height;
     fmt.i_bits_per_pixel = 0;
@@ -1348,7 +1348,7 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
 
         /* create a separate region for the bitmap */
         memset( &fmt, 0, sizeof(video_format_t) );
-        fmt.i_chroma = VLC_FOURCC('Y','U','V','P');
+        fmt.i_chroma = VLC_CODEC_YUVP;
         fmt.i_aspect = 0;
         fmt.i_width = fmt.i_visible_width = ev->bitmap->width;
         fmt.i_height = fmt.i_visible_height = ev->bitmap->height;
@@ -1371,7 +1371,7 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
     }
 
     /* text region */
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_height = 0;
     fmt.i_x_offset = fmt.i_y_offset = 0;
index 70d9c52fc39e0ed1665bf9e25c59641e5aa47412..9dd811c70b486c33f5ae89361a99e3ce604f4ab4 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_osd.h>
 #include <vlc_input.h>
@@ -136,7 +135,7 @@ static int Create( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
     ass_track_t *p_track;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('s','s','a',' ') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_SSA )
         return VLC_EGENERIC;
 
     p_dec->pf_decode_sub = DecodeBlock;
@@ -168,7 +167,7 @@ static int Create( vlc_object_t *p_this )
     vlc_mutex_unlock( &libass_lock );
 
     p_dec->fmt_out.i_cat = SPU_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('R','G','B','A');
+    p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
 
     return VLC_SUCCESS;
 }
@@ -332,7 +331,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
 
     /* */
     fmt = *p_fmt;
-    fmt.i_chroma = VLC_FOURCC('R','G','B','A');
+    fmt.i_chroma = VLC_CODEC_RGBA;
     fmt.i_width = fmt.i_visible_width;
     fmt.i_height = fmt.i_visible_height;
     fmt.i_bits_per_pixel = 0;
index 5a2ef6fe7987245632bddbfa0130263327d2dec0..9863018d8b6f0a0c70624f1f7a4f9a07598bfb2f 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_block_helper.h>
 #include "../codec/cc.h"
@@ -119,15 +118,22 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
     uint32_t i_accel = 0;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','v') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','1') &&
-        /* Pinnacle hardware-mpeg1 */
-        p_dec->fmt_in.i_codec != VLC_FOURCC('P','I','M','1') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','2','v') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','2') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('h','d','v','2') )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MPGV )
         return VLC_EGENERIC;
+
+    /* Select onl recognized original format (standard mpeg video) */
+    switch( p_dec->fmt_in.i_original_fourcc )
+    {
+    case VLC_FOURCC('m','p','g','1'):
+    case VLC_FOURCC('m','p','g','2'):
+    case VLC_FOURCC('m','p','g','v'):
+    case VLC_FOURCC('P','I','M','1'):
+    case VLC_FOURCC('h','d','v','2'):
+        break;
+    default:
+        if( p_dec->fmt_in.i_original_fourcc )
+            return VLC_EGENERIC;
+        break;
     }
 
     /* Allocate the memory needed to store the decoder's structure */
@@ -665,7 +671,7 @@ static picture_t *GetNewPicture( decoder_t *p_dec, uint8_t **pp_buf )
     p_dec->fmt_out.i_codec =
         ( p_sys->p_info->sequence->chroma_height <
           p_sys->p_info->sequence->height ) ?
-        VLC_FOURCC('I','4','2','0') : VLC_FOURCC('I','4','2','2');
+        VLC_CODEC_I420 : VLC_CODEC_I422;
 
     /* Get a new picture */
     p_pic = decoder_NewPicture( p_dec );
index 52adfc9a923ece7ba17e6d8ebba24e04265ba748..74b3d366e586388f7b078318f72df25b8e2782cc 100644 (file)
@@ -131,12 +131,11 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
     switch( p_dec->fmt_in.i_codec )
     {
     /* DVD LPCM */
-    case VLC_FOURCC('l','p','c','m'):
-    case VLC_FOURCC('l','p','c','b'):
+    case VLC_CODEC_DVD_LPCM:
         b_dvd = true;
         break;
     /* BD LPCM */
-    case VLC_FOURCC('b','p','c','m'):
+    case VLC_CODEC_BD_LPCM:
         b_dvd = false;
         break;
     default:
@@ -158,7 +157,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
 
     if( b_packetizer )
     {
-        p_dec->fmt_out.i_codec = b_dvd ? VLC_FOURCC('l','p','c','m') : VLC_FOURCC('b','p','c','m');
+        p_dec->fmt_out.i_codec = b_dvd ? VLC_CODEC_DVD_LPCM : VLC_CODEC_BD_LPCM;
     }
     else
     {
@@ -166,11 +165,11 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
         {
         case 24:
         case 20:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','2','4','b');
+            p_dec->fmt_out.i_codec = VLC_CODEC_S24B;
             p_dec->fmt_out.audio.i_bitspersample = 24;
             break;
         default:
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','1','6','b');
+            p_dec->fmt_out.i_codec = VLC_CODEC_S16B;
             p_dec->fmt_out.audio.i_bitspersample = 16;
             break;
         }
@@ -274,12 +273,12 @@ static void *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
         /* */
         if( i_bits == 16 )
         {
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','1','6','b');
+            p_dec->fmt_out.i_codec = VLC_CODEC_S16B;
             p_dec->fmt_out.audio.i_bitspersample = 16;
         }
         else
         {
-            p_dec->fmt_out.i_codec = VLC_FOURCC('s','2','4','b');
+            p_dec->fmt_out.i_codec = VLC_CODEC_S24B;
             p_dec->fmt_out.audio.i_bitspersample = 24;
         }
 
index 88533cb4796230bc183ea3fe6473c73ca3625648..c5dce5bfe35fb08226108e8085e09dddef81b735 100644 (file)
@@ -31,7 +31,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 #include <vlc_block.h>
 
 #include <p64/p64.h>
@@ -86,8 +85,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     switch( p_dec->fmt_in.i_codec )
     {
         /* Planar YUV */
-        case VLC_FOURCC('h','2','6','1'):
-        case VLC_FOURCC('H','2','6','1'):
+        case VLC_CODEC_H261:
             break;
 
         default:
@@ -105,7 +103,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
+    p_dec->fmt_out.i_codec = VLC_CODEC_I420;
 
     /* Set callbacks */
     p_dec->pf_decode_video = (picture_t *(*)(decoder_t *, block_t **))
@@ -192,9 +190,9 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     {
         msg_Dbg( p_dec, "video size is perhaps %dx%d", i_width,
                   i_height);
-        vout_InitFormat( &p_dec->fmt_out.video, VLC_FOURCC('I','4','2','0'),
-                         i_width, i_height,
-                         VOUT_ASPECT_FACTOR * i_width / i_height );
+        video_format_Setup( &p_dec->fmt_out.video, VLC_CODEC_I420,
+                            i_width, i_height,
+                            VOUT_ASPECT_FACTOR * i_width / i_height );
         p_sys->b_inited = true;
     }
     p_pic = NULL;
index 306bf0737b9ac343dbe1c2ecb1ff40ab26579e5a..f025be51f93b5ea0e1e0a3ed0a924eeae702587d 100644 (file)
@@ -134,7 +134,7 @@ static int Open( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','a') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MPGA )
     {
         return VLC_EGENERIC;
     }
@@ -153,7 +153,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('m','p','g','a');
+    p_dec->fmt_out.i_codec = VLC_CODEC_MPGA;
     p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
 
     /* Set callback */
index c604f014a1ad3be5274d34d27f3296cac213d286..3d8a6ff9fd075a5cf02ccff1196f7bc0c00b484d 100644 (file)
@@ -31,7 +31,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 #include <png.h>
 
 /*****************************************************************************
@@ -70,7 +69,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('p','n','g',' ') &&
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_PNG &&
         p_dec->fmt_in.i_codec != VLC_FOURCC('M','P','N','G') )
     {
         return VLC_EGENERIC;
@@ -83,7 +82,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('R','G','B','A');
+    p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
 
     /* Set callbacks */
     p_dec->pf_decode_video = DecodeBlock;
@@ -184,7 +183,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     if( p_sys->b_error ) goto error;
 
     /* Set output properties */
-    p_dec->fmt_out.i_codec = VLC_FOURCC('R','G','B','A');
+    p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
     p_dec->fmt_out.video.i_width = i_width;
     p_dec->fmt_out.video.i_height = i_height;
     p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
@@ -208,7 +207,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     }
     else if( !(i_color_type & PNG_COLOR_MASK_ALPHA) )
     {
-        p_dec->fmt_out.i_codec = VLC_FOURCC('R','V','2','4');
+        p_dec->fmt_out.i_codec = VLC_CODEC_RGB24;
     }
 
     /* Get a new picture */
index e5b5778160a776e1dc439c7b07cc61e4efbc4f25..9ae170295d8caf5527f7b21973cadca3c3f82ced 100644 (file)
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_aout.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 
 #if !defined (__APPLE__) && !defined(WIN32)
@@ -245,27 +244,21 @@ static int Open( vlc_object_t *p_this )
 
     switch( p_dec->fmt_in.i_codec )
     {
-        case VLC_FOURCC('h','2','6','4'): /* H.264 */
-        case VLC_FOURCC('c','v','i','d'): /* Cinepak */
+        case VLC_CODEC_H264:
+        case VLC_CODEC_CINEPAK:
         case VLC_FOURCC('I','V','4','1'): /* Indeo Video IV */
         case VLC_FOURCC('i','v','4','1'): /* dto. */
 #ifdef __APPLE__
         case VLC_FOURCC('p','x','l','t'): /* Pixlet */
 #endif
-        case VLC_FOURCC('d','v','1','n'): /* DVC Pro 100 NTSC */
-        case VLC_FOURCC('d','v','1','p'): /* DVC Pro 100 PAL */
-        case VLC_FOURCC('d','v','h','p'): /* DVC PRO HD 720p */
-        case VLC_FOURCC('d','v','h','6'): /* DVC PRO HD 1080i 60 */
-        case VLC_FOURCC('d','v','h','5'): /* DVC PRO HD 1080i 50 */
-
-        case VLC_FOURCC('S','V','Q','3'): /* Sorenson v3 */
-    /*    case VLC_FOURCC('S','V','Q','1'):  Sorenson v1
+        case VLC_CODEC_DV:
+        case VLC_CODEC_SVQ3: /* Sorenson v3 */
+    /*    case VLC_CODEC_SVQ1:  Sorenson v1
         case VLC_FOURCC('Z','y','G','o'):
         case VLC_FOURCC('V','P','3','1'):
         case VLC_FOURCC('3','I','V','1'): */
-        case VLC_FOURCC('r','l','e',' '): /* QuickTime animation (RLE) */
-        case VLC_FOURCC('r','p','z','a'): /* QuickTime Apple Video */
-        case VLC_FOURCC('a','z','p','r'): /* QuickTime animation (RLE) */
+        case VLC_CODEC_QTRLE:
+        case VLC_CODEC_RPZA:
 #ifdef LOADER
         p_dec->p_sys = NULL;
         p_dec->pf_decode_video = DecodeVideo;
@@ -283,23 +276,23 @@ static int Open( vlc_object_t *p_this )
             if ((err != noErr) || (qtVersion < 0x07500000)) 
                 return VLC_EGENERIC;
 #endif
-        case VLC_FOURCC('s','a','m','r'): /* 3GPP AMR audio */
+        case VLC_CODEC_AMR_NB: /* 3GPP AMR audio */
         case VLC_FOURCC('s','a','m','b'): /* 3GPP AMR-WB audio */
-        case VLC_FOURCC('m','p','4','a'): /* MPEG-4 audio */
+        case VLC_CODEC_MP4A: /* MPEG-4 audio */
         case VLC_FOURCC('Q','D','M','C'): /* QDesign */
-        case VLC_FOURCC('Q','D','M','2'): /* QDesign* 2 */
-        case VLC_FOURCC('Q','c','l','p'): /* Qualcomm Purevoice Codec */
+        case VLC_CODEC_QDM2: /* QDesign* 2 */
+        case VLC_CODEC_QCELP: /* Qualcomm Purevoice Codec */
         case VLC_FOURCC('Q','C','L','P'): /* Qualcomm Purevoice Codec */
-        case VLC_FOURCC('M','A','C','3'): /* MACE3 audio decoder */
-        case VLC_FOURCC('M','A','C','6'): /* MACE6 audio decoder */
+        case VLC_CODEC_MACE3: /* MACE3 audio decoder */
+        case VLC_CODEC_MACE6: /* MACE6 audio decoder */
         case VLC_FOURCC('d','v','c','a'): /* DV Audio */
         case VLC_FOURCC('s','o','w','t'): /* 16-bit Little Endian */
         case VLC_FOURCC('t','w','o','s'): /* 16-bit Big Endian */
-        case VLC_FOURCC('a','l','a','w'): /* ALaw 2:1 */
+        case VLC_CODEC_ALAW: /* ALaw 2:1 */
         case VLC_FOURCC('u','l','a','w'): /* mu-Law 2:1 */
         case VLC_FOURCC('r','a','w',' '): /* 8-bit offset binaries */
-        case VLC_FOURCC('f','l','3','2'): /* 32-bit Floating Point */
-        case VLC_FOURCC('f','l','6','4'): /* 64-bit Floating Point */
+        case VLC_CODEC_FL32: /* 32-bit Floating Point */
+        case VLC_CODEC_FL64: /* 64-bit Floating Point */
         case VLC_FOURCC('i','n','2','4'): /* 24-bit Interger */
         case VLC_FOURCC('i','n','3','2'): /* 32-bit Integer */
         case 0x0011:                            /* DVI IMA */
@@ -394,7 +387,10 @@ static int OpenAudio( decoder_t *p_dec )
     p_dec->p_sys = p_sys;
     p_dec->pf_decode_audio = DecodeAudio;
 
-    memcpy( fcc, &p_dec->fmt_in.i_codec, 4 );
+    if( p_dec->fmt_in.i_original_fourcc )
+        memcpy( fcc, &p_dec->fmt_in.i_original_fourcc, 4 );
+    else
+        memcpy( fcc, &p_dec->fmt_in.i_codec, 4 );
 
 #ifdef __APPLE__
     EnterMovies();
@@ -489,7 +485,7 @@ static int OpenAudio( decoder_t *p_dec )
     }
 
 
-    es_format_Init( &p_dec->fmt_out, AUDIO_ES, AOUT_FMT_S16_NE );
+    es_format_Init( &p_dec->fmt_out, AUDIO_ES, VLC_CODEC_S16N );
     p_dec->fmt_out.audio.i_rate = p_sys->OutputFormatInfo.sampleRate;
     p_dec->fmt_out.audio.i_channels = p_sys->OutputFormatInfo.numChannels;
     p_dec->fmt_out.audio.i_physical_channels =
@@ -694,7 +690,11 @@ static int OpenVideo( decoder_t *p_dec )
         return VLC_EGENERIC;
     }
 
-    memcpy( fcc, &p_dec->fmt_in.i_codec, 4 );
+    if( p_dec->fmt_in.i_original_fourcc )
+        memcpy( fcc, &p_dec->fmt_in.i_original_fourcc, 4 );
+    else
+        memcpy( fcc, &p_dec->fmt_in.i_codec, 4 );
+
     msg_Dbg( p_dec, "quicktime_video %4.4s %dx%d",
              fcc, p_dec->fmt_in.video.i_width, p_dec->fmt_in.video.i_height );
 
@@ -836,7 +836,7 @@ static int OpenVideo( decoder_t *p_dec )
     msg_Dbg( p_dec, "quicktime_video: ImageCodecPreDecompress cres=0x%X",
              (int)cres );
 
-    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_FOURCC( 'Y', 'U', 'Y', '2' ));
+    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_YUYV);
     p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
     p_dec->fmt_out.video.i_height= p_dec->fmt_in.video.i_height;
     p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width / p_dec->fmt_in.video.i_height;
index e79e2edff172683498be140b54ebfc5d9515d335..d6998325d1d73fb7cdd63c013a5dba9b417ac706 100644 (file)
@@ -31,7 +31,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 
 /*****************************************************************************
  * decoder_sys_t : raw video decoder descriptor
@@ -92,36 +91,28 @@ static int OpenDecoder( vlc_object_t *p_this )
     switch( p_dec->fmt_in.i_codec )
     {
         /* Planar YUV */
-        case VLC_FOURCC('I','4','4','4'):
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('I','4','1','1'):
-        case VLC_FOURCC('I','4','1','0'):
-        case VLC_FOURCC('Y','V','U','9'):
-        case VLC_FOURCC('Y','4','2','B'):
-        case VLC_FOURCC('Y','4','1','B'):
+        case VLC_CODEC_I444:
+        case VLC_CODEC_I422:
+        case VLC_CODEC_I420:
+        case VLC_CODEC_YV12:
+        case VLC_CODEC_I411:
+        case VLC_CODEC_I410:
+        case VLC_CODEC_GREY:
+        case VLC_CODEC_YUVP:
 
         /* Packed YUV */
-        case VLC_FOURCC('Y','U','Y','2'):
-        case VLC_FOURCC('Y','8','0','0'):
-        case VLC_FOURCC('U','Y','V','Y'):
-        case VLC_FOURCC('H','D','Y','C'):
+        case VLC_CODEC_YUYV:
+        case VLC_CODEC_YVYU:
+        case VLC_CODEC_UYVY:
+        case VLC_CODEC_VYUY:
 
         /* RGB */
-        case VLC_FOURCC('R','V','3','2'):
-        case VLC_FOURCC('R','V','2','4'):
-        case VLC_FOURCC('R','V','1','6'):
-        case VLC_FOURCC('R','V','1','5'):
-            break;
-        case VLC_FOURCC('2','V','u','y'):
-        case VLC_FOURCC('2','v','u','y'):
-        case VLC_FOURCC('A','V','U','I'):
-            p_dec->fmt_in.i_codec = VLC_FOURCC('U','Y','V','Y');
-            break;
-        case VLC_FOURCC('y','v','1','2'):
-            p_dec->fmt_in.i_codec = VLC_FOURCC('Y','V','1','2');
+        case VLC_CODEC_RGB32:
+        case VLC_CODEC_RGB24:
+        case VLC_CODEC_RGB16:
+        case VLC_CODEC_RGB15:
+        case VLC_CODEC_RGB8:
+        case VLC_CODEC_RGBP:
             break;
 
         default:
@@ -165,10 +156,10 @@ static int OpenDecoder( vlc_object_t *p_this )
     }
 
     /* Find out p_vdec->i_raw_size */
-    vout_InitFormat( &p_dec->fmt_out.video, p_dec->fmt_in.i_codec,
-                     p_dec->fmt_in.video.i_width,
-                     p_dec->fmt_in.video.i_height,
-                     p_dec->fmt_in.video.i_aspect );
+    video_format_Setup( &p_dec->fmt_out.video, p_dec->fmt_in.i_codec,
+                        p_dec->fmt_in.video.i_width,
+                        p_dec->fmt_in.video.i_height,
+                        p_dec->fmt_in.video.i_aspect );
     p_sys->i_raw_size = p_dec->fmt_out.video.i_bits_per_pixel *
         p_dec->fmt_out.video.i_width * p_dec->fmt_out.video.i_height / 8;
 
@@ -329,9 +320,9 @@ static block_t *SendFrame( decoder_t *p_dec, block_t *p_block )
         int i, j;
 
         /* Fill in picture_t fields */
-        vout_InitPicture( VLC_OBJECT(p_dec), &pic, p_dec->fmt_out.i_codec,
-                          p_dec->fmt_out.video.i_width,
-                          p_dec->fmt_out.video.i_height, VOUT_ASPECT_FACTOR );
+        picture_Setup( &pic, p_dec->fmt_out.i_codec,
+                       p_dec->fmt_out.video.i_width,
+                       p_dec->fmt_out.video.i_height, VOUT_ASPECT_FACTOR );
 
         if( !pic.i_planes )
         {
index aa1d1334c31874f3c758be3d6e31b4d1dcdf0c51..b668b609fce5bbb1121b41f6b47ffd8134318289 100644 (file)
@@ -182,8 +182,8 @@ static int Open( vlc_object_t *p_this )
 
     switch( p_dec->fmt_in.i_codec )
     {
-    case VLC_FOURCC('c','o','o','k'):
-    case VLC_FOURCC('a','t','r','c'):
+    case VLC_CODEC_COOK:
+    case VLC_CODEC_ATRAC3:
     case VLC_FOURCC('s','i','p','r'):
         break;
 
@@ -222,7 +222,7 @@ static int Open( vlc_object_t *p_this )
     if( p_sys->win32_dll ) Close( p_this );
 #endif
 
-    es_format_Init( &p_dec->fmt_out, AUDIO_ES, AOUT_FMT_S16_NE );
+    es_format_Init( &p_dec->fmt_out, AUDIO_ES, VLC_CODEC_S16N );
     p_dec->fmt_out.audio.i_rate = p_dec->fmt_in.audio.i_rate;
     p_dec->fmt_out.audio.i_channels = p_dec->fmt_in.audio.i_channels;
     p_dec->fmt_out.audio.i_bitspersample =
index 23ea612ae5a69dce12374f53977dc491ae9e5e53..5ac53bf875705741ad8cb0e7f02ecd904a69741f 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 
 #ifdef LOADER
@@ -327,7 +326,7 @@ static int InitVideo(decoder_t *p_dec)
     }
 
     /* setup rv30 codec (codec sub-type and image dimensions): */
-    /*if ( p_dec->fmt_in.i_codec == VLC_FOURCC('R','V','3','0') )*/
+    /*if ( p_dec->fmt_in.i_codec == VLC_CODEC_RV30 )*/
     if (p_vide[1]>=0x20200002)
     {
         int i, cmsg_cnt;
@@ -347,10 +346,10 @@ static int InitVideo(decoder_t *p_dec)
             (*rvyuv_custom_message)(&cmsg_data,p_sys->handle);
     }
     /*
-    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_FOURCC( 'Y','V','1','2' ));
-    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_FOURCC( 'Y','U','Y','2' ));
+    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_YV12);
+    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_YUYV);
      */
-    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_FOURCC( 'I', '4', '2', '0'));
+    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_I420);
      
     p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
     p_dec->fmt_out.video.i_height= p_dec->fmt_in.video.i_height;
@@ -376,10 +375,10 @@ static int Open( vlc_object_t *p_this )
 
     switch ( p_dec->fmt_in.i_codec )
     {
-    case VLC_FOURCC('R','V','1','0')
-    case VLC_FOURCC('R','V','2','0')
-    case VLC_FOURCC('R','V','3','0'):
-    case VLC_FOURCC('R','V','4','0')
+    case VLC_CODEC_RV10
+    case VLC_CODEC_RV20
+    case VLC_CODEC_RV30:
+    case VLC_CODEC_RV40
         p_dec->p_sys = NULL;
         p_dec->pf_decode_video = DecodeVideo;
         return InitVideo(p_dec);
index 8b7abb5f3711be814299f83a35d2c45638df8f0f..162fd8ba95070d67c06dbed6192b59f86c284703 100644 (file)
@@ -35,7 +35,6 @@
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 
 #include <schroedinger/schro.h>
 
@@ -88,7 +87,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
     SchroDecoder *p_schro;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('d','r','a','c') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_DIRAC )
     {
         return VLC_EGENERIC;
     }
@@ -117,7 +116,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
+    p_dec->fmt_out.i_codec = VLC_CODEC_I420;
 
     /* Set callbacks */
     p_dec->pf_decode_video = DecodeBlock;
@@ -142,9 +141,9 @@ static void SetVideoFormat( decoder_t *p_dec )
 
     switch( p_sys->p_format->chroma_format )
     {
-    case SCHRO_CHROMA_420: p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0'); break;
-    case SCHRO_CHROMA_422: p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','2'); break;
-    case SCHRO_CHROMA_444: p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','4','4'); break;
+    case SCHRO_CHROMA_420: p_dec->fmt_out.i_codec = VLC_CODEC_I420; break;
+    case SCHRO_CHROMA_422: p_dec->fmt_out.i_codec = VLC_CODEC_I422; break;
+    case SCHRO_CHROMA_444: p_dec->fmt_out.i_codec = VLC_CODEC_I444; break;
     default:
         p_dec->fmt_out.i_codec = 0;
         break;
index d4eb387ab17cf7a65ad8be146747b01bbdde7af5..6ce6baa94059f36137f1f53e957858af19323c7d 100644 (file)
@@ -31,7 +31,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 
 #include SDL_IMAGE_INCLUDE_FILE
 
@@ -70,17 +69,17 @@ static const struct supported_fmt_t
     const char *psz_sdl_type;
 } p_supported_fmt[] =
 {
-    { VLC_FOURCC('t','g','a',' '), "TGA" },
-    { VLC_FOURCC('b','m','p',' '), "BMP" },
-    { VLC_FOURCC('p','n','m',' '), "PNM" },
+    { VLC_CODEC_TARGA, "TGA" },
+    { VLC_CODEC_BMP, "BMP" },
+    { VLC_CODEC_PNM, "PNM" },
     { VLC_FOURCC('x','p','m',' '), "XPM" },
     { VLC_FOURCC('x','c','f',' '), "XCF" },
-    { VLC_FOURCC('p','c','x',' '), "PCX" },
-    { VLC_FOURCC('g','i','f',' '), "GIF" },
-    { VLC_FOURCC('j','p','e','g'), "JPG" },
-    { VLC_FOURCC('t','i','f','f'), "TIF" },
+    { VLC_CODEC_PCX, "PCX" },
+    { VLC_CODEC_GIF, "GIF" },
+    { VLC_CODEC_JPEG, "JPG" },
+    { VLC_CODEC_TIFF, "TIF" },
     { VLC_FOURCC('l','b','m',' '), "LBM" },
-    { VLC_FOURCC('p','n','g',' '), "PNG" }
+    { VLC_CODEC_PNG, "PNG" }
 };
 
 /*****************************************************************************
@@ -113,7 +112,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* Set output properties - this is a decoy and isn't used anywhere */
     p_dec->fmt_out.i_cat = VIDEO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('R','V','3','2');
+    p_dec->fmt_out.i_codec = VLC_CODEC_RGB32;
 
     /* Set callbacks */
     p_dec->pf_decode_video = DecodeBlock;
@@ -157,14 +156,14 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     switch ( p_surface->format->BitsPerPixel )
     {
     case 16:
-        p_dec->fmt_out.i_codec = VLC_FOURCC('R','V','1','6');
+        p_dec->fmt_out.i_codec = VLC_CODEC_RGB16;
         break;
     case 8:
     case 24:
-        p_dec->fmt_out.i_codec = VLC_FOURCC('R','V','2','4');
+        p_dec->fmt_out.i_codec = VLC_CODEC_RGB24;
         break;
     case 32:
-        p_dec->fmt_out.i_codec = VLC_FOURCC('R','V','3','2');
+        p_dec->fmt_out.i_codec = VLC_CODEC_RGB32;
         break;
     default:
         msg_Warn( p_dec, "unknown bits/pixel format (%d)",
index ec460c52574b069454355cffb33a0ee0bdec8dc6..168d21a62bcf2aad53fe40a913c739897f76cb6d 100644 (file)
@@ -74,7 +74,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_sys_t *p_sys;
 
     /* FIXME: what about layers 1 and 2 ? shine is an 'MP3' encoder */
-    if( p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','3',' ') ||
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_MP3 ||
         p_enc->fmt_out.audio.i_channels > 2 )
         return VLC_EGENERIC;
 
index af1ea6bd1ba4f231dea96c17adf299f99de01db9..564a87c841e2085ea6aadb55ad12d5f6dccb406e 100644 (file)
@@ -205,11 +205,8 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('s','p','x',' ') 
-        && p_dec->fmt_in.i_codec != VLC_FOURCC('s', 'p', 'x', 'r') )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_SPEEX )
         return VLC_EGENERIC;
-    }
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
@@ -223,7 +220,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
-    p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
+    p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
 
     /*
       Set callbacks
@@ -231,7 +228,7 @@ static int OpenDecoder( vlc_object_t *p_this )
       being invoked on a Speex stream arriving via RTP. 
       A special decoder callback is used.
     */
-    if (p_dec->fmt_in.i_codec == VLC_FOURCC('s', 'p', 'x', 'r'))
+    if (p_dec->fmt_in.i_original_fourcc == VLC_FOURCC('s', 'p', 'x', 'r'))
     {
         msg_Dbg( p_dec, "Using RTP version of Speex decoder @ rate %d.", 
            p_dec->fmt_in.audio.i_rate );
@@ -263,7 +260,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
     if( i_ret == VLC_SUCCESS )
     {
         p_dec->p_sys->b_packetizer = true;
-        p_dec->fmt_out.i_codec = VLC_FOURCC('s','p','x',' ');
+        p_dec->fmt_out.i_codec = VLC_CODEC_SPEEX;
     }
 
     return i_ret;
@@ -915,7 +912,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     int pi_header[2];
     uint8_t *p_extra;
 
-    if( p_enc->fmt_out.i_codec != VLC_FOURCC('s','p','x',' ') &&
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_SPEEX &&
         !p_enc->b_force )
     {
         return VLC_EGENERIC;
@@ -943,8 +940,8 @@ static int OpenEncoder( vlc_object_t *p_this )
         return VLC_ENOMEM;
     p_enc->p_sys = p_sys;
     p_enc->pf_encode_audio = Encode;
-    p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
-    p_enc->fmt_out.i_codec = VLC_FOURCC('s','p','x',' ');
+    p_enc->fmt_in.i_codec = VLC_CODEC_S16N;
+    p_enc->fmt_out.i_codec = VLC_CODEC_SPEEX;
 
     speex_init_header( &p_sys->header, p_enc->fmt_in.audio.i_rate,
                        1, p_speex_mode );
index b2ea3a177c1f18ae7365a7e3e377ebba60ccb689..c61674ae83fc6f506ce1e1830c562b73b1a1d12a 100644 (file)
@@ -31,7 +31,6 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_input.h>
 
@@ -688,7 +687,7 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','P');
+    fmt.i_chroma = VLC_CODEC_YUVP;
     fmt.i_aspect = 0; /* 0 means use aspect ratio of background video */
     fmt.i_width = fmt.i_visible_width = p_spu_properties->i_width;
     fmt.i_height = fmt.i_visible_height = p_spu_properties->i_height -
index f527a9c2b379c0ed5fc6cc6ff48cc353859719ef..bd9be5d3fb2d0b8276bc60be1b18c6e12afa9d4e 100644 (file)
@@ -73,11 +73,8 @@ static int DecoderOpen( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC( 's','p','u',' ' ) &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 's','p','u','b' ) )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_SPU )
         return VLC_EGENERIC;
-    }
 
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
 
@@ -86,7 +83,7 @@ static int DecoderOpen( vlc_object_t *p_this )
     p_sys->i_spu      = 0;
     p_sys->p_block    = NULL;
 
-    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_FOURCC( 's','p','u',' ' ) );
+    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_CODEC_SPU );
 
     p_dec->pf_decode_sub = Decode;
     p_dec->pf_packetize  = NULL;
@@ -111,7 +108,7 @@ static int PacketizerOpen( vlc_object_t *p_this )
     p_dec->pf_packetize  = Packetize;
     p_dec->p_sys->b_packetizer = true;
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
-    p_dec->fmt_out.i_codec = VLC_FOURCC( 's','p','u',' ' );
+    p_dec->fmt_out.i_codec = VLC_CODEC_SPU;
 
     return VLC_SUCCESS;
 }
index e642673288c6426079a4a1cf27c6679268fa018e..0284f8be380c7a618f55e57b849b1e692ef61e97 100644 (file)
@@ -38,7 +38,7 @@ void ParseSSAString( decoder_t *p_dec,
      * MarginV, Effect, Text */
     decoder_sys_t   *p_sys = p_dec->p_sys;
     subpicture_t    *p_spu = p_spu_in;
-    ssa_style_t     *p_style = NULL;
+    ssa_style_t     *p_ssa_style = NULL;
     char            *psz_new_subtitle = NULL;
     char            *psz_buffer_sub = NULL;
     char            *psz_style = NULL;
@@ -118,12 +118,12 @@ void ParseSSAString( decoder_t *p_dec,
     for( i = 0; i < p_sys->i_ssa_styles; i++ )
     {
         if( !strcmp( p_sys->pp_ssa_styles[i]->psz_stylename, psz_style ) )
-            p_style = p_sys->pp_ssa_styles[i];
+            p_ssa_style = p_sys->pp_ssa_styles[i];
     }
     free( psz_style );
 
     p_spu->p_region->psz_text = psz_new_subtitle;
-    if( p_style == NULL )
+    if( p_ssa_style == NULL )
     {
         p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
         p_spu->p_region->i_x = p_sys->i_align ? 20 : 0;
@@ -131,18 +131,18 @@ void ParseSSAString( decoder_t *p_dec,
     }
     else
     {
-        msg_Dbg( p_dec, "style is: %s", p_style->psz_stylename);
-        p_spu->p_region->p_style = &p_style->font_style;
-        p_spu->p_region->i_align = p_style->i_align;
-        if( p_style->i_align & SUBPICTURE_ALIGN_LEFT )
+        msg_Dbg( p_dec, "style is: %s", p_ssa_style->psz_stylename );
+        p_spu->p_region->p_style = text_style_Duplicate( &p_ssa_style->font_style );
+        p_spu->p_region->i_align = p_ssa_style->i_align;
+        if( p_ssa_style->i_align & SUBPICTURE_ALIGN_LEFT )
         {
-            p_spu->p_region->i_x = (i_margin_l) ? i_margin_l : p_style->i_margin_h;
+            p_spu->p_region->i_x = (i_margin_l) ? i_margin_l : p_ssa_style->i_margin_h;
         }
-        else if( p_style->i_align & SUBPICTURE_ALIGN_RIGHT )
+        else if( p_ssa_style->i_align & SUBPICTURE_ALIGN_RIGHT )
         {
-            p_spu->p_region->i_x = (i_margin_r) ? i_margin_r : p_style->i_margin_h;
+            p_spu->p_region->i_x = (i_margin_r) ? i_margin_r : p_ssa_style->i_margin_h;
         }
-        p_spu->p_region->i_y = (i_margin_v) ? i_margin_v : p_style->i_margin_v;
+        p_spu->p_region->i_y = (i_margin_v) ? i_margin_v : p_ssa_style->i_margin_v;
     }
 }
 
@@ -233,52 +233,52 @@ void ParseSSAHeader( decoder_t *p_dec )
                     &i_border, &i_outline, &i_shadow, &i_align, &i_margin_l,
                     &i_margin_r, &i_margin_v ) == 16 )
                 {
-                    ssa_style_t *p_style = malloc( sizeof(ssa_style_t) );
+                    ssa_style_t *p_ssa_style = malloc( sizeof(ssa_style_t) );
 
-                    p_style->psz_stylename = strdup( psz_temp_stylename );
-                    p_style->font_style.psz_fontname = strdup( psz_temp_fontname );
-                    p_style->font_style.i_font_size = i_font_size;
+                    p_ssa_style->psz_stylename = strdup( psz_temp_stylename );
+                    p_ssa_style->font_style.psz_fontname = strdup( psz_temp_fontname );
+                    p_ssa_style->font_style.i_font_size = i_font_size;
 
-                    ParseColor( psz_temp_color1, &p_style->font_style.i_font_color, NULL );
-                    ParseColor( psz_temp_color4, &p_style->font_style.i_shadow_color, NULL );
-                    p_style->font_style.i_outline_color = p_style->font_style.i_shadow_color;
-                    p_style->font_style.i_font_alpha = p_style->font_style.i_outline_alpha
-                                                     = p_style->font_style.i_shadow_alpha = 0x00;
-                    p_style->font_style.i_style_flags = 0;
-                    if( i_bold ) p_style->font_style.i_style_flags |= STYLE_BOLD;
-                    if( i_italic ) p_style->font_style.i_style_flags |= STYLE_ITALIC;
+                    ParseColor( psz_temp_color1, &p_ssa_style->font_style.i_font_color, NULL );
+                    ParseColor( psz_temp_color4, &p_ssa_style->font_style.i_shadow_color, NULL );
+                    p_ssa_style->font_style.i_outline_color = p_ssa_style->font_style.i_shadow_color;
+                    p_ssa_style->font_style.i_font_alpha = p_ssa_style->font_style.i_outline_alpha
+                                                     = p_ssa_style->font_style.i_shadow_alpha = 0x00;
+                    p_ssa_style->font_style.i_style_flags = 0;
+                    if( i_bold ) p_ssa_style->font_style.i_style_flags |= STYLE_BOLD;
+                    if( i_italic ) p_ssa_style->font_style.i_style_flags |= STYLE_ITALIC;
 
                     if( i_border == 1 )
-                        p_style->font_style.i_style_flags |= (STYLE_ITALIC | STYLE_OUTLINE);
+                        p_ssa_style->font_style.i_style_flags |= (STYLE_ITALIC | STYLE_OUTLINE);
                     else if( i_border == 3 )
                     {
-                        p_style->font_style.i_style_flags |= STYLE_BACKGROUND;
-                        p_style->font_style.i_background_color = p_style->font_style.i_shadow_color;
-                        p_style->font_style.i_background_alpha = p_style->font_style.i_shadow_alpha;
+                        p_ssa_style->font_style.i_style_flags |= STYLE_BACKGROUND;
+                        p_ssa_style->font_style.i_background_color = p_ssa_style->font_style.i_shadow_color;
+                        p_ssa_style->font_style.i_background_alpha = p_ssa_style->font_style.i_shadow_alpha;
                     }
-                    p_style->font_style.i_shadow_width = i_shadow;
-                    p_style->font_style.i_outline_width = i_outline;
+                    p_ssa_style->font_style.i_shadow_width = i_shadow;
+                    p_ssa_style->font_style.i_outline_width = i_outline;
 
-                    p_style->i_align = 0;
+                    p_ssa_style->i_align = 0;
                     if( i_align == 1 || i_align == 5 || i_align == 9 )
-                        p_style->i_align |= SUBPICTURE_ALIGN_LEFT;
+                        p_ssa_style->i_align |= SUBPICTURE_ALIGN_LEFT;
                     if( i_align == 3 || i_align == 7 || i_align == 11 )
-                        p_style->i_align |= SUBPICTURE_ALIGN_RIGHT;
+                        p_ssa_style->i_align |= SUBPICTURE_ALIGN_RIGHT;
                     if( i_align < 4 )
-                        p_style->i_align |= SUBPICTURE_ALIGN_BOTTOM;
+                        p_ssa_style->i_align |= SUBPICTURE_ALIGN_BOTTOM;
                     else if( i_align < 8 )
-                        p_style->i_align |= SUBPICTURE_ALIGN_TOP;
+                        p_ssa_style->i_align |= SUBPICTURE_ALIGN_TOP;
 
-                    p_style->i_margin_h = ( p_style->i_align & SUBPICTURE_ALIGN_RIGHT ) ?
+                    p_ssa_style->i_margin_h = ( p_ssa_style->i_align & SUBPICTURE_ALIGN_RIGHT ) ?
                                                         i_margin_r : i_margin_l;
-                    p_style->i_margin_v = i_margin_v;
-                    p_style->i_margin_percent_h = 0;
-                    p_style->i_margin_percent_v = 0;
+                    p_ssa_style->i_margin_v = i_margin_v;
+                    p_ssa_style->i_margin_percent_h = 0;
+                    p_ssa_style->i_margin_percent_v = 0;
 
-                    p_style->font_style.i_karaoke_background_color = 0xffffff;
-                    p_style->font_style.i_karaoke_background_alpha = 0xff;
+                    p_ssa_style->font_style.i_karaoke_background_color = 0xffffff;
+                    p_ssa_style->font_style.i_karaoke_background_alpha = 0xff;
 
-                    TAB_APPEND( p_sys->i_ssa_styles, p_sys->pp_ssa_styles, p_style );
+                    TAB_APPEND( p_sys->i_ssa_styles, p_sys->pp_ssa_styles, p_ssa_style );
                 }
                 else msg_Warn( p_dec, "SSA v4 styleline parsing failed" );
             }
@@ -294,55 +294,55 @@ void ParseSSAHeader( decoder_t *p_dec )
                     &i_underline, &i_strikeout, &i_scale_x, &i_scale_y, &i_spacing, &i_border, &i_outline,
                     &i_shadow, &i_align, &i_margin_l, &i_margin_r, &i_margin_v ) == 21 )
                 {
-                    ssa_style_t *p_style = malloc( sizeof(ssa_style_t) );
-
-                    p_style->psz_stylename = strdup( psz_temp_stylename );
-                    p_style->font_style.psz_fontname = strdup( psz_temp_fontname );
-                    p_style->font_style.i_font_size = i_font_size;
-                    ParseColor( psz_temp_color1, &p_style->font_style.i_font_color,
-                                &p_style->font_style.i_font_alpha );
-                    ParseColor( psz_temp_color3, &p_style->font_style.i_outline_color,
-                                &p_style->font_style.i_outline_alpha );
-                    ParseColor( psz_temp_color4, &p_style->font_style.i_shadow_color,
-                                &p_style->font_style.i_shadow_alpha );
-
-                    p_style->font_style.i_style_flags = 0;
-                    if( i_bold ) p_style->font_style.i_style_flags |= STYLE_BOLD;
-                    if( i_italic ) p_style->font_style.i_style_flags |= STYLE_ITALIC;
-                    if( i_underline ) p_style->font_style.i_style_flags |= STYLE_UNDERLINE;
-                    if( i_strikeout ) p_style->font_style.i_style_flags |= STYLE_STRIKEOUT;
-                    if( i_border == 1 ) p_style->font_style.i_style_flags |= (STYLE_ITALIC | STYLE_OUTLINE);
+                    ssa_style_t *p_ssa_style = malloc( sizeof(ssa_style_t) );
+
+                    p_ssa_style->psz_stylename = strdup( psz_temp_stylename );
+                    p_ssa_style->font_style.psz_fontname = strdup( psz_temp_fontname );
+                    p_ssa_style->font_style.i_font_size = i_font_size;
+                    ParseColor( psz_temp_color1, &p_ssa_style->font_style.i_font_color,
+                                &p_ssa_style->font_style.i_font_alpha );
+                    ParseColor( psz_temp_color3, &p_ssa_style->font_style.i_outline_color,
+                                &p_ssa_style->font_style.i_outline_alpha );
+                    ParseColor( psz_temp_color4, &p_ssa_style->font_style.i_shadow_color,
+                                &p_ssa_style->font_style.i_shadow_alpha );
+
+                    p_ssa_style->font_style.i_style_flags = 0;
+                    if( i_bold ) p_ssa_style->font_style.i_style_flags |= STYLE_BOLD;
+                    if( i_italic ) p_ssa_style->font_style.i_style_flags |= STYLE_ITALIC;
+                    if( i_underline ) p_ssa_style->font_style.i_style_flags |= STYLE_UNDERLINE;
+                    if( i_strikeout ) p_ssa_style->font_style.i_style_flags |= STYLE_STRIKEOUT;
+                    if( i_border == 1 ) p_ssa_style->font_style.i_style_flags |= (STYLE_ITALIC | STYLE_OUTLINE);
                     else if( i_border == 3 )
                     {
-                        p_style->font_style.i_style_flags |= STYLE_BACKGROUND;
-                        p_style->font_style.i_background_color = p_style->font_style.i_shadow_color;
-                        p_style->font_style.i_background_alpha = p_style->font_style.i_shadow_alpha;
+                        p_ssa_style->font_style.i_style_flags |= STYLE_BACKGROUND;
+                        p_ssa_style->font_style.i_background_color = p_ssa_style->font_style.i_shadow_color;
+                        p_ssa_style->font_style.i_background_alpha = p_ssa_style->font_style.i_shadow_alpha;
                     }
-                    p_style->font_style.i_shadow_width  = ( i_border == 1 ) ? i_shadow : 0;
-                    p_style->font_style.i_outline_width = ( i_border == 1 ) ? i_outline : 0;
-                    p_style->font_style.i_spacing = i_spacing;
-                    //p_style->font_style.f_angle = f_angle;
+                    p_ssa_style->font_style.i_shadow_width  = ( i_border == 1 ) ? i_shadow : 0;
+                    p_ssa_style->font_style.i_outline_width = ( i_border == 1 ) ? i_outline : 0;
+                    p_ssa_style->font_style.i_spacing = i_spacing;
+                    //p_ssa_style->font_style.f_angle = f_angle;
 
-                    p_style->i_align = 0;
+                    p_ssa_style->i_align = 0;
                     if( i_align == 0x1 || i_align == 0x4 || i_align == 0x7 )
-                        p_style->i_align |= SUBPICTURE_ALIGN_LEFT;
+                        p_ssa_style->i_align |= SUBPICTURE_ALIGN_LEFT;
                     if( i_align == 0x3 || i_align == 0x6 || i_align == 0x9 )
-                        p_style->i_align |= SUBPICTURE_ALIGN_RIGHT;
+                        p_ssa_style->i_align |= SUBPICTURE_ALIGN_RIGHT;
                     if( i_align == 0x7 || i_align == 0x8 || i_align == 0x9 )
-                        p_style->i_align |= SUBPICTURE_ALIGN_TOP;
+                        p_ssa_style->i_align |= SUBPICTURE_ALIGN_TOP;
                     if( i_align == 0x1 || i_align == 0x2 || i_align == 0x3 )
-                        p_style->i_align |= SUBPICTURE_ALIGN_BOTTOM;
-                    p_style->i_margin_h = ( p_style->i_align & SUBPICTURE_ALIGN_RIGHT ) ?
+                        p_ssa_style->i_align |= SUBPICTURE_ALIGN_BOTTOM;
+                    p_ssa_style->i_margin_h = ( p_ssa_style->i_align & SUBPICTURE_ALIGN_RIGHT ) ?
                                             i_margin_r : i_margin_l;
-                    p_style->i_margin_v = i_margin_v;
-                    p_style->i_margin_percent_h = 0;
-                    p_style->i_margin_percent_v = 0;
+                    p_ssa_style->i_margin_v = i_margin_v;
+                    p_ssa_style->i_margin_percent_h = 0;
+                    p_ssa_style->i_margin_percent_v = 0;
 
-                    p_style->font_style.i_karaoke_background_color = 0xffffff;
-                    p_style->font_style.i_karaoke_background_alpha = 0xff;
+                    p_ssa_style->font_style.i_karaoke_background_color = 0xffffff;
+                    p_ssa_style->font_style.i_karaoke_background_alpha = 0xff;
 
                     /*TODO: Ignored: angle i_scale_x|y (fontscaling), i_encoding */
-                    TAB_APPEND( p_sys->i_ssa_styles, p_sys->pp_ssa_styles, p_style );
+                    TAB_APPEND( p_sys->i_ssa_styles, p_sys->pp_ssa_styles, p_ssa_style );
                 }
                 else msg_Dbg( p_dec, "SSA V4+ styleline parsing failed" );
             }
index aa5ca570d66a0dcc1690dd4ec60ba2f80e658ce8..f217f0b77e244effe9cd8e718a68939c6f68a15d 100644 (file)
@@ -232,9 +232,9 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     switch( p_dec->fmt_in.i_codec )
     {
-        case VLC_FOURCC('s','u','b','t'):
-        case VLC_FOURCC('s','s','a',' '):
-        case VLC_FOURCC('t','1','4','0'):
+        case VLC_CODEC_SUBT:
+        case VLC_CODEC_SSA:
+        case VLC_CODEC_ITU_T140:
             break;
         default:
             return VLC_EGENERIC;
@@ -262,7 +262,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     char *psz_charset = NULL;
 
     /* First try demux-specified encoding */
-    if( p_dec->fmt_in.i_codec == VLC_FOURCC('t','1','4','0') )
+    if( p_dec->fmt_in.i_codec == VLC_CODEC_ITU_T140 )
         psz_charset = strdup( "UTF-8" ); /* IUT T.140 is always using UTF-8 */
     else
     if( p_dec->fmt_in.subs.psz_encoding && *p_dec->fmt_in.subs.psz_encoding )
@@ -316,7 +316,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     var_Get( p_dec, "subsdec-align", &val );
     p_sys->i_align = val.i_int;
 
-    if( p_dec->fmt_in.i_codec == VLC_FOURCC('s','s','a',' ')
+    if( p_dec->fmt_in.i_codec == VLC_CODEC_SSA
      && var_CreateGetBool( p_dec, "subsdec-formatted" ) )
     {
         if( p_dec->fmt_in.i_extra > 0 )
@@ -493,7 +493,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_height = 0;
     fmt.i_x_offset = fmt.i_y_offset = 0;
@@ -507,7 +507,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
     }
 
     /* Decode and format the subpicture unit */
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('s','s','a',' ') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_SSA )
     {
         /* Normal text subs, easy markup */
         p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
index 2c221ca95dc09e18dd64f6b2435888604ef56e6d..0ab39b748a6818bd9d7f725900bdd6a31d59433f 100644 (file)
@@ -28,7 +28,6 @@
 #define SUBSDEC_HEADER_H
 
 #include <vlc_common.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_input.h>
 
index 330e167ab3c10f21b9cb53c7e77628ee90370e81..ff92294c2c79dab4100bd4fac2fce4d389358c18 100644 (file)
@@ -68,7 +68,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('u','s','f',' ') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_USF )
         return VLC_EGENERIC;
 
     /* Allocate the memory needed to store the decoder's structure */
@@ -146,6 +146,7 @@ static void CloseDecoder( vlc_object_t *p_this )
                 continue;
 
             free( p_sys->pp_ssa_styles[i]->psz_stylename );
+            //FIXME: Make font_style a pointer and use text_style_* functions
             free( p_sys->pp_ssa_styles[i]->font_style.psz_fontname );
             free( p_sys->pp_ssa_styles[i] );
         }
@@ -261,7 +262,7 @@ static char *GrabAttributeValue( const char *psz_attribute,
 
 static ssa_style_t *ParseStyle( decoder_sys_t *p_sys, char *psz_subtitle )
 {
-    ssa_style_t *p_style   = NULL;
+    ssa_style_t *p_ssa_style = NULL;
     char        *psz_style = GrabAttributeValue( "style", psz_subtitle );
 
     if( psz_style )
@@ -271,11 +272,11 @@ static ssa_style_t *ParseStyle( decoder_sys_t *p_sys, char *psz_subtitle )
         for( i = 0; i < p_sys->i_ssa_styles; i++ )
         {
             if( !strcmp( p_sys->pp_ssa_styles[i]->psz_stylename, psz_style ) )
-                p_style = p_sys->pp_ssa_styles[i];
+                p_ssa_style = p_sys->pp_ssa_styles[i];
         }
         free( psz_style );
     }
-    return p_style;
+    return p_ssa_style;
 }
 
 static int ParsePositionAttributeList( char *psz_subtitle, int *i_align,
@@ -382,7 +383,7 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec,
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_height = 0;
     fmt.i_x_offset = fmt.i_y_offset = 0;
@@ -390,7 +391,7 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec,
 
     if( p_text_region != NULL )
     {
-        ssa_style_t  *p_style = NULL;
+        ssa_style_t  *p_ssa_style = NULL;
 
         p_text_region->psz_text = NULL;
         p_text_region->psz_html = strndup( psz_subtitle, i_len );
@@ -400,34 +401,34 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec,
             return NULL;
         }
 
-        p_style = ParseStyle( p_sys, p_text_region->psz_html );
-        if( !p_style )
+        p_ssa_style = ParseStyle( p_sys, p_text_region->psz_html );
+        if( !p_ssa_style )
         {
             int i;
 
             for( i = 0; i < p_sys->i_ssa_styles; i++ )
             {
                 if( !strcasecmp( p_sys->pp_ssa_styles[i]->psz_stylename, "Default" ) )
-                    p_style = p_sys->pp_ssa_styles[i];
+                    p_ssa_style = p_sys->pp_ssa_styles[i];
             }
         }
 
-        if( p_style )
+        if( p_ssa_style )
         {
-            msg_Dbg( p_dec, "style is: %s", p_style->psz_stylename );
+            msg_Dbg( p_dec, "style is: %s", p_ssa_style->psz_stylename );
 
-            p_text_region->p_style = &p_style->font_style;
-            p_text_region->i_align = p_style->i_align;
+            p_text_region->p_style = text_style_Duplicate( &p_ssa_style->font_style );
+            p_text_region->i_align = p_ssa_style->i_align;
 
             /* TODO: Setup % based offsets properly, without adversely affecting
              *       everything else in vlc. Will address with separate patch,
              *       to prevent this one being any more complicated.
 
-                     * p_style->i_margin_percent_h;
-                     * p_style->i_margin_percent_v;
+                     * p_ssa_style->i_margin_percent_h;
+                     * p_ssa_style->i_margin_percent_v;
              */
-            p_text_region->i_x         = p_style->i_margin_h;
-            p_text_region->i_y         = p_style->i_margin_v;
+            p_text_region->i_x         = p_ssa_style->i_margin_h;
+            p_text_region->i_y         = p_ssa_style->i_margin_v;
 
         }
         else
@@ -487,7 +488,7 @@ static int ParseImageAttachments( decoder_t *p_dec )
                     memset( &fmt_out, 0, sizeof( video_format_t));
 
                     fmt_in.i_chroma  = type;
-                    fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+                    fmt_out.i_chroma = VLC_CODEC_YUVA;
 
                     /* Find a suitable decoder module */
                     if( module_exists( "sdl_image" ) )
@@ -532,7 +533,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     char *psz_node;
-    ssa_style_t *p_style = NULL;
+    ssa_style_t *p_ssa_style = NULL;
     int i_style_level = 0;
     int i_metadata_level = 0;
 
@@ -565,9 +566,9 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
                     case 2:
                         if( !strcasecmp( "style", psz_node ) )
                         {
-                            TAB_APPEND( p_sys->i_ssa_styles, p_sys->pp_ssa_styles, p_style );
+                            TAB_APPEND( p_sys->i_ssa_styles, p_sys->pp_ssa_styles, p_ssa_style );
 
-                            p_style = NULL;
+                            p_ssa_style = NULL;
                             i_style_level--;
                         }
                         break;
@@ -612,8 +613,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
                 {
                     i_style_level++;
 
-                    p_style = calloc( 1, sizeof(ssa_style_t) );
-                    if( ! p_style )
+                    p_ssa_style = calloc( 1, sizeof(ssa_style_t) );
+                    if( !p_ssa_style )
                     {
                         free( psz_node );
                         return;
@@ -630,9 +631,11 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
                         {
                             ssa_style_t *p_default_style = p_sys->pp_ssa_styles[i];
 
-                            memcpy( p_style, p_default_style, sizeof( ssa_style_t ) );
-                            p_style->font_style.psz_fontname = strdup( p_style->font_style.psz_fontname );
-                            p_style->psz_stylename = NULL;
+                            memcpy( p_ssa_style, p_default_style, sizeof( ssa_style_t ) );
+                            //FIXME: Make font_style a pointer. Actually we double copy some data here,
+                            //   we use text_style_Copy to avoid copying psz_fontname, though .
+                            text_style_Copy( &p_ssa_style->font_style, &p_default_style->font_style );
+                            p_ssa_style->psz_stylename = NULL;
                         }
                     }
 
@@ -644,7 +647,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
                         if( psz_name && psz_value )
                         {
                             if( !strcasecmp( "name", psz_name ) )
-                                p_style->psz_stylename = strdup( psz_value);
+                                p_ssa_style->psz_stylename = strdup( psz_value );
                         }
                         free( psz_name );
                         free( psz_value );
@@ -661,8 +664,8 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
                         {
                             if( !strcasecmp( "face", psz_name ) )
                             {
-                                free( p_style->font_style.psz_fontname );
-                                p_style->font_style.psz_fontname = strdup( psz_value );
+                                free( p_ssa_style->font_style.psz_fontname );
+                                p_ssa_style->font_style.psz_fontname = strdup( psz_value );
                             }
                             else if( !strcasecmp( "size", psz_name ) )
                             {
@@ -671,44 +674,44 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
                                     int i_value = atoi( psz_value );
 
                                     if( ( i_value >= -5 ) && ( i_value <= 5 ) )
-                                        p_style->font_style.i_font_size  +=
-                                            ( i_value * p_style->font_style.i_font_size ) / 10;
+                                        p_ssa_style->font_style.i_font_size  +=
+                                            ( i_value * p_ssa_style->font_style.i_font_size ) / 10;
                                     else if( i_value < -5 )
-                                        p_style->font_style.i_font_size  = - i_value;
+                                        p_ssa_style->font_style.i_font_size  = - i_value;
                                     else if( i_value > 5 )
-                                        p_style->font_style.i_font_size  = i_value;
+                                        p_ssa_style->font_style.i_font_size  = i_value;
                                 }
                                 else
-                                    p_style->font_style.i_font_size  = atoi( psz_value );
+                                    p_ssa_style->font_style.i_font_size  = atoi( psz_value );
                             }
                             else if( !strcasecmp( "italic", psz_name ) )
                             {
                                 if( !strcasecmp( "yes", psz_value ))
-                                    p_style->font_style.i_style_flags |= STYLE_ITALIC;
+                                    p_ssa_style->font_style.i_style_flags |= STYLE_ITALIC;
                                 else
-                                    p_style->font_style.i_style_flags &= ~STYLE_ITALIC;
+                                    p_ssa_style->font_style.i_style_flags &= ~STYLE_ITALIC;
                             }
                             else if( !strcasecmp( "weight", psz_name ) )
                             {
                                 if( !strcasecmp( "bold", psz_value ))
-                                    p_style->font_style.i_style_flags |= STYLE_BOLD;
+                                    p_ssa_style->font_style.i_style_flags |= STYLE_BOLD;
                                 else
-                                    p_style->font_style.i_style_flags &= ~STYLE_BOLD;
+                                    p_ssa_style->font_style.i_style_flags &= ~STYLE_BOLD;
                             }
                             else if( !strcasecmp( "underline", psz_name ) )
                             {
                                 if( !strcasecmp( "yes", psz_value ))
-                                    p_style->font_style.i_style_flags |= STYLE_UNDERLINE;
+                                    p_ssa_style->font_style.i_style_flags |= STYLE_UNDERLINE;
                                 else
-                                    p_style->font_style.i_style_flags &= ~STYLE_UNDERLINE;
+                                    p_ssa_style->font_style.i_style_flags &= ~STYLE_UNDERLINE;
                             }
                             else if( !strcasecmp( "color", psz_name ) )
                             {
                                 if( *psz_value == '#' )
                                 {
                                     unsigned long col = strtol(psz_value+1, NULL, 16);
-                                    p_style->font_style.i_font_color = (col & 0x00ffffff);
-                                    p_style->font_style.i_font_alpha = (col >> 24) & 0xff;
+                                    p_ssa_style->font_style.i_font_color = (col & 0x00ffffff);
+                                    p_ssa_style->font_style.i_font_alpha = (col >> 24) & 0xff;
                                 }
                             }
                             else if( !strcasecmp( "outline-color", psz_name ) )
@@ -716,39 +719,39 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
                                 if( *psz_value == '#' )
                                 {
                                     unsigned long col = strtol(psz_value+1, NULL, 16);
-                                    p_style->font_style.i_outline_color = (col & 0x00ffffff);
-                                    p_style->font_style.i_outline_alpha = (col >> 24) & 0xff;
+                                    p_ssa_style->font_style.i_outline_color = (col & 0x00ffffff);
+                                    p_ssa_style->font_style.i_outline_alpha = (col >> 24) & 0xff;
                                 }
                             }
                             else if( !strcasecmp( "outline-level", psz_name ) )
                             {
-                                p_style->font_style.i_outline_width = atoi( psz_value );
+                                p_ssa_style->font_style.i_outline_width = atoi( psz_value );
                             }
                             else if( !strcasecmp( "shadow-color", psz_name ) )
                             {
                                 if( *psz_value == '#' )
                                 {
                                     unsigned long col = strtol(psz_value+1, NULL, 16);
-                                    p_style->font_style.i_shadow_color = (col & 0x00ffffff);
-                                    p_style->font_style.i_shadow_alpha = (col >> 24) & 0xff;
+                                    p_ssa_style->font_style.i_shadow_color = (col & 0x00ffffff);
+                                    p_ssa_style->font_style.i_shadow_alpha = (col >> 24) & 0xff;
                                 }
                             }
                             else if( !strcasecmp( "shadow-level", psz_name ) )
                             {
-                                p_style->font_style.i_shadow_width = atoi( psz_value );
+                                p_ssa_style->font_style.i_shadow_width = atoi( psz_value );
                             }
                             else if( !strcasecmp( "back-color", psz_name ) )
                             {
                                 if( *psz_value == '#' )
                                 {
                                     unsigned long col = strtol(psz_value+1, NULL, 16);
-                                    p_style->font_style.i_karaoke_background_color = (col & 0x00ffffff);
-                                    p_style->font_style.i_karaoke_background_alpha = (col >> 24) & 0xff;
+                                    p_ssa_style->font_style.i_karaoke_background_color = (col & 0x00ffffff);
+                                    p_ssa_style->font_style.i_karaoke_background_alpha = (col >> 24) & 0xff;
                                 }
                             }
                             else if( !strcasecmp( "spacing", psz_name ) )
                             {
-                                p_style->font_style.i_spacing = atoi( psz_value );
+                                p_ssa_style->font_style.i_spacing = atoi( psz_value );
                             }
                         }
                         free( psz_name );
@@ -767,48 +770,48 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
                             if( !strcasecmp( "alignment", psz_name ) )
                             {
                                 if( !strcasecmp( "TopLeft", psz_value ) )
-                                    p_style->i_align = SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT;
+                                    p_ssa_style->i_align = SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT;
                                 else if( !strcasecmp( "TopCenter", psz_value ) )
-                                    p_style->i_align = SUBPICTURE_ALIGN_TOP;
+                                    p_ssa_style->i_align = SUBPICTURE_ALIGN_TOP;
                                 else if( !strcasecmp( "TopRight", psz_value ) )
-                                    p_style->i_align = SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_RIGHT;
+                                    p_ssa_style->i_align = SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_RIGHT;
                                 else if( !strcasecmp( "MiddleLeft", psz_value ) )
-                                    p_style->i_align = SUBPICTURE_ALIGN_LEFT;
+                                    p_ssa_style->i_align = SUBPICTURE_ALIGN_LEFT;
                                 else if( !strcasecmp( "MiddleCenter", psz_value ) )
-                                    p_style->i_align = 0;
+                                    p_ssa_style->i_align = 0;
                                 else if( !strcasecmp( "MiddleRight", psz_value ) )
-                                    p_style->i_align = SUBPICTURE_ALIGN_RIGHT;
+                                    p_ssa_style->i_align = SUBPICTURE_ALIGN_RIGHT;
                                 else if( !strcasecmp( "BottomLeft", psz_value ) )
-                                    p_style->i_align = SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_LEFT;
+                                    p_ssa_style->i_align = SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_LEFT;
                                 else if( !strcasecmp( "BottomCenter", psz_value ) )
-                                    p_style->i_align = SUBPICTURE_ALIGN_BOTTOM;
+                                    p_ssa_style->i_align = SUBPICTURE_ALIGN_BOTTOM;
                                 else if( !strcasecmp( "BottomRight", psz_value ) )
-                                    p_style->i_align = SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_RIGHT;
+                                    p_ssa_style->i_align = SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_RIGHT;
                             }
                             else if( !strcasecmp( "horizontal-margin", psz_name ) )
                             {
                                 if( strchr( psz_value, '%' ) )
                                 {
-                                    p_style->i_margin_h = 0;
-                                    p_style->i_margin_percent_h = atoi( psz_value );
+                                    p_ssa_style->i_margin_h = 0;
+                                    p_ssa_style->i_margin_percent_h = atoi( psz_value );
                                 }
                                 else
                                 {
-                                    p_style->i_margin_h = atoi( psz_value );
-                                    p_style->i_margin_percent_h = 0;
+                                    p_ssa_style->i_margin_h = atoi( psz_value );
+                                    p_ssa_style->i_margin_percent_h = 0;
                                 }
                             }
                             else if( !strcasecmp( "vertical-margin", psz_name ) )
                             {
                                 if( strchr( psz_value, '%' ) )
                                 {
-                                    p_style->i_margin_v = 0;
-                                    p_style->i_margin_percent_v = atoi( psz_value );
+                                    p_ssa_style->i_margin_v = 0;
+                                    p_ssa_style->i_margin_percent_v = atoi( psz_value );
                                 }
                                 else
                                 {
-                                    p_style->i_margin_v = atoi( psz_value );
-                                    p_style->i_margin_percent_v = 0;
+                                    p_ssa_style->i_margin_v = atoi( psz_value );
+                                    p_ssa_style->i_margin_percent_v = 0;
                                 }
                             }
                         }
@@ -821,7 +824,7 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
                 break;
         }
     }
-    free( p_style );
+    free( p_ssa_style );
 }
 
 
@@ -1164,7 +1167,7 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec,
     /* Display the feed's image */
     memset( &fmt_out, 0, sizeof( video_format_t));
 
-    fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt_out.i_chroma = VLC_CODEC_YUVA;
     fmt_out.i_aspect = VOUT_ASPECT_FACTOR;
     fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
     fmt_out.i_width =
@@ -1178,7 +1181,7 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec,
         msg_Err( p_dec, "cannot allocate SPU region" );
         return NULL;
     }
-    assert( p_pic->format.i_chroma == VLC_FOURCC('Y','U','V','A') );
+    assert( p_pic->format.i_chroma == VLC_CODEC_YUVA );
     /* FIXME the copy is probably not needed anymore */
     picture_CopyPixels( p_region->p_picture, p_pic );
 
@@ -1198,7 +1201,7 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec,
         int i_u =   ( ( -38 * i_r -  74 * i_g + 112 * i_b + 128 ) >> 8 ) + 128 ;
         int i_v =   ( ( 112 * i_r -  94 * i_g -  18 * i_b + 128 ) >> 8 ) + 128 ;
 
-        assert( p_region->fmt.i_chroma == VLC_FOURCC('Y','U','V','A') );
+        assert( p_region->fmt.i_chroma == VLC_CODEC_YUVA );
         for( unsigned int y = 0; y < p_region->fmt.i_height; y++ )
         {
             for( unsigned int x = 0; x < p_region->fmt.i_width; x++ )
index 5e0c25a0a8bce8704f2e2f486e5b808a40407014..1c3f6e73484f67f857bd902313aa16ac0351ffa7 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_sout.h>
 
@@ -49,7 +48,7 @@ static int Open( vlc_object_t *p_this )
 
     switch( p_enc->fmt_out.i_codec )
     {
-        case VLC_FOURCC('s','u','b','t'):
+        case VLC_CODEC_SUBT:
             if( ( p_enc->fmt_out.subs.psz_encoding != NULL )
              && strcasecmp( p_enc->fmt_out.subs.psz_encoding, "utf8" )
              && strcasecmp( p_enc->fmt_out.subs.psz_encoding, "UTF-8" ) )
@@ -57,14 +56,14 @@ static int Open( vlc_object_t *p_this )
                 msg_Err( p_this, "Only UTF-8 encoding supported" );
                 return VLC_EGENERIC;
             }
-        case VLC_FOURCC('t','1','4','0'):
+        case VLC_CODEC_ITU_T140:
             break;
 
         default:
             if( !p_enc->b_force )
                 return VLC_EGENERIC;
 
-            p_enc->fmt_out.i_codec = VLC_FOURCC('t','1','4','0');
+            p_enc->fmt_out.i_codec = VLC_CODEC_ITU_T140;
     }
 
     p_enc->p_sys = NULL;
@@ -92,7 +91,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu )
 
     p_region = p_spu->p_region;
     if( ( p_region == NULL )
-     || ( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') )
+     || ( p_region->fmt.i_chroma != VLC_CODEC_TEXT )
      || ( p_region->psz_text == NULL ) )
         return NULL;
 
index c6d9ee922994a75a407b306bfa63f081ea637010..6afddccc582b0fef7743b98eaf2e8c66259f6e2c 100644 (file)
@@ -142,10 +142,8 @@ static int DecoderOpen( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC( 'o','g','t',' ' ) )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_OGT )
         return VLC_EGENERIC;
-    }
 
     p_dec->p_sys = p_sys = calloc( 1, sizeof( decoder_sys_t ) );
     if( p_sys == NULL )
@@ -158,7 +156,7 @@ static int DecoderOpen( vlc_object_t *p_this )
     p_sys->i_state = SUBTITLE_BLOCK_EMPTY;
     p_sys->p_spu   = NULL;
 
-    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_FOURCC( 'o','g','t',' ' ) );
+    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_CODEC_OGT );
 
     p_dec->pf_decode_sub = Decode;
     p_dec->pf_packetize  = Packetize;
@@ -480,7 +478,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
 
     /* Create new subtitle region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','P');
+    fmt.i_chroma = VLC_CODEC_YUVP;
 
     /**
        The video on which the subtitle sits, is scaled, probably
index 8c00db57632a8e8c4dc8642f74e835134011bfea..f0327413ff779c5d726de68857ded4a60b07633d 100644 (file)
@@ -31,7 +31,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 #include <ogg/ogg.h>
 
 /* FIXME */
@@ -93,7 +92,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('t','a','r','k') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_TARKIN )
     {
         return VLC_EGENERIC;
     }
@@ -240,19 +239,19 @@ static picture_t *DecodePacket( decoder_t *p_dec, block_t **pp_block,
         switch( p_sys->tarkin_stream->layer->desc.format )
         {
         case TARKIN_RGB24:
-            i_chroma = VLC_FOURCC('R','V','2','4');
+            i_chroma = VLC_CODEC_RGB24;
             i_stride = i_width * 3;
             break;
         case TARKIN_RGB32:
-            i_chroma = VLC_FOURCC('R','V','3','2');
+            i_chroma = VLC_CODEC_RGB32;
             i_stride = i_width * 4;
             break;
         case TARKIN_RGBA:
-            i_chroma = VLC_FOURCC('R','G','B','A');
+            i_chroma = VLC_CODEC_RGBA;
             i_stride = i_width * 4;
             break;
         default:
-            i_chroma = VLC_FOURCC('I','4','2','0');
+            i_chroma = VLC_CODEC_I420;
             i_stride = i_width;
             break;
         }
index 07fd4cf883d24894205dfec2addc1afd69c39d8b..59bd7f0d468f252f05d8846575665544e083ad01 100644 (file)
@@ -34,7 +34,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 
-#include "vlc_vout.h"
 #include "vlc_bits.h"
 #include "vlc_codec.h"
 
@@ -175,7 +174,7 @@ static int Open( vlc_object_t *p_this )
     vlc_value_t    val;
     int            i;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('t','e','l','x'))
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_TELETEXT)
     {
         return VLC_EGENERIC;
     }
@@ -701,7 +700,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
  
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_height = 0;
     fmt.i_x_offset = fmt.i_y_offset = 0;
index 17bf9a7cf06b32e24bea3750636add750f38deec..934c6839e5e4721a83471255d904aadcce2d739e 100644 (file)
@@ -31,7 +31,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 #include <vlc_sout.h>
 #include <vlc_input.h>
 #include <ogg/ogg.h>
@@ -135,7 +134,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('t','h','e','o') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_THEORA )
     {
         return VLC_EGENERIC;
     }
@@ -150,7 +149,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
+    p_dec->fmt_out.i_codec = VLC_CODEC_I420;
 
     /* Set callbacks */
     p_dec->pf_decode_video = (picture_t *(*)(decoder_t *, block_t **))
@@ -176,7 +175,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
     if( i_ret == VLC_SUCCESS )
     {
         p_dec->p_sys->b_packetizer = true;
-        p_dec->fmt_out.i_codec = VLC_FOURCC( 't', 'h', 'e', 'o' );
+        p_dec->fmt_out.i_codec = VLC_CODEC_THEORA;
     }
 
     return i_ret;
@@ -287,13 +286,13 @@ static int ProcessHeaders( decoder_t *p_dec )
     switch( p_sys->ti.pixelformat )
     {
       case OC_PF_420:
-        p_dec->fmt_out.i_codec = VLC_FOURCC( 'I','4','2','0' );
+        p_dec->fmt_out.i_codec = VLC_CODEC_I420;
         break;
       case OC_PF_422:
-        p_dec->fmt_out.i_codec = VLC_FOURCC( 'I','4','2','2' );
+        p_dec->fmt_out.i_codec = VLC_CODEC_I422;
         break;
       case OC_PF_444:
-        p_dec->fmt_out.i_codec = VLC_FOURCC( 'I','4','4','4' );
+        p_dec->fmt_out.i_codec = VLC_CODEC_I444;
         break;
       case OC_PF_RSVD:
       default:
@@ -609,7 +608,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     vlc_value_t val;
     int i_quality, i;
 
-    if( p_enc->fmt_out.i_codec != VLC_FOURCC('t','h','e','o') &&
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_THEORA &&
         !p_enc->b_force )
     {
         return VLC_EGENERIC;
@@ -621,8 +620,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->p_sys = p_sys;
 
     p_enc->pf_encode_video = Encode;
-    p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
-    p_enc->fmt_out.i_codec = VLC_FOURCC('t','h','e','o');
+    p_enc->fmt_in.i_codec = VLC_CODEC_I420;
+    p_enc->fmt_out.i_codec = VLC_CODEC_THEORA;
 
     config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
index 787cbf87fe94864872c735e70b1ab3b89d027876..6a3f33e890ce6a1f48cb8a10212d124fa0818ce7 100644 (file)
@@ -132,7 +132,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     vlc_value_t val;
     int i_frequency;
 
-    if( p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','g','a') &&
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_MPGA &&
         p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','2','a') &&
         p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','2',' ') &&
         !p_enc->b_force )
@@ -164,10 +164,10 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->p_sys = p_sys;
 
     p_enc->pf_encode_audio = Encode;
-    p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
+    p_enc->fmt_in.i_codec = VLC_CODEC_S16N;
 
     p_enc->fmt_out.i_cat = AUDIO_ES;
-    p_enc->fmt_out.i_codec = VLC_FOURCC('m','p','g','a');
+    p_enc->fmt_out.i_codec = VLC_CODEC_MPGA;
 
     config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
index 5d25be9d51b09abfd8c74d80738499710c0c7a2b..62cb4d2595df2548510e2dc8f85ef8ddc0e9f838 100644 (file)
@@ -229,7 +229,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('v','o','r','b') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_VORBIS )
     {
         return VLC_EGENERIC;
     }
@@ -251,9 +251,9 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
 #ifdef MODULE_NAME_IS_tremor
-    p_dec->fmt_out.i_codec = VLC_FOURCC('f','i','3','2');
+    p_dec->fmt_out.i_codec = VLC_CODEC_FI32;
 #else
-    p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+    p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
 #endif
 
     /* Set callbacks */
@@ -274,7 +274,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
     if( i_ret == VLC_SUCCESS )
     {
         p_dec->p_sys->b_packetizer = true;
-        p_dec->fmt_out.i_codec = VLC_FOURCC('v','o','r','b');
+        p_dec->fmt_out.i_codec = VLC_CODEC_VORBIS;
     }
 
     return i_ret;
@@ -794,7 +794,7 @@ static int OpenEncoder( vlc_object_t *p_this )
     vlc_value_t val;
     uint8_t *p_extra;
 
-    if( p_enc->fmt_out.i_codec != VLC_FOURCC('v','o','r','b') &&
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_VORBIS &&
         !p_enc->b_force )
     {
         return VLC_EGENERIC;
@@ -806,8 +806,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_enc->p_sys = p_sys;
 
     p_enc->pf_encode_audio = Encode;
-    p_enc->fmt_in.i_codec = VLC_FOURCC('f','l','3','2');
-    p_enc->fmt_out.i_codec = VLC_FOURCC('v','o','r','b');
+    p_enc->fmt_in.i_codec = VLC_CODEC_FL32;
+    p_enc->fmt_out.i_codec = VLC_CODEC_VORBIS;
 
     config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
 
index e57b9cef57391a2b204fcb22732e2b6fe7aa07ad..a67e6eb8bcdbab29238f9a2dddc965b5c112f1ba 100644 (file)
@@ -119,10 +119,8 @@ static int OpenDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('w','m','a','1') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('W','M','A','1') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('w','m','a','2') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('W','M','A','2') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_WMA1 &&
+        p_dec->fmt_in.i_codec != VLC_CODEC_WMA2 )
     {
         return VLC_EGENERIC;
     }
@@ -139,7 +137,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('f','i','3','2');
+    p_dec->fmt_out.i_codec = VLC_CODEC_FI32;
     p_dec->fmt_out.audio.i_bitspersample = p_dec->fmt_in.audio.i_bitspersample;
     p_dec->fmt_out.audio.i_rate = p_dec->fmt_in.audio.i_rate;
 
@@ -166,11 +164,9 @@ static int OpenDecoder( vlc_object_t *p_this )
         wfx.rate, wfx.bitrate, wfx.channels, wfx.blockalign,
         wfx.bitspersample );
 
-    if( p_dec->fmt_in.i_codec == VLC_FOURCC('w','m','a','1')
-        || p_dec->fmt_in.i_codec == VLC_FOURCC('W','M','A','1') )
+    if( p_dec->fmt_in.i_codec == VLC_CODEC_WMA1 )
         wfx.codec_id = ASF_CODEC_ID_WMAV1;
-    else if( p_dec->fmt_in.i_codec == VLC_FOURCC('W','M','A','2')
-        || p_dec->fmt_in.i_codec == VLC_FOURCC('w','m','a','2') )
+    else if( p_dec->fmt_in.i_codec == VLC_CODEC_WMA2 )
         wfx.codec_id = ASF_CODEC_ID_WMAV2;
 
     wfx.datalen = p_dec->fmt_in.i_extra;
index 5004c2c724569bcfa1f70536a0d6afb5b86a9894..93df88d8956581ace5c4eca0097f6d7c8d815d0b 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_sout.h>
 #include <vlc_codec.h>
 
@@ -761,7 +760,7 @@ static int  Open ( vlc_object_t *p_this )
     x264_nal_t    *nal;
     int i, i_nal;
 
-    if( p_enc->fmt_out.i_codec != VLC_FOURCC( 'h', '2', '6', '4' ) &&
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_H264 &&
         !p_enc->b_force )
     {
         return VLC_EGENERIC;
@@ -793,8 +792,8 @@ static int  Open ( vlc_object_t *p_this )
     config_ChainParse( p_enc, SOUT_CFG_PREFIX, ppsz_sout_options, p_enc->p_cfg );
 
     p_enc->fmt_out.i_cat = VIDEO_ES;
-    p_enc->fmt_out.i_codec = VLC_FOURCC( 'h', '2', '6', '4' );
-    p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
+    p_enc->fmt_out.i_codec = VLC_CODEC_H264;
+    p_enc->fmt_in.i_codec = VLC_CODEC_I420;
 
     p_enc->pf_encode_video = Encode;
     p_enc->pf_encode_audio = NULL;
index edfe1cc27b2cbadc6219884dc98aed416fb33bb9..19b238b9fb87d7450f4d1f82310a2b3e28664083 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_codec_synchro.h>
 
@@ -121,17 +120,25 @@ static int OpenDecoder( vlc_object_t *p_this )
 #ifdef __GLIBC__
     mtrace();
 #endif
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','v') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','1') &&
-        /* Pinnacle hardware-mpeg1 */
-        p_dec->fmt_in.i_codec != VLC_FOURCC('P','I','M','1') &&
-        /* VIA hardware-mpeg2 */
-        p_dec->fmt_in.i_codec != VLC_FOURCC('X','x','M','C') &&
-        /* ATI Video */
-        p_dec->fmt_in.i_codec != VLC_FOURCC('V','C','R','2') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','2') )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MPGV )
         return VLC_EGENERIC;
+    /* Select onl recognized original format (standard mpeg video) */
+    switch( p_dec->fmt_in.i_original_fourcc )
+    {
+    case VLC_FOURCC('m','p','g','1'):
+    case VLC_FOURCC('m','p','g','2'):
+    case VLC_FOURCC('m','p','g','v'):
+    /* Pinnacle hardware-mpeg1 */
+    case VLC_FOURCC('P','I','M','1'):
+    /* VIA hardware-mpeg2 */
+    case VLC_FOURCC('X','x','M','C'):
+    /* ATI Video */
+    case VLC_FOURCC('V','C','R','2'):
+        break;
+    default:
+        if( p_dec->fmt_in.i_original_fourcc )
+            return VLC_EGENERIC;
+        break;
     }
 
     msg_Dbg(p_dec, "OpenDecoder Entering");
@@ -693,7 +700,7 @@ static picture_t *GetNewPicture( decoder_t *p_dec, uint8_t **pp_buf )
     p_dec->fmt_out.i_codec =
         ( p_sys->p_info->sequence->chroma_height <
           p_sys->p_info->sequence->height ) ?
-        VLC_FOURCC('I','4','2','0') : VLC_FOURCC('I','4','2','2');
+        VLC_CODEC_I420 : VLC_CODEC_I422;
 
 #if 0
     p_sys->f_wd_nb = fopen("/vlc/dec_nb", "w");
index 8d5509a6b4294f153ba961ffc1d35b9a27ac548f..26672f2c94460dfbecfd0ad450a8ae8af1e8d0a6 100644 (file)
@@ -46,7 +46,6 @@
 #include <assert.h>
 #include <libzvbi.h>
 
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_osd.h>
 
@@ -203,7 +202,7 @@ static int Open( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t *) p_this;
     decoder_sys_t *p_sys = NULL;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('t','e','l','x') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_TELETEXT )
         return VLC_EGENERIC;
 
     p_dec->pf_decode_sub = Decode;
@@ -271,11 +270,11 @@ static int Open( vlc_object_t *p_this )
     /* Listen for keys */
     var_AddCallback( p_dec->p_libvlc, "key-pressed", EventKey, p_dec );
 
-    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_FOURCC( 's','p','u',' ' ) );
+    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_CODEC_SPU );
     if( p_sys->b_text )
-        p_dec->fmt_out.video.i_chroma = VLC_FOURCC('T','E','X','T');
+        p_dec->fmt_out.video.i_chroma = VLC_CODEC_TEXT;
     else
-        p_dec->fmt_out.video.i_chroma = VLC_FOURCC('R','G','B','A');
+        p_dec->fmt_out.video.i_chroma = VLC_CODEC_RGBA;
     return VLC_SUCCESS;
 }
 
@@ -466,8 +465,8 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt,
     }
 
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = b_text ? VLC_FOURCC('T','E','X','T') :
-                                   VLC_FOURCC('R','G','B','A');
+    fmt.i_chroma = b_text ? VLC_CODEC_TEXT :
+                                   VLC_CODEC_RGBA;
     fmt.i_aspect = b_text ? 0 : VOUT_ASPECT_FACTOR;
     if( b_text )
     {
@@ -556,7 +555,7 @@ static int OpaquePage( picture_t *p_src, const vbi_page p_page,
 {
     unsigned int    x, y;
 
-    assert( fmt.i_chroma == VLC_FOURCC('R','G','B','A' ) );
+    assert( fmt.i_chroma == VLC_CODEC_RGBA );
 
     /* Kludge since zvbi doesn't provide an option to specify opacity. */
     for( y = 0; y < fmt.i_height; y++ )
index 2753140710742b42bab9ade2db57f424b63be128..9aa7a9dadbd0635375aabbac29c695b5994f17e5 100644 (file)
@@ -514,7 +514,7 @@ DBUS_METHOD( DelTrack )
     if( i_position < p_playlist->current.i_size )
     {
         playlist_DeleteFromInput( p_playlist,
-            p_playlist->current.p_elems[i_position]->p_input->i_id,
+            p_playlist->current.p_elems[i_position]->p_input,
             pl_Locked );
     }
     PL_UNLOCK;
index 38a6cc1af25d625d7378574af52ecb4c0280602a..4d55c8df273deed99637f43be6ebc2f4356fa181 100644 (file)
@@ -353,7 +353,8 @@ static void MacroDo( httpd_file_sys_t *p_args,
                 }
                 case MVLC_DEL:
                 {
-                    int i_item, *p_items = NULL, i_nb_items = 0;
+                    int *p_items = NULL;
+                    size_t i_nb_items = 0;
                     char item[512];
                     const char *p_parser = p_request;
 
@@ -363,24 +364,25 @@ static void MacroDo( httpd_file_sys_t *p_args,
                     {
                         if( !*item ) continue;
 
-                        i_item = atoi( item );
+                        int i_item = atoi( item );
                         p_items = realloc( p_items, (i_nb_items + 1) *
-                                           sizeof(int) );
+                                           sizeof(*p_items) );
                         p_items[i_nb_items] = i_item;
                         i_nb_items++;
                     }
 
-                    if( i_nb_items )
+                    for( size_t i = 0; i < i_nb_items; i++ )
                     {
-                        int i;
-                        for( i = 0; i < i_nb_items; i++ )
-                        {
+                        playlist_item_t *p_item;
+
+                        msg_Dbg( p_intf, "requested playlist delete: %d",
+                                 p_items[i] );
+                        p_item = playlist_ItemGetById( p_sys->p_playlist,
+                                                       p_items[i] );
+                        if( p_item )
                             playlist_DeleteFromInput( p_sys->p_playlist,
-                                                      p_items[i], false );
-                            msg_Dbg( p_intf, "requested playlist delete: %d",
-                                     p_items[i] );
-                            p_items[i] = -1;
-                        }
+                                                      p_item->p_input,
+                                                      false );
                     }
 
                     free( p_items );
@@ -388,10 +390,10 @@ static void MacroDo( httpd_file_sys_t *p_args,
                 }
                 case MVLC_KEEP:
                 {
-                    int i_item, *p_items = NULL, i_nb_items = 0;
+                    int *p_items = NULL;
+                    size_t i_nb_items = 0, i;
                     char item[512];
                     const char *p_parser = p_request;
-                    int i,j;
 
                     /* Get the list of items to keep */
                     while( (p_parser =
@@ -399,30 +401,31 @@ static void MacroDo( httpd_file_sys_t *p_args,
                     {
                         if( !*item ) continue;
 
-                        i_item = atoi( item );
+                        int i_item = atoi( item );
                         p_items = realloc( p_items, (i_nb_items + 1) *
-                                           sizeof(int) );
+                                           sizeof(*p_items) );
                         p_items[i_nb_items] = i_item;
                         i_nb_items++;
                     }
 
-                    for( i = p_sys->p_playlist->items.i_size - 1 ; i >= 0; i-- )
+                    for( i = 0; i < p_sys->p_playlist->items.i_size; i++ )
                     {
+                        size_t j;
+
                         /* Check if the item is in the keep list */
                         for( j = 0 ; j < i_nb_items ; j++ )
                         {
                             if( p_items[j] ==
-                                 ARRAY_VAL(p_sys->p_playlist->items,i)
-                                                ->i_id)
+                                ARRAY_VAL(p_sys->p_playlist->items,i)->i_id)
                                 break;
                         }
                         if( j == i_nb_items )
                         {
+                            msg_Dbg( p_intf, "requested playlist delete: %d",
+                                   p_sys->p_playlist->items.p_elems[i]->i_id );
                             playlist_DeleteFromInput( p_sys->p_playlist,
-                                     p_sys->p_playlist->items.p_elems[i]->i_id,
+                                p_sys->p_playlist->items.p_elems[i]->p_input,
                                                       false );
-                            msg_Dbg( p_intf, "requested playlist delete: %d",
-                                     i );
                         }
                     }
 
index 05c30cf4fec935c37eb780621302b20ed0549074..43e72c5dbdeef192adf1640425c5730294c84c6b 100644 (file)
@@ -875,7 +875,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t  *vars,
             if( p_item )
             {
                 playlist_DeleteFromInput( p_sys->p_playlist,
-                                          p_item->p_input->i_id, pl_Locked );
+                                          p_item->p_input, pl_Locked );
                 msg_Dbg( p_intf, "requested playlist delete: %d", i_id );
             }
             else
index 69de4a65aaca76bdd93c52eccb70bc9f376e534a..053e3ff391c18b688d27eceffaab3100fea2ab24 100644 (file)
@@ -349,7 +349,7 @@ void PlaylistListNode( intf_thread_t *p_intf, playlist_t *p_pl,
             return;
 
         mvar_t *itm = mvar_New( name, "set" );
-        if( p_item->p_input->i_id == p_node->p_input->i_id )
+        if( p_item->p_input == p_node->p_input )
             mvar_AppendNewVar( itm, "current", "1" );
         else
             mvar_AppendNewVar( itm, "current", "0" );
index d72e73e0932a993666b28ccde5dd29bba8fef6e6..2928cbef6bfa45c318b2b905452b97192e7b2d35 100644 (file)
@@ -19,7 +19,7 @@ SOURCES_mjpeg = mjpeg.c
 SOURCES_subtitle = subtitle.c
 SOURCES_asademux = subtitle_asa.c asademux.c asademux_defs.h asademux.h
 SOURCES_ty = ty.c ../codec/cc.h
-SOURCES_vobsub = vobsub.c
+SOURCES_vobsub = vobsub.c vobsub.h
 SOURCES_voc = voc.c
 SOURCES_xa = xa.c
 SOURCES_nuv = nuv.c
index fb5de970c2f36dfa1bf21f73f374c76e7ec12143..18c293d3cae52e0d931594e2d7abfce877bb809e 100644 (file)
@@ -923,7 +923,7 @@ static int DemuxInit( demux_t *p_demux )
                 es_format_Init( &fmt, AUDIO_ES, 0 );
                 i_format = GetWLE( &p_data[0] );
                 if( i_format == 0 )
-                    fmt.i_codec = VLC_FOURCC( 'a','5','2',' ');
+                    fmt.i_codec = VLC_CODEC_A52;
                 else
                     wf_tag_to_fourcc( i_format, &fmt.i_codec, NULL );
                 fmt.audio.i_channels        = GetWLE(  &p_data[2] );
index 08f7e986417f0d84d2dd2f418d98a09742dcc6b2..bccf2ea6cf3ec532df464bef1121d7a835513eb3 100644 (file)
@@ -156,14 +156,14 @@ static int Open( vlc_object_t *p_this )
     switch( GetDWBE( &hdr[8] ) )
     {
         case AU_ALAW_8:        /* 8-bit ISDN A-law */
-            p_sys->fmt.i_codec               = VLC_FOURCC( 'a','l','a','w' );
+            p_sys->fmt.i_codec               = VLC_CODEC_ALAW;
             p_sys->fmt.audio.i_bitspersample = 8;
             p_sys->fmt.audio.i_blockalign    = 1 * p_sys->fmt.audio.i_channels;
             i_cat                    = AU_CAT_PCM;
             break;
 
         case AU_MULAW_8:       /* 8-bit ISDN u-law */
-            p_sys->fmt.i_codec               = VLC_FOURCC( 'u','l','a','w' );
+            p_sys->fmt.i_codec               = VLC_CODEC_MULAW;
             p_sys->fmt.audio.i_bitspersample = 8;
             p_sys->fmt.audio.i_blockalign    = 1 * p_sys->fmt.audio.i_channels;
             i_cat                    = AU_CAT_PCM;
index 3b8ec5dc06fdfe04ef4b04994b0130ec181bf14d..dae22c924eb8f71fc2f57476be686c47038351f3 100644 (file)
@@ -4,6 +4,7 @@ SOURCES_avformat = \
     demux.c \
     ../../codec/avcodec/fourcc.c \
     ../../codec/avcodec/chroma.c \
+       ../vobsub.h \
     $(NULL)
 if ENABLE_SOUT
 SOURCES_avformat += mux.c
index dd0f7c93d2f579f595f2405bd607d23aa60b6dc0..16a9cb04718bb52ed7877c007648fbfc453391d2 100644 (file)
@@ -47,6 +47,7 @@
 
 #include "../../codec/avcodec/avcodec.h"
 #include "avformat.h"
+#include "../vobsub.h"
 
 //#define AVFORMAT_DEBUG 1
 
@@ -271,6 +272,48 @@ int OpenDemux( vlc_object_t *p_this )
 
         case CODEC_TYPE_SUBTITLE:
             es_format_Init( &fmt, SPU_ES, fcc );
+            if( strncmp( p_sys->ic->iformat->name, "matroska", 8 ) == 0 &&
+                cc->codec_id == CODEC_ID_DVD_SUBTITLE &&
+                cc->extradata != NULL &&
+                cc->extradata_size > 0 )
+            {
+                char *psz_start;
+                char *psz_buf = malloc( cc->extradata_size + 1);
+                if( psz_buf != NULL )
+                {
+                    memcpy( psz_buf, cc->extradata , cc->extradata_size );
+                    psz_buf[cc->extradata_size] = '\0';
+
+                    psz_start = strstr( psz_buf, "size:" );
+                    if( psz_start &&
+                        vobsub_size_parse( psz_start,
+                                           &fmt.subs.spu.i_original_frame_width,
+                                           &fmt.subs.spu.i_original_frame_height ) == VLC_SUCCESS )
+                    {
+                        msg_Dbg( p_demux, "original frame size: %dx%d",
+                                 fmt.subs.spu.i_original_frame_width,
+                                 fmt.subs.spu.i_original_frame_height );
+                    }
+                    else
+                    {
+                        msg_Warn( p_demux, "reading original frame size failed" );
+                    }
+
+                    psz_start = strstr( psz_buf, "palette:" );
+                    if( psz_start &&
+                        vobsub_palette_parse( psz_start, &fmt.subs.spu.palette[1] ) == VLC_SUCCESS )
+                    {
+                        fmt.subs.spu.palette[0] =  0xBeef;
+                        msg_Dbg( p_demux, "vobsub palette read" );
+                    }
+                    else
+                    {
+                        msg_Warn( p_demux, "reading original palette failed" );
+                    }
+                    free( psz_buf );
+                }
+            }
+
             psz_type = "subtitle";
             break;
 
index 3e98975cd24396f8cde64a6f4aac43691e7720b6..4dbb17e86610089d5c2a45952b99f68acf8a039f 100644 (file)
@@ -278,7 +278,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     /* This is a hack */
     if( i_codec_id == CODEC_ID_MP2 )
         i_codec_id = CODEC_ID_MP3;
-    codec->codec_tag = p_input->p_fmt->i_codec;
+    codec->codec_tag = p_input->p_fmt->i_original_fourcc ?: p_input->p_fmt->i_codec;
 #endif
     codec->codec_id = i_codec_id;
 
index bfea0b79a7d9cb66ca7ed8d34deb3b908f0d2755..98f60d5f724ef4128628949d04535ca975264467 100644 (file)
@@ -402,7 +402,7 @@ static int Open( vlc_object_t * p_this )
                     tk->i_samplesize = tk->i_blocksize;
                 }
 
-                if( tk->i_codec == VLC_FOURCC( 'v', 'o', 'r', 'b' ) )
+                if( tk->i_codec == VLC_CODEC_VORBIS )
                 {
                     tk->i_blocksize = 0; /* fix vorbis VBR decoding */
                 }
@@ -445,7 +445,7 @@ static int Open( vlc_object_t * p_this )
                  *  - Size of the next packet, and so on ...
                  */
 
-                if( tk->i_codec == VLC_FOURCC( 'v', 'o', 'r', 'b' ) )
+                if( tk->i_codec == VLC_CODEC_VORBIS )
                 {
                     uint8_t *p_extra = fmt.p_extra; 
                     size_t i_extra = fmt.i_extra;
@@ -511,33 +511,33 @@ static int Open( vlc_object_t * p_this )
                     switch( p_vids->p_bih->biBitCount )
                     {
                         case 32:
-                            tk->i_codec = VLC_FOURCC('R','V','3','2');
+                            tk->i_codec = VLC_CODEC_RGB32;
                             break;
                         case 24:
-                            tk->i_codec = VLC_FOURCC('R','V','2','4');
+                            tk->i_codec = VLC_CODEC_RGB24;
                             break;
                         case 16: /* Yes it is RV15 */
                         case 15:
-                            tk->i_codec = VLC_FOURCC('R','V','1','5');
+                            tk->i_codec = VLC_CODEC_RGB15;
                             break;
                         case 9: /* <- TODO check that */
-                            tk->i_codec = VLC_FOURCC( 'Y', 'V', 'U', '9' );
+                            tk->i_codec = VLC_CODEC_I410;
                             break;
                         case 8: /* <- TODO check that */
-                            tk->i_codec = VLC_FOURCC('Y','8','0','0');
+                            tk->i_codec = VLC_CODEC_GREY;
                             break;
                     }
                     es_format_Init( &fmt, VIDEO_ES, tk->i_codec );
 
                     switch( tk->i_codec )
                     {
-                    case VLC_FOURCC('R','V','2','4'):
-                    case VLC_FOURCC('R','V','3','2'):
+                    case VLC_CODEC_RGB24:
+                    case VLC_CODEC_RGB32:
                         fmt.video.i_rmask = 0x00ff0000;
                         fmt.video.i_gmask = 0x0000ff00;
                         fmt.video.i_bmask = 0x000000ff;
                         break;
-                    case VLC_FOURCC('R','V','1','5'):
+                    case VLC_CODEC_RGB15:
                         fmt.video.i_rmask = 0x7c00;
                         fmt.video.i_gmask = 0x03e0;
                         fmt.video.i_bmask = 0x001f;
@@ -549,10 +549,11 @@ static int Open( vlc_object_t * p_this )
                 else
                 {
                     es_format_Init( &fmt, VIDEO_ES, p_vids->p_bih->biCompression );
-                    if( tk->i_codec == FOURCC_mp4v &&
+                    if( tk->i_codec == VLC_CODEC_MP4V &&
                         !strncasecmp( (char*)&p_strh->i_handler, "XVID", 4 ) )
                     {
-                        fmt.i_codec = VLC_FOURCC( 'X', 'V', 'I', 'D' );
+                        fmt.i_codec           =
+                        fmt.i_original_fourcc = VLC_FOURCC( 'X', 'V', 'I', 'D' );
                     }
                 }
                 tk->i_samplesize = 0;
@@ -604,7 +605,7 @@ static int Open( vlc_object_t * p_this )
 
             case( AVIFOURCC_txts):
                 tk->i_cat   = SPU_ES;
-                tk->i_codec = VLC_FOURCC( 's', 'u', 'b', 't' );
+                tk->i_codec = VLC_CODEC_SUBT;
                 msg_Dbg( p_demux, "stream[%d] subtitles", i );
                 es_format_Init( &fmt, SPU_ES, tk->i_codec );
                 break;
@@ -1858,7 +1859,7 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte )
 {
     switch( i_fourcc )
     {
-        case FOURCC_DIV1:
+        case VLC_CODEC_DIV1:
             /* we have:
              *  startcode:      0x00000100   32bits
              *  framenumber     ?             5bits
@@ -1871,13 +1872,14 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte )
             }
             return p_byte[4] & 0x06 ? 0 : AVIIF_KEYFRAME;
 
-        case FOURCC_DIV2:
-        case FOURCC_DIV3:   /* wmv1 also */
+        case VLC_CODEC_DIV2:
+        case VLC_CODEC_DIV3:
+        case VLC_CODEC_WMV1:
             /* we have
              *  picture type    0(I),1(P)     2bits
              */
             return p_byte[0] & 0xC0 ? 0 : AVIIF_KEYFRAME;
-        case FOURCC_mp4v:
+        case VLC_CODEC_MP4V:
             /* we should find first occurrence of 0x000001b6 (32bits)
              *  startcode:      0x000001b6   32bits
              *  piture type     0(I),1(P)     2bits
@@ -1902,60 +1904,8 @@ vlc_fourcc_t AVI_FourccGetCodec( unsigned int i_cat, vlc_fourcc_t i_codec )
         case AUDIO_ES:
             wf_tag_to_fourcc( i_codec, &i_codec, NULL );
             return i_codec;
-
         case VIDEO_ES:
-            /* XXX DIV1 <- msmpeg4v1, DIV2 <- msmpeg4v2, DIV3 <- msmpeg4v3, mp4v for mpeg4 */
-            switch( i_codec )
-            {
-                case FOURCC_1:
-                    return VLC_FOURCC('m','r','l','e');
-                case FOURCC_DIV1:
-                case FOURCC_div1:
-                case FOURCC_MPG4:
-                case FOURCC_mpg4:
-                    return FOURCC_DIV1;
-                case FOURCC_DIV2:
-                case FOURCC_div2:
-                case FOURCC_MP42:
-                case FOURCC_mp42:
-                case FOURCC_MPG3:
-                case FOURCC_mpg3:
-                    return FOURCC_DIV2;
-                case FOURCC_div3:
-                case FOURCC_MP43:
-                case FOURCC_mp43:
-                case FOURCC_DIV3:
-                case FOURCC_DIV4:
-                case FOURCC_div4:
-                case FOURCC_DIV5:
-                case FOURCC_div5:
-                case FOURCC_DIV6:
-                case FOURCC_div6:
-                case FOURCC_AP41:
-                case FOURCC_3IV1:
-                case FOURCC_3iv1:
-                case FOURCC_3IVD:
-                case FOURCC_3ivd:
-                case FOURCC_3VID:
-                case FOURCC_3vid:
-                    return FOURCC_DIV3;
-                case FOURCC_DIVX:
-                case FOURCC_divx:
-                case FOURCC_MP4S:
-                case FOURCC_mp4s:
-                case FOURCC_M4S2:
-                case FOURCC_m4s2:
-                case FOURCC_xvid:
-                case FOURCC_XVID:
-                case FOURCC_XviD:
-                case FOURCC_DX50:
-                case FOURCC_dx50:
-                case FOURCC_mp4v:
-                case FOURCC_4:
-                case FOURCC_3IV2:
-                case FOURCC_3iv2:
-                    return FOURCC_mp4v;
-            }
+            return vlc_fourcc_GetCodec( i_cat, i_codec );
         default:
             return VLC_FOURCC( 'u', 'n', 'd', 'f' );
     }
index 453602c0754ef8ddc67f85c9bb1ada29727b59c5..ff885753728e3fee698939709765673f7934eb16 100644 (file)
@@ -298,75 +298,6 @@ void    AVI_ChunkFreeRoot( stream_t *, avi_chunk_t  *p_chk );
 #define AVITWOCC_AC            VLC_TWOCC('A','C')
     /* *** codex stuff ***  */
 
-    /* Microsoft RLE video */
-#define FOURCC_1            VLC_FOURCC( 1,  0,  0,  0 )
-
-    /* MPEG4 video */
-#define FOURCC_DIVX         VLC_FOURCC('D','I','V','X')
-#define FOURCC_divx         VLC_FOURCC('d','i','v','x')
-#define FOURCC_DIV1         VLC_FOURCC('D','I','V','1')
-#define FOURCC_div1         VLC_FOURCC('d','i','v','1')
-#define FOURCC_MP4S         VLC_FOURCC('M','P','4','S')
-#define FOURCC_mp4s         VLC_FOURCC('m','p','4','s')
-#define FOURCC_M4S2         VLC_FOURCC('M','4','S','2')
-#define FOURCC_m4s2         VLC_FOURCC('m','4','s','2')
-#define FOURCC_xvid         VLC_FOURCC('x','v','i','d')
-#define FOURCC_XVID         VLC_FOURCC('X','V','I','D')
-#define FOURCC_XviD         VLC_FOURCC('X','v','i','D')
-#define FOURCC_DX50         VLC_FOURCC('D','X','5','0')
-#define FOURCC_dx50         VLC_FOURCC('d','x','5','0')
-#define FOURCC_mp4v         VLC_FOURCC('m','p','4','v')
-#define FOURCC_4            VLC_FOURCC( 4,  0,  0,  0 )
-
-    /* MSMPEG4 v2 */
-#define FOURCC_MPG4         VLC_FOURCC('M','P','G','4')
-#define FOURCC_mpg4         VLC_FOURCC('m','p','g','4')
-#define FOURCC_DIV2         VLC_FOURCC('D','I','V','2')
-#define FOURCC_div2         VLC_FOURCC('d','i','v','2')
-#define FOURCC_MP42         VLC_FOURCC('M','P','4','2')
-#define FOURCC_mp42         VLC_FOURCC('m','p','4','2')
-
-    /* MSMPEG4 v3 / M$ mpeg4 v3 */
-#define FOURCC_MPG3         VLC_FOURCC('M','P','G','3')
-#define FOURCC_mpg3         VLC_FOURCC('m','p','g','3')
-#define FOURCC_div3         VLC_FOURCC('d','i','v','3')
-#define FOURCC_MP43         VLC_FOURCC('M','P','4','3')
-#define FOURCC_mp43         VLC_FOURCC('m','p','4','3')
-
-    /* DivX 3.20 */
-#define FOURCC_DIV3         VLC_FOURCC('D','I','V','3')
-#define FOURCC_DIV4         VLC_FOURCC('D','I','V','4')
-#define FOURCC_div4         VLC_FOURCC('d','i','v','4')
-#define FOURCC_DIV5         VLC_FOURCC('D','I','V','5')
-#define FOURCC_div5         VLC_FOURCC('d','i','v','5')
-#define FOURCC_DIV6         VLC_FOURCC('D','I','V','6')
-#define FOURCC_div6         VLC_FOURCC('d','i','v','6')
-
-    /* AngelPotion stuff */
-#define FOURCC_AP41         VLC_FOURCC('A','P','4','1')
-
-    /* 3IVX */
-#define FOURCC_3IV1         VLC_FOURCC('3','I','V','1')
-#define FOURCC_3iv1         VLC_FOURCC('2','i','v','1')
-#define FOURCC_3IV2         VLC_FOURCC('3','I','V','2')
-#define FOURCC_3iv2         VLC_FOURCC('3','i','v','2')
-#define FOURCC_3IVD         VLC_FOURCC('3','I','V','D')
-#define FOURCC_3ivd         VLC_FOURCC('3','i','v','d')
-#define FOURCC_3VID         VLC_FOURCC('3','V','I','D')
-#define FOURCC_3vid         VLC_FOURCC('3','v','i','d')
-
-    /* H263 and H263i */
-#define FOURCC_H263         VLC_FOURCC('H','2','6','3')
-#define FOURCC_h263         VLC_FOURCC('h','2','6','3')
-#define FOURCC_U263         VLC_FOURCC('U','2','6','3')
-#define FOURCC_I263         VLC_FOURCC('I','2','6','3')
-#define FOURCC_i263         VLC_FOURCC('i','2','6','3')
-
-    /* H264 */
-#define FOURCC_H264         VLC_FOURCC('H','2','6','4')
-#define FOURCC_h264         VLC_FOURCC('h','2','6','4')
-#define FOURCC_VSSH         VLC_FOURCC('V','S','S','H')
-
     /* DV */
 #define FOURCC_dvsd         VLC_FOURCC('d','v','s','d')
 #define FOURCC_dvhd         VLC_FOURCC('d','v','h','d')
index d9102884bc680ef0e3e2ac190daf5a51ddd05b26..4b6e59d4400afa1613f1174ad79c8270eae4a832 100644 (file)
@@ -94,7 +94,7 @@ static int Open( vlc_object_t * p_this )
     p_demux->p_sys      = p_sys = malloc( sizeof( demux_sys_t ) );
 
     /* */
-    es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_FOURCC('C','D','G', ' ' ) );
+    es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_CODEC_CDG );
     p_sys->fmt.video.i_width  = 300-2*6;
     p_sys->fmt.video.i_height = 216-2*12 ;
 
index 84e66913830f3aef1a2b85b0cd4fa7c981adebdc..4cfd537fdc64395953ed37ea07bb9a3da0a9433e 100644 (file)
@@ -110,7 +110,7 @@ static int Open( vlc_object_t * p_this )
     p_sys->i_dtsoffset = var_CreateGetInteger( p_demux, DEMUX_CFG_PREFIX DEMUX_DTSOFFSET );
 
     /* Load the packetizer */
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( 'd','r','a','c' ) );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_DIRAC );
     p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "dirac" );
     if( !p_sys->p_packetizer )
     {
index 17b45ff6cc072d6c7eeb38791efb3865047be88b..91a2cccb40d76ad24c53ea6f27841ffa5f08137e 100644 (file)
@@ -144,7 +144,7 @@ static int Open( vlc_object_t * p_this )
     /* Load the FLAC packetizer */
     /* Store STREAMINFO for the decoder and packetizer */
     p_streaminfo[4] |= 0x80; /* Fake this as the last metadata block */
-    es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'f', 'l', 'a', 'c' ) );
+    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_FLAC );
     fmt.i_extra = i_streaminfo;
     fmt.p_extra = p_streaminfo;
 
index 414c51fcdaf4cf3dac8e4735d1cbf7c939122bfa..aa6a789ebaf8411e7a0c6d1af3e2ce80c00dd182 100644 (file)
@@ -18,9 +18,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -45,6 +45,7 @@
 #include <vlc_dialog.h>
 #include <vlc_network.h>
 #include <vlc_url.h>
+#include <vlc_strings.h>
 
 #include <iostream>
 #include <limits.h>
@@ -78,16 +79,16 @@ static void Close( vlc_object_t * );
     "value should be set in millisecond units." )
 
 #define KASENNA_TEXT N_( "Kasenna RTSP dialect")
-#define KASENNA_LONGTEXT N_( "Kasenna servers use an old and unstandard " \
-    "dialect of RTSP. When you set this parameter, VLC will try this dialect "\
-    "for communication. In this mode you cannot connect to normal RTSP servers." )
+#define KASENNA_LONGTEXT N_( "Kasenna servers use an old and nonstandard " \
+    "dialect of RTSP. With this parameter VLC will try this dialect, but "\
+    "then it cannot connect to normal RTSP servers." )
 
 #define USER_TEXT N_("RTSP user name")
-#define USER_LONGTEXT N_("Allows you to modify the user name that will " \
-    "be used for authenticating the connection.")
+#define USER_LONGTEXT N_("Sets the username for the connection, " \
+    "if no username or password are set in the url.")
 #define PASS_TEXT N_("RTSP password")
-#define PASS_LONGTEXT N_("Allows you to modify the password that will be " \
-    "used for the connection.")
+#define PASS_LONGTEXT N_("Sets the password for the connection, " \
+    "if no username or password are set in the url.")
 
 vlc_module_begin ()
     set_description( N_("RTP/RTSP/SDP demuxer (using Live555)" ) )
@@ -808,12 +809,12 @@ static int SessionsSetup( demux_t *p_demux )
                     !strcmp( sub->codecName(), "MPA-ROBUST" ) ||
                     !strcmp( sub->codecName(), "X-MP3-DRAFT-00" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'm', 'p', 'g', 'a' );
+                    tk->fmt.i_codec = VLC_CODEC_MPGA;
                     tk->fmt.audio.i_rate = 0;
                 }
                 else if( !strcmp( sub->codecName(), "AC3" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'a', '5', '2', ' ' );
+                    tk->fmt.i_codec = VLC_CODEC_A52;
                     tk->fmt.audio.i_rate = 0;
                 }
                 else if( !strcmp( sub->codecName(), "L16" ) )
@@ -828,15 +829,15 @@ static int SessionsSetup( demux_t *p_demux )
                 }
                 else if( !strcmp( sub->codecName(), "PCMU" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'u', 'l', 'a', 'w' );
+                    tk->fmt.i_codec = VLC_CODEC_MULAW;
                 }
                 else if( !strcmp( sub->codecName(), "PCMA" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'a', 'l', 'a', 'w' );
+                    tk->fmt.i_codec = VLC_CODEC_ALAW;
                 }
                 else if( !strncmp( sub->codecName(), "G726", 4 ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'g', '7', '2', '6' );
+                    tk->fmt.i_codec = VLC_CODEC_ADPCM_G726;
                     tk->fmt.audio.i_rate = 8000;
                     tk->fmt.audio.i_channels = 1;
                     if( !strcmp( sub->codecName()+5, "40" ) )
@@ -850,18 +851,18 @@ static int SessionsSetup( demux_t *p_demux )
                 }
                 else if( !strcmp( sub->codecName(), "AMR" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 's', 'a', 'm', 'r' );
+                    tk->fmt.i_codec = VLC_CODEC_AMR_NB;
                 }
                 else if( !strcmp( sub->codecName(), "AMR-WB" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 's', 'a', 'w', 'b' );
+                    tk->fmt.i_codec = VLC_CODEC_AMR_WB;
                 }
                 else if( !strcmp( sub->codecName(), "MP4A-LATM" ) )
                 {
                     unsigned int i_extra;
                     uint8_t      *p_extra;
 
-                    tk->fmt.i_codec = VLC_FOURCC( 'm', 'p', '4', 'a' );
+                    tk->fmt.i_codec = VLC_CODEC_MP4A;
 
                     if( ( p_extra = parseStreamMuxConfigStr( sub->fmtp_config(),
                                                              i_extra ) ) )
@@ -880,7 +881,7 @@ static int SessionsSetup( demux_t *p_demux )
                     unsigned int i_extra;
                     uint8_t      *p_extra;
 
-                    tk->fmt.i_codec = VLC_FOURCC( 'm', 'p', '4', 'a' );
+                    tk->fmt.i_codec = VLC_CODEC_MP4A;
 
                     if( ( p_extra = parseGeneralConfigStr( sub->fmtp_config(),
                                                            i_extra ) ) )
@@ -920,24 +921,24 @@ static int SessionsSetup( demux_t *p_demux )
                 es_format_Init( &tk->fmt, VIDEO_ES, VLC_FOURCC('u','n','d','f') );
                 if( !strcmp( sub->codecName(), "MPV" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'm', 'p', 'g', 'v' );
+                    tk->fmt.i_codec = VLC_CODEC_MPGV;
                 }
                 else if( !strcmp( sub->codecName(), "H263" ) ||
                          !strcmp( sub->codecName(), "H263-1998" ) ||
                          !strcmp( sub->codecName(), "H263-2000" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'H', '2', '6', '3' );
+                    tk->fmt.i_codec = VLC_CODEC_H263;
                 }
                 else if( !strcmp( sub->codecName(), "H261" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'H', '2', '6', '1' );
+                    tk->fmt.i_codec = VLC_CODEC_H261;
                 }
                 else if( !strcmp( sub->codecName(), "H264" ) )
                 {
                     unsigned int i_extra = 0;
                     uint8_t      *p_extra = NULL;
 
-                    tk->fmt.i_codec = VLC_FOURCC( 'h', '2', '6', '4' );
+                    tk->fmt.i_codec = VLC_CODEC_H264;
                     tk->fmt.b_packetized = false;
 
                     if((p_extra=parseH264ConfigStr( sub->fmtp_spropparametersets(),
@@ -952,14 +953,14 @@ static int SessionsSetup( demux_t *p_demux )
                 }
                 else if( !strcmp( sub->codecName(), "JPEG" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'M', 'J', 'P', 'G' );
+                    tk->fmt.i_codec = VLC_CODEC_MJPG;
                 }
                 else if( !strcmp( sub->codecName(), "MP4V-ES" ) )
                 {
                     unsigned int i_extra;
                     uint8_t      *p_extra;
 
-                    tk->fmt.i_codec = VLC_FOURCC( 'm', 'p', '4', 'v' );
+                    tk->fmt.i_codec = VLC_CODEC_MP4V;
 
                     if( ( p_extra = parseGeneralConfigStr( sub->fmtp_config(),
                                                            i_extra ) ) )
@@ -1347,11 +1348,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 return VLC_EGENERIC;
 
             /* According to RFC 2326 p56 chapter 12.35 a RTSP server that
-             * supports Scale should:
+             * supports Scale:
              *
-             * "The server should try to approximate the viewing rate, but may
-             *  restrict the range of scale values that it supports. The response
-             *  MUST contain the actual scale value chosen by the server."
+             * "[...] should try to approximate the viewing rate, but
+             *  may restrict the range of scale values that it supports.
+             *  The response MUST contain the actual scale value chosen
+             *  by the server."
              *
              * Scale = 1 indicates normal play
              * Scale > 1 indicates fast forward
@@ -1631,8 +1633,8 @@ static void StreamRead( void *p_private, unsigned int i_size,
         msg_Warn( p_demux, "buffer overflow" );
     }
     /* FIXME could i_size be > buffer size ? */
-    if( tk->fmt.i_codec == VLC_FOURCC('s','a','m','r') ||
-        tk->fmt.i_codec == VLC_FOURCC('s','a','w','b') )
+    if( tk->fmt.i_codec == VLC_CODEC_AMR_NB ||
+        tk->fmt.i_codec == VLC_CODEC_AMR_WB )
     {
         AMRAudioSource *amrSource = (AMRAudioSource*)tk->sub->readSource();
 
@@ -1640,7 +1642,7 @@ static void StreamRead( void *p_private, unsigned int i_size,
         p_block->p_buffer[0] = amrSource->lastFrameHeader();
         memcpy( p_block->p_buffer + 1, tk->p_buffer, i_size );
     }
-    else if( tk->fmt.i_codec == VLC_FOURCC('H','2','6','1') )
+    else if( tk->fmt.i_codec == VLC_CODEC_H261 )
     {
         H261VideoRTPSource *h261Source = (H261VideoRTPSource*)tk->sub->rtpSource();
         uint32_t header = h261Source->lastSpecialHeader();
@@ -1651,7 +1653,7 @@ static void StreamRead( void *p_private, unsigned int i_size,
         if( tk->sub->rtpSource()->curPacketMarkerBit() )
             p_block->i_flags |= BLOCK_FLAG_END_OF_FRAME;
     }
-    else if( tk->fmt.i_codec == VLC_FOURCC('h','2','6','4') )
+    else if( tk->fmt.i_codec == VLC_CODEC_H264 )
     {
         if( (tk->p_buffer[0] & 0x1f) >= 24 )
             msg_Warn( p_demux, "unsupported NAL type for H264" );
@@ -1694,7 +1696,7 @@ static void StreamRead( void *p_private, unsigned int i_size,
     if( !tk->b_muxed )
     {
         /*FIXME: for h264 you should check that packetization-mode=1 in sdp-file */
-        p_block->i_dts = ( tk->fmt.i_codec == VLC_FOURCC( 'm', 'p', 'g', 'v' ) ) ? 0 : i_pts;
+        p_block->i_dts = ( tk->fmt.i_codec == VLC_CODEC_MPGV ) ? 0 : i_pts;
     }
 
     if( tk->b_muxed )
@@ -1781,8 +1783,6 @@ static void* TimeoutPrevention( void *p_data )
 /*****************************************************************************
  *
  *****************************************************************************/
-static int b64_decode( char *dest, char *src );
-
 static int ParseASF( demux_t *p_demux )
 {
     demux_sys_t    *p_sys = p_demux->p_sys;
@@ -1811,7 +1811,8 @@ static int ParseASF( demux_t *p_demux )
 
     /* Always smaller */
     p_header = block_New( p_demux, psz_end - psz_asf );
-    p_header->i_buffer = b64_decode( (char*)p_header->p_buffer, psz_asf );
+    p_header->i_buffer = vlc_b64_decode_binary_to_buffer( p_header->p_buffer,
+                                               p_header->i_buffer, psz_asf );
     //msg_Dbg( p_demux, "Size=%d Hdrb64=%s", p_header->i_buffer, psz_asf );
     if( p_header->i_buffer <= 0 )
     {
@@ -1834,9 +1835,8 @@ static unsigned char* parseH264ConfigStr( char const* configStr,
                                           unsigned int& configSize )
 {
     char *dup, *psz;
-    int i, i_records = 1;
+    size_t i_records = 1;
 
-    if( configSize )
     configSize = 0;
 
     if( configStr == NULL || *configStr == '\0' )
@@ -1844,7 +1844,7 @@ static unsigned char* parseH264ConfigStr( char const* configStr,
 
     psz = dup = strdup( configStr );
 
-    /* Count the number of comma's */
+    /* Count the number of commas */
     for( psz = dup; *psz != '\0'; ++psz )
     {
         if( *psz == ',')
@@ -1854,79 +1854,21 @@ static unsigned char* parseH264ConfigStr( char const* configStr,
         }
     }
 
-    unsigned char *cfg = new unsigned char[5 * strlen(dup)];
+    size_t configMax = 5*strlen(dup);
+    unsigned char *cfg = new unsigned char[configMax];
     psz = dup;
-    for( i = 0; i < i_records; i++ )
+    for( size_t i = 0; i < i_records; ++i )
     {
         cfg[configSize++] = 0x00;
         cfg[configSize++] = 0x00;
         cfg[configSize++] = 0x00;
         cfg[configSize++] = 0x01;
 
-        configSize += b64_decode( (char*)&cfg[configSize], psz );
+        configSize += vlc_b64_decode_binary_to_buffer( cfg+configSize,
+                                          configMax-configSize, psz );
         psz += strlen(psz)+1;
     }
 
     free( dup );
     return cfg;
 }
-
-/*char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";*/
-static int b64_decode( char *dest, char *src )
-{
-    const char *dest_start = dest;
-    int  i_level;
-    int  last = 0;
-    int  b64[256] = {
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* 00-0F */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* 10-1F */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,  /* 20-2F */
-        52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,  /* 30-3F */
-        -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,  /* 40-4F */
-        15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,  /* 50-5F */
-        -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,  /* 60-6F */
-        41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1,  /* 70-7F */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* 80-8F */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* 90-9F */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* A0-AF */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* B0-BF */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* C0-CF */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* D0-DF */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,  /* E0-EF */
-        -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1   /* F0-FF */
-        };
-
-    for( i_level = 0; *src != '\0'; src++ )
-    {
-        int  c;
-
-        c = b64[(unsigned int)*src];
-        if( c == -1 )
-        {
-            continue;
-        }
-
-        switch( i_level )
-        {
-            case 0:
-                i_level++;
-                break;
-            case 1:
-                *dest++ = ( last << 2 ) | ( ( c >> 4)&0x03 );
-                i_level++;
-                break;
-            case 2:
-                *dest++ = ( ( last << 4 )&0xf0 ) | ( ( c >> 2 )&0x0f );
-                i_level++;
-                break;
-            case 3:
-                *dest++ = ( ( last &0x03 ) << 6 ) | c;
-                i_level = 0;
-        }
-        last = c;
-    }
-
-    *dest = '\0';
-
-    return dest - dest_start;
-}
index 69d54db80d6fdb36e22bfb185d6186a3f1f8ec68..406ac6e7a3a47775a0295f8227bde62bdf8a332e 100644 (file)
@@ -367,7 +367,7 @@ static int Open( vlc_object_t * p_this )
     }
 
     es_format_Init( &p_sys->fmt, VIDEO_ES, 0 );
-    p_sys->fmt.i_codec = VLC_FOURCC('m','j','p','g');
+    p_sys->fmt.i_codec = VLC_CODEC_MJPG;
 
     p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
     return VLC_SUCCESS;
index c0b25fcd95379c81d506090c1c3ccd40ca402caa..759425e253a0a616b2e401c11010a691a294aab9 100644 (file)
@@ -7,5 +7,6 @@ SOURCES_mkv = mkv.hpp mkv.cpp \
               chapters.hpp chapters.cpp \
               chapter_command.hpp chapter_command.cpp \
               stream_io_callback.hpp stream_io_callback.cpp \
-            ../mp4/libmp4.c ../mp4/drms.c
+              ../mp4/libmp4.c ../mp4/drms.c \
+              ../vobsub.h
 
index 26d43b4bdc91bc2d0ec2060b17cca5e87981e4b3..08846787b7e9965e4f246ee0d229b6e24b11d156 100644 (file)
 
 #include "demux.hpp"
 
+extern "C" {
+#include "../vobsub.h"
+}
+
 /* GetFourCC helper */
 #define GetFOURCC( p )  __GetFOURCC( (uint8_t*)p )
 static vlc_fourcc_t __GetFOURCC( uint8_t *p )
@@ -669,12 +673,12 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
         else if( !strcmp( tracks[i_track]->psz_codec, "V_MPEG1" ) ||
                  !strcmp( tracks[i_track]->psz_codec, "V_MPEG2" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'm', 'p', 'g', 'v' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_MPGV;
         }
         else if( !strncmp( tracks[i_track]->psz_codec, "V_THEORA", 8 ) )
         {
             uint8_t *p_data = tracks[i_track]->p_extra_data;
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 't', 'h', 'e', 'o' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_THEORA;
             if( tracks[i_track]->i_extra_data >= 4 ) {
                 if( p_data[0] == 2 ) {
                     int i = 1;
@@ -744,13 +748,13 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
         else if( !strncmp( tracks[i_track]->psz_codec, "V_REAL/RV", 9 ) )
         {
             if( !strcmp( p_tk->psz_codec, "V_REAL/RV10" ) )
-                p_fmt->i_codec = VLC_FOURCC( 'R', 'V', '1', '0' );
+                p_fmt->i_codec = VLC_CODEC_RV10;
             else if( !strcmp( p_tk->psz_codec, "V_REAL/RV20" ) )
-                p_fmt->i_codec = VLC_FOURCC( 'R', 'V', '2', '0' );
+                p_fmt->i_codec = VLC_CODEC_RV20;
             else if( !strcmp( p_tk->psz_codec, "V_REAL/RV30" ) )
-                p_fmt->i_codec = VLC_FOURCC( 'R', 'V', '3', '0' );
+                p_fmt->i_codec = VLC_CODEC_RV30;
             else if( !strcmp( p_tk->psz_codec, "V_REAL/RV40" ) )
-                p_fmt->i_codec = VLC_FOURCC( 'R', 'V', '4', '0' );
+                p_fmt->i_codec = VLC_CODEC_RV40;
 
             if( p_tk->i_extra_data > 26 )
             {
@@ -765,13 +769,13 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
         }
         else if( !strncmp( tracks[i_track]->psz_codec, "V_DIRAC", 7 ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC('d', 'r', 'a', 'c' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_DIRAC;
         }
         else if( !strncmp( tracks[i_track]->psz_codec, "V_MPEG4", 7 ) )
         {
             if( !strcmp( tracks[i_track]->psz_codec, "V_MPEG4/MS/V3" ) )
             {
-                tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'D', 'I', 'V', '3' );
+                tracks[i_track]->fmt.i_codec = VLC_CODEC_DIV3;
             }
             else if( !strncmp( tracks[i_track]->psz_codec, "V_MPEG4/ISO", 11 ) )
             {
@@ -779,7 +783,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                 if( !strcmp( tracks[i_track]->psz_codec, "V_MPEG4/ISO/AVC" ) )
                     tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'a', 'v', 'c', '1' );
                 else
-                    tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'm', 'p', '4', 'v' );
+                    tracks[i_track]->fmt.i_codec = VLC_CODEC_MP4V;
                 tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
                 tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
                 memcpy( tracks[i_track]->fmt.p_extra,tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
@@ -840,33 +844,33 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                  !strcmp( tracks[i_track]->psz_codec, "A_MPEG/L2" ) ||
                  !strcmp( tracks[i_track]->psz_codec, "A_MPEG/L1" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'm', 'p', 'g', 'a' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_MPGA;
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_AC3" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'a', '5', '2', ' ' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_A52;
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_EAC3" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'e', 'a', 'c', '3' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_EAC3;
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_DTS" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'd', 't', 's', ' ' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_DTS;
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_MLP" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC('m', 'l', 'p', ' ' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_MLP;
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_TRUEHD" ) )
         {
             /* FIXME when more samples arrive */
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC('t', 'r', 'h', 'd' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_TRUEHD;
             p_fmt->b_packetized = false;
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_FLAC" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'f', 'l', 'a', 'c' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_FLAC;
             tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
             tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
             memcpy( tracks[i_track]->fmt.p_extra,tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
@@ -876,7 +880,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
             int i, i_offset = 1, i_size[3], i_extra;
             uint8_t *p_extra;
 
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'v', 'o', 'r', 'b' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_VORBIS;
 
             /* Split the 3 headers */
             if( tracks[i_track]->p_extra_data[0] != 0x02 )
@@ -919,7 +923,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                         16000, 12000, 11025, 8000,  7350,  0,     0,     0
             };
 
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'm', 'p', '4', 'a' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_MP4A;
             /* create data for faad (MP4DecSpecificDescrTag)*/
 
             if( !strcmp( &tracks[i_track]->psz_codec[12], "MAIN" ) )
@@ -971,21 +975,21 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_AAC" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'm', 'p', '4', 'a' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_MP4A;
             tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
             tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
             memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_WAVPACK4" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'W', 'V', 'P', 'K' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_WAVPACK;
             tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
             tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
             memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_TTA1" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'T', 'T', 'A', '1' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_TTA;
             tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
             tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
             memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
@@ -1010,7 +1014,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
             int i, i_offset = 1, i_extra, num_headers, size_so_far;
             uint8_t *p_extra;
 
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'k', 'a', 't', 'e' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_KATE;
             tracks[i_track]->fmt.subs.psz_encoding = strdup( "UTF-8" );
 
             /* Recover the number of headers to expect */
@@ -1057,12 +1061,12 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "S_TEXT/ASCII" ) )
         {
-            p_fmt->i_codec = VLC_FOURCC( 's', 'u', 'b', 't' );
+            p_fmt->i_codec = VLC_CODEC_SUBT;
             p_fmt->subs.psz_encoding = NULL; /* Is there a place where it is stored ? */
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "S_TEXT/UTF8" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 's', 'u', 'b', 't' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_SUBT;
             tracks[i_track]->fmt.subs.psz_encoding = strdup( "UTF-8" );
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "S_TEXT/USF" ) )
@@ -1081,7 +1085,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                  !strcmp( tracks[i_track]->psz_codec, "S_SSA" ) ||
                  !strcmp( tracks[i_track]->psz_codec, "S_ASS" ))
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 's', 's', 'a', ' ' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_SSA;
             tracks[i_track]->fmt.subs.psz_encoding = strdup( "UTF-8" );
             if( tracks[i_track]->i_extra_data )
             {
@@ -1092,25 +1096,44 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "S_VOBSUB" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 's','p','u',' ' );
+            tracks[i_track]->fmt.i_codec = VLC_CODEC_SPU;
             if( tracks[i_track]->i_extra_data )
             {
-                char *p_start;
-                char *p_buf = (char *)malloc( tracks[i_track]->i_extra_data + 1);
-                memcpy( p_buf, tracks[i_track]->p_extra_data , tracks[i_track]->i_extra_data );
-                p_buf[tracks[i_track]->i_extra_data] = '\0';
-                p_start = strstr( p_buf, "size:" );
-                if( sscanf( p_start, "size: %dx%d",
-                        &tracks[i_track]->fmt.subs.spu.i_original_frame_width, &tracks[i_track]->fmt.subs.spu.i_original_frame_height ) == 2 )
+                char *psz_start;
+                char *psz_buf = (char *)malloc( tracks[i_track]->i_extra_data + 1);
+                if( psz_buf != NULL )
                 {
-                    msg_Dbg( &sys.demuxer, "original frame size vobsubs: %dx%d", tracks[i_track]->fmt.subs.spu.i_original_frame_width, tracks[i_track]->fmt.subs.spu.i_original_frame_height );
-                }
-                else
-                {
-                    msg_Warn( &sys.demuxer, "reading original frame size for vobsub failed" );
+                    memcpy( psz_buf, tracks[i_track]->p_extra_data , tracks[i_track]->i_extra_data );
+                    psz_buf[tracks[i_track]->i_extra_data] = '\0';
+
+                    psz_start = strstr( psz_buf, "size:" );
+                    if( psz_start &&
+                        vobsub_size_parse( psz_start,
+                                           &tracks[i_track]->fmt.subs.spu.i_original_frame_width,
+                                           &tracks[i_track]->fmt.subs.spu.i_original_frame_height ) == VLC_SUCCESS )
+                    {
+                        msg_Dbg( &sys.demuxer, "original frame size vobsubs: %dx%d",
+                                 tracks[i_track]->fmt.subs.spu.i_original_frame_width,
+                                 tracks[i_track]->fmt.subs.spu.i_original_frame_height );
+                    }
+                    else
+                    {
+                        msg_Warn( &sys.demuxer, "reading original frame size for vobsub failed" );
+                    }
+
+                    psz_start = strstr( psz_buf, "palette:" );
+                    if( psz_start &&
+                        vobsub_palette_parse( psz_start, &tracks[i_track]->fmt.subs.spu.palette[1] ) == VLC_SUCCESS )
+                    {
+                        tracks[i_track]->fmt.subs.spu.palette[0] =  0xBeef;
+                        msg_Dbg( &sys.demuxer, "vobsub palette read" );
+                    }
+                    else
+                    {
+                        msg_Warn( &sys.demuxer, "reading original palette failed" );
+                    }
+                    free( psz_buf );
                 }
-                free( p_buf );
             }
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "B_VOBBTN" ) )
@@ -1120,7 +1143,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
         }
         else if( !strcmp( p_tk->psz_codec, "A_REAL/14_4" ) )
         {
-            p_fmt->i_codec = VLC_FOURCC( '1', '4', '_', '4');
+            p_fmt->i_codec = VLC_CODEC_RA_144;
             p_fmt->audio.i_channels = 1;
             p_fmt->audio.i_rate = 8000;
             p_fmt->audio.i_blockalign = 0x14;
index b02e4cdf51610470676a4a793e07d4d6edc8ab15..a1aff2d97c543ac1b98758d4281407a47ed8ae30 100644 (file)
@@ -150,12 +150,12 @@ static int Open( vlc_object_t * p_this )
 
     /* */
 #ifndef MPC_FIXED_POINT
-    es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'f', 'l', '3', '2' ) );
+    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_FL32 );
 #else
 #   ifdef WORDS_BIGENDIAN
-    es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 's', '3', '2', 'b' ) );
+    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S32B );
 #   else
-    es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 's', '3', '2', 'l' ) );
+    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S32L );
 #   endif
 #endif
     fmt.audio.i_channels = p_sys->info.channels;
index abe04dcbc50deeeb61e3636fc071a07b10b54acc..3a23281fd6eee8a78373cea52915af752d857438 100644 (file)
@@ -133,12 +133,12 @@ static int MlpProbe( demux_t *p_demux, int64_t *pi_offset );
 static int MlpInit( demux_t *p_demux );
 
 static const codec_t p_codec[] = {
-    { VLC_FOURCC( 'm', 'p', '4', 'a' ), false, "mp4 audio",  AacProbe,  AacInit },
-    { VLC_FOURCC( 'm', 'p', 'g', 'a' ), false, "mpeg audio", MpgaProbe, MpgaInit },
-    { VLC_FOURCC( 'a', '5', '2', ' ' ), true,  "a52 audio",  A52Probe,  A52Init },
-    { VLC_FOURCC( 'e', 'a', 'c', '3' ), true,  "eac3 audio", EA52Probe, A52Init },
-    { VLC_FOURCC( 'd', 't', 's', ' ' ), false, "dts audio",  DtsProbe,  DtsInit },
-    { VLC_FOURCC( 'm', 'l', 'p', ' ' ), false, "mlp audio",  MlpProbe,  MlpInit },
+    { VLC_CODEC_MP4A, false, "mp4 audio",  AacProbe,  AacInit },
+    { VLC_CODEC_MPGA, false, "mpeg audio", MpgaProbe, MpgaInit },
+    { VLC_CODEC_A52, true,  "a52 audio",  A52Probe,  A52Init },
+    { VLC_CODEC_EAC3, true,  "eac3 audio", EA52Probe, A52Init },
+    { VLC_CODEC_DTS, false, "dts audio",  DtsProbe,  DtsInit },
+    { VLC_CODEC_MLP, false, "mlp audio",  MlpProbe,  MlpInit },
 
     { 0, false, NULL, NULL, NULL }
 };
index 5f6071c48220737855b4e7753ada1e7e945100f3..1bcf6f06c8a38c555d296c2fa32e9c934f297d9a 100644 (file)
@@ -109,7 +109,7 @@ static int Open( vlc_object_t * p_this )
     msg_Dbg( p_demux, "using %.2f fps", p_sys->f_fps );
 
     /* Load the mpegvideo packetizer */
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( 'h', '2', '6', '4' ) );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_H264 );
     p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "h264" );
     if( !p_sys->p_packetizer )
     {
index 946739aa3c07e190e96ea08907b8bfc08122d6c5..e9cbd8e35653114ca1ea468e63125ee47b34cd08 100644 (file)
@@ -108,7 +108,7 @@ static int Open( vlc_object_t * p_this )
     p_sys->p_es        = NULL;
 
     /* Load the mpegvideo packetizer */
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', 'g', 'v' ) );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_MPGV );
     p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "mpeg video" );
     if( !p_sys->p_packetizer )
     {
@@ -117,7 +117,7 @@ static int Open( vlc_object_t * p_this )
     }
 
     /* create the output */
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', 'g', 'v' ) );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_MPGV );
     p_sys->p_es = es_out_Add( p_demux->out, &fmt );
 
     return VLC_SUCCESS;
index c6a87b45ac6fea1580c9cd0af234c289b0c37bc9..99cad8397b69466a98a7938d6183bfb6f7902576 100644 (file)
@@ -314,7 +314,7 @@ static int Open( vlc_object_t * p_this )
     {
         es_format_t fmt;
 
-        es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC('m','p','g','a') );
+        es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_MPGA );
         fmt.audio.i_rate = p_sys->exh.i_audio_sample_rate;
         fmt.audio.i_bitspersample = p_sys->exh.i_audio_bits_per_sample;
 
index 2580c6aba6ac416986d965305ac8f06688da223e..5e50b7a55297a0b22759b5335d9d941525a1c237 100644 (file)
@@ -360,21 +360,21 @@ static int Demux( demux_t * p_demux )
             /* Read info from any secondary header packets, if there are any */
             if( p_stream->i_secondary_header_packets > 0 )
             {
-                if( p_stream->fmt.i_codec == VLC_FOURCC('t','h','e','o') &&
+                if( p_stream->fmt.i_codec == VLC_CODEC_THEORA &&
                         oggpacket.bytes >= 7 &&
                         ! memcmp( oggpacket.packet, "\x80theora", 7 ) )
                 {
                     Ogg_ReadTheoraHeader( p_stream, &oggpacket );
                     p_stream->i_secondary_header_packets = 0;
                 }
-                else if( p_stream->fmt.i_codec == VLC_FOURCC('v','o','r','b') &&
+                else if( p_stream->fmt.i_codec == VLC_CODEC_VORBIS &&
                         oggpacket.bytes >= 7 &&
                         ! memcmp( oggpacket.packet, "\x01vorbis", 7 ) )
                 {
                     Ogg_ReadVorbisHeader( p_stream, &oggpacket );
                     p_stream->i_secondary_header_packets = 0;
                 }
-                else if( p_stream->fmt.i_codec == VLC_FOURCC('c','m','m','l') )
+                else if( p_stream->fmt.i_codec == VLC_CODEC_CMML )
                 {
                     p_stream->i_secondary_header_packets = 0;
                 }
@@ -397,9 +397,9 @@ static int Demux( demux_t * p_demux )
                 }
 
                 /* An Ogg/vorbis packet contains an end date granulepos */
-                if( p_stream->fmt.i_codec == VLC_FOURCC( 'v','o','r','b' ) ||
-                    p_stream->fmt.i_codec == VLC_FOURCC( 's','p','x',' ' ) ||
-                    p_stream->fmt.i_codec == VLC_FOURCC( 'f','l','a','c' ) )
+                if( p_stream->fmt.i_codec == VLC_CODEC_VORBIS ||
+                    p_stream->fmt.i_codec == VLC_CODEC_SPEEX ||
+                    p_stream->fmt.i_codec == VLC_CODEC_FLAC )
                 {
                     if( ogg_stream_packetout( &p_stream->os, &oggpacket ) > 0 )
                     {
@@ -541,8 +541,8 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream,
     /* Convert the granulepos into a pcr */
     if( p_oggpacket->granulepos >= 0 )
     {
-        if( p_stream->fmt.i_codec == VLC_FOURCC( 't','h','e','o' ) ||
-            p_stream->fmt.i_codec == VLC_FOURCC( 'k','a','t','e' ) )
+        if( p_stream->fmt.i_codec == VLC_CODEC_THEORA ||
+            p_stream->fmt.i_codec == VLC_CODEC_KATE )
         {
             ogg_int64_t iframe = p_oggpacket->granulepos >>
               p_stream->i_granule_shift;
@@ -552,7 +552,7 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream,
             p_stream->i_pcr = ( iframe + pframe ) * INT64_C(1000000)
                               / p_stream->f_rate;
         }
-        else if( p_stream->fmt.i_codec == VLC_FOURCC( 'd','r','a','c' ) )
+        else if( p_stream->fmt.i_codec == VLC_CODEC_DIRAC )
         {
             ogg_int64_t i_dts = p_oggpacket->granulepos >> 31;
             /* NB, OggDirac granulepos values are in units of 2*picturerate */
@@ -616,7 +616,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         return;
     }
 
-    if( p_stream->fmt.i_codec == VLC_FOURCC( 's','u','b','t' ) &&
+    if( p_stream->fmt.i_codec == VLC_CODEC_SUBT &&
         p_oggpacket->packet[0] & PACKET_TYPE_BITS ) return;
 
     /* Check the ES is selected */
@@ -632,13 +632,13 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         p_stream->i_packets_backup++;
         switch( p_stream->fmt.i_codec )
         {
-        case VLC_FOURCC( 'v','o','r','b' ):
-        case VLC_FOURCC( 's','p','x',' ' ):
-        case VLC_FOURCC( 't','h','e','o' ):
+        case VLC_CODEC_VORBIS:
+        case VLC_CODEC_SPEEX:
+        case VLC_CODEC_THEORA:
             if( p_stream->i_packets_backup == 3 ) p_stream->b_force_backup = 0;
             break;
 
-        case VLC_FOURCC( 'f','l','a','c' ):
+        case VLC_CODEC_FLAC:
             if( !p_stream->fmt.audio.i_rate && p_stream->i_packets_backup == 2 )
             {
                 Ogg_ReadFlacHeader( p_demux, p_stream, p_oggpacket );
@@ -656,7 +656,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
             b_store_size = false;
             break;
 
-        case VLC_FOURCC( 'k','a','t','e' ):
+        case VLC_CODEC_KATE:
             if( p_stream->i_packets_backup == 1)
                 b_store_num_headers = true;
             if( p_stream->i_packets_backup == p_stream->i_kate_num_headers ) p_stream->b_force_backup = 0;
@@ -723,9 +723,9 @@ static void Ogg_DecodePacket( demux_t *p_demux,
     }
 
     /* Convert the pcr into a pts */
-    if( p_stream->fmt.i_codec == VLC_FOURCC( 'v','o','r','b' ) ||
-        p_stream->fmt.i_codec == VLC_FOURCC( 's','p','x',' ' ) ||
-        p_stream->fmt.i_codec == VLC_FOURCC( 'f','l','a','c' ) )
+    if( p_stream->fmt.i_codec == VLC_CODEC_VORBIS ||
+        p_stream->fmt.i_codec == VLC_CODEC_SPEEX ||
+        p_stream->fmt.i_codec == VLC_CODEC_FLAC )
     {
         if( p_stream->i_pcr >= 0 )
         {
@@ -770,9 +770,9 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         }
     }
 
-    if( p_stream->fmt.i_codec != VLC_FOURCC( 'v','o','r','b' ) &&
-        p_stream->fmt.i_codec != VLC_FOURCC( 's','p','x',' ' ) &&
-        p_stream->fmt.i_codec != VLC_FOURCC( 'f','l','a','c' ) &&
+    if( p_stream->fmt.i_codec != VLC_CODEC_VORBIS &&
+        p_stream->fmt.i_codec != VLC_CODEC_SPEEX &&
+        p_stream->fmt.i_codec != VLC_CODEC_FLAC &&
         p_stream->i_pcr >= 0 )
     {
         p_stream->i_previous_pcr = p_stream->i_pcr;
@@ -805,9 +805,9 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         p_block->i_dts = p_block->i_pts = i_pts;
         p_block->i_length = 0;
     }
-    else if( p_stream->fmt.i_codec == VLC_FOURCC( 't','h','e','o' ) )
+    else if( p_stream->fmt.i_codec == VLC_CODEC_THEORA )
         p_block->i_dts = p_block->i_pts = i_pts;
-    else if( p_stream->fmt.i_codec == VLC_FOURCC( 'd','r','a','c' ) )
+    else if( p_stream->fmt.i_codec == VLC_CODEC_DIRAC )
     {
         ogg_int64_t dts = p_oggpacket->granulepos >> 31;
         ogg_int64_t delay = (p_oggpacket->granulepos >> 9) & 0x1fff;
@@ -826,20 +826,20 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         p_block->i_pts = 0;
     }
 
-    if( p_stream->fmt.i_codec != VLC_FOURCC( 'v','o','r','b' ) &&
-        p_stream->fmt.i_codec != VLC_FOURCC( 's','p','x',' ' ) &&
-        p_stream->fmt.i_codec != VLC_FOURCC( 'f','l','a','c' ) &&
-        p_stream->fmt.i_codec != VLC_FOURCC( 't','a','r','k' ) &&
-        p_stream->fmt.i_codec != VLC_FOURCC( 't','h','e','o' ) &&
-        p_stream->fmt.i_codec != VLC_FOURCC( 'c','m','m','l' ) &&
-        p_stream->fmt.i_codec != VLC_FOURCC( 'd','r','a','c' ) &&
-        p_stream->fmt.i_codec != VLC_FOURCC( 'k','a','t','e' ) )
+    if( p_stream->fmt.i_codec != VLC_CODEC_VORBIS &&
+        p_stream->fmt.i_codec != VLC_CODEC_SPEEX &&
+        p_stream->fmt.i_codec != VLC_CODEC_FLAC &&
+        p_stream->fmt.i_codec != VLC_CODEC_TARKIN &&
+        p_stream->fmt.i_codec != VLC_CODEC_THEORA &&
+        p_stream->fmt.i_codec != VLC_CODEC_CMML &&
+        p_stream->fmt.i_codec != VLC_CODEC_DIRAC &&
+        p_stream->fmt.i_codec != VLC_CODEC_KATE )
     {
         /* We remove the header from the packet */
         i_header_len = (*p_oggpacket->packet & PACKET_LEN_BITS01) >> 6;
         i_header_len |= (*p_oggpacket->packet & PACKET_LEN_BITS2) << 1;
 
-        if( p_stream->fmt.i_codec == VLC_FOURCC( 's','u','b','t' ))
+        if( p_stream->fmt.i_codec == VLC_CODEC_SUBT)
         {
             /* But with subtitles we need to retrieve the duration first */
             int i, lenbytes = 0;
@@ -869,7 +869,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
             p_block->i_buffer = 0;
     }
 
-    if( p_stream->fmt.i_codec == VLC_FOURCC( 't','a','r','k' ) )
+    if( p_stream->fmt.i_codec == VLC_CODEC_TARKIN )
     {
         /* FIXME: the biggest hack I've ever done */
         msg_Warn( p_demux, "tarkin pts: %"PRId64", granule: %"PRId64,
@@ -970,7 +970,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                     p_stream->b_force_backup = 1;
 
                     p_stream->fmt.i_cat = AUDIO_ES;
-                    p_stream->fmt.i_codec = VLC_FOURCC( 'f','l','a','c' );
+                    p_stream->fmt.i_codec = VLC_CODEC_FLAC;
                 }
                 /* Check for Flac header (>= version 1.1.1) */
                 else if( oggpacket.bytes >= 13 && oggpacket.packet[0] ==0x7F &&
@@ -987,7 +987,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                     p_stream->b_force_backup = 1;
 
                     p_stream->fmt.i_cat = AUDIO_ES;
-                    p_stream->fmt.i_codec = VLC_FOURCC( 'f','l','a','c' );
+                    p_stream->fmt.i_codec = VLC_CODEC_FLAC;
                     oggpacket.packet += 13; oggpacket.bytes -= 13;
                     Ogg_ReadFlacHeader( p_demux, p_stream, &oggpacket );
                 }
@@ -1022,7 +1022,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
 
                     msg_Dbg( p_demux, "found tarkin header" );
                     p_stream->fmt.i_cat = VIDEO_ES;
-                    p_stream->fmt.i_codec = VLC_FOURCC( 't','a','r','k' );
+                    p_stream->fmt.i_codec = VLC_CODEC_TARKIN;
 
                     /* Cheat and get additionnal info ;) */
                     oggpack_readinit( &opb, oggpacket.packet, oggpacket.bytes);
@@ -1280,7 +1280,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
 
                         msg_Dbg( p_demux, "found text subtitles header" );
                         p_stream->fmt.i_cat = SPU_ES;
-                        p_stream->fmt.i_codec = VLC_FOURCC('s','u','b','t');
+                        p_stream->fmt.i_codec = VLC_CODEC_SUBT;
                         p_stream->f_rate = 1000; /* granulepos is in millisec */
                     }
                     else
@@ -1385,15 +1385,15 @@ static int Ogg_BeginningOfStream( demux_t *p_demux )
         if( !p_stream->p_es )
         {
             /* Better be safe than sorry when possible with ogm */
-            if( p_stream->fmt.i_codec == VLC_FOURCC( 'm', 'p', 'g', 'a' ) ||
-                p_stream->fmt.i_codec == VLC_FOURCC( 'a', '5', '2', ' ' ) )
+            if( p_stream->fmt.i_codec == VLC_CODEC_MPGA ||
+                p_stream->fmt.i_codec == VLC_CODEC_A52 )
                 p_stream->fmt.b_packetized = false;
 
             p_stream->p_es = es_out_Add( p_demux->out, &p_stream->fmt );
         }
 
         // TODO: something to do here ?
-        if( p_stream->fmt.i_codec == VLC_FOURCC('c','m','m','l') )
+        if( p_stream->fmt.i_codec == VLC_CODEC_CMML )
         {
             /* Set the CMML stream active */
             es_out_Control( p_demux->out, ES_OUT_SET_ES, p_stream->p_es );
@@ -1496,7 +1496,7 @@ static bool Ogg_LogicalStreamResetEsFormat( demux_t *p_demux, logical_stream_t *
         return true;
 
     /* Only vorbis is supported */
-    if( p_stream->fmt.i_codec == VLC_FOURCC( 'v','o','r','b' ) )
+    if( p_stream->fmt.i_codec == VLC_CODEC_VORBIS )
         b_compatible = Ogg_IsVorbisFormatCompatible( &p_stream->fmt, &p_stream->fmt_old );
 
     if( !b_compatible )
@@ -1550,30 +1550,30 @@ static void Ogg_ExtractMeta( demux_t *p_demux, vlc_fourcc_t i_codec, const uint8
     switch( i_codec )
     {
     /* 3 headers with the 2° one being the comments */
-    case VLC_FOURCC( 'v','o','r','b' ):
+    case VLC_CODEC_VORBIS:
         Ogg_ExtractXiphMeta( p_demux, p_headers, i_headers, 1+6, false );
         break;
-    case VLC_FOURCC( 't','h','e','o' ):
+    case VLC_CODEC_THEORA:
         Ogg_ExtractXiphMeta( p_demux, p_headers, i_headers, 1+6, false );
         break;
-    case VLC_FOURCC( 's','p','x',' ' ):
+    case VLC_CODEC_SPEEX:
         Ogg_ExtractXiphMeta( p_demux, p_headers, i_headers, 0, false );
         break;
 
     /* N headers with the 2° one being the comments */
-    case VLC_FOURCC( 'k','a','t','e' ):
+    case VLC_CODEC_KATE:
         /* 1 byte for header type, 7 bit for magic, 1 reserved zero byte */
         Ogg_ExtractXiphMeta( p_demux, p_headers, i_headers, 1+7+1, true );
         break;
 
     /* TODO */
-    case VLC_FOURCC( 'f','l','a','c' ):
+    case VLC_CODEC_FLAC:
         msg_Warn( p_demux, "Ogg_ExtractMeta does not support %4.4s", (const char*)&i_codec );
         break;
 
     /* No meta data */
-    case VLC_FOURCC( 'c','m','m','l' ): /* CMML is XML text, doesn't have Vorbis comments */
-    case VLC_FOURCC( 'd','r','a','c' ):
+    case VLC_CODEC_CMML: /* CMML is XML text, doesn't have Vorbis comments */
+    case VLC_CODEC_DIRAC:
     default:
         break;
     }
@@ -1590,7 +1590,7 @@ static void Ogg_ReadTheoraHeader( logical_stream_t *p_stream,
     int i_keyframe_frequency_force;
 
     p_stream->fmt.i_cat = VIDEO_ES;
-    p_stream->fmt.i_codec = VLC_FOURCC( 't','h','e','o' );
+    p_stream->fmt.i_codec = VLC_CODEC_THEORA;
 
     /* Signal that we want to keep a backup of the theora
      * stream headers. They will be used when switching between
@@ -1642,7 +1642,7 @@ static void Ogg_ReadVorbisHeader( logical_stream_t *p_stream,
     oggpack_buffer opb;
 
     p_stream->fmt.i_cat = AUDIO_ES;
-    p_stream->fmt.i_codec = VLC_FOURCC( 'v','o','r','b' );
+    p_stream->fmt.i_codec = VLC_CODEC_VORBIS;
 
     /* Signal that we want to keep a backup of the vorbis
      * stream headers. They will be used when switching between
@@ -1665,7 +1665,7 @@ static void Ogg_ReadSpeexHeader( logical_stream_t *p_stream,
     oggpack_buffer opb;
 
     p_stream->fmt.i_cat = AUDIO_ES;
-    p_stream->fmt.i_codec = VLC_FOURCC( 's','p','x',' ' );
+    p_stream->fmt.i_codec = VLC_CODEC_SPEEX;
 
     /* Signal that we want to keep a backup of the speex
      * stream headers. They will be used when switching between
@@ -1729,7 +1729,7 @@ static void Ogg_ReadKateHeader( logical_stream_t *p_stream,
     char *psz_desc;
 
     p_stream->fmt.i_cat = SPU_ES;
-    p_stream->fmt.i_codec = VLC_FOURCC( 'k','a','t','e' );
+    p_stream->fmt.i_codec = VLC_CODEC_KATE;
 
     /* Signal that we want to keep a backup of the kate
      * stream headers. They will be used when switching between
@@ -1848,21 +1848,21 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *p_this,
         else if( !strncmp(content_type_string, "audio/x-vorbis", 14) )
         {
             p_stream->fmt.i_cat = AUDIO_ES;
-            p_stream->fmt.i_codec = VLC_FOURCC( 'v','o','r','b' );
+            p_stream->fmt.i_codec = VLC_CODEC_VORBIS;
 
             p_stream->b_force_backup = 1;
         }
         else if( !strncmp(content_type_string, "audio/x-speex", 14) )
         {
             p_stream->fmt.i_cat = AUDIO_ES;
-            p_stream->fmt.i_codec = VLC_FOURCC( 's','p','x',' ' );
+            p_stream->fmt.i_codec = VLC_CODEC_SPEEX;
 
             p_stream->b_force_backup = 1;
         }
         else if( !strncmp(content_type_string, "video/x-theora", 14) )
         {
             p_stream->fmt.i_cat = VIDEO_ES;
-            p_stream->fmt.i_codec = VLC_FOURCC( 't','h','e','o' );
+            p_stream->fmt.i_codec = VLC_CODEC_THEORA;
 
             p_stream->b_force_backup = 1;
         }
@@ -1877,13 +1877,13 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *p_this,
         {
             /* n.b. MPEG streams are unsupported right now */
             p_stream->fmt.i_cat = VIDEO_ES;
-            p_stream->fmt.i_codec = VLC_FOURCC( 'm','p','g','v' );
+            p_stream->fmt.i_codec = VLC_CODEC_MPGV;
         }
         else if( !strncmp(content_type_string, "text/x-cmml", 11) )
         {
             ogg_stream_packetout( &p_stream->os, p_oggpacket );
             p_stream->fmt.i_cat = SPU_ES;
-            p_stream->fmt.i_codec = VLC_FOURCC( 'c','m','m','l' );
+            p_stream->fmt.i_codec = VLC_CODEC_CMML;
         }
     }
 }
@@ -1985,7 +1985,7 @@ static bool Ogg_ReadDiracHeader( logical_stream_t *p_stream,
 
     /* probably is an ogg dirac es */
     p_stream->fmt.i_cat = VIDEO_ES;
-    p_stream->fmt.i_codec = VLC_FOURCC( 'd','r','a','c' );
+    p_stream->fmt.i_codec = VLC_CODEC_DIRAC;
 
     return true;
 }
index aad1e52971ad3b4434e0e235c17e253bbecb17c4..66b289219b11add189904f99c6a3ebcdbe03b505 100644 (file)
@@ -388,7 +388,7 @@ static int Demux( demux_t *p_demux )
             if( tk->b_seen && tk->es &&
                 (
 #ifdef ZVBI_COMPILED /* FIXME!! */
-                tk->fmt.i_codec == VLC_FOURCC('t','e','l','x') ||
+                tk->fmt.i_codec == VLC_CODEC_TELETEXT ||
 #endif
                 !ps_pkt_parse_pes( p_pkt, tk->i_skip ) ) )
             {
index fed3ab0ac93a33ed4380d333ce14ca16136df08a..d0b4cc4a02d00a8c7be3e816f0dabc0396594f0d 100644 (file)
@@ -70,28 +70,28 @@ static inline int ps_track_fill( ps_track_t *tk, ps_psm_t *p_psm, int i_id )
     {
         if( ( i_id&0xf8 ) == 0x88 || (i_id&0xf8) == 0x98 )
         {
-            es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('d','t','s',' ') );
+            es_format_Init( &tk->fmt, AUDIO_ES, VLC_CODEC_DTS );
             tk->i_skip = 4;
         }
         else if( ( i_id&0xf0 ) == 0x80
                ||  (i_id&0xf0) == 0xc0 ) /* AC-3, Can also be used for DD+/E-AC-3 */
         {
-            es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('a','5','2',' ') );
+            es_format_Init( &tk->fmt, AUDIO_ES, VLC_CODEC_A52 );
             tk->i_skip = 4;
         }
         else if( (i_id&0xf0) == 0xb0 )
         {
-            es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('m','l','p',' ') );
+            es_format_Init( &tk->fmt, AUDIO_ES, VLC_CODEC_MLP );
             /* FIXME / untested ... no known decoder (at least not in VLC/ffmpeg) */
         }
         else if( ( i_id&0xe0 ) == 0x20 )
         {
-            es_format_Init( &tk->fmt, SPU_ES, VLC_FOURCC('s','p','u',' ') );
+            es_format_Init( &tk->fmt, SPU_ES, VLC_CODEC_SPU );
             tk->i_skip = 1;
         }
         else if( ( i_id&0xf0 ) == 0xa0 )
         {
-            es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('l','p','c','m') );
+            es_format_Init( &tk->fmt, AUDIO_ES, VLC_CODEC_DVD_LPCM );
             tk->i_skip = 1;
         }
         else if( ( i_id&0xff ) == 0x70 )
@@ -104,7 +104,7 @@ static inline int ps_track_fill( ps_track_t *tk, ps_psm_t *p_psm, int i_id )
         }
         else if( ( i_id&0xff ) == 0x10 )
         {
-            es_format_Init( &tk->fmt, SPU_ES, VLC_FOURCC('t','e','l','x') );
+            es_format_Init( &tk->fmt, SPU_ES, VLC_CODEC_TELETEXT );
         }
         else
         {
@@ -117,7 +117,7 @@ static inline int ps_track_fill( ps_track_t *tk, ps_psm_t *p_psm, int i_id )
         uint8_t i_sub_id = i_id & 0xff;
         if( i_sub_id >= 0x55 && i_sub_id <= 0x5f )
         {
-            es_format_Init( &tk->fmt, VIDEO_ES, VLC_FOURCC('W','V','C','1') );
+            es_format_Init( &tk->fmt, VIDEO_ES, VLC_CODEC_VC1 );
         }
         else
         {
@@ -133,36 +133,36 @@ static inline int ps_track_fill( ps_track_t *tk, ps_psm_t *p_psm, int i_id )
 
         if( (i_id&0xf0) == 0xe0 && i_type == 0x1b )
         {
-            es_format_Init( &tk->fmt, VIDEO_ES, VLC_FOURCC('h','2','6','4') );
+            es_format_Init( &tk->fmt, VIDEO_ES, VLC_CODEC_H264 );
         }
         else if( (i_id&0xf0) == 0xe0 && i_type == 0x10 )
         {
-            es_format_Init( &tk->fmt, VIDEO_ES, VLC_FOURCC('m','p','4','v') );
+            es_format_Init( &tk->fmt, VIDEO_ES, VLC_CODEC_MP4V );
         }
         else if( (i_id&0xf0) == 0xe0 && i_type == 0x02 )
         {
-            es_format_Init( &tk->fmt, VIDEO_ES, VLC_FOURCC('m','p','g','v') );
+            es_format_Init( &tk->fmt, VIDEO_ES, VLC_CODEC_MPGV );
         }
         else if( ( i_id&0xe0 ) == 0xc0 && i_type == 0x0f )
         {
-            es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('m','p','4','a') );
+            es_format_Init( &tk->fmt, AUDIO_ES, VLC_CODEC_MP4A );
         }
         else if( ( i_id&0xe0 ) == 0xc0 && i_type == 0x11 )
         {
-            es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('m','p','4','a') );
+            es_format_Init( &tk->fmt, AUDIO_ES, VLC_CODEC_MP4A );
         }
         else if( ( i_id&0xe0 ) == 0xc0 && i_type == 0x03 )
         {
-            es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('m','p','g','a') );
+            es_format_Init( &tk->fmt, AUDIO_ES, VLC_CODEC_MPGA );
         }
 
         if( tk->fmt.i_cat == UNKNOWN_ES && ( i_id&0xf0 ) == 0xe0 )
         {
-            es_format_Init( &tk->fmt, VIDEO_ES, VLC_FOURCC('m','p','g','v') );
+            es_format_Init( &tk->fmt, VIDEO_ES, VLC_CODEC_MPGV );
         }
         else if( tk->fmt.i_cat == UNKNOWN_ES && ( i_id&0xe0 ) == 0xc0 )
         {
-            es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('m','p','g','a') );
+            es_format_Init( &tk->fmt, AUDIO_ES, VLC_CODEC_MPGA );
         }
         else if( tk->fmt.i_cat == UNKNOWN_ES ) return VLC_EGENERIC;
     }
index 68093d98df0e8ab65dd9887d1874c48d29ef2f02..d5ceafb6b9e1cb1e787231aace003026993154ef 100644 (file)
@@ -98,10 +98,10 @@ static int Open( vlc_object_t *p_this )
     p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
 
     /* Register one audio and one video stream */
-    es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'm', 'p', 'g', 'a' ) );
+    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_MPGA );
     p_sys->p_audio = es_out_Add( p_demux->out, &fmt );
 
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', 'g', 'v' ) );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_MPGV );
     p_sys->p_video = es_out_Add( p_demux->out, &fmt );
 
     p_sys->i_vc    = -1;
index c3ff27bc71c987865535e745f0b05e81afe36f91..2f2bb11c889214e30e1f7921c94b9547c9afcbfe 100644 (file)
@@ -113,49 +113,43 @@ static int Open( vlc_object_t * p_this )
     es_format_Init( &p_sys->fmt, AUDIO_ES, 0 );
 
     char *psz_fourcc = var_CreateGetString( p_demux, "rawaud-fourcc" );
+    p_sys->fmt.i_codec = vlc_fourcc_GetCodecFromString( AUDIO_ES, psz_fourcc );
+    free( psz_fourcc );
 
-    if( ( psz_fourcc == NULL ?  0 : strlen( psz_fourcc ) ) != 4  )
+    if( !p_sys->fmt.i_codec )
     {
         msg_Err( p_demux, "rawaud-fourcc must be a 4 character string");
-        free( psz_fourcc );
         es_format_Clean( &p_sys->fmt );
         free( p_sys );
         return VLC_EGENERIC;
     }
 
-    p_sys->fmt.i_codec = VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
-                                     psz_fourcc[2], psz_fourcc[3] );
-
-    free( psz_fourcc );
     // get the bits per sample ratio based on codec
     switch( p_sys->fmt.i_codec )
     {
 
-        case VLC_FOURCC( 'f', 'l', '6', '4' ):
+        case VLC_CODEC_FL64:
             p_sys->fmt.audio.i_bitspersample = 64;
             break;
 
-        case VLC_FOURCC( 'f', 'l', '3', '2' ):
-        case VLC_FOURCC( 's', '3', '2', 'l' ):
-        case VLC_FOURCC( 's', '3', '2', 'b' ):
-        case VLC_FOURCC( 'i', 'n', '3', '2' ):
+        case VLC_CODEC_FL32:
+        case VLC_CODEC_S32L:
+        case VLC_CODEC_S32B:
             p_sys->fmt.audio.i_bitspersample = 32;
             break;
 
-        case VLC_FOURCC( 's', '2', '4', 'l' ):
-        case VLC_FOURCC( 's', '2', '4', 'b' ):
-        case VLC_FOURCC( 'i', 'n', '2', '4' ):
-        case VLC_FOURCC( '4', '2', 'n', 'i' ):
+        case VLC_CODEC_S24L:
+        case VLC_CODEC_S24B:
             p_sys->fmt.audio.i_bitspersample = 24;
             break;
 
-        case VLC_FOURCC( 's', '1', '6', 'l' ):
-        case VLC_FOURCC( 's', '1', '6', 'b' ):
+        case VLC_CODEC_S16L:
+        case VLC_CODEC_S16B:
             p_sys->fmt.audio.i_bitspersample = 16;
             break;
 
-        case VLC_FOURCC( 's', '8', ' ', ' ' ):
-        case VLC_FOURCC( 'u', '8', ' ', ' ' ):
+        case VLC_CODEC_S8:
+        case VLC_CODEC_U8:
             p_sys->fmt.audio.i_bitspersample = 8;
             break;
 
index 611be06aece1b9e0a638e3be4cf70c9617a1b105..527056d7daaeacd36c1d176d6928cf8087e587dd 100644 (file)
@@ -222,7 +222,7 @@ static int Open( vlc_object_t * p_this )
 
     p_sys->i_bitrate = 0;
 
-    es_format_Init( &p_sys->fmt_video, VIDEO_ES, VLC_FOURCC('d','v','s','d') );
+    es_format_Init( &p_sys->fmt_video, VIDEO_ES, VLC_CODEC_DV );
     p_sys->fmt_video.video.i_width = 720;
     p_sys->fmt_video.video.i_height= dv_header.dsf ? 576 : 480;;
 
@@ -239,9 +239,10 @@ static int Open( vlc_object_t * p_this )
     p_peek = p_peek_backup + 80*6+80*16*3 + 3; /* beginning of AAUX pack */
     if( *p_peek == 0x50 )
     {
-        es_format_Init( &p_sys->fmt_audio, AUDIO_ES,
-                        VLC_FOURCC('a','r','a','w') );
+        /* 12 bits non-linear will be converted to 16 bits linear */
+        es_format_Init( &p_sys->fmt_audio, AUDIO_ES, VLC_CODEC_S16L );
 
+        p_sys->fmt_audio.audio.i_bitspersample = 16;
         p_sys->fmt_audio.audio.i_channels = 2;
         switch( (p_peek[4] >> 3) & 0x07 )
         {
@@ -257,9 +258,6 @@ static int Open( vlc_object_t * p_this )
             break;
         }
 
-        /* 12 bits non-linear will be converted to 16 bits linear */
-        p_sys->fmt_audio.audio.i_bitspersample = 16;
-
         p_sys->p_es_audio = es_out_Add( p_demux->out, &p_sys->fmt_audio );
     }
 
index 22ded17b8e4ce979880fc7cdc50781fbc172f88c..85b3a8642df94676c193883999478e241e0b0b0a 100644 (file)
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
-#include <vlc_vout.h>                                     /* vout_InitFormat */
 #include <assert.h>
 
 /*****************************************************************************
@@ -113,12 +112,12 @@ struct preset_t
 
 static const struct preset_t p_presets[] =
 {
-    { "sqcif", 128, 96, 30000, 1001, 4,3, VLC_FOURCC('Y','V','1','2') },
-    { "qcif", 176, 144, 30000, 1001, 4,3, VLC_FOURCC('Y','V','1','2') },
-    { "cif", 352, 288, 30000, 1001, 4,3, VLC_FOURCC('Y','V','1','2') },
-    { "4cif", 704, 576, 30000, 1001, 4,3, VLC_FOURCC('Y','V','1','2') },
-    { "16cif", 1408, 1152, 30000, 1001, 4,3, VLC_FOURCC('Y','V','1','2') },
-    { "yuv", 176, 144, 25, 1, 4,3, VLC_FOURCC('Y','V','1','2') },
+    { "sqcif", 128, 96, 30000, 1001, 4,3, VLC_CODEC_YV12 },
+    { "qcif", 176, 144, 30000, 1001, 4,3, VLC_CODEC_YV12 },
+    { "cif", 352, 288, 30000, 1001, 4,3, VLC_CODEC_YV12 },
+    { "4cif", 704, 576, 30000, 1001, 4,3, VLC_CODEC_YV12 },
+    { "16cif", 1408, 1152, 30000, 1001, 4,3, VLC_CODEC_YV12 },
+    { "yuv", 176, 144, 25, 1, 4,3, VLC_CODEC_YV12 },
     { NULL, 0, 0, 0, 0, 0,0, 0 }
 };
 
@@ -238,12 +237,12 @@ static int Open( vlc_object_t * p_this )
         {
             static const struct { const char *psz_name; vlc_fourcc_t i_fcc; } formats[] =
             {
-                { "420jpeg",    VLC_FOURCC('I','4','2','0') },
-                { "420paldv",   VLC_FOURCC('I','4','2','0') },
-                { "420",        VLC_FOURCC('I','4','2','0') },
-                { "422",        VLC_FOURCC('I','4','2','2') },
-                { "444",        VLC_FOURCC('I','4','4','4') },
-                { "mono",       VLC_FOURCC('G','R','E','Y') },
+                { "420jpeg",    VLC_CODEC_I420 },
+                { "420paldv",   VLC_CODEC_I420 },
+                { "420",        VLC_CODEC_I420 },
+                { "422",        VLC_CODEC_I422 },
+                { "444",        VLC_CODEC_I444 },
+                { "mono",       VLC_CODEC_GREY },
                 { NULL, 0 }
             };
             bool b_found = false;
@@ -357,8 +356,8 @@ static int Open( vlc_object_t * p_this )
     }
 
     es_format_Init( &p_sys->fmt_video, VIDEO_ES, i_chroma );
-    vout_InitFormat( &p_sys->fmt_video.video, i_chroma, i_width, i_height,
-                     i_aspect );
+    video_format_Setup( &p_sys->fmt_video.video,
+                        i_chroma, i_width, i_height, i_aspect );
 
     vlc_ureduce( &p_sys->fmt_video.video.i_frame_rate,
                  &p_sys->fmt_video.video.i_frame_rate_base,
index ec02487eadd796098494b3cb21359f57386bad6e..2f8e93aaf9c7f3952a1ce7d0ebce68584d6a0858 100644 (file)
@@ -230,7 +230,7 @@ static int Open (vlc_object_t * p_this)
     }
 
     es_format_t  fmt;
-    es_format_Init (&fmt, AUDIO_ES, VLC_FOURCC('M', 'I', 'D', 'I'));
+    es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MIDI);
     fmt.audio.i_channels = 2;
     fmt.audio.i_original_channels = fmt.audio.i_physical_channels =
         AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
index 426659c924f6b023e0dd6c970e6bd1781b05ab1f..4faaa9cdcc473b7f4fdfc113fc0ff102b5cca1de 100644 (file)
@@ -518,11 +518,11 @@ static int Open ( vlc_object_t *p_this )
              p_sys->i_type == SUB_TYPE_SSA2_4 ||
              p_sys->i_type == SUB_TYPE_ASS )
     {
-        es_format_Init( &fmt, SPU_ES, VLC_FOURCC( 's','s','a',' ' ) );
+        es_format_Init( &fmt, SPU_ES, VLC_CODEC_SSA );
     }
     else
     {
-        es_format_Init( &fmt, SPU_ES, VLC_FOURCC( 's','u','b','t' ) );
+        es_format_Init( &fmt, SPU_ES, VLC_CODEC_SUBT );
     }
     if( p_sys->psz_header != NULL )
     {
index 7a654f302a40d0d776bb6e26a1d90d730c73b768..4882206a3cbd53a7b2bd34a0416d339b745cfaf4 100644 (file)
@@ -252,11 +252,11 @@ static int Open ( vlc_object_t *p_this )
     /* *** add subtitle ES *** */
     if( p_detect->fmt->target == ASAI_TARGET_SSA )
     {
-        es_format_Init( &fmt, SPU_ES, VLC_FOURCC( 's','s','a',' ' ) );
+        es_format_Init( &fmt, SPU_ES, VLC_CODEC_SSA );
     }
     else
     {
-        es_format_Init( &fmt, SPU_ES, VLC_FOURCC( 's','u','b','t' ) );
+        es_format_Init( &fmt, SPU_ES, VLC_CODEC_SUBT );
     }
     p_sys->es = es_out_Add( p_demux->out, &fmt );
 
index b80031b68a845ba780f01a18b70ee466c353d7b5..180507ad5deb3dabfd3b091a168e22cdbcb94c63 100644 (file)
@@ -1737,7 +1737,7 @@ static void ParsePES( demux_t *p_demux, ts_pid_t *pid )
     {
         i_skip += 1;
     }
-    else if( pid->es->fmt.i_codec == VLC_FOURCC( 's', 'u', 'b', 't' ) &&
+    else if( pid->es->fmt.i_codec == VLC_CODEC_SUBT &&
              pid->es->p_mpeg4desc )
     {
         decoder_config_descriptor_t *dcd = &pid->es->p_mpeg4desc->dec_descr;
@@ -1762,7 +1762,7 @@ static void ParsePES( demux_t *p_demux, ts_pid_t *pid )
         i_skip += 2;
     }
 #ifdef ZVBI_COMPILED
-    else if( pid->es->fmt.i_codec == VLC_FOURCC( 't', 'e', 'l', 'x' ) )
+    else if( pid->es->fmt.i_codec == VLC_CODEC_TELETEXT )
         i_skip = 0; /*hack for zvbi support */
 #endif
     /* skip header */
@@ -1804,7 +1804,7 @@ static void ParsePES( demux_t *p_demux, ts_pid_t *pid )
         p_pes->i_length = i_length * 100 / 9;
 
         p_block = block_ChainGather( p_pes );
-        if( pid->es->fmt.i_codec == VLC_FOURCC( 's', 'u', 'b', 't' ) )
+        if( pid->es->fmt.i_codec == VLC_CODEC_SUBT )
         {
             if( i_pes_size > 0 && p_block->i_buffer > i_pes_size )
             {
@@ -2048,38 +2048,38 @@ static int PIDFillFormat( ts_pid_t *pid, int i_stream_type )
     case 0x01:  /* MPEG-1 video */
     case 0x02:  /* MPEG-2 video */
     case 0x80:  /* MPEG-2 MOTO video */
-        es_format_Init( fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', 'g', 'v' ) );
+        es_format_Init( fmt, VIDEO_ES, VLC_CODEC_MPGV );
         break;
     case 0x03:  /* MPEG-1 audio */
     case 0x04:  /* MPEG-2 audio */
-        es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'm', 'p', 'g', 'a' ) );
+        es_format_Init( fmt, AUDIO_ES, VLC_CODEC_MPGA );
         break;
     case 0x11:  /* MPEG4 (audio) */
     case 0x0f:  /* ISO/IEC 13818-7 Audio with ADTS transport syntax */
-        es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'm', 'p', '4', 'a' ) );
+        es_format_Init( fmt, AUDIO_ES, VLC_CODEC_MP4A );
         break;
     case 0x10:  /* MPEG4 (video) */
-        es_format_Init( fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', '4', 'v' ) );
+        es_format_Init( fmt, VIDEO_ES, VLC_CODEC_MP4V );
         pid->es->b_gather = true;
         break;
     case 0x1B:  /* H264 <- check transport syntax/needed descriptor */
-        es_format_Init( fmt, VIDEO_ES, VLC_FOURCC( 'h', '2', '6', '4' ) );
+        es_format_Init( fmt, VIDEO_ES, VLC_CODEC_H264 );
         break;
 
     case 0x81:  /* A52 (audio) */
-        es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'a', '5', '2', ' ' ) );
+        es_format_Init( fmt, AUDIO_ES, VLC_CODEC_A52 );
         break;
     case 0x82:  /* DVD_SPU (sub) */
-        es_format_Init( fmt, SPU_ES, VLC_FOURCC( 's', 'p', 'u', ' ' ) );
+        es_format_Init( fmt, SPU_ES, VLC_CODEC_SPU );
         break;
     case 0x83:  /* LPCM (audio) */
-        es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'l', 'p', 'c', 'm' ) );
+        es_format_Init( fmt, AUDIO_ES, VLC_CODEC_DVD_LPCM );
         break;
     case 0x84:  /* SDDS (audio) */
-        es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 's', 'd', 'd', 's' ) );
+        es_format_Init( fmt, AUDIO_ES, VLC_CODEC_SDDS );
         break;
     case 0x85:  /* DTS (audio) */
-        es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'd', 't', 's', ' ' ) );
+        es_format_Init( fmt, AUDIO_ES, VLC_CODEC_DTS );
         break;
 
     case 0x91:  /* A52 vls (audio) */
@@ -3103,14 +3103,14 @@ static void PMTSetupEsISO14496( demux_t *p_demux, ts_pid_t *pid,
         {
         case 0x0B: /* mpeg4 sub */
             p_fmt->i_cat = SPU_ES;
-            p_fmt->i_codec = VLC_FOURCC('s','u','b','t');
+            p_fmt->i_codec = VLC_CODEC_SUBT;
             break;
 
         case 0x20: /* mpeg4 */
-            p_fmt->i_codec = VLC_FOURCC('m','p','4','v');
+            p_fmt->i_codec = VLC_CODEC_MP4V;
             break;
         case 0x21: /* h264 */
-            p_fmt->i_codec = VLC_FOURCC('h','2','6','4');
+            p_fmt->i_codec = VLC_CODEC_H264;
             break;
         case 0x60:
         case 0x61:
@@ -3118,13 +3118,13 @@ static void PMTSetupEsISO14496( demux_t *p_demux, ts_pid_t *pid,
         case 0x63:
         case 0x64:
         case 0x65: /* mpeg2 */
-            p_fmt->i_codec = VLC_FOURCC( 'm','p','g','v' );
+            p_fmt->i_codec = VLC_CODEC_MPGV;
             break;
         case 0x6a: /* mpeg1 */
-            p_fmt->i_codec = VLC_FOURCC( 'm','p','g','v' );
+            p_fmt->i_codec = VLC_CODEC_MPGV;
             break;
         case 0x6c: /* mpeg1 */
-            p_fmt->i_codec = VLC_FOURCC( 'j','p','e','g' );
+            p_fmt->i_codec = VLC_CODEC_JPEG;
             break;
         default:
             p_fmt->i_cat = UNKNOWN_ES;
@@ -3137,18 +3137,18 @@ static void PMTSetupEsISO14496( demux_t *p_demux, ts_pid_t *pid,
         switch( dcd->i_objectTypeIndication )
         {
         case 0x40: /* mpeg4 */
-            p_fmt->i_codec = VLC_FOURCC('m','p','4','a');
+            p_fmt->i_codec = VLC_CODEC_MP4A;
             break;
         case 0x66:
         case 0x67:
         case 0x68: /* mpeg2 aac */
-            p_fmt->i_codec = VLC_FOURCC('m','p','4','a');
+            p_fmt->i_codec = VLC_CODEC_MP4A;
             break;
         case 0x69: /* mpeg2 */
-            p_fmt->i_codec = VLC_FOURCC('m','p','g','a');
+            p_fmt->i_codec = VLC_CODEC_MPGA;
             break;
         case 0x6b: /* mpeg1 */
-            p_fmt->i_codec = VLC_FOURCC('m','p','g','a');
+            p_fmt->i_codec = VLC_CODEC_MPGA;
             break;
         default:
             p_fmt->i_cat = UNKNOWN_ES;
@@ -3260,7 +3260,7 @@ static void PMTSetupEsTeletext( demux_t *p_demux, ts_pid_t *pid,
 #endif
 
     /* */
-    es_format_Init( p_fmt, SPU_ES, VLC_FOURCC( 't', 'e', 'l', 'x' ) );
+    es_format_Init( p_fmt, SPU_ES, VLC_CODEC_TELETEXT );
 
     /* In stream output mode, do not separate the stream by page */
     if( p_demux->out->b_sout || i_page <= 0 )
@@ -3339,7 +3339,7 @@ static void PMTSetupEsDvbSubtitle( demux_t *p_demux, ts_pid_t *pid,
 {
     es_format_t *p_fmt = &pid->es->fmt;
 
-    es_format_Init( p_fmt, SPU_ES, VLC_FOURCC( 'd', 'v', 'b', 's' ) );
+    es_format_Init( p_fmt, SPU_ES, VLC_CODEC_DVBS );
 
     dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_es, 0x59 );
     int i_page = 0;
@@ -3444,13 +3444,13 @@ static void PMTSetupEs0x06( demux_t *p_demux, ts_pid_t *pid,
         PMTEsFindDescriptor( p_es, 0x81 ) )
     {
         p_fmt->i_cat = AUDIO_ES;
-        p_fmt->i_codec = VLC_FOURCC('a','5','2',' ');
+        p_fmt->i_codec = VLC_CODEC_A52;
     }
     else if( PMTEsFindDescriptor( p_es, 0x7a ) )
     {
         /* DVB with stream_type 0x06 (ETS EN 300 468) */
         p_fmt->i_cat = AUDIO_ES;
-        p_fmt->i_codec = VLC_FOURCC( 'e', 'a', 'c', '3' );
+        p_fmt->i_codec = VLC_CODEC_EAC3;
     }
     else if( PMTEsHasRegistration( p_demux, p_es, "DTS1" ) ||
              PMTEsHasRegistration( p_demux, p_es, "DTS2" ) ||
@@ -3459,13 +3459,13 @@ static void PMTSetupEs0x06( demux_t *p_demux, ts_pid_t *pid,
     {
         /*registration descriptor(ETSI TS 101 154 Annex F)*/
         p_fmt->i_cat = AUDIO_ES;
-        p_fmt->i_codec = VLC_FOURCC('d','t','s',' ');
+        p_fmt->i_codec = VLC_CODEC_DTS;
     }
     else if( PMTEsHasRegistration( p_demux, p_es, "BSSD" ) )
     {
         p_fmt->i_cat = AUDIO_ES;
         p_fmt->b_packetized = true;
-        p_fmt->i_codec = VLC_FOURCC('a','e','s','3');
+        p_fmt->i_codec = VLC_CODEC_302M;
     }
     else
     {
@@ -3544,7 +3544,7 @@ static void PMTSetupEs0xEA( demux_t *p_demux, ts_pid_t *pid,
 
     /* registration descriptor for VC-1 (SMPTE rp227) */
     p_fmt->i_cat = VIDEO_ES;
-    p_fmt->i_codec = VLC_FOURCC('W','V','C','1');
+    p_fmt->i_codec = VLC_CODEC_VC1;
 
     /* XXX With Simple and Main profile the SEQUENCE
      * header is modified: video width and height are
@@ -3567,7 +3567,7 @@ static void PMTSetupEs0xD1( demux_t *p_demux, ts_pid_t *pid,
     /* registration descriptor for Dirac
      * (backwards compatable with VC-2 (SMPTE Sxxxx:2008)) */
     p_fmt->i_cat = VIDEO_ES;
-    p_fmt->i_codec = VLC_FOURCC('d','r','a','c');
+    p_fmt->i_codec = VLC_CODEC_DIRAC;
 }
 
 static void PMTSetupEs0xA0( demux_t *p_demux, ts_pid_t *pid,
@@ -3615,26 +3615,26 @@ static void PMTSetupEsHDMV( demux_t *p_demux, ts_pid_t *pid,
     {
     case 0x80:
         p_fmt->i_cat = AUDIO_ES;
-        p_fmt->i_codec = VLC_FOURCC( 'b', 'p', 'c', 'm' );
+        p_fmt->i_codec = VLC_CODEC_BD_LPCM;
         break;
     case 0x82:
     case 0x85: /* DTS-HD High resolution audio */
     case 0x86: /* DTS-HD Master audio */
     case 0xA2: /* Secondary DTS audio */
         p_fmt->i_cat = AUDIO_ES;
-        p_fmt->i_codec = VLC_FOURCC( 'd', 't', 's', ' ' );
+        p_fmt->i_codec = VLC_CODEC_DTS;
         break;
 
     case 0x83: /* TrueHD AC3 */
         p_fmt->i_cat = AUDIO_ES;
-        p_fmt->i_codec = VLC_FOURCC( 'm', 'l', 'p', ' ' );
+        p_fmt->i_codec = VLC_CODEC_MLP;
         break;
 
     case 0x84: /* E-AC3 */
     case 0x87: /* E-AC3 */
     case 0xA1: /* Secondary E-AC3 */
         p_fmt->i_cat = AUDIO_ES;
-        p_fmt->i_codec = VLC_FOURCC( 'e', 'a', 'c', '3' );
+        p_fmt->i_codec = VLC_CODEC_EAC3;
         break;
     case 0x90: /* Presentation graphics */
     case 0x91: /* Interactive graphics */
@@ -3936,8 +3936,8 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt )
 
         if( pid->es->fmt.i_cat == AUDIO_ES ||
             ( pid->es->fmt.i_cat == SPU_ES &&
-              pid->es->fmt.i_codec != VLC_FOURCC('d','v','b','s') &&
-              pid->es->fmt.i_codec != VLC_FOURCC('t','e','l','x') ) )
+              pid->es->fmt.i_codec != VLC_CODEC_DVBS &&
+              pid->es->fmt.i_codec != VLC_CODEC_TELETEXT ) )
         {
             PMTParseEsIso639( p_demux, pid, p_es );
         }
index 0922f389536461e946cab0cebd810c71afec35dd..dd32597172f131954fe4e68064076998e77dd319 100644 (file)
@@ -117,7 +117,7 @@ static int Open( vlc_object_t * p_this )
     p_sys->pi_seektable = NULL;
 
     /* Read the metadata */
-    es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'T', 'T', 'A', '1' ) );
+    es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_TTA );
     fmt.audio.i_channels = GetWLE( &p_header[6] );
     fmt.audio.i_bitspersample = GetWLE( &p_header[8] );
     fmt.audio.i_rate = GetDWLE( &p_header[10] );
index 63d8402dc994992a7ef839c9410f08091d3ea494..0c93a351e891dd84bbd3c1536174afa9372ce380 100644 (file)
@@ -352,15 +352,15 @@ static int Open(vlc_object_t *p_this)
 
     /* register the proper audio codec */
     if (p_sys->audio_type == TIVO_AUDIO_MPEG) {
-        es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'm', 'p', 'g', 'a' ) );
+        es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_MPGA );
     } else {
-        es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'a', '5', '2', ' ' ) );
+        es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_A52 );
     }
     fmt.i_group = TY_ES_GROUP;
     p_sys->p_audio = es_out_Add( p_demux->out, &fmt );
 
     /* register the video stream */
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', 'g', 'v' ) );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_MPGV );
     fmt.i_group = TY_ES_GROUP;
     p_sys->p_video = es_out_Add( p_demux->out, &fmt );
 
index 8c3af591962a6efe26fcc7bc1bd0a0f4b8ae88d4..968b9e8dc7c17e1345aafeb4097eba1b3f9f9859 100644 (file)
@@ -106,7 +106,7 @@ static int Open( vlc_object_t * p_this )
         p_sys->f_fps = 0.0;
 
     /* Load the packetizer */
-    es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( 'W', 'V', 'C', '1' ) );
+    es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_VC1 );
     p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "VC-1" );
     if( !p_sys->p_packetizer )
     {
index 3b90e2da5be5a9784ca1782b901ebda3b9fbbe3c..e6f6c7e797fbebfe2662c860c560b13c5acbdf14 100644 (file)
@@ -40,6 +40,7 @@
 #include <vlc_charset.h>
 
 #include "ps.h"
+#include "vobsub.h"
 
 #define MAX_LINE 8192
 
@@ -488,8 +489,8 @@ static int ParseVobSubIDX( demux_t *p_demux )
         else if( !strncmp( "size:", line, 5 ) )
         {
             /* Store the original size of the video */
-            if( sscanf( line, "size: %dx%d",
-                        &p_sys->i_original_frame_width, &p_sys->i_original_frame_height ) == 2 )
+            if( vobsub_size_parse( line, &p_sys->i_original_frame_width,
+                                   &p_sys->i_original_frame_height ) == VLC_SUCCESS )
             {
                 msg_Dbg( p_demux, "original frame size: %dx%d", p_sys->i_original_frame_width, p_sys->i_original_frame_height );
             }
@@ -500,33 +501,8 @@ static int ParseVobSubIDX( demux_t *p_demux )
         }
         else if( !strncmp( "palette:", line, 8 ) )
         {
-            int i;
-
-            /* Store the palette of the subs */
-            if( sscanf( line, "palette: %x, %x, %x, %x, %x, %x, %x, %x, %x, %x, %x, %x, %x, %x, %x, %x",
-                        &p_sys->palette[0], &p_sys->palette[1], &p_sys->palette[2], &p_sys->palette[3],
-                        &p_sys->palette[4], &p_sys->palette[5], &p_sys->palette[6], &p_sys->palette[7],
-                        &p_sys->palette[8], &p_sys->palette[9], &p_sys->palette[10], &p_sys->palette[11],
-                        &p_sys->palette[12], &p_sys->palette[13], &p_sys->palette[14], &p_sys->palette[15] ) == 16 )
+            if( vobsub_palette_parse( line, p_sys->palette ) == VLC_SUCCESS )
             {
-                for( i = 0; i < 16; i++ )
-                {
-                    uint8_t r = 0, g = 0, b = 0;
-                    uint8_t y = 0, u = 0, v = 0;
-                    r = (p_sys->palette[i] >> 16) & 0xff;
-                    g = (p_sys->palette[i] >> 8) & 0xff;
-                    b = (p_sys->palette[i] >> 0) & 0xff;
-                    /* msg_Dbg( p_demux, "palette %d: R=%x, G=%x, B=%x", i, r, g, b ); */
-                    y = (uint8_t) __MIN(abs(r * 2104 + g * 4130 + b * 802 + 4096 + 131072) >> 13, 235);
-                    u = (uint8_t) __MIN(abs(r * -1214 + g * -2384 + b * 3598 + 4096 + 1048576) >> 13, 240);
-                    v = (uint8_t) __MIN(abs(r * 3598 + g * -3013 + b * -585 + 4096 + 1048576) >> 13, 240);
-                    p_sys->palette[i] = 0;
-                    p_sys->palette[i] |= (y&0xff)<<16;
-                    p_sys->palette[i] |= (u&0xff);
-                    p_sys->palette[i] |= (v&0xff)<<8;
-                    /* msg_Dbg( p_demux, "palette %d: y=%x, u=%x, v=%x", i, y, u, v ); */
-
-                }
                 p_sys->b_palette = true;
                 msg_Dbg( p_demux, "vobsub palette read" );
             }
@@ -557,7 +533,7 @@ static int ParseVobSubIDX( demux_t *p_demux )
                 current_tk->i_track_id = i_track_id;
                 current_tk->i_delay = (int64_t)0;
 
-                es_format_Init( &fmt, SPU_ES, VLC_FOURCC( 's','p','u',' ' ) );
+                es_format_Init( &fmt, SPU_ES, VLC_CODEC_SPU );
                 fmt.subs.spu.i_original_frame_width = p_sys->i_original_frame_width;
                 fmt.subs.spu.i_original_frame_height = p_sys->i_original_frame_height;
                 fmt.psz_language = strdup( language );
diff --git a/modules/demux/vobsub.h b/modules/demux/vobsub.h
new file mode 100644 (file)
index 0000000..cabdefb
--- /dev/null
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * vobsub.h: Vobsub support
+ *****************************************************************************
+ * Copyright (C) 2009 the VideoLAN team
+ * $Id$
+ *
+ * Authors: John Stebbins
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+static inline void vobsub_palette_rgb2yuv( uint32_t *pu_palette )
+{
+    int i;
+    for( i = 0; i < 16; i++ )
+    {
+        uint8_t r, g, b, y, u, v;
+        r = (pu_palette[i] >> 16) & 0xff;
+        g = (pu_palette[i] >> 8) & 0xff;
+        b = (pu_palette[i] >> 0) & 0xff;
+        y = (uint8_t) __MIN(abs(r * 2104 + g * 4130 + b * 802 + 4096 + 131072) >> 13, 235);
+        u = (uint8_t) __MIN(abs(r * -1214 + g * -2384 + b * 3598 + 4096 + 1048576) >> 13, 240);
+        v = (uint8_t) __MIN(abs(r * 3598 + g * -3013 + b * -585 + 4096 + 1048576) >> 13, 240);
+        pu_palette[i] = (y&0xff)<<16 | (v&0xff)<<8 | (u&0xff);
+    }
+}
+
+static inline int vobsub_palette_parse( const char *psz_buf, uint32_t *pu_palette )
+{
+    if( sscanf( psz_buf, "palette: "
+                "%"PRIx32", %"PRIx32", %"PRIx32", %"PRIx32", "
+                "%"PRIx32", %"PRIx32", %"PRIx32", %"PRIx32", "
+                "%"PRIx32", %"PRIx32", %"PRIx32", %"PRIx32", "
+                "%"PRIx32", %"PRIx32", %"PRIx32", %"PRIx32"",
+                &pu_palette[0], &pu_palette[1], &pu_palette[2], &pu_palette[3],
+                &pu_palette[4], &pu_palette[5], &pu_palette[6], &pu_palette[7],
+                &pu_palette[8], &pu_palette[9], &pu_palette[10], &pu_palette[11],
+                &pu_palette[12], &pu_palette[13], &pu_palette[14], &pu_palette[15] ) == 16 )
+    {
+        vobsub_palette_rgb2yuv( pu_palette );
+        return VLC_SUCCESS;
+    }
+    else
+    {
+        return VLC_EGENERIC;
+    }
+}
+
+static inline int vobsub_size_parse( const char *psz_buf,
+                                     int *pi_original_frame_width,
+                                     int *pi_original_frame_height )
+{
+    if( sscanf( psz_buf, "size: %dx%d",
+                pi_original_frame_width, pi_original_frame_height ) == 2 )
+    {
+        return VLC_SUCCESS;
+    }
+    else
+    {
+        return VLC_EGENERIC;
+    }
+}
+
index 13d86d1b28feb78de8bae83fa220bb5d273703fe..ccdb63a73fea173a6809101613c26de63b2c294f 100644 (file)
@@ -196,7 +196,7 @@ static int ReadBlockHeader( demux_t *p_demux )
                 return VLC_EGENERIC;
             }
 
-            new_fmt.i_codec = VLC_FOURCC('u','8',' ',' ');
+            new_fmt.i_codec = VLC_CODEC_U8;
             new_fmt.audio.i_rate = fix_voc_sr( 1000000L / (256L - buf[0]) );
             new_fmt.audio.i_bytes_per_frame = 1;
             new_fmt.audio.i_frame_length = 1;
@@ -221,7 +221,7 @@ static int ReadBlockHeader( demux_t *p_demux )
             i_block_size = 0;
             p_sys->i_silence_countdown = GetWLE( buf );
 
-            new_fmt.i_codec = VLC_FOURCC('u','8',' ',' ');
+            new_fmt.i_codec = VLC_CODEC_U8;
             new_fmt.audio.i_rate = fix_voc_sr( 1000000L / (256L - buf[0]) );
             new_fmt.audio.i_bytes_per_frame = 1;
             new_fmt.audio.i_frame_length = 1;
@@ -272,7 +272,7 @@ static int ReadBlockHeader( demux_t *p_demux )
                 return VLC_EGENERIC;
             }
 
-            new_fmt.i_codec = VLC_FOURCC('u','8',' ',' ');
+            new_fmt.i_codec = VLC_CODEC_U8;
             new_fmt.audio.i_channels = buf[3] + 1; /* can't be nul */
             new_fmt.audio.i_rate = 256000000L /
                           ((65536L - GetWLE(buf)) * new_fmt.audio.i_channels);
@@ -323,11 +323,11 @@ static int ReadBlockHeader( demux_t *p_demux )
                     switch( new_fmt.audio.i_bitspersample )
                     {
                         case 8:
-                            new_fmt.i_codec = VLC_FOURCC('u','8',' ',' ');
+                            new_fmt.i_codec = VLC_CODEC_U8;
                             break;
 
                         case 16:
-                            new_fmt.i_codec = VLC_FOURCC('u','1','6','l');
+                            new_fmt.i_codec = VLC_CODEC_U16L;
                             break;
 
                         default:
@@ -341,11 +341,11 @@ static int ReadBlockHeader( demux_t *p_demux )
                     switch( new_fmt.audio.i_bitspersample )
                     {
                         case 8:
-                            new_fmt.i_codec = VLC_FOURCC('s','8',' ',' ');
+                            new_fmt.i_codec = VLC_CODEC_S8;
                             break;
 
                         case 16:
-                            new_fmt.i_codec = VLC_FOURCC('s','1','6','l');
+                            new_fmt.i_codec = VLC_CODEC_S16L;
                             break;
 
                         default:
index ff5367a008fb44f0544c2034170914dbffffc9bf..9f4c832e012676d2dbd7cc0d0f61b6ffd0001357 100644 (file)
@@ -310,8 +310,8 @@ static int Open( vlc_object_t * p_this )
     case VLC_FOURCC( 'a', 'r', 'a', 'w' ):
     case VLC_FOURCC( 'a', 'f', 'l', 't' ):
     case VLC_FOURCC( 'u', 'l', 'a', 'w' ):
-    case VLC_FOURCC( 'a', 'l', 'a', 'w' ):
-    case VLC_FOURCC( 'm', 'l', 'a', 'w' ):
+    case VLC_CODEC_ALAW:
+    case VLC_CODEC_MULAW:
     case VLC_FOURCC( 'p', 'c', 'm', ' ' ):
         if( FrameInfo_PCM( &p_sys->i_frame_size, &p_sys->i_frame_samples,
                            &p_sys->fmt ) )
@@ -334,11 +334,11 @@ static int Open( vlc_object_t * p_this )
                                 &p_sys->fmt ) )
             goto error;
         break;
-    case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
-    case VLC_FOURCC( 'a', '5', '2', ' ' ):
+    case VLC_CODEC_MPGA:
+    case VLC_CODEC_A52:
         /* FIXME set end of area FIXME */
         goto error;
-    case VLC_FOURCC( 'a', 'g', 's', 'm' ):
+    case VLC_CODEC_GSM_MS:
         if( FrameInfo_MSGSM( &p_sys->i_frame_size, &p_sys->i_frame_samples,
                              &p_sys->fmt ) )
             goto error;
index 1202ef04da6c340af136ae6f0eec33dcad6655e2..51cee519937eae44fd39bd4aa8b1db87aae56fba 100644 (file)
@@ -97,7 +97,7 @@ int OpenAudio ( vlc_object_t * p_this )
 #endif
     p_format->buffer_size = 8192;
 
-    p_aout->output.output.i_format = VLC_FOURCC('f','l','3','2');
+    p_aout->output.output.i_format = VLC_CODEC_FL32;
     p_aout->output.i_nb_samples = 2048 / i_nb_channels;
     p_aout->output.pf_play = DoNothing;
 
index 4f874d31aeb0d77abeac6af209c3a8acfcd1135a..aaffae5e8d4e08baf150a709e624699a7102eb53 100644 (file)
@@ -45,11 +45,11 @@ typedef struct colorcombo
 
 colorcombo colspace[]=
 {
-    {B_YCbCr420, "B_YCbCr420", VLC_FOURCC('I','4','2','0'), 3, 2},
+    {B_YCbCr420, "B_YCbCr420", VLC_CODEC_I420, 3, 2},
     {B_YUV422,   "B_YUV422",   VLC_FOURCC('Y','4','2','2'), 3, 2},
-    {B_YCbCr422, "B_YCbCr422", VLC_FOURCC('Y','U','Y','2'), 3, 2},
-    {B_RGB32,    "B_RGB32",    VLC_FOURCC('R','V','3','2'), 1, 4},
-    {B_RGB16,    "B_RGB16",    VLC_FOURCC('R','V','1','6'), 1, 2}
+    {B_YCbCr422, "B_YCbCr422", VLC_CODEC_YUYV, 3, 2},
+    {B_RGB32,    "B_RGB32",    VLC_CODEC_RGB32, 1, 4},
+    {B_RGB16,    "B_RGB16",    VLC_CODEC_RGB16, 1, 2}
 };
 
 #define COLOR_COUNT 5
index 9af2a75873aeed672c3bc0508633a66fe3debeb3..739137939b232bf68f3717d5a9bb0ed82585da6a 100644 (file)
@@ -234,7 +234,7 @@ struct fbosd_render_t
     int             i_state;
 
     /* Font style */
-    text_style_t    text_style;                              /* font control */
+    text_style_t*   p_text_style;                            /* font control */
     char            *psz_string;
 
     /* Position */
@@ -310,20 +310,19 @@ static int Create( vlc_object_t *p_this )
     if( !p_intf->p_sys )
         return VLC_ENOMEM;
 
-    p_sys->p_style = malloc( sizeof( text_style_t ) );
+    p_sys->p_style = text_style_New();
     if( !p_sys->p_style )
     {
         free( p_intf->p_sys );
         return VLC_ENOMEM;
     }
-    vlc_memcpy( p_sys->p_style, &default_text_style, sizeof( text_style_t ) );
 
     p_intf->pf_run = Run;
 
     p_sys->p_image = image_HandlerCreate( p_this );
     if( !p_sys->p_image )
     {
-        free( p_sys->p_style );
+        text_style_Delete( p_sys->p_style );
         free( p_sys );
         return VLC_ENOMEM;
     }
@@ -395,10 +394,7 @@ static int Create( vlc_object_t *p_this )
     var_AddCallback( p_intf, "fbosd-font-opacity", OverlayCallback, NULL );
 
     for( i = 0; i < FBOSD_RENDER_MAX; i++ )
-    {
-        vlc_memcpy( &p_sys->render[i].text_style, &default_text_style,
-                    sizeof( text_style_t ) );
-    }
+        p_sys->render[i].p_text_style = text_style_New();
 
     p_sys->b_clear = var_CreateGetBoolCommand( p_intf, "fbosd-clear" );
     p_sys->b_render = var_CreateGetBoolCommand( p_intf, "fbosd-render" );
@@ -508,6 +504,7 @@ static void Destroy( vlc_object_t *p_this )
     {
         free( p_sys->render[i].psz_string );
         p_sys->render[i].i_state = FBOSD_STATE_FREE;
+        text_style_Delete( p_sys->render[i].p_text_style );
     }
 
 #if defined(FBOSD_BLENDING)
@@ -520,7 +517,7 @@ static void Destroy( vlc_object_t *p_this )
     if( p_sys->p_overlay )
         picture_Release( p_sys->p_overlay );
 
-    free( p_sys->p_style );
+    text_style_Delete( p_sys->p_style );
     free( p_sys );
 }
 
@@ -540,10 +537,10 @@ static int OpenBlending( intf_thread_t *p_intf )
             p_intf->p_sys->fmt_out.i_chroma;
     if( config_GetInt( p_intf, "freetype-yuvp" ) )
         p_intf->p_sys->p_blend->fmt_in.video.i_chroma =
-                VLC_FOURCC('Y','U','V','P');
+                VLC_CODEC_YUVP;
     else
         p_intf->p_sys->p_blend->fmt_in.video.i_chroma =
-                VLC_FOURCC('Y','U','V','A');
+                VLC_CODEC_YUVA;
 
     p_intf->p_sys->p_blend->p_module =
         module_need( p_intf->p_sys->p_blend, "video blending", NULL, false );
@@ -631,7 +628,7 @@ static picture_t *AllocatePicture( video_format_t *p_fmt )
         return NULL;
 
     if( !p_fmt->p_palette &&
-        ( p_fmt->i_chroma == VLC_FOURCC('Y','U','V','P') ) )
+        ( p_fmt->i_chroma == VLC_CODEC_YUVP ) )
     {
         p_fmt->p_palette = malloc( sizeof(video_palette_t) );
         if( !p_fmt->p_palette )
@@ -740,13 +737,13 @@ static int InvertAlpha( intf_thread_t *p_intf, picture_t **p_pic, video_format_t
 
     switch( fmt.i_chroma )
     {
-        case VLC_FOURCC('R','V','2','4'):
+        case VLC_CODEC_RGB24:
             p_begin = (uint8_t *)(*p_pic)->p[Y_PLANE].p_pixels;
             p_end   = (uint8_t *)(*p_pic)->p[Y_PLANE].p_pixels +
                       ( fmt.i_height * (*p_pic)->p[Y_PLANE].i_pitch );
             i_skip = 3;
             break;
-        case VLC_FOURCC('R','V','3','2'):
+        case VLC_CODEC_RGB32:
             p_begin = (uint8_t *)(*p_pic)->p[Y_PLANE].p_pixels;
             p_end   = (uint8_t *)(*p_pic)->p[Y_PLANE].p_pixels +
                       ( fmt.i_height * (*p_pic)->p[Y_PLANE].i_pitch );
@@ -848,7 +845,7 @@ static picture_t *RenderText( intf_thread_t *p_intf, const char *psz_string,
         video_format_t fmt;
 
         memset( &fmt, 0, sizeof(fmt) );
-        fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+        fmt.i_chroma = VLC_CODEC_TEXT;
         fmt.i_aspect = 0;
         fmt.i_width  = fmt.i_visible_width = 0;
         fmt.i_height = fmt.i_visible_height = 0;
@@ -865,7 +862,7 @@ static picture_t *RenderText( intf_thread_t *p_intf, const char *psz_string,
             subpicture_region_Delete( p_region );
             return NULL;
         }
-        p_region->p_style = p_style;
+        p_region->p_style = text_style_Duplicate( p_style );
         p_region->i_align = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
 
         if( p_sys->p_text->pf_render_text )
@@ -963,15 +960,15 @@ static int Init( intf_thread_t *p_intf )
     switch( p_sys->var_info.bits_per_pixel )
     {
     case 8: /* FIXME: set the palette */
-        p_sys->fmt_out.i_chroma = VLC_FOURCC('R','G','B','2'); break;
+        p_sys->fmt_out.i_chroma = VLC_CODEC_RGB8; break;
     case 15:
-        p_sys->fmt_out.i_chroma = VLC_FOURCC('R','V','1','5'); break;
+        p_sys->fmt_out.i_chroma = VLC_CODEC_RGB15; break;
     case 16:
-        p_sys->fmt_out.i_chroma = VLC_FOURCC('R','V','1','6'); break;
+        p_sys->fmt_out.i_chroma = VLC_CODEC_RGB16; break;
     case 24:
-        p_sys->fmt_out.i_chroma = VLC_FOURCC('R','V','2','4'); break;
+        p_sys->fmt_out.i_chroma = VLC_CODEC_RGB24; break;
     case 32:
-        p_sys->fmt_out.i_chroma = VLC_FOURCC('R','V','3','2'); break;
+        p_sys->fmt_out.i_chroma = VLC_CODEC_RGB32; break;
     default:
         msg_Err( p_intf, "unknown screen depth %i",
                  p_sys->var_info.bits_per_pixel );
@@ -1194,7 +1191,7 @@ static void Render( intf_thread_t *p_intf, struct fbosd_render_t *render )
 #if defined(FBOSD_BLENDING)
         video_format_t fmt_in;
         memset( &fmt_in, 0, sizeof(video_format_t) );
-        p_text = RenderText( p_intf, render->psz_string, &render->text_style,
+        p_text = RenderText( p_intf, render->psz_string, render->p_text_style,
                              &fmt_in );
         if( p_text )
         {
@@ -1204,7 +1201,7 @@ static void Render( intf_thread_t *p_intf, struct fbosd_render_t *render )
             DeAllocatePicture( p_text, &fmt_in );
         }
 #else
-        p_text = RenderText( p_intf, render->psz_string, &render->text_style,
+        p_text = RenderText( p_intf, render->psz_string, render->p_text_style,
                              &p_sys->fmt_out );
         if( p_text )
         {
@@ -1220,8 +1217,8 @@ static void RenderClear( intf_thread_t *p_intf, struct fbosd_render_t *render )
 {
     intf_sys_t *p_sys = p_intf->p_sys;
 
-    vlc_memcpy( &render->text_style, &default_text_style,
-                sizeof( text_style_t ) );
+    text_style_Delete( render->p_text_style );
+    render->p_text_style = text_style_New();
     free( render->psz_string );
     render->psz_string = NULL;
 
@@ -1399,15 +1396,15 @@ static int OverlayCallback( vlc_object_t *p_this, char const *psz_cmd,
         }
         else if( !strncmp( psz_cmd, "fbosd-font-size", 15 ) )
         {
-            p_sys->render[i].text_style.i_font_size = newval.i_int;
+            p_sys->render[i].p_text_style->i_font_size = newval.i_int;
         }
         else if( !strncmp( psz_cmd, "fbosd-font-color", 16 ) )
         {
-            p_sys->render[i].text_style.i_font_color = newval.i_int;
+            p_sys->render[i].p_text_style->i_font_color = newval.i_int;
         }
         else if( !strncmp( psz_cmd, "fbosd-font-opacity", 18 ) )
         {
-            p_sys->render[i].text_style.i_font_alpha = 255 - newval.i_int;
+            p_sys->render[i].p_text_style->i_font_alpha = 255 - newval.i_int;
         }
         else if( !strncmp( psz_cmd, "fbosd-alpha", 11 ) )
         {
index d777d4ae864edec3715a16ff20e41e0e32b23f9d..269e513d5bdf5a42284bc6046f1adf6b68aab42b 100644 (file)
             playlist_NodeDelete( p_playlist, p_item, true, false );
         }
         else
-            playlist_DeleteFromInput( p_playlist, p_item->p_input->i_id, pl_Locked );
+            playlist_DeleteFromInput( p_playlist, p_item->p_input, pl_Locked );
     }
     PL_UNLOCK;
 
index 6921963e1dcf7873066be847438108db03b43e44..7f88fe2b34ae0d012ab6672ed296b5fb8179e28e 100644 (file)
@@ -211,6 +211,19 @@ void CloseVideoGL ( vlc_object_t * p_this )
     msg_Dbg( p_this, "Closing" );
 
 #ifndef __x86_64__
+    /* If the fullscreen window is still open, close it */
+    if( p_vout->b_fullscreen )
+    {
+        p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+        if( p_vout->p_sys->b_embedded )
+        {
+            aglManage( p_vout );
+            var_SetBool( p_vout->p_parent, "fullscreen", false );
+        }
+        else
+            Manage( p_vout );
+    }
+
     if( p_vout->p_sys->b_embedded )
     {
         if( p_vout->p_sys->agl_ctx )
index 709171597c9cf4da596c970070d40a9e0eacfc05..d2f8ec8d7f57fd9f8e953fd4ee7b2f969907f6a8 100644 (file)
@@ -656,7 +656,7 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
                 if( p_item->i_children == -1 )
                 {
                     playlist_DeleteFromInput( p_playlist,
-                                              p_item->p_input->i_id, pl_Locked );
+                                              p_item->p_input, pl_Locked );
                 }
                 else
                 {
index e1abc08bb1c0422bdcbabd31024c5db980da7fc1..9e4100ac28bb78cd9d1695b2362ecb548ef6b6e5 100644 (file)
@@ -91,7 +91,7 @@ static void PlaylistAddItem(GtkWidget *widget, gchar *name, char **ppsz_options,
 {
     intf_thread_t *p_intf = GtkGetIntf( widget );
     playlist_t    *p_playlist;
-    int           i_id , i_pos=0;
+    int           i_pos=0;
     GtkTreeView   *p_tvplaylist = NULL;
 
     p_playlist = pl_Hold( p_intf );
@@ -132,7 +132,7 @@ static void PlaylistAddItem(GtkWidget *widget, gchar *name, char **ppsz_options,
             else
 #endif
             {
-                i_id = playlist_AddExt( p_playlist, (const char*)name,
+                playlist_AddExt( p_playlist, (const char*)name,
                               (const char*)name,
                               PLAYLIST_APPEND, PLAYLIST_END,
                               (mtime_t) 0,
index f0f8297cb727deb236e0f2dfd9897805b4016e31..6c9a6d8c4d012ad1c01e0590ed4ca094a8a486e7 100644 (file)
@@ -141,7 +141,7 @@ int OpenAudio( vlc_object_t *p_this )
     }
     pp.format.voices         = i_nb_channels;
 
-    p_aout->output.output.i_format = AOUT_FMT_S16_NE;
+    p_aout->output.output.i_format = VLC_CODEC_S16N;
     p_aout->output.i_nb_samples = DEFAULT_FRAME_SIZE;
     pp.format.format = SND_PCM_SFMT_S16;
     i_bytes_per_sample = 2;
@@ -270,7 +270,7 @@ static void* QNXaoutThread( vlc_object_t *p_this )
         int i_tmp, i_size;
         uint8_t * p_bytes;
 
-        if ( p_aout->output.output.i_format != VLC_FOURCC('s','p','d','i') )
+        if ( p_aout->output.output.i_format != VLC_CODEC_SPDIFL )
         {
             mtime_t next_date = 0;
 
index f5a01cb72d24ca38d276bc6b0734cffd67556d36..ef775d1c285a8c9792beb78672a3365804994b0c 100644 (file)
@@ -592,13 +592,13 @@ static int QNXInitDisplay( vout_thread_t * p_vout )
     switch( p_vout->p_sys->i_screen_depth )
     {
         case 8:
-            p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB8;
             p_vout->p_sys->i_bytes_per_pixel = 1;
             p_vout->output.pf_setpalette = SetPalette;
             break;
 
         case 15:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5');
+            p_vout->output.i_chroma = VLC_CODEC_RGB15;
             p_vout->p_sys->i_bytes_per_pixel = 2;
             p_vout->output.i_rmask = 0x7c00;
             p_vout->output.i_gmask = 0x03e0;
@@ -606,7 +606,7 @@ static int QNXInitDisplay( vout_thread_t * p_vout )
             break;
 
         case 16:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+            p_vout->output.i_chroma = VLC_CODEC_RGB16;
             p_vout->p_sys->i_bytes_per_pixel = 2;
             p_vout->output.i_rmask = 0xf800;
             p_vout->output.i_gmask = 0x07e0;
@@ -614,7 +614,7 @@ static int QNXInitDisplay( vout_thread_t * p_vout )
             break;
 
         case 24:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4');
+            p_vout->output.i_chroma = VLC_CODEC_RGB24;
             p_vout->p_sys->i_bytes_per_pixel = 3;
             p_vout->output.i_rmask = 0xff0000;
             p_vout->output.i_gmask = 0x00ff00;
@@ -623,7 +623,7 @@ static int QNXInitDisplay( vout_thread_t * p_vout )
 
         case 32:
         default:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB32;
             p_vout->p_sys->i_bytes_per_pixel = 4;
             p_vout->output.i_rmask = 0xff0000;
             p_vout->output.i_gmask = 0x00ff00;
@@ -819,7 +819,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
         switch (p_vout->p_sys->i_vc_format)
         {
             case Pg_VIDEO_FORMAT_YUV420:
-                p_vout->output.i_chroma = VLC_FOURCC('I','4','2','0');
+                p_vout->output.i_chroma = VLC_CODEC_I420;
 
                 p_pic->p_sys->p_buf[U_PLANE] = PdGetOffscreenContextPtr( p_pic->p_sys->p_ctx[U_PLANE] );
                 p_pic->p_sys->p_buf[V_PLANE] = PdGetOffscreenContextPtr( p_pic->p_sys->p_ctx[V_PLANE] );
@@ -856,7 +856,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
                 break;
 
             case Pg_VIDEO_FORMAT_YV12:
-                p_vout->output.i_chroma = VLC_FOURCC('Y','V','1','2');
+                p_vout->output.i_chroma = VLC_CODEC_YV12;
 
                 p_pic->p_sys->p_buf[U_PLANE] = PdGetOffscreenContextPtr( p_pic->p_sys->p_ctx[U_PLANE] );
                 p_pic->p_sys->p_buf[V_PLANE] = PdGetOffscreenContextPtr( p_pic->p_sys->p_ctx[V_PLANE] );
@@ -896,11 +896,11 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
             case Pg_VIDEO_FORMAT_YUY2:
                 if (p_vout->p_sys->i_vc_format == Pg_VIDEO_FORMAT_UYVY)
                 {
-                    p_vout->output.i_chroma = VLC_FOURCC('U','Y','V','Y');
+                    p_vout->output.i_chroma = VLC_CODEC_UYVY;
                 }
                 else
                 {
-                    p_vout->output.i_chroma = VLC_FOURCC('Y','U','Y','2');
+                    p_vout->output.i_chroma = VLC_CODEC_YUYV;
                 }
 
                 p_pic->p->p_pixels = p_pic->p_sys->p_buf[Y_PLANE];
@@ -914,7 +914,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
                 break;
 
             case Pg_VIDEO_FORMAT_RGB555:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5');
+                p_vout->output.i_chroma = VLC_CODEC_RGB15;
                 p_vout->output.i_rmask = 0x001f;
                 p_vout->output.i_gmask = 0x03e0;
                 p_vout->output.i_bmask = 0x7c00;
@@ -930,7 +930,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
                 break;
 
             case Pg_VIDEO_FORMAT_RGB565:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+                p_vout->output.i_chroma = VLC_CODEC_RGB16;
                 p_vout->output.i_rmask = 0x001f;
                 p_vout->output.i_gmask = 0x07e0;
                 p_vout->output.i_bmask = 0xf800;
@@ -946,7 +946,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
                 break;
 
             case Pg_VIDEO_FORMAT_RGB8888:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+                p_vout->output.i_chroma = VLC_CODEC_RGB32;
                 p_vout->output.i_rmask = 0x000000ff;
                 p_vout->output.i_gmask = 0x0000ff00;
                 p_vout->output.i_bmask = 0x00ff0000;
@@ -966,7 +966,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic, int index )
     switch( p_vout->output.i_chroma )
     {
 #ifdef MODULE_NAME_IS_xvideo
-        case VLC_FOURCC('Y','2','1','1'):
+        case VLC_CODEC_Y211:
 
             p_pic->p->p_pixels = p_pic->p_sys->p_image->data
                                   + p_pic->p_sys->p_image->offsets[0];
index ce0f73e62cd9b8a9c9c5d8ab8bba1e96e3c4d703..a863447dd126ff98bcc9b7d3a539d489eaa5027d 100644 (file)
@@ -21,6 +21,7 @@ nodist_SOURCES_qt4 = \
                input_manager.moc.cpp \
                actions_manager.moc.cpp \
                recents.moc.cpp \
+               variables.moc.cpp \
                dialogs/playlist.moc.cpp \
                dialogs/bookmarks.moc.cpp \
                dialogs/mediainfo.moc.cpp \
@@ -195,6 +196,7 @@ SOURCES_qt4 =       qt4.cpp \
                input_manager.cpp \
                actions_manager.cpp \
                recents.cpp \
+               variables.cpp \
                dialogs/playlist.cpp \
                dialogs/bookmarks.cpp \
                dialogs/preferences.cpp \
@@ -241,6 +243,7 @@ noinst_HEADERS = \
        input_manager.hpp \
        actions_manager.hpp \
        recents.hpp \
+       variables.hpp \
        dialogs/playlist.hpp \
        dialogs/bookmarks.hpp \
        dialogs/mediainfo.hpp \
index 6b35a3609744cf4c80845c5c42f9c67ba75ae7d4..8df5220857d1f9422a44b35fa5e432486eb087be 100644 (file)
@@ -121,7 +121,7 @@ WId VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
 
 /* Set the Widget to the correct Size */
 /* Function has to be called by the parent
-   Parent has to care about resizing himself*/
+   Parent has to care about resizing itself */
 void VideoWidget::SetSizing( unsigned int w, unsigned int h )
 {
     msg_Dbg( p_intf, "Video is resizing to: %i %i", w, h );
@@ -404,24 +404,25 @@ void SpeedControlWidget::resetRate()
 }
 
 CoverArtLabel::CoverArtLabel( QWidget *parent, intf_thread_t *_p_i )
-        : QLabel( parent ), p_intf( _p_i )
+              : QLabel( parent ), p_intf( _p_i )
 {
     setContextMenuPolicy( Qt::ActionsContextMenu );
-    CONNECT( this, updateRequested(), this, doUpdate() );
+    CONNECT( this, updateRequested(), this, askForUpdate() );
     CONNECT( THEMIM->getIM(), artChanged( QString ),
-             this, doUpdate( const QString& ) );
+             this, showArtUpdate( const QString& ) );
 
     setMinimumHeight( 128 );
     setMinimumWidth( 128 );
     setMaximumHeight( 128 );
     setMaximumWidth( 128 );
     setScaledContents( true );
+
     QList< QAction* > artActions = actions();
     QAction *action = new QAction( qtr( "Download cover art" ), this );
+    CONNECT( action, triggered(), this, askForUpdate() );
     addAction( action );
-    CONNECT( action, triggered(), this, doUpdate() );
 
-    doUpdate( "" );
+    showArtUpdate( "" );
 }
 
 CoverArtLabel::~CoverArtLabel()
@@ -431,7 +432,7 @@ CoverArtLabel::~CoverArtLabel()
         removeAction( act );
 }
 
-void CoverArtLabel::doUpdate( const QString& url )
+void CoverArtLabel::showArtUpdate( const QString& url )
 {
     QPixmap pix;
     if( !url.isEmpty()  && pix.load( url ) )
@@ -444,7 +445,7 @@ void CoverArtLabel::doUpdate( const QString& url )
     }
 }
 
-void CoverArtLabel::doUpdate()
+void CoverArtLabel::askForUpdate()
 {
     THEMIM->getIM()->requestArtUpdate();
 }
index bec4d4badb20700e7a73091c3976be5de3d34922..a34158a0ff0bfee03aa16219363192be812668fc 100644 (file)
@@ -207,8 +207,8 @@ public slots:
     }
 
 private slots:
-    void doUpdate();
-    void doUpdate( const QString& );
+    void askForUpdate();
+    void showArtUpdate( const QString& );
 
 signals:
     void updateRequested();
index 31d1b184ae895ff589b61c1759f216f7504c1639..97e11d06b18a5e226fe627e3ef38fffe4b33a13e 100644 (file)
@@ -49,8 +49,6 @@ static int PlaylistChanged( vlc_object_t *, const char *,
                             vlc_value_t, vlc_value_t, void * );
 static int PlaylistNext( vlc_object_t *, const char *,
                          vlc_value_t, vlc_value_t, void * );
-static int ItemChanged( vlc_object_t *, const char *,
-                        vlc_value_t, vlc_value_t, void * );
 static int ItemAppended( vlc_object_t *p_this, const char *psz_variable,
                          vlc_value_t oval, vlc_value_t nval, void *param );
 static int ItemDeleted( vlc_object_t *p_this, const char *psz_variable,
@@ -234,7 +232,6 @@ void PLModel::addCallbacks()
 
 void PLModel::delCallbacks()
 {
-    var_DelCallback( p_playlist, "item-change", ItemChanged, this );
     /*
     var_DelCallback( p_playlist, "item-current", PlaylistNext, this );
     */
@@ -719,7 +716,7 @@ void PLModel::doDeleteItem( PLItem *item, QModelIndexList *fullList )
         return;
     }
     if( p_item->i_children == -1 )
-        playlist_DeleteFromInput( p_playlist, item->i_input_id, pl_Locked );
+        playlist_DeleteFromInput( p_playlist, p_item->p_input, pl_Locked );
     else
         playlist_NodeDelete( p_playlist, p_item, true, false );
     /* And finally, remove it from the tree */
@@ -959,15 +956,6 @@ static int PlaylistNext( vlc_object_t *p_this, const char *psz_variable,
     return VLC_SUCCESS;
 }
 
-static int ItemChanged( vlc_object_t *p_this, const char *psz_variable,
-                        vlc_value_t oval, vlc_value_t nval, void *param )
-{
-    PLModel *p_model = (PLModel *) param;
-    PLEvent *event = new PLEvent( ItemUpdate_Type, nval.i_int );
-    QApplication::postEvent( p_model, event );
-    return VLC_SUCCESS;
-}
-
 static int ItemDeleted( vlc_object_t *p_this, const char *psz_variable,
                         vlc_value_t oval, vlc_value_t nval, void *param )
 {
index 37a503725e5c22fae81aea9498faf87257f6aa43..af2818f4a5d7085be2ace30fad28b6e34fc585dc 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * external.hpp : Dialogs from other LibVLC core and other plugins
+ * external.cpp : Dialogs from other LibVLC core and other plugins
  ****************************************************************************
  * Copyright (C) 2009 Rémi Denis-Courmont
  * Copyright (C) 2006 the VideoLAN team
 #include <QProgressDialog>
 #include <QMutex>
 
-QVLCVariable::QVLCVariable (vlc_object_t *obj, const char *varname, int type)
-    : object (obj), name (qfu(varname))
-{
-    var_Create (object, qtu(name), type);
-    var_AddCallback (object, qtu(name), callback, this);
-}
-
-QVLCVariable::~QVLCVariable (void)
-{
-    var_DelCallback (object, qtu(name), callback, this);
-    var_Destroy (object, qtu(name));
-}
-
-int QVLCVariable::callback (vlc_object_t *object, const char *,
-                            vlc_value_t, vlc_value_t cur, void *data)
-{
-    QVLCVariable *self = (QVLCVariable *)data;
-
-    emit self->pointerChanged (object, cur.p_address);
-    return VLC_SUCCESS;
-}
-
-
 DialogHandler::DialogHandler (intf_thread_t *intf)
     : intf (intf),
       message (VLC_OBJECT(intf), "dialog-fatal", VLC_VAR_ADDRESS),
index d2894ef883f0981a89f1596763fd570da6b65fe1..dda635bc0a2413234f32ae6f28d8f93e51a46ee1 100644 (file)
 
 #include <QObject>
 #include <vlc_common.h>
-
-class QVLCVariable : public QObject
-{
-    Q_OBJECT
-private:
-    static int callback (vlc_object_t *, const char *,
-                         vlc_value_t, vlc_value_t, void *);
-    vlc_object_t *object;
-    QString name;
-
-public:
-    QVLCVariable (vlc_object_t *, const char *, int);
-    virtual ~QVLCVariable (void);
-
-signals:
-    void pointerChanged (vlc_object_t *, void *);
-};
+#include "variables.hpp"
 
 struct intf_thread_t;
 class QProgressDialog;
@@ -56,10 +40,10 @@ public:
 
 private:
     intf_thread_t *intf;
-    QVLCVariable message;
-    QVLCVariable login;
-    QVLCVariable question;
-    QVLCVariable progressBar;
+    QVLCPointer message;
+    QVLCPointer login;
+    QVLCPointer question;
+    QVLCPointer progressBar;
 signals:
     void progressBarDestroyed (QWidget *);
 
index 41a5ef34050cd8250814f045e798cbebd65e2664..eb3f242c38a3dc7f409eacc3b1206222896a92b4 100644 (file)
@@ -103,9 +103,9 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
          **/
         CONNECT( THEMIM->getIM(), infoChanged( input_item_t* ),
                  IP, update( input_item_t* ) );
-        CONNECT( THEMIM->getIM(), metaChanged( input_item_t* ),
+        CONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
                  MP, update( input_item_t* ) );
-        CONNECT( THEMIM->getIM(), metaChanged( input_item_t* ),
+        CONNECT( THEMIM->getIM(), currentMetaChanged( input_item_t* ),
                  EMP, update( input_item_t* ) );
         CONNECT( THEMIM->getIM(), statisticsUpdated( input_item_t* ),
                  ISP, update( input_item_t* ) );
index 0b456ad086193ae58c4b1e8c2a962ddf2a3bc139..fd2381a4b9c82e901f2ce38ada85e1d3c7d7eb46 100644 (file)
@@ -62,7 +62,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
     artUrl       = "";
     p_input      = NULL;
     i_rate       = 0;
-    i_input_id   = 0;
+    p_item       = NULL;
     b_video      = false;
     timeA        = 0;
     timeB        = 0;
@@ -92,12 +92,12 @@ void InputManager::setInput( input_thread_t *_p_input )
         UpdateNavigation();
         UpdateVout();
         addCallbacks();
-        i_input_id = input_GetItem( p_input )->i_id;
+        p_item = input_GetItem( p_input );
     }
     else
     {
         p_input = NULL;
-        i_input_id = 0;
+        p_item = NULL;
         emit rateChanged( INPUT_RATE_DEFAULT );
     }
 }
@@ -112,7 +112,7 @@ void InputManager::delInput()
 
     delCallbacks();
     i_old_playing_status = END_S;
-    i_input_id           = 0;
+    p_item               = NULL;
     oldName              = "";
     artUrl               = "";
     b_video              = false;
@@ -137,7 +137,7 @@ void InputManager::delInput()
     /* Reset all InfoPanels but stats */
     emit artChanged( NULL );
     emit infoChanged( NULL );
-    emit metaChanged( (input_item_t *)NULL );
+    emit currentMetaChanged( (input_item_t *)NULL );
 
     emit encryptionChanged( false );
     emit recordingStateChanged( false );
@@ -170,14 +170,14 @@ void InputManager::customEvent( QEvent *event )
         break;
     case ItemChanged_Type:
         /* Ignore ItemChanged_Type event that does not apply to our input */
-        if( i_input_id == ple->i_id )
+        if( p_item == ple->p_item )
         {
             UpdateStatus();
             // UpdateName();
             UpdateArt();
             /* Update duration of file */
         }
-        UpdateMeta( ple->i_id );
+        UpdateMeta( ple->p_item->i_id );
         break;
     case ItemStateChanged_Type:
         // TODO: Fusion with above state
@@ -255,8 +255,9 @@ static int ItemChanged( vlc_object_t *p_this, const char *psz_var,
                         vlc_value_t oldval, vlc_value_t newval, void *param )
 {
     InputManager *im = (InputManager*)param;
+    input_item_t *p_item = static_cast<input_item_t *>(newval.p_address);
 
-    IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
+    IMEvent *event = new IMEvent( ItemChanged_Type, p_item );
     QApplication::postEvent( im, event );
     return VLC_SUCCESS;
 }
@@ -270,73 +271,74 @@ static int InputEvent( vlc_object_t *p_this, const char *,
     switch( newval.i_int )
     {
     case INPUT_EVENT_STATE:
-        event = new IMEvent( ItemStateChanged_Type, 0 );
+        event = new IMEvent( ItemStateChanged_Type );
         break;
     case INPUT_EVENT_RATE:
-        event = new IMEvent( ItemRateChanged_Type, 0 );
+        event = new IMEvent( ItemRateChanged_Type );
         break;
-    case INPUT_EVENT_TIMES:
-        event = new IMEvent( PositionUpdate_Type, 0 );
+    case INPUT_EVENT_POSITION:
+    //case INPUT_EVENT_LENGTH:
+        event = new IMEvent( PositionUpdate_Type );
         break;
 
     case INPUT_EVENT_TITLE:
     case INPUT_EVENT_CHAPTER:
-        event = new IMEvent( ItemTitleChanged_Type, 0 );
+        event = new IMEvent( ItemTitleChanged_Type );
         break;
 
     case INPUT_EVENT_ES:
-        event = new IMEvent( ItemEsChanged_Type, 0 );
+        event = new IMEvent( ItemEsChanged_Type );
         break;
     case INPUT_EVENT_TELETEXT:
-        event = new IMEvent( ItemTeletextChanged_Type, 0 );
+        event = new IMEvent( ItemTeletextChanged_Type );
         break;
 
     case INPUT_EVENT_STATISTICS:
-        event = new IMEvent( StatisticsUpdate_Type, 0 );
+        event = new IMEvent( StatisticsUpdate_Type );
         break;
 
     case INPUT_EVENT_VOUT:
-        event = new IMEvent( InterfaceVoutUpdate_Type, 0 );
+        event = new IMEvent( InterfaceVoutUpdate_Type );
         break;
     case INPUT_EVENT_AOUT:
-        event = new IMEvent( InterfaceAoutUpdate_Type, 0 );
+        event = new IMEvent( InterfaceAoutUpdate_Type );
         break;
 
     case INPUT_EVENT_ITEM_META: /* Codec MetaData + Art */
-        event = new IMEvent( MetaChanged_Type, 0 );
+        event = new IMEvent( MetaChanged_Type );
         break;
     case INPUT_EVENT_ITEM_INFO: /* Codec Info */
-        event = new IMEvent( InfoChanged_Type, 0 );
+        event = new IMEvent( InfoChanged_Type );
         break;
     case INPUT_EVENT_ITEM_NAME:
-        event = new IMEvent( NameChanged_Type, 0 );
+        event = new IMEvent( NameChanged_Type );
         break;
 
     case INPUT_EVENT_AUDIO_DELAY:
     case INPUT_EVENT_SUBTITLE_DELAY:
-        event = new IMEvent( SynchroChanged_Type, 0 );
+        event = new IMEvent( SynchroChanged_Type );
         break;
 
     case INPUT_EVENT_CACHE:
-        event = new IMEvent( CachingEvent_Type, 0 );
+        event = new IMEvent( CachingEvent_Type );
         break;
 
     case INPUT_EVENT_BOOKMARK:
-        event = new IMEvent( BookmarksChanged_Type, 0 );
+        event = new IMEvent( BookmarksChanged_Type );
         break;
 
     case INPUT_EVENT_RECORD:
-        event = new IMEvent( RecordingEvent_Type, 0 );
+        event = new IMEvent( RecordingEvent_Type );
         break;
 
     case INPUT_EVENT_PROGRAM:
         /* This is for PID changes */
-        event = new IMEvent( ProgramChanged_Type, 0 );
+        event = new IMEvent( ProgramChanged_Type );
         break;
 
     case INPUT_EVENT_SIGNAL:
         /* This is for capture-card signals */
-        /* event = new IMEvent( SignalChanged_Type, 0 );
+        /* event = new IMEvent( SignalChanged_Type );
         break; */
     default:
         event = NULL;
@@ -352,7 +354,7 @@ static int VbiEvent( vlc_object_t *, const char *,
                      vlc_value_t, vlc_value_t, void *param )
 {
     InputManager *im = (InputManager*)param;
-    IMEvent *event = new IMEvent( ItemTeletextChanged_Type, 0 );
+    IMEvent *event = new IMEvent( ItemTeletextChanged_Type );
 
     QApplication::postEvent( im, event );
     return VLC_SUCCESS;
@@ -394,12 +396,11 @@ void InputManager::UpdateNavigation()
 void InputManager::UpdateStatus()
 {
     /* Update playing status */
-    vlc_value_t val; val.i_int = 0;
-    var_Get( p_input, "state", &val );
-    if( i_old_playing_status != val.i_int )
+    int state = var_GetInteger( p_input, "state" );
+    if( i_old_playing_status != state )
     {
-        i_old_playing_status = val.i_int;
-        emit statusChanged( val.i_int );
+        i_old_playing_status = state;
+        emit statusChanged( state );
     }
 }
 
@@ -611,7 +612,7 @@ inline void InputManager::UpdateMeta( int id )
 
 inline void InputManager::UpdateMeta()
 {
-    emit metaChanged( input_GetItem( p_input ) );
+    emit currentMetaChanged( input_GetItem( p_input ) );
 }
 
 inline void InputManager::UpdateInfo()
@@ -884,10 +885,18 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
              im, setInput( input_thread_t * ) );
 
     /* emit check if playlist has already started playing */
-    IMEvent *event = new IMEvent( ItemChanged_Type,
-                                  var_GetInteger( THEPL, "item-current" ) );
-    customEvent( event );
-    delete event;
+    input_thread_t *p_input = playlist_CurrentInput( THEPL );
+    if( p_input )
+    {
+        input_item_t *p_item = input_GetItem( p_input );
+        if( p_item )
+        {
+            IMEvent *event = new IMEvent( ItemChanged_Type, p_item );
+            customEvent( event );
+            delete event;
+        }
+        vlc_object_release( p_input );
+    }
 }
 
 MainInputManager::~MainInputManager()
@@ -1003,11 +1012,11 @@ void MainInputManager::activatePlayQuit( bool b_exit )
 
 /* Static callbacks for MIM */
 static int PLItemChanged( vlc_object_t *p_this, const char *psz_var,
-                        vlc_value_t oldval, vlc_value_t newval, void *param )
+                        vlc_value_t oldval, vlc_value_t, void *param )
 {
     MainInputManager *mim = (MainInputManager*)param;
 
-    IMEvent *event = new IMEvent( ItemChanged_Type, newval.i_int );
+    IMEvent *event = new IMEvent( ItemChanged_Type );
     QApplication::postEvent( mim, event );
     return VLC_SUCCESS;
 }
@@ -1017,7 +1026,7 @@ static int VolumeChanged( vlc_object_t *p_this, const char *psz_var,
 {
     MainInputManager *mim = (MainInputManager*)param;
 
-    IMEvent *event = new IMEvent( VolumeChanged_Type, newval.i_int );
+    IMEvent *event = new IMEvent( VolumeChanged_Type );
     QApplication::postEvent( mim, event );
     return VLC_SUCCESS;
 }
index d9b6630b28691648fc51c2120268ce0034b90e82..98a1bbe36832f796aaac495b56251a1f93035a58 100644 (file)
@@ -71,12 +71,20 @@ class IMEvent : public QEvent
 {
 friend class InputManager;
     public:
-    IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
-    { i_id = id ; }
-    virtual ~IMEvent() {}
+    IMEvent( int type, input_item_t *p_input = NULL )
+        : QEvent( (QEvent::Type)(type) )
+    {
+        if( (p_item = p_input) != NULL )
+            vlc_gc_incref( p_item );
+    }
+    virtual ~IMEvent()
+    {
+        if( p_item )
+            vlc_gc_decref( p_item );
+    }
 
 private:
-    int i_id;
+    input_item_t *p_item;
 };
 
 class InputManager : public QObject
@@ -106,7 +114,7 @@ public:
 private:
     intf_thread_t  *p_intf;
     input_thread_t *p_input;
-    int             i_input_id;
+    input_item_t   *p_item;
     int             i_old_playing_status;
     QString         oldName;
     QString         artUrl;
@@ -177,7 +185,7 @@ signals:
     /// Statistics are updated
     void statisticsUpdated( input_item_t* );
     void infoChanged( input_item_t* );
-    void metaChanged( input_item_t* );
+    void currentMetaChanged( input_item_t* );
     void metaChanged( int );
     void artChanged( QString );
     /// Play/pause status
index 0bde8ff48183de77858407a11509becbe32228ca..33cbba1f663abfbf0199a21388206aa9b488d7da 100644 (file)
@@ -761,7 +761,7 @@ void MainInterface::releaseVideoSlot( void )
     videoIsActive = false;
 
     /* Try to resize, except when you are in Fullscreen mode */
-    if( !isFullScreen() ) doComponentsUpdate();
+    doComponentsUpdate();
 }
 
 /* Call from WindowControl function */
index d522a8b7ae7719e85745307e42e66c9a31cf7fce..1d39a81685cf09830bf050aea9d09187742a3312 100644 (file)
@@ -183,7 +183,6 @@ signals:
     void askReleaseVideo( );
     void askVideoToResize( unsigned int, unsigned int );
     void askVideoToShow( unsigned int, unsigned int );
-    void askVideoToToggle();
     void askBgWidgetToToggle();
     void askUpdate();
     void minimalViewToggled( bool );
index ec2efbe96c6fc0e27393c56d10dff48d6570cab1..e3507754cc7266bd9ba034d0578c5ba0bd59c50b 100644 (file)
@@ -350,17 +350,6 @@ static void *Thread( void *obj )
 
     Q_INIT_RESOURCE( vlc );
 
-#if !defined(WIN32) && !defined(__APPLE__)
-    /* KLUDGE:
-     * disables icon theme use because that makes Cleanlooks style bug
-     * because it asks gconf for some settings that timeout because of threads
-     * see commits 21610 21622 21654 for reference */
-
-    /* If you don't have a gconftool-2 binary, you should comment this line */
-    if( strcmp( qVersion(), "4.4.0" ) < 0 ) /* fixed in Qt 4.4.0 */
-        QApplication::setDesktopSettingsAware( false );
-#endif
-
     /* Start the QApplication here */
 #ifdef Q_WS_X11
     char *display = var_CreateGetNonEmptyString( p_intf, "x11-display" );
index dbcd04f7aa47f8a311e575d1f298b0ad6a9c43e4..6bde27156959e2756d58fe83ba01014ac090cabe 100644 (file)
@@ -36,7 +36,7 @@
 #include <QEvent>
 #include <QString>
 
-#if ( QT_VERSION < 0x040300 )
+#if ( QT_VERSION < 0x040400 )
 # error Update your Qt version
 #endif
 #if QT_VERSION == 0x040500
index 82a20e137cb78b74a9a339af9438130f44765403..bb6768e69bca90992b31ad943e7ea8fc70490311 100644 (file)
 #include <QRegExp>
 #include <QSignalMapper>
 
+#ifdef WIN32
+#include <shlobj.h>
+#endif
+
 RecentsMRL* RecentsMRL::instance = NULL;
 
 RecentsMRL::RecentsMRL( intf_thread_t *_p_intf ) : p_intf( _p_intf )
@@ -66,7 +70,9 @@ void RecentsMRL::addRecent( const QString &mrl )
 {
     if ( !isActive || ( filter && filter->indexIn( mrl ) >= 0 ) )
         return;
-
+#ifdef WIN32
+    SHAddToRecentDocs( 0x00000002 , qtu( mrl ) );
+#endif
     msg_Dbg( p_intf, "Adding a new MRL to recent ones: %s", qtu( mrl ) );
     int i_index = stack->indexOf( mrl );
     if( 0 <= i_index )
@@ -82,6 +88,7 @@ void RecentsMRL::addRecent( const QString &mrl )
     }
     QVLCMenu::updateRecents( p_intf );
     save();
+
 }
 
 void RecentsMRL::clear()
diff --git a/modules/gui/qt4/variables.cpp b/modules/gui/qt4/variables.cpp
new file mode 100644 (file)
index 0000000..36da23b
--- /dev/null
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * variables.cpp : VLC variable class
+ ****************************************************************************
+ * Copyright (C) 2009 Rémi Denis-Courmont
+ * Copyright (C) 2006 the VideoLAN team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "qt4.hpp"
+#include "variables.hpp"
+
+QVLCVariable::QVLCVariable (vlc_object_t *obj, const char *varname, int type,
+                            bool inherit)
+    : object (obj), name (qfu(varname))
+{
+    vlc_object_hold (object);
+
+    if (inherit)
+        type |= VLC_VAR_DOINHERIT;
+    var_Create (object, qtu(name), type);
+    var_AddCallback (object, qtu(name), callback, this);
+}
+
+QVLCVariable::~QVLCVariable (void)
+{
+    var_DelCallback (object, qtu(name), callback, this);
+    var_Destroy (object, qtu(name));
+    vlc_object_release (object);
+}
+
+int QVLCVariable::callback (vlc_object_t *object, const char *,
+                            vlc_value_t old, vlc_value_t cur, void *data)
+{
+    QVLCVariable *self = static_cast<QVLCVariable *>(data);
+
+    self->trigger (self->object, old, cur);
+    return VLC_SUCCESS;
+}
+
+
+QVLCPointer::QVLCPointer (vlc_object_t *obj, const char *varname, bool inherit)
+    : QVLCVariable (obj, varname, VLC_VAR_ADDRESS, inherit)
+{
+}
+
+void QVLCPointer::trigger (vlc_object_t *obj, vlc_value_t old, vlc_value_t cur)
+{
+    emit pointerChanged (obj, old.p_address, cur.p_address);
+    emit pointerChanged (obj, cur.p_address);
+}
+
+
+QVLCInteger::QVLCInteger (vlc_object_t *obj, const char *varname, bool inherit)
+    : QVLCVariable (obj, varname, VLC_VAR_INTEGER, inherit)
+{
+}
+
+void QVLCInteger::trigger (vlc_object_t *obj, vlc_value_t old, vlc_value_t cur)
+{
+    emit integerChanged (obj, old.i_int, cur.i_int);
+    emit integerChanged (obj, cur.i_int);
+}
diff --git a/modules/gui/qt4/variables.hpp b/modules/gui/qt4/variables.hpp
new file mode 100644 (file)
index 0000000..40d414c
--- /dev/null
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * external.hpp : Dialogs from other LibVLC core and other plugins
+ ****************************************************************************
+ * Copyright (C) 2009 Rémi Denis-Courmont
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef QVLC_VARIABLES_H_
+#define QVLC_VARIABLES_H_ 1
+
+#include <QObject>
+#include <vlc_common.h>
+
+class QVLCVariable : public QObject
+{
+    Q_OBJECT
+private:
+    static int callback (vlc_object_t *, const char *,
+                         vlc_value_t, vlc_value_t, void *);
+    vlc_object_t *object;
+    QString name;
+    virtual void trigger (vlc_object_t *, vlc_value_t, vlc_value_t) = 0;
+
+public:
+    QVLCVariable (vlc_object_t *, const char *, int, bool);
+    virtual ~QVLCVariable (void);
+};
+
+class QVLCPointer : public QVLCVariable
+{
+    Q_OBJECT
+private:
+    virtual void trigger (vlc_object_t *, vlc_value_t, vlc_value_t);
+
+public:
+    QVLCPointer (vlc_object_t *, const char *, bool inherit = false);
+
+signals:
+    void pointerChanged (vlc_object_t *, void *, void *);
+    void pointerChanged (vlc_object_t *, void *);
+};
+
+class QVLCInteger : public QVLCVariable
+{
+    Q_OBJECT
+private:
+    virtual void trigger (vlc_object_t *, vlc_value_t, vlc_value_t);
+
+public:
+    QVLCInteger (vlc_object_t *, const char *, bool inherit = false);
+
+signals:
+    void integerChanged (vlc_object_t *, int, int);
+    void integerChanged (vlc_object_t *, int);
+};
+
+#endif
index 1724b49844ff19b00cf25b3ee242c09c8c86dd68..5ab377d5cd6522e52a34cd9e167a9812cd3d43fb 100644 (file)
@@ -39,7 +39,7 @@ FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
     video_format_t fmt_in = {0}, fmt_out = {0};
     picture_t *pPic;
 
-    fmt_out.i_chroma = VLC_FOURCC('R','G','B','A');
+    fmt_out.i_chroma = VLC_CODEC_RGBA;
 
     pPic = image_ReadUrl( pImageHandler, fileName.c_str(), &fmt_in, &fmt_out );
     if( !pPic ) return;
index 4c890150e2097bb449cf7c4b37a4dce13cfa9434..a2dcd273008cb672184e353c1a0ec6579ea1cd29 100644 (file)
@@ -410,17 +410,18 @@ int VlcProc::onIntfShow( vlc_object_t *pObj, const char *pVariable,
 
 
 int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,
-                           vlc_value_t oldVal, vlc_value_t newVal,
+                           vlc_value_t oldval, vlc_value_t newval,
                            void *pParam )
 {
     VlcProc *pThis = (VlcProc*)pParam;
+    input_item_t *p_item = static_cast<input_item_t*>(newval.p_address);
 
     // Update the stream variable
     pThis->updateStreamName();
 
     // Create a playtree notify command
     CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
-                                                         newVal.i_int );
+                                                         p_item->i_id );
 
     // Push the command in the asynchronous command queue
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
@@ -474,10 +475,11 @@ int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,
 
 
 int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
-                               vlc_value_t oldVal, vlc_value_t newVal,
+                               vlc_value_t oldval, vlc_value_t newval,
                                void *pParam )
 {
     VlcProc *pThis = (VlcProc*)pParam;
+    input_item_t *p_item = static_cast<input_item_t*>(newval.p_address);
 
     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
 
@@ -485,10 +487,13 @@ int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
     pThis->updateStreamName();
 
     // Create two playtree notify commands: one for old item, one for new
+#if 0 /* FIXME: Heck, no! You cannot do that.
+         There is no warranty that the old item is still valid. */
     CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
                                                          oldVal.i_int );
     pQueue->push( CmdGenericPtr( pCmdTree ) , true );
-    pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), newVal.i_int );
+#endif
+    CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), p_item->i_id );
     pQueue->push( CmdGenericPtr( pCmdTree ) , true );
 
     return VLC_SUCCESS;
index 839b928291b101a03be093d42fb6cf0295104157..3dc32ab8af3d3b8eead399dd4cffcdbebdccd584 100644 (file)
@@ -74,7 +74,7 @@ void Playtree::delSelected()
             if( p_item->i_children == -1 )
             {
                 playlist_DeleteFromInput( getIntf()->p_sys->p_playlist,
-                                          p_item->p_input->i_id, pl_Locked );
+                                          p_item->p_input, pl_Locked );
                 it2 = getNextVisibleItem( it ) ;
                 it->parent()->removeChild( it );
                 it = it2;
index fd695a4b8ff09051db0517036acb26104f9bdf79..8eebda56a780f0c1dfc2c98d9dd227870b9d5a03 100644 (file)
@@ -700,7 +700,7 @@ void Playlist::UpdateItem( int i )
 /**********************************************************************
  * Private functions
  **********************************************************************/
-void Playlist::DeleteItem( initem )
+void Playlist::DeleteItem( input_item_t *item )
 {
     playlist_t *p_playlist = pl_Hold( p_intf );
     if( p_playlist == NULL ) return;
index 554a37ac5c1814b738fb6fdffba3afd6ee2be0ed..012dab91d425bdfa31f6cb59c79c471c917e780c 100644 (file)
@@ -403,7 +403,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
                     psz_help = config_CategoryHelpGet( p_item->value.i );
                     if( psz_help )
                     {
-                        config_data->psz_help = wraptext( strdup( psz_help ), 72 );
+                        config_data->psz_help = strdup( psz_help );
                     }
                     else
                     {
@@ -447,7 +447,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
                         const char *psz_help = config_CategoryHelpGet( p_item->value.i );
                         if( psz_help )
                         {
-                            config_data->psz_help = wraptext( strdup( psz_help ), 72 );
+                            config_data->psz_help = strdup( psz_help );
                         }
                         else
                         {
@@ -462,7 +462,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
                     psz_help = config_CategoryHelpGet( p_item->value.i );
                     if( psz_help )
                     {
-                        config_data->psz_help = wraptext( strdup( psz_help ), 72 );
+                        config_data->psz_help = strdup( psz_help );
                     }
                     else
                     {
index 3bf2fc98b455a6320ee1a0b05352f9484c0b8f81..7fc13d4354f0f44bb35c5cb6d15b44c585eef85e 100644 (file)
@@ -171,14 +171,11 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
                                     int * py_pos )
   : ConfigControl( p_this, p_item, parent, hInst )
 {
-    // Number of keys descriptions
-    unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t);
-
     // Init the keys decriptions array
     if( m_keysList == NULL )
     {
-        m_keysList = new string[i_keys];
-        for( unsigned int i = 0; i < i_keys; i++ )
+        m_keysList = new string[vlc_num_keys];
+        for( size_t i = 0; i < vlc_num_keys; ++i )
         {
             m_keysList[i] = vlc_keys[i].psz_key_string;
         }
@@ -233,7 +230,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
 
     *py_pos += 15 + 10;
 
-    for( unsigned int i = 0; i < i_keys ; i++ )
+    for( size_t i = 0; i < vlc_num_keys ; ++i )
     {
         ComboBox_AddString( combo, _FROMMB(m_keysList[i].c_str()) );
         ComboBox_SetItemData( combo, i, (void*)vlc_keys[i].i_key_code );
index a5b62d37b14ca377cde1e30c50a041de5a41b45f..e648a335d2fb41d85e63789d882227f277b4ebc8 100644 (file)
@@ -52,7 +52,7 @@ int OpenAudio ( vlc_object_t * p_this )
     p_aout->output.pf_play = Play;
     aout_VolumeSoftInit( p_aout );
 
-    if ( p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i') )
+    if ( p_aout->output.output.i_format == VLC_CODEC_SPDIFL )
     {
         p_aout->output.i_nb_samples = A52_FRAME_NB;
         p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
index 0b4cdbb481968df2e71d4a81845dd575176e7a5b..3311041e03d671edbbf29cd578ef21809d39442f 100644 (file)
@@ -89,17 +89,9 @@ static int Init( vout_thread_t *p_vout )
     bool b_chroma = 0;
 
     psz_chroma = config_GetPsz( p_vout, "dummy-chroma" );
-    if( psz_chroma )
-    {
-        if( strlen( psz_chroma ) >= 4 )
-        {
-            i_chroma = VLC_FOURCC( psz_chroma[0], psz_chroma[1],
-                                   psz_chroma[2], psz_chroma[3] );
-            b_chroma = 1;
-        }
-
-        free( psz_chroma );
-    }
+    i_chroma = vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_chroma );
+    b_chroma = i_chroma != 0;
+    free( psz_chroma );
 
     I_OUTPUTPICTURES = 0;
 
@@ -109,7 +101,7 @@ static int Init( vout_thread_t *p_vout )
         msg_Dbg( p_vout, "forcing chroma 0x%.8x (%4.4s)",
                          i_chroma, (char*)&i_chroma );
         p_vout->output.i_chroma = i_chroma;
-        if ( i_chroma == VLC_FOURCC( 'R', 'G', 'B', '2' ) )
+        if ( i_chroma == VLC_CODEC_RGB8 )
         {
             p_vout->output.pf_setpalette = SetPalette;
         }
index 7e458663d77eb3f342480ac2cdc31684f5a88afe..11d7bb8c5d7c4f5e303b17268d6ee0c6fc01ea58 100644 (file)
@@ -655,7 +655,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','P');
+    fmt.i_chroma = VLC_CODEC_YUVP;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_visible_width = i_width + 4;
     fmt.i_height = fmt.i_visible_height = i_height + 4;
@@ -921,7 +921,7 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region,
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt.i_chroma = VLC_CODEC_YUVA;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_visible_width = i_width + 6;
     fmt.i_height = fmt.i_visible_height = i_height + 6;
index 58ce8c0bccdc456dbb87a75e82fab7d4c3acdaab..9e839a7947cc3d7476af849ccd984fcbfcec91ec 100644 (file)
@@ -318,7 +318,19 @@ static int vlclua_playlist_search( lua_State *L )
 static int vlclua_playlist_current( lua_State *L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
-    lua_pushinteger( L, var_GetInteger( p_playlist, "item-current" ) );
+    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+    int id = -1;
+
+    if( p_input )
+    {
+        input_item_t *p_item = input_GetItem( p_input );
+        if( p_item )
+            id = p_item->i_id;
+        vlc_object_release( p_input );
+    }
+
+#warning Indexing input items by ID is unsafe,
+    lua_pushinteger( L, id );
     vlclua_release_playlist_internal( p_playlist );
     return 1;
 }
index 7b55a8a49ca5015f19179c3c394eb190c8f446c6..c89c58792e96a998ac2a69e467ea80f67fd227e5 100644 (file)
@@ -173,17 +173,19 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     playlist_t* p_playlist = (playlist_t*) p_this;
     char *psz_buf = NULL;
     input_thread_t *p_input;
+    input_item_t *p_item = newval.p_address;
     bool b_is_item_current = !strcmp( "item-current", psz_var );
 
     /* Don't update Telepathy presence each time an item has been preparsed */
     if( b_is_item_current )
     { /* stores the current input item id */
-        p_intf->p_sys->i_id = newval.i_int;
+        p_intf->p_sys->i_id = p_item->i_id;
         p_intf->p_sys->i_item_changes = 0;
     }
     else
     {
-        if( newval.i_int != p_intf->p_sys->i_id ) /* "item-change" */
+
+        if( p_item->i_id != p_intf->p_sys->i_id ) /* "item-change" */
             return VLC_SUCCESS;
         /* Some variable bitrate inputs call "item-change callbacks each time
          * their length is updated, that is several times per second.
index f5d8704f050253abf496438ab47844fee79f7bc8..f7b95d3ac8976305ef23a98d15e483e716b17587 100644 (file)
@@ -199,7 +199,7 @@ osd_state_t *osd_StateNew( osd_menu_t *p_menu, const char *psz_file,
     memset( &fmt_in, 0, sizeof(video_format_t) );
     memset( &fmt_out, 0, sizeof(video_format_t) );
 
-    fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt_out.i_chroma = VLC_CODEC_YUVA;
     if( p_menu->p_image )
     {
         p_state->p_pic = image_ReadUrl( p_menu->p_image, psz_file,
index a19c2a3cfd1df8829067bed9277187d67c2dcba1..b3b92445c749cd934e66708d9aff9a3caa518417 100644 (file)
@@ -838,7 +838,7 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region, UniCha
 
     // Create a new subpicture region
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt.i_chroma = VLC_CODEC_YUVA;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_visible_width = i_width;
     fmt.i_height = fmt.i_visible_height = i_textblock_height + VERTICAL_MARGIN * 2;
index ee23ed54d3002efdfeee40b7a89bedde3587febb..a87dc3fcf6393acfbde725b6069739be7297c02b 100644 (file)
@@ -538,7 +538,7 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
 
     switch( p_fmt->i_codec )
     {
-        case VLC_FOURCC( 's', '1', '6', 'b' ):
+        case VLC_CODEC_S16B:
             if( p_fmt->audio.i_channels == 1 && p_fmt->audio.i_rate == 44100 )
             {
                 p_es->i_payload_type = 11;
@@ -556,31 +556,30 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
                           p_fmt->audio.i_channels ) == -1 )
                 p_es->psz_rtpmap = NULL;
             break;
-        case VLC_FOURCC( 'u', '8', ' ', ' ' ):
+        case VLC_CODEC_U8:
             p_es->i_payload_type = p_media->i_payload_type++;
             if( asprintf( &p_es->psz_rtpmap, "L8/%d/%d", p_fmt->audio.i_rate,
                           p_fmt->audio.i_channels ) == -1 )
                 p_es->psz_rtpmap = NULL;
             break;
-        case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
-        case VLC_FOURCC( 'm', 'p', '3', ' ' ):
+        case VLC_CODEC_MPGA:
             p_es->i_payload_type = 14;
             p_es->psz_rtpmap = strdup( "MPA/90000" );
             break;
-        case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
+        case VLC_CODEC_MPGV:
             p_es->i_payload_type = 32;
             p_es->psz_rtpmap = strdup( "MPV/90000" );
             break;
-        case VLC_FOURCC( 'a', '5', '2', ' ' ):
+        case VLC_CODEC_A52:
             p_es->i_payload_type = p_media->i_payload_type++;
             if( asprintf( &p_es->psz_rtpmap, "ac3/%d", p_fmt->audio.i_rate ) == -1 )
                 p_es->psz_rtpmap = NULL;
             break;
-        case VLC_FOURCC( 'H', '2', '6', '3' ):
+        case VLC_CODEC_H263:
             p_es->i_payload_type = p_media->i_payload_type++;
             p_es->psz_rtpmap = strdup( "H263-1998/90000" );
             break;
-        case VLC_FOURCC( 'h', '2', '6', '4' ):
+        case VLC_CODEC_H264:
             p_es->i_payload_type = p_media->i_payload_type++;
             p_es->psz_rtpmap = strdup( "H264/90000" );
             p_es->psz_fmtp = NULL;
@@ -646,7 +645,7 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
             if( !p_es->psz_fmtp )
                 p_es->psz_fmtp = strdup( "packetization-mode=1" );
             break;
-        case VLC_FOURCC( 'm', 'p', '4', 'v' ):
+        case VLC_CODEC_MP4V:
             p_es->i_payload_type = p_media->i_payload_type++;
             p_es->psz_rtpmap = strdup( "MP4V-ES/90000" );
             if( p_fmt->i_extra > 0 )
@@ -659,7 +658,7 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
                 free( p_hexa );
             }
             break;
-        case VLC_FOURCC( 'm', 'p', '4', 'a' ):
+        case VLC_CODEC_MP4A:
             p_es->i_payload_type = p_media->i_payload_type++;
             if( asprintf( &p_es->psz_rtpmap, "mpeg4-generic/%d", p_fmt->audio.i_rate ) == -1 )
                 p_es->psz_rtpmap = NULL;
@@ -685,13 +684,13 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
             p_es->i_payload_type = p_media->i_payload_type++;
             p_es->psz_rtpmap = strdup( "MP2P/90000" );
             break;
-        case VLC_FOURCC( 's', 'a', 'm', 'r' ):
+        case VLC_CODEC_AMR_NB:
             p_es->i_payload_type = p_media->i_payload_type++;
             p_es->psz_rtpmap = strdup( p_fmt->audio.i_channels == 2 ?
                                     "AMR/8000/2" : "AMR/8000" );
             p_es->psz_fmtp = strdup( "octet-align=1" );
             break;
-        case VLC_FOURCC( 's', 'a', 'w', 'b' ):
+        case VLC_CODEC_AMR_WB:
             p_es->i_payload_type = p_media->i_payload_type++;
             p_es->psz_rtpmap = strdup( p_fmt->audio.i_channels == 2 ?
                                     "AMR-WB/16000/2" : "AMR-WB/16000" );
index b5d89460d72d0baa8240a85745f802b8ae58cd00..3944b1a61f494dfa2bbb5b5961212cbba43612b1 100644 (file)
@@ -34,8 +34,6 @@
 #include <vlc_plugin.h>
 #include <vlc_input.h>
 #include <vlc_interface.h>
-#include <vlc_aout.h>
-#include <vlc_vout.h>
 
 #include <sys/types.h>
 #include <sys/wait.h>
index 5d9fa0a0998ccfdcb795b0906b56569030bc5d79..80899db50f1230e4fe743820084753a892b0ad00 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <vlc_common.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 
 #include "stats.h"
 
@@ -54,7 +53,7 @@ int OpenDecoder ( vlc_object_t *p_this )
     p_dec->pf_decode_sub = NULL;
 
     /* */
-    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_FOURCC('I','4','2','0') );
+    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_I420 );
     p_dec->fmt_out.video.i_width = 100;
     p_dec->fmt_out.video.i_height = 100;
     p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR;
index 74858ac1f28b28703b15c99f485fe55b0bf06195..4b7461d17aa235d5a22f3cc4069172794976ccd3 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <vlc_common.h>
 #include <vlc_codec.h>
-#include <vlc_vout.h>
 
 #include "stats.h"
 
index a765e3dd8a715929fb9e2b6b03a830e3ad054ebe..a9236f50f3ea8d37a8015cc9ee059dc5e02cbbf1 100644 (file)
@@ -109,7 +109,7 @@ static int Init( vout_thread_t *p_vout )
         msg_Dbg( p_vout, "forcing chroma 0x%.8x (%4.4s)",
                          i_chroma, (char*)&i_chroma );
         p_vout->output.i_chroma = i_chroma;
-        if ( i_chroma == VLC_FOURCC( 'R', 'G', 'B', '2' ) )
+        if ( i_chroma == VLC_CODEC_RGB8 )
         {
             p_vout->output.pf_setpalette = SetPalette;
         }
index 28e1b77b89139201253d238b6d5c3f732a37cd44..c6cf3d140c97f60e2bf40cbe3a73a4baba2af1c2 100644 (file)
@@ -277,7 +277,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof( video_format_t ) );
-    fmt.i_chroma = VLC_FOURCC( 'Y','U','V','A' );
+    fmt.i_chroma = VLC_CODEC_YUVA;
     fmt.i_aspect = VOUT_ASPECT_FACTOR;
     fmt.i_width = fmt.i_visible_width = i_width;
     fmt.i_height = fmt.i_visible_height = i_height;
@@ -481,7 +481,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
     }
     p_svg->i_width = p_sys->i_width;
     p_svg->i_height = p_sys->i_height;
-    p_svg->i_chroma = VLC_FOURCC( 'Y','U','V','A' );
+    p_svg->i_chroma = VLC_CODEC_YUVA;
 
     /* Render the SVG.
        The input data is stored in the p_string structure,
index 4475a7aef6fba816d81be2f6e262fa79f7dac500..b48f856645126b52ca93c5b059d973b36633d14a 100644 (file)
@@ -221,7 +221,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','P');
+    fmt.i_chroma = VLC_CODEC_YUVP;
     fmt.i_width = fmt.i_visible_width = i_width + (b_outline ? 4 : 0);
     fmt.i_height = fmt.i_visible_height = i_height + (b_outline ? 4 : 0);
     fmt.i_x_offset = fmt.i_y_offset = 0;
index 332cae87b4475b881b876a7baeae41b543b165d1..b8f6eaef5296c8b8f8d9ec0752cc44b4433b98e3 100644 (file)
@@ -374,17 +374,17 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
 
             switch( p_input->p_fmt->i_codec )
             {
-                case VLC_FOURCC( 'a', '5', '2', ' ' ):
+                case VLC_CODEC_A52:
                     tk->i_tag = WAVE_FORMAT_A52;
                     tk->psz_name = "A/52";
                     i_bitspersample = 0;
                     break;
-                case VLC_FOURCC( 'm', 'p', '4', 'a' ):
+                case VLC_CODEC_MP4A:
                     tk->i_tag = WAVE_FORMAT_AAC;
                     tk->psz_name = "MPEG-4 Audio";
                     i_bitspersample = 0;
                     break;
-                case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
+                case VLC_CODEC_MPGA:
 #if 1
                     tk->psz_name = "MPEG Audio Layer 3";
                     tk->i_tag = WAVE_FORMAT_MPEGLAYER3;
@@ -400,47 +400,46 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
                     i_extra = 22;
                     break;
 #endif
-                case VLC_FOURCC( 'w', 'm', 'a', '1' ):
+                case VLC_CODEC_WMA1:
                     tk->psz_name = "Windows Media Audio v1";
                     tk->i_tag = WAVE_FORMAT_WMA1;
                     tk->b_audio_correction = true;
                     break;
-                case VLC_FOURCC( 'w', 'm', 'a', ' ' ):
-                case VLC_FOURCC( 'w', 'm', 'a', '2' ):
+                case VLC_CODEC_WMA2:
                     tk->psz_name= "Windows Media Audio (v2) 7, 8 and 9 Series";
                     tk->i_tag = WAVE_FORMAT_WMA2;
                     tk->b_audio_correction = true;
                     break;
-                case VLC_FOURCC( 'w', 'm', 'a', 'p' ):
+                case VLC_CODEC_WMAP:
                     tk->psz_name = "Windows Media Audio 9 Professional";
                     tk->i_tag = WAVE_FORMAT_WMAP;
                     tk->b_audio_correction = true;
                     break;
-                case VLC_FOURCC( 'w', 'm', 'a', 'l' ):
+                case VLC_CODEC_WMAL:
                     tk->psz_name = "Windows Media Audio 9 Lossless";
                     tk->i_tag = WAVE_FORMAT_WMAL;
                     tk->b_audio_correction = true;
                     break;
                     /* raw codec */
-                case VLC_FOURCC( 'u', '8', ' ', ' ' ):
+                case VLC_CODEC_U8:
                     tk->psz_name = "Raw audio 8bits";
                     tk->i_tag = WAVE_FORMAT_PCM;
                     i_blockalign= p_input->p_fmt->audio.i_channels;
                     i_bitspersample = 8;
                     break;
-                case VLC_FOURCC( 's', '1', '6', 'l' ):
+                case VLC_CODEC_S16L:
                     tk->psz_name = "Raw audio 16bits";
                     tk->i_tag = WAVE_FORMAT_PCM;
                     i_blockalign= 2 * p_input->p_fmt->audio.i_channels;
                     i_bitspersample = 16;
                     break;
-                case VLC_FOURCC( 's', '2', '4', 'l' ):
+                case VLC_CODEC_S24L:
                     tk->psz_name = "Raw audio 24bits";
                     tk->i_tag = WAVE_FORMAT_PCM;
                     i_blockalign= 3 * p_input->p_fmt->audio.i_channels;
                     i_bitspersample = 24;
                     break;
-                case VLC_FOURCC( 's', '3', '2', 'l' ):
+                case VLC_CODEC_S32L:
                     tk->psz_name = "Raw audio 32bits";
                     tk->i_tag = WAVE_FORMAT_PCM;
                     i_blockalign= 4 * p_input->p_fmt->audio.i_channels;
@@ -513,42 +512,42 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             uint8_t *p_codec_extra = NULL;
             int     i_codec_extra = 0;
 
-            if( p_input->p_fmt->i_codec == VLC_FOURCC('m','p','4','v') )
+            if( p_input->p_fmt->i_codec == VLC_CODEC_MP4V )
             {
                 tk->psz_name = "MPEG-4 Video";
                 tk->i_fourcc = VLC_FOURCC( 'M', 'P', '4', 'S' );
             }
-            else if( p_input->p_fmt->i_codec == VLC_FOURCC('D','I','V','3') )
+            else if( p_input->p_fmt->i_codec == VLC_CODEC_DIV3 )
             {
                 tk->psz_name = "MSMPEG-4 V3 Video";
                 tk->i_fourcc = VLC_FOURCC( 'M', 'P', '4', '3' );
             }
-            else if( p_input->p_fmt->i_codec == VLC_FOURCC('D','I','V','2') )
+            else if( p_input->p_fmt->i_codec == VLC_CODEC_DIV2 )
             {
                 tk->psz_name = "MSMPEG-4 V2 Video";
                 tk->i_fourcc = VLC_FOURCC( 'M', 'P', '4', '2' );
             }
-            else if( p_input->p_fmt->i_codec == VLC_FOURCC('D','I','V','1') )
+            else if( p_input->p_fmt->i_codec == VLC_CODEC_DIV2 )
             {
                 tk->psz_name = "MSMPEG-4 V1 Video";
                 tk->i_fourcc = VLC_FOURCC( 'M', 'P', 'G', '4' );
             }
-            else if( p_input->p_fmt->i_codec == VLC_FOURCC('W','M','V','1') )
+            else if( p_input->p_fmt->i_codec == VLC_CODEC_WMV1 )
             {
                 tk->psz_name = "Windows Media Video 7";
                 tk->i_fourcc = VLC_FOURCC( 'W', 'M', 'V', '1' );
             }
-            else if( p_input->p_fmt->i_codec == VLC_FOURCC('W','M','V','2') )
+            else if( p_input->p_fmt->i_codec == VLC_CODEC_WMV2 )
             {
                 tk->psz_name = "Windows Media Video 8";
                 tk->i_fourcc = VLC_FOURCC( 'W', 'M', 'V', '2' );
             }
-            else if( p_input->p_fmt->i_codec == VLC_FOURCC('W','M','V','3') )
+            else if( p_input->p_fmt->i_codec == VLC_CODEC_WMV3 )
             {
                 tk->psz_name = "Windows Media Video 9";
                 tk->i_fourcc = VLC_FOURCC( 'W', 'M', 'V', '3' );
             }
-            else if( p_input->p_fmt->i_codec == VLC_FOURCC('W','V','C','1') )
+            else if( p_input->p_fmt->i_codec == VLC_CODEC_VC1 )
             {
                 tk->psz_name = "Windows Media Video 9 Advanced Profile";
                 tk->i_fourcc = VLC_FOURCC( 'W', 'V', 'C', '1' );
@@ -565,7 +564,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
                     }
                 }
             }
-            else if( p_input->p_fmt->i_codec == VLC_FOURCC('h','2','6','4') )
+            else if( p_input->p_fmt->i_codec == VLC_CODEC_H264 )
             {
                 tk->psz_name = "H.264/MPEG-4 AVC";
                 tk->i_fourcc = VLC_FOURCC('h','2','6','4');
@@ -573,7 +572,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             else
             {
                 tk->psz_name = _("Unknown Video");
-                tk->i_fourcc = p_input->p_fmt->i_codec;
+                tk->i_fourcc = p_input->p_fmt->i_original_fourcc ?: p_input->p_fmt->i_codec;
             }
             if( !i_codec_extra && p_fmt->i_extra > 0 )
             {
index e70e5ddd892d7ee0e7fbc1fd83a6ac81ed3c361b..28a36160d324494a19c6c43472110397c7ec0176 100644 (file)
@@ -305,42 +305,41 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
 
             switch( p_input->p_fmt->i_codec )
             {
-                case VLC_FOURCC( 'a', '5', '2', ' ' ):
+                case VLC_CODEC_A52:
                     p_wf->wFormatTag = WAVE_FORMAT_A52;
                     break;
-                case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
+                case VLC_CODEC_MPGA:
                     p_wf->wFormatTag = WAVE_FORMAT_MPEGLAYER3;
                     break;
-                case VLC_FOURCC( 'w', 'm', 'a', '1' ):
+                case VLC_CODEC_WMA1:
                     p_wf->wFormatTag = WAVE_FORMAT_WMA1;
                     break;
-                case VLC_FOURCC( 'w', 'm', 'a', ' ' ):
-                case VLC_FOURCC( 'w', 'm', 'a', '2' ):
+                case VLC_CODEC_WMA2:
                     p_wf->wFormatTag = WAVE_FORMAT_WMA2;
                     break;
-                case VLC_FOURCC( 'w', 'm', 'a', 'p' ):
+                case VLC_CODEC_WMAP:
                     p_wf->wFormatTag = WAVE_FORMAT_WMAP;
                     break;
-                case VLC_FOURCC( 'w', 'm', 'a', 'l' ):
+                case VLC_CODEC_WMAL:
                     p_wf->wFormatTag = WAVE_FORMAT_WMAL;
                     break;
                     /* raw codec */
-                case VLC_FOURCC( 'u', '8', ' ', ' ' ):
+                case VLC_CODEC_U8:
                     p_wf->wFormatTag = WAVE_FORMAT_PCM;
                     p_wf->nBlockAlign= p_wf->nChannels;
                     p_wf->wBitsPerSample = 8;
                     break;
-                case VLC_FOURCC( 's', '1', '6', 'l' ):
+                case VLC_CODEC_S16L:
                     p_wf->wFormatTag = WAVE_FORMAT_PCM;
                     p_wf->nBlockAlign= 2 * p_wf->nChannels;
                     p_wf->wBitsPerSample = 16;
                     break;
-                case VLC_FOURCC( 's', '2', '4', 'l' ):
+                case VLC_CODEC_S24L:
                     p_wf->wFormatTag = WAVE_FORMAT_PCM;
                     p_wf->nBlockAlign= 3 * p_wf->nChannels;
                     p_wf->wBitsPerSample = 24;
                     break;
-                case VLC_FOURCC( 's', '3', '2', 'l' ):
+                case VLC_CODEC_S32L:
                     p_wf->wFormatTag = WAVE_FORMAT_PCM;
                     p_wf->nBlockAlign= 4 * p_wf->nChannels;
                     p_wf->wBitsPerSample = 32;
@@ -388,11 +387,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             p_bih->biClrImportant   = 0;
             switch( p_input->p_fmt->i_codec )
             {
-                case VLC_FOURCC( 'm', 'p', '4', 'v' ):
+                case VLC_CODEC_MP4V:
                     p_bih->biCompression = VLC_FOURCC( 'X', 'V', 'I', 'D' );
                     break;
                 default:
-                    p_bih->biCompression = p_input->p_fmt->i_codec;
+                    p_bih->biCompression = p_input->p_fmt->i_original_fourcc ?: p_input->p_fmt->i_codec;
                     break;
             }
 #undef p_bih
index 92a251f3c746bec33490ec9134be2c6c86fd57c8..ade26a3edbf07a035267ba264087e7ca216faaaa 100644 (file)
@@ -397,22 +397,22 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
 
     switch( p_input->p_fmt->i_codec )
     {
-        case VLC_FOURCC( 'm', 'p', '4', 'a' ):
-        case VLC_FOURCC( 'm', 'p', '4', 'v' ):
-        case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
-        case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
-        case VLC_FOURCC( 'M', 'J', 'P', 'G' ):
-        case VLC_FOURCC( 'm', 'j', 'p', 'b' ):
-        case VLC_FOURCC( 'S', 'V', 'Q', '1' ):
-        case VLC_FOURCC( 'S', 'V', 'Q', '3' ):
-        case VLC_FOURCC( 'H', '2', '6', '3' ):
-        case VLC_FOURCC( 'h', '2', '6', '4' ):
-        case VLC_FOURCC( 's', 'a', 'm', 'r' ):
-        case VLC_FOURCC( 's', 'a', 'w', 'b' ):
-        case VLC_FOURCC( 'Y', 'V', '1', '2' ):
-        case VLC_FOURCC( 'Y', 'U', 'Y', '2' ):
+        case VLC_CODEC_MP4A:
+        case VLC_CODEC_MP4V:
+        case VLC_CODEC_MPGA:
+        case VLC_CODEC_MPGV:
+        case VLC_CODEC_MJPG:
+        case VLC_CODEC_MJPGB:
+        case VLC_CODEC_SVQ1:
+        case VLC_CODEC_SVQ3:
+        case VLC_CODEC_H263:
+        case VLC_CODEC_H264:
+        case VLC_CODEC_AMR_NB:
+        case VLC_CODEC_AMR_WB:
+        case VLC_CODEC_YV12:
+        case VLC_CODEC_YUYV:
             break;
-        case VLC_FOURCC( 's', 'u', 'b', 't' ):
+        case VLC_CODEC_SUBT:
             msg_Warn( p_mux, "subtitle track added like in .mov (even when creating .mp4)" );
             break;
         default:
@@ -515,11 +515,11 @@ static int Mux( sout_mux_t *p_mux )
 
 again:
         p_data  = block_FifoGet( p_input->p_fifo );
-        if( p_stream->fmt.i_codec == VLC_FOURCC( 'h', '2', '6', '4' ) )
+        if( p_stream->fmt.i_codec == VLC_CODEC_H264 )
         {
             p_data = ConvertAVC1( p_data );
         }
-        else if( p_stream->fmt.i_codec == VLC_FOURCC( 's', 'u', 'b', 't' ) )
+        else if( p_stream->fmt.i_codec == VLC_CODEC_SUBT )
         {
             p_data = ConvertSUBT( p_data );
         }
@@ -781,18 +781,18 @@ static bo_t *GetESDS( mp4_stream_t *p_stream )
 
     switch( p_stream->fmt.i_codec )
     {
-        case VLC_FOURCC( 'm', 'p', '4', 'v' ):
+        case VLC_CODEC_MP4V:
             i_object_type_indication = 0x20;
             break;
-        case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
+        case VLC_CODEC_MPGV:
             /* FIXME MPEG-I=0x6b, MPEG-II = 0x60 -> 0x65 */
             i_object_type_indication = 0x60;
             break;
-        case VLC_FOURCC( 'm', 'p', '4', 'a' ):
+        case VLC_CODEC_MP4A:
             /* FIXME for mpeg2-aac == 0x66->0x68 */
             i_object_type_indication = 0x40;
             break;
-        case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
+        case VLC_CODEC_MPGA:
             i_object_type_indication =
                 p_stream->fmt.audio.i_rate < 32000 ? 0x69 : 0x6b;
             break;
@@ -874,7 +874,7 @@ static bo_t *GetDamrTag( mp4_stream_t *p_stream )
     bo_add_fourcc( damr, "REFC" );
     bo_add_8( damr, 0 );
 
-    if( p_stream->fmt.i_codec == VLC_FOURCC( 's', 'a', 'm', 'r' ) )
+    if( p_stream->fmt.i_codec == VLC_CODEC_AMR_NB )
         bo_add_16be( damr, 0x81ff ); /* Mode set (all modes for AMR_NB) */
     else
         bo_add_16be( damr, 0x83ff ); /* Mode set (all modes for AMR_WB) */
@@ -1026,8 +1026,8 @@ static bo_t *GetUdtaTag( sout_mux_t *p_mux )
     {
         mp4_stream_t *p_stream = p_sys->pp_streams[i_track];
 
-        if( p_stream->fmt.i_codec == VLC_FOURCC('m','p','4','v') ||
-            p_stream->fmt.i_codec == VLC_FOURCC('m','p','4','a') )
+        if( p_stream->fmt.i_codec == VLC_CODEC_MP4V ||
+            p_stream->fmt.i_codec == VLC_CODEC_MP4A )
         {
             bo_t *box = box_new( "\251req" );
             /* String length */
@@ -1093,18 +1093,18 @@ static bo_t *GetSounBox( sout_mux_t *p_mux, mp4_stream_t *p_stream )
 
     switch( p_stream->fmt.i_codec )
     {
-    case VLC_FOURCC('m','p','4','a'):
+    case VLC_CODEC_MP4A:
         memcpy( fcc, "mp4a", 4 );
         b_descr = true;
         break;
 
-    case VLC_FOURCC('s','a','m','r'):
-    case VLC_FOURCC('s','a','w','b'):
+    case VLC_CODEC_AMR_NB:
+    case VLC_CODEC_AMR_WB:
         memcpy( fcc, (char*)&p_stream->fmt.i_codec, 4 );
         b_descr = true;
         break;
 
-    case VLC_FOURCC('m','p','g','a'):
+    case VLC_CODEC_MPGA:
         if( p_sys->b_mov )
             memcpy( fcc, ".mp3", 4 );
         else
@@ -1128,7 +1128,7 @@ static bo_t *GetSounBox( sout_mux_t *p_mux, mp4_stream_t *p_stream )
 
     /* SoundDescription */
     if( p_sys->b_mov &&
-        p_stream->fmt.i_codec == VLC_FOURCC('m','p','4','a') )
+        p_stream->fmt.i_codec == VLC_CODEC_MP4A )
     {
         bo_add_16be( soun, 1 );     // version 1;
     }
@@ -1150,7 +1150,7 @@ static bo_t *GetSounBox( sout_mux_t *p_mux, mp4_stream_t *p_stream )
 
     /* Extended data for SoundDescription V1 */
     if( p_sys->b_mov &&
-        p_stream->fmt.i_codec == VLC_FOURCC('m','p','4','a') )
+        p_stream->fmt.i_codec == VLC_CODEC_MP4A )
     {
         /* samples per packet */
         bo_add_32be( soun, p_stream->fmt.audio.i_frame_length );
@@ -1166,11 +1166,11 @@ static bo_t *GetSounBox( sout_mux_t *p_mux, mp4_stream_t *p_stream )
         bo_t *box;
 
         if( p_sys->b_mov &&
-            p_stream->fmt.i_codec == VLC_FOURCC('m','p','4','a') )
+            p_stream->fmt.i_codec == VLC_CODEC_MP4A )
         {
             box = GetWaveTag( p_stream );
         }
-        else if( p_stream->fmt.i_codec == VLC_FOURCC('s','a','m','r') )
+        else if( p_stream->fmt.i_codec == VLC_CODEC_AMR_NB )
         {
             box = GetDamrTag( p_stream );
         }
@@ -1196,36 +1196,36 @@ static bo_t *GetVideBox( mp4_stream_t *p_stream )
 
     switch( p_stream->fmt.i_codec )
     {
-    case VLC_FOURCC('m','p','4','v'):
-    case VLC_FOURCC('m','p','g','v'):
+    case VLC_CODEC_MP4V:
+    case VLC_CODEC_MPGV:
         memcpy( fcc, "mp4v", 4 );
         break;
 
-    case VLC_FOURCC('M','J','P','G'):
+    case VLC_CODEC_MJPG:
         memcpy( fcc, "mjpa", 4 );
         break;
 
-    case VLC_FOURCC('S','V','Q','1'):
+    case VLC_CODEC_SVQ1:
         memcpy( fcc, "SVQ1", 4 );
         break;
 
-    case VLC_FOURCC('S','V','Q','3'):
+    case VLC_CODEC_SVQ3:
         memcpy( fcc, "SVQ3", 4 );
         break;
 
-    case VLC_FOURCC('H','2','6','3'):
+    case VLC_CODEC_H263:
         memcpy( fcc, "s263", 4 );
         break;
 
-    case VLC_FOURCC('h','2','6','4'):
+    case VLC_CODEC_H264:
         memcpy( fcc, "avc1", 4 );
         break;
 
-    case VLC_FOURCC('Y','V','1','2'):
+    case VLC_CODEC_YV12:
         memcpy( fcc, "yv12", 4 );
         break;
 
-    case VLC_FOURCC('Y','U','Y','2'):
+    case VLC_CODEC_YUYV:
         memcpy( fcc, "yuy2", 4 );
         break;
 
@@ -1269,8 +1269,8 @@ static bo_t *GetVideBox( mp4_stream_t *p_stream )
     /* add an ES Descriptor */
     switch( p_stream->fmt.i_codec )
     {
-    case VLC_FOURCC('m','p','4','v'):
-    case VLC_FOURCC('m','p','g','v'):
+    case VLC_CODEC_MP4V:
+    case VLC_CODEC_MPGV:
         {
             bo_t *esds = GetESDS( p_stream );
 
@@ -1279,7 +1279,7 @@ static bo_t *GetVideBox( mp4_stream_t *p_stream )
         }
         break;
 
-    case VLC_FOURCC('H','2','6','3'):
+    case VLC_CODEC_H263:
         {
             bo_t *d263 = GetD263Tag();
 
@@ -1288,7 +1288,7 @@ static bo_t *GetVideBox( mp4_stream_t *p_stream )
         }
         break;
 
-    case VLC_FOURCC('S','V','Q','3'):
+    case VLC_CODEC_SVQ3:
         {
             bo_t *esds = GetSVQ3Tag( p_stream );
 
@@ -1297,7 +1297,7 @@ static bo_t *GetVideBox( mp4_stream_t *p_stream )
         }
         break;
 
-    case VLC_FOURCC('h','2','6','4'):
+    case VLC_CODEC_H264:
         box_gather( vide, GetAvcCTag( p_stream ) );
         break;
 
index 06afc9a08b351d9611ba255e28baba5315874831..7df2891ee8570cedfd443c49e6c47c97a79357c9 100644 (file)
@@ -111,7 +111,7 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts,
 
                 if( i_pts > 0 && i_dts > 0 &&
                     ( i_pts != i_dts || ( p_fmt->i_cat == VIDEO_ES &&
-                      p_fmt->i_codec != VLC_FOURCC('m','p','g','v') ) ) )
+                      p_fmt->i_codec != VLC_CODEC_MPGV ) ) )
                 {
                     i_pts_dts = 0x03;
                     if ( !i_header_size ) i_header_size = 0xa;
@@ -341,7 +341,7 @@ int  EStoPES ( sout_instance_t *p_sout, block_t **pp_pes, block_t *p_es,
         i_max_pes_size = PES_PAYLOAD_SIZE_MAX;
     }
 
-    if( p_fmt->i_codec == VLC_FOURCC( 'm', 'p','4', 'v' ) &&
+    if( p_fmt->i_codec == VLC_CODEC_MP4V &&
         p_es->i_flags & BLOCK_FLAG_TYPE_I )
     {
         /* For MPEG4 video, add VOL before I-frames */
index 0f5667d07ec067d4bda2ec881fcdac494d48a663..a7e4ef5f7266d74875022f7e628e4452bb84a6de 100644 (file)
@@ -276,50 +276,44 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     /* Init this new stream */
     switch( p_input->p_fmt->i_codec )
     {
-        case VLC_FOURCC( 'm', 'p', '1', 'v' ):
-            p_stream->i_stream_id =
-                StreamIdGet( p_sys->stream_id_mpgv, 0xe0, 0xef );
-            p_stream->i_stream_type = 0x01; /* ISO/IEC 11172 Video */
-            break;
-        case VLC_FOURCC( 'm', 'p', '2', 'v' ):
-        case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
+        case VLC_CODEC_MPGV:
             p_stream->i_stream_id =
                 StreamIdGet( p_sys->stream_id_mpgv, 0xe0, 0xef );
             p_stream->i_stream_type = 0x02; /* ISO/IEC 13818 Video */
             break;
-        case VLC_FOURCC( 'm', 'p', '4', 'v' ):
+        case VLC_CODEC_MP4V:
             p_stream->i_stream_id =
                 StreamIdGet( p_sys->stream_id_mpgv, 0xe0, 0xef );
             p_stream->i_stream_type = 0x10;
             break;
-        case VLC_FOURCC( 'h', '2', '6', '4' ):
+        case VLC_CODEC_H264:
             p_stream->i_stream_id =
                 StreamIdGet( p_sys->stream_id_mpgv, 0xe0, 0xef );
             p_stream->i_stream_type = 0x1b;
             break;
-        case VLC_FOURCC( 'l', 'p', 'c', 'm' ):
+        case VLC_CODEC_DVD_LPCM:
             p_stream->i_stream_id =
                 0xbd00 | StreamIdGet( p_sys->stream_id_lpcm, 0xa0, 0xaf );
             break;
-        case VLC_FOURCC( 'd', 't', 's', ' ' ):
+        case VLC_CODEC_DTS:
             p_stream->i_stream_id =
                 0xbd00 | StreamIdGet( p_sys->stream_id_dts, 0x88, 0x8f );
             break;
-        case VLC_FOURCC( 'a', '5', '2', ' ' ):
+        case VLC_CODEC_A52:
             p_stream->i_stream_id =
                 0xbd00 | StreamIdGet( p_sys->stream_id_a52, 0x80, 0x87 );
             break;
-        case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
+        case VLC_CODEC_MPGA:
             p_stream->i_stream_id =
                 StreamIdGet( p_sys->stream_id_mpga, 0xc0, 0xcf );
             p_stream->i_stream_type = 0x03; /* ISO/IEC 11172 Audio */
             break;
-        case VLC_FOURCC( 'm', 'p', '4', 'a' ):
+        case VLC_CODEC_MP4A:
             p_stream->i_stream_id =
                 StreamIdGet( p_sys->stream_id_mpga, 0xc0, 0xcf );
             p_stream->i_stream_type = 0x0f;
             break;
-        case VLC_FOURCC( 's', 'p', 'u', ' ' ):
+        case VLC_CODEC_SPU:
             p_stream->i_stream_id =
                 0xbd00 | StreamIdGet( p_sys->stream_id_spu, 0x20, 0x3f );
             break;
@@ -399,27 +393,27 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
     msg_Dbg( p_mux, "removing input" );
     switch( p_input->p_fmt->i_codec )
     {
-        case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
+        case VLC_CODEC_MPGV:
             StreamIdRelease( p_sys->stream_id_mpgv, 0xe0,
                              p_stream->i_stream_id );
             break;
-        case VLC_FOURCC( 'l', 'p', 'c', 'm' ):
+        case VLC_CODEC_DVD_LPCM:
             StreamIdRelease( p_sys->stream_id_lpcm, 0xa0,
                              p_stream->i_stream_id&0xff );
             break;
-        case VLC_FOURCC( 'd', 't', 's', ' ' ):
+        case VLC_CODEC_DTS:
             StreamIdRelease( p_sys->stream_id_dts, 0x88,
                              p_stream->i_stream_id&0xff );
             break;
-        case VLC_FOURCC( 'a', '5', '2', ' ' ):
+        case VLC_CODEC_A52:
             StreamIdRelease( p_sys->stream_id_a52, 0x80,
                              p_stream->i_stream_id&0xff );
             break;
-        case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
+        case VLC_CODEC_MPGA:
             StreamIdRelease( p_sys->stream_id_mpga, 0xc0,
                              p_stream->i_stream_id  );
             break;
-        case VLC_FOURCC( 's', 'p', 'u', ' ' ):
+        case VLC_CODEC_SPU:
             StreamIdRelease( p_sys->stream_id_spu, 0x20,
                              p_stream->i_stream_id&0xff );
             break;
index dccd56043fd4333c3c36da94df7bd59066101586..82737fc4f33d99cf768d1da9532498fb3cf5e471 100644 (file)
@@ -998,39 +998,39 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         case VIDEO_ES:
             switch( p_input->p_fmt->i_codec )
             {
-                case VLC_FOURCC( 'm', 'p','g', 'v' ):
+                case VLC_CODEC_MPGV:
                     /* TODO: do we need to check MPEG-I/II ? */
                     p_stream->i_stream_type = 0x02;
                     p_stream->i_stream_id = 0xe0;
                     break;
-                case VLC_FOURCC( 'm', 'p','4', 'v' ):
+                case VLC_CODEC_MP4V:
                     p_stream->i_stream_type = 0x10;
                     p_stream->i_stream_id = 0xe0;
                     p_stream->i_es_id = p_stream->i_pid;
                     break;
-                case VLC_FOURCC( 'h', '2','6', '4' ):
+                case VLC_CODEC_H264:
                     p_stream->i_stream_type = 0x1b;
                     p_stream->i_stream_id = 0xe0;
                     break;
                 /* XXX dirty dirty but somebody want that:
                  *     using crapy MS-codec XXX */
                 /* I didn't want to do that :P */
-                case VLC_FOURCC( 'H', '2', '6', '3' ):
-                case VLC_FOURCC( 'I', '2', '6', '3' ):
-                case VLC_FOURCC( 'W', 'M', 'V', '3' ):
-                case VLC_FOURCC( 'W', 'M', 'V', '2' ):
-                case VLC_FOURCC( 'W', 'M', 'V', '1' ):
-                case VLC_FOURCC( 'D', 'I', 'V', '3' ):
-                case VLC_FOURCC( 'D', 'I', 'V', '2' ):
-                case VLC_FOURCC( 'D', 'I', 'V', '1' ):
-                case VLC_FOURCC( 'M', 'J', 'P', 'G' ):
+                case VLC_CODEC_H263I:
+                case VLC_CODEC_H263:
+                case VLC_CODEC_WMV3:
+                case VLC_CODEC_WMV2:
+                case VLC_CODEC_WMV1:
+                case VLC_CODEC_DIV3:
+                case VLC_CODEC_DIV2:
+                case VLC_CODEC_DIV1:
+                case VLC_CODEC_MJPG:
                     p_stream->i_stream_type = 0xa0; /* private */
                     p_stream->i_stream_id = 0xa0;   /* beurk */
                     p_stream->i_bih_codec  = p_input->p_fmt->i_codec;
                     p_stream->i_bih_width  = p_input->p_fmt->video.i_width;
                     p_stream->i_bih_height = p_input->p_fmt->video.i_height;
                     break;
-                case VLC_FOURCC( 'd', 'r', 'a', 'c' ):
+                case VLC_CODEC_DIRAC:
                     /* stream_id makes use of stream_id_extension */
                     p_stream->i_stream_id = (PES_EXTENDED_STREAM_ID << 8) | 0x60;
                     p_stream->i_stream_type = 0xd1;
@@ -1045,25 +1045,24 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         case AUDIO_ES:
             switch( p_input->p_fmt->i_codec )
             {
-                case VLC_FOURCC( 'm', 'p','g', 'a' ):
-                case VLC_FOURCC( 'm', 'p', '3', ' ' ):
+                case VLC_CODEC_MPGA:
                     p_stream->i_stream_type =
                         p_input->p_fmt->audio.i_rate >= 32000 ? 0x03 : 0x04;
                     p_stream->i_stream_id = 0xc0;
                     break;
-                case VLC_FOURCC( 'a', '5','2', ' ' ):
+                case VLC_CODEC_A52:
                     p_stream->i_stream_type = 0x81;
                     p_stream->i_stream_id = 0xbd;
                     break;
-                case VLC_FOURCC( 'l', 'p','c', 'm' ):
+                case VLC_CODEC_DVD_LPCM:
                     p_stream->i_stream_type = 0x83;
                     p_stream->i_stream_id = 0xbd;
                     break;
-                case VLC_FOURCC( 'd', 't','s', ' ' ):
+                case VLC_CODEC_DTS:
                     p_stream->i_stream_type = 0x06;
                     p_stream->i_stream_id = 0xbd;
                     break;
-                case VLC_FOURCC( 'm', 'p','4', 'a' ):
+                case VLC_CODEC_MP4A:
                     /* XXX: make that configurable in some way when LOAS
                      * is implemented for AAC in TS */
                     //p_stream->i_stream_type = 0x11; /* LOAS/LATM */
@@ -1082,22 +1081,22 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         case SPU_ES:
             switch( p_input->p_fmt->i_codec )
             {
-                case VLC_FOURCC( 's', 'p','u', ' ' ):
+                case VLC_CODEC_SPU:
                     p_stream->i_stream_type = 0x82;
                     p_stream->i_stream_id = 0xbd;
                     break;
-                case VLC_FOURCC( 's', 'u','b', 't' ):
+                case VLC_CODEC_SUBT:
                     p_stream->i_stream_type = 0x12;
                     p_stream->i_stream_id = 0xfa;
                     p_sys->i_mpeg4_streams++;
                     p_stream->i_es_id = p_stream->i_pid;
                     break;
-                case VLC_FOURCC('d','v','b','s'):
+                case VLC_CODEC_DVBS:
                     p_stream->i_stream_type = 0x06;
                     p_stream->i_es_id = p_input->p_fmt->subs.dvb.i_id;
                     p_stream->i_stream_id = 0xbd;
                     break;
-                case VLC_FOURCC('t','e','l','x'):
+                case VLC_CODEC_TELETEXT:
                     p_stream->i_stream_type = 0x06;
                     p_stream->i_stream_id = 0xbd; /* FIXME */
                     break;
@@ -1185,7 +1184,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     }
 
     /* Create decoder specific info for subt */
-    if( p_stream->i_codec == VLC_FOURCC( 's', 'u','b', 't' ) )
+    if( p_stream->i_codec == VLC_CODEC_SUBT )
     {
         uint8_t *p;
 
@@ -1489,12 +1488,12 @@ static int Mux( sout_mux_t *p_mux )
 
                     if( p_stream == p_pcr_stream || p_sys->b_data_alignment
                          || p_input->p_fmt->i_codec !=
-                             VLC_FOURCC('m', 'p', 'g', 'a') )
+                             VLC_CODEC_MPGA )
                     {
                         p_data = block_FifoGet( p_input->p_fifo );
 
                         if( p_input->p_fmt->i_codec ==
-                                VLC_FOURCC('m', 'p', '4', 'a' ) )
+                                VLC_CODEC_MP4A )
                             p_data = Add_ADTS( p_data, p_input->p_fmt );
                     }
                     else
@@ -1507,7 +1506,7 @@ static int Mux( sout_mux_t *p_mux )
                         p_data->i_length = p_next->i_dts - p_data->i_dts;
                     }
                     else if( p_input->p_fmt->i_codec !=
-                               VLC_FOURCC('s', 'u', 'b', 't' ) )
+                               VLC_CODEC_SUBT )
                         p_data->i_length = 1000;
 
                     if( ( p_pcr_stream->i_pes_dts > 0 &&
@@ -1546,7 +1545,7 @@ static int Mux( sout_mux_t *p_mux )
                         if( p_input->p_fmt->i_cat == SPU_ES )
                         {
                             if( p_input->p_fmt->i_codec ==
-                                VLC_FOURCC('s','u','b','t') )
+                                VLC_CODEC_SUBT )
                             {
                                 /* Prepend header */
                                 p_data = block_Realloc( p_data, 2,
@@ -1585,14 +1584,14 @@ static int Mux( sout_mux_t *p_mux )
                                 }
                             }
                             else if( p_input->p_fmt->i_codec ==
-                                       VLC_FOURCC('t','e','l','x') )
+                                       VLC_CODEC_TELETEXT )
                             {
                                 /* EN 300 472 */
                                 i_header_size = 0x24;
                                 b_data_alignment = 1;
                             }
                             else if( p_input->p_fmt->i_codec ==
-                                       VLC_FOURCC('d','v','b','s') )
+                                       VLC_CODEC_DVBS )
                             {
                                 /* EN 300 743 */
                                 b_data_alignment = 1;
@@ -1622,7 +1621,7 @@ static int Mux( sout_mux_t *p_mux )
                         }
 
                         if( p_input->p_fmt->i_codec ==
-                                   VLC_FOURCC('d','r','a','c') )
+                                   VLC_CODEC_DIRAC )
                         {
                             b_data_alignment = 1;
                             /* dirac pes packets should be unbounded in
@@ -2545,7 +2544,7 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
                     bits_write( &bits, 6, 0x05 );   /* AudioStream */
                 }
                 else if( p_stream->i_stream_type == 0x12 &&
-                         p_stream->i_codec == VLC_FOURCC('s','u','b','t') )
+                         p_stream->i_codec == VLC_CODEC_SUBT )
                 {
                     bits_write( &bits, 8, 0x0B );   /* Text Stream */
                     bits_write( &bits, 6, 0x04 );   /* VisualStream */
@@ -2680,14 +2679,14 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
             /* "registration" descriptor : "AC-3" */
             dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, format );
         }
-        else if( p_stream->i_codec == VLC_FOURCC('d','r','a','c') )
+        else if( p_stream->i_codec == VLC_CODEC_DIRAC )
         {
             /* Dirac registration descriptor */
 
             uint8_t data[4] = { 'd', 'r', 'a', 'c' };
             dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, data );
         }
-        else if( p_stream->i_codec == VLC_FOURCC('d','t','s',' ') )
+        else if( p_stream->i_codec == VLC_CODEC_DTS )
         {
             /* DTS registration descriptor (ETSI TS 101 154 Annex F) */
 
@@ -2695,7 +2694,7 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
             uint8_t data[4] = { 0x44, 0x54, 0x53, 0x32 };
             dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, data );
         }
-        else if( p_stream->i_codec == VLC_FOURCC('t','e','l','x') )
+        else if( p_stream->i_codec == VLC_CODEC_TELETEXT )
         {
             if( p_stream->i_decoder_specific_info )
             {
@@ -2705,7 +2704,7 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
             }
             continue;
         }
-        else if( p_stream->i_codec == VLC_FOURCC('d','v','b','s') )
+        else if( p_stream->i_codec == VLC_CODEC_DVBS )
         {
             /* DVB subtitles */
             if( p_stream->i_decoder_specific_info )
index 1511373046365afbf98d7e8e9c8a82055706cc28..1de2ec4cbe4774a494931613af5b5a17c00da41c 100644 (file)
@@ -131,16 +131,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     }
 
     msg_Dbg( p_mux, "adding input" );
-    if( p_input->p_fmt->i_codec != VLC_FOURCC('M','J','P','G') &&
-        p_input->p_fmt->i_codec != VLC_FOURCC('m','j','p','g') &&
-        p_input->p_fmt->i_codec != VLC_FOURCC('j','p','e','g') &&
-        p_input->p_fmt->i_codec != VLC_FOURCC('J','P','E','G') &&
-        p_input->p_fmt->i_codec != VLC_FOURCC('J','F','I','F') &&
-        p_input->p_fmt->i_codec != VLC_FOURCC('J','P','G','L') &&
-        p_input->p_fmt->i_codec != VLC_FOURCC('m','j','p','a') )
-    {
+    if( p_input->p_fmt->i_codec != VLC_CODEC_MJPG )
         return VLC_EGENERIC;
-    }
 
     return VLC_SUCCESS;
 }
index fcdfb8a617ce421bc1393155ac3ce6a729bad170..373637167b723484cc03ad81db1526385762c478 100644 (file)
@@ -342,14 +342,14 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
 
         switch( p_stream->i_fourcc )
         {
-        case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
-        case VLC_FOURCC( 'm', 'p', '4', 'v' ):
-        case VLC_FOURCC( 'D', 'I', 'V', '3' ):
-        case VLC_FOURCC( 'M', 'J', 'P', 'G' ):
-        case VLC_FOURCC( 'W', 'M', 'V', '1' ):
-        case VLC_FOURCC( 'W', 'M', 'V', '2' ):
-        case VLC_FOURCC( 'W', 'M', 'V', '3' ):
-        case VLC_FOURCC( 'S', 'N', 'O', 'W' ):
+        case VLC_CODEC_MP4V:
+        case VLC_CODEC_MPGV:
+        case VLC_CODEC_DIV3:
+        case VLC_CODEC_MJPG:
+        case VLC_CODEC_WMV1:
+        case VLC_CODEC_WMV2:
+        case VLC_CODEC_WMV3:
+        case VLC_CODEC_SNOW:
             p_stream->p_oggds_header = calloc( 1, sizeof(oggds_header_t) );
             if( !p_stream->p_oggds_header )
             {
@@ -359,11 +359,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             p_stream->p_oggds_header->i_packet_type = PACKET_TYPE_HEADER;
 
             memcpy( p_stream->p_oggds_header->stream_type, "video", 5 );
-            if( p_stream->i_fourcc == VLC_FOURCC( 'm', 'p', '4', 'v' ) )
+            if( p_stream->i_fourcc == VLC_CODEC_MP4V )
             {
                 memcpy( p_stream->p_oggds_header->sub_type, "XVID", 4 );
             }
-            else if( p_stream->i_fourcc == VLC_FOURCC( 'D', 'I', 'V', '3' ) )
+            else if( p_stream->i_fourcc == VLC_CODEC_DIV3 )
             {
                 memcpy( p_stream->p_oggds_header->sub_type, "DIV3", 4 );
             }
@@ -388,11 +388,11 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             msg_Dbg( p_mux, "%4.4s stream", (char *)&p_stream->i_fourcc );
             break;
 
-        case VLC_FOURCC( 'd', 'r', 'a', 'c' ):
+        case VLC_CODEC_DIRAC:
             msg_Dbg( p_mux, "dirac stream" );
             break;
 
-        case VLC_FOURCC( 't', 'h', 'e', 'o' ):
+        case VLC_CODEC_THEORA:
             msg_Dbg( p_mux, "theora stream" );
             break;
 
@@ -405,15 +405,15 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     case AUDIO_ES:
         switch( p_stream->i_fourcc )
         {
-        case VLC_FOURCC( 'v', 'o', 'r', 'b' ):
+        case VLC_CODEC_VORBIS:
             msg_Dbg( p_mux, "vorbis stream" );
             break;
 
-        case VLC_FOURCC( 's', 'p', 'x', ' ' ):
+        case VLC_CODEC_SPEEX:
             msg_Dbg( p_mux, "speex stream" );
             break;
 
-        case VLC_FOURCC( 'f', 'l', 'a', 'c' ):
+        case VLC_CODEC_FLAC:
             msg_Dbg( p_mux, "flac stream" );
             break;
 
@@ -470,7 +470,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     case SPU_ES:
         switch( p_stream->i_fourcc )
         {
-        case VLC_FOURCC( 's', 'u','b', 't' ):
+        case VLC_CODEC_SUBT:
             p_stream->p_oggds_header = calloc( 1, sizeof(oggds_header_t) );
             if( !p_stream->p_oggds_header )
             {
@@ -626,9 +626,9 @@ static block_t *OggCreateHeader( sout_mux_t *p_mux )
         ogg_stream_init( &p_stream->os, p_stream->i_serial_no );
         p_stream->i_packet_no = 0;
 
-        if( p_stream->i_fourcc == VLC_FOURCC( 'v', 'o', 'r', 'b' ) ||
-            p_stream->i_fourcc == VLC_FOURCC( 's', 'p', 'x', ' ' ) ||
-            p_stream->i_fourcc == VLC_FOURCC( 't', 'h', 'e', 'o' ) )
+        if( p_stream->i_fourcc == VLC_CODEC_VORBIS ||
+            p_stream->i_fourcc == VLC_CODEC_SPEEX ||
+            p_stream->i_fourcc == VLC_CODEC_THEORA )
         {
             /* First packet in order: vorbis/speex/theora info */
             p_extra = p_input->p_fmt->p_extra;
@@ -652,7 +652,7 @@ static block_t *OggCreateHeader( sout_mux_t *p_mux )
             p_og = OggStreamFlush( p_mux, &p_stream->os, 0 );
 
             /* Get keyframe_granule_shift for theora granulepos calculation */
-            if( p_stream->i_fourcc == VLC_FOURCC( 't', 'h', 'e', 'o' ) )
+            if( p_stream->i_fourcc == VLC_CODEC_THEORA )
             {
                 int i_keyframe_frequency_force =
                       1 << ((op.packet[40] << 6 >> 3) | (op.packet[41] >> 5));
@@ -667,7 +667,7 @@ static block_t *OggCreateHeader( sout_mux_t *p_mux )
                 }
             }
         }
-        else if( p_stream->i_fourcc == VLC_FOURCC( 'd', 'r', 'a', 'c' ) )
+        else if( p_stream->i_fourcc == VLC_CODEC_DIRAC )
         {
             op.packet = p_input->p_fmt->p_extra;
             op.bytes  = p_input->p_fmt->i_extra;
@@ -678,7 +678,7 @@ static block_t *OggCreateHeader( sout_mux_t *p_mux )
             ogg_stream_packetin( &p_stream->os, &op );
             p_og = OggStreamFlush( p_mux, &p_stream->os, 0 );
         }
-        else if( p_stream->i_fourcc == VLC_FOURCC( 'f', 'l', 'a', 'c' ) )
+        else if( p_stream->i_fourcc == VLC_CODEC_FLAC )
         {
             /* flac stream marker (yeah, only that in the 1st packet) */
             op.packet = (unsigned char *)"fLaC";
@@ -712,15 +712,15 @@ static block_t *OggCreateHeader( sout_mux_t *p_mux )
         sout_input_t *p_input = p_mux->pp_inputs[i];
         ogg_stream_t *p_stream = (ogg_stream_t*)p_input->p_sys;
 
-        if( p_stream->i_fourcc == VLC_FOURCC( 'v', 'o', 'r', 'b' ) ||
-            p_stream->i_fourcc == VLC_FOURCC( 's', 'p', 'x', ' ' ) ||
-            p_stream->i_fourcc == VLC_FOURCC( 't', 'h', 'e', 'o' ) )
+        if( p_stream->i_fourcc == VLC_CODEC_VORBIS ||
+            p_stream->i_fourcc == VLC_CODEC_SPEEX ||
+            p_stream->i_fourcc == VLC_CODEC_THEORA )
         {
             /* Special case, headers are already there in the incoming stream.
              * We need to gather them an mark them as headers. */
             int j = 2;
 
-            if( p_stream->i_fourcc == VLC_FOURCC( 's', 'p', 'x', ' ' ) ) j = 1;
+            if( p_stream->i_fourcc == VLC_CODEC_SPEEX ) j = 1;
 
             p_extra = p_input->p_fmt->p_extra;
             i_extra = p_input->p_fmt->i_extra;
@@ -755,8 +755,8 @@ static block_t *OggCreateHeader( sout_mux_t *p_mux )
                 block_ChainAppend( &p_hdr, p_og );
             }
         }
-        else if( p_stream->i_fourcc != VLC_FOURCC( 'f', 'l', 'a', 'c' ) &&
-                 p_stream->i_fourcc != VLC_FOURCC( 'd', 'r', 'a', 'c' ) )
+        else if( p_stream->i_fourcc != VLC_CODEC_FLAC &&
+                 p_stream->i_fourcc != VLC_CODEC_DIRAC )
         {
             uint8_t com[128];
             int     i_com;
@@ -778,8 +778,8 @@ static block_t *OggCreateHeader( sout_mux_t *p_mux )
         }
 
         /* Special case for mp4v and flac */
-        if( ( p_stream->i_fourcc == VLC_FOURCC( 'm', 'p', '4', 'v' ) ||
-              p_stream->i_fourcc == VLC_FOURCC( 'f', 'l', 'a', 'c' ) ) &&
+        if( ( p_stream->i_fourcc == VLC_CODEC_MP4V ||
+              p_stream->i_fourcc == VLC_CODEC_FLAC ) &&
             p_input->p_fmt->i_extra )
         {
             /* Send a packet with the VOL data for mp4v
@@ -787,7 +787,7 @@ static block_t *OggCreateHeader( sout_mux_t *p_mux )
             msg_Dbg( p_mux, "writing extra data" );
             op.bytes  = p_input->p_fmt->i_extra;
             op.packet = p_input->p_fmt->p_extra;
-            if( p_stream->i_fourcc == VLC_FOURCC( 'f', 'l', 'a', 'c' ) )
+            if( p_stream->i_fourcc == VLC_CODEC_FLAC )
             {
                 /* Skip the flac stream marker */
                 op.bytes -= 4;
@@ -964,11 +964,11 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
     block_t *p_og = NULL;
     ogg_packet op;
 
-    if( p_stream->i_fourcc != VLC_FOURCC( 'v', 'o', 'r', 'b' ) &&
-        p_stream->i_fourcc != VLC_FOURCC( 'f', 'l', 'a', 'c' ) &&
-        p_stream->i_fourcc != VLC_FOURCC( 's', 'p', 'x', ' ' ) &&
-        p_stream->i_fourcc != VLC_FOURCC( 't', 'h', 'e', 'o' ) &&
-        p_stream->i_fourcc != VLC_FOURCC( 'd', 'r', 'a', 'c' ) )
+    if( p_stream->i_fourcc != VLC_CODEC_VORBIS &&
+        p_stream->i_fourcc != VLC_CODEC_FLAC &&
+        p_stream->i_fourcc != VLC_CODEC_SPEEX &&
+        p_stream->i_fourcc != VLC_CODEC_THEORA &&
+        p_stream->i_fourcc != VLC_CODEC_DIRAC )
     {
         p_data = block_Realloc( p_data, 1, p_data->i_buffer );
         p_data->p_buffer[0] = PACKET_IS_SYNCPOINT;      // FIXME
@@ -982,9 +982,9 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
 
     if( p_stream->i_cat == AUDIO_ES )
     {
-        if( p_stream->i_fourcc == VLC_FOURCC( 'v', 'o', 'r', 'b' ) ||
-            p_stream->i_fourcc == VLC_FOURCC( 'f', 'l', 'a', 'c' ) ||
-            p_stream->i_fourcc == VLC_FOURCC( 's', 'p', 'x', ' ' ) )
+        if( p_stream->i_fourcc == VLC_CODEC_VORBIS ||
+            p_stream->i_fourcc == VLC_CODEC_FLAC ||
+            p_stream->i_fourcc == VLC_CODEC_SPEEX )
         {
             /* number of sample from begining + current packet */
             op.granulepos =
@@ -1000,7 +1000,7 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
     }
     else if( p_stream->i_cat == VIDEO_ES )
     {
-        if( p_stream->i_fourcc == VLC_FOURCC( 't', 'h', 'e', 'o' ) )
+        if( p_stream->i_fourcc == VLC_CODEC_THEORA )
         {
             /* FIXME, we assume only keyframes */
             op.granulepos = ( ( p_data->i_dts - p_sys->i_start_dts ) *
@@ -1008,7 +1008,7 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
                 p_input->p_fmt->video.i_frame_rate_base /
                 INT64_C(1000000) ) << p_stream->i_keyframe_granule_shift;
         }
-        else if( p_stream->i_fourcc == VLC_FOURCC( 'd', 'r', 'a', 'c' ) )
+        else if( p_stream->i_fourcc == VLC_CODEC_DIRAC )
         {
             mtime_t dt = (p_data->i_dts - p_sys->i_start_dts + 1)
                        * p_input->p_fmt->video.i_frame_rate *2
@@ -1038,8 +1038,8 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
     ogg_stream_packetin( &p_stream->os, &op );
 
     if( p_stream->i_cat == SPU_ES ||
-        p_stream->i_fourcc == VLC_FOURCC( 's', 'p', 'x', ' ' ) ||
-        p_stream->i_fourcc == VLC_FOURCC( 'd', 'r', 'a', 'c' ) )
+        p_stream->i_fourcc == VLC_CODEC_SPEEX ||
+        p_stream->i_fourcc == VLC_CODEC_DIRAC )
     {
         /* Subtitles or Speex packets are quite small so they
          * need to be flushed to be sent on time */
index 7a8968f08fa78b657a10657e4dc893476e0af4d7..f2f4091d78f7d7334659ed5d49875f33a214af03 100644 (file)
@@ -204,7 +204,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
                  p_sys->i_channel_mask, (int)p_sys->b_chan_reorder );
     }
 
-    i_format = p_input->p_fmt->i_codec == VLC_FOURCC('f', 'l', '3', '2') ?
+    i_format = p_input->p_fmt->i_codec == VLC_CODEC_FL32 ?
         WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM;
     b_ext = p_sys->b_ext = p_input->p_fmt->audio.i_channels > 2;
 
index 661e406c1458573ddf76391330bc42ae84de52ba..8207b609a96b028e44a43147e3613bfbbb064fbb 100644 (file)
@@ -87,149 +87,19 @@ static int Open( vlc_object_t *p_this )
     /* Create the output format */
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
 
-    /* Fix the value of the fourcc */
-    switch( p_dec->fmt_in.i_codec )
+    /* Fix the value of the fourcc for audio */
+    if( p_dec->fmt_in.i_cat == AUDIO_ES )
     {
-        /* video */
-        case VLC_FOURCC( 'm', '4', 's', '2'):
-        case VLC_FOURCC( 'M', '4', 'S', '2'):
-        case VLC_FOURCC( 'm', 'p', '4', 's'):
-        case VLC_FOURCC( 'M', 'P', '4', 'S'):
-        case VLC_FOURCC( 'D', 'I', 'V', 'X'):
-        case VLC_FOURCC( 'd', 'i', 'v', 'x'):
-        case VLC_FOURCC( 'X', 'V', 'I', 'D'):
-        case VLC_FOURCC( 'X', 'v', 'i', 'D'):
-        case VLC_FOURCC( 'x', 'v', 'i', 'd'):
-        case VLC_FOURCC( 'D', 'X', '5', '0'):
-        case VLC_FOURCC( 0x04, 0,   0,   0):
-        case VLC_FOURCC( '3', 'I', 'V', '2'):
-            p_dec->fmt_out.i_codec = VLC_FOURCC( 'm', 'p', '4', 'v');
-            break;
-
-        case VLC_FOURCC( 'm', 'p', 'g', '1' ):
-        case VLC_FOURCC( 'm', 'p', 'g', '2' ):
-        case VLC_FOURCC( 'm', 'p', '1', 'v' ):
-        case VLC_FOURCC( 'm', 'p', '2', 'v' ):
-            p_dec->fmt_out.i_codec = VLC_FOURCC( 'm', 'p', 'g', 'v' );
-            break;
-
-        case VLC_FOURCC( 'd', 'i', 'v', '1' ):
-        case VLC_FOURCC( 'M', 'P', 'G', '4' ):
-        case VLC_FOURCC( 'm', 'p', 'g', '4' ):
-            p_dec->fmt_out.i_codec = VLC_FOURCC( 'D', 'I', 'V', '1' );
-            break;
-
-        case VLC_FOURCC( 'd', 'i', 'v', '2' ):
-        case VLC_FOURCC( 'M', 'P', '4', '2' ):
-        case VLC_FOURCC( 'm', 'p', '4', '2' ):
-            p_dec->fmt_out.i_codec = VLC_FOURCC( 'D', 'I', 'V', '2' );
-            break;
-
-        case VLC_FOURCC( 'd', 'i', 'v', '3' ):
-        case VLC_FOURCC( 'd', 'i', 'v', '4' ):
-        case VLC_FOURCC( 'D', 'I', 'V', '4' ):
-        case VLC_FOURCC( 'd', 'i', 'v', '5' ):
-        case VLC_FOURCC( 'D', 'I', 'V', '5' ):
-        case VLC_FOURCC( 'd', 'i', 'v', '6' ):
-        case VLC_FOURCC( 'D', 'I', 'V', '6' ):
-        case VLC_FOURCC( 'M', 'P', '4', '3' ):
-        case VLC_FOURCC( 'm', 'p', '4', '3' ):
-        case VLC_FOURCC( 'm', 'p', 'g', '3' ):
-        case VLC_FOURCC( 'M', 'P', 'G', '3' ):
-        case VLC_FOURCC( 'A', 'P', '4', '1' ):
-            p_dec->fmt_out.i_codec = VLC_FOURCC( 'D', 'I', 'V', '3' );
-            break;
-
-        case VLC_FOURCC( 'h', '2', '6', '3' ):
-        case VLC_FOURCC( 'U', '2', '6', '3' ):
-        case VLC_FOURCC( 'u', '2', '6', '3' ):
-            p_dec->fmt_out.i_codec = VLC_FOURCC( 'H', '2', '6', '3' );
-            break;
-
-        case VLC_FOURCC( 'i', '2', '6', '3' ):
-            p_dec->fmt_out.i_codec = VLC_FOURCC( 'I', '2', '6', '3' );
-            break;
-
-        case VLC_FOURCC( 'm', 'j', 'p', 'g' ):
-        case VLC_FOURCC( 'm', 'j', 'p', 'a' ):
-        case VLC_FOURCC( 'j', 'p', 'e', 'g' ):
-        case VLC_FOURCC( 'J', 'P', 'E', 'G' ):
-        case VLC_FOURCC( 'J', 'F', 'I', 'F' ):
-            p_dec->fmt_out.i_codec = VLC_FOURCC( 'M', 'J', 'P', 'G' );
-            break;
-
-        case VLC_FOURCC( 'd', 'v', 's', 'd' ):
-        case VLC_FOURCC( 'D', 'V', 'S', 'D' ):
-        case VLC_FOURCC( 'd', 'v', 'h', 'd' ):
-            p_dec->fmt_out.i_codec = VLC_FOURCC( 'd', 'v', 's', 'l' );
-            break;
-
-        /* audio */
-        case VLC_FOURCC( 'a', 'r', 'a', 'w' ):
-            switch( ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8 )
-            {
-                case 1:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('u','8',' ',' ');
-                    break;
-                case 2:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','1','6','l');
-                    break;
-                case 3:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','2','4','l');
-                    break;
-                case 4:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','3','2','l');
-                    break;
-                default:
-                    msg_Err( p_dec, "unknown raw audio sample size" );
-                    return VLC_EGENERIC;
-            }
-            break;
-
-        case VLC_FOURCC( 't', 'w', 'o', 's' ):
-            switch( ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8 )
-            {
-                case 1:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','8',' ',' ');
-                    break;
-                case 2:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','1','6','b');
-                    break;
-                case 3:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','2','4','b');
-                    break;
-                case 4:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','3','2','b');
-                    break;
-                default:
-                    msg_Err( p_dec, "unknown raw audio sample size" );
-                    return VLC_EGENERIC;
-            }
-            break;
-
-        case VLC_FOURCC( 's', 'o', 'w', 't' ):
-            switch( ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8 )
-            {
-                case 1:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','8',' ',' ');
-                    break;
-                case 2:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','1','6','l');
-                    break;
-                case 3:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','2','4','l');
-                    break;
-                case 4:
-                    p_dec->fmt_out.i_codec = VLC_FOURCC('s','3','2','l');
-                    break;
-                default:
-                    msg_Err( p_dec, "unknown raw audio sample size" );
-                    return VLC_EGENERIC;
-            }
-            break;
+        p_dec->fmt_out.i_codec = vlc_fourcc_GetCodecAudio( p_dec->fmt_in.i_codec,
+                                                           p_dec->fmt_in.audio.i_bitspersample );
+        if( !p_dec->fmt_out.i_codec )
+        {
+            msg_Err( p_dec, "unknown raw audio sample size" );
+            return VLC_EGENERIC;
+        }
     }
 
-    p_dec->p_sys = p_sys = malloc( sizeof( block_t ) );
+    p_dec->p_sys = p_sys = malloc( sizeof(*p_sys) );
     p_sys->p_block    = NULL;
 
     return VLC_SUCCESS;
index 75f9ce5796c3c6fc74f12cbc2066dc93b31dcc0b..39c48185a60dbddfd43e1fd153157a44e95687a3 100644 (file)
@@ -1349,7 +1349,7 @@ static int Open( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec !=  VLC_FOURCC( 'd','r','a','c' ) )
+    if( p_dec->fmt_in.i_codec !=  VLC_CODEC_DIRAC )
         return VLC_EGENERIC;
 
     p_dec->pf_packetize = Packetize;
index 534ee7bcbe6f58954dea56a0eba722a09b851456..3baac0cbf150cba3117b0b8367d5101c67b5a821 100644 (file)
@@ -183,18 +183,11 @@ static int Open( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
     int i;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC( 'h', '2', '6', '4') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'H', '2', '6', '4') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'V', 'S', 'S', 'H') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'v', 's', 's', 'h') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'D', 'A', 'V', 'C') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'x', '2', '6', '4') &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'X', '2', '6', '4') &&
-        ( p_dec->fmt_in.i_codec != VLC_FOURCC( 'a', 'v', 'c', '1') ||
-          p_dec->fmt_in.i_extra < 7 ) )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_H264 )
+        return VLC_EGENERIC;
+    if( p_dec->fmt_in.i_original_fourcc == VLC_FOURCC( 'a', 'v', 'c', '1') &&
+        p_dec->fmt_in.i_extra < 7 )
         return VLC_EGENERIC;
-    }
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys = malloc( sizeof(decoder_sys_t) ) ) == NULL )
@@ -233,9 +226,9 @@ static int Open( vlc_object_t *p_this )
 
     /* Setup properties */
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
-    p_dec->fmt_out.i_codec = VLC_FOURCC( 'h', '2', '6', '4' );
+    p_dec->fmt_out.i_codec = VLC_CODEC_H264;
 
-    if( p_dec->fmt_in.i_codec == VLC_FOURCC( 'a', 'v', 'c', '1' ) )
+    if( p_dec->fmt_in.i_original_fourcc == VLC_FOURCC( 'a', 'v', 'c', '1' ) )
     {
         /* This type of stream is produced by mp4 and matroska
          * when we want to store it in another streamformat, you need to convert
index 5722c0cb4e68a8a3018e6e63fa9ff04ae727c67e..09abbcb7575af0eacb6fa528afc72044cc9a6a4a 100644 (file)
@@ -120,7 +120,7 @@ static int Open( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('m','l','p',' ') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MLP )
         return VLC_EGENERIC;
 
     /* */
@@ -137,7 +137,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('m','l','p',' ');
+    p_dec->fmt_out.i_codec = VLC_CODEC_MLP;
     p_dec->fmt_out.audio.i_rate = 0;
 
     /* Set callback */
index e0f99d4012b03c44022dc109dc1c67d58988f02c..222678f140924250fefe058220919b79e45dfff9 100644 (file)
@@ -193,7 +193,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC( 'm', 'p', '4', 'a' ) )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MP4A )
     {
         return VLC_EGENERIC;
     }
@@ -211,7 +211,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = AUDIO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('m','p','4','a');
+    p_dec->fmt_out.i_codec = VLC_CODEC_MP4A;
 
     msg_Dbg( p_dec, "running MPEG4 audio packetizer" );
 
index 018846c9980fa832596aa52e34284dd8bcbbe2ed..32daa37dfb26fd1c718e531d0b212f4600f022b6 100644 (file)
@@ -131,30 +131,8 @@ static int Open( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    switch( p_dec->fmt_in.i_codec )
-    {
-        case VLC_FOURCC( 'm', '4', 's', '2'):
-        case VLC_FOURCC( 'M', '4', 'S', '2'):
-        case VLC_FOURCC( 'm', 'p', '4', 's'):
-        case VLC_FOURCC( 'M', 'P', '4', 'S'):
-        case VLC_FOURCC( 'm', 'p', '4', 'v'):
-        case VLC_FOURCC( 'M', 'P', '4', 'V'):
-        case VLC_FOURCC( 'D', 'I', 'V', 'X'):
-        case VLC_FOURCC( 'd', 'i', 'v', 'x'):
-        case VLC_FOURCC( 'X', 'V', 'I', 'D'):
-        case VLC_FOURCC( 'X', 'v', 'i', 'D'):
-        case VLC_FOURCC( 'x', 'v', 'i', 'd'):
-        case VLC_FOURCC( 'D', 'X', '5', '0'):
-        case VLC_FOURCC( 'd', 'x', '5', '0'):
-        case VLC_FOURCC( 0x04, 0,   0,   0):
-        case VLC_FOURCC( '3', 'I', 'V', '2'):
-        case VLC_FOURCC( 'm', '4', 'c', 'c'):
-        case VLC_FOURCC( 'M', '4', 'C', 'C'):
-            break;
-
-        default:
-            return VLC_EGENERIC;
-    }
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MP4V )
+        return VLC_EGENERIC;
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys = malloc( sizeof(decoder_sys_t) ) ) == NULL )
@@ -172,7 +150,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Setup properties */
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
-    p_dec->fmt_out.i_codec = VLC_FOURCC( 'm', 'p', '4', 'v' );
+    p_dec->fmt_out.i_codec = VLC_CODEC_MP4V;
 
     if( p_dec->fmt_in.i_extra )
     {
index a3a4020cfb57a89edda885b03f58bb6ec3e218d3..fa3c0e218ca1ab8f475535a907bfd4efcd55e136 100644 (file)
@@ -153,14 +153,12 @@ static int Open( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC( 'm', 'p', 'g', '1' ) &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'm', 'p', 'g', '2' ) &&
-        p_dec->fmt_in.i_codec != VLC_FOURCC( 'm', 'p', 'g', 'v' ) )
-    {
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_MPGV )
         return VLC_EGENERIC;
-    }
 
-    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_FOURCC('m','p','g','v') );
+    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_MPGV );
+    p_dec->fmt_out.i_original_fourcc = p_dec->fmt_in.i_original_fourcc;
+
     p_dec->pf_packetize = Packetize;
     p_dec->pf_get_cc = GetCc;
 
index c422f7a3dc73fed98bbb6f0b4e78bd5648496f03..83c7f500822ecb072d0f41aa5aa7efe52cc9da28 100644 (file)
@@ -130,7 +130,7 @@ static int Open( vlc_object_t *p_this )
     decoder_t     *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
 
-    if( p_dec->fmt_in.i_codec !=  VLC_FOURCC( 'W', 'V', 'C', '1' ) )
+    if( p_dec->fmt_in.i_codec !=  VLC_CODEC_VC1 )
         return VLC_EGENERIC;
 
     p_dec->pf_packetize = Packetize;
index 4a8e6382e5c7eb0b8e82fa9bf70c967855e08ed0..496459310a2377d0373011ed66559a40acd7e58e 100644 (file)
@@ -66,38 +66,12 @@ struct sout_stream_sys_t
     filter_chain_t *p_vf2;
 };
 
-#define PICTURE_RING_SIZE 4
 struct decoder_owner_sys_t
 {
-    picture_t *pp_pics[PICTURE_RING_SIZE];
-
     /* Current format in use by the output */
     video_format_t video;
 };
 
-typedef void (* pf_release_t)( picture_t * );
-static void ReleasePicture( picture_t *p_pic )
-{
-    assert( p_pic );
-
-
-    if( p_pic->p_sys )
-    {
-        pf_release_t pf_release = (pf_release_t)p_pic->p_sys;
-        p_pic->p_sys = NULL;
-        pf_release( p_pic );
-    }
-    else
-    {
-        if( --p_pic->i_refcount == 0 )
-        {
-            free( p_pic->p_q );
-            free( p_pic->p_data_orig );
-            free( p_pic );
-        }
-    }
-}
-
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -109,12 +83,11 @@ static int               Send( sout_stream_t *, sout_stream_id_t *, block_t * );
 
 inline static void video_del_buffer_decoder( decoder_t *, picture_t * );
 inline static void video_del_buffer_filter( filter_t *, picture_t * );
-static void video_del_buffer( picture_t * );
 
 inline static picture_t *video_new_buffer_decoder( decoder_t * );
 inline static picture_t *video_new_buffer_filter( filter_t * );
 static picture_t *video_new_buffer( vlc_object_t *, decoder_owner_sys_t *,
-                                    es_format_t *, void (*)( picture_t * ) );
+                                    es_format_t * );
 
 static void video_link_picture_decoder( decoder_t *, picture_t * );
 static void video_unlink_picture_decoder( decoder_t *, picture_t * );
@@ -349,8 +322,6 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
         return NULL;
     }
 
-    for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        p_sys->p_decoder->p_owner->pp_pics[i] = NULL;
     p_sys->p_decoder->p_owner->video = p_fmt->video;
     //p_sys->p_decoder->p_cfg = p_sys->p_video_cfg;
 
@@ -481,16 +452,6 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
         vlc_object_detach( p_sys->p_decoder );
         vlc_object_release( p_sys->p_decoder );
 
-        picture_t **pp_ring = p_owner->pp_pics;
-        for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        {
-            if ( pp_ring[i] != NULL )
-            {
-                free( pp_ring[i]->p_data_orig );
-                free( pp_ring[i]->p_sys );
-                free( pp_ring[i] );
-            }
-        }
         free( p_owner );
     }
 
@@ -507,7 +468,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
     while ( p_es->p_picture )
     {
         picture_t *p_next = p_es->p_picture->p_next;
-        p_es->p_picture->pf_release( p_es->p_picture );
+        picture_Release( p_es->p_picture );
         p_es->p_picture = p_next;
     }
 
@@ -588,7 +549,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
             if( p_sys->i_chroma )
                 fmt_out.i_chroma = p_sys->i_chroma;
             else
-                fmt_out.i_chroma = VLC_FOURCC('I','4','2','0');
+                fmt_out.i_chroma = VLC_CODEC_I420;
 
             if ( !p_sys->i_height )
             {
@@ -614,7 +575,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
 
             p_new_pic = image_Convert( p_sys->p_image,
                                        p_pic, &fmt_in, &fmt_out );
-            if ( p_new_pic == NULL )
+            if( p_new_pic == NULL )
             {
                 msg_Err( p_stream, "image conversion failed" );
                 picture_Release( p_pic );
@@ -625,34 +586,18 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
         {
             /* TODO: chroma conversion if needed */
 
-            p_new_pic = (picture_t*)malloc( sizeof(picture_t) );
-            if( p_new_pic == NULL )
-            {
-                msg_Err( p_stream, "image conversion failed" );
-                continue;
-            }
-
-            if( vout_AllocatePicture(
-                                  p_stream, p_new_pic, p_pic->format.i_chroma,
-                                  p_pic->format.i_width, p_pic->format.i_height,
-                                  p_sys->p_decoder->fmt_out.video.i_aspect )
-                != VLC_SUCCESS )
+            p_new_pic = picture_New( p_pic->format.i_chroma,
+                                     p_pic->format.i_width, p_pic->format.i_height,
+                                     p_sys->p_decoder->fmt_out.video.i_aspect );
+            if( !p_new_pic )
             {
                 picture_Release( p_pic );
-                free( p_new_pic );
                 msg_Err( p_stream, "image allocation failed" );
                 continue;
             }
 
             picture_Copy( p_new_pic, p_pic );
         }
-
-        p_new_pic->i_refcount = 1;
-        p_new_pic->i_status = DESTROYED_PICTURE;
-        p_new_pic->i_type   = DIRECT_PICTURE;
-        p_new_pic->p_sys = (picture_sys_t *)p_new_pic->pf_release;
-        p_new_pic->pf_release = ReleasePicture;
-        p_new_pic->date = p_pic->date;
         picture_Release( p_pic );
 
         if( p_sys->p_vf2 )
@@ -664,59 +609,24 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
     return VLC_SUCCESS;
 }
 
-struct picture_sys_t
-{
-    vlc_object_t *p_owner;
-    bool b_dead;
-};
-
-static void video_release_buffer_decoder( picture_t *p_pic )
-{
-    assert( p_pic && p_pic->p_sys );
-
-    if( --p_pic->i_refcount > 0 )
-        return;
-
-    video_del_buffer_decoder( (decoder_t *)p_pic->p_sys->p_owner, p_pic );
-}
-
-static void video_release_buffer_filter( picture_t *p_pic )
-{
-    assert( p_pic );
-
-    if( --p_pic->i_refcount > 0 )
-        return;
-
-    assert( p_pic->p_sys );
-
-    video_del_buffer_filter( (filter_t *)p_pic->p_sys->p_owner, p_pic );
-}
-
 inline static picture_t *video_new_buffer_decoder( decoder_t *p_dec )
 {
     return video_new_buffer( VLC_OBJECT( p_dec ),
                              (decoder_owner_sys_t *)p_dec->p_owner,
-                             &p_dec->fmt_out,
-                             video_release_buffer_decoder );
+                             &p_dec->fmt_out );
 }
 
 inline static picture_t *video_new_buffer_filter( filter_t *p_filter )
 {
     return video_new_buffer( VLC_OBJECT( p_filter ),
                              (decoder_owner_sys_t *)p_filter->p_owner,
-                             &p_filter->fmt_out,
-                             video_release_buffer_filter );
+                             &p_filter->fmt_out );
 }
 
 static picture_t *video_new_buffer( vlc_object_t *p_this,
                                     decoder_owner_sys_t *p_sys,
-                                    es_format_t *fmt_out,
-                                    void ( *pf_release )( picture_t * ) )
+                                    es_format_t *fmt_out )
 {
-    picture_t **pp_ring = p_sys->pp_pics;
-    picture_t *p_pic;
-    int i;
-
     if( fmt_out->video.i_width != p_sys->video.i_width ||
         fmt_out->video.i_height != p_sys->video.i_height ||
         fmt_out->video.i_chroma != p_sys->video.i_chroma ||
@@ -746,123 +656,41 @@ static picture_t *video_new_buffer( vlc_object_t *p_this,
 
         fmt_out->video.i_chroma = fmt_out->i_codec;
         p_sys->video = fmt_out->video;
-
-        for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        {
-            if ( pp_ring[i] != NULL )
-            {
-                if ( pp_ring[i]->i_status == DESTROYED_PICTURE )
-                {
-                    free( pp_ring[i]->p_data_orig );
-                    free( pp_ring[i]->p_sys );
-                    free( pp_ring[i] );
-                }
-                else
-                {
-                    pp_ring[i]->p_sys->b_dead = true;
-                }
-                pp_ring[i] = NULL;
-            }
-        }
     }
 
-    /* Find an empty space in the picture ring buffer */
-    for( i = 0; i < PICTURE_RING_SIZE; i++ )
-    {
-        if( pp_ring[i] != NULL && pp_ring[i]->i_status == DESTROYED_PICTURE )
-        {
-            pp_ring[i]->i_status = RESERVED_PICTURE;
-            pp_ring[i]->i_refcount = 1;
-            return pp_ring[i];
-        }
-    }
-    for( i = 0; i < PICTURE_RING_SIZE; i++ )
-    {
-        if( pp_ring[i] == NULL ) break;
-    }
-
-    if( i == PICTURE_RING_SIZE )
-    {
-        msg_Err( p_this, "decoder/filter is leaking pictures, "
-                 "resetting its ring buffer" );
-
-        for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        {
-            pp_ring[i]->p_sys->b_dead = true;
-            pp_ring[i]->pf_release( pp_ring[i] );
-            pp_ring[i] = NULL;
-        }
-
-        i = 0;
-    }
-
-    p_pic = malloc( sizeof(picture_t) );
-    if( !p_pic ) return NULL;
+    /* */
     fmt_out->video.i_chroma = fmt_out->i_codec;
-    if( vout_AllocatePicture( p_this, p_pic,
-                          fmt_out->video.i_chroma,
-                          fmt_out->video.i_width,
-                          fmt_out->video.i_height,
-                          fmt_out->video.i_aspect ) != VLC_SUCCESS )
-    {
-        free( p_pic );
-        return NULL;
-    }
-
-    if( !p_pic->i_planes )
-    {
-        free( p_pic );
-        return NULL;
-    }
-
-    p_pic->pf_release = pf_release;
-    p_pic->i_refcount = 1;
-    p_pic->p_sys = malloc( sizeof(picture_sys_t) );
-    p_pic->p_sys->p_owner = p_this;
-    p_pic->p_sys->b_dead = false;
-    p_pic->i_status = RESERVED_PICTURE;
 
-    pp_ring[i] = p_pic;
-
-    return p_pic;
+    return picture_New( fmt_out->video.i_chroma,
+                        fmt_out->video.i_width,
+                        fmt_out->video.i_height,
+                        fmt_out->video.i_aspect );
 }
 
 inline static void video_del_buffer_decoder( decoder_t *p_this,
                                              picture_t *p_pic )
 {
     VLC_UNUSED(p_this);
-    video_del_buffer( p_pic );
+    picture_Release( p_pic );
 }
 
 inline static void video_del_buffer_filter( filter_t *p_this,
                                             picture_t *p_pic )
 {
     VLC_UNUSED(p_this);
-    video_del_buffer( p_pic );
-}
-
-static void video_del_buffer( picture_t *p_pic )
-{
-    p_pic->i_refcount = 0;
-    p_pic->i_status = DESTROYED_PICTURE;
-    if ( p_pic->p_sys->b_dead )
-    {
-        free( p_pic->p_data_orig );
-        free( p_pic->p_sys );
-        free( p_pic );
-    }
+    picture_Release( p_pic );
 }
 
 static void video_link_picture_decoder( decoder_t *p_dec, picture_t *p_pic )
 {
     VLC_UNUSED(p_dec);
-    p_pic->i_refcount++;
+    picture_Hold( p_pic );
 }
 
 static void video_unlink_picture_decoder( decoder_t *p_dec, picture_t *p_pic )
 {
     VLC_UNUSED(p_dec);
-    video_release_buffer_decoder( p_pic );
+    picture_Release( p_pic );
 }
 
 
index c0ee052eeb1396bc4cf66c07f80229fa8eaaa730..db0a2edfbfa8b8d10f1156a2e5309f207b0816f8 100644 (file)
@@ -1404,7 +1404,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
     switch ( id->fmt.i_cat )
     {
     case AUDIO_ES:
-        if ( id->fmt.i_codec == VLC_FOURCC('a', 'l', 'a', 'c') )
+        if ( id->fmt.i_codec == VLC_CODEC_ALAC )
         {
             if ( p_sys->p_audio_stream )
             {
index e7ca29dbd49a034b6ed91479fdc154c332c92e7b..e9bd8106b14ceb39a78900defd2138c92096ad64 100644 (file)
@@ -267,38 +267,36 @@ typedef struct
  * Do not do non native and non standard association !
  * Muxer will be probe if no entry found */
 static const muxer_properties_t p_muxers[] = {
-    M( "raw", "mp3", 1,         VLC_FOURCC('m','p','g','a') ),
-    M( "raw", "a52", 1,         VLC_FOURCC('a','5','2',' ') ),
-    M( "raw", "dts", 1,         VLC_FOURCC('d','t','s',' ') ),
-    M( "raw", "mpc", 1,         VLC_FOURCC('m','p','c',' ') ),
-    M( "raw", "ape", 1,         VLC_FOURCC('A','P','E',' ') ),
-
-    M( "wav", "wav", 1,         VLC_FOURCC('a','r','a','w'), VLC_FOURCC('u','8',' ',' '), VLC_FOURCC('s','1','6','l'),
-                                VLC_FOURCC('s','2','4','l'), VLC_FOURCC('s','3','2','l'), VLC_FOURCC('f','l','3','2') ),
-
-    //M( "ffmpeg{mux=flac}", "flac", 1, VLC_FOURCC('f','l','a','c') ), BROKEN
-
-    M( "ogg", "ogg", INT_MAX,   VLC_FOURCC('v','o','r','b'), VLC_FOURCC('s','p','x',' '), VLC_FOURCC('f','l','a','c'),
-                                VLC_FOURCC('s','u','b','t'), VLC_FOURCC('t','h','e','o'), VLC_FOURCC('d','r','a','c')  ),
-
-    M( "asf", "asf", 127,       VLC_FOURCC('w','m','a','1'), VLC_FOURCC('w','m','a','2'), VLC_FOURCC('w','m','a',' '),
-                                VLC_FOURCC('w','m','a','p'), VLC_FOURCC('w','m','a','l'),
-                                VLC_FOURCC('W','M','V','1'), VLC_FOURCC('W','M','V','2'), VLC_FOURCC('W','M','V','3'),
-                                VLC_FOURCC('W','V','C','1')),
-
-    M( "mp4", "mp4", INT_MAX,   VLC_FOURCC('m','p','4','a'), VLC_FOURCC('h','2','6','4'), VLC_FOURCC('m','p','4','v'),
-                                VLC_FOURCC('s','u','b','t') ),
-
-    M( "ps", "mpg", 16/* FIXME*/,VLC_FOURCC('m','p','g','v'), VLC_FOURCC('m','p','1','v'), VLC_FOURCC('m','p','2','v'),
-                                VLC_FOURCC('m','p','g','a'), VLC_FOURCC('l','p','c','m'), VLC_FOURCC('a','5','2',' '),
-                                VLC_FOURCC('d','t','s',' '),
-                                VLC_FOURCC('s','p','u',' ') ),
-
-    M( "ts", "ts", 8000,        VLC_FOURCC('m','p','g','v'), VLC_FOURCC('m','p','1','v'), VLC_FOURCC('m','p','2','v'),
-                                VLC_FOURCC('h','2','6','4'),
-                                VLC_FOURCC('m','p','g','a'), VLC_FOURCC('l','p','c','m'), VLC_FOURCC('a','5','2',' '),
-                                VLC_FOURCC('d','t','s',' '), VLC_FOURCC('m','p','4','a'),
-                                VLC_FOURCC('d','v','b','s'), VLC_FOURCC('t','e','l','x') ),
+    M( "raw", "mp3", 1,         VLC_CODEC_MPGA ),
+    M( "raw", "a52", 1,         VLC_CODEC_A52 ),
+    M( "raw", "dts", 1,         VLC_CODEC_DTS ),
+    M( "raw", "mpc", 1,         VLC_CODEC_MUSEPACK7, VLC_CODEC_MUSEPACK8 ),
+    M( "raw", "ape", 1,         VLC_CODEC_APE ),
+
+    M( "wav", "wav", 1,         VLC_CODEC_U8, VLC_CODEC_S16L,
+                                VLC_CODEC_S24L, VLC_CODEC_S32L, VLC_CODEC_FL32 ),
+
+    //M( "ffmpeg{mux=flac}", "flac", 1, VLC_CODEC_FLAC ), BROKEN
+
+    M( "ogg", "ogg", INT_MAX,   VLC_CODEC_VORBIS, VLC_CODEC_SPEEX, VLC_CODEC_FLAC,
+                                VLC_CODEC_SUBT, VLC_CODEC_THEORA, VLC_CODEC_DIRAC  ),
+
+    M( "asf", "asf", 127,       VLC_CODEC_WMA1, VLC_CODEC_WMA2, VLC_CODEC_WMAP, VLC_CODEC_WMAL, VLC_CODEC_WMAS,
+                                VLC_CODEC_WMV1, VLC_CODEC_WMV2, VLC_CODEC_WMV3, VLC_CODEC_VC1 ),
+
+    M( "mp4", "mp4", INT_MAX,   VLC_CODEC_MP4A, VLC_CODEC_H264, VLC_CODEC_MP4V,
+                                VLC_CODEC_SUBT ),
+
+    M( "ps", "mpg", 16/* FIXME*/,VLC_CODEC_MPGV,
+                                VLC_CODEC_MPGA, VLC_CODEC_DVD_LPCM, VLC_CODEC_A52,
+                                VLC_CODEC_DTS,
+                                VLC_CODEC_SPU ),
+
+    M( "ts", "ts", 8000,        VLC_CODEC_MPGV,
+                                VLC_CODEC_H264,
+                                VLC_CODEC_MPGA, VLC_CODEC_DVD_LPCM, VLC_CODEC_A52,
+                                VLC_CODEC_DTS, VLC_CODEC_MP4A,
+                                VLC_CODEC_DVBS, VLC_CODEC_TELETEXT ),
 
     M( NULL, NULL, 0, 0 )
 };
index edd06c6ec9738470acf2fd5bf50d98367b62800d..909a2949dcba5d103e27d0dd80423278471aa8a9 100644 (file)
@@ -1030,21 +1030,21 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
     else
     switch( p_fmt->i_codec )
     {
-        case VLC_FOURCC( 'u', 'l', 'a', 'w' ):
+        case VLC_CODEC_MULAW:
             if( p_fmt->audio.i_channels == 1 && p_fmt->audio.i_rate == 8000 )
                 id->i_payload_type = 0;
             id->psz_enc = "PCMU";
             id->pf_packetize = rtp_packetize_split;
             rtp_set_ptime (id, 20, 1);
             break;
-        case VLC_FOURCC( 'a', 'l', 'a', 'w' ):
+        case VLC_CODEC_ALAW:
             if( p_fmt->audio.i_channels == 1 && p_fmt->audio.i_rate == 8000 )
                 id->i_payload_type = 8;
             id->psz_enc = "PCMA";
             id->pf_packetize = rtp_packetize_split;
             rtp_set_ptime (id, 20, 1);
             break;
-        case VLC_FOURCC( 's', '1', '6', 'b' ):
+        case VLC_CODEC_S16B:
             if( p_fmt->audio.i_channels == 1 && p_fmt->audio.i_rate == 44100 )
             {
                 id->i_payload_type = 11;
@@ -1058,25 +1058,23 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
             id->pf_packetize = rtp_packetize_split;
             rtp_set_ptime (id, 20, 2);
             break;
-        case VLC_FOURCC( 'u', '8', ' ', ' ' ):
+        case VLC_CODEC_U8:
             id->psz_enc = "L8";
             id->pf_packetize = rtp_packetize_split;
             rtp_set_ptime (id, 20, 1);
             break;
-        case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
-        case VLC_FOURCC( 'm', 'p', '3', ' ' ):
+        case VLC_CODEC_MPGA:
             id->i_payload_type = 14;
             id->psz_enc = "MPA";
             id->i_clock_rate = 90000; /* not 44100 */
             id->pf_packetize = rtp_packetize_mpa;
             break;
-        case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
+        case VLC_CODEC_MPGV:
             id->i_payload_type = 32;
             id->psz_enc = "MPV";
             id->pf_packetize = rtp_packetize_mpv;
             break;
-        case VLC_FOURCC( 'G', '7', '2', '6' ):
-        case VLC_FOURCC( 'g', '7', '2', '6' ):
+        case VLC_CODEC_ADPCM_G726:
             switch( p_fmt->i_bitrate / 1000 )
             {
             case 16:
@@ -1097,15 +1095,15 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
                 break;
             }
             break;
-        case VLC_FOURCC( 'a', '5', '2', ' ' ):
+        case VLC_CODEC_A52:
             id->psz_enc = "ac3";
             id->pf_packetize = rtp_packetize_ac3;
             break;
-        case VLC_FOURCC( 'H', '2', '6', '3' ):
+        case VLC_CODEC_H263:
             id->psz_enc = "H263-1998";
             id->pf_packetize = rtp_packetize_h263;
             break;
-        case VLC_FOURCC( 'h', '2', '6', '4' ):
+        case VLC_CODEC_H264:
             id->psz_enc = "H264";
             id->pf_packetize = rtp_packetize_h264;
             id->psz_fmtp = NULL;
@@ -1164,7 +1162,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
                 id->psz_fmtp = strdup( "packetization-mode=1" );
             break;
 
-        case VLC_FOURCC( 'm', 'p', '4', 'v' ):
+        case VLC_CODEC_MP4V:
         {
             char hexa[2*p_fmt->i_extra +1];
 
@@ -1179,7 +1177,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
             }
             break;
         }
-        case VLC_FOURCC( 'm', 'p', '4', 'a' ):
+        case VLC_CODEC_MP4A:
         {
             if(!p_sys->b_latm)
             {
@@ -1224,21 +1222,21 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
             }
             break;
         }
-        case VLC_FOURCC( 's', 'a', 'm', 'r' ):
+        case VLC_CODEC_AMR_NB:
             id->psz_enc = "AMR";
             id->psz_fmtp = strdup( "octet-align=1" );
             id->pf_packetize = rtp_packetize_amr;
             break;
-        case VLC_FOURCC( 's', 'a', 'w', 'b' ):
+        case VLC_CODEC_AMR_WB:
             id->psz_enc = "AMR-WB";
             id->psz_fmtp = strdup( "octet-align=1" );
             id->pf_packetize = rtp_packetize_amr;
             break;
-        case VLC_FOURCC( 's', 'p', 'x', ' ' ):
+        case VLC_CODEC_SPEEX:
             id->psz_enc = "SPEEX";
             id->pf_packetize = rtp_packetize_spx;
             break;
-        case VLC_FOURCC( 't', '1', '4', '0' ):
+        case VLC_CODEC_ITU_T140:
             id->psz_enc = "t140" ;
             id->i_clock_rate = 1000;
             id->pf_packetize = rtp_packetize_t140;
index 9faf03eff2a2f97518feb9d561f1148c43da6558..63aca6f81cb87322c275d309c28f32d42618daef 100644 (file)
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 #include <vlc_avcodec.h>
 
 #include <vlc_block.h>
@@ -323,16 +322,16 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
         return NULL;
 
     if( p_fmt->i_cat == VIDEO_ES &&
-        ( p_fmt->i_codec == VLC_FOURCC('m', 'p', 'g', 'v') ||
+        ( p_fmt->i_codec == VLC_CODEC_MPGV ||
           p_fmt->i_codec == VLC_FOURCC('f', 'a', 'k', 'e') ) )
     {
         id->b_switcher_video = true;
-        p_fmt->i_codec = VLC_FOURCC('m', 'p', 'g', 'v');
+        p_fmt->i_codec = VLC_CODEC_MPGV;
         msg_Dbg( p_stream, "creating video switcher for fcc=`%4.4s' cmd:%d",
                  (char*)&p_fmt->i_codec, p_sys->i_cmd );
     }
     else if ( p_fmt->i_cat == AUDIO_ES &&
-              p_fmt->i_codec == VLC_FOURCC('m', 'p', 'g', 'a') &&
+              p_fmt->i_codec == VLC_CODEC_MPGA &&
               p_sys->b_audio )
     {
         int i_ff_codec = CODEC_ID_MP2;
@@ -613,9 +612,13 @@ static int UnpackFromFile( sout_stream_t *p_stream, const char *psz_file,
         return -1;
     }
 
-    vout_InitPicture( VLC_OBJECT(p_stream), p_pic, VLC_FOURCC('I','4','2','0'),
-                      i_width, i_height,
-                      i_width * VOUT_ASPECT_FACTOR / i_height );
+    if( picture_Setup( p_pic, VLC_CODEC_I420,
+                       i_width, i_height,
+                       i_width * VOUT_ASPECT_FACTOR / i_height ) )
+    {
+        msg_Err( p_stream, "unknown chroma" );
+        return -1;
+    }
     for ( i = 0; i < p_pic->i_planes; i++ )
     {
         p_pic->p[i].p_pixels = malloc( p_pic->p[i].i_lines *
index b4bf89136ab1126212cc4a0286783aac5d89a22c..d8eb8cad0cba5d38de97e14f99dffd6e9ccee7ba 100644 (file)
@@ -268,13 +268,10 @@ static int  transcode_video_encoder_open( sout_stream_t *, sout_stream_id_t *);
 static int  transcode_video_process( sout_stream_t *, sout_stream_id_t *,
                                      block_t *, block_t ** );
 
-static void video_del_buffer( vlc_object_t *, picture_t * );
 static picture_t *video_new_buffer_decoder( decoder_t * );
 static void video_del_buffer_decoder( decoder_t *, picture_t * );
 static void video_link_picture_decoder( decoder_t *, picture_t * );
 static void video_unlink_picture_decoder( decoder_t *, picture_t * );
-static picture_t *video_new_buffer_filter( filter_t * );
-static void video_del_buffer_filter( filter_t *, picture_t * );
 
 static int  transcode_spu_new    ( sout_stream_t *, sout_stream_id_t * );
 static void transcode_spu_close  ( sout_stream_id_t * );
@@ -365,12 +362,6 @@ struct sout_stream_sys_t
 
 struct decoder_owner_sys_t
 {
-    picture_t *pp_pics[PICTURE_RING_SIZE];
-    sout_stream_sys_t *p_sys;
-};
-struct filter_owner_sys_t
-{
-    picture_t *pp_pics[PICTURE_RING_SIZE];
     sout_stream_sys_t *p_sys;
 };
 
@@ -433,8 +424,8 @@ static int Open( vlc_object_t *p_this )
 
     if( p_sys->i_acodec )
     {
-        if( p_sys->i_acodec == VLC_FOURCC('m','p','3',0) &&
-            p_sys->i_channels > 2 )
+        if( ( p_sys->i_acodec == VLC_CODEC_MP3 ||
+              p_sys->i_acodec == VLC_CODEC_MPGA ) && p_sys->i_channels > 2 )
         {
             msg_Warn( p_stream, "%d channels invalid for mp3, forcing to 2",
                       p_sys->i_channels );
@@ -598,7 +589,7 @@ static int Open( vlc_object_t *p_this )
                                    &p_sys->p_osd_cfg, strdup( "dvbsub") );
         free( psz_next );
 
-        p_sys->i_osdcodec = VLC_FOURCC('Y','U','V','P' );
+        p_sys->i_osdcodec = VLC_CODEC_YUVP;
 
         msg_Dbg( p_stream, "codec osd=%4.4s", (char *)&p_sys->i_osdcodec );
 
@@ -1082,11 +1073,11 @@ static int transcode_audio_filter_chain_build( sout_stream_t *p_stream, filter_c
          p_dst->audio.i_rate );
 
     /* If any filter is needed, convert to fl32 */
-    if( current.i_codec != VLC_FOURCC('f','l','3','2') )
+    if( current.i_codec != VLC_CODEC_FL32 )
     {
         /* First step, convert to fl32 */
         current.i_codec =
-        current.audio.i_format = VLC_FOURCC('f','l','3','2');
+        current.audio.i_format = VLC_CODEC_FL32;
 
         if( !filter_chain_AppendFilter( p_chain, NULL, NULL, NULL, &current ) )
         {
@@ -1182,7 +1173,7 @@ static int transcode_audio_new( sout_stream_t *p_stream,
         aout_BitsPerSample( id->p_decoder->fmt_out.i_codec );
     fmt_last = id->p_decoder->fmt_out;
     /* Fix AAC SBR changing number of channels and sampling rate */
-    if( !(id->p_decoder->fmt_in.i_codec == VLC_FOURCC('m','p','4','a') &&
+    if( !(id->p_decoder->fmt_in.i_codec == VLC_CODEC_MP4A &&
         fmt_last.audio.i_rate != id->p_encoder->fmt_in.audio.i_rate &&
         fmt_last.audio.i_channels != id->p_encoder->fmt_in.audio.i_channels) )
         fmt_last.audio.i_rate = id->p_decoder->fmt_in.audio.i_rate;
@@ -1227,7 +1218,7 @@ static int transcode_audio_new( sout_stream_t *p_stream,
     {
         es_format_t fmt_fl32 = fmt_last;
         fmt_fl32.i_codec =
-        fmt_fl32.audio.i_format = VLC_FOURCC('f','l','3','2');
+        fmt_fl32.audio.i_format = VLC_CODEC_FL32;
         if( transcode_audio_filter_chain_build( p_stream, id->p_uf_chain,
                                                 &fmt_fl32, &fmt_last ) )
         {
@@ -1256,9 +1247,9 @@ static int transcode_audio_new( sout_stream_t *p_stream,
     }
     fmt_last = id->p_encoder->fmt_in;
 
-    /* FIXME: Hack for mp3 transcoding support */
-    if( id->p_encoder->fmt_out.i_codec == VLC_FOURCC( 'm','p','3',' ' ) )
-        id->p_encoder->fmt_out.i_codec = VLC_FOURCC( 'm','p','g','a' );
+    /* */
+    id->p_encoder->fmt_out.i_codec =
+        vlc_fourcc_GetCodec( AUDIO_ES, id->p_encoder->fmt_out.i_codec );
 
     return VLC_SUCCESS;
 }
@@ -1406,44 +1397,35 @@ static void audio_del_buffer( decoder_t *p_dec, aout_buffer_t *p_buffer )
  * video
  */
 
+static picture_t *transcode_video_filter_buffer_new( filter_t *p_filter )
+{
+    p_filter->fmt_out.video.i_chroma = p_filter->fmt_out.i_codec;
+    return picture_New( p_filter->fmt_out.video.i_chroma,
+                        p_filter->fmt_out.video.i_width,
+                        p_filter->fmt_out.video.i_height,
+                        p_filter->fmt_out.video.i_aspect );
+}
+static void transcode_video_filter_buffer_del( filter_t *p_filter, picture_t *p_pic )
+{
+    VLC_UNUSED(p_filter);
+    picture_Release( p_pic );
+}
+
 static int transcode_video_filter_allocation_init( filter_t *p_filter,
                                                    void *p_data )
 {
-    sout_stream_sys_t *p_sys = (sout_stream_sys_t*)p_data;
-    int i;
-
-    p_filter->pf_vout_buffer_new = video_new_buffer_filter;
-    p_filter->pf_vout_buffer_del = video_del_buffer_filter;
-
-    p_filter->p_owner = malloc( sizeof(filter_owner_sys_t) );
-    if( !p_filter->p_owner )
-        return VLC_EGENERIC;
-
-    for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        p_filter->p_owner->pp_pics[i] = 0;
-    p_filter->p_owner->p_sys = p_sys;
-
+    p_filter->pf_vout_buffer_new = transcode_video_filter_buffer_new;
+    p_filter->pf_vout_buffer_del = transcode_video_filter_buffer_del;
     return VLC_SUCCESS;
 }
 
 static void transcode_video_filter_allocation_clear( filter_t *p_filter )
 {
-    int j;
-
-    /* Clean-up pictures ring buffer */
-    for( j = 0; j < PICTURE_RING_SIZE; j++ )
-    {
-        if( p_filter->p_owner->pp_pics[j] )
-            video_del_buffer( VLC_OBJECT(p_filter),
-                              p_filter->p_owner->pp_pics[j] );
-    }
-    free( p_filter->p_owner );
 }
 
 static int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_t *id )
 {
     sout_stream_sys_t *p_sys = p_stream->p_sys;
-    int i;
 
     /* Open decoder
      * Initialization of decoder structures
@@ -1462,8 +1444,6 @@ static int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_t *id )
     if( !id->p_decoder->p_owner )
         return VLC_EGENERIC;
 
-    for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        id->p_decoder->p_owner->pp_pics[i] = 0;
     id->p_decoder->p_owner->p_sys = p_sys;
     /* id->p_decoder->p_cfg = p_sys->p_video_cfg; */
 
@@ -1739,12 +1719,9 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
 
     id->p_encoder->fmt_in.video.i_chroma = id->p_encoder->fmt_in.i_codec;
 
-    /* Hack for mp2v/mp1v transcoding support */
-    if( id->p_encoder->fmt_out.i_codec == VLC_FOURCC('m','p','1','v') ||
-        id->p_encoder->fmt_out.i_codec == VLC_FOURCC('m','p','2','v') )
-    {
-        id->p_encoder->fmt_out.i_codec = VLC_FOURCC('m','p','g','v');
-    }
+    /*  */
+    id->p_encoder->fmt_out.i_codec =
+        vlc_fourcc_GetCodec( VIDEO_ES, id->p_encoder->fmt_out.i_codec );
 
     id->id = sout_StreamIdAdd( p_stream->p_sys->p_out,
                                &id->p_encoder->fmt_out );
@@ -1760,8 +1737,6 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
 static void transcode_video_close( sout_stream_t *p_stream,
                                    sout_stream_id_t *id )
 {
-    int i;
-
     if( p_stream->p_sys->i_threads >= 1 )
     {
         vlc_mutex_lock( &p_stream->p_sys->lock_out );
@@ -1781,17 +1756,7 @@ static void transcode_video_close( sout_stream_t *p_stream,
     if( id->p_decoder->p_description )
         vlc_meta_Delete( id->p_decoder->p_description );
 
-    if( id->p_decoder->p_owner )
-    {
-        /* Clean-up pictures ring buffer */
-        for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        {
-            if( id->p_decoder->p_owner->pp_pics[i] )
-                video_del_buffer( VLC_OBJECT(id->p_decoder),
-                                  id->p_decoder->p_owner->pp_pics[i] );
-        }
-        free( id->p_decoder->p_owner );
-    }
+    free( id->p_decoder->p_owner );
 
     /* Close encoder */
     if( id->p_encoder->p_module )
@@ -1826,7 +1791,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
             {
                 msg_Dbg( p_stream, "late picture skipped (%"PRId64")",
                          current_date + 50000 - p_pic->date );
-                p_pic->pf_release( p_pic );
+                picture_Release( p_pic );
                 continue;
             }
         }
@@ -1857,7 +1822,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
                 msg_Dbg( p_stream, "dropping frame (%i)",
                          (int)(i_video_drift - i_master_drift) );
 #endif
-                p_pic->pf_release( p_pic );
+                picture_Release( p_pic );
                 continue;
             }
             else if( i_video_drift > (i_master_drift + 50000) )
@@ -1927,7 +1892,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
 
             if( transcode_video_encoder_open( p_stream, id ) != VLC_SUCCESS )
             {
-                p_pic->pf_release( p_pic );
+                picture_Release( p_pic );
                 transcode_video_close( p_stream, id );
                 id->b_transcode = false;
                 return VLC_EGENERIC;
@@ -1955,14 +1920,14 @@ static int transcode_video_process( sout_stream_t *p_stream,
         {
             video_format_t fmt;
 
-            if( p_pic->i_refcount && !filter_chain_GetLength( id->p_f_chain ) )
+            if( picture_IsReferenced( p_pic ) && !filter_chain_GetLength( id->p_f_chain ) )
             {
                 /* We can't modify the picture, we need to duplicate it */
                 picture_t *p_tmp = video_new_buffer_decoder( id->p_decoder );
                 if( p_tmp )
                 {
                     picture_Copy( p_tmp, p_pic );
-                    p_pic->pf_release( p_pic );
+                    picture_Release( p_pic );
                     p_pic = p_tmp;
                 }
             }
@@ -2043,7 +2008,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
 
         if( p_sys->i_threads == 0 )
         {
-            p_pic->pf_release( p_pic );
+            picture_Release( p_pic );
         }
         else
         {
@@ -2100,14 +2065,14 @@ static void* EncoderThread( vlc_object_t* p_this )
         block_ChainAppend( &p_sys->p_buffers, p_block );
 
         vlc_mutex_unlock( &p_sys->lock_out );
-        p_pic->pf_release( p_pic );
+        picture_Release( p_pic );
     }
 
     while( p_sys->i_last_pic != p_sys->i_first_pic )
     {
         p_pic = p_sys->pp_pics[p_sys->i_first_pic++];
         p_sys->i_first_pic %= PICTURE_RING_SIZE;
-        p_pic->pf_release( p_pic );
+        picture_Release( p_pic );
     }
     block_ChainRelease( p_sys->p_buffers );
 
@@ -2115,150 +2080,44 @@ static void* EncoderThread( vlc_object_t* p_this )
     return NULL;
 }
 
-struct picture_sys_t
-{
-    vlc_object_t *p_owner;
-};
-
-static void video_release_buffer( picture_t *p_pic )
+static picture_t *video_new_buffer_decoder( decoder_t *p_dec )
 {
-    if( p_pic && !p_pic->i_refcount && p_pic->pf_release && p_pic->p_sys )
+    sout_stream_sys_t *p_ssys = p_dec->p_owner->p_sys;
+    if( p_ssys->i_threads >= 1 )
     {
-        video_del_buffer_decoder( (decoder_t *)p_pic->p_sys->p_owner, p_pic );
-    }
-    else if( p_pic && p_pic->i_refcount > 0 ) p_pic->i_refcount--;
-}
-
-static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring,
-                                    sout_stream_sys_t *p_sys )
-{
-    decoder_t *p_dec = (decoder_t *)p_this;
-    picture_t *p_pic;
-    int i;
+        int i_first_pic = p_ssys->i_first_pic;
 
-    /* Find an empty space in the picture ring buffer */
-    for( i = 0; i < PICTURE_RING_SIZE; i++ )
-    {
-        if( pp_ring[i] != NULL && pp_ring[i]->i_status == DESTROYED_PICTURE )
-        {
-            pp_ring[i]->i_status = RESERVED_PICTURE;
-            return pp_ring[i];
-        }
-    }
-    for( i = 0; i < PICTURE_RING_SIZE; i++ )
-    {
-        if( pp_ring[i] == NULL ) break;
-    }
-
-    if( i == PICTURE_RING_SIZE && p_sys->i_threads >= 1 )
-    {
-        int i_first_pic = p_sys->i_first_pic;
-
-        if( p_sys->i_first_pic != p_sys->i_last_pic )
+        if( p_ssys->i_first_pic != p_ssys->i_last_pic )
         {
             /* Encoder still has stuff to encode, wait to clear-up the list */
-            while( p_sys->i_first_pic == i_first_pic )
+            while( p_ssys->i_first_pic == i_first_pic )
                 msleep( 100000 );
         }
-
-        /* Find an empty space in the picture ring buffer */
-        for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        {
-            if( pp_ring[i] != NULL && pp_ring[i]->i_status == DESTROYED_PICTURE )
-            {
-                pp_ring[i]->i_status = RESERVED_PICTURE;
-                return pp_ring[i];
-            }
-        }
-        for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        {
-            if( pp_ring[i] == NULL ) break;
-        }
-    }
-
-    if( i == PICTURE_RING_SIZE )
-    {
-        msg_Err( p_this, "decoder/filter is leaking pictures, "
-                 "resetting its ring buffer" );
-
-        for( i = 0; i < PICTURE_RING_SIZE; i++ )
-        {
-            pp_ring[i]->pf_release( pp_ring[i] );
-        }
-
-        i = 0;
     }
 
     p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
-    p_pic = picture_New( p_dec->fmt_out.video.i_chroma,
-                         p_dec->fmt_out.video.i_width,
-                         p_dec->fmt_out.video.i_height,
-                         p_dec->fmt_out.video.i_aspect );
-    if( !p_pic ) return NULL;
-    p_pic->p_sys = calloc( 1, sizeof(picture_sys_t) );
-    if( !p_pic->p_sys )
-    {
-        picture_Release( p_pic );
-        return NULL;
-    }
-    p_pic->pf_release = video_release_buffer;
-    p_pic->i_refcount = 0;
-
-    pp_ring[i] = p_pic;
-    return p_pic;
-}
-
-static picture_t *video_new_buffer_decoder( decoder_t *p_dec )
-{
-    return video_new_buffer( VLC_OBJECT(p_dec),
-                             p_dec->p_owner->pp_pics, p_dec->p_owner->p_sys );
-}
-
-static picture_t *video_new_buffer_filter( filter_t *p_filter )
-{
-    return video_new_buffer( VLC_OBJECT(p_filter),
-                             p_filter->p_owner->pp_pics,
-                             p_filter->p_owner->p_sys );
-}
-
-static void video_del_buffer( vlc_object_t *p_this, picture_t *p_pic )
-{
-    VLC_UNUSED(p_this);
-    if( p_pic )
-    {
-        free( p_pic->p_q );
-        free( p_pic->p_data_orig );
-        free( p_pic->p_sys );
-        free( p_pic );
-    }
+    return picture_New( p_dec->fmt_out.video.i_chroma,
+                        p_dec->fmt_out.video.i_width,
+                        p_dec->fmt_out.video.i_height,
+                        p_dec->fmt_out.video.i_aspect );
 }
 
 static void video_del_buffer_decoder( decoder_t *p_decoder, picture_t *p_pic )
 {
     VLC_UNUSED(p_decoder);
-    p_pic->i_refcount = 0;
-    p_pic->i_status = DESTROYED_PICTURE;
-    picture_CleanupQuant( p_pic );
-}
-
-static void video_del_buffer_filter( filter_t *p_filter, picture_t *p_pic )
-{
-    VLC_UNUSED(p_filter);
-    p_pic->i_refcount = 0;
-    p_pic->i_status = DESTROYED_PICTURE;
-    picture_CleanupQuant( p_pic );
+    picture_Release( p_pic );
 }
 
 static void video_link_picture_decoder( decoder_t *p_dec, picture_t *p_pic )
 {
     VLC_UNUSED(p_dec);
-    p_pic->i_refcount++;
+    picture_Hold( p_pic );
 }
 
 static void video_unlink_picture_decoder( decoder_t *p_dec, picture_t *p_pic )
 {
     VLC_UNUSED(p_dec);
-    video_release_buffer( p_pic );
+    picture_Release( p_pic );
 }
 
 /*
@@ -2406,7 +2265,7 @@ static int transcode_osd_new( sout_stream_t *p_stream, sout_stream_id_t *id )
 
         /* Open encoder */
         es_format_Init( &id->p_encoder->fmt_in, id->p_decoder->fmt_in.i_cat,
-                        VLC_FOURCC('Y','U','V','A') );
+                        VLC_CODEC_YUVA );
         id->p_encoder->fmt_in.psz_language = strdup( "osd" );
 
         id->p_encoder->p_cfg = p_sys->p_osd_cfg;
index af73e7c2ef620e53947fb1ee04d43f1093717fbf..1425bbc4b2d93cc9d9c94215c127b179e05da306 100644 (file)
@@ -175,7 +175,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
     id->id = NULL;
 
     if( p_fmt->i_cat == VIDEO_ES
-            && p_fmt->i_codec == VLC_FOURCC('m', 'p', 'g', 'v') )
+            && p_fmt->i_codec == VLC_CODEC_MPGV )
     {
         msg_Dbg( p_stream,
                  "creating video transrating for fcc=`%4.4s'",
index 99e150c99fa7b1e37bf38d110d5be09789f8ebf6..84b39fd32431eedbf9cd8fa8632ae1cad51783e5 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #define SRC_FOURCC  "GREY"
 #define DEST_FOURCC "I420,YUY2"
@@ -78,15 +77,13 @@ static int Activate( vlc_object_t *p_this )
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('Y','8','0','0'):
-            p_filter->fmt_in.video.i_chroma = VLC_FOURCC('G','R','E','Y');
-        case VLC_FOURCC('G','R','E','Y'):
+        case VLC_CODEC_GREY:
             switch( p_filter->fmt_out.video.i_chroma )
             {
-                case VLC_FOURCC('I','4','2','0'):
+                case VLC_CODEC_I420:
                     p_filter->pf_video_filter = GREY_I420_Filter;
                     break;
-                case VLC_FOURCC('Y','U','Y','2'):
+                case VLC_CODEC_YUYV:
                     p_filter->pf_video_filter = GREY_YUY2_Filter;
                     break;
                 default:
index 1d56f9d5f1ce8e44ec03bd7dfbe6a8a7014b5e72..28303f79a9eb5aa7f1a7929a944c0ada617064c2 100644 (file)
@@ -35,7 +35,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #include "i420_rgb.h"
 #if defined (MODULE_NAME_IS_i420_rgb)
@@ -107,18 +106,17 @@ static int Activate( vlc_object_t *p_this )
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('Y','V','1','2'):
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('I','Y','U','V'):
+        case VLC_CODEC_YV12:
+        case VLC_CODEC_I420:
             switch( p_filter->fmt_out.video.i_chroma )
             {
 #if defined (MODULE_NAME_IS_i420_rgb)
-                case VLC_FOURCC('R','G','B','2'):
+                case VLC_CODEC_RGB8:
                     p_filter->pf_video_filter = I420_RGB8_Filter;
                     break;
 #endif
-                case VLC_FOURCC('R','V','1','5'):
-                case VLC_FOURCC('R','V','1','6'):
+                case VLC_CODEC_RGB15:
+                case VLC_CODEC_RGB16:
 #if ! defined (MODULE_NAME_IS_i420_rgb)
                     /* If we don't have support for the bitmasks, bail out */
                     if( ( p_filter->fmt_out.video.i_rmask == 0x7c00
@@ -147,10 +145,10 @@ static int Activate( vlc_object_t *p_this )
 
 #if 0
                 /* Hmmm, is there only X11 using 32bits per pixel for RV24 ? */
-                case VLC_FOURCC('R','V','2','4'):
+                case VLC_CODEC_RGB24:
 #endif
 
-                case VLC_FOURCC('R','V','3','2'):
+                case VLC_CODEC_RGB32:
 #if ! defined (MODULE_NAME_IS_i420_rgb)
                     /* If we don't have support for the bitmasks, bail out */
                     if( p_filter->fmt_out.video.i_rmask == 0x00ff0000
@@ -211,18 +209,18 @@ static int Activate( vlc_object_t *p_this )
     switch( p_filter->fmt_out.video.i_chroma )
     {
 #if defined (MODULE_NAME_IS_i420_rgb)
-        case VLC_FOURCC('R','G','B','2'):
+        case VLC_CODEC_RGB8:
             p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH );
             break;
 #endif
 
-        case VLC_FOURCC('R','V','1','5'):
-        case VLC_FOURCC('R','V','1','6'):
+        case VLC_CODEC_RGB15:
+        case VLC_CODEC_RGB16:
             p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 2 );
             break;
 
-        case VLC_FOURCC('R','V','2','4'):
-        case VLC_FOURCC('R','V','3','2'):
+        case VLC_CODEC_RGB24:
+        case VLC_CODEC_RGB32:
             p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 4 );
             break;
 
@@ -239,7 +237,7 @@ static int Activate( vlc_object_t *p_this )
 
     p_filter->p_sys->p_offset = malloc( p_filter->fmt_out.video.i_width
                     * ( ( p_filter->fmt_out.video.i_chroma
-                           == VLC_FOURCC('R','G','B','2') ) ? 2 : 1 )
+                           == VLC_CODEC_RGB8 ) ? 2 : 1 )
                     * sizeof( int ) );
     if( p_filter->p_sys->p_offset == NULL )
     {
@@ -251,11 +249,11 @@ static int Activate( vlc_object_t *p_this )
 #if defined (MODULE_NAME_IS_i420_rgb)
     switch( p_filter->fmt_out.video.i_chroma )
     {
-    case VLC_FOURCC('R','G','B','2'):
+    case VLC_CODEC_RGB8:
         i_tables_size = sizeof( uint8_t ) * PALETTE_TABLE_SIZE;
         break;
-    case VLC_FOURCC('R','V','1','5'):
-    case VLC_FOURCC('R','V','1','6'):
+    case VLC_CODEC_RGB15:
+    case VLC_CODEC_RGB16:
         i_tables_size = sizeof( uint16_t ) * RGB_TABLE_SIZE;
         break;
     default: /* RV24, RV32 */
@@ -348,13 +346,13 @@ static void SetYUV( filter_t *p_filter )
     /* Color: build red, green and blue tables */
     switch( p_filter->fmt_out.video.i_chroma )
     {
-    case VLC_FOURCC('R','G','B','2'):
+    case VLC_CODEC_RGB8:
         p_filter->p_sys->p_rgb8 = (uint8_t *)p_filter->p_sys->p_base;
         Set8bppPalette( p_filter, p_filter->p_sys->p_rgb8 );
         break;
 
-    case VLC_FOURCC('R','V','1','5'):
-    case VLC_FOURCC('R','V','1','6'):
+    case VLC_CODEC_RGB15:
+    case VLC_CODEC_RGB16:
         p_filter->p_sys->p_rgb16 = (uint16_t *)p_filter->p_sys->p_base;
         for( i_index = 0; i_index < RED_MARGIN; i_index++ )
         {
@@ -379,8 +377,8 @@ static void SetYUV( filter_t *p_filter )
         }
         break;
 
-    case VLC_FOURCC('R','V','2','4'):
-    case VLC_FOURCC('R','V','3','2'):
+    case VLC_CODEC_RGB24:
+    case VLC_CODEC_RGB32:
         p_filter->p_sys->p_rgb32 = (uint32_t *)p_filter->p_sys->p_base;
         for( i_index = 0; i_index < RED_MARGIN; i_index++ )
         {
index 3f0c6734f5d3a20d09399c397a27a860edc1ce45..a8532f72e2e83160eff638b46c6da4bdc39a87b0 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <vlc/vlc.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #include "i420_rgb.h"
 #if defined (MODULE_NAME_IS_i420_rgb)
index 78ed5c6e17f4f7eb1e60e0a4fbe144b5da813849..8d43532ffd599dbdecaa6741bc55084f392cb8fd 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc/vlc.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #include "i420_rgb.h"
 #include "i420_rgb_c.h"
index 6e0f77c8a102be984216bd5ce28b9884b66f10f5..5d8789f21308715357f2160a5883b683944be0d9 100644 (file)
@@ -34,7 +34,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #define SRC_FOURCC  "I420,IYUV,YV12"
 #define DEST_FOURCC "YMGA"
@@ -82,12 +81,11 @@ static int Activate( vlc_object_t *p_this )
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('Y','V','1','2'):
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('I','Y','U','V'):
+        case VLC_CODEC_YV12:
+        case VLC_CODEC_I420:
             switch( p_filter->fmt_out.video.i_chroma )
             {
-                case VLC_FOURCC('Y','M','G','A'):
+                case VLC_CODEC_YMGA:
                     p_filter->pf_video_filter = I420_YMGA_Filter;
                     break;
 
index 15f5ac2fee6d469c27339e27e161b761f1ba043c..facdf0a58595fb77d3fa0b98d2ca5cb4d98f99cc 100644 (file)
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #if defined (MODULE_NAME_IS_i420_yuy2_altivec) && defined(HAVE_ALTIVEC_H)
 #   include <altivec.h>
@@ -126,23 +125,19 @@ static int Activate( vlc_object_t *p_this )
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('Y','V','1','2'):
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('I','Y','U','V'):
+        case VLC_CODEC_YV12:
+        case VLC_CODEC_I420:
             switch( p_filter->fmt_out.video.i_chroma )
             {
-                case VLC_FOURCC('Y','U','Y','2'):
-                case VLC_FOURCC('Y','U','N','V'):
+                case VLC_CODEC_YUYV:
                     p_filter->pf_video_filter = I420_YUY2_Filter;
                     break;
 
-                case VLC_FOURCC('Y','V','Y','U'):
+                case VLC_CODEC_YVYU:
                     p_filter->pf_video_filter = I420_YVYU_Filter;
                     break;
 
-                case VLC_FOURCC('U','Y','V','Y'):
-                case VLC_FOURCC('U','Y','N','V'):
-                case VLC_FOURCC('Y','4','2','2'):
+                case VLC_CODEC_UYVY:
                     p_filter->pf_video_filter = I420_UYVY_Filter;
                     break;
 #if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
@@ -150,13 +145,13 @@ static int Activate( vlc_object_t *p_this )
                     p_filter->pf_video_filter = I420_IUYV_Filter;
                     break;
 
-                case VLC_FOURCC('c','y','u','v'):
+                case VLC_CODEC_CYUV:
                     p_filter->pf_video_filter = I420_cyuv_Filter;
                     break;
 #endif
 
 #if defined (MODULE_NAME_IS_i420_yuy2)
-                case VLC_FOURCC('Y','2','1','1'):
+                case VLC_CODEC_Y211:
                     p_filter->pf_video_filter = I420_Y211_Filter;
                     break;
 #endif
index 7cb40e3b90ade7db445468696c89cc151869a197..c9291679b600b3ea07d63deebbf79115f78d271d 100644 (file)
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #define SRC_FOURCC  "I422,J422"
 #define DEST_FOURCC "I420,IYUV,J420,YV12,YUVA"
@@ -80,21 +79,20 @@ static int Activate( vlc_object_t *p_this )
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('J','4','2','2'):
+        case VLC_CODEC_I422:
+        case VLC_CODEC_J422:
             switch( p_filter->fmt_out.video.i_chroma )
             {
-                case VLC_FOURCC('I','4','2','0'):
-                case VLC_FOURCC('I','Y','U','V'):
-                case VLC_FOURCC('J','4','2','0'):
+                case VLC_CODEC_I420:
+                case VLC_CODEC_J420:
                     p_filter->pf_video_filter = I422_I420_Filter;
                     break;
 
-                case VLC_FOURCC('Y','V','1','2'):
+                case VLC_CODEC_YV12:
                     p_filter->pf_video_filter = I422_YV12_Filter;
                     break;
 
-                case VLC_FOURCC('Y','U','V','A'):
+                case VLC_CODEC_YUVA:
                     p_filter->pf_video_filter = I422_YUVA_Filter;
                     break;
 
index 53dd4fd20089be3f7f9d1ba2fc4779af3acfb963..cf7bfc9a9e646f1110c196b6aaefa861f03abfd0 100644 (file)
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #include "i422_yuy2.h"
 
@@ -100,34 +99,30 @@ static int Activate( vlc_object_t *p_this )
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('I','4','2','2'):
+        case VLC_CODEC_I422:
             switch( p_filter->fmt_out.video.i_chroma )
             {
-                case VLC_FOURCC('Y','U','Y','2'):
-                case VLC_FOURCC('Y','U','N','V'):
+                case VLC_CODEC_YUYV:
                     p_filter->pf_video_filter = I422_YUY2_Filter;
                     break;
 
-                case VLC_FOURCC('Y','V','Y','U'):
+                case VLC_CODEC_YVYU:
                     p_filter->pf_video_filter = I422_YVYU_Filter;
                     break;
 
-                case VLC_FOURCC('U','Y','V','Y'):
-                case VLC_FOURCC('U','Y','N','V'):
-                case VLC_FOURCC('Y','4','2','2'):
+                case VLC_CODEC_UYVY:
                     p_filter->pf_video_filter = I422_UYVY_Filter;
                     break;
 
-                case VLC_FOURCC('I','U','Y','V'):
                     p_filter->pf_video_filter = I422_IUYV_Filter;
                     break;
 
-                case VLC_FOURCC('c','y','u','v'):
+                case VLC_CODEC_CYUV:
                     p_filter->pf_video_filter = I422_cyuv_Filter;
                     break;
 
 #if defined (MODULE_NAME_IS_i422_yuy2)
-                case VLC_FOURCC('Y','2','1','1'):
+                case VLC_CODEC_Y211:
                     p_filter->pf_video_filter = I422_Y211_Filter;
                     break;
 #endif
index 3f3e8822cedfb54cc1ca7cc5e6a97ee21981089a..d5aef1178c3fec3380e3810e4ff7e9416688f98d 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #define SRC_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,cyuv"
 #define DEST_FOURCC  "I420"
@@ -82,25 +81,22 @@ static int Activate( vlc_object_t *p_this )
 
     switch( p_filter->fmt_out.video.i_chroma )
     {
-        case VLC_FOURCC('I','4','2','0'):
+        case VLC_CODEC_I420:
             switch( p_filter->fmt_in.video.i_chroma )
             {
-                case VLC_FOURCC('Y','U','Y','2'):
-                case VLC_FOURCC('Y','U','N','V'):
+                case VLC_CODEC_YUYV:
                     p_filter->pf_video_filter = YUY2_I420_Filter;
                     break;
 
-                case VLC_FOURCC('Y','V','Y','U'):
+                case VLC_CODEC_YVYU:
                     p_filter->pf_video_filter = YVYU_I420_Filter;
                     break;
 
-                case VLC_FOURCC('U','Y','V','Y'):
-                case VLC_FOURCC('U','Y','N','V'):
-                case VLC_FOURCC('Y','4','2','2'):
+                case VLC_CODEC_UYVY:
                     p_filter->pf_video_filter = UYVY_I420_Filter;
                     break;
 
-                case VLC_FOURCC('c','y','u','v'):
+                case VLC_CODEC_CYUV:
                     p_filter->pf_video_filter = cyuv_I420_Filter;
                     break;
 
index 03d47fd54168608c77965a26eb8e96c1bbe341df..bcd6b1c89bdd61a312ec06817f3304fc8ac40214 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #define SRC_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,cyuv"
 #define DEST_FOURCC  "I422"
@@ -81,25 +80,22 @@ static int Activate( vlc_object_t *p_this )
 
     switch( p_filter->fmt_out.video.i_chroma )
     {
-        case VLC_FOURCC('I','4','2','2'):
+        case VLC_CODEC_I422:
             switch( p_filter->fmt_in.video.i_chroma )
             {
-                case VLC_FOURCC('Y','U','Y','2'):
-                case VLC_FOURCC('Y','U','N','V'):
+                case VLC_CODEC_YUYV:
                     p_filter->pf_video_filter = YUY2_I422_Filter;
                     break;
 
-                case VLC_FOURCC('Y','V','Y','U'):
+                case VLC_CODEC_YVYU:
                     p_filter->pf_video_filter = YVYU_I422_Filter;
                     break;
 
-                case VLC_FOURCC('U','Y','V','Y'):
-                case VLC_FOURCC('U','Y','N','V'):
-                case VLC_FOURCC('Y','4','2','2'):
+                case VLC_CODEC_UYVY:
                     p_filter->pf_video_filter = UYVY_I422_Filter;
                     break;
 
-                case VLC_FOURCC('c','y','u','v'):
+                case VLC_CODEC_CYUV:
                     p_filter->pf_video_filter = cyuv_I422_Filter;
                     break;
 
index fa671dc2127d58b5e3f26fd91cee72961f1af140..c8dfecf48b1bae95daab08e6fa54570989f894e3 100644 (file)
@@ -36,7 +36,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
@@ -465,7 +464,7 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
         msg_Warn( p_filter, "can't get output picture" );
index af46bd7a641092976a64084cd039544c6958dd5e..b9ddcd9445fe63b5dd012e7bd71485effab168ec 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include <vlc_image.h>
 #include <vlc_filter.h>
@@ -90,7 +89,7 @@ static int Create( vlc_object_t *p_this )
     filter_sys_t *p_sys;
     char *psz_string;
 
-    if( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','U','V','A') )
+    if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVA )
     {
         msg_Err( p_filter,
                  "Unsupported input chroma \"%4s\". "
@@ -178,7 +177,7 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
     video_format_t fmt_in, fmt_out;
     memset( &fmt_in, 0, sizeof( video_format_t ) );
     memset( &fmt_out, 0, sizeof( video_format_t ) );
-    fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt_out.i_chroma = VLC_CODEC_YUVA;
     if( p_filter->p_sys->p_mask )
         picture_Release( p_filter->p_sys->p_mask );
     p_image = image_HandlerCreate( p_filter );
index 2e78693a616aadcc9dc6a879569ab2a46f25f8d2..5c07f2ed5f0c08c38c40c51fbd142563c20e43fa 100644 (file)
@@ -1192,11 +1192,8 @@ static void Atmo_SetupParameters(filter_t *p_filter)
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-    case VLC_FOURCC('I','4','2','0'):
-    case VLC_FOURCC('I','Y','U','V'):
-    case VLC_FOURCC('Y','V','1','2'):
-    case VLC_FOURCC('Y','V','1','6'):
-    case VLC_FOURCC('Y','V','U','9'):
+    case VLC_CODEC_I420:
+    case VLC_CODEC_YV12:
         // simple enough? Dionoea?
         p_sys->pf_extract_mini_image = ExtractMiniImage_YUV;
         break;
index 08fe36f55bb99f5890e2e2d2a9497f8d7d1f9223..5308bac56b5fc9e8d29c34eee1f61367cb784b89 100644 (file)
@@ -32,7 +32,6 @@
 #include <assert.h>
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include "vlc_filter.h"
 
 /*****************************************************************************
@@ -56,19 +55,19 @@ struct filter_sys_t
     int i_dummy;
 };
 
-#define FCC_YUVA VLC_FOURCC('Y','U','V','A')
-#define FCC_YUVP VLC_FOURCC('Y','U','V','P')
-#define FCC_RGBA VLC_FOURCC('R','G','B','A')
-
-#define FCC_I420 VLC_FOURCC('I','4','2','0')
-#define FCC_YV12 VLC_FOURCC('Y','V','1','2')
-#define FCC_YUY2 VLC_FOURCC('Y','U','Y','2')
-#define FCC_UYVY VLC_FOURCC('U','Y','V','Y')
-#define FCC_YVYU VLC_FOURCC('Y','V','Y','U')
-#define FCC_RV15 VLC_FOURCC('R','V','1','5')
-#define FCC_RV16 VLC_FOURCC('R','V','1','6')
-#define FCC_RV24 VLC_FOURCC('R','V','2','4')
-#define FCC_RV32 VLC_FOURCC('R','V','3','2')
+#define FCC_YUVA VLC_CODEC_YUVA
+#define FCC_YUVP VLC_CODEC_YUVP
+#define FCC_RGBA VLC_CODEC_RGBA
+
+#define FCC_I420 VLC_CODEC_I420
+#define FCC_YV12 VLC_CODEC_YV12
+#define FCC_YUY2 VLC_CODEC_YUYV
+#define FCC_UYVY VLC_CODEC_UYVY
+#define FCC_YVYU VLC_CODEC_YVYU
+#define FCC_RV15 VLC_CODEC_RGB15
+#define FCC_RV16 VLC_CODEC_RGB16
+#define FCC_RV24 VLC_CODEC_RGB24
+#define FCC_RV32 VLC_CODEC_RGB32
 
 /****************************************************************************
  * Local prototypes
index 6adf28369bd22f358fc60a8d5ee44e0a6cd62344..05875207310a0c5fd33f60b7dc8b65a28811fadd 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "vlc_image.h"
index 90396c81cc447b473d6fddf74300c1a4acc1aa35..41707d1813a02e64a7c1930838aaab5181121051 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 
@@ -113,7 +112,7 @@ static int Create( vlc_object_t *p_this )
     filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
-    if( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','U','V','A') )
+    if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVA )
     {
         msg_Err( p_filter,
                  "Unsupported input chroma \"%4s\". "
@@ -178,7 +177,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     uint8_t *p_v = p_pic->p[ V_PLANE ].p_pixels;
     uint8_t umin, umax, vmin, vmax;
 
-    if( p_pic->format.i_chroma != VLC_FOURCC('Y','U','V','A') )
+    if( p_pic->format.i_chroma != VLC_CODEC_YUVA )
     {
         msg_Err( p_filter,
                  "Unsupported input chroma \"%4s\". "
index ef48f2236b71434cf24254a105a8fc7ea4e880d0..9f9bef46946ce02cca04698901f116271e332cd1 100644 (file)
@@ -34,7 +34,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 /*****************************************************************************
  * Local and extern prototypes.
@@ -286,13 +285,12 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
  *****************************************************************************/
 static picture_t *video_new( filter_t *p_filter )
 {
-    return ((filter_t*)p_filter->p_owner)->pf_vout_buffer_new( (filter_t*)p_filter->p_owner );
+    return filter_NewPicture( (filter_t*)p_filter->p_owner );
 }
 
 static void video_del( filter_t *p_filter, picture_t *p_pic )
 {
-    if( ((filter_t*)p_filter->p_owner)->pf_vout_buffer_del )
-        ((filter_t*)p_filter->p_owner)->pf_vout_buffer_del( (filter_t*)p_filter->p_owner, p_pic );
+    return filter_DeletePicture( (filter_t*)p_filter->p_owner, p_pic );
 }
 
 static int alloc_init( filter_t *p_filter, void *p_data )
index d56f67e5e85e77b9d9cb03b9e423e11bb6d6b984..7ea91eb3dd4a3a52b92db5cf0faa8fc99d7313ec 100644 (file)
@@ -60,10 +60,10 @@ static void EsFormatMergeSize( es_format_t *p_dst,
                                const es_format_t *p_size );
 
 static const vlc_fourcc_t pi_allowed_chromas[] = {
-    VLC_FOURCC('I','4','2','0'),
-    VLC_FOURCC('I','4','2','2'),
-    VLC_FOURCC('R','V','3','2'),
-    VLC_FOURCC('R','V','2','4'),
+    VLC_CODEC_I420,
+    VLC_CODEC_I422,
+    VLC_CODEC_RGB32,
+    VLC_CODEC_RGB24,
     0
 };
 
@@ -220,13 +220,13 @@ static picture_t *BufferNew( filter_t *p_filter )
 {
     filter_t *p_parent = (filter_t*)p_filter->p_owner;
 
-    return p_parent->pf_vout_buffer_new( p_parent );
+    return filter_NewPicture( p_parent );
 }
 static void BufferDel( filter_t *p_filter, picture_t *p_pic )
 {
     filter_t *p_parent = (filter_t*)p_filter->p_owner;
 
-    p_parent->pf_vout_buffer_del( p_parent, p_pic );
+    return filter_DeletePicture( p_parent, p_pic );
 }
 static int BufferAllocationInit ( filter_t *p_filter, void *p_data )
 {
index e847b706f8409dd6403ded3ed6e08dc4605affa7..45052830775ca9c42eb501baa5cfe1379ebc936b 100644 (file)
@@ -35,7 +35,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
index b7a63ad4ea7851980b761ca021fe07f9f7eef177..286ce642c80ea03a7d3d1d72fc5c0f232d1847db 100644 (file)
@@ -558,15 +558,13 @@ static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch,
     switch(i_chroma)
     {
     // planar YUV
-        case VLC_FOURCC('I','4','4','4'):
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('I','4','1','1'):
-        case VLC_FOURCC('I','4','1','0'):
-        case VLC_FOURCC('Y','V','U','9'):
-        case VLC_FOURCC('Y','U','V','A'):
+        case VLC_CODEC_I444:
+        case VLC_CODEC_I422:
+        case VLC_CODEC_I420:
+        case VLC_CODEC_YV12:
+        case VLC_CODEC_I411:
+        case VLC_CODEC_I410:
+        case VLC_CODEC_YUVA:
             i_skipCount = (i_pitch * i_skipCountPercent) / 100;
             for (i_index = i_col/2 + i_skipCount/2;
                  i_index <= i_visible_pitch/2 + i_col/2 - i_skipCount/2;
@@ -577,7 +575,7 @@ static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch,
             }
             break;
     // packed RGB
-        case VLC_FOURCC('R','G','B','2'):    // packed by 1
+        case VLC_CODEC_RGB8:    // packed by 1
             i_skipCount = (i_pitch * i_skipCountPercent) / 100;
             for (i_index = i_col/2 + i_skipCount/2;
                  i_index <= i_visible_pitch/2 + i_col/2 - i_skipCount/2;
@@ -587,8 +585,8 @@ static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch,
             if (i_count > i_nonBlackPixel) break;
             }
             break;
-        case VLC_FOURCC('R','V','1','5'):    // packed by 2
-        case VLC_FOURCC('R','V','1','6'):    // packed by 2
+        case VLC_CODEC_RGB15:    // packed by 2
+        case VLC_CODEC_RGB16:    // packed by 2
             i_skipCount = (i_pitch * i_skipCountPercent) / 100;
             for (i_index = i_col/2 + i_skipCount/2 -
                                 (i_col/2 + i_skipCount/2) % 2;
@@ -600,7 +598,7 @@ static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch,
             if (i_count > i_nonBlackPixel) break;
             }
             break;
-        case VLC_FOURCC('R','V','2','4'):    // packed by 3
+        case VLC_CODEC_RGB24:    // packed by 3
             i_skipCount = (i_pitch * i_skipCountPercent) / 100;
             for (i_index = i_col/2 + i_skipCount/2 - (i_col/2 + i_skipCount/2) % 3; i_index <= i_visible_pitch/2 + i_col/2 - i_skipCount/2; i_index+=3)
             {
@@ -610,7 +608,7 @@ static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch,
             if (i_count > i_nonBlackPixel) break;
             }
             break;
-        case VLC_FOURCC('R','V','3','2'):    // packed by 4
+        case VLC_CODEC_RGB32:    // packed by 4
             i_skipCount = (i_pitch * i_skipCountPercent) / 100;
             for (i_index = i_col/2 + i_skipCount/2 - (i_col/2 + i_skipCount/2) % 4; i_index <= i_visible_pitch/2 + i_col/2 - i_skipCount/2; i_index+=4)
             {
@@ -619,11 +617,8 @@ static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch,
             }
             break;
     // packed YUV
-        case VLC_FOURCC('Y','U','Y','2'):    // packed by 2
-        case VLC_FOURCC('Y','U','N','V'):    // packed by 2
-        case VLC_FOURCC('U','Y','V','Y'):    // packed by 2
-        case VLC_FOURCC('U','Y','N','V'):    // packed by 2
-        case VLC_FOURCC('Y','4','2','2'):    // packed by 2
+        case VLC_CODEC_YUYV:    // packed by 2
+        case VLC_CODEC_UYVY:    // packed by 2
             i_skipCount = (i_pitch * i_skipCountPercent) / 100;
             for (i_index = (i_col/2 + i_skipCount/2) -
                            (i_col/2 + i_skipCount/2) % 2;
@@ -740,7 +735,7 @@ static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic )
     /* Determine where black borders are */
     switch( p_vout->output.i_chroma )
     {
-    case VLC_FOURCC('I','4','2','0'):
+    case VLC_CODEC_I420:
         /* XXX: Do not laugh ! I know this is very naive. But it's just a
          *      proof of concept code snippet... */
         for( i = i_lines ; i-- ; )
index 9c23c6b5e1df29dba6662819d7f16f0d5f236b7a..d5c7730d690faf388a1cd10a6fcb9dad575da814 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include "vlc_filter.h"
 #include "filter_picture.h"
 
index 08f135d8707e5a781800ce428c273ef3c71cc43f..0460fd952eeb2bc0b45117ed2c9846602846f2c2 100644 (file)
@@ -310,7 +310,7 @@ static void SetFilterMethod( vout_thread_t *p_vout, char *psz_method )
     }
     else
     {
-        const bool b_i422 = p_vout->render.i_chroma == VLC_FOURCC('I','4','2','2');
+        const bool b_i422 = p_vout->render.i_chroma == VLC_CODEC_I422;
         if( strcmp( psz_method, "discard" ) )
             msg_Err( p_vout, "no valid deinterlace mode provided, "
                      "using \"discard\"" );
@@ -336,17 +336,17 @@ static void GetOutputFormat( vout_thread_t *p_vout,
         p_dst->i_sar_den *= 2;
     }
 
-    if( p_src->i_chroma == VLC_FOURCC('I','4','2','2') )
+    if( p_src->i_chroma == VLC_CODEC_I422 )
     {
         switch( p_vout->p_sys->i_mode )
         {
         case DEINTERLACE_MEAN:
         case DEINTERLACE_LINEAR:
         case DEINTERLACE_X:
-            p_dst->i_chroma = VLC_FOURCC('I','4','2','2');
+            p_dst->i_chroma = VLC_CODEC_I422;
             break;
         default:
-            p_dst->i_chroma = VLC_FOURCC('I','4','2','0');
+            p_dst->i_chroma = VLC_CODEC_I420;
             break;
         }
     }
@@ -354,10 +354,9 @@ static void GetOutputFormat( vout_thread_t *p_vout,
 
 static bool IsChromaSupported( vlc_fourcc_t i_chroma )
 {
-    return i_chroma == VLC_FOURCC('I','4','2','0') ||
-           i_chroma == VLC_FOURCC('I','Y','U','V') ||
-           i_chroma == VLC_FOURCC('Y','V','1','2') ||
-           i_chroma == VLC_FOURCC('I','4','2','2');
+    return i_chroma == VLC_CODEC_I420 ||
+           i_chroma == VLC_CODEC_YV12 ||
+           i_chroma == VLC_CODEC_I422;
 }
 
 /*****************************************************************************
@@ -608,9 +607,8 @@ static void RenderDiscard( vout_thread_t *p_vout,
 
         switch( p_vout->render.i_chroma )
         {
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('Y','V','1','2'):
+        case VLC_CODEC_I420:
+        case VLC_CODEC_YV12:
 
             for( ; p_out < p_out_end ; )
             {
@@ -621,7 +619,7 @@ static void RenderDiscard( vout_thread_t *p_vout,
             }
             break;
 
-        case VLC_FOURCC('I','4','2','2'):
+        case VLC_CODEC_I422:
 
             i_increment = 2 * p_pic->p[i_plane].i_pitch;
 
@@ -673,9 +671,8 @@ static void RenderBob( vout_thread_t *p_vout,
 
         switch( p_vout->render.i_chroma )
         {
-            case VLC_FOURCC('I','4','2','0'):
-            case VLC_FOURCC('I','Y','U','V'):
-            case VLC_FOURCC('Y','V','1','2'):
+            case VLC_CODEC_I420:
+            case VLC_CODEC_YV12:
                 /* For BOTTOM field we need to add the first line */
                 if( i_field == 1 )
                 {
@@ -709,7 +706,7 @@ static void RenderBob( vout_thread_t *p_vout,
                 }
                 break;
 
-            case VLC_FOURCC('I','4','2','2'):
+            case VLC_CODEC_I422:
                 /* For BOTTOM field we need to add the first line */
                 if( i_field == 1 )
                 {
@@ -863,9 +860,8 @@ static void RenderBlend( vout_thread_t *p_vout,
 
         switch( p_vout->render.i_chroma )
         {
-            case VLC_FOURCC('I','4','2','0'):
-            case VLC_FOURCC('I','Y','U','V'):
-            case VLC_FOURCC('Y','V','1','2'):
+            case VLC_CODEC_I420:
+            case VLC_CODEC_YV12:
                 /* First line: simple copy */
                 vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
                 p_out += p_outpic->p[i_plane].i_pitch;
@@ -881,7 +877,7 @@ static void RenderBlend( vout_thread_t *p_vout,
                 }
                 break;
 
-            case VLC_FOURCC('I','4','2','2'):
+            case VLC_CODEC_I422:
                 /* First line: simple copy */
                 vlc_memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
                 p_out += p_outpic->p[i_plane].i_pitch;
index c015c4ccbc16c91f84f85cb64f0e18f2ea91fa65..da647e25550b25fbc9c7175820ce1655dcf78ad1 100644 (file)
@@ -355,12 +355,10 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
                  (char*)&p_overlay->format.i_chroma, p_overlay->i_x, p_overlay->i_y,
                  p_overlay->i_alpha );
 
-        if( p_overlay->format.i_chroma == VLC_FOURCC('T','E','X','T') )
+        if( p_overlay->format.i_chroma == VLC_CODEC_TEXT )
         {
             p_region->psz_text = strdup( p_overlay->data.p_text );
-            p_region->p_style = malloc( sizeof(struct text_style_t) );
-            if( p_region->p_style )
-                *p_region->p_style = p_overlay->fontstyle;
+            p_region->p_style = text_style_Duplicate( p_overlay->p_fontstyle );
         }
         else
         {
index 8eb500a527a32bfc0c9de63395e930f00c63e41c..a40c73dfb636a273d6924a253ed931a6ca73d002 100644 (file)
@@ -122,7 +122,7 @@ typedef struct overlay_t
     bool b_active;
 
     video_format_t format;
-    struct text_style_t fontstyle;
+    struct text_style_t *p_fontstyle;
     union {
         picture_t *p_pic;
         char *p_text;
index 3f3f5b82fc5e513dff7f3d5beea1bf936c92297e..58c9fcdfaa55bc61f62b84ceb1603f6aff7e70df 100644 (file)
@@ -56,9 +56,9 @@ overlay_t *OverlayCreate( void )
     p_ovl->i_x = p_ovl->i_y = 0;
     p_ovl->i_alpha = 0xFF;
     p_ovl->b_active = false;
-    vout_InitFormat( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0,
-                     VOUT_ASPECT_FACTOR );
-    memcpy( &p_ovl->fontstyle, &default_text_style, sizeof(struct text_style_t) );
+    video_format_Setup( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0,
+                        VOUT_ASPECT_FACTOR );
+    p_ovl->p_fontstyle = text_style_New();
     p_ovl->data.p_text = NULL;
 
     return p_ovl;
@@ -68,6 +68,7 @@ int OverlayDestroy( overlay_t *p_ovl )
 {
     if( p_ovl->data.p_text != NULL )
         free( p_ovl->data.p_text );
+    text_style_Delete( p_ovl->p_fontstyle );
 
     return VLC_SUCCESS;
 }
@@ -436,7 +437,7 @@ static int exec_DataSharedMem( filter_t *p_filter,
     }
     i_size = shminfo.shm_segsz;
 
-    if( p_params->fourcc == VLC_FOURCC('T','E','X','T') )
+    if( p_params->fourcc == VLC_CODEC_TEXT )
     {
         char *p_data;
 
@@ -464,8 +465,8 @@ static int exec_DataSharedMem( filter_t *p_filter,
             return VLC_ENOMEM;
         }
 
-        vout_InitFormat( &p_ovl->format, VLC_FOURCC('T','E','X','T'),
-                         0, 0, 0 );
+        video_format_Setup( &p_ovl->format, VLC_CODEC_TEXT,
+                            0, 0, 0 );
 
         p_data = shmat( p_params->i_shmid, NULL, SHM_RDONLY );
         if( p_data == NULL )
@@ -488,9 +489,9 @@ static int exec_DataSharedMem( filter_t *p_filter,
         if( p_ovl->data.p_pic == NULL )
             return VLC_ENOMEM;
 
-        vout_InitFormat( &p_ovl->format, p_params->fourcc,
-                         p_params->i_width, p_params->i_height,
-                         VOUT_ASPECT_FACTOR );
+        video_format_Setup( &p_ovl->format, p_params->fourcc,
+                            p_params->i_width, p_params->i_height,
+                            VOUT_ASPECT_FACTOR );
         if( vout_AllocatePicture( p_filter, p_ovl->data.p_pic,
                                   p_ovl->format.i_chroma, p_params->i_width,
                                   p_params->i_height, p_ovl->format.i_aspect ) )
@@ -636,7 +637,7 @@ static int exec_GetTextAlpha( filter_t *p_filter,
     if( p_ovl == NULL )
         return VLC_EGENERIC;
 
-    p_results->fontstyle.i_font_alpha = p_ovl->fontstyle.i_font_alpha;
+    p_results->fontstyle.i_font_alpha = p_ovl->p_fontstyle->i_font_alpha;
     return VLC_SUCCESS;
 }
 
@@ -649,7 +650,7 @@ static int exec_GetTextColor( filter_t *p_filter,
     if( p_ovl == NULL )
         return VLC_EGENERIC;
 
-    p_results->fontstyle.i_font_color = p_ovl->fontstyle.i_font_color;
+    p_results->fontstyle.i_font_color = p_ovl->p_fontstyle->i_font_color;
     return VLC_SUCCESS;
 }
 
@@ -662,7 +663,7 @@ static int exec_GetTextSize( filter_t *p_filter,
     if( p_ovl == NULL )
         return VLC_EGENERIC;
 
-    p_results->fontstyle.i_font_size = p_ovl->fontstyle.i_font_size;
+    p_results->fontstyle.i_font_size = p_ovl->p_fontstyle->i_font_size;
     return VLC_SUCCESS;
 }
 
@@ -725,7 +726,7 @@ static int exec_SetTextAlpha( filter_t *p_filter,
     if( p_ovl == NULL )
         return VLC_EGENERIC;
 
-    p_ovl->fontstyle.i_font_alpha = p_params->fontstyle.i_font_alpha;
+    p_ovl->p_fontstyle->i_font_alpha = p_params->fontstyle.i_font_alpha;
     p_sys->b_updated = p_ovl->b_active;
     return VLC_SUCCESS;
 }
@@ -741,7 +742,7 @@ static int exec_SetTextColor( filter_t *p_filter,
     if( p_ovl == NULL )
         return VLC_EGENERIC;
 
-    p_ovl->fontstyle.i_font_color = p_params->fontstyle.i_font_color;
+    p_ovl->p_fontstyle->i_font_color = p_params->fontstyle.i_font_color;
     p_sys->b_updated = p_ovl->b_active;
     return VLC_SUCCESS;
 }
@@ -757,7 +758,7 @@ static int exec_SetTextSize( filter_t *p_filter,
     if( p_ovl == NULL )
         return VLC_EGENERIC;
 
-    p_ovl->fontstyle.i_font_size = p_params->fontstyle.i_font_size;
+    p_ovl->p_fontstyle->i_font_size = p_params->fontstyle.i_font_size;
     p_sys->b_updated = p_ovl->b_active;
     return VLC_SUCCESS;
 }
index b501c869fbd46e424f1b3004158f6157af6550af..2305009f93868deca2f9e50b72cec12b808c328a 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 #include "vlc_image.h"
 
 #include "vlc_filter.h"
@@ -100,7 +99,7 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
     picture_t *p_old_mask = p_filter->p_sys->p_mask;
     memset( &fmt_in, 0, sizeof( video_format_t ) );
     memset( &fmt_out, 0, sizeof( video_format_t ) );
-    fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt_out.i_chroma = VLC_CODEC_YUVA;
     p_image = image_HandlerCreate( p_filter );
     p_filter->p_sys->p_mask =
         image_ReadUrl( p_image, psz_filename, &fmt_in, &fmt_out );
@@ -128,13 +127,12 @@ static int Create( vlc_object_t *p_this )
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('J','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
+        case VLC_CODEC_I420:
+        case VLC_CODEC_J420:
+        case VLC_CODEC_YV12:
 
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('J','4','2','2'):
+        case VLC_CODEC_I422:
+        case VLC_CODEC_J422:
             break;
 
         default:
@@ -248,8 +246,8 @@ static void FilterErase( filter_t *p_filter, picture_t *p_inpic,
         int i_width  = i_mask_visible_pitch;
 
         const bool b_line_factor = ( i_plane /* U_PLANE or V_PLANE */ &&
-            !( p_inpic->format.i_chroma == VLC_FOURCC('I','4','2','2')
-            || p_inpic->format.i_chroma == VLC_FOURCC('J','4','2','2') ) );
+            !( p_inpic->format.i_chroma == VLC_CODEC_I422
+            || p_inpic->format.i_chroma == VLC_CODEC_J422 ) );
 
         if( i_plane ) /* U_PLANE or V_PLANE */
         {
index c061884ac2cf26ad6ec8934c408492e04fe0e0c0..11551f7a82efac4d46a4e71cbb8f774ca9fc389b 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
@@ -107,13 +106,12 @@ static int Create( vlc_object_t *p_this )
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('J','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
+        case VLC_CODEC_I420:
+        case VLC_CODEC_J420:
+        case VLC_CODEC_YV12:
 
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('J','4','2','2'):
+        case VLC_CODEC_I422:
+        case VLC_CODEC_J422:
 
         CASE_PACKED_YUV_422
             break;
@@ -188,10 +186,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     vlc_mutex_lock( &p_sys->lock );
     switch( p_pic->format.i_chroma )
     {
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('J','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
+        case VLC_CODEC_I420:
+        case VLC_CODEC_J420:
+        case VLC_CODEC_YV12:
             switch( p_sys->i_color )
             {
                 case RED:
@@ -214,8 +211,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
             }
             break;
 
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('J','4','2','2'):
+        case VLC_CODEC_I422:
+        case VLC_CODEC_J422:
             switch( p_filter->p_sys->i_color )
             {
                 case RED:
index b39a26637c9b0e9e036aff5363016757cc8fd854..c5b4473aa2f38344e583176fe9783d5f21237b24 100644 (file)
 
 /* FIXME: do all of these really have square pixels? */
 #define CASE_PLANAR_YUV_SQUARE              \
-        case VLC_FOURCC('I','4','2','0'):   \
-        case VLC_FOURCC('I','Y','U','V'):   \
-        case VLC_FOURCC('J','4','2','0'):   \
-        case VLC_FOURCC('Y','V','1','2'):   \
-        case VLC_FOURCC('I','4','1','1'):   \
-        case VLC_FOURCC('I','4','1','0'):   \
-        case VLC_FOURCC('Y','V','U','9'):   \
-        case VLC_FOURCC('I','4','4','4'):   \
-        case VLC_FOURCC('J','4','4','4'):   \
-        case VLC_FOURCC('Y','U','V','A'):
+        case VLC_CODEC_I420:   \
+        case VLC_CODEC_J420:   \
+        case VLC_CODEC_YV12:   \
+        case VLC_CODEC_I411:   \
+        case VLC_CODEC_I410:   \
+        case VLC_CODEC_I444:   \
+        case VLC_CODEC_J444:   \
+        case VLC_CODEC_YUVA:
 
 #define CASE_PLANAR_YUV_NONSQUARE           \
-        case VLC_FOURCC('I','4','2','2'):   \
-        case VLC_FOURCC('J','4','2','2'):
+        case VLC_CODEC_I422:   \
+        case VLC_CODEC_J422:
 
 #define CASE_PLANAR_YUV                     \
         CASE_PLANAR_YUV_SQUARE              \
         CASE_PLANAR_YUV_NONSQUARE           \
 
 #define CASE_PACKED_YUV_422                 \
-        case VLC_FOURCC('U','Y','V','Y'):   \
-        case VLC_FOURCC('U','Y','N','V'):   \
-        case VLC_FOURCC('Y','4','2','2'):   \
-        case VLC_FOURCC('c','y','u','v'):   \
-        case VLC_FOURCC('Y','U','Y','2'):   \
-        case VLC_FOURCC('Y','U','N','V'):   \
-        case VLC_FOURCC('Y','V','Y','U'):
+        case VLC_CODEC_UYVY:   \
+        case VLC_CODEC_CYUV:   \
+        case VLC_CODEC_YUYV:   \
+        case VLC_CODEC_YVYU:
 
 static inline int GetPackedYuvOffsets( vlc_fourcc_t i_chroma,
     int *i_y_offset, int *i_u_offset, int *i_v_offset )
 {
     switch( i_chroma )
     {
-        case VLC_FOURCC('U','Y','V','Y'):
-        case VLC_FOURCC('U','Y','N','V'):
-        case VLC_FOURCC('Y','4','2','2'):
-        case VLC_FOURCC('c','y','u','v'): /* <-- FIXME: reverted, whatever that means */
+        case VLC_CODEC_UYVY:
+        case VLC_CODEC_CYUV: /* <-- FIXME: reverted, whatever that means */
             /* UYVY */
             *i_y_offset = 1;
             *i_u_offset = 0;
             *i_v_offset = 2;
             return VLC_SUCCESS;
-        case VLC_FOURCC('Y','U','Y','2'):
-        case VLC_FOURCC('Y','U','N','V'):
+        case VLC_CODEC_YUYV:
             /* YUYV */
             *i_y_offset = 0;
             *i_u_offset = 1;
             *i_v_offset = 3;
             return VLC_SUCCESS;
-        case VLC_FOURCC('Y','V','Y','U'):
+        case VLC_CODEC_YVYU:
             /* YVYU */
             *i_y_offset = 0;
             *i_u_offset = 3;
index a8f96efc6833908b39e04f8efe865a0e24e45e7d..97019f789f207a64319ceadfbf71b8065e8db08b 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
@@ -123,13 +122,12 @@ static int Create( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
 
-    if(   p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','4','2','0')
-       && p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','Y','U','V')
-       && p_filter->fmt_in.video.i_chroma != VLC_FOURCC('J','4','2','0')
-       && p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','V','1','2')
+    if(   p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420
+       && p_filter->fmt_in.video.i_chroma != VLC_CODEC_J420
+       && p_filter->fmt_in.video.i_chroma != VLC_CODEC_YV12
 
-       && p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','4','2','2')
-       && p_filter->fmt_in.video.i_chroma != VLC_FOURCC('J','4','2','2')
+       && p_filter->fmt_in.video.i_chroma != VLC_CODEC_I422
+       && p_filter->fmt_in.video.i_chroma != VLC_CODEC_J422
       )
     {
         /* We only want planar YUV 4:2:0 or 4:2:2 */
index 948cb4a04d318256b720203ed6ea0e8b54698f02..fd3baa0551a1d22e23f12d2d13212e983fc1ff86 100644 (file)
@@ -35,7 +35,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
index 28f54eb813ffb07c3c3a5088f0ed5f671e99b48a..57a740e7acdd7bdc9317e409aea3a765a58f8ee4 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
index 1f1cd71aaed3c61335d2edae82fd85c7605ab436..e857dfe08c7c9eed89916be177809ec6d64e3e7d 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
@@ -58,7 +57,7 @@ vlc_module_begin ()
 vlc_module_end ()
 
 /*****************************************************************************
- * vout_sys_t: Invert video output method descriptor
+ * filter_sys_t: Invert video output method descriptor
  *****************************************************************************
  * This structure is part of the video output thread descriptor.
  * It describes the Invert specific properties of an output thread.
@@ -121,7 +120,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    if( p_pic->format.i_chroma == VLC_FOURCC('Y','U','V','A') )
+    if( p_pic->format.i_chroma == VLC_CODEC_YUVA )
     {
         /* We don't want to invert the alpha plane */
         i_planes = p_pic->i_planes - 1;
index bdc988d3b8f96adbf92ee45cdbf49f56994d5838..f57056b5f6e788a5d748fe3287fa28fc57bc9251 100644 (file)
@@ -179,7 +179,7 @@ static picture_t *LoadImage( vlc_object_t *p_this, char *psz_filename )
     memset( &fmt_in, 0, sizeof(video_format_t) );
     memset( &fmt_out, 0, sizeof(video_format_t) );
 
-    fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt_out.i_chroma = VLC_CODEC_YUVA;
     p_image = image_HandlerCreate( p_this );
     p_pic = image_ReadUrl( p_image, psz_filename, &fmt_in, &fmt_out );
     image_HandlerDelete( p_image );
@@ -393,7 +393,7 @@ static int Init( vout_thread_t *p_vout )
         p_sys->p_blend->fmt_in.video.i_y_offset = 0;
     p_sys->p_blend->fmt_out.video.i_aspect = p_vout->render.i_aspect;
     p_sys->p_blend->fmt_out.video.i_chroma = p_vout->output.i_chroma;
-    p_sys->p_blend->fmt_in.video.i_chroma = VLC_FOURCC('Y','U','V','A');
+    p_sys->p_blend->fmt_in.video.i_chroma = VLC_CODEC_YUVA;
     p_sys->p_blend->fmt_in.video.i_aspect = VOUT_ASPECT_FACTOR;
     p_sys->i_width =
         p_sys->p_blend->fmt_in.video.i_width =
@@ -819,7 +819,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
 
     /* Create new SPU region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt.i_chroma = VLC_CODEC_YUVA;
     fmt.i_aspect = VOUT_ASPECT_FACTOR;
     fmt.i_sar_num = fmt.i_sar_den = 1;
     fmt.i_width = fmt.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;
index aef6837a77d6968e921661d7c32459caed3db770..b5c080cd2e04d7d566d680968a12f6a745df4fff 100644 (file)
@@ -114,7 +114,7 @@ static int Create( vlc_object_t *p_this )
     switch( p_vout->fmt_in.i_chroma )
     {
         CASE_PLANAR_YUV
-        case VLC_FOURCC('G','R','E','Y'):
+        case VLC_CODEC_GREY:
             break;
         default:
             msg_Err( p_vout, "Unsupported chroma" );
index ce627d124410fad85571c6e84cc2e97097ad3173..f993907d4d1445ea9ee7847d10ac268484ec449f 100644 (file)
@@ -33,7 +33,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "vlc_block.h"
@@ -204,8 +203,7 @@ static int CreateFilter( vlc_object_t *p_this )
         return VLC_ENOMEM;
 
     vlc_mutex_init( &p_sys->lock );
-    p_sys->p_style = malloc( sizeof( text_style_t ) );
-    memcpy( p_sys->p_style, &default_text_style, sizeof( text_style_t ) );
+    p_sys->p_style = text_style_New();
 
     config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
@@ -259,7 +257,7 @@ static void DestroyFilter( vlc_object_t *p_this )
     DEL_VAR( "marq-size" );
 
     vlc_mutex_destroy( &p_sys->lock );
-    free( p_sys->p_style );
+    text_style_Delete( p_sys->p_style );
     free( p_sys->psz_marquee );
     free( p_sys );
 }
@@ -286,7 +284,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         goto out;
 
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_height = 0;
     fmt.i_x_offset = 0;
@@ -325,7 +323,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     p_spu->p_region->i_x = p_sys->i_xoff;
     p_spu->p_region->i_y = p_sys->i_yoff;
 
-    p_spu->p_region->p_style = p_sys->p_style;
+    p_spu->p_region->p_style = text_style_Duplicate( p_sys->p_style );
 
 out:
     vlc_mutex_unlock( &p_sys->lock );
index a8d60f0c5a13191c08b96cd2d6b9ebf44d5df7a0..d9488f9807ce4c16e09f9e681151a57793fcc3bf 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include <math.h>
 #include <limits.h> /* INT_MAX */
@@ -596,11 +595,11 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
             fmt_in.i_height = p_es->p_picture->format.i_height;
             fmt_in.i_width = p_es->p_picture->format.i_width;
 
-            if( fmt_in.i_chroma == VLC_FOURCC('Y','U','V','A') ||
-                fmt_in.i_chroma == VLC_FOURCC('R','G','B','A') )
-                fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+            if( fmt_in.i_chroma == VLC_CODEC_YUVA ||
+                fmt_in.i_chroma == VLC_CODEC_RGBA )
+                fmt_out.i_chroma = VLC_CODEC_YUVA;
             else
-                fmt_out.i_chroma = VLC_FOURCC('I','4','2','0');
+                fmt_out.i_chroma = VLC_CODEC_I420;
             fmt_out.i_width = col_inner_width;
             fmt_out.i_height = row_inner_height;
 
index e975efcfb581cc97b13c72cddc872b27a72cbe1c..f5e43403136146a938f2e63507ff084cb9b3dc26 100644 (file)
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 #include <vlc_filter.h>
 #include "filter_picture.h"
 
index aaf8f3149dd66e25929b3a68d7acd933367ad30e..8043f4c1024ca3d34ee2d03a3f46cfeb4b476372 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
@@ -198,16 +197,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
     int i_chroma_dy;
     switch( p_inpic->format.i_chroma )
     {
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('J','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
+        case VLC_CODEC_I420:
+        case VLC_CODEC_J420:
+        case VLC_CODEC_YV12:
             i_chroma_dx = 2;
             i_chroma_dy = 2;
             break;
 
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('J','4','2','2'):
+        case VLC_CODEC_I422:
+        case VLC_CODEC_J422:
             i_chroma_dx = 2;
             i_chroma_dy = 1;
             break;
index dcd6cdeea9fc0cc4fefda3454c1f635bd4a31910..54cea1650903a3e8649c2ffe9083360b33b92ce3 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
@@ -61,7 +60,7 @@ vlc_module_begin ()
 vlc_module_end ()
 
 /*****************************************************************************
- * vout_sys_t: Distort video output method descriptor
+ * filter_sys_t: Distort video output method descriptor
  *****************************************************************************
  * This structure is part of the video output thread descriptor.
  * It describes the Distort specific properties of an output thread.
index e1fe03e2f1b816cc6435243d22fab793998ed71b..3d899e55d3e315ef063acc5e413b6e211be1d71e 100644 (file)
@@ -174,7 +174,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         msg_Err( p_filter, "no image" );
         return NULL;
     }
-    if ((p_pic->format.i_chroma != VLC_FOURCC('I','4','2','0')))
+    if ((p_pic->format.i_chroma != VLC_CODEC_I420))
     {
         msg_Err( p_filter, "wrong chroma - use I420" );
         return NULL;
index ca48f23c5eaf171027ad42e2e7a786c5718a1633..6825ba38ed24ca6a9da694c14953b6934abbae5f 100644 (file)
@@ -318,9 +318,9 @@ static int Init( vout_thread_t *p_vout )
         fmt.i_y_offset = fmt.i_y_offset * p_sys->f_scale;
 
         if (p_sys->i_internal_chroma == GREY)
-            fmt.i_chroma = VLC_FOURCC('I','4','2','0');
+            fmt.i_chroma = VLC_CODEC_I420;
         else if (p_sys->i_internal_chroma == RGB)
-            fmt.i_chroma = VLC_FOURCC('R','V','3','2');
+            fmt.i_chroma = VLC_CODEC_RGB32;
     }
 
     /* Load the internal opencv filter */
@@ -463,13 +463,13 @@ static void VlcPictureToIplImage( vout_thread_t *p_vout, picture_t *p_in )
             //rgb2 gives 3 separate planes, this gives 1 interleaved plane
             //rv24 gives is about 20% faster but gives r&b the wrong way round
             //and I cant think of an easy way to fix this
-            fmt_out.i_chroma = VLC_FOURCC('R','V','3','2');
+            fmt_out.i_chroma = VLC_CODEC_RGB32;
         }
         else if (p_sys->i_internal_chroma == GREY)
         {
             //take the I (gray) plane (video seems to commonly be in this fmt so usually the
             //conversion does nothing)
-            fmt_out.i_chroma = VLC_FOURCC('I','4','2','0');
+            fmt_out.i_chroma = VLC_CODEC_I420;
         }
 
         //convert from the input image
index d7f23a4eaa854292ea4ead6ebd23ee4e09eabdfd..e287f392cd6de721b3b2abfc2d6f2370bdfc9427 100644 (file)
@@ -263,7 +263,7 @@ static int CreateFilter ( vlc_object_t *p_this )
                         MouseEvent, p_sys );
     }
 
-    es_format_Init( &p_filter->fmt_out, SPU_ES, VLC_FOURCC( 's','p','u',' ' ) );
+    es_format_Init( &p_filter->fmt_out, SPU_ES, VLC_CODEC_SPU );
     p_filter->fmt_out.i_priority = 0;
 
     return VLC_SUCCESS;
@@ -370,7 +370,7 @@ static subpicture_region_t *create_text_region( filter_t *p_filter, subpicture_t
 
     /* Create new SPU region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC( 'T','E','X','T' );
+    fmt.i_chroma = VLC_CODEC_TEXT;
     fmt.i_aspect = VOUT_ASPECT_FACTOR;
     fmt.i_sar_num = fmt.i_sar_den = 1;
     fmt.i_width = fmt.i_visible_width = i_width;
@@ -408,13 +408,13 @@ static subpicture_region_t *create_picture_region( filter_t *p_filter, subpictur
 
     /* Create new SPU region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = (p_pic == NULL) ? VLC_FOURCC('Y','U','V','P') : VLC_FOURCC('Y','U','V','A');
+    fmt.i_chroma = (p_pic == NULL) ? VLC_CODEC_YUVP : VLC_CODEC_YUVA;
     fmt.i_aspect = VOUT_ASPECT_FACTOR;
     fmt.i_sar_num = fmt.i_sar_den = 1;
     fmt.i_width = fmt.i_visible_width = i_width;
     fmt.i_height = fmt.i_visible_height = i_height;
     fmt.i_x_offset = fmt.i_y_offset = 0;
-    if( fmt.i_chroma == VLC_FOURCC('Y','U','V','P') )
+    if( fmt.i_chroma == VLC_CODEC_YUVP )
     {
         fmt.p_palette = &palette;
         fmt.p_palette->i_entries = 0;
index 73c92814fbbafb454b33f6cafdfe91fd6845aa51..8b4467a379318fc79b016f4378b49d6bfe0e3757 100644 (file)
@@ -307,43 +307,38 @@ static int Create( vlc_object_t *p_this )
     p_vout->pf_manage = NULL;
 /* Color Format not supported
 // Planar Y, packed UV
-case VLC_FOURCC('Y','M','G','A'):
+case VLC_CODEC_YMGA:
 // Packed YUV 4:2:2, U:Y:V:Y, interlaced
 case VLC_FOURCC('I','U','Y','V'):    // packed by 2
 // Packed YUV 2:1:1, Y:U:Y:V
-case VLC_FOURCC('Y','2','1','1'):     // packed by 4
+case VLC_CODEC_Y211:     // packed by 4
 // Packed YUV Reverted
-case VLC_FOURCC('c','y','u','v'):    // packed by 2
+case VLC_CODEC_CYUV:    // packed by 2
 */
     switch (p_vout->render.i_chroma)
     {
     // planar YUV
-        case VLC_FOURCC('I','4','4','4'):
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('I','4','1','1'):
-        case VLC_FOURCC('I','4','1','0'):
-        case VLC_FOURCC('Y','V','U','9'):
-        case VLC_FOURCC('Y','U','V','A'):
+        case VLC_CODEC_I444:
+        case VLC_CODEC_I422:
+        case VLC_CODEC_I420:
+        case VLC_CODEC_YV12:
+        case VLC_CODEC_I411:
+        case VLC_CODEC_I410:
+        case VLC_CODEC_YUVA:
             p_vout->pf_render = RenderPlanarYUV;
             break;
     // packed RGB
-        case VLC_FOURCC('R','G','B','2'):    // packed by 1
-        case VLC_FOURCC('R','V','1','5'):    // packed by 2
-        case VLC_FOURCC('R','V','1','6'):    // packed by 2
-        case VLC_FOURCC('R','V','2','4'):    // packed by 3
-        case VLC_FOURCC('R','V','3','2'):    // packed by 4
+        case VLC_CODEC_RGB8:    // packed by 1
+        case VLC_CODEC_RGB15:    // packed by 2
+        case VLC_CODEC_RGB16:    // packed by 2
+        case VLC_CODEC_RGB24:    // packed by 3
+        case VLC_CODEC_RGB32:    // packed by 4
             p_vout->pf_render = RenderPackedRGB;
             break;
 #ifdef PACKED_YUV
     // packed YUV
-        case VLC_FOURCC('Y','U','Y','2'):    // packed by 2
-        case VLC_FOURCC('Y','U','N','V'):    // packed by 2
-        case VLC_FOURCC('U','Y','V','Y'):    // packed by 2
-        case VLC_FOURCC('U','Y','N','V'):    // packed by 2
-        case VLC_FOURCC('Y','4','2','2'):    // packed by 2
+        case VLC_CODEC_YUYV:    // packed by 2
+        case VLC_CODEC_UYVY:    // packed by 2
             p_vout->pf_render = RenderPackedYUV;
             break;
 #endif
@@ -700,29 +695,24 @@ static int Init( vout_thread_t *p_vout )
         switch (p_vout->render.i_chroma)
         {
         // planar YVU
-            case VLC_FOURCC('Y','V','1','2'):
-            case VLC_FOURCC('Y','V','U','9'):
+            case VLC_CODEC_YV12:
         // packed UYV
-            case VLC_FOURCC('U','Y','V','Y'):    // packed by 2
-            case VLC_FOURCC('U','Y','N','V'):    // packed by 2
-            case VLC_FOURCC('Y','4','2','2'):    // packed by 2
-    //        case VLC_FOURCC('c','y','u','v'):    // packed by 2
+            case VLC_CODEC_UYVY:    // packed by 2
+    //        case VLC_CODEC_CYUV:    // packed by 2
                 VLC_XCHG( float, p_vout->p_sys->f_gamma[1], p_vout->p_sys->f_gamma[2] );
                 VLC_XCHG( float, f_BlackCrush[1], f_BlackCrush[2] );
                 VLC_XCHG( float, f_WhiteCrush[1], f_WhiteCrush[2] );
                 VLC_XCHG( float, f_BlackLevel[1], f_BlackLevel[2] );
                 VLC_XCHG( float, f_WhiteLevel[1], f_WhiteLevel[2] );
         // planar YUV
-            case VLC_FOURCC('I','4','4','4'):
-            case VLC_FOURCC('I','4','2','2'):
-            case VLC_FOURCC('I','4','2','0'):
-            case VLC_FOURCC('I','4','1','1'):
-            case VLC_FOURCC('I','4','1','0'):
-            case VLC_FOURCC('I','Y','U','V'):
-            case VLC_FOURCC('Y','U','V','A'):
+            case VLC_CODEC_I444:
+            case VLC_CODEC_I422:
+            case VLC_CODEC_I420:
+            case VLC_CODEC_I411:
+            case VLC_CODEC_I410:
+            case VLC_CODEC_YUVA:
         // packed YUV
-            case VLC_FOURCC('Y','U','Y','2'):    // packed by 2
-            case VLC_FOURCC('Y','U','N','V'):    // packed by 2
+            case VLC_CODEC_YUYV:    // packed by 2
                 for (i_index = 0; i_index < 256; i_index++)
                     for (i_index2 = 0; i_index2 <= ACCURACY; i_index2++)
                         for (i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++)
@@ -735,11 +725,11 @@ static int Init( vout_thread_t *p_vout )
                         }
                 break;
         // packed RGB
-            case VLC_FOURCC('R','G','B','2'):    // packed by 1
-            case VLC_FOURCC('R','V','1','5'):    // packed by 2
-            case VLC_FOURCC('R','V','1','6'):    // packed by 2
-            case VLC_FOURCC('R','V','2','4'):    // packed by 3
-            case VLC_FOURCC('R','V','3','2'):    // packed by 4
+            case VLC_CODEC_RGB8:    // packed by 1
+            case VLC_CODEC_RGB15:    // packed by 2
+            case VLC_CODEC_RGB16:    // packed by 2
+            case VLC_CODEC_RGB24:    // packed by 3
+            case VLC_CODEC_RGB32:    // packed by 4
             for (i_index = 0; i_index < 256; i_index++)
                     for (i_index2 = 0; i_index2 <= ACCURACY; i_index2++)
                         for (i_plane = 0; i_plane < VOUT_MAX_PLANES; i_plane++)
@@ -1651,8 +1641,7 @@ static void RenderPackedYUV( vout_thread_t *p_vout, picture_t *p_pic )
 #endif
             switch (p_vout->output.i_chroma)
                 {
-                    case VLC_FOURCC('Y','U','Y','2'):    // packed by 2
-                    case VLC_FOURCC('Y','U','N','V'):    // packed by 2
+                    case VLC_CODEC_YUYV:    // packed by 2
                         Denom = F2(length / p_pic->p->i_pixel_pitch);
                         a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
                         a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
@@ -1672,9 +1661,7 @@ static void RenderPackedYUV( vout_thread_t *p_vout, picture_t *p_pic )
                                 p_vout->p_sys->cstYUV[i_col][1][i_index + 1] = p_vout->p_sys->cstYUV[i_col][1][i_index];
                         }
                         break;
-                    case VLC_FOURCC('U','Y','V','Y'):    // packed by 2
-                    case VLC_FOURCC('U','Y','N','V'):    // packed by 2
-                    case VLC_FOURCC('Y','4','2','2'):    // packed by 2
+                    case VLC_CODEC_UYVY:    // packed by 2
                         Denom = F2(length / p_pic->p->i_pixel_pitch);
                         a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
                         a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfLength * (ACCURACY / 100);
@@ -1740,8 +1727,7 @@ static void RenderPackedYUV( vout_thread_t *p_vout, picture_t *p_pic )
 #endif
                                 switch (p_vout->output.i_chroma)
                                 {
-                                    case VLC_FOURCC('Y','U','Y','2'):    // packed by 2
-                                    case VLC_FOURCC('Y','U','N','V'):    // packed by 2
+                                    case VLC_CODEC_YUYV:    // packed by 2
                                         Denom = F2(length / p_pic->p->i_pixel_pitch);
                                         a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
                                         a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfHeight * (ACCURACY / 100);
@@ -1761,9 +1747,7 @@ static void RenderPackedYUV( vout_thread_t *p_vout, picture_t *p_pic )
                                                 p_vout->p_sys->cstYUV2[i_row][1][i_index + 1] = p_vout->p_sys->cstYUV2[i_row][1][i_index];
                                         }
                                         break;
-                                    case VLC_FOURCC('U','Y','V','Y'):    // packed by 2
-                                    case VLC_FOURCC('U','Y','N','V'):    // packed by 2
-                                    case VLC_FOURCC('Y','4','2','2'):    // packed by 2
+                                    case VLC_CODEC_UYVY:    // packed by 2
                                         Denom = F2(length / p_pic->p->i_pixel_pitch);
                                         a_2 = p_vout->p_sys->a_2 * (ACCURACY / 100);
                                         a_1 = p_vout->p_sys->a_1 * 2 * p_vout->p_sys->i_halfHeight * (ACCURACY / 100);
index 9d1dc57b4989ca37a7e1e5e7fdcd7a38a0c9c0b2..ee7499f6cd9252e96629d52781ee9d204ef69f2a 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
+#include <vlc_filter.h>
 
 #include "filter_picture.h"
 
@@ -140,22 +140,21 @@ static int OpenPostproc( vlc_object_t *p_this )
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('I','4','4','4'):
-        case VLC_FOURCC('J','4','4','4'):
-        /* case VLC_FOURCC('Y','U','V','A'): FIXME Should work but alpha plane needs to be copied manually and I'm kind of feeling too lazy to write the code to do that ATM (i_pitch vs i_visible_pitch...). */
+        case VLC_CODEC_I444:
+        case VLC_CODEC_J444:
+        /* case VLC_CODEC_YUVA: FIXME Should work but alpha plane needs to be copied manually and I'm kind of feeling too lazy to write the code to do that ATM (i_pitch vs i_visible_pitch...). */
             i_flags |= PP_FORMAT_444;
             break;
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('J','4','2','2'):
+        case VLC_CODEC_I422:
+        case VLC_CODEC_J422:
             i_flags |= PP_FORMAT_422;
             break;
-        case VLC_FOURCC('I','4','1','1'):
+        case VLC_CODEC_I411:
             i_flags |= PP_FORMAT_411;
             break;
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('I','Y','U','V'):
-        case VLC_FOURCC('J','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
+        case VLC_CODEC_I420:
+        case VLC_CODEC_J420:
+        case VLC_CODEC_YV12:
             i_flags |= PP_FORMAT_420;
             break;
         default:
index 2e1c53c36acbb924206f16db2b97e675cdcd2ae7..b0cf07d0168fad64982b60bb03e1dccf997fa711 100644 (file)
@@ -62,7 +62,7 @@ vlc_module_begin ()
 vlc_module_end ()
 
 /*****************************************************************************
- * vout_sys_t: Distort video output method descriptor
+ * filter_sys_t: Distort video output method descriptor
  *****************************************************************************
  * This structure is part of the video output thread descriptor.
  * It describes the Distort specific properties of an output thread.
index 8b0e02ece326754b86991c75306cf4f11c192ec7..5bc22dc36fa19b8e516a883e789a1d7e07b4ade4 100644 (file)
@@ -323,7 +323,7 @@ static int CreateFilter ( vlc_object_t *p_this )
                          KeyEvent, p_this );
     }
 
-    es_format_Init( &p_filter->fmt_out, SPU_ES, VLC_FOURCC( 's','p','u',' ' ) );
+    es_format_Init( &p_filter->fmt_out, SPU_ES, VLC_CODEC_SPU );
     p_filter->fmt_out.i_priority = 0;
 
     vlc_gcrypt_init();
@@ -697,7 +697,7 @@ static void* vnc_worker_thread( vlc_object_t *p_thread_obj )
 
     /* Create an empty picture for VNC the data */
     vlc_mutex_lock( &p_sys->lock );
-    p_sys->p_pic = picture_New( VLC_FOURCC('Y','U','V','A'),
+    p_sys->p_pic = picture_New( VLC_CODEC_YUVA,
                                 p_sys->i_vnc_width, p_sys->i_vnc_height, VOUT_ASPECT_FACTOR );
     if( !p_sys->p_pic )
     {
@@ -1154,7 +1154,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
 
     /* Create new SPU region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt.i_chroma = VLC_CODEC_YUVA;
     fmt.i_aspect = VOUT_ASPECT_FACTOR;
     fmt.i_sar_num = fmt.i_sar_den = 1;
     fmt.i_width = fmt.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;
index 6eab4f1c17fbf0a28c01b8f608edf507dcb0f181..a8ce70fcc42ec3522648c5bf69b69b6c4f8d6a9a 100644 (file)
@@ -34,7 +34,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_filter.h>
 #include "filter_picture.h"
 
@@ -61,7 +60,7 @@ vlc_module_begin ()
 vlc_module_end ()
 
 /*****************************************************************************
- * vout_sys_t: Distort video output method descriptor
+ * filter_sys_t: Distort video output method descriptor
  *****************************************************************************
  * This structure is part of the video output thread descriptor.
  * It describes the Distort specific properties of an output thread.
index d41ea992d24206c30a487cb9f1416357b6fe003e..8a1d4342aacaea22845550781a48ee3e03c04c63 100644 (file)
@@ -33,7 +33,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
index 8eef177220630dd8bde0f8792924646dd62b459e..5c6e4c8192573b6b054c9598caa44855ae0244b2 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "vlc_block.h"
@@ -272,7 +271,7 @@ static int CreateFilter( vlc_object_t *p_this )
     }
     p_sys->psz_marquee[p_sys->i_length] = '\0';
 
-    p_sys->p_style = malloc( sizeof( text_style_t ));
+    p_sys->p_style = text_style_New();
     if( p_sys->p_style == NULL )
     {
         free( p_sys->psz_marquee );
@@ -282,7 +281,6 @@ static int CreateFilter( vlc_object_t *p_this )
         free( p_sys );
         return VLC_ENOMEM;
     }
-    memcpy( p_sys->p_style, &default_text_style, sizeof( text_style_t ));
 
     p_sys->i_xoff = var_CreateGetInteger( p_filter, CFG_PREFIX "x" );
     p_sys->i_yoff = var_CreateGetInteger( p_filter, CFG_PREFIX "y" );
@@ -299,7 +297,7 @@ static int CreateFilter( vlc_object_t *p_this )
     if( FetchRSS( p_filter ) )
     {
         msg_Err( p_filter, "failed while fetching RSS ... too bad" );
-        free( p_sys->p_style );
+        text_style_Delete( p_sys->p_style );
         free( p_sys->psz_marquee );
         vlc_mutex_unlock( &p_sys->lock );
         vlc_mutex_destroy( &p_sys->lock );
@@ -311,7 +309,7 @@ static int CreateFilter( vlc_object_t *p_this )
 
     if( p_sys->i_feeds == 0 )
     {
-        free( p_sys->p_style );
+        text_style_Delete( p_sys->p_style );
         free( p_sys->psz_marquee );
         vlc_mutex_unlock( &p_sys->lock );
         vlc_mutex_destroy( &p_sys->lock );
@@ -323,7 +321,7 @@ static int CreateFilter( vlc_object_t *p_this )
     {
         if( p_sys->p_feeds[i_feed].i_items == 0 )
         {
-            free( p_sys->p_style );
+            text_style_Delete( p_sys->p_style );
             free( p_sys->psz_marquee );
             FreeRSS( p_filter );
             vlc_mutex_unlock( &p_sys->lock );
@@ -351,7 +349,7 @@ static void DestroyFilter( vlc_object_t *p_this )
 
     vlc_mutex_lock( &p_sys->lock );
 
-    free( p_sys->p_style );
+    text_style_Delete( p_sys->p_style );
     free( p_sys->psz_marquee );
     free( p_sys->psz_urls );
     FreeRSS( p_filter );
@@ -441,7 +439,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         return NULL;
     }
 
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
 
     p_spu->p_region = subpicture_region_New( &fmt );
     if( !p_spu->p_region )
@@ -530,7 +528,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         p_spu->b_absolute = false;
     }
 
-    p_spu->p_region->p_style = p_sys->p_style;
+    p_spu->p_region->p_style = text_style_Duplicate( p_sys->p_style );
 
     if( p_feed->p_pic )
     {
@@ -540,7 +538,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
 
         memset( &fmt_out, 0, sizeof(video_format_t) );
 
-        fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+        fmt_out.i_chroma = VLC_CODEC_YUVA;
         fmt_out.i_aspect = VOUT_ASPECT_FACTOR;
         fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
         fmt_out.i_width =
@@ -594,7 +592,7 @@ static picture_t *LoadImage( filter_t *p_filter, const char *psz_url )
     memset( &fmt_in, 0, sizeof(video_format_t) );
     memset( &fmt_out, 0, sizeof(video_format_t) );
 
-    fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt_out.i_chroma = VLC_CODEC_YUVA;
     p_orig = image_ReadUrl( p_handler, psz_url, &fmt_in, &fmt_out );
 
     if( !p_orig )
@@ -604,7 +602,7 @@ static picture_t *LoadImage( filter_t *p_filter, const char *psz_url )
     else if( p_sys->p_style->i_font_size > 0 )
     {
 
-        fmt_in.i_chroma = VLC_FOURCC('Y','U','V','A');
+        fmt_in.i_chroma = VLC_CODEC_YUVA;
         fmt_in.i_height = p_orig->p[Y_PLANE].i_visible_lines;
         fmt_in.i_width = p_orig->p[Y_PLANE].i_visible_pitch;
         fmt_out.i_width = p_orig->p[Y_PLANE].i_visible_pitch
index 68ef70f3469d67506a9aa072c80ac18991656e7a..f595b49eaf5a619743ace7add87895174f9e04a9 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include "vlc_filter.h"
 
 /*****************************************************************************
@@ -68,9 +67,9 @@ static int OpenFilter( vlc_object_t *p_this )
     filter_sys_t *p_sys;
 
     /* XXX Only support RV24 -> RV32 conversion */
-    if( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('R','V','2','4') ||
-        (p_filter->fmt_out.video.i_chroma != VLC_FOURCC('R', 'V', '3', '2') &&
-        p_filter->fmt_out.video.i_chroma != VLC_FOURCC('R', 'G', 'B', 'A')) )
+    if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGB24 ||
+        (p_filter->fmt_out.video.i_chroma != VLC_CODEC_RGB32 &&
+        p_filter->fmt_out.video.i_chroma != VLC_CODEC_RGBA) )
     {
         return VLC_EGENERIC;
     }
index 159bd180fca315d1f9889bf6db0b74c9fcd80b1a..e2c3da8b3a57dc8dd589b75e579f8b2b1a9947dc 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include "vlc_filter.h"
 
 /*****************************************************************************
@@ -69,12 +68,12 @@ static int OpenFilter( vlc_object_t *p_this )
     filter_t *p_filter = (filter_t*)p_this;
     filter_sys_t *p_sys;
 
-    if( ( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','U','V','P') &&
-          p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','U','V','A') &&
-          p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','4','2','0') &&
-          p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','V','1','2') &&
-          p_filter->fmt_in.video.i_chroma != VLC_FOURCC('R','V','3','2') &&
-          p_filter->fmt_in.video.i_chroma != VLC_FOURCC('R','G','B','A') ) ||
+    if( ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVP &&
+          p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVA &&
+          p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420 &&
+          p_filter->fmt_in.video.i_chroma != VLC_CODEC_YV12 &&
+          p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGB32 &&
+          p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGBA ) ||
         p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma )
     {
         return VLC_EGENERIC;
@@ -131,8 +130,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    if( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('R','G','B','A') &&
-        p_filter->fmt_in.video.i_chroma != VLC_FOURCC('R','V','3','2') )
+    if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGBA &&
+        p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGB32 )
     {
         for( i_plane = 0; i_plane < p_pic_dst->i_planes; i_plane++ )
         {
index c28433a0a31a2e7d886eb6b7e0d68393fe76c298..604259cfb7dfd0395da1f4d5910744f374774216 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_block.h>
 
 #include "vlc_filter.h"
index 135f21b49ceff5558de68c10a849d636c5f49dac..d7724b4730042d0307f6bd00ac90b91f34ee4345 100644 (file)
@@ -39,7 +39,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
index 61d0d8250423b10eac3fcce496c792a1420bb9b0..fee512755f2dfef8c2965bc4c45ccd1304146e02 100644 (file)
@@ -31,7 +31,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_filter.h>
 
 #ifdef HAVE_LIBSWSCALE_SWSCALE_H
@@ -272,30 +271,30 @@ static int GetParameters( ScalerConfiguration *p_cfg,
 
     if( p_fmti->i_chroma == p_fmto->i_chroma )
     {
-        if( p_fmti->i_chroma == VLC_FOURCC( 'Y', 'U', 'V', 'P' ) && ALLOW_YUVP )
+        if( p_fmti->i_chroma == VLC_CODEC_YUVP && ALLOW_YUVP )
         {
             i_fmti = i_fmto = PIX_FMT_GRAY8;
             i_sws_flags = SWS_POINT;
         }
     }
 
-    if( p_fmti->i_chroma == VLC_FOURCC( 'Y', 'U', 'V', 'A' ) )
+    if( p_fmti->i_chroma == VLC_CODEC_YUVA )
     {
         i_fmti = PIX_FMT_YUV444P;
         b_has_ai = true;
     }
-    else if( p_fmti->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+    else if( p_fmti->i_chroma == VLC_CODEC_RGBA )
     {
         i_fmti = PIX_FMT_BGR32;
         b_has_ai = true;
     }
 
-    if( p_fmto->i_chroma == VLC_FOURCC( 'Y', 'U', 'V', 'A' ) )
+    if( p_fmto->i_chroma == VLC_CODEC_YUVA )
     {
         i_fmto = PIX_FMT_YUV444P;
         b_has_ao = true;
     }
-    else if( p_fmto->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+    else if( p_fmto->i_chroma == VLC_CODEC_RGBA )
     {
         i_fmto = PIX_FMT_BGR32;
         b_has_ao = true;
@@ -379,8 +378,8 @@ static int Init( filter_t *p_filter )
     }
     if( p_sys->ctxA )
     {
-        p_sys->p_src_a = picture_New( VLC_FOURCC( 'G', 'R', 'E', 'Y' ), i_fmti_width, p_fmti->i_height, 0 );
-        p_sys->p_dst_a = picture_New( VLC_FOURCC( 'G', 'R', 'E', 'Y' ), i_fmto_width, p_fmto->i_height, 0 );
+        p_sys->p_src_a = picture_New( VLC_CODEC_GREY, i_fmti_width, p_fmti->i_height, 0 );
+        p_sys->p_dst_a = picture_New( VLC_CODEC_GREY, i_fmto_width, p_fmto->i_height, 0 );
     }
     if( p_sys->i_extend_factor != 1 )
     {
@@ -509,7 +508,7 @@ static void Convert( filter_t *p_filter, struct SwsContext *ctx,
     uint8_t *dst[3]; int dst_stride[3];
 
     GetPixels( src, src_stride, p_src, i_plane_start, i_plane_count );
-    if( p_filter->fmt_in.video.i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'P' ) )
+    if( p_filter->fmt_in.video.i_chroma == VLC_CODEC_RGBP )
     {
         memset( palette, 0, sizeof(palette) );
         if( p_filter->fmt_in.video.p_palette )
@@ -575,13 +574,13 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     if( p_sys->ctxA )
     {
         /* We extract the A plane to rescale it, and then we reinject it. */
-        if( p_fmti->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+        if( p_fmti->i_chroma == VLC_CODEC_RGBA )
             ExtractA( p_sys->p_src_a, p_src, p_fmti->i_width * p_sys->i_extend_factor, p_fmti->i_height );
         else
             plane_CopyPixels( p_sys->p_src_a->p, p_src->p+A_PLANE );
 
         Convert( p_filter, p_sys->ctxA, p_sys->p_dst_a, p_sys->p_src_a, p_fmti->i_height, 0, 1 );
-        if( p_fmto->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+        if( p_fmto->i_chroma == VLC_CODEC_RGBA )
             InjectA( p_dst, p_sys->p_dst_a, p_fmto->i_width * p_sys->i_extend_factor, p_fmto->i_height );
         else
             plane_CopyPixels( p_dst->p+A_PLANE, p_sys->p_dst_a->p );
@@ -589,7 +588,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     else if( p_sys->b_add_a )
     {
         /* We inject a complete opaque alpha plane */
-        if( p_fmto->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
+        if( p_fmto->i_chroma == VLC_CODEC_RGBA )
             FillA( &p_dst->p[0], OFFSET_A );
         else
             FillA( &p_dst->p[A_PLANE], 0 );
index 6afd21000c4d61aeab287062885c6ca3525f70f4..6356ca2485507c8181f9568a24a871996ee0366f 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_filter.h>
 
 #include "libswscale_nokia770/arm_jit_swscale.h"
@@ -138,9 +137,8 @@ static int Init( filter_t *p_filter )
         return VLC_SUCCESS;
     }
 
-    if( ( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','4','2','0') &&
-          p_filter->fmt_in.video.i_chroma != VLC_FOURCC('I','Y','U','V') &&
-          p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','V','1','2') ) ||
+    if( ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420 &&
+          p_filter->fmt_in.video.i_chroma != VLC_CODEC_YV12 ) ||
           p_filter->fmt_out.video.i_chroma != VLC_FOURCC('Y','4','2','0') )
     {
         msg_Err( p_filter, "format not supported" );
@@ -188,7 +186,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
 
     /* Request output picture */
-    p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
+    p_pic_dst = filter_NewPicture( p_filter );
     if( !p_pic_dst )
     {
         msg_Warn( p_filter, "can't get output picture" );
index 0409cf1acb126d2dd18f6c027694f55e707e65c6..0ecd4500843c711351b4de52d7ca11016455c9c3 100644 (file)
@@ -145,12 +145,12 @@ static int Create( vlc_object_t *p_this )
     switch( p_vout->fmt_in.i_chroma )
     {
         CASE_PLANAR_YUV_SQUARE
-        case VLC_FOURCC('G','R','E','Y'):
+        case VLC_CODEC_GREY:
             p_vout->p_sys->pf_filter = FilterPlanar;
             break;
 
-        case VLC_FOURCC('I','4','2','2'):
-        case VLC_FOURCC('J','4','2','2'):
+        case VLC_CODEC_I422:
+        case VLC_CODEC_J422:
             p_vout->p_sys->pf_filter = FilterI422;
             break;
 
index e51dfe580900333482adc97675a69b80a646518a..4a5227f509a0ad1c24facef19e7fa864f99934fd 100644 (file)
@@ -34,7 +34,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 
 #include "vlc_filter.h"
 #include "filter_picture.h"
@@ -62,7 +61,7 @@ vlc_module_begin ()
 vlc_module_end ()
 
 /*****************************************************************************
- * vout_sys_t: Distort video output method descriptor
+ * filter_sys_t: Distort video output method descriptor
  *****************************************************************************
  * This structure is part of the video output thread descriptor.
  * It describes the Distort specific properties of an output thread.
index 72c6fb8898a01522b0fa3d517944ab11accc06fd..5035c285b4eea30eb00b0f227dbd04c144c5fc8b 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include "vlc_filter.h"
 #include <assert.h>
 
@@ -65,9 +64,9 @@ static int Open( vlc_object_t *p_this )
 
     /* It only supports YUVP to YUVA/RGBA without scaling
      * (if scaling is required another filter can do it) */
-    if( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','U','V','P') ||
-        ( p_filter->fmt_out.video.i_chroma != VLC_FOURCC('Y','U','V','A') &&
-          p_filter->fmt_out.video.i_chroma != VLC_FOURCC('R','G','B','A') ) ||
+    if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVP ||
+        ( p_filter->fmt_out.video.i_chroma != VLC_CODEC_YUVA &&
+          p_filter->fmt_out.video.i_chroma != VLC_CODEC_RGBA ) ||
         p_filter->fmt_in.video.i_width  != p_filter->fmt_out.video.i_width ||
         p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
     {
@@ -103,7 +102,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     const video_palette_t *p_yuvp = p_filter->fmt_in.video.p_palette;
 
     assert( p_yuvp != NULL );
-    assert( p_filter->fmt_in.video.i_chroma == VLC_FOURCC('Y','U','V','P') );
+    assert( p_filter->fmt_in.video.i_chroma == VLC_CODEC_YUVP );
     assert( p_filter->fmt_in.video.i_width == p_filter->fmt_out.video.i_width );
     assert( p_filter->fmt_in.video.i_height == p_filter->fmt_out.video.i_height );
 
@@ -115,7 +114,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    if( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('Y','U','V','A') )
+    if( p_filter->fmt_out.video.i_chroma == VLC_CODEC_YUVA )
     {
         for( unsigned int y = 0; y < p_filter->fmt_in.video.i_height; y++ )
         {
@@ -141,7 +140,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     }
     else
     {
-        assert( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('R','G','B','A') );
+        assert( p_filter->fmt_out.video.i_chroma == VLC_CODEC_RGBA );
 
         /* Create a RGBA palette */
         video_palette_t rgbp;
index 0e256851465e28b1d0f2f7c3c4fa5016bd95588c..a46998fb0259a8397ede28b656b068f7068205c0 100644 (file)
@@ -127,7 +127,7 @@ static int Init( vout_thread_t *p_vout )
 
     I_OUTPUTPICTURES = 0;
 
-    p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+    p_vout->output.i_chroma = VLC_CODEC_RGB8;
     p_vout->output.i_width = p_vout->p_sys->i_width;
     p_vout->output.i_height = p_vout->p_sys->i_height;
     p_vout->output.i_aspect = p_vout->p_sys->i_width
@@ -231,7 +231,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
 static void Display( vout_thread_t *p_vout, picture_t *p_pic )
 {
     /* No need to do anything, the fake direct buffers stay as they are */
-    int i_width, i_height, i_x, i_y;
+    unsigned int i_width, i_height, i_x, i_y;
 
     vout_PlacePicture( p_vout, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
                        &i_x, &i_y, &i_width, &i_height );
index 63e437f26379b75a97d17b34263c03502d217d0a..d044a3d5ea0aff0a9caac7bfaca1fcddac107233 100644 (file)
@@ -215,7 +215,7 @@ static int Init( vout_thread_t *p_vout )
 
     I_OUTPUTPICTURES = 0;
 
-    p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+    p_vout->output.i_chroma = VLC_CODEC_RGB32;
     p_vout->output.i_width = p_vout->render.i_width;
     p_vout->output.i_height = p_vout->render.i_height;
     p_vout->output.i_aspect = p_vout->render.i_aspect;
index dce0dfadc2dfd38d4a4d11537d4880da87c8ed4d..77fa243a4adb2e8a3c7583f00a2a7b7dfbf1f689 100644 (file)
@@ -140,7 +140,7 @@ static int Init( vout_thread_t *p_vout )
             i_goffset = 2;
             i_blength = 2;
             i_boffset = 0;
-            p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB8;
             break;
 
         case DSPF_RGB16:
@@ -152,7 +152,7 @@ static int Init( vout_thread_t *p_vout )
             i_goffset = 5;
             i_blength = 5;
             i_boffset = 0;
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+            p_vout->output.i_chroma = VLC_CODEC_RGB16;
             break;
 
         case DSPF_RGB24:
@@ -164,7 +164,7 @@ static int Init( vout_thread_t *p_vout )
             i_goffset = 8;
             i_blength = 8;
             i_boffset = 0;
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4');
+            p_vout->output.i_chroma = VLC_CODEC_RGB24;
             break;
 
         case DSPF_RGB32:
@@ -176,7 +176,7 @@ static int Init( vout_thread_t *p_vout )
             i_goffset = 8;
             i_blength = 8;
             i_boffset = 0;
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB32;
             break;
 
         default:
index b041adaf3dda284cc67626bd2a03abba9adaaa59..39513690c8cfb96cf46bff8ac188404792a3df5e 100644 (file)
@@ -69,44 +69,17 @@ static int Control (vout_window_t *, int, va_list);
  */
 static int Open (vlc_object_t *obj, const char *varname, bool ptr)
 {
-    static vlc_mutex_t serializer = VLC_STATIC_MUTEX;
     vout_window_t *wnd = (vout_window_t *)obj;
-    vlc_value_t val, globval;
+    vlc_value_t val;
 
-    if (var_Create (obj->p_libvlc, "drawable-busy", VLC_VAR_BOOL)
-     || var_Create (obj, varname, VLC_VAR_DOINHERIT
+    if (var_Create (obj, varname, VLC_VAR_DOINHERIT
                                   | (ptr ? VLC_VAR_ADDRESS : VLC_VAR_INTEGER)))
         return VLC_ENOMEM;
     var_Get (obj, varname, &val);
-
-    vlc_mutex_lock (&serializer);
-    /* Note: We cannot simply clear the drawable variable.
-     * It would break libvlc_video_get_parent(). */
-    var_Get (obj->p_libvlc, varname, &globval);
-    if (ptr ? (val.p_address == globval.p_address)
-            : (val.i_int == globval.i_int))
-    {
-        if (var_GetBool (obj->p_libvlc, "drawable-busy"))
-        {   /* LibVLC-wide drawable already in use */
-            if (ptr)
-                val.p_address = NULL;
-            else
-                val.i_int = 0;
-        }
-        else
-            var_SetBool (obj->p_libvlc, "drawable-busy", true);
-    }
-    /* If we got a drawable _not_ from the root object (from the input?),
-     * We assume it is not busy. This is a bug. */
-    vlc_mutex_unlock (&serializer);
-
     var_Destroy (obj, varname);
 
     if (ptr ? (val.p_address == NULL) : (val.i_int == 0))
-    {
-        var_Destroy (obj->p_libvlc, "drawable-busy");
         return VLC_EGENERIC;
-    }
 
     if (ptr)
         wnd->handle.hwnd = val.p_address;
@@ -136,11 +109,7 @@ static int  OpenHWND (vlc_object_t *obj)
  */
 static void Close (vlc_object_t *obj)
 {
-    /* This is atomic with regards to var_GetBool() in Open(): */
-    var_SetBool (obj->p_libvlc, "drawable-busy", false);
-
-    /* Variables are reference-counted... */
-    var_Destroy (obj->p_libvlc, "drawable-busy");
+    (void)obj;
 }
 
 
index 1796b70f7bf3dddb7b1d9e8451bcb793c0b7d22b..cd4486e09c0fdab60cc13249c565346b7826ddec 100644 (file)
@@ -225,12 +225,12 @@ static int Create( vlc_object_t *p_this )
     psz_chroma = var_CreateGetNonEmptyString( p_vout, "fb-chroma" );
     if( psz_chroma )
     {
-        if( strlen( psz_chroma ) == 4 )
+        const vlc_fourcc_t i_chroma =
+            vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_chroma );
+
+        if( i_chroma )
         {
-            p_sys->i_chroma = VLC_FOURCC( psz_chroma[0],
-                                   psz_chroma[1],
-                                   psz_chroma[2],
-                                   psz_chroma[3] );
+            p_sys->i_chroma = i_chroma;
             msg_Dbg( p_vout, "forcing chroma '%s'", psz_chroma );
         }
         else
@@ -415,9 +415,13 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
     /* Fill in picture_t fields */
-    vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma,
-                      p_vout->output.i_width, p_vout->output.i_height,
-                      p_vout->output.i_aspect );
+    if( picture_Setup( p_pic, p_vout->output.i_chroma,
+                       p_vout->output.i_width, p_vout->output.i_height,
+                       p_vout->output.i_aspect ) )
+    {
+        free( p_pic );
+        return VLC_EGENERIC;
+    }
 
     p_pic->p_sys->p_data = malloc( p_vout->p_sys->i_page_size );
     if( !p_pic->p_sys->p_data )
@@ -487,15 +491,15 @@ static int Init( vout_thread_t *p_vout )
         switch( p_sys->var_info.bits_per_pixel )
         {
         case 8: /* FIXME: set the palette */
-            p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB8; break;
         case 15:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB15; break;
         case 16:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB16; break;
         case 24:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB24; break;
         case 32:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB32; break;
         default:
             msg_Err( p_vout, "unknown screen depth %i",
                      p_vout->p_sys->var_info.bits_per_pixel );
index a5a0e6c39802ecdfc2f277d1679d33283394ab93..7f7c5d5464ffcb1645b2636081677e74d01f496f 100644 (file)
@@ -145,17 +145,17 @@ static int Init( vout_thread_t *p_vout )
     switch( p_vout->p_sys->i_bits_per_pixel )
     {
         case 8:
-            p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB8;
             p_vout->output.pf_setpalette = SetPalette;
             break;
         case 15:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB15; break;
         case 16:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB16; break;
         case 24:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB24; break;
         case 32:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB32; break;
         default:
             msg_Err( p_vout, "unknown screen depth %i",
                      p_vout->p_sys->i_bits_per_pixel );
index fa6b2058a9d24b6d8a0263f55992af3e380dbcab..56392a3be049955d2d3f837a2c6af0cb3597d081 100644 (file)
@@ -171,7 +171,7 @@ static int Init( vout_thread_t *p_vout )
 
     I_OUTPUTPICTURES = 0;
 
-    p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+    p_vout->output.i_chroma = VLC_CODEC_RGB8;
     p_vout->output.i_width = p_vout->p_sys->i_width;
     p_vout->output.i_height = p_vout->p_sys->i_height;
     p_vout->output.i_aspect = p_vout->p_sys->i_width
@@ -181,15 +181,15 @@ static int Init( vout_thread_t *p_vout )
     switch( p_vout->p_sys->i_screen_depth )
     {
         case 8: /* FIXME: set the palette */
-            p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB8; break;
         case 15:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB15; break;
         case 16:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB16; break;
         case 24:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB24; break;
         case 32:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB32; break;
         default:
             msg_Err( p_vout, "unknown screen depth %i",
                      p_vout->p_sys->i_screen_depth );
@@ -257,9 +257,9 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
     /* Fill in picture_t fields */
-    vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma,
-                      p_vout->output.i_width, p_vout->output.i_height,
-                      p_vout->output.i_aspect );
+    picture_Setup( p_pic, p_vout->output.i_chroma,
+                   p_vout->output.i_width, p_vout->output.i_height,
+                   p_vout->output.i_aspect );
 
     p_pic->p_sys->p_image = new CascadeSharedMemZone();
     if( p_pic->p_sys->p_image == NULL )
index 7ebcefcd8bdf140e3722074e005ce730ac597154..65ed9eee092041dd3c0d46c0661666cbb22d9e96 100644 (file)
@@ -188,7 +188,7 @@ static int Init( vout_thread_t *p_vout )
 
     /* Assume we only do YMGA for the moment. XXX: mga_vid calls this
      * YV12, but it's actually some strange format with packed UV. */
-    p_vout->output.i_chroma = VLC_FOURCC('Y','M','G','A');
+    p_vout->output.i_chroma = VLC_CODEC_YMGA;
     p_vout->p_sys->mga.format = MGA_VID_FORMAT_YV12;
 
     if( ioctl(p_vout->p_sys->i_fd, MGA_VID_CONFIG, &p_vout->p_sys->mga) )
index 6435154de92ad388439666af3a9666aa4794bc28..7d385468c2b4c0b8540f180f3e649e2d31a71794 100644 (file)
@@ -883,17 +883,15 @@ static D3DFORMAT Direct3DVoutFindFormat(vout_thread_t *p_vout, int i_chroma, D3D
     /* it sounds like vista does not support YUV surfaces at all */
         switch( i_chroma )
         {
-            case VLC_FOURCC('U','Y','V','Y'):
-            case VLC_FOURCC('U','Y','N','V'):
-            case VLC_FOURCC('Y','4','2','2'):
+            case VLC_CODEC_UYVY:
             {
                 static const D3DFORMAT formats[] =
                     { D3DFMT_UYVY, D3DFMT_YUY2, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 };
                 return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
             }
-            case VLC_FOURCC('I','4','2','0'):
-            case VLC_FOURCC('I','4','2','2'):
-            case VLC_FOURCC('Y','V','1','2'):
+            case VLC_CODEC_I420:
+            case VLC_CODEC_I422:
+            case VLC_CODEC_YV12:
             {
                 /* typically 3D textures don't support planar format
                 ** fallback to packed version and use CPU for the conversion
@@ -902,8 +900,7 @@ static D3DFORMAT Direct3DVoutFindFormat(vout_thread_t *p_vout, int i_chroma, D3D
                     { D3DFMT_YUY2, D3DFMT_UYVY, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 };
                 return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
             }
-            case VLC_FOURCC('Y','U','Y','2'):
-            case VLC_FOURCC('Y','U','N','V'):
+            case VLC_CODEC_YUYV:
             {
                 static const D3DFORMAT formats[] =
                     { D3DFMT_YUY2, D3DFMT_UYVY, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 };
@@ -914,25 +911,25 @@ static D3DFORMAT Direct3DVoutFindFormat(vout_thread_t *p_vout, int i_chroma, D3D
 
     switch( i_chroma )
     {
-        case VLC_FOURCC('R', 'V', '1', '5'):
+        case VLC_CODEC_RGB15:
         {
             static const D3DFORMAT formats[] =
                 { D3DFMT_X1R5G5B5 };
             return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
         }
-        case VLC_FOURCC('R', 'V', '1', '6'):
+        case VLC_CODEC_RGB16:
         {
             static const D3DFORMAT formats[] =
                 { D3DFMT_R5G6B5 };
             return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
         }
-        case VLC_FOURCC('R', 'V', '2', '4'):
+        case VLC_CODEC_RGB24:
         {
             static const D3DFORMAT formats[] =
                 { D3DFMT_R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8 };
             return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
         }
-        case VLC_FOURCC('R', 'V', '3', '2'):
+        case VLC_CODEC_RGB32:
         {
             static const D3DFORMAT formats[] =
                 { D3DFMT_A8R8G8B8, D3DFMT_X8R8G8B8 };
@@ -980,32 +977,32 @@ static int Direct3DVoutSetOutputFormat(vout_thread_t *p_vout, D3DFORMAT format)
     switch( format )
     {
         case D3DFMT_YUY2:
-            p_vout->output.i_chroma = VLC_FOURCC('Y', 'U', 'Y', '2');
+            p_vout->output.i_chroma = VLC_CODEC_YUYV;
             break;
         case D3DFMT_UYVY:
-            p_vout->output.i_chroma = VLC_FOURCC('U', 'Y', 'V', 'Y');
+            p_vout->output.i_chroma = VLC_CODEC_UYVY;
             break;
         case D3DFMT_R8G8B8:
-            p_vout->output.i_chroma = VLC_FOURCC('R', 'V', '2', '4');
+            p_vout->output.i_chroma = VLC_CODEC_RGB24;
             p_vout->output.i_rmask = 0xff0000;
             p_vout->output.i_gmask = 0x00ff00;
             p_vout->output.i_bmask = 0x0000ff;
             break;
         case D3DFMT_X8R8G8B8:
         case D3DFMT_A8R8G8B8:
-            p_vout->output.i_chroma = VLC_FOURCC('R', 'V', '3', '2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB32;
             p_vout->output.i_rmask = 0x00ff0000;
             p_vout->output.i_gmask = 0x0000ff00;
             p_vout->output.i_bmask = 0x000000ff;
             break;
         case D3DFMT_R5G6B5:
-            p_vout->output.i_chroma = VLC_FOURCC('R', 'V', '1', '6');
+            p_vout->output.i_chroma = VLC_CODEC_RGB16;
             p_vout->output.i_rmask = (0x1fL)<<11;
             p_vout->output.i_gmask = (0x3fL)<<5;
             p_vout->output.i_bmask = (0x1fL)<<0;
             break;
         case D3DFMT_X1R5G5B5:
-            p_vout->output.i_chroma = VLC_FOURCC('R', 'V', '1', '5');
+            p_vout->output.i_chroma = VLC_CODEC_RGB15;
             p_vout->output.i_rmask = (0x1fL)<<10;
             p_vout->output.i_gmask = (0x1fL)<<5;
             p_vout->output.i_bmask = (0x1fL)<<0;
@@ -1078,7 +1075,7 @@ static int Direct3DVoutCreatePictures( vout_thread_t *p_vout, size_t i_num_pics
          * picture_t structures */
         switch( p_vout->output.i_chroma )
         {
-            case VLC_FOURCC('R','G','B','2'):
+            case VLC_CODEC_RGB8:
                 p_pic->p->i_lines = p_vout->output.i_height;
                 p_pic->p->i_visible_lines = p_vout->output.i_height;
                 p_pic->p->i_pixel_pitch = 1;
@@ -1086,8 +1083,8 @@ static int Direct3DVoutCreatePictures( vout_thread_t *p_vout, size_t i_num_pics
                     p_pic->p->i_pixel_pitch;
                 p_pic->i_planes = 1;
             break;
-            case VLC_FOURCC('R','V','1','5'):
-            case VLC_FOURCC('R','V','1','6'):
+            case VLC_CODEC_RGB15:
+            case VLC_CODEC_RGB16:
                 p_pic->p->i_lines = p_vout->output.i_height;
                 p_pic->p->i_visible_lines = p_vout->output.i_height;
                 p_pic->p->i_pixel_pitch = 2;
@@ -1095,7 +1092,7 @@ static int Direct3DVoutCreatePictures( vout_thread_t *p_vout, size_t i_num_pics
                     p_pic->p->i_pixel_pitch;
                 p_pic->i_planes = 1;
             break;
-            case VLC_FOURCC('R','V','2','4'):
+            case VLC_CODEC_RGB24:
                 p_pic->p->i_lines = p_vout->output.i_height;
                 p_pic->p->i_visible_lines = p_vout->output.i_height;
                 p_pic->p->i_pixel_pitch = 3;
@@ -1103,7 +1100,7 @@ static int Direct3DVoutCreatePictures( vout_thread_t *p_vout, size_t i_num_pics
                     p_pic->p->i_pixel_pitch;
                 p_pic->i_planes = 1;
             break;
-            case VLC_FOURCC('R','V','3','2'):
+            case VLC_CODEC_RGB32:
                 p_pic->p->i_lines = p_vout->output.i_height;
                 p_pic->p->i_visible_lines = p_vout->output.i_height;
                 p_pic->p->i_pixel_pitch = 4;
@@ -1111,8 +1108,8 @@ static int Direct3DVoutCreatePictures( vout_thread_t *p_vout, size_t i_num_pics
                     p_pic->p->i_pixel_pitch;
                 p_pic->i_planes = 1;
                 break;
-            case VLC_FOURCC('U','Y','V','Y'):
-            case VLC_FOURCC('Y','U','Y','2'):
+            case VLC_CODEC_UYVY:
+            case VLC_CODEC_YUYV:
                 p_pic->p->i_lines = p_vout->output.i_height;
                 p_pic->p->i_visible_lines = p_vout->output.i_height;
                 p_pic->p->i_pixel_pitch = 2;
index 3d2ba7cec15cbee6c65abbf3cc5da11324735fc9..5844a6f53c8470c79d14ed719ce1d559cff8e682 100644 (file)
@@ -407,20 +407,17 @@ static int Init( vout_thread_t *p_vout )
     /* Choose the chroma we will try first. */
     switch( p_vout->render.i_chroma )
     {
-        case VLC_FOURCC('Y','U','Y','2'):
-        case VLC_FOURCC('Y','U','N','V'):
-            p_vout->output.i_chroma = VLC_FOURCC('Y','U','Y','2');
+        case VLC_CODEC_YUYV:
+            p_vout->output.i_chroma = VLC_CODEC_YUYV;
             break;
-        case VLC_FOURCC('U','Y','V','Y'):
-        case VLC_FOURCC('U','Y','N','V'):
-        case VLC_FOURCC('Y','4','2','2'):
-            p_vout->output.i_chroma = VLC_FOURCC('U','Y','V','Y');
+        case VLC_CODEC_UYVY:
+            p_vout->output.i_chroma = VLC_CODEC_UYVY;
             break;
-        case VLC_FOURCC('Y','V','Y','U'):
-            p_vout->output.i_chroma = VLC_FOURCC('Y','V','Y','U');
+        case VLC_CODEC_YVYU:
+            p_vout->output.i_chroma = VLC_CODEC_YVYU;
             break;
         default:
-            p_vout->output.i_chroma = VLC_FOURCC('Y','V','1','2');
+            p_vout->output.i_chroma = VLC_CODEC_YV12;
             break;
     }
 
@@ -431,15 +428,15 @@ static int Init( vout_thread_t *p_vout )
     if( !I_OUTPUTPICTURES )
     {
         /* hmmm, it didn't work! Let's try commonly supported chromas */
-        if( p_vout->output.i_chroma != VLC_FOURCC('I','4','2','0') )
+        if( p_vout->output.i_chroma != VLC_CODEC_I420 )
         {
-            p_vout->output.i_chroma = VLC_FOURCC('Y','V','1','2');
+            p_vout->output.i_chroma = VLC_CODEC_YV12;
             NewPictureVec( p_vout, p_vout->p_picture, MAX_DIRECTBUFFERS );
         }
         if( !I_OUTPUTPICTURES )
         {
             /* hmmm, it still didn't work! Let's try another one */
-            p_vout->output.i_chroma = VLC_FOURCC('Y','U','Y','2');
+            p_vout->output.i_chroma = VLC_CODEC_YUYV;
             NewPictureVec( p_vout, p_vout->p_picture, MAX_DIRECTBUFFERS );
         }
     }
@@ -1196,11 +1193,11 @@ static int DirectXCreateSurface( vout_thread_t *p_vout,
     if( !b_overlay )
     {
         bool b_rgb_surface =
-            ( i_chroma == VLC_FOURCC('R','G','B','2') )
-          || ( i_chroma == VLC_FOURCC('R','V','1','5') )
-           || ( i_chroma == VLC_FOURCC('R','V','1','6') )
-            || ( i_chroma == VLC_FOURCC('R','V','2','4') )
-             || ( i_chroma == VLC_FOURCC('R','V','3','2') );
+            ( i_chroma == VLC_CODEC_RGB8 )
+          || ( i_chroma == VLC_CODEC_RGB15 )
+           || ( i_chroma == VLC_CODEC_RGB16 )
+            || ( i_chroma == VLC_CODEC_RGB24 )
+             || ( i_chroma == VLC_CODEC_RGB32 );
 
         memset( &ddsd, 0, sizeof( DDSURFACEDESC ) );
         ddsd.dwSize = sizeof(DDSURFACEDESC);
@@ -1551,20 +1548,20 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic,
                 switch( ddpfPixelFormat.dwRGBBitCount )
                 {
                 case 8:
-                    p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+                    p_vout->output.i_chroma = VLC_CODEC_RGB8;
                     p_vout->output.pf_setpalette = SetPalette;
                     break;
                 case 15:
-                    p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5');
+                    p_vout->output.i_chroma = VLC_CODEC_RGB15;
                     break;
                 case 16:
-                    p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+                    p_vout->output.i_chroma = VLC_CODEC_RGB16;
                     break;
                 case 24:
-                    p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4');
+                    p_vout->output.i_chroma = VLC_CODEC_RGB24;
                     break;
                 case 32:
-                    p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+                    p_vout->output.i_chroma = VLC_CODEC_RGB32;
                     break;
                 default:
                     msg_Err( p_vout, "unknown screen depth" );
@@ -1678,28 +1675,28 @@ static int UpdatePictureStruct( vout_thread_t *p_vout, picture_t *p_pic,
 {
     switch( p_vout->output.i_chroma )
     {
-        case VLC_FOURCC('R','G','B','2'):
-        case VLC_FOURCC('R','V','1','5'):
-        case VLC_FOURCC('R','V','1','6'):
-        case VLC_FOURCC('R','V','2','4'):
-        case VLC_FOURCC('R','V','3','2'):
+        case VLC_CODEC_RGB8:
+        case VLC_CODEC_RGB15:
+        case VLC_CODEC_RGB16:
+        case VLC_CODEC_RGB24:
+        case VLC_CODEC_RGB32:
             p_pic->p->p_pixels = p_pic->p_sys->ddsd.lpSurface;
             p_pic->p->i_lines = p_vout->output.i_height;
             p_pic->p->i_visible_lines = p_vout->output.i_height;
             p_pic->p->i_pitch = p_pic->p_sys->ddsd.lPitch;
             switch( p_vout->output.i_chroma )
             {
-                case VLC_FOURCC('R','G','B','2'):
+                case VLC_CODEC_RGB8:
                     p_pic->p->i_pixel_pitch = 1;
                     break;
-                case VLC_FOURCC('R','V','1','5'):
-                case VLC_FOURCC('R','V','1','6'):
+                case VLC_CODEC_RGB15:
+                case VLC_CODEC_RGB16:
                     p_pic->p->i_pixel_pitch = 2;
                     break;
-                case VLC_FOURCC('R','V','2','4'):
+                case VLC_CODEC_RGB24:
                     p_pic->p->i_pixel_pitch = 3;
                     break;
-                case VLC_FOURCC('R','V','3','2'):
+                case VLC_CODEC_RGB32:
                     p_pic->p->i_pixel_pitch = 4;
                     break;
                 default:
@@ -1710,12 +1707,11 @@ static int UpdatePictureStruct( vout_thread_t *p_vout, picture_t *p_pic,
             p_pic->i_planes = 1;
             break;
 
-        case VLC_FOURCC('Y','V','1','2'):
-        case VLC_FOURCC('I','4','2','0'):
+        case VLC_CODEC_YV12:
 
             /* U and V inverted compared to I420
              * Fixme: this should be handled by the vout core */
-            p_vout->output.i_chroma = VLC_FOURCC('I','4','2','0');
+            p_vout->output.i_chroma = VLC_CODEC_I420;
 
             p_pic->Y_PIXELS = p_pic->p_sys->ddsd.lpSurface;
             p_pic->p[Y_PLANE].i_lines = p_vout->output.i_height;
@@ -1746,7 +1742,7 @@ static int UpdatePictureStruct( vout_thread_t *p_vout, picture_t *p_pic,
             p_pic->i_planes = 3;
             break;
 
-        case VLC_FOURCC('I','Y','U','V'):
+        case VLC_CODEC_I420:
 
             p_pic->Y_PIXELS = p_pic->p_sys->ddsd.lpSurface;
             p_pic->p[Y_PLANE].i_lines = p_vout->output.i_height;
@@ -1777,8 +1773,8 @@ static int UpdatePictureStruct( vout_thread_t *p_vout, picture_t *p_pic,
             p_pic->i_planes = 3;
             break;
 
-        case VLC_FOURCC('U','Y','V','Y'):
-        case VLC_FOURCC('Y','U','Y','2'):
+        case VLC_CODEC_UYVY:
+        case VLC_CODEC_YUYV:
 
             p_pic->p->p_pixels = p_pic->p_sys->ddsd.lpSurface;
             p_pic->p->i_lines = p_vout->output.i_height;
index c725d66110c1df8ade309c3318d8ae6a7fc638d8..706aded1725d59e795381d183d84c8e4e55f4842 100644 (file)
@@ -379,29 +379,29 @@ static int Init( vout_thread_t *p_vout )
     switch( p_vout->p_sys->i_depth )
     {
     case 8:
-        p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+        p_vout->output.i_chroma = VLC_CODEC_RGB8;
         p_vout->output.pf_setpalette = SetPalette;
         break;
     case 15:
-        p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5');
+        p_vout->output.i_chroma = VLC_CODEC_RGB15;
         p_vout->output.i_rmask  = 0x7c00;
         p_vout->output.i_gmask  = 0x03e0;
         p_vout->output.i_bmask  = 0x001f;
         break;
     case 16:
-        p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+        p_vout->output.i_chroma = VLC_CODEC_RGB16;
         p_vout->output.i_rmask  = 0xf800;
         p_vout->output.i_gmask  = 0x07e0;
         p_vout->output.i_bmask  = 0x001f;
         break;
     case 24:
-        p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4');
+        p_vout->output.i_chroma = VLC_CODEC_RGB24;
         p_vout->output.i_rmask  = 0x00ff0000;
         p_vout->output.i_gmask  = 0x0000ff00;
         p_vout->output.i_bmask  = 0x000000ff;
         break;
     case 32:
-        p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+        p_vout->output.i_chroma = VLC_CODEC_RGB32;
         p_vout->output.i_rmask  = 0x00ff0000;
         p_vout->output.i_gmask  = 0x0000ff00;
         p_vout->output.i_bmask  = 0x000000ff;
index 95c2eaf2e604bbce6605bae621bab2979a0d1344..9d895645f4ed29dcd70aa07d669e5d480a0e2f36 100644 (file)
@@ -185,9 +185,8 @@ static int Create( vlc_object_t *p_this )
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
     vout_sys_t    *p_sys;
 
-    if( p_vout->fmt_in.i_chroma != VLC_FOURCC('I','4','2','0') &&
-        p_vout->fmt_in.i_chroma != VLC_FOURCC('I','Y','U','V') &&
-        p_vout->fmt_in.i_chroma != VLC_FOURCC('Y','V','1','2') )
+    if( p_vout->fmt_in.i_chroma != VLC_CODEC_I420 &&
+        p_vout->fmt_in.i_chroma != VLC_CODEC_YV12 )
         return VLC_EGENERIC;
 
     /* Allocate instance and initialize some members */
@@ -308,7 +307,7 @@ static int Init( vout_thread_t *p_vout )
     }
 
     p_vout->output.i_chroma =
-    p_vout->fmt_out.i_chroma = VLC_FOURCC( 'Y','4','2','0' );
+    p_vout->fmt_out.i_chroma = VLC_CODEC_I420;
     p_sys->i_color_format = OMAPFB_COLOR_YUV420;
 
     // place in the framebuffer where we have to write
index ecacbeb48b45134afc1b450791a37d3a2c57c7cc..2cff793f71e372aa93614dd9a67deaa5e7711382 100644 (file)
@@ -252,16 +252,16 @@ static int Init( vout_thread_t *p_vout )
 
 /* TODO: We use YCbCr on Mac which is Y422, but on OSX it seems to == YUY2. Verify */
 #if ( defined( WORDS_BIGENDIAN ) && VLCGL_FORMAT == GL_YCBCR_422_APPLE ) || (VLCGL_FORMAT == YCBCR_MESA)
-    p_vout->output.i_chroma = VLC_FOURCC('Y','U','Y','2');
+    p_vout->output.i_chroma = VLC_CODEC_YUYV;
     i_pixel_pitch = 2;
 
 #elif (VLCGL_FORMAT == GL_YCBCR_422_APPLE)
-    p_vout->output.i_chroma = VLC_FOURCC('U','Y','V','Y');
+    p_vout->output.i_chroma = VLC_CODEC_UYVY;
     i_pixel_pitch = 2;
 
 #elif VLCGL_FORMAT == GL_RGB
 #   if VLCGL_TYPE == GL_UNSIGNED_BYTE
-    p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4');
+    p_vout->output.i_chroma = VLC_CODEC_RGB24;
 #       if defined( WORDS_BIGENDIAN )
     p_vout->output.i_rmask = 0x00ff0000;
     p_vout->output.i_gmask = 0x0000ff00;
@@ -273,7 +273,7 @@ static int Init( vout_thread_t *p_vout )
 #       endif
     i_pixel_pitch = 3;
 #   else
-    p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+    p_vout->output.i_chroma = VLC_CODEC_RGB16;
 #       if defined( WORDS_BIGENDIAN )
     p_vout->output.i_rmask = 0x001f;
     p_vout->output.i_gmask = 0x07e0;
@@ -286,7 +286,7 @@ static int Init( vout_thread_t *p_vout )
     i_pixel_pitch = 2;
 #   endif
 #else
-    p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+    p_vout->output.i_chroma = VLC_CODEC_RGB32;
 #       if defined( WORDS_BIGENDIAN )
     p_vout->output.i_rmask = 0xff000000;
     p_vout->output.i_gmask = 0x00ff0000;
index fe7518f052d7d132e1cf74caac9145d42720d036..fe5717c03b1ca7f28eb467bb5e1d3a90433697b6 100644 (file)
@@ -170,10 +170,10 @@ static int Init( vout_thread_t *p_vout )
     vlc_value_t val;
 
 #if ( defined( WORDS_BIGENDIAN ) && VLCGL_FORMAT == GL_YCBCR_422_APPLE ) || (VLCGL_FORMAT == YCBCR_MESA)
-    p_vout->output.i_chroma = VLC_FOURCC('Y','U','Y','2');
+    p_vout->output.i_chroma = VLC_CODEC_YUYV;
     i_pixel_pitch = 2;
 #elif (VLCGL_FORMAT == GL_YCBCR_422_APPLE)
-    p_vout->output.i_chroma = VLC_FOURCC('U','Y','V','Y');
+    p_vout->output.i_chroma = VLC_CODEC_UYVY;
     i_pixel_pitch = 2;
 #endif
 
index 1c310bc5a494d4e9dda8f25928c0d955bc8680a0..f91acd7b3eeeda38734d48da33ceae98d7012b00 100644 (file)
@@ -218,7 +218,7 @@ static int Init( vout_thread_t *p_vout )
 
     I_OUTPUTPICTURES = 0;
 
-    p_vout->output.i_chroma = (dd == 16) ? VLC_FOURCC('R','V','1','6'): VLC_FOURCC('R','V','3','2');
+    p_vout->output.i_chroma = (dd == 16) ? VLC_CODEC_RGB16 : VLC_CODEC_RGB32;
     p_vout->output.i_rmask  = 0xf800;
     p_vout->output.i_gmask  = 0x07e0;
     p_vout->output.i_bmask  = 0x001f;
index ac19b285905b9388cf81d8177d4b978912e1bfe7..e3f4a9264390390ae3b0e834f8782f9d91258962 100644 (file)
@@ -753,7 +753,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
     /* SDL fucked up fourcc definitions on bigendian machines */
     uint32_t i_sdl_chroma;
     char *psz_chroma = NULL;
-    uint32_t i_chroma = 0;
+    vlc_fourcc_t i_chroma = 0;
 
     bool b_overlay = config_GetInt( p_vout, "overlay" );
 
@@ -796,9 +796,9 @@ static int OpenDisplay( vout_thread_t *p_vout )
 
     if( ( psz_chroma = config_GetPsz( p_vout, "sdl-chroma" ) ) )
     {
-        if( strlen( psz_chroma ) >= 4 )
+        i_chroma = vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_chroma );
+        if( i_chroma )
         {
-            memcpy(&i_chroma, psz_chroma, 4);
             msg_Dbg( p_vout, "Forcing chroma to 0x%.8x (%4.4s)", i_chroma, (char*)&i_chroma );
         }
         else
@@ -816,26 +816,22 @@ static int OpenDisplay( vout_thread_t *p_vout )
             if( !psz_chroma ) i_chroma = 0;
             switch( i_chroma ? i_chroma : p_vout->render.i_chroma )
             {
-                case VLC_FOURCC('Y','U','Y','2'):
-                case VLC_FOURCC('Y','U','N','V'):
-                    p_vout->output.i_chroma = VLC_FOURCC('Y','U','Y','2');
+                case VLC_CODEC_YUYV:
+                    p_vout->output.i_chroma = VLC_CODEC_YUYV;
                     i_sdl_chroma = SDL_YUY2_OVERLAY;
                     break;
-                case VLC_FOURCC('U','Y','V','Y'):
-                case VLC_FOURCC('U','Y','N','V'):
-                case VLC_FOURCC('Y','4','2','2'):
-                    p_vout->output.i_chroma = VLC_FOURCC('U','Y','V','Y');
+                case VLC_CODEC_UYVY:
+                    p_vout->output.i_chroma = VLC_CODEC_UYVY;
                     i_sdl_chroma = SDL_UYVY_OVERLAY;
                     break;
-                case VLC_FOURCC('Y','V','Y','U'):
-                    p_vout->output.i_chroma = VLC_FOURCC('Y','V','Y','U');
+                case VLC_CODEC_YVYU:
+                    p_vout->output.i_chroma = VLC_CODEC_YVYU;
                     i_sdl_chroma = SDL_YVYU_OVERLAY;
                     break;
-                case VLC_FOURCC('Y','V','1','2'):
-                case VLC_FOURCC('I','4','2','0'):
-                case VLC_FOURCC('I','Y','U','V'):
+                case VLC_CODEC_YV12:
+                case VLC_CODEC_I420:
                 default:
-                    p_vout->output.i_chroma = VLC_FOURCC('Y','V','1','2');
+                    p_vout->output.i_chroma = VLC_CODEC_YV12;
                     i_sdl_chroma = SDL_YV12_OVERLAY;
                     break;
             }
@@ -853,7 +849,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
         /* If this best choice failed, fall back to other chromas */
         if( p_vout->p_sys->p_overlay == NULL )
         {
-            p_vout->output.i_chroma = VLC_FOURCC('I','Y','U','V');
+            p_vout->output.i_chroma = VLC_CODEC_I420;
             p_vout->p_sys->p_overlay =
                 SDL_CreateYUVOverlay( 32, 32, SDL_IYUV_OVERLAY,
                                       p_vout->p_sys->p_display );
@@ -861,7 +857,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
 
         if( p_vout->p_sys->p_overlay == NULL )
         {
-            p_vout->output.i_chroma = VLC_FOURCC('Y','V','1','2');
+            p_vout->output.i_chroma = VLC_CODEC_YV12;
             p_vout->p_sys->p_overlay =
                 SDL_CreateYUVOverlay( 32, 32, SDL_YV12_OVERLAY,
                                       p_vout->p_sys->p_display );
@@ -869,7 +865,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
 
         if( p_vout->p_sys->p_overlay == NULL )
         {
-            p_vout->output.i_chroma = VLC_FOURCC('Y','U','Y','2');
+            p_vout->output.i_chroma = VLC_CODEC_YUYV;
             p_vout->p_sys->p_overlay =
                 SDL_CreateYUVOverlay( 32, 32, SDL_YUY2_OVERLAY,
                                       p_vout->p_sys->p_display );
@@ -888,20 +884,20 @@ static int OpenDisplay( vout_thread_t *p_vout )
         switch( p_vout->p_sys->p_display->format->BitsPerPixel )
         {
             case 8:
-                p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+                p_vout->output.i_chroma = VLC_CODEC_RGB8;
                 p_vout->output.pf_setpalette = SetPalette;
                 break;
             case 15:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5');
+                p_vout->output.i_chroma = VLC_CODEC_RGB15;
                 break;
             case 16:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+                p_vout->output.i_chroma = VLC_CODEC_RGB16;
                 break;
             case 24:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4');
+                p_vout->output.i_chroma = VLC_CODEC_RGB24;
                 break;
             case 32:
-                p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+                p_vout->output.i_chroma = VLC_CODEC_RGB32;
                 break;
             default:
                 msg_Err( p_vout, "unknown screen depth %i",
index b5dce2551fd7ae80b7e1207c1bd845dfae986a01..5b6c4c330add7296b59898af02ab7ea4430109ed 100644 (file)
@@ -152,7 +152,7 @@ static int Init( vout_thread_t *p_vout )
     picture_t *p_pic;
     vlc_value_t val;
     char* psz_chroma;
-    int i_chroma;
+    vlc_fourcc_t i_chroma;
     int i_width;
     int i_height;
     int i_datasize;
@@ -161,20 +161,18 @@ static int Init( vout_thread_t *p_vout )
     i_height = config_GetInt( p_vout, "snapshot-height" );
 
     psz_chroma = config_GetPsz( p_vout, "snapshot-chroma" );
-    if( psz_chroma )
+    if( !psz_chroma )
     {
-        if( strlen( psz_chroma ) < 4 )
-        {
-            msg_Err( p_vout, "snapshot-chroma should be 4 characters long" );
-            return VLC_EGENERIC;
-        }
-        i_chroma = VLC_FOURCC( psz_chroma[0], psz_chroma[1],
-                               psz_chroma[2], psz_chroma[3] );
-        free( psz_chroma );
+        msg_Err( p_vout, "Cannot find chroma information." );
+        return VLC_EGENERIC;
     }
-    else
+
+    i_chroma = vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_chroma );
+    free( psz_chroma );
+
+    if( !i_chroma )
     {
-        msg_Err( p_vout, "Cannot find chroma information." );
+        msg_Err( p_vout, "snapshot-chroma should be 4 characters long" );
         return VLC_EGENERIC;
     }
 
@@ -192,25 +190,25 @@ static int Init( vout_thread_t *p_vout )
     /* Define the bitmasks */
     switch( i_chroma )
     {
-      case VLC_FOURCC( 'R','V','1','5' ):
+      case VLC_CODEC_RGB15:
         p_vout->output.i_rmask = 0x001f;
         p_vout->output.i_gmask = 0x03e0;
         p_vout->output.i_bmask = 0x7c00;
         break;
 
-      case VLC_FOURCC( 'R','V','1','6' ):
+      case VLC_CODEC_RGB16:
         p_vout->output.i_rmask = 0x001f;
         p_vout->output.i_gmask = 0x07e0;
         p_vout->output.i_bmask = 0xf800;
         break;
 
-      case VLC_FOURCC( 'R','V','2','4' ):
+      case VLC_CODEC_RGB24:
         p_vout->output.i_rmask = 0xff0000;
         p_vout->output.i_gmask = 0x00ff00;
         p_vout->output.i_bmask = 0x0000ff;
         break;
 
-      case VLC_FOURCC( 'R','V','3','2' ):
+      case VLC_CODEC_RGB32:
         p_vout->output.i_rmask = 0xff0000;
         p_vout->output.i_gmask = 0x00ff00;
         p_vout->output.i_bmask = 0x0000ff;
index ae99b3452922115ed140c74a8ddae8aea6412f4e..fbe3fda6235f0d737943f5b9545722067ae9f8cb 100644 (file)
@@ -155,7 +155,7 @@ static int Init( vout_thread_t *p_vout )
 
     /* Initialize the output structure: RGB with square pixels, whatever
      * the input format is, since it's the only format we know */
-    p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+    p_vout->output.i_chroma = VLC_CODEC_RGB8;
     p_vout->output.pf_setpalette = SetPalette;
     p_vout->output.i_width = vga_getxdim();
     p_vout->output.i_height = vga_getydim();
index f132021a2d8e5ef690a9d37753e8bfbafc0b080e..57e05303e5c39c35cc1954f9fc5d846b9a269571 100644 (file)
@@ -133,28 +133,26 @@ static int Init( vout_thread_t *p_vout )
     int i_index;
     picture_t *p_pic;
     char *psz_chroma, *psz_tmp;
-    int i_width, i_height, i_pitch, i_chroma;
+    int i_width, i_height, i_pitch;
+    vlc_fourcc_t i_chroma;
 
     i_width = var_CreateGetInteger( p_vout, "vmem-width" );
     i_height = var_CreateGetInteger( p_vout, "vmem-height" );
     i_pitch = var_CreateGetInteger( p_vout, "vmem-pitch" );
 
     psz_chroma = var_CreateGetString( p_vout, "vmem-chroma" );
-    if( psz_chroma )
+    if( !psz_chroma )
     {
-        if( strlen( psz_chroma ) < 4 )
-        {
-            msg_Err( p_vout, "vmem-chroma should be 4 characters long" );
-            free( psz_chroma );
-            return VLC_EGENERIC;
-        }
-        i_chroma = VLC_FOURCC( psz_chroma[0], psz_chroma[1],
-                               psz_chroma[2], psz_chroma[3] );
-        free( psz_chroma );
+        msg_Err( p_vout, "Cannot find chroma information." );
+        return VLC_EGENERIC;
     }
-    else
+
+    i_chroma = vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_chroma );
+    free( psz_chroma );
+
+    if( !i_chroma )
     {
-        msg_Err( p_vout, "Cannot find chroma information." );
+        msg_Err( p_vout, "vmem-chroma should be 4 characters long" );
         return VLC_EGENERIC;
     }
 
@@ -189,25 +187,25 @@ static int Init( vout_thread_t *p_vout )
     /* Define the bitmasks */
     switch( i_chroma )
     {
-      case VLC_FOURCC( 'R','V','1','5' ):
+      case VLC_CODEC_RGB15:
         p_vout->output.i_rmask = 0x001f;
         p_vout->output.i_gmask = 0x03e0;
         p_vout->output.i_bmask = 0x7c00;
         break;
 
-      case VLC_FOURCC( 'R','V','1','6' ):
+      case VLC_CODEC_RGB16:
         p_vout->output.i_rmask = 0x001f;
         p_vout->output.i_gmask = 0x07e0;
         p_vout->output.i_bmask = 0xf800;
         break;
 
-      case VLC_FOURCC( 'R','V','2','4' ):
+      case VLC_CODEC_RGB24:
         p_vout->output.i_rmask = 0xff0000;
         p_vout->output.i_gmask = 0x00ff00;
         p_vout->output.i_bmask = 0x0000ff;
         break;
 
-      case VLC_FOURCC( 'R','V','3','2' ):
+      case VLC_CODEC_RGB32:
         p_vout->output.i_rmask = 0xff0000;
         p_vout->output.i_gmask = 0x00ff00;
         p_vout->output.i_bmask = 0x0000ff;
@@ -233,9 +231,13 @@ static int Init( vout_thread_t *p_vout )
         return VLC_SUCCESS;
     }
 
-    vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma,
-                      p_vout->output.i_width, p_vout->output.i_height,
-                      p_vout->output.i_aspect );
+    if( picture_Setup( p_pic, p_vout->output.i_chroma,
+                       p_vout->output.i_width, p_vout->output.i_height,
+                       p_vout->output.i_aspect ) )
+    {
+        free( p_pic );
+        return VLC_EGENERIC;
+    }
 
     p_pic->p->i_pitch = i_pitch;
 
index 9cd132c91c71b4c8178b8ea1b02ee602c42928f0..939ab8734d5cce99b777303d940f2a4b9d66ae52 100644 (file)
@@ -286,7 +286,7 @@ int Activate ( vlc_object_t *p_this )
             }
         }
     }
-    p_vout->output.i_chroma = X112VLC_FOURCC(p_vout->output.i_chroma);
+    p_vout->output.i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, X112VLC_FOURCC(p_vout->output.i_chroma) );
 #elif defined(MODULE_NAME_IS_glx)
     {
         int i_opcode, i_evt, i_err = 0;
@@ -812,7 +812,7 @@ static int InitVideo( vout_thread_t *p_vout )
 #if XvVersion < 2 || ( XvVersion == 2 && XvRevision < 2 )
     switch( p_vout->output.i_chroma )
     {
-        case VLC_FOURCC('R','V','1','6'):
+        case VLC_CODEC_RGB16:
 #if defined( WORDS_BIGENDIAN )
             p_vout->output.i_rmask = 0xf800;
             p_vout->output.i_gmask = 0x07e0;
@@ -823,7 +823,7 @@ static int InitVideo( vout_thread_t *p_vout )
             p_vout->output.i_bmask = 0xf800;
 #endif
             break;
-        case VLC_FOURCC('R','V','1','5'):
+        case VLC_CODEC_RGB15:
 #if defined( WORDS_BIGENDIAN )
             p_vout->output.i_rmask = 0x7c00;
             p_vout->output.i_gmask = 0x03e0;
@@ -843,14 +843,14 @@ static int InitVideo( vout_thread_t *p_vout )
     switch( p_vout->p_sys->i_screen_depth )
     {
         case 8: /* FIXME: set the palette */
-            p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB8; break;
         case 15:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB15; break;
         case 16:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB16; break;
         case 24:
         case 32:
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2'); break;
+            p_vout->output.i_chroma = VLC_CODEC_RGB32; break;
         default:
             msg_Err( p_vout, "unknown screen depth %i",
                      p_vout->p_sys->i_screen_depth );
@@ -926,12 +926,12 @@ static int InitVideo( vout_thread_t *p_vout )
         I_OUTPUTPICTURES++;
     }
 
-    if( p_vout->output.i_chroma == VLC_FOURCC('Y','V','1','2') )
+    if( p_vout->output.i_chroma == VLC_CODEC_YV12 )
     {
         /* U and V inverted compared to I420
          * Fixme: this should be handled by the vout core */
-        p_vout->output.i_chroma = VLC_FOURCC('I','4','2','0');
-        p_vout->fmt_out.i_chroma = VLC_FOURCC('I','4','2','0');
+        p_vout->output.i_chroma = VLC_CODEC_I420;
+        p_vout->fmt_out.i_chroma = VLC_CODEC_I420;
     }
 
     return VLC_SUCCESS;
@@ -1612,6 +1612,8 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
     {
         p_win->owner_window = vout_RequestXWindow( p_vout, &p_win->i_x,
                               &p_win->i_y, &p_win->i_width, &p_win->i_height );
+        if( !p_win->owner_window )
+            return VLC_EGENERIC;
         xsize_hints.base_width  = xsize_hints.width = p_win->i_width;
         xsize_hints.base_height = xsize_hints.height = p_win->i_height;
         xsize_hints.flags       = PSize | PMinSize;
@@ -1622,6 +1624,30 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
             xsize_hints.y = p_win->i_y;
             xsize_hints.flags |= PPosition;
         }
+
+        /* Select events we are interested in. */
+        XSelectInput( p_vout->p_sys->p_display,
+                      p_win->owner_window->handle.xid, StructureNotifyMask );
+
+        /* Get the parent window's geometry information */
+        XGetGeometry( p_vout->p_sys->p_display,
+                      p_win->owner_window->handle.xid,
+                      &(Window){ 0 }, &(int){ 0 }, &(int){ 0 },
+                      &p_win->i_width,
+                      &p_win->i_height,
+                      &(unsigned){ 0 }, &(unsigned){ 0 } );
+
+        /* From man XSelectInput: only one client at a time can select a
+         * ButtonPress event, so we need to open a new window anyway. */
+        p_win->base_window =
+            XCreateWindow( p_vout->p_sys->p_display,
+                           p_win->owner_window->handle.xid,
+                           0, 0,
+                           p_win->i_width, p_win->i_height,
+                           0,
+                           0, CopyFromParent, 0,
+                           CWBackingStore | CWBackPixel | CWEventMask,
+                           &xwindow_attributes );
     }
     else
     {
@@ -1632,10 +1658,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
             DisplayWidth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
         p_win->i_height =
             DisplayHeight( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
-    }
 
-    if( !p_win->owner_window )
-    {
         /* Create the window and set hints - the window must receive
          * ConfigureNotify events, and until it is displayed, Expose and
          * MapNotify events. */
@@ -1669,66 +1692,6 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
                         p_win->base_window, val.psz_string );
         }
         free( val.psz_string );
-
-        if( !p_vout->b_fullscreen )
-        {
-            const char *argv[] = { "vlc", NULL };
-
-            /* Set window manager hints and properties: size hints, command,
-             * window's name, and accepted protocols */
-            XSetWMNormalHints( p_vout->p_sys->p_display,
-                               p_win->base_window, &xsize_hints );
-            XSetCommand( p_vout->p_sys->p_display, p_win->base_window,
-                         (char**)argv, 1 );
-
-            if( !var_GetBool( p_vout, "video-deco") )
-            {
-                Atom prop;
-                mwmhints_t mwmhints;
-
-                mwmhints.flags = MWM_HINTS_DECORATIONS;
-                mwmhints.decorations = False;
-
-                prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS",
-                                    False );
-
-                XChangeProperty( p_vout->p_sys->p_display,
-                                 p_win->base_window,
-                                 prop, prop, 32, PropModeReplace,
-                                 (unsigned char *)&mwmhints,
-                                 PROP_MWM_HINTS_ELEMENTS );
-            }
-        }
-    }
-    else
-    {
-        Window dummy1;
-        int dummy2, dummy3;
-        unsigned int dummy4, dummy5;
-
-        /* Select events we are interested in. */
-        XSelectInput( p_vout->p_sys->p_display,
-                      p_win->owner_window->handle.xid, StructureNotifyMask );
-
-        /* Get the parent window's geometry information */
-        XGetGeometry( p_vout->p_sys->p_display,
-                      p_win->owner_window->handle.xid,
-                      &dummy1, &dummy2, &dummy3,
-                      &p_win->i_width,
-                      &p_win->i_height,
-                      &dummy4, &dummy5 );
-
-        /* From man XSelectInput: only one client at a time can select a
-         * ButtonPress event, so we need to open a new window anyway. */
-        p_win->base_window =
-            XCreateWindow( p_vout->p_sys->p_display,
-                           p_win->owner_window->handle.xid,
-                           0, 0,
-                           p_win->i_width, p_win->i_height,
-                           0,
-                           0, CopyFromParent, 0,
-                           CWBackingStore | CWBackPixel | CWEventMask,
-                           &xwindow_attributes );
     }
 
     if( (p_win->wm_protocols == None)        /* use WM_DELETE_WINDOW */
@@ -1903,9 +1866,10 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
 #endif
 
     /* Fill in picture_t fields */
-    vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma,
-                      p_vout->output.i_width, p_vout->output.i_height,
-                      p_vout->output.i_aspect );
+    if( picture_Setup( p_pic, p_vout->output.i_chroma,
+                       p_vout->output.i_width, p_vout->output.i_height,
+                       p_vout->output.i_aspect ) )
+        return -1;
 
 #ifdef HAVE_SYS_SHM_H
     if( p_vout->p_sys->i_shm_opcode )
@@ -1959,15 +1923,15 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
     switch( p_vout->output.i_chroma )
     {
 #if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
-        case VLC_FOURCC('I','4','2','0'):
-        case VLC_FOURCC('Y','V','1','2'):
-        case VLC_FOURCC('Y','2','1','1'):
-        case VLC_FOURCC('Y','U','Y','2'):
-        case VLC_FOURCC('U','Y','V','Y'):
-        case VLC_FOURCC('R','V','1','5'):
-        case VLC_FOURCC('R','V','1','6'):
-        case VLC_FOURCC('R','V','2','4'): /* Fixme: pixel pitch == 4 ? */
-        case VLC_FOURCC('R','V','3','2'):
+        case VLC_CODEC_I420:
+        case VLC_CODEC_YV12:
+        case VLC_CODEC_Y211:
+        case VLC_CODEC_YUYV:
+        case VLC_CODEC_UYVY:
+        case VLC_CODEC_RGB15:
+        case VLC_CODEC_RGB16:
+        case VLC_CODEC_RGB24: /* Fixme: pixel pitch == 4 ? */
+        case VLC_CODEC_RGB32:
 
             for( i_plane = 0; i_plane < p_pic->p_sys->p_image->num_planes;
                  i_plane++ )
@@ -1977,7 +1941,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
                 p_pic->p[i_plane].i_pitch =
                     p_pic->p_sys->p_image->pitches[i_plane];
             }
-            if( p_vout->output.i_chroma == VLC_FOURCC('Y','V','1','2') )
+            if( p_vout->output.i_chroma == VLC_CODEC_YV12 )
             {
                 /* U and V inverted compared to I420
                  * Fixme: this should be handled by the vout core */
@@ -1990,11 +1954,11 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
             break;
 
 #else
-        case VLC_FOURCC('R','G','B','2'):
-        case VLC_FOURCC('R','V','1','6'):
-        case VLC_FOURCC('R','V','1','5'):
-        case VLC_FOURCC('R','V','2','4'):
-        case VLC_FOURCC('R','V','3','2'):
+        case VLC_CODEC_RGB8:
+        case VLC_CODEC_RGB16:
+        case VLC_CODEC_RGB15:
+        case VLC_CODEC_RGB24:
+        case VLC_CODEC_RGB32:
 
             p_pic->p->i_lines = p_pic->p_sys->p_image->height;
             p_pic->p->i_visible_lines = p_pic->p_sys->p_image->height;
@@ -2003,7 +1967,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
             p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line;
 
             /* p_pic->p->i_pixel_pitch = 4 for RV24 but this should be set
-             * properly by vout_InitPicture() */
+             * properly by picture_Setup() */
             p_pic->p->i_visible_pitch = p_pic->p->i_pixel_pitch
                                          * p_pic->p_sys->p_image->width;
             break;
index 0c5a1234e77cecaa73570614874214463168f928..2196fb26438141e040ad596e0a060d7f3d70c2a2 100644 (file)
@@ -148,26 +148,26 @@ static int Open (vlc_object_t *obj)
         {
           case 24:
             if (fmt->bits_per_pixel == 32)
-                chroma = VLC_FOURCC ('R', 'V', '3', '2');
+                chroma = VLC_CODEC_RGB32;
             else if (fmt->bits_per_pixel == 24)
-                chroma = VLC_FOURCC ('R', 'V', '2', '4');
+                chroma = VLC_CODEC_RGB24;
             else
                 continue;
             break;
           case 16:
             if (fmt->bits_per_pixel != 16)
                 continue;
-            chroma = VLC_FOURCC ('R', 'V', '1', '6');
+            chroma = VLC_CODEC_RGB16;
             break;
           case 15:
             if (fmt->bits_per_pixel != 16)
                 continue;
-            chroma = VLC_FOURCC ('R', 'V', '1', '5');
+            chroma = VLC_CODEC_RGB15;
             break;
           case 8:
             if (fmt->bits_per_pixel != 8)
                 continue;
-            chroma = VLC_FOURCC ('R', 'G', 'B', '2');
+            chroma = VLC_CODEC_RGB8;
             break;
           default:
             continue;
@@ -202,7 +202,7 @@ static int Open (vlc_object_t *obj)
                 if (!gray)
                     continue; /* Prefer color over gray scale */
                 vid = vt->visual_id;
-                chroma = VLC_FOURCC ('G', 'R', 'E', 'Y');
+                chroma = VLC_CODEC_GREY;
             }
         }
 
@@ -346,9 +346,9 @@ static int Init (vout_thread_t *vout)
         if (pic->i_status != FREE_PICTURE)
             continue;
 
-        vout_InitPicture (vout, pic, vout->output.i_chroma,
-                          vout->output.i_width, vout->output.i_height,
-                          vout->output.i_aspect);
+        picture_Setup (pic, vout->output.i_chroma,
+                       vout->output.i_width, vout->output.i_height,
+                       vout->output.i_aspect);
         if (PictureAlloc (vout, pic, pic->p->i_pitch * pic->p->i_lines,
                           p_sys->shm ? p_sys->conn : NULL))
             break;
index 0e99035be87489a688470870155a94bf45a7c2c2..f460c4afad8f3cd2ebd0c42e30e3634ef417d269 100644 (file)
@@ -249,21 +249,21 @@ static vlc_fourcc_t ParseFormat (vout_thread_t *vout,
             {
               case 32:
                 if (f->depth == 24)
-                    return VLC_FOURCC ('R', 'V', '3', '2');
+                    return VLC_CODEC_RGB32;
                 break;
               case 24:
                 if (f->depth == 24)
-                    return VLC_FOURCC ('R', 'V', '2', '4');
+                    return VLC_CODEC_RGB24;
                 break;
               case 16:
                 if (f->depth == 16)
-                    return VLC_FOURCC ('R', 'V', '1', '6');
+                    return VLC_CODEC_RGB16;
                 if (f->depth == 15)
-                    return VLC_FOURCC ('R', 'V', '1', '5');
+                    return VLC_CODEC_RGB15;
                 break;
               case 8:
                 if (f->depth == 8)
-                    return VLC_FOURCC ('R', 'G', 'B', '2');
+                    return VLC_CODEC_RGB8;
                 break;
             }
             break;
@@ -288,15 +288,15 @@ static vlc_fourcc_t ParseFormat (vout_thread_t *vout,
             {
               /*untested: case 24:
                 if (f->vhorz_u_period == 1 && f->vvert_u_period == 1)
-                    return VLC_FOURCC ('I', '4', '4', '4');
+                    return VLC_CODEC_I444;
                 break;*/
               case 16:
                 if (f->vhorz_u_period == 2 && f->vvert_u_period == 1)
                 {
                     if (!strcmp ((const char *)f->vcomp_order, "YUYV"))
-                        return VLC_FOURCC ('Y', 'U', 'Y', '2');
+                        return VLC_CODEC_YUYV;
                     if (!strcmp ((const char *)f->vcomp_order, "UYVY"))
-                        return VLC_FOURCC ('U', 'Y', 'V', 'Y');
+                        return VLC_CODEC_UYVY;
                 }
                 break;
             }
@@ -308,9 +308,9 @@ static vlc_fourcc_t ParseFormat (vout_thread_t *vout,
                 if (f->vhorz_u_period == 2 && f->vvert_u_period == 2)
                 {
                     if (!strcmp ((const char *)f->vcomp_order, "YVU"))
-                        return VLC_FOURCC ('Y', 'V', '1', '2');
+                        return VLC_CODEC_YV12;
                     if (!strcmp ((const char *)f->vcomp_order, "YUV"))
-                        return VLC_FOURCC ('I', '4', '2', '0');
+                        return VLC_CODEC_I420;
                 }
             }
             break;
@@ -401,9 +401,9 @@ static int Init (vout_thread_t *vout)
         /* Video chroma in preference order */
         const vlc_fourcc_t chromas[] = {
             vout->fmt_in.i_chroma,
-            VLC_FOURCC ('Y', 'U', 'Y', '2'),
-            VLC_FOURCC ('R', 'V', '2', '4'),
-            VLC_FOURCC ('R', 'V', '1', '5'),
+            VLC_CODEC_YUYV,
+            VLC_CODEC_RGB24,
+            VLC_CODEC_RGB15,
         };
         for (size_t i = 0; i < sizeof (chromas) / sizeof (chromas[0]); i++)
         {
@@ -456,9 +456,9 @@ found_adaptor:
         if (pic->i_status != FREE_PICTURE)
             continue;
 
-        vout_InitPicture (vout, pic, vout->output.i_chroma,
-                          att->width, att->height,
-                          vout->fmt_in.i_aspect);
+        picture_Setup (pic, vout->output.i_chroma,
+                       att->width, att->height,
+                       vout->fmt_in.i_aspect);
         if (PictureAlloc (vout, pic, att->data_size,
                           p_sys->shm ? p_sys->conn : NULL))
             break;
index cd73fb8645b595e3db0945e9f215b3decb07fd34..35542ebfa99295816f8851c23fe5898eb9d1f81f 100644 (file)
@@ -121,7 +121,7 @@ static int Create( vlc_object_t *p_this )
     p_sys->p_fd = NULL;
 
     p_sys->b_yuv4mpeg2 = var_CreateGetBool( p_this, CFG_PREFIX "yuv4mpeg2" );
-    p_sys->i_chroma = VLC_FOURCC('I','4','2','0');
+    p_sys->i_chroma = VLC_CODEC_I420;
 
     p_sys->psz_file =
             var_CreateGetString( p_this, CFG_PREFIX "file" );
@@ -134,21 +134,19 @@ static int Create( vlc_object_t *p_this )
     }
 
     psz_fcc = var_CreateGetNonEmptyString( p_this, CFG_PREFIX "chroma" );
-    if( psz_fcc && (strlen( psz_fcc ) == 4) )
-    {
-        p_sys->i_chroma = VLC_FOURCC( psz_fcc[0], psz_fcc[1],
-                                      psz_fcc[2], psz_fcc[3] );
-    }
+    const vlc_fourcc_t i_requested_chroma =
+        vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_fcc );
+    if( i_requested_chroma )
+        p_sys->i_chroma = i_requested_chroma;
     free( psz_fcc );
 
     if( p_sys->b_yuv4mpeg2 )
     {
         switch( p_sys->i_chroma )
         {
-            case VLC_FOURCC('Y','V','1','2'):
-            case VLC_FOURCC('I','4','2','0'):
-            case VLC_FOURCC('I','Y','U','V'):
-            case VLC_FOURCC('J','4','2','0'):
+            case VLC_CODEC_YV12:
+            case VLC_CODEC_I420:
+            case VLC_CODEC_J420:
                 break;
             default:
                 msg_Err( p_this,
index 285ae50995c6af3acc9da9ebe776e751d0b90d05..5f7dfdae4e8ad6f635696be3ceefae97bd979208 100644 (file)
@@ -79,8 +79,8 @@ static int Open( vlc_object_t *p_this )
     aout_filter_sys_t *p_sys;
     galaktos_thread_t *p_thread;
 
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' )
-         || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if( p_filter->input.i_format != VLC_CODEC_FL32 ||
+        p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         msg_Warn( p_filter, "bad input or output format" );
         return VLC_EGENERIC;
@@ -210,9 +210,8 @@ static void* Thread( vlc_object_t *p_this )
     vlc_object_attach( p_thread->p_opengl, p_this );
 
     /* Initialize vout parameters */
-    vout_InitFormat( &p_thread->p_opengl->fmt_in,
-                     VLC_FOURCC('R','V','3','2'),
-                     p_thread->i_width, p_thread->i_height, 1 );
+    video_format_Setup( &p_thread->p_opengl->fmt_in,
+                        VLC_CODEC_RGB32, p_thread->i_width, p_thread->i_height, 1 );
     p_thread->p_opengl->i_window_width = p_thread->i_width;
     p_thread->p_opengl->i_window_height = p_thread->i_height;
     p_thread->p_opengl->render.i_width = p_thread->i_width;
index 0dce4b7a6f13a259360903b1880a46ce89725d05..08b1d6c0a65d2d5461a5cace957774b84fac1df4 100644 (file)
@@ -137,13 +137,13 @@ static int Open( vlc_object_t *p_this )
     video_format_t     fmt;
 
 
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' )
-         || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    if( p_filter->input.i_format != VLC_CODEC_FL32 ||
+         p_filter->output.i_format != VLC_CODEC_FL32 )
     {
         msg_Warn( p_filter, "bad input or output format" );
         return VLC_EGENERIC;
     }
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    if( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
     {
         msg_Warn( p_filter, "input and output formats are not similar" );
         return VLC_EGENERIC;
@@ -167,7 +167,7 @@ static int Open( vlc_object_t *p_this )
 
     fmt.i_width = fmt.i_visible_width = width;
     fmt.i_height = fmt.i_visible_height = height;
-    fmt.i_chroma = VLC_FOURCC('R','V','3','2');
+    fmt.i_chroma = VLC_CODEC_RGB32;
     fmt.i_aspect = VOUT_ASPECT_FACTOR * width/height;
     fmt.i_sar_num = fmt.i_sar_den = 1;
 
index 4702a98952887c0af7f62e4def63e3b448edde63..c26d3b2612ddf888e934c20181b24573f1769452 100644 (file)
@@ -193,8 +193,8 @@ static int Open( vlc_object_t *p_this )
     char *psz_effects, *psz_parser;
     video_format_t fmt;
 
-    if( ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2') &&
-          p_filter->input.i_format != VLC_FOURCC('f','i','3','2') ) )
+    if( ( p_filter->input.i_format != VLC_CODEC_FL32 &&
+          p_filter->input.i_format != VLC_CODEC_FI32 ) )
     {
         return VLC_EGENERIC;
     }
@@ -303,7 +303,7 @@ static int Open( vlc_object_t *p_this )
 
     fmt.i_width = fmt.i_visible_width = p_sys->i_width;
     fmt.i_height = fmt.i_visible_height = p_sys->i_height;
-    fmt.i_chroma = VLC_FOURCC('I','4','2','0');
+    fmt.i_chroma = VLC_CODEC_I420;
     fmt.i_aspect = VOUT_ASPECT_FACTOR * p_sys->i_width/p_sys->i_height;
     fmt.i_sar_num = fmt.i_sar_den = 1;
 
index 1451f43598ef32e8781e20821766e0a86657101c..0d63f57affb9367a69aead04ee9d627f3e844ed8 100644 (file)
@@ -725,16 +725,6 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
         if( FAILED(result) )
             return result;
 
-        /* set internal video width and height */
-        libvlc_video_set_size(p_libvlc,
-            lprcPosRect->right-lprcPosRect->left,
-            lprcPosRect->bottom-lprcPosRect->top,
-            NULL );
-
-        /* set internal video parent window */
-        libvlc_video_set_parent(p_libvlc,
-            reinterpret_cast<libvlc_drawable_t>(_inplacewnd), NULL);
-
         if( _b_autoplay && playlist_select(0,NULL) )
         {
             libvlc_media_player_play(_p_mplayer,NULL);
@@ -995,13 +985,6 @@ void VLCPlugin::onPositionChange(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
     SetWindowRgn(_inplacewnd, clipRgn, FALSE);
 
     //RedrawWindow(_videownd, &posRect, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN);
-    if( isRunning() )
-    {
-        libvlc_video_set_size(_p_libvlc,
-            lprcPosRect->right-lprcPosRect->left,
-            lprcPosRect->bottom-lprcPosRect->top,
-            NULL );
-    }
 };
 
 void VLCPlugin::freezeEvents(BOOL freeze)
@@ -1103,5 +1086,3 @@ int  VLCPlugin::playlist_add_extended_untrusted(const char *mrl, int optc, const
 
     return item;
 }
-
-
index f428187e21857ca5d1801a9cfe1e95f0236b9181..850fcbe79a9c157e8333318b53a814ada599beff 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2002-2009 the VideoLAN team
  *
  * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
- *          Jan Paul Dinger <jpd@m2x.nl>
+ *          JP Dinger <jpd@m2x.nl>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -130,17 +130,7 @@ LibvlcRootNPObject::getProperty(int index, NPVariant &result)
                 OBJECT_TO_NPVARIANT(NPN_RetainObject(videoObj), result);
                 return INVOKERESULT_NO_ERROR;
             case ID_root_VersionInfo:
-            {
-                const char *s = libvlc_get_version();
-                int len = strlen(s);
-                NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);
-                if( !retval )
-                    return INVOKERESULT_OUT_OF_MEMORY;
-
-                memcpy(retval, s, len);
-                STRINGN_TO_NPVARIANT(retval, len, result);
-                return INVOKERESULT_NO_ERROR;
-            }
+                return invokeResultString(libvlc_get_version(),result);
             default:
                 ;
         }
@@ -171,18 +161,9 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index,
         switch( index )
         {
             case ID_root_versionInfo:
-                if( argCount == 0 )
-                {
-                    const char *s = libvlc_get_version();
-                    int len = strlen(s);
-                    NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);
-                    if( !retval )
-                        return INVOKERESULT_OUT_OF_MEMORY;
-                    memcpy(retval, s, len);
-                    STRINGN_TO_NPVARIANT(retval, len, result);
-                    return INVOKERESULT_NO_ERROR;
-                }
-                return INVOKERESULT_NO_SUCH_METHOD;
+                if( 0 != argCount )
+                    return INVOKERESULT_NO_SUCH_METHOD;
+                return invokeResultString(libvlc_get_version(),result);
             default:
                 ;
         }
@@ -640,10 +621,9 @@ LibvlcPlaylistItemsNPObject::invoke(int index, const NPVariant *args,
 
 LibvlcPlaylistNPObject::~LibvlcPlaylistNPObject()
 {
-    if( isValid() )
-    {
-        if( playlistItemsObj ) NPN_ReleaseObject(playlistItemsObj);
-    }
+    // Why the isValid()?
+    if( isValid() && playlistItemsObj )
+        NPN_ReleaseObject(playlistItemsObj);
 };
 
 const NPUTF8 * const LibvlcPlaylistNPObject::propertyNames[] =
@@ -821,8 +801,8 @@ LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
                     }
                 }
 
-                int item = p_plugin->playlist_add_extended_untrusted(url, name, i_options,
-                               const_cast<const char **>(ppsz_options), &ex);
+                int item = p_plugin->playlist_add_extended_untrusted(url, name,
+                      i_options, const_cast<const char **>(ppsz_options), &ex);
                 free(url);
                 free(name);
                 for( int i=0; i< i_options; ++i )
index db9e9a56a39dd33ecfec54023b89abb8f0fa29b0..b237fbd18497b61856a3e7b384608bfae5ce6629 100644 (file)
@@ -110,3 +110,24 @@ bool RuntimeNPObject::returnInvokeResult(RuntimeNPObject::InvokeResult result)
     }
     return false;
 }
+
+RuntimeNPObject::InvokeResult
+RuntimeNPObject::invokeResultString(const char *psz, NPVariant &result)
+{
+    if( !psz )
+        NULL_TO_NPVARIANT(result);
+    else
+    {
+        size_t len = strlen(psz);
+        NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
+        if( !retval )
+            return INVOKERESULT_OUT_OF_MEMORY;
+        else
+        {
+            memcpy(retval, psz, len);
+            STRINGN_TO_NPVARIANT(retval, len, result);
+        }
+    }
+    return INVOKERESULT_NO_ERROR;
+}
+
index ad3c400c37b5985b29b5d937734b0f216e1591f3..1fc8d1cd343e71436d3429134ab5e4873ebe2080 100644 (file)
@@ -127,6 +127,8 @@ protected:
 
     bool returnInvokeResult(InvokeResult result);
 
+    static InvokeResult invokeResultString(const char *,NPVariant &);
+
     bool isPluginRunning()
     {
         return _instance->pdata;
index b9085f3d586892fb00e032f07c2ad5a1c4b2079c..e73ffecdd6c1a48be0350d166161dda7977b4208 100644 (file)
@@ -598,6 +598,7 @@ function onPlay()
 function onEnd()\r
 {\r
     document.getElementById("state").innerHTML = "End...";\r
+    doStop();\r
 }\r
 \r
 var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "((  Live  ))");\r
index 8f3ebe5e1cdbb4128eb7b85339a61dacc2ceb48b..552d6fdad43fb9a780a511f1e6f5e19b90094110 100644 (file)
@@ -135,7 +135,7 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
     /* parse plugin arguments */
     for( int i = 0; i < argc ; i++ )
     {
-        fprintf(stderr, "argn=%s, argv=%s\n", argn[i], argv[i]);
+       /* fprintf(stderr, "argn=%s, argv=%s\n", argn[i], argv[i]); */
 
         if( !strcmp( argn[i], "target" )
          || !strcmp( argn[i], "mrl")
@@ -186,7 +186,7 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
         }
         else if( !strcmp( argn[i], "toolbar" ) )
         {
-/* FIXME: Remove this when toolbar functionality has been implemented on\
+/* FIXME: Remove this when toolbar functionality has been implemented on
  * MacOS X and Win32 for Firefox/Mozilla/Safari. */
 #ifdef XP_UNIX
             b_toolbar = boolValue(argv[i]);
@@ -198,7 +198,6 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
     libvlc_exception_init(&ex);
 
     libvlc_instance = libvlc_new(ppsz_argc, ppsz_argv, &ex);
-
     if( libvlc_exception_raised(&ex) )
     {
         libvlc_exception_clear(&ex);
@@ -474,7 +473,7 @@ relativeurl:
             if( href )
             {
                 /* prepend base URL */
-                strcpy(href, psz_baseURL);
+                memcpy(href, psz_baseURL, baseLen+1);
 
                 /*
                 ** relative url could be empty,
@@ -489,7 +488,7 @@ relativeurl:
 
                 /* skip over protocol part  */
                 char *pathstart = strchr(href, ':');
-                char *pathend;
+                char *pathend = href+baseLen;
                 if( pathstart )
                 {
                     if( '/' == *(++pathstart) )
@@ -501,7 +500,6 @@ relativeurl:
                     }
                     /* skip over host part */
                     pathstart = strchr(pathstart, '/');
-                    pathend = href+baseLen;
                     if( ! pathstart )
                     {
                         // no path, add a / past end of url (over '\0')
@@ -519,7 +517,6 @@ relativeurl:
                         return NULL;
                     }
                     pathstart = href;
-                    pathend = href+baseLen;
                 }
 
                 /* relative URL made of an absolute path ? */
index b59c42d1651d92c5f7105510ccd1aab0a60740e6..e0b937bf239041d01dcc0788ec4ac07626ccbb54 100644 (file)
@@ -167,8 +167,7 @@ int16 NPP_HandleEvent( NPP instance, void * event )
         return false;
     }
 
-    VlcPlugin *p_plugin = (VlcPlugin*)instance->pdata;
-
+    VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
     if( p_plugin == NULL )
     {
         return false;
@@ -388,14 +387,6 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
     {
         /* check if plugin has a new parent window */
         CGrafPtr drawable = (((NP_Port*) (window->window))->port);
-        if( !curwin.window || drawable != (((NP_Port*) (curwin.window))->port) )
-        {
-            /* set/change parent window */
-            libvlc_video_set_parent(p_vlc, (libvlc_drawable_t)drawable, &ex);
-            if( libvlc_exception_raised(&ex) )
-                fprintf( stderr, "Exception: %s\n", libvlc_exception_get_message(&ex) );
-            libvlc_exception_clear(&ex);
-        }
 
         /* as MacOS X video output is windowless, set viewport */
         libvlc_rectangle_t view, clip;
@@ -417,8 +408,6 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
         clip.right   = window->clipRect.right;
 
         libvlc_video_set_viewport(p_vlc, p_plugin->getMD(&ex), &view, &clip, &ex);
-        if( libvlc_exception_raised(&ex) )
-            fprintf( stderr, "Exception: %s\n", libvlc_exception_get_message(&ex) );
         libvlc_exception_clear(&ex);
 
         /* remember new window */
@@ -427,11 +416,6 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
     else if( curwin.window )
     {
         /* change/set parent */
-        libvlc_video_set_parent(p_vlc, 0, &ex);
-        if( libvlc_exception_raised(&ex) )
-            fprintf( stderr, "Exception: %s\n", libvlc_exception_get_message(&ex) );
-        libvlc_exception_clear(&ex);
-
         curwin.window = NULL;
     }
 #endif /* XP_MACOSX */
@@ -464,12 +448,6 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
             style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
             SetWindowLong((HWND)drawable, GWL_STYLE, style);
 
-            /* change/set parent */
-            libvlc_video_set_parent(p_vlc, (libvlc_drawable_t)drawable, &ex);
-            if( libvlc_exception_raised(&ex) )
-                fprintf( stderr, "Exception: %s\n", libvlc_exception_get_message(&ex) );
-            libvlc_exception_clear(&ex);
-
             /* remember new window */
             p_plugin->setWindow(*window);
 
@@ -485,12 +463,6 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
         SetWindowLong( oldwin, GWL_WNDPROC, (LONG)(p_plugin->getWindowProc()) );
         p_plugin->setWindowProc(NULL);
 
-        /* change/set parent */
-        libvlc_video_set_parent(p_vlc, 0, &ex);
-        if( libvlc_exception_raised(&ex) )
-            fprintf( stderr, "Exception: %s\n", libvlc_exception_get_message(&ex) );
-        libvlc_exception_clear(&ex);
-
         curwin.window = NULL;
     }
 #endif /* XP_WIN */
@@ -540,12 +512,6 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
             XtAddEventHandler( w, ButtonReleaseMask, FALSE,
                                (XtEventHandler)ControlHandler, p_plugin );
 
-            /* set/change parent window */
-            libvlc_video_set_parent( p_vlc, (libvlc_drawable_t) video, &ex );
-            if( libvlc_exception_raised(&ex) )
-                fprintf( stderr, "Exception: %s\n", libvlc_exception_get_message(&ex) );
-            libvlc_exception_clear(&ex);
-
             /* remember window */
             p_plugin->setWindow( *window );
             p_plugin->setVideoWindow( video );
@@ -566,11 +532,6 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
     }
     else if( curwin.window )
     {
-        /* change/set parent */
-        libvlc_video_set_parent(p_vlc, 0, &ex);
-        if( libvlc_exception_raised(&ex) )
-            fprintf( stderr, "Exception: %s\n", libvlc_exception_get_message(&ex) );
-        libvlc_exception_clear(&ex);
         curwin.window = NULL;
     }
 #endif /* XP_UNIX */
@@ -838,13 +799,9 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
 
         libvlc_exception_init( &ex );
         libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
-        if( libvlc_exception_raised(&ex) )
-            fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
         libvlc_exception_clear( &ex );
 
         i_playing = p_plugin->playlist_isplaying( &ex );
-        if( libvlc_exception_raised(&ex) )
-            fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
         libvlc_exception_clear( &ex );
 
         vlc_toolbar_clicked_t clicked;
@@ -859,8 +816,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
                 else
                     p_plugin->playlist_play( &ex );
 
-                if( libvlc_exception_raised(&ex) )
-                    fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
                 libvlc_exception_clear( &ex );
             }
             break;
@@ -868,8 +823,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
             case clicked_Stop:
             {
                 p_plugin->playlist_stop(&ex);
-                if( libvlc_exception_raised(&ex) )
-                    fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
                 libvlc_exception_clear( &ex );
             }
             break;
@@ -877,8 +830,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
             case clicked_Fullscreen:
             {
                 p_plugin->set_fullscreen( 1, &ex );
-                if( libvlc_exception_raised(&ex) )
-                    fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
                 libvlc_exception_clear( &ex );
             }
             break;
@@ -887,8 +838,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
             case clicked_Unmute:
             {
                 libvlc_audio_toggle_mute( p_plugin->getVLC(), &ex );
-                if( libvlc_exception_raised(&ex) )
-                    fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
                 libvlc_exception_clear( &ex );
             }
             break;
@@ -906,8 +855,6 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
                             ( ((float)i_xPos-4.0 ) / ( ((float)i_width-8.0)/100) );
 
                     libvlc_media_player_set_time( p_md, f_length, &ex );
-                    if( libvlc_exception_raised(&ex) )
-                        fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
                     libvlc_exception_clear( &ex );
                 }
             }
index 059b4d43541d513b659544cdd713eded09722b3c..23daa48e7c73b6ca34f3ed7241e3ad6d8b276162 100644 (file)
@@ -58,6 +58,7 @@ pluginsinclude_HEADERS = \
        ../include/vlc_es_out.h \
        ../include/vlc_events.h \
        ../include/vlc_filter.h \
+       ../include/vlc_fourcc.h \
        ../include/vlc_gcrypt.h \
        ../include/vlc_httpd.h \
        ../include/vlc_image.h \
@@ -70,6 +71,7 @@ pluginsinclude_HEADERS = \
        ../include/vlc_modules.h \
        ../include/vlc_mtime.h \
        ../include/vlc_objects.h \
+       ../include/vlc_picture.h \
        ../include/vlc_playlist.h \
        ../include/vlc_plugin.h \
        ../include/vlc_rand.h \
@@ -77,6 +79,7 @@ pluginsinclude_HEADERS = \
        ../include/vlc_sout.h \
        ../include/vlc_stream.h \
        ../include/vlc_strings.h \
+       ../include/vlc_subpicture.h \
        ../include/vlc_threads.h \
        ../include/vlc_url.h \
        ../include/vlc_variables.h \
@@ -159,7 +162,7 @@ libvlccore_la_CFLAGS = `$(VLC_CONFIG) --cflags libvlccore` \
 libvlccore_la_LDFLAGS = `$(VLC_CONFIG) --ldflags libvlccore` $(AM_LDFLAGS) \
        -no-undefined \
        -export-symbols $(srcdir)/libvlccore.sym \
-       -version-info 2:0:0
+       -version-info 3:0:0
 libvlccore_la_LIBADD = `$(VLC_CONFIG) -libs libvlccore` $(AM_LIBADD) \
        $(LTLIBINTL) ../compat/libcompat.la
 libvlccore_la_DEPENDENCIES = libvlccore.sym
@@ -176,7 +179,7 @@ libvlc_la_LIBADD = `$(VLC_CONFIG) -libs libvlc` \
        libvlccore.la ../compat/libcompat.la
 libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags libvlc`
 libvlc_la_LDFLAGS = $(AM_LDFLAGS) `$(VLC_CONFIG) --ldflags libvlc` \
-       -version-info 4:0:2 \
+       -version-info 5:0:0 \
        -export-symbols $(srcdir)/libvlc.sym
 libvlc_la_DEPENDENCIES = libvlc.sym libvlccore.la
 if HAVE_WIN32
@@ -235,22 +238,28 @@ endif
 endif
 
 SOURCES_libvlc_beos = \
+       misc/pthread.c \
        $(NULL)
 
 SOURCES_libvlc_darwin = \
+       misc/pthread.c \
        misc/darwin_specific.c \
        $(NULL)
 
 SOURCES_libvlc_linux = \
+       misc/pthread.c \
        misc/linux_specific.c \
        $(NULL)
 
 SOURCES_libvlc_win32 = \
+       misc/w32thread.c \
        misc/win32_specific.c \
        network/winsock.c \
        $(NULL)
 
-SOURCES_libvlc_other = misc/not_specific.c
+SOURCES_libvlc_other = \
+       misc/pthread.c \
+       misc/not_specific.c
 
 SOURCES_libvlc_dirent = \
        extras/dirent.c \
@@ -359,6 +368,7 @@ SOURCES_libvlc_common = \
        misc/rand.c \
        misc/mtime.c \
        misc/block.c \
+       misc/fourcc.c \
        misc/es_format.c \
        modules/modules.h \
        modules/modules.c \
index 806cb998357999e1929d3e2f2ad9909c00caa980..fde38b3ab78a159d08996192c18102ea87767fa8 100644 (file)
@@ -144,29 +144,29 @@ unsigned int aout_BitsPerSample( vlc_fourcc_t i_format )
 {
     switch( i_format )
     {
-    case VLC_FOURCC('u','8',' ',' '):
-    case VLC_FOURCC('s','8',' ',' '):
+    case VLC_CODEC_U8:
+    case VLC_CODEC_S8:
         return 8;
 
-    case VLC_FOURCC('u','1','6','l'):
-    case VLC_FOURCC('s','1','6','l'):
-    case VLC_FOURCC('u','1','6','b'):
-    case VLC_FOURCC('s','1','6','b'):
+    case VLC_CODEC_U16L:
+    case VLC_CODEC_S16L:
+    case VLC_CODEC_U16B:
+    case VLC_CODEC_S16B:
         return 16;
 
-    case VLC_FOURCC('u','2','4','l'):
-    case VLC_FOURCC('s','2','4','l'):
-    case VLC_FOURCC('u','2','4','b'):
-    case VLC_FOURCC('s','2','4','b'):
+    case VLC_CODEC_U24L:
+    case VLC_CODEC_S24L:
+    case VLC_CODEC_U24B:
+    case VLC_CODEC_S24B:
         return 24;
 
-    case VLC_FOURCC('s','3','2','l'):
-    case VLC_FOURCC('s','3','2','b'):
-    case VLC_FOURCC('f','l','3','2'):
-    case VLC_FOURCC('f','i','3','2'):
+    case VLC_CODEC_S32L:
+    case VLC_CODEC_S32B:
+    case VLC_CODEC_FL32:
+    case VLC_CODEC_FI32:
         return 32;
 
-    case VLC_FOURCC('f','l','6','4'):
+    case VLC_CODEC_FL64:
         return 64;
 
     default:
index 0b0ebfa5071636bb13377e61d7746d10c12ec049..8271868079a6d1cbaff60fb606384b35b512c9c0 100644 (file)
@@ -177,8 +177,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
         /* Non-S/PDIF mixer only deals with float32 or fixed32. */
         p_aout->mixer.mixer.i_format
                      = (vlc_CPU() & CPU_CAPABILITY_FPU) ?
-                        VLC_FOURCC('f','l','3','2') :
-                        VLC_FOURCC('f','i','3','2');
+                        VLC_CODEC_FL32 : VLC_CODEC_FI32;
         aout_FormatPrepare( &p_aout->mixer.mixer );
     }
     else
index 6c411f23ed9308c07c889b69aac826845a45c6b9..9d12a97254d7c37f5be83a325de320e477436cb3 100644 (file)
@@ -744,11 +744,11 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
 int ConfigStringToKey( const char *psz_key )
 {
     int i_key = 0;
-    unsigned int i;
+    size_t i;
     const char *psz_parser = strchr( psz_key, '-' );
     while( psz_parser && psz_parser != psz_key )
     {
-        for( i = 0; i < sizeof(vlc_modifiers) / sizeof(key_descriptor_t); i++ )
+        for( i = 0; i < vlc_num_modifiers; ++i )
         {
             if( !strncasecmp( vlc_modifiers[i].psz_key_string, psz_key,
                               strlen( vlc_modifiers[i].psz_key_string ) ) )
@@ -759,7 +759,7 @@ int ConfigStringToKey( const char *psz_key )
         psz_key = psz_parser + 1;
         psz_parser = strchr( psz_key, '-' );
     }
-    for( i = 0; i < sizeof(vlc_keys) / sizeof( key_descriptor_t ); i++ )
+    for( i = 0; i < vlc_num_keys; ++i )
     {
         if( !strcasecmp( vlc_keys[i].psz_key_string, psz_key ) )
         {
@@ -772,7 +772,10 @@ int ConfigStringToKey( const char *psz_key )
 
 char *ConfigKeyToString( int i_key )
 {
-    char *psz_key = malloc( 100 );
+    // Worst case appears to be 45 characters:
+    // "Command-Meta-Ctrl-Shift-Alt-Browser Favorites"
+    enum { keylen=64 };
+    char *psz_key = malloc( keylen );
     char *p;
     size_t index;
 
@@ -783,20 +786,20 @@ char *ConfigKeyToString( int i_key )
     *psz_key = '\0';
     p = psz_key;
 
-    for( index = 0; index < (sizeof(vlc_modifiers) / sizeof(key_descriptor_t));
-         index++ )
+    for( index = 0; index < vlc_num_modifiers; ++index )
     {
         if( i_key & vlc_modifiers[index].i_key_code )
         {
-            p += sprintf( p, "%s-", vlc_modifiers[index].psz_key_string );
+            p += snprintf( p, keylen-(psz_key-p), "%s-",
+                           vlc_modifiers[index].psz_key_string );
         }
     }
-    for( index = 0; index < (sizeof(vlc_keys) / sizeof( key_descriptor_t));
-         index++)
+    for( index = 0; index < vlc_num_keys; ++index )
     {
         if( (int)( i_key & ~KEY_MODIFIER ) == vlc_keys[index].i_key_code )
         {
-            p += sprintf( p, "%s", vlc_keys[index].psz_key_string );
+            p += snprintf( p, keylen-(psz_key-p), "%s",
+                           vlc_keys[index].psz_key_string );
             break;
         }
     }
index d7f0b41facbe27bba69cf38d89846a2d5844f216..69d8b265f3bae0e4632cb3f37d5e6559bb91f32f 100644 (file)
@@ -93,8 +93,8 @@ void libvlc_event_manager_release( libvlc_event_manager_t * p_em )
     libvlc_event_listeners_group_t * p_lg;
     int i,j ;
 
-    vlc_mutex_destroy( &p_em->event_sending_lock );
-    vlc_mutex_destroy( &p_em->object_lock );
+    vlc_mutex_lock( &p_em->event_sending_lock );
+    vlc_mutex_lock( &p_em->object_lock );
 
     for( i = 0; i < vlc_array_count(&p_em->listeners_groups); i++)
     {
@@ -107,7 +107,15 @@ void libvlc_event_manager_release( libvlc_event_manager_t * p_em )
         free( p_lg );
     }
     vlc_array_clear( &p_em->listeners_groups );
+
+    vlc_mutex_unlock( &p_em->object_lock );
+    vlc_mutex_unlock( &p_em->event_sending_lock );
+
     libvlc_release( p_em->p_libvlc_instance );
+
+    vlc_mutex_destroy( &p_em->event_sending_lock );
+    vlc_mutex_destroy( &p_em->object_lock );
+
     free( p_em );
 }
 
@@ -122,9 +130,14 @@ void libvlc_event_manager_register_event_type(
         libvlc_exception_t * p_e )
 {
     libvlc_event_listeners_group_t * listeners_group;
+
+    vlc_mutex_lock( &p_em->object_lock );
+
     listeners_group = malloc(sizeof(libvlc_event_listeners_group_t));
     if( !listeners_group )
     {
+        vlc_mutex_unlock( &p_em->object_lock );
+
         libvlc_exception_raise( p_e, "No Memory left" );
         return;
     }
@@ -132,7 +145,6 @@ void libvlc_event_manager_register_event_type(
     listeners_group->event_type = event_type;
     vlc_array_init( &listeners_group->listeners );
 
-    vlc_mutex_lock( &p_em->object_lock );
     vlc_array_append( &p_em->listeners_groups, listeners_group );
     vlc_mutex_unlock( &p_em->object_lock );
 }
@@ -171,6 +183,7 @@ void libvlc_event_send( libvlc_event_manager_t * p_em,
             if( !array_listeners_cached )
             {
                 fprintf(stderr, "Can't alloc memory in libvlc_event_send" );
+                vlc_mutex_unlock( &p_em->object_lock );
                 return;
             }
 
@@ -187,6 +200,7 @@ void libvlc_event_send( libvlc_event_manager_t * p_em,
 
     if( !listeners_group )
     {
+        vlc_mutex_unlock( &p_em->object_lock );
         free( array_listeners_cached );
         return;
     }
@@ -215,9 +229,10 @@ void libvlc_event_send( libvlc_event_manager_t * p_em,
         listener_cached->pf_callback( p_event, listener_cached->p_user_data );
         listener_cached++;
     }
-    vlc_mutex_unlock( &p_em->event_sending_lock );
 
     free( array_listeners_cached );
+
+    vlc_mutex_unlock( &p_em->event_sending_lock );
 }
 
 /*
@@ -299,9 +314,13 @@ void libvlc_event_attach( libvlc_event_manager_t * p_event_manager,
     libvlc_event_listener_t * listener;
     int i;
 
+    vlc_mutex_lock( &p_event_manager->object_lock );
+
     listener = malloc(sizeof(libvlc_event_listener_t));
     if( !listener )
     {
+        vlc_mutex_unlock( &p_event_manager->object_lock );
+
         libvlc_exception_raise( p_e, "No Memory left" );
         return;
     }
@@ -310,7 +329,6 @@ void libvlc_event_attach( libvlc_event_manager_t * p_event_manager,
     listener->p_user_data = p_user_data;
     listener->pf_callback = pf_callback;
 
-    vlc_mutex_lock( &p_event_manager->object_lock );
     for( i = 0; i < vlc_array_count(&p_event_manager->listeners_groups); i++ )
     {
         listeners_group = vlc_array_item_at_index(&p_event_manager->listeners_groups, i);
@@ -321,9 +339,11 @@ void libvlc_event_attach( libvlc_event_manager_t * p_event_manager,
             return;
         }
     }
-    vlc_mutex_unlock( &p_event_manager->object_lock );
 
     free(listener);
+
+    vlc_mutex_unlock( &p_event_manager->object_lock );
+
     libvlc_exception_raise( p_e,
             "This object event manager doesn't know about '%s' events",
             libvlc_event_type_name(event_type));
@@ -344,8 +364,8 @@ void libvlc_event_detach( libvlc_event_manager_t *p_event_manager,
     libvlc_event_listener_t * listener;
     int i, j;
 
-    vlc_mutex_lock( &p_event_manager->event_sending_lock );
     vlc_mutex_lock( &p_event_manager->object_lock );
+
     for( i = 0; i < vlc_array_count(&p_event_manager->listeners_groups); i++)
     {
         listeners_group = vlc_array_item_at_index(&p_event_manager->listeners_groups, i);
@@ -367,14 +387,13 @@ void libvlc_event_detach( libvlc_event_manager_t *p_event_manager,
                     free( listener );
                     vlc_array_remove( &listeners_group->listeners, j );
                     vlc_mutex_unlock( &p_event_manager->object_lock );
-                    vlc_mutex_unlock( &p_event_manager->event_sending_lock );
                     return;
                 }
             }
         }
     }
+
     vlc_mutex_unlock( &p_event_manager->object_lock );
-    vlc_mutex_unlock( &p_event_manager->event_sending_lock );
 
     libvlc_exception_raise( p_e,
             "This object event manager doesn't know about '%s,%p,%p' event observer",
index 67e8c284469e4b7a171784a114f120e29afdc69f..2079d504025e723c0f1f13c9358d679cc68e00dd 100644 (file)
@@ -161,8 +161,6 @@ struct libvlc_media_player_t
         uint32_t xid;
         uint32_t agl;
     } drawable;
-
-    bool        b_own_its_input_thread;
 };
 
 struct libvlc_media_list_player_t
@@ -265,15 +263,6 @@ input_thread_t *libvlc_get_input_thread(
      libvlc_media_player_t *,
     libvlc_exception_t * );
 
-/* Media instance */
-libvlc_media_player_t *
-libvlc_media_player_new_from_input_thread( libvlc_instance_t *,
-                                           input_thread_t *,
-                                           libvlc_exception_t * );
-
-void libvlc_media_player_destroy(
-        libvlc_media_player_t * );
-
 /* Media Descriptor */
 libvlc_media_t * libvlc_media_new_from_input_item(
         libvlc_instance_t *, input_item_t *,
index c3e698d06ded674e221f8b48eebf74f10c36b8e8..00216dad432d8e822814ba7f43ecc44214d20830 100644 (file)
@@ -47,9 +47,9 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_with_root_index( i
 }
 
 /**************************************************************************
- *       path_deepness (Media List Player Internal)
+ *       path_depth (Media List Player Internal)
  **************************************************************************/
-static inline int libvlc_media_list_path_deepness( libvlc_media_list_path_t path )
+static inline int libvlc_media_list_path_depth( libvlc_media_list_path_t path )
 {
     int i;
     for( i = 0; path[i] != -1; i++ );
@@ -61,10 +61,10 @@ static inline int libvlc_media_list_path_deepness( libvlc_media_list_path_t path
  **************************************************************************/
 static inline void libvlc_media_list_path_append( libvlc_media_list_path_t * p_path, int index )
 {
-    int old_deepness = libvlc_media_list_path_deepness( *p_path );
-    *p_path = realloc( *p_path, sizeof(int)*(old_deepness+2));
-    *p_path[old_deepness] = index;
-    *p_path[old_deepness+1] = -1;
+    int old_depth = libvlc_media_list_path_depth( *p_path );
+    *p_path = realloc( *p_path, sizeof(int)*(old_depth+2));
+    *p_path[old_depth] = index;
+    *p_path[old_depth+1] = -1;
 }
 
 /**************************************************************************
@@ -73,11 +73,11 @@ static inline void libvlc_media_list_path_append( libvlc_media_list_path_t * p_p
 static inline libvlc_media_list_path_t libvlc_media_list_path_copy_by_appending( libvlc_media_list_path_t path, int index )
 {
     libvlc_media_list_path_t ret;
-    int old_deepness = libvlc_media_list_path_deepness( path );
-    ret = malloc( sizeof(int)*(old_deepness+2) );
-    memcpy( ret, path, sizeof(int)*(old_deepness+2) );
-    ret[old_deepness] = index;
-    ret[old_deepness+1] = -1;
+    int old_depth = libvlc_media_list_path_depth( path );
+    ret = malloc( sizeof(int)*(old_depth+2) );
+    memcpy( ret, path, sizeof(int)*(old_depth+2) );
+    ret[old_depth] = index;
+    ret[old_depth+1] = -1;
     return ret;
 }
 
@@ -87,9 +87,9 @@ static inline libvlc_media_list_path_t libvlc_media_list_path_copy_by_appending(
 static inline libvlc_media_list_path_t libvlc_media_list_path_copy( libvlc_media_list_path_t path )
 {
     libvlc_media_list_path_t ret;
-    int deepness = libvlc_media_list_path_deepness( path );
-    ret = malloc( sizeof(int)*(deepness+1) );
-    memcpy( ret, path, sizeof(int)*(deepness+1) );
+    int depth = libvlc_media_list_path_depth( path );
+    ret = malloc( sizeof(int)*(depth+1) );
+    memcpy( ret, path, sizeof(int)*(depth+1) );
     return ret;
 }
 
index 0f704bd26998f44a08345abecb84aeffccc056b1..d5865d99c2e6ceb833f1f9938ebdaf2e01baa360 100644 (file)
@@ -64,23 +64,23 @@ get_next_path( libvlc_media_list_player_t * p_mlp )
                             p_mlp->p_mlist,
                             p_mlp->current_playing_item_path );
 
-    int deepness = libvlc_media_list_path_deepness( p_mlp->current_playing_item_path );
-    if( deepness < 1 || !p_parent_of_playing_item )
+    int depth = libvlc_media_list_path_depth( p_mlp->current_playing_item_path );
+    if( depth < 1 || !p_parent_of_playing_item )
         return NULL;
 
     ret = libvlc_media_list_path_copy( p_mlp->current_playing_item_path );
 
-    while( ret[deepness-1] >= libvlc_media_list_count( p_parent_of_playing_item, NULL ) )
+    while( ret[depth-1] >= libvlc_media_list_count( p_parent_of_playing_item, NULL ) )
     {
-        deepness--;
-        if( deepness <= 0 )
+        depth--;
+        if( depth <= 0 )
         {
             free( ret );
             libvlc_media_list_release( p_parent_of_playing_item );
             return NULL;
         }
-        ret[deepness] = -1;
-        ret[deepness-1]++;
+        ret[depth] = -1;
+        ret[depth-1]++;
         p_parent_of_playing_item  = libvlc_media_list_parentlist_at_path(
                                         p_mlp->p_mlist,
                                         ret );
@@ -282,7 +282,31 @@ libvlc_media_list_player_new( libvlc_instance_t * p_instance,
  **************************************************************************/
 void libvlc_media_list_player_release( libvlc_media_list_player_t * p_mlp )
 {
-    free(p_mlp);
+    if( !p_mlp )
+        return;
+
+    vlc_mutex_lock( &p_mlp->object_lock );
+
+    p_mlp->i_refcount--;
+    if( p_mlp->i_refcount > 0 )
+    {
+        vlc_mutex_unlock( &p_mlp->object_lock );
+        return;
+    }
+    vlc_mutex_unlock( &p_mlp->object_lock );
+    vlc_mutex_destroy( &p_mlp->object_lock );
+
+    libvlc_event_manager_release( p_mlp->p_event_manager );
+    libvlc_media_player_release( p_mlp->p_mi );
+
+    if( p_mlp->p_mlist )
+    {
+        uninstall_playlist_observer( p_mlp );
+        libvlc_media_list_release( p_mlp->p_mlist );
+    }
+
+    free( p_mlp->current_playing_item_path );
+    free( p_mlp );
 }
 
 /**************************************************************************
index fe80925d68e084b445578c7f75409183766cc905..389fce92aa460cadf8721adfb7b65947e50e8582 100644 (file)
@@ -78,24 +78,20 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor
 
     p_input_thread = p_mi->p_input_thread;
 
-    /* No one is tracking this input_thread apart from us. Destroy it. */
-    if( p_mi->b_own_its_input_thread )
-    {
-        var_DelCallback( p_input_thread, "can-seek",
-                         input_seekable_changed, p_mi );
-        var_DelCallback( p_input_thread, "can-pause",
-                         input_pausable_changed, p_mi );
-        var_DelCallback( p_input_thread, "intf-event",
-                         input_event_changed, p_mi );
-
-        /* We owned this one */
-        input_Stop( p_input_thread, b_input_abort );
-        vlc_thread_join( p_input_thread );
-
-        var_Destroy( p_input_thread, "drawable-hwnd" );
-        var_Destroy( p_input_thread, "drawable-xid" );
-        var_Destroy( p_input_thread, "drawable-agl" );
-    }
+    var_DelCallback( p_input_thread, "can-seek",
+                     input_seekable_changed, p_mi );
+    var_DelCallback( p_input_thread, "can-pause",
+                    input_pausable_changed, p_mi );
+    var_DelCallback( p_input_thread, "intf-event",
+                     input_event_changed, p_mi );
+
+    /* We owned this one */
+    input_Stop( p_input_thread, b_input_abort );
+    vlc_thread_join( p_input_thread );
+
+    var_Destroy( p_input_thread, "drawable-hwnd" );
+    var_Destroy( p_input_thread, "drawable-xid" );
+    var_Destroy( p_input_thread, "drawable-agl" );
 
     vlc_object_release( p_input_thread );
 
@@ -219,7 +215,7 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
         libvlc_media_set_state( p_mi->p_md, libvlc_state, NULL );
         libvlc_event_send( p_mi->p_event_manager, &event );
     }
-    else if( newval.i_int == INPUT_EVENT_TIMES )
+    else if( newval.i_int == INPUT_EVENT_POSITION )
     {
         if( var_GetInteger( p_input, "state" ) != PLAYING_S )
             return VLC_SUCCESS; /* Don't send the position while stopped */
@@ -236,11 +232,20 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
                                                var_GetTime( p_input, "time" );
         libvlc_event_send( p_mi->p_event_manager, &event );
     }
+    else if( newval.i_int == INPUT_EVENT_LENGTH )
+    {
+        event.type = libvlc_MediaPlayerLengthChanged;
+        event.u.media_player_length_changed.new_length =
+                                               var_GetTime( p_input, "length" );
+        libvlc_event_send( p_mi->p_event_manager, &event );
+    }
 
     return VLC_SUCCESS;
 
 }
 
+static void libvlc_media_player_destroy( libvlc_media_player_t * );
+
 /**************************************************************************
  * Create a Media Instance object.
  *
@@ -280,7 +285,6 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
     p_mi->p_libvlc_instance = p_libvlc_instance;
     p_mi->p_input_thread = NULL;
     p_mi->i_refcount = 1;
-    p_mi->b_own_its_input_thread = true;
     vlc_mutex_init( &p_mi->object_lock );
     p_mi->p_event_manager = libvlc_event_manager_new( p_mi,
             p_libvlc_instance, p_e );
@@ -316,6 +320,8 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
             libvlc_MediaPlayerPositionChanged, p_e );
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
             libvlc_MediaPlayerTimeChanged, p_e );
+    libvlc_event_manager_register_event_type( p_mi->p_event_manager,
+            libvlc_MediaPlayerLengthChanged, p_e );
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
             libvlc_MediaPlayerTitleChanged, p_e );
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
@@ -326,6 +332,7 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
     /* Snapshot initialization */
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
            libvlc_MediaPlayerSnapshotTaken, p_e );
+
     /* Attach a var callback to the global object to provide the glue between
         vout_thread that generates the event and media_player that re-emits it
         with its own event manager
@@ -347,8 +354,8 @@ libvlc_media_player_new_from_media(
                                     libvlc_exception_t *p_e )
 {
     libvlc_media_player_t * p_mi;
-    p_mi = libvlc_media_player_new( p_md->p_libvlc_instance, p_e );
 
+    p_mi = libvlc_media_player_new( p_md->p_libvlc_instance, p_e );
     if( !p_mi )
         return NULL;
 
@@ -358,80 +365,35 @@ libvlc_media_player_new_from_media(
     return p_mi;
 }
 
-/**************************************************************************
- * Create a new media instance object from an input_thread (Libvlc Internal).
- **************************************************************************/
-libvlc_media_player_t * libvlc_media_player_new_from_input_thread(
-                                   struct libvlc_instance_t *p_libvlc_instance,
-                                   input_thread_t *p_input,
-                                   libvlc_exception_t *p_e )
-{
-    libvlc_media_player_t * p_mi;
-
-    if( !p_input )
-    {
-        libvlc_exception_raise( p_e, "invalid input thread" );
-        return NULL;
-    }
-
-    p_mi = libvlc_media_player_new( p_libvlc_instance, p_e );
-
-    if( !p_mi )
-        return NULL;
-
-    p_mi->p_md = libvlc_media_new_from_input_item(
-                    p_libvlc_instance,
-                    input_GetItem( p_input ), p_e );
-
-    if( !p_mi->p_md )
-    {
-        libvlc_media_player_destroy( p_mi );
-        return NULL;
-    }
-
-    /* will be released in media_player_release() */
-    vlc_object_hold( p_input );
-
-    p_mi->p_input_thread = p_input;
-    p_mi->b_own_its_input_thread = false;
-
-    return p_mi;
-}
-
 /**************************************************************************
  * Destroy a Media Instance object (libvlc internal)
  *
  * Warning: No lock held here, but hey, this is internal. Caller must lock.
  **************************************************************************/
-void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
+static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
 {
     input_thread_t *p_input_thread;
     libvlc_exception_t p_e;
 
-    libvlc_exception_init( &p_e );
-
-    if( !p_mi )
-        return;
+    assert( p_mi );
 
-       /* Detach Callback from the main libvlc object */
+    /* Detach Callback from the main libvlc object */
     var_DelCallback( p_mi->p_libvlc_instance->p_libvlc_int,
                      "vout-snapshottaken", SnapshotTakenCallback, p_mi );
 
+    libvlc_exception_init( &p_e );
     p_input_thread = libvlc_get_input_thread( p_mi, &p_e );
 
     if( libvlc_exception_raised( &p_e ) )
-    {
-        libvlc_event_manager_release( p_mi->p_event_manager );
+        /* no need to worry about no input thread */
         libvlc_exception_clear( &p_e );
-        free( p_mi );
-        return; /* no need to worry about no input thread */
-    }
-    vlc_mutex_destroy( &p_mi->object_lock );
-
-    vlc_object_release( p_input_thread );
-
-    libvlc_media_release( p_mi->p_md );
+    else
+        release_input_thread( p_mi, true );
 
+    libvlc_event_manager_release( p_mi->p_event_manager );
+    if( p_mi->p_md )
+        libvlc_media_release( p_mi->p_md );
+    vlc_mutex_destroy( &p_mi->object_lock );
     free( p_mi );
 }
 
@@ -442,28 +404,15 @@ void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
  **************************************************************************/
 void libvlc_media_player_release( libvlc_media_player_t *p_mi )
 {
-    if( !p_mi )
-        return;
+    bool destroy;
 
+    assert( p_mi );
     vlc_mutex_lock( &p_mi->object_lock );
-
-    p_mi->i_refcount--;
-
-    if( p_mi->i_refcount > 0 )
-    {
-        vlc_mutex_unlock( &p_mi->object_lock );
-        return;
-    }
+    destroy = !--p_mi->i_refcount;
     vlc_mutex_unlock( &p_mi->object_lock );
-    vlc_mutex_destroy( &p_mi->object_lock );
-
-    release_input_thread( p_mi, true );
 
-    libvlc_event_manager_release( p_mi->p_event_manager );
-
-    libvlc_media_release( p_mi->p_md );
-
-    free( p_mi );
+    if( destroy )
+        libvlc_media_player_destroy( p_mi );
 }
 
 /**************************************************************************
@@ -711,31 +660,17 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
         libvlc_event_send( p_mi->p_event_manager, &event );
     }
 
-    if( p_mi->b_own_its_input_thread )
-    {
-        vlc_mutex_lock( &p_mi->object_lock );
-        release_input_thread( p_mi, true ); /* This will stop the input thread */
-        vlc_mutex_unlock( &p_mi->object_lock );
-    }
-    else
-    {
-        input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
-
-        if( !p_input_thread )
-            return;
-
-        input_Stop( p_input_thread, true );
-        vlc_object_release( p_input_thread );
-        p_mi->p_input_thread = NULL;
-    }
+    vlc_mutex_lock( &p_mi->object_lock );
+    release_input_thread( p_mi, true ); /* This will stop the input thread */
+    vlc_mutex_unlock( &p_mi->object_lock );
 }
 
 /**************************************************************************
  * set_nsobject
  **************************************************************************/
 void libvlc_media_player_set_nsobject( libvlc_media_player_t *p_mi,
-                                                                void * drawable,
-                                                                libvlc_exception_t *p_e )
+                                        void * drawable,
+                                        libvlc_exception_t *p_e )
 {
     (void) p_e;
     p_mi->drawable.nsobject = drawable;
index 76acbd8f34974c56fac999815c364ff5164993e8..22d593efba1c895e28bf81c13acd3406a8b7e1ab 100644 (file)
 
 #include <assert.h>
 
-#define PL (libvlc_priv (p_instance->p_libvlc_int)->p_playlist)
-
-static inline int playlist_was_locked( libvlc_instance_t *p_instance )
-{
-    int was_locked;
-    vlc_mutex_lock( &p_instance->instance_lock );
-    was_locked = p_instance->b_playlist_locked;
-    vlc_mutex_unlock( &p_instance->instance_lock );
-    return was_locked;
-}
-
-static inline void playlist_mark_locked( libvlc_instance_t *p_instance,
-                                         int locked )
-{
-    vlc_mutex_lock( &p_instance->instance_lock );
-    p_instance->b_playlist_locked = locked;
-    vlc_mutex_unlock( &p_instance->instance_lock );
-}
-
-void libvlc_playlist_loop( libvlc_instance_t *p_instance, int loop,
-                           libvlc_exception_t *p_e)
-{
-    VLC_UNUSED(p_e);
-
-    assert( PL );
-    var_SetBool( PL, "loop", loop );
-}
-
 void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id,
                            int i_options, char **ppsz_options,
                            libvlc_exception_t *p_e )
 {
-    VLC_UNUSED(p_e); VLC_UNUSED(i_options); VLC_UNUSED(ppsz_options);
-
-    int did_lock = 0;
-    assert( PL );
-    ///\todo Handle additionnal options
-
-    if( PL->items.i_size == 0 ) RAISEVOID( "Empty playlist" );
-    if( i_id > 0 )
-    {
-        playlist_item_t *p_item;
-        if (! playlist_was_locked( p_instance ) )
-        {
-            playlist_mark_locked( p_instance, 1 );
-            playlist_Lock( PL );
-            did_lock = 1;
-        }
-
-        p_item = playlist_ItemGetByInputId( PL, i_id,
-                                            PL->p_root_category );
-        if( p_item )
-            playlist_Control( PL, PLAYLIST_VIEWPLAY, pl_Locked,
-                              PL->p_root_category, p_item );
-       else
-            RAISEVOID( "Unable to find item" );
-
-        if( did_lock == 1 )
-        {
-            playlist_Unlock( PL );
-            playlist_mark_locked( p_instance, 0 );
-        }
-    }
-    else
-    {
-        playlist_Control( PL, PLAYLIST_PLAY,
-                          playlist_was_locked( p_instance ) );
-    }
-}
-
-void libvlc_playlist_pause( libvlc_instance_t *p_instance,
-                            libvlc_exception_t *p_e )
-{
-    assert( PL );
-    if( playlist_Control( PL, PLAYLIST_PAUSE,
-                          playlist_was_locked( p_instance ) ) != VLC_SUCCESS )
-        RAISEVOID( "Empty playlist" );
-}
-
-
-void libvlc_playlist_stop( libvlc_instance_t *p_instance,
-                           libvlc_exception_t *p_e )
-{
-    assert( PL );
-    if( playlist_Control( PL, PLAYLIST_STOP,
-                          playlist_was_locked( p_instance ) ) != VLC_SUCCESS )
-        RAISEVOID( "Empty playlist" );
-}
-
-void libvlc_playlist_clear( libvlc_instance_t *p_instance,
-                            libvlc_exception_t *p_e )
-{
-    VLC_UNUSED(p_e);
-
-    assert( PL );
-    playlist_Clear( PL, playlist_was_locked( p_instance ) );
-}
-
-void libvlc_playlist_next( libvlc_instance_t *p_instance,
-                           libvlc_exception_t *p_e )
-{
-    assert( PL );
-    if( playlist_Control( PL, PLAYLIST_SKIP, playlist_was_locked( p_instance ),
-                          1 ) != VLC_SUCCESS )
-        RAISEVOID( "Empty playlist" );
-}
+    playlist_t *pl = libvlc_priv (p_instance->p_libvlc_int)->p_playlist;
+    VLC_UNUSED(i_id); VLC_UNUSED(i_options); VLC_UNUSED(ppsz_options);
 
-void libvlc_playlist_prev( libvlc_instance_t *p_instance,
-                           libvlc_exception_t *p_e )
-{
-    if( playlist_Control( PL, PLAYLIST_SKIP, playlist_was_locked( p_instance ),
-                          -1  ) != VLC_SUCCESS )
-        RAISEVOID( "Empty playlist" );
+    assert( pl );
+    if( pl->items.i_size == 0 ) RAISEVOID( "Empty playlist" );
+    playlist_Control( pl, PLAYLIST_PLAY, false );
 }
-
-int libvlc_playlist_add( libvlc_instance_t *p_instance, const char *psz_uri,
-                         const char *psz_name, libvlc_exception_t *p_e )
-{
-    return libvlc_playlist_add_extended( p_instance, psz_uri, psz_name,
-                                         0, NULL, p_e );
-}
-
-static int PlaylistAddExtended( libvlc_instance_t *p_instance,
-                                const char *psz_uri, const char *psz_name,
-                                int i_options, const char **ppsz_options,
-                                unsigned i_option_flags,
-                                libvlc_exception_t *p_e )
-{
-    assert( PL );
-    if( playlist_was_locked( p_instance ) )
-    {
-        libvlc_exception_raise( p_e, "You must unlock playlist before "
-                               "calling libvlc_playlist_add" );
-        return VLC_EGENERIC;
-    }
-    return playlist_AddExt( PL, psz_uri, psz_name,
-                            PLAYLIST_INSERT, PLAYLIST_END, -1,
-                            i_options, ppsz_options, i_option_flags,
-                            true, pl_Unlocked );
-}
-int libvlc_playlist_add_extended( libvlc_instance_t *p_instance,
-                                  const char *psz_uri, const char *psz_name,
-                                  int i_options, const char **ppsz_options,
-                                  libvlc_exception_t *p_e )
-{
-    return PlaylistAddExtended( p_instance, psz_uri, psz_name,
-                                i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED,
-                                p_e );
-}
-int libvlc_playlist_add_extended_untrusted( libvlc_instance_t *p_instance,
-                                            const char *psz_uri, const char *psz_name,
-                                            int i_options, const char **ppsz_options,
-                                            libvlc_exception_t *p_e )
-{
-    return PlaylistAddExtended( p_instance, psz_uri, psz_name,
-                                i_options, ppsz_options, 0,
-                                p_e );
-}
-
-int libvlc_playlist_delete_item( libvlc_instance_t *p_instance, int i_id,
-                                 libvlc_exception_t *p_e )
-{
-    assert( PL );
-
-    if( playlist_DeleteFromInput( PL, i_id,
-                                  playlist_was_locked( p_instance ) ) )
-    {
-        libvlc_exception_raise( p_e, "deletion failed" );
-        return VLC_ENOITEM;
-    }
-    return VLC_SUCCESS;
-}
-
-int libvlc_playlist_isplaying( libvlc_instance_t *p_instance,
-                               libvlc_exception_t *p_e )
-{
-    VLC_UNUSED(p_e);
-
-    assert( PL );
-    return playlist_Status( PL ) == PLAYLIST_RUNNING;
-}
-
-int libvlc_playlist_items_count( libvlc_instance_t *p_instance,
-                                 libvlc_exception_t *p_e )
-{
-    VLC_UNUSED(p_e);
-
-    assert( PL );
-    return playlist_CurrentSize( PL );
-}
-
-int libvlc_playlist_get_current_index ( libvlc_instance_t *p_instance,
-                                        libvlc_exception_t *p_e )
-{
-    VLC_UNUSED(p_e);
-
-    assert( PL );
-    playlist_item_t *p_item = playlist_CurrentPlayingItem( PL );
-    if( !p_item )
-        return -1;
-    return p_item->i_id;
-}
-
-void libvlc_playlist_lock( libvlc_instance_t *p_instance )
-{
-    assert( PL );
-    playlist_Lock( PL );
-    p_instance->b_playlist_locked = 1;
-}
-
-void libvlc_playlist_unlock( libvlc_instance_t *p_instance )
-{
-    assert( PL );
-    p_instance->b_playlist_locked = 0;
-    playlist_Unlock( PL );
-}
-
-libvlc_media_player_t * libvlc_playlist_get_media_player(
-                                libvlc_instance_t *p_instance,
-                                libvlc_exception_t *p_e )
-{
-    libvlc_media_player_t *p_mi;
-    assert( PL );
-    input_thread_t * input = playlist_CurrentInput( PL );
-    if( input )
-    {
-        p_mi = libvlc_media_player_new_from_input_thread(
-                            p_instance, input, p_e );
-        vlc_object_release( input );
-    }
-    else
-    {
-        /* no active input */
-        p_mi = NULL;
-        libvlc_exception_raise( p_e, "No active input" );
-    }
-
-    return p_mi;
-}
-
index 939ed5941783135e87d7189cc77e598edf4c2c09..f43a81556d1a0f3e71404b1695f70e6736508ce0 100644 (file)
@@ -187,157 +187,6 @@ int libvlc_media_player_has_vout( libvlc_media_player_t *p_mi,
     return has_vout;
 }
 
-int libvlc_video_reparent( libvlc_media_player_t *p_mi, libvlc_drawable_t d,
-                           libvlc_exception_t *p_e )
-{
-    (void) p_mi; (void) d;
-    libvlc_exception_raise(p_e, "Reparenting not supported");
-    return -1;
-}
-
-void libvlc_video_resize( libvlc_media_player_t *p_mi, int width, int height, libvlc_exception_t *p_e )
-{
-    vout_thread_t *p_vout = GetVout( p_mi, p_e );
-    if( p_vout )
-    {
-        vout_Control( p_vout, VOUT_SET_SIZE, width, height );
-        vlc_object_release( p_vout );
-    }
-}
-
-void libvlc_video_redraw_rectangle( libvlc_media_player_t *p_mi,
-                           const libvlc_rectangle_t *area,
-                           libvlc_exception_t *p_e )
-{
-#ifdef __APPLE__
-    if( (NULL != area)
-     && ((area->bottom - area->top) > 0)
-     && ((area->right - area->left) > 0) )
-    {
-        vout_thread_t *p_vout = GetVout( p_mi, p_e );
-        if( p_vout )
-        {
-            /* tell running vout to redraw area */
-            vout_Control( p_vout , VOUT_REDRAW_RECT,
-                               area->top, area->left, area->bottom, area->right );
-            vlc_object_release( p_vout );
-        }
-    }
-#else
-    (void) p_mi; (void) area; (void) p_e;
-#endif
-}
-
-/* global video settings */
-
-/* Deprecated use libvlc_media_player_set_drawable() */
-void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d,
-                              libvlc_exception_t *p_e )
-{
-    /* set as default for future vout instances */
-#ifdef WIN32
-    vlc_value_t val;
-
-    if( sizeof(HWND) > sizeof(libvlc_drawable_t) )
-        return; /* BOOM! we told you not to use this function! */
-    val.p_address = (void *)(uintptr_t)d;
-    var_Set( p_instance->p_libvlc_int, "drawable-hwnd", val );
-#elif defined(__APPLE__)
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-agl", d );
-#else
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-xid", d );
-#endif
-
-    libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
-    if( p_mi )
-    {
-        libvlc_media_player_set_drawable( p_mi, d, p_e );
-        libvlc_media_player_release(p_mi);
-    }
-}
-
-/* Deprecated use libvlc_media_player_get_drawable() */
-libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
-{
-    VLC_UNUSED(p_e);
-
-#ifdef WIN32
-    vlc_value_t val;
-
-    if( sizeof(HWND) > sizeof(libvlc_drawable_t) )
-        return 0;
-    var_Get( p_instance->p_libvlc_int, "drawable-hwnd", &val );
-    return (uintptr_t)val.p_address;
-#elif defined(__APPLE__)
-    return var_GetInteger( p_instance->p_libvlc_int, "drawable-agl" );
-#else
-    return var_GetInteger( p_instance->p_libvlc_int, "drawable-xid" );
-#endif
-}
-
-void libvlc_video_set_size( libvlc_instance_t *p_instance, int width, int height,
-                           libvlc_exception_t *p_e )
-{
-    /* set as default for future vout instances */
-    config_PutInt(p_instance->p_libvlc_int, "width", width);
-    config_PutInt(p_instance->p_libvlc_int, "height", height);
-
-    libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
-    if( p_mi )
-    {
-        vout_thread_t *p_vout = GetVout( p_mi, p_e );
-        if( p_vout )
-        {
-            /* tell running vout to re-size */
-            vout_Control( p_vout , VOUT_SET_SIZE, width, height);
-            vlc_object_release( p_vout );
-        }
-        libvlc_media_player_release(p_mi);
-    }
-}
-
-void libvlc_video_set_viewport( libvlc_instance_t *p_instance, libvlc_media_player_t *p_mi,
-                            const libvlc_rectangle_t *view, const libvlc_rectangle_t *clip,
-                           libvlc_exception_t *p_e )
-{
-#ifdef __APPLE__
-    if( !view )
-    {
-        libvlc_exception_raise( p_e, "viewport is NULL" );
-        return;
-    }
-
-    /* if clip is NULL, then use view rectangle as clip */
-    if( !clip )
-        clip = view;
-
-    /* set as default for future vout instances */
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-view-top", view->top );
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-view-left", view->left );
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-view-bottom", view->bottom );
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-view-right", view->right );
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-top", clip->top );
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-left", clip->left );
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-bottom", clip->bottom );
-    var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-right", clip->right );
-
-    if( p_mi )
-    {
-        vout_thread_t *p_vout = GetVout( p_mi, p_e );
-        if( p_vout )
-        {
-            /* change viewport for running vout */
-            vout_Control( p_vout, VOUT_SET_VIEWPORT,
-                               view->top, view->left, view->bottom, view->right,
-                               clip->top, clip->left, clip->bottom, clip->right );
-            vlc_object_release( p_vout );
-        }
-    }
-#else
-    (void) p_instance; (void) p_mi; (void) view; (void) clip; (void) p_e;
-#endif
-}
-
 float libvlc_video_get_scale( libvlc_media_player_t *p_mp,
                               libvlc_exception_t *p_e )
 {
@@ -742,14 +591,3 @@ end:
     var_Change( p_input_thread, "video-es", VLC_VAR_FREELIST, &val_list, NULL );
     vlc_object_release( p_input_thread );
 }
-
-int libvlc_video_destroy( libvlc_media_player_t *p_mi,
-                          libvlc_exception_t *p_e )
-{
-    vout_thread_t *p_vout = GetVout( p_mi, p_e );
-    vlc_object_detach( p_vout );
-    vlc_object_release( p_vout );
-    vlc_object_release( p_vout );
-
-    return 0;
-}
index 8cf6addf5fee5f334718bcb2502bd55f1e10038d..450905b90bd2f445b3180c493cc037196740c7aa 100644 (file)
@@ -140,7 +140,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             char *psz_format = (char *)va_arg( args, char * );
 
             char *psz_value;
-            
+
             if( vasprintf( &psz_value, psz_format, args ) == -1 )
                 return VLC_EGENERIC;
 
index dd2946067aa60b7a4c5ccef16fbc00f4a64a4310..591c2c17ea0f304346db84fa0e610ff1007648eb 100644 (file)
@@ -1694,7 +1694,7 @@ static void DecoderFlushBuffering( decoder_t *p_dec )
 static void DecoderProcessSout( decoder_t *p_dec, block_t *p_block )
 {
     decoder_owner_sys_t *p_owner = (decoder_owner_sys_t *)p_dec->p_owner;
-    const bool b_telx = p_dec->fmt_in.i_codec == VLC_FOURCC('t','e','l','x');
+    const bool b_telx = p_dec->fmt_in.i_codec == VLC_CODEC_TELETEXT;
     block_t *p_sout_block;
 
     while( ( p_sout_block =
@@ -1850,7 +1850,7 @@ static void DecoderProcessAudio( decoder_t *p_dec, block_t *p_block, bool b_flus
 static void DecoderProcessSpu( decoder_t *p_dec, block_t *p_block, bool b_flush )
 {
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
-    const bool b_telx = p_dec->fmt_in.i_codec == VLC_FOURCC('t','e','l','x');
+    const bool b_telx = p_dec->fmt_in.i_codec == VLC_CODEC_TELETEXT;
 
     input_thread_t *p_input = p_owner->p_input;
     vout_thread_t *p_vout;
index 22d40261304b225b9b3b728ae7f0eca2c6c13c55..a0b0b1cad56b171f7ff2d8ad6926b16ba1324281 100644 (file)
@@ -37,6 +37,7 @@
 #include <vlc_es_out.h>
 #include <vlc_block.h>
 #include <vlc_aout.h>
+#include <vlc_fourcc.h>
 
 #include "input_internal.h"
 #include "clock.h"
@@ -211,7 +212,7 @@ static inline int EsOutGetClosedCaptionsChannel( vlc_fourcc_t fcc )
 }
 static inline bool EsFmtIsTeletext( const es_format_t *p_fmt )
 {
-    return p_fmt->i_cat == SPU_ES && p_fmt->i_codec == VLC_FOURCC( 't', 'e', 'l', 'x' );
+    return p_fmt->i_cat == SPU_ES && p_fmt->i_codec == VLC_CODEC_TELETEXT;
 }
 
 /*****************************************************************************
@@ -1386,6 +1387,10 @@ static es_out_id_t *EsOutAdd( es_out_t *out, const es_format_t *fmt )
     es_format_Copy( &es->fmt, fmt );
     if( es->fmt.i_id < 0 )
         es->fmt.i_id = out->p_sys->i_id;
+    if( !es->fmt.i_original_fourcc )
+        es->fmt.i_original_fourcc = es->fmt.i_codec;
+    es->fmt.i_codec = vlc_fourcc_GetCodec( es->fmt.i_cat, es->fmt.i_codec );
+
     es->i_id = es->fmt.i_id;
     es->i_meta_id = out->p_sys->i_id;
     es->b_scrambled = false;
@@ -1920,19 +1925,13 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
     input_DecoderIsCcPresent( es->p_dec, pb_cc );
     for( int i = 0; i < 4; i++ )
     {
-        static const vlc_fourcc_t fcc[4] = {
-            VLC_FOURCC('c', 'c', '1', ' '),
-            VLC_FOURCC('c', 'c', '2', ' '),
-            VLC_FOURCC('c', 'c', '3', ' '),
-            VLC_FOURCC('c', 'c', '4', ' '),
-        };
         es_format_t fmt;
 
         if(  es->pb_cc_present[i] || !pb_cc[i] )
             continue;
         msg_Dbg( p_input, "Adding CC track %d for es[%d]", 1+i, es->i_id );
 
-        es_format_Init( &fmt, SPU_ES, fcc[i] );
+        es_format_Init( &fmt, SPU_ES, EsOutFourccClosedCaptions[i] );
         fmt.i_group = es->fmt.i_group;
         if( asprintf( &fmt.psz_description,
                       _("Closed captions %u"), 1 + i ) == -1 )
@@ -2445,20 +2444,24 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
             mtime_t i_time = (mtime_t)va_arg( args, mtime_t );
             mtime_t i_length = (mtime_t)va_arg( args, mtime_t );
 
-            /* Fix for buffering delay */
-            const mtime_t i_delay = EsOutGetBuffering( out );
+            input_SendEventLength( p_sys->p_input, i_length );
 
-            i_time -= i_delay;
-            if( i_time < 0 )
-                i_time = 0;
+            if( !p_sys->b_buffering )
+            {
+                /* Fix for buffering delay */
+                const mtime_t i_delay = EsOutGetBuffering( out );
 
-            if( i_length > 0 )
-                f_position -= (double)i_delay / i_length;
-            if( f_position < 0 )
-                f_position = 0;
+                i_time -= i_delay;
+                if( i_time < 0 )
+                    i_time = 0;
 
-            if( !p_sys->b_buffering )
-                input_SendEventTimes( p_sys->p_input, f_position, i_time, i_length );
+                if( i_length > 0 )
+                    f_position -= (double)i_delay / i_length;
+                if( f_position < 0 )
+                    f_position = 0;
+
+                input_SendEventPosition( p_sys->p_input, f_position, i_time );
+            }
             return VLC_SUCCESS;
         }
         case ES_OUT_SET_JITTER:
@@ -2673,8 +2676,15 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
         input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Original ID"),
                        "%d", es->i_id );
 
-    input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Codec"),
-                   "%.4s", (char*)&p_fmt_es->i_codec );
+    const char *psz_codec_description =
+        vlc_fourcc_GetDescription( p_fmt_es->i_cat, p_fmt_es->i_codec );
+    const vlc_fourcc_t i_codec_fourcc = p_fmt_es->i_original_fourcc ?: p_fmt_es->i_codec;
+    if( psz_codec_description )
+        input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Codec"),
+                       "%s (%.4s)", psz_codec_description, (char*)&i_codec_fourcc );
+    else
+        input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Codec"),
+                       "%.4s", (char*)&i_codec_fourcc );
 
     if( es->psz_language && *es->psz_language )
         input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Language"),
index 242bf1fd01b61e6bf5c45f7fd9deb58499abe022..6703dfed395c64a1bbc418aed0767fa061a65521 100644 (file)
@@ -60,8 +60,7 @@ void input_SendEventAbort( input_thread_t *p_input )
     Trigger( p_input, INPUT_EVENT_ABORT );
 }
 
-void input_SendEventTimes( input_thread_t *p_input,
-                           double f_position, mtime_t i_time, mtime_t i_length )
+void input_SendEventPosition( input_thread_t *p_input, double f_position, mtime_t i_time )
 {
     vlc_value_t val;
 
@@ -73,13 +72,22 @@ void input_SendEventTimes( input_thread_t *p_input,
     val.i_time = i_time;
     var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
 
+    Trigger( p_input, INPUT_EVENT_POSITION );
+}
+void input_SendEventLength( input_thread_t *p_input, mtime_t i_length )
+{
+    vlc_value_t val;
+
        /* FIXME ugly + what about meta change event ? */
-    if( var_GetTime( p_input, "length" ) != i_length )
-        input_item_SetDuration( p_input->p->p_item, i_length );
+    if( var_GetTime( p_input, "length" ) == i_length )
+        return;
+
+    input_item_SetDuration( p_input->p->p_item, i_length );
+
     val.i_time = i_length;
     var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
 
-    Trigger( p_input, INPUT_EVENT_TIMES );
+    Trigger( p_input, INPUT_EVENT_LENGTH );
 }
 void input_SendEventStatistics( input_thread_t *p_input )
 {
index b6ed2bfc607af1652b0f7645278da43af2526bc5..6fc9d9935253b4985debe3b675793a67d1155b99 100644 (file)
@@ -35,7 +35,8 @@
  *****************************************************************************/
 void input_SendEventDead( input_thread_t *p_input );
 void input_SendEventAbort( input_thread_t *p_input );
-void input_SendEventTimes( input_thread_t *p_input, double f_position, mtime_t i_time, mtime_t i_length );
+void input_SendEventPosition( input_thread_t *p_input, double f_position, mtime_t i_time );
+void input_SendEventLength( input_thread_t *p_input, mtime_t i_length );
 void input_SendEventStatistics( input_thread_t *p_input );
 void input_SendEventRate( input_thread_t *p_input, int i_rate );
 void input_SendEventAudioDelay( input_thread_t *p_input, mtime_t i_delay );
index cfb306575a9ae015abc31eb3135a6a33b46de8f7..119b41c730b2272c96b20e741320ae8faad7cb30 100644 (file)
@@ -1203,7 +1203,9 @@ static int Init( input_thread_t * p_input )
         i_length = 0;
     if( i_length <= 0 )
         i_length = input_item_GetDuration( p_input->p->p_item );
-    input_SendEventTimes( p_input, 0.0, 0, i_length );
+    input_SendEventLength( p_input, i_length );
+
+    input_SendEventPosition( p_input, 0.0, 0 );
 
     if( !p_input->b_preparsing )
     {
index 2f5d2f13f87773ce0600426db22478553188abfd..0fb54b02469b35346f7f80fbfa0fd2207009d535 100644 (file)
@@ -973,14 +973,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     }
 #endif
 
-    /*
-     * FIXME: kludge to use a p_libvlc-local variable for the Mozilla plugin
-     */
-    var_Create( p_libvlc, "drawable-xid", VLC_VAR_DOINHERIT|VLC_VAR_INTEGER );
-    var_Create( p_libvlc, "drawable-hwnd", VLC_VAR_ADDRESS );
-    var_Create( p_libvlc, "drawable-agl", VLC_VAR_INTEGER );
-    var_Create( p_libvlc, "drawable-gl", VLC_VAR_INTEGER );
-
     var_Create( p_libvlc, "drawable-view-top", VLC_VAR_INTEGER );
     var_Create( p_libvlc, "drawable-view-left", VLC_VAR_INTEGER );
     var_Create( p_libvlc, "drawable-view-bottom", VLC_VAR_INTEGER );
index 8da4a03fe3eeceaff94622b89b1c2c957c21f121..c8c489b4c042927fc5966a641f959dc4e203d6b9 100644 (file)
@@ -119,7 +119,6 @@ libvlc_media_new
 libvlc_media_new_as_node
 libvlc_media_new_from_input_item
 libvlc_media_player_can_pause
-libvlc_media_player_destroy
 libvlc_media_player_event_manager
 libvlc_media_player_get_agl
 libvlc_media_player_get_chapter
@@ -142,7 +141,6 @@ libvlc_media_player_has_vout
 libvlc_media_player_is_seekable
 libvlc_media_player_is_playing
 libvlc_media_player_new
-libvlc_media_player_new_from_input_thread
 libvlc_media_player_new_from_media
 libvlc_media_player_next_chapter
 libvlc_media_player_pause
@@ -169,23 +167,7 @@ libvlc_media_set_state
 libvlc_media_set_user_data
 libvlc_media_subitems
 libvlc_new
-libvlc_playlist_add
-libvlc_playlist_add_extended
-libvlc_playlist_add_extended_untrusted
-libvlc_playlist_clear
-libvlc_playlist_delete_item
-libvlc_playlist_get_media_player
-libvlc_playlist_isplaying
-libvlc_playlist_items_count
-libvlc_playlist_get_current_index
-libvlc_playlist_lock
-libvlc_playlist_loop
-libvlc_playlist_next
-libvlc_playlist_pause
 libvlc_playlist_play
-libvlc_playlist_prev
-libvlc_playlist_stop
-libvlc_playlist_unlock
 libvlc_release
 libvlc_retain
 libvlc_set_fullscreen
@@ -193,12 +175,10 @@ libvlc_set_log_verbosity
 libvlc_toggle_fullscreen
 libvlc_toggle_teletext
 libvlc_track_description_release
-libvlc_video_destroy
 libvlc_video_get_aspect_ratio
 libvlc_video_get_chapter_description
 libvlc_video_get_crop_geometry
 libvlc_video_get_height
-libvlc_video_get_parent
 libvlc_video_get_scale
 libvlc_video_get_spu
 libvlc_video_get_spu_count
@@ -209,19 +189,13 @@ libvlc_video_get_track
 libvlc_video_get_track_count
 libvlc_video_get_track_description
 libvlc_video_get_width
-libvlc_video_redraw_rectangle
-libvlc_video_reparent
-libvlc_video_resize
 libvlc_video_set_aspect_ratio
 libvlc_video_set_crop_geometry
-libvlc_video_set_parent
 libvlc_video_set_scale
-libvlc_video_set_size
 libvlc_video_set_spu
 libvlc_video_set_subtitle_file
 libvlc_video_set_teletext
 libvlc_video_set_track
-libvlc_video_set_viewport
 libvlc_video_take_snapshot
 libvlc_vlm_add_broadcast
 libvlc_vlm_add_vod
index d72c10f8051a2271ad641244972b59e4f3f6cc6d..fc42f05cc5b011dd401573aa1896b8c845c41762 100644 (file)
@@ -279,6 +279,7 @@ picture_CopyPixels
 picture_Delete
 picture_Export
 picture_New
+picture_Setup
 plane_CopyPixels
 playlist_Add
 playlist_AddExt
@@ -301,7 +302,6 @@ playlist_Import
 playlist_IsServicesDiscoveryLoaded
 playlist_ItemGetById
 playlist_ItemGetByInput
-playlist_ItemGetByInputId
 playlist_LiveSearchUpdate
 playlist_Lock
 playlist_NodeAppend
@@ -376,6 +376,10 @@ subpicture_New
 subpicture_region_ChainDelete
 subpicture_region_Delete
 subpicture_region_New
+text_style_Copy
+text_style_Delete
+text_style_Duplicate
+text_style_New
 tls_ClientCreate
 tls_ClientDelete
 ToLocale
@@ -419,6 +423,7 @@ var_SetChecked
 __var_TriggerCallback
 __var_Type
 video_format_FixRgb
+video_format_Setup
 vlc_avcodec_mutex
 vlc_b64_decode
 vlc_b64_decode_binary
@@ -448,6 +453,10 @@ vlc_event_manager_register_event_type
 vlc_event_send
 __vlc_execve
 vlc_fastmem_register
+vlc_fourcc_GetCodec
+vlc_fourcc_GetCodecAudio
+vlc_fourcc_GetCodecFromString
+vlc_fourcc_GetDescription
 vlc_freeaddrinfo
 vlc_gai_strerror
 vlc_gc_init
@@ -520,8 +529,6 @@ vout_DestroyPicture
 vout_DisplayPicture
 vout_EnableFilter
 vout_GetSnapshot
-vout_InitFormat
-__vout_InitPicture
 vout_LinkPicture
 vout_OSDIcon
 __vout_OSDMessage
index 9f74db009c3b0bd90f7476bdb0cd3c906fe43aba..d5eaa471f82ec94aca71863b0c710a8382366185 100644 (file)
@@ -92,24 +92,24 @@ void video_format_FixRgb( video_format_t *p_fmt )
     {
         switch( p_fmt->i_chroma )
         {
-        case VLC_FOURCC('R','V','1','5'):
+        case VLC_CODEC_RGB15:
             p_fmt->i_rmask = 0x7c00;
             p_fmt->i_gmask = 0x03e0;
             p_fmt->i_bmask = 0x001f;
             break;
 
-        case VLC_FOURCC('R','V','1','6'):
+        case VLC_CODEC_RGB16:
             p_fmt->i_rmask = 0xf800;
             p_fmt->i_gmask = 0x07e0;
             p_fmt->i_bmask = 0x001f;
             break;
 
-        case VLC_FOURCC('R','V','2','4'):
+        case VLC_CODEC_RGB24:
             p_fmt->i_rmask = 0xff0000;
             p_fmt->i_gmask = 0x00ff00;
             p_fmt->i_bmask = 0x0000ff;
             break;
-        case VLC_FOURCC('R','V','3','2'):
+        case VLC_CODEC_RGB32:
             p_fmt->i_rmask = 0x00ff0000;
             p_fmt->i_gmask = 0x0000ff00;
             p_fmt->i_bmask = 0x000000ff;
@@ -128,11 +128,86 @@ void video_format_FixRgb( video_format_t *p_fmt )
                  p_fmt->i_bmask );
 }
 
+void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect )
+{
+    p_fmt->i_chroma         = vlc_fourcc_GetCodec( VIDEO_ES, i_chroma );
+    p_fmt->i_width          =
+    p_fmt->i_visible_width  = i_width;
+    p_fmt->i_height         =
+    p_fmt->i_visible_height = i_height;
+    p_fmt->i_x_offset       =
+    p_fmt->i_y_offset       = 0;
+    p_fmt->i_aspect         = i_aspect;
+
+    switch( p_fmt->i_chroma )
+    {
+    case VLC_CODEC_YUVA:
+        p_fmt->i_bits_per_pixel = 32;
+        break;
+    case VLC_CODEC_I444:
+    case VLC_CODEC_J444:
+        p_fmt->i_bits_per_pixel = 24;
+        break;
+    case VLC_CODEC_I422:
+    case VLC_CODEC_YUYV:
+    case VLC_CODEC_YVYU:
+    case VLC_CODEC_UYVY:
+    case VLC_CODEC_VYUY:
+    case VLC_CODEC_J422:
+        p_fmt->i_bits_per_pixel = 16;
+        break;
+    case VLC_CODEC_I440:
+    case VLC_CODEC_J440:
+        p_fmt->i_bits_per_pixel = 16;
+        break;
+    case VLC_CODEC_I411:
+    case VLC_CODEC_YV12:
+    case VLC_CODEC_I420:
+    case VLC_CODEC_J420:
+        p_fmt->i_bits_per_pixel = 12;
+        break;
+    case VLC_CODEC_I410:
+        p_fmt->i_bits_per_pixel = 9;
+        break;
+    case VLC_CODEC_Y211:
+        p_fmt->i_bits_per_pixel = 8;
+        break;
+    case VLC_CODEC_YUVP:
+        p_fmt->i_bits_per_pixel = 8;
+        break;
+
+    case VLC_CODEC_RGB32:
+    case VLC_CODEC_RGBA:
+        p_fmt->i_bits_per_pixel = 32;
+        break;
+    case VLC_CODEC_RGB24:
+        p_fmt->i_bits_per_pixel = 24;
+        break;
+    case VLC_CODEC_RGB15:
+    case VLC_CODEC_RGB16:
+        p_fmt->i_bits_per_pixel = 16;
+        break;
+    case VLC_CODEC_RGB8:
+        p_fmt->i_bits_per_pixel = 8;
+        break;
+
+    case VLC_CODEC_GREY:
+    case VLC_CODEC_RGBP:
+        p_fmt->i_bits_per_pixel = 8;
+        break;
+
+    default:
+        p_fmt->i_bits_per_pixel = 0;
+        break;
+    }
+}
+
 void es_format_Init( es_format_t *fmt,
                      int i_cat, vlc_fourcc_t i_codec )
 {
     fmt->i_cat                  = i_cat;
     fmt->i_codec                = i_codec;
+    fmt->i_original_fourcc      = 0;
     fmt->i_id                   = -1;
     fmt->i_group                = 0;
     fmt->i_priority             = 0;
diff --git a/src/misc/fourcc.c b/src/misc/fourcc.c
new file mode 100644 (file)
index 0000000..8a6121b
--- /dev/null
@@ -0,0 +1,1277 @@
+/*****************************************************************************
+ * fourcc.c: fourcc helpers functions
+ *****************************************************************************
+ * Copyright (C) 2009 Laurent Aimar
+ * $Id$
+ *
+ * Authors: Laurent Aimar <fenrir@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_fourcc.h>
+#include <assert.h>
+
+typedef struct
+{
+    char p_class[4];
+    char p_fourcc[4];
+    const char *psz_description;
+} entry_t;
+
+#define NULL4 "\x00\x00\x00\x00"
+
+/* XXX You don't want to see the preprocessor generated code ;) */
+#ifdef WORDS_BIGENDIAN
+#   define FCC2STR(f) { ((f)>>24)&0xff, ((f)>>16)&0xff, ((f)>>8)&0xff, ((f)>>0)&0xff }
+#else
+#   define FCC2STR(f) { ((f)>>0)&0xff, ((f)>>8)&0xff, ((f)>>16)&0xff, ((f)>>24)&0xff }
+#endif
+/* Begin a new class */
+#define B(a, c) { .p_class = FCC2STR(a), .p_fourcc = FCC2STR(a), .psz_description = c }
+/* Create a sub-class entry with description */
+#define E(b, c) { .p_class = NULL4, .p_fourcc = b, .psz_description = c }
+/* Create a sub-class entry without description (alias) */
+#define A(b) E(b, NULL4)
+
+
+/* */
+static const entry_t p_list_video[] = {
+
+    B(VLC_CODEC_MPGV, "MPEG-1/2 Video"),
+        A("mpgv"),
+        A("mp1v"),
+        A("mpeg"),
+        A("mpg1"),
+        A("mp2v"),
+        A("MPEG"),
+        A("mpg2"),
+
+        E("PIM1", "Pinnacle DC1000 (MPEG-1 Video)"),
+
+        E("hdv1", "HDV 720p30 (MPEG-2 Video)"),
+        E("hdv2", "Sony HDV (MPEG-2 Video)"),
+        E("hdv3", "FCP HDV (MPEG-2 Video)"),
+        E("hdv5", "HDV 720p25 (MPEG-2 Video)"),
+        E("hdv6", "HDV 1080p24 (MPEG-2 Video)"),
+        E("hdv7", "HDV 1080p25 (MPEG-2 Video)"),
+        E("hdv8", "HDV 1080p30 (MPEG-2 Video)"),
+
+        E("mx5n", "MPEG2 IMX NTSC 525/60 50mb/s (FCP)"),
+        E("mx5p", "MPEG2 IMX PAL 625/60 50mb/s (FCP)"),
+        E("mx4n", "MPEG2 IMX NTSC 525/60 40mb/s (FCP)"),
+        E("mx4p", "MPEG2 IMX PAL 625/50 40mb/s (FCP)"),
+        E("mx3n", "MPEG2 IMX NTSC 525/60 30mb/s (FCP)"),
+        E("mx3p", "MPEG2 IMX NTSC 625/50 30mb/s (FCP)"),
+
+        E("xdv1", "XDCAM HD"),
+        E("xdv2", "XDCAM HD 1080i60 35mb/s"),
+        E("xdv3", "XDCAM HD 1080i50 35mb/s"),
+        E("xdv4", "XDCAM HD"),
+        E("xdv5", "XDCAM HD"),
+        E("xdv6", "XDCAM HD 1080p24 35mb/s"),
+        E("xdv7", "XDCAM HD 1080p25 35mb/s"),
+        E("xdv8", "XDCAM HD 1080p30 35mb/s"),
+        E("xdv9", "XDCAM HD"),
+
+        E("xdva", "XDCAM"),
+        E("xdvb", "XDCAM"),
+        E("xdvc", "XDCAM"),
+        E("xdvd", "XDCAM"),
+        E("xdve", "XDCAM"),
+        E("xdvf", "XDCAM"),
+
+        E("xd5a", "XDCAM"),
+        E("xd5b", "XDCAM"),
+        E("xd5c", "XDCAM"),
+        E("xd5d", "XDCAM"),
+        E("xd5e", "XDCAM"),
+        E("xd5f", "XDCAM"),
+        E("xd59", "XDCAM"),
+
+        E("AVmp", "AVID IMX PAL"),
+        E("MMES", "Matrox MPEG-2"),
+        E("mmes", "Matrox MPEG-2"),
+        E("PIM2", "Pinnacle MPEG-2"),
+        E("LMP2", "Lead MPEG-2"),
+
+        E("VCR2", "ATI VCR-2"),
+
+    B(VLC_CODEC_MP4V, "MPEG-4 Video"),
+        A("mp4v"),
+        A("DIVX"),
+        A("divx"),
+        A("MP4S"),
+        A("mp4s"),
+        A("M4S2"),
+        A("m4s2"),
+        A("MP4V"),
+        A("\x04\x00\x00\x00"),
+        A("m4cc"),
+        A("M4CC"),
+        A("FMP4"),
+        A("fmp4"),
+        A("DCOD"),
+        A("MVXM"),
+        A("PM4V"),
+        A("M4T3"),
+        A("GEOX"),
+        A("DMK2"),
+        A("WV1F"),
+        A("DIGI"),
+        A("INMC"),
+        A("SN40"),
+        A("EPHV"),
+        /* XVID flavours */
+        E("xvid", "Xvid MPEG-4 Video"),
+        E("XVID", "Xvid MPEG-4 Video"),
+        E("XviD", "Xvid MPEG-4 Video"),
+        E("XVIX", "Xvid MPEG-4 Video"),
+        E("xvix", "Xvid MPEG-4 Video"),
+        /* DX50 */
+        E("DX50", "DivX MPEG-4 Video"),
+        E("dx50", "DivX MPEG-4 Video"),
+        E("BLZ0", "Blizzard MPEG-4 Video"),
+        E("DXGM", "Electronic Arts Game MPEG-4 Video"),
+        /* 3ivx delta 4 */
+        E("3IV2", "3ivx MPEG-4 Video"),
+        E("3iv2", "3ivx MPEG-4 Video"),
+        /* Various */
+        E("UMP4", "UB MPEG-4 Video"),
+        E("SEDG", "Samsung MPEG-4 Video"),
+        E("RMP4", "REALmagic MPEG-4 Video"),
+        E("HDX4", "Jomigo HDX4 (MPEG-4 Video)"),
+        E("hdx4", "Jomigo HDX4 (MPEG-4 Video)"),
+        E("SMP4", "Samsung SMP4 (MPEG-4 Video)"),
+        E("smp4", "Samsung SMP4 (MPEG-4 Video)"),
+        E("fvfw", "FFmpeg MPEG-4"),
+        E("FVFW", "FFmpeg MPEG-4"),
+        E("FFDS", "FFDShow MPEG-4"),
+        E("VIDM", "vidm 4.01 codec"),
+        /* 3ivx delta 3.5 Unsupported
+         * putting it here gives extreme distorted images */
+        //E("3IV1", "3ivx delta 3.5 MPEG-4 Video"),
+        //E("3iv1", "3ivx delta 3.5 MPEG-4 Video"),
+
+    /* MSMPEG4 v1 */
+    B(VLC_CODEC_DIV1, "MS MPEG-4 Video v1"),
+        A("DIV1"),
+        A("div1"),
+        A("MPG4"),
+        A("mpg4"),
+        A("mp41"),
+
+    /* MSMPEG4 v2 */
+    B(VLC_CODEC_DIV2, "MS MPEG-4 Video v2"),
+        A("DIV2"),
+        A("div2"),
+        A("MP42"),
+        A("mp42"),
+
+    /* MSMPEG4 v3 / M$ mpeg4 v3 */
+    B(VLC_CODEC_DIV3, "MS MPEG-4 Video v3"),
+        A("DIV3"),
+        A("MPG3"),
+        A("mpg3"),
+        A("div3"),
+        A("MP43"),
+        A("mp43"),
+        /* DivX 3.20 */
+        A("DIV4"),
+        A("div4"),
+        A("DIV5"),
+        A("div5"),
+        A("DIV6"),
+        A("div6"),
+        E("divf", "DivX 4.12"),
+        E("DIVF", "DivX 4.12"),
+        /* Cool Codec */
+        A("COL1"),
+        A("col1"),
+        A("COL0"),
+        A("col0"),
+        /* AngelPotion stuff */
+        A("AP41"),
+        /* 3ivx doctered divx files */
+        A("3IVD"),
+        A("3ivd"),
+        /* who knows? */
+        A("3VID"),
+        A("3vid"),
+        A("DVX3"),
+
+    /* Sorenson v1 */
+    B(VLC_CODEC_SVQ1, "SVQ-1 (Sorenson Video v1)"),
+        A("SVQ1"),
+        A("svq1"),
+        A("svqi"),
+
+    /* Sorenson v3 */
+    B(VLC_CODEC_SVQ3, "SVQ-3 (Sorenson Video v3)"),
+        A("SVQ3"),
+
+    /* h264 */
+    B(VLC_CODEC_H264, "H264 - MPEG-4 AVC (part 10)"),
+        A("H264"),
+        A("h264"),
+        A("x264"),
+        A("X264"),
+        /* avc1: special case h264 */
+        A("avc1"),
+        A("AVC1"),
+        E("VSSH", "Vanguard VSS H264"),
+        E("VSSW", "Vanguard VSS H264"),
+        E("vssh", "Vanguard VSS H264"),
+        E("DAVC", "Dicas MPEGable H.264/MPEG-4 AVC"),
+        E("davc", "Dicas MPEGable H.264/MPEG-4 AVC"),
+
+    /* H263 and H263i */
+    /* H263(+) is also known as Real Video 1.0 */
+
+    /* H263 */
+    B(VLC_CODEC_H263, "H263"),
+        A("H263"),
+        A("h263"),
+        A("VX1K"),
+        A("s263"),
+        A("S263"),
+        A("U263"),
+        A("u263"),
+        E("D263", "DEC H263"),
+        E("L263", "LEAD H263"),
+        E("M263", "Microsoft H263"),
+        E("X263", "Xirlink H263"),
+        /* Zygo (partial) */
+        E("ZyGo", "ITU H263+"),
+
+    /* H263i */
+    B(VLC_CODEC_H263I, "I263.I"),
+        A("I263"),
+        A("i263"),
+
+    /* H263P */
+    B(VLC_CODEC_H263P, "ITU H263+"),
+        E("ILVR", "ITU H263+"),
+        E("viv1", "H263+"),
+        E("vivO", "H263+"),
+        E("viv2", "H263+"),
+        E("U263", "UB H263+"),
+
+    /* Flash (H263) variant */
+    B(VLC_CODEC_FLV1, "Flash Video"),
+        A("FLV1"),
+        A("flv "),
+
+    /* H261 */
+    B(VLC_CODEC_H261, "H.261"),
+        A("H261"),
+        A("h261"),
+
+    B(VLC_CODEC_FLIC, "Flic Video"),
+        A("FLIC"),
+
+    /* MJPEG */
+    B(VLC_CODEC_MJPG, "Motion JPEG Video"),
+        A("MJPG"),
+        A("mjpg"),
+        A("mjpa"),
+        A("jpeg"),
+        A("JPEG"),
+        A("JFIF"),
+        A("JPGL"),
+        A("AVDJ"),
+        A("MMJP"),
+        A("QIVG"),
+        /* AVID MJPEG */
+        E("AVRn", "Avid Motion JPEG"),
+        E("AVDJ", "Avid Motion JPEG"),
+        E("ADJV", "Avid Motion JPEG"),
+        E("dmb1", "Motion JPEG OpenDML Video"),
+        E("ijpg", "Intergraph JPEG Video"),
+        E("IJPG", "Intergraph JPEG Video"),
+        E("ACDV", "ACD Systems Digital"),
+        E("SLMJ", "SL M-JPEG"),
+
+    B(VLC_CODEC_MJPGB, "Motion JPEG B Video"),
+        A("mjpb"),
+
+    B(VLC_CODEC_LJPG, "Lead Motion JPEG Video"),
+        A("LJPG"),
+
+    // ? from avcodec/fourcc.c but makes not sense.
+    //{ VLC_FOURCC( 'L','J','P','G' ), CODEC_ID_MJPEG,       VIDEO_ES, "Lead Motion JPEG Video" },
+
+    /* SP5x */
+    B(VLC_CODEC_SP5X, "Sunplus Motion JPEG Video"),
+        A("SP5X"),
+        A("SP53"),
+        A("SP54"),
+        A("SP55"),
+        A("SP56"),
+        A("SP57"),
+        A("SP58"),
+
+    /* DV */
+    B(VLC_CODEC_DV, "DV Video"),
+        A("dv  "),
+        A("dvsl"),
+        A("DVSD"),
+        A("dvsd"),
+        A("DVCS"),
+        A("dvcs"),
+        A("dvhd"),
+        A("dvhp"),
+        A("dvhq"),
+        A("dvh3"),
+        A("dvh5"),
+        A("dvh6"),
+        A("dv1n"),
+        A("dv1p"),
+        A("dvc "),
+        A("dv25"),
+        A("dvh1"),
+        A("dvs1"),
+        E("dvcp", "DV Video PAL"),
+        E("dvp ", "DV Video Pro"),
+        E("dvpp", "DV Video Pro PAL"),
+        E("dv50", "DV Video C Pro 50"),
+        E("dv5p", "DV Video C Pro 50 PAL"),
+        E("dv5n", "DV Video C Pro 50 NTSC"),
+        E("AVdv", "AVID DV"),
+        E("AVd1", "AVID DV"),
+        E("CDVC", "Canopus DV Video"),
+        E("cdvc", "Canopus DV Video"),
+        E("CDVH", "Canopus DV Video"),
+        E("cdvh", "Canopus DV Video"),
+
+    /* Windows Media Video */
+    B(VLC_CODEC_WMV1, "Windows Media Video 7"),
+        A("WMV1"),
+        A("wmv1"),
+
+    B(VLC_CODEC_WMV2, "Windows Media Video 8"),
+        A("WMV2"),
+        A("wmv2"),
+
+    B(VLC_CODEC_WMV3, "Windows Media Video 9"),
+        A("WMV3"),
+        A("wmv3"),
+
+    B(VLC_CODEC_WMVA, "Windows Media Video Advanced"),
+        A("WMVA"),
+        A("wmva"),
+        A("WVP2"),
+        A("wvp2"),
+
+    B(VLC_CODEC_VC1, "Windows Media Video VC1"),
+        A("WVC1"),
+        A("wvc1"),
+        A("vc-1"),
+        A("VC-1"),
+        /* WMVA is the VC-1 codec before the standardization proces,
+         * it is not bitstream compatible and deprecated  */
+        E("WMVA", "Windows Media Video Advanced Profile"),
+
+    /* Microsoft Video 1 */
+    B(VLC_CODEC_MSVIDEO1, "Microsoft Video 1"),
+        A("MSVC"),
+        A("msvc"),
+        A("CRAM"),
+        A("cram"),
+        A("WHAM"),
+        A("wham"),
+
+    /* Microsoft RLE */
+    B(VLC_CODEC_MSRLE, "Microsoft RLE Video"),
+        A("mrle"),
+        A("WRLE"),
+        A("\x01\x00\x00\x00"),
+        A("\x02\x00\x00\x00"),
+
+    /* Indeo Video Codecs (Quality of this decoder on ppc is not good) */
+    B(VLC_CODEC_INDEO3, "Indeo Video v3"),
+        A("IV31"),
+        A("iv31"),
+        A("IV32"),
+        A("iv32"),
+
+    /* Huff YUV */
+    B(VLC_CODEC_HUFFYUV, "Huff YUV Video"),
+        A("HFYU"),
+
+    B(VLC_CODEC_FFVHUFF, "Huff YUV Video"),
+        A("FFVH"),
+
+    /* On2 VP3 Video Codecs */
+    B(VLC_CODEC_VP3, "On2's VP3 Video"),
+        A("VP3 "),
+        A("VP30"),
+        A("vp30"),
+        A("VP31"),
+        A("vp31"),
+
+    /* On2  VP5, VP6 codecs */
+    B(VLC_CODEC_VP5, "On2's VP5 Video"),
+        A("VP5 "),
+        A("VP50"),
+
+    B(VLC_CODEC_VP6, "On2's VP6.2 Video"),
+        A("VP62"),
+        A("vp62"),
+        E("VP60", "On2's VP6.0 Video"),
+        E("VP61", "On2's VP6.1 Video"),
+
+    B(VLC_CODEC_VP6F, "On2's VP6.2 Video (Flash)"),
+        A("VP6F"),
+
+    B(VLC_CODEC_VP6A, "On2's VP6 A Video"),
+        A("VP6A"),
+
+    /* Xiph.org theora */
+    B(VLC_CODEC_THEORA, "Xiph.org's Theora Video"),
+        A("theo"),
+        A("Thra"),
+
+    /* Xiph.org tarkin */
+    B(VLC_CODEC_TARKIN, "Xiph.org's Tarkin Video"),
+        A("tark"),
+
+    /* Asus Video (Another thing that doesn't work on PPC) */
+    B(VLC_CODEC_ASV1, "Asus V1 Video"),
+        A("ASV1"),
+    B(VLC_CODEC_ASV2, "Asus V2 Video"),
+        A("ASV2"),
+
+    /* FFMPEG Video 1 (lossless codec) */
+    B(VLC_CODEC_FFV1, "FFMpeg Video 1"),
+        A("FFV1"),
+
+    /* ATI VCR1 */
+    B(VLC_CODEC_VCR1, "ATI VCR1 Video"),
+        A("VCR1"),
+
+    /* Cirrus Logic AccuPak */
+    B(VLC_CODEC_CLJR, "Creative Logic AccuPak"),
+        A("CLJR"),
+
+    /* Real Video */
+    B(VLC_CODEC_RV10, "Real Video 1.0"),
+        A("RV10"),
+        A("rv10"),
+
+    B(VLC_CODEC_RV13, "Real Video 1.3"),
+        A("RV13"),
+        A("rv13"),
+
+    B(VLC_CODEC_RV20, "Real Video 2.0"),
+        A("RV20"),
+        A("rv20"),
+
+    B(VLC_CODEC_RV30, "Real Video 3.0"),
+        A("RV30"),
+        A("rv30"),
+
+    B(VLC_CODEC_RV40, "Real Video 4.0"),
+        A("RV40"),
+        A("rv40"),
+
+    /* Apple Video */
+    B(VLC_CODEC_RPZA, "Apple Video"),
+        A("rpza"),
+        A("azpr"),
+        A("RPZA"),
+        A("AZPR"),
+
+    B(VLC_CODEC_SMC, "Apple graphics"),
+        A("smc "),
+
+    B(VLC_CODEC_CINEPAK, "Cinepak Video"),
+        A("CVID"),
+        A("cvid"),
+
+    /* Screen Capture Video Codecs */
+    B(VLC_CODEC_TSCC, "TechSmith Camtasia Screen Capture"),
+        A("TSCC"),
+        A("tscc"),
+
+    B(VLC_CODEC_CSCD, "CamStudio Screen Codec"),
+        A("CSCD"),
+        A("cscd"),
+
+    B(VLC_CODEC_ZMBV, "DosBox Capture Codec"),
+        A("ZMBV"),
+
+    B(VLC_CODEC_VMNC, "VMware Video"),
+        A("VMnc"),
+    B(VLC_CODEC_FRAPS, "FRAPS: Realtime Video Capture"),
+        A("FPS1"),
+        A("fps1"),
+
+    /* Duck TrueMotion */
+    B(VLC_CODEC_TRUEMOTION1, "Duck TrueMotion v1 Video"),
+        A("DUCK"),
+        A("PVEZ"),
+    B(VLC_CODEC_TRUEMOTION2, "Duck TrueMotion v2.0 Video"),
+        A("TM20"),
+
+    /* FFMPEG's SNOW wavelet codec */
+    B(VLC_CODEC_SNOW, "FFMpeg SNOW wavelet Video"),
+        A("SNOW"),
+        A("snow"),
+
+    B(VLC_CODEC_QTRLE, "Apple QuickTime RLE Video"),
+        A("rle "),
+
+    B(VLC_CODEC_QDRAW, "Apple QuickDraw Video"),
+        A("qdrw"),
+
+    B(VLC_CODEC_QPEG, "QPEG Video"),
+        A("QPEG"),
+        A("Q1.0"),
+        A("Q1.1"),
+
+    B(VLC_CODEC_ULTI, "IBM Ultimotion Video"),
+        A("ULTI"),
+
+    B(VLC_CODEC_VIXL, "Miro/Pinnacle VideoXL Video"),
+        A("VIXL"),
+        A("XIXL"),
+        E("PIXL", "Pinnacle VideoXL Video"),
+
+    B(VLC_CODEC_LOCO, "LOCO Video"),
+        A("LOCO"),
+
+    B(VLC_CODEC_WNV1, "Winnov WNV1 Video"),
+        A("WNV1"),
+
+    B(VLC_CODEC_AASC, "Autodesc RLE Video"),
+        A("AASC"),
+
+    B(VLC_CODEC_INDEO2, "Indeo Video v2"),
+        A("IV20"),
+        A("RT21"),
+
+        /* Flash Screen Video */
+    B(VLC_CODEC_FLASHSV, "Flash Screen Video"),
+        A("FSV1"),
+    B(VLC_CODEC_KMVC, "Karl Morton's Video Codec (Worms)"),
+        A("KMVC"),
+
+    B(VLC_CODEC_NUV, "Nuppel Video"),
+        A("RJPG"),
+        A("NUV1"),
+
+    /* CODEC_ID_SMACKVIDEO */
+    B(VLC_CODEC_SMACKVIDEO, "Smacker Video"),
+        A("SMK2"),
+        A("SMK4"),
+
+    /* Chinese AVS - Untested */
+    B(VLC_CODEC_CAVS, "Chinese AVS"),
+        A("CAVS"),
+        A("AVs2"),
+        A("avs2"),
+
+    /* */
+    B(VLC_CODEC_DNXHD, "DNxHD"),
+        A("AVdn"),
+    B(VLC_CODEC_8BPS, "8BPS"),
+        A("8BPS"),
+    B(VLC_CODEC_MIMIC, "Mimic"),
+        A("ML2O"),
+
+    B(VLC_CODEC_CDG, "CD-G Video"),
+        A("CDG "),
+
+    /* */
+    B(VLC_CODEC_YV12, "Planar 4:2:0 YVU"),
+        A("YV12"),
+        A("yv12"),
+    B(VLC_CODEC_I420, "Planar 4:1:0 YUV"),
+        A("I410"),
+        A("YVU9"),
+    B(VLC_CODEC_I420, "Planar 4:1:1 YUV"),
+        A("I411"),
+    B(VLC_CODEC_I420, "Planar 4:2:0 YUV"),
+        A("I420"),
+        A("IYUV"),
+    B(VLC_CODEC_I422, "Planar 4:2:2 YUV"),
+        A("I422"),
+    B(VLC_CODEC_I444, "Planar 4:4:0 YUV"),
+        A("I440"),
+    B(VLC_CODEC_I444, "Planar 4:4:4 YUV"),
+        A("I444"),
+
+    B(VLC_CODEC_I420, "Planar 4:1:0 YUV full scale"),
+        A("J410"),
+    B(VLC_CODEC_I420, "Planar 4:1:1 YUV full scale"),
+        A("J411"),
+    B(VLC_CODEC_I420, "Planar 4:2:0 YUV full scale"),
+        A("J420"),
+    B(VLC_CODEC_I422, "Planar 4:2:2 YUV full scale"),
+        A("J422"),
+    B(VLC_CODEC_I444, "Planar 4:4:0 YUV full scale"),
+        A("J440"),
+    B(VLC_CODEC_I444, "Planar 4:4:4 YUV full scale"),
+        A("J444"),
+
+    B(VLC_CODEC_YUVP, "Palettized YUV with palette element Y:U:V:A"),
+        A("YUVP"),
+
+    B(VLC_CODEC_YUVA, "Planar YUV 4:4:4 Y:U:V:A"),
+        A("YUVA"),
+
+    B(VLC_CODEC_RGBP, "Palettized RGB with palette element R:G:B"),
+        A("RGBP"),
+
+    B(VLC_CODEC_RGB8, "8 bits RGB"),
+        A("RGB2"),
+    B(VLC_CODEC_RGB15, "15 bits RGB"),
+        A("RV15"),
+    B(VLC_CODEC_RGB16, "16 bits RGB"),
+        A("RV16"),
+    B(VLC_CODEC_RGB24, "24 bits RGB"),
+        A("RV24"),
+    B(VLC_CODEC_RGB32, "32 bits RGB"),
+        A("RV32"),
+    B(VLC_CODEC_RGBA, "32 bits RGBA"),
+        A("RGBA"),
+
+    B(VLC_CODEC_GREY, "8 bits greyscale"),
+        A("GREY"),
+        A("Y800"),
+        A("Y8  "),
+
+    B(VLC_CODEC_UYVY, "Packed YUV 4:2:2, U:Y:V:Y"),
+        A("UYVY"),
+        A("UYNV"),
+        A("Y422"),
+        A("2vuy"),
+        A("2Vuy"),
+        A("AVUI"),
+    B(VLC_CODEC_VYUY, "Packed YUV 4:2:2, V:Y:U:Y"),
+        A("VYUY"),
+    B(VLC_CODEC_YUYV, "Packed YUV 4:2:2, Y:U:Y:V"),
+        A("YUY2"),
+        A("YUYV"),
+        A("YUNV"),
+    B(VLC_CODEC_YVYU, "Packed YUV 4:2:2, Y:V:Y:U"),
+        A("YVYU"),
+
+    B(VLC_CODEC_Y211, "Packed YUV 2:1:1, Y:U:Y:V "),
+        A("Y211"),
+    B(VLC_CODEC_YMGA, "Planar Y, packed UV, from Matrox"),
+        A("YMGA"),
+    B(VLC_CODEC_CYUV, "Creative Packed YUV 4:2:2, U:Y:V:Y, reverted"),
+        A("cyuv"),
+        A("CYUV"),
+
+    B(VLC_CODEC_V210, "10-bit 4:2:2 Component YCbCr"),
+        A("v210"),
+
+    /* Videogames Codecs */
+
+    /* Interplay MVE */
+    B(VLC_CODEC_INTERPLAY, "Interplay MVE Video"),
+        A("imve"),
+        A("INPV"),
+
+    /* Id Quake II CIN */
+    B(VLC_CODEC_IDCIN, "Id Quake II CIN Video"),
+        A("IDCI"),
+
+    /* 4X Technologies */
+    B(VLC_CODEC_4XM, "4X Technologies Video"),
+        A("4XMV"),
+        A("4xmv"),
+
+    /* Id RoQ */
+    B(VLC_CODEC_ROQ, "Id RoQ Video"),
+        A("RoQv"),
+
+    /* Sony Playstation MDEC */
+    B(VLC_CODEC_MDEC, "PSX MDEC Video"),
+        A("MDEC"),
+
+    /* Sierra VMD */
+    B(VLC_CODEC_VMDVIDEO, "Sierra VMD Video"),
+        A("VMDV"),
+        A("vmdv"),
+
+    B(VLC_CODEC_DIRAC, "Dirac" ),
+        A("drac"),
+
+    /* Image */
+    B(VLC_CODEC_PNG, "PNG Image"),
+        A("png "),
+
+    B(VLC_CODEC_PPM, "PPM Image"),
+        A("ppm "),
+
+    B(VLC_CODEC_PGM, "PGM Image"),
+        A("pgm "),
+
+    B(VLC_CODEC_PGMYUV, "PGM YUV Image"),
+        A("pgmy"),
+
+    B(VLC_CODEC_PAM, "PAM Image"),
+        A("pam "),
+
+    B(VLC_CODEC_JPEGLS, "Lossless JPEG"),
+        A("MJLS"),
+
+    B(VLC_CODEC_JPEG, "JPEG"),
+        A("jpeg"),
+        A("JPEG"),
+
+    B(VLC_CODEC_BMP, "BMP Image"),
+        A("bmp "),
+
+    B(VLC_CODEC_TIFF, "TIFF Image"),
+        A("tiff"),
+
+    B(VLC_CODEC_GIF, "GIF Image"),
+        A("gif "),
+
+
+    B(VLC_CODEC_TARGA, "Truevision Targa Image"),
+        A("tga "),
+        A("mtga"),
+        A("MTGA"),
+
+    B(VLC_CODEC_SGI, "SGI Image"),
+        A("sgi "),
+
+    B(VLC_CODEC_PNM, "Portable Anymap Image"),
+        A("pnm "),
+
+    B(VLC_CODEC_PCX, "Personal Computer Exchange Image"),
+        A("pcx "),
+
+    B(0, "")
+};
+static const entry_t p_list_audio[] = {
+
+    /* Windows Media Audio 1 */
+    B(VLC_CODEC_WMA1, "Windows Media Audio 1"),
+        A("WMA1"),
+        A("wma1"),
+
+    /* Windows Media Audio 2 */
+    B(VLC_CODEC_WMA2, "Windows Media Audio 2"),
+        A("WMA2"),
+        A("wma2"),
+        A("wma "),
+
+    /* Windows Media Audio Professional */
+    B(VLC_CODEC_WMAP, "Windows Media Audio Professional"),
+        A("WMAP"),
+        A("wmap"),
+
+    /* Windows Media Audio Lossless */
+    B(VLC_CODEC_WMAL, "Windows Media Audio Lossless"),
+        A("WMAL"),
+        A("wmal"),
+
+    /* Windows Media Audio Speech */
+    B(VLC_CODEC_WMAS, "Windows Media Audio Speech"),
+        A("WMAS"),
+        A("wmas"),
+
+    /* DV Audio */
+    B(VLC_CODEC_DVAUDIO, "DV Audio"),
+        A("dvau"),
+        A("vdva"),
+        A("dvca"),
+        A("RADV"),
+
+    /* MACE-3 Audio */
+    B(VLC_CODEC_MACE3, "MACE-3 Audio"),
+        A("MAC3"),
+
+    /* MACE-6 Audio */
+    B(VLC_CODEC_MACE6, "MACE-6 Audio"),
+        A("MAC6"),
+
+    /* MUSEPACK7 Audio */
+    B(VLC_CODEC_MUSEPACK7, "MUSEPACK7 Audio"),
+        A("MPC "),
+
+    /* MUSEPACK8 Audio */
+    B(VLC_CODEC_MUSEPACK8, "MUSEPACK8 Audio"),
+        A("MPCK"),
+        A("MPC8"),
+
+    /* RealAudio 1.0 */
+    B(VLC_CODEC_RA_144, "RealAudio 1.0"),
+        A("14_4"),
+        A("lpcJ"),
+
+    /* RealAudio 2.0 */
+    B(VLC_CODEC_RA_288, "RealAudio 2.0"),
+        A("28_8"),
+
+    /* MPEG Audio layer 1/2/3 */
+    B(VLC_CODEC_MPGA, "MPEG Audio layer 1/2/3"),
+        A("mpga"),
+        A("mp3 "),
+        A(".mp3"),
+        A("MP3 "),
+        A("LAME"),
+        A("ms\x00\x50"),
+        A("ms\x00\x55"),
+
+    /* A52 Audio (aka AC3) */
+    B(VLC_CODEC_A52, "A52 Audio (aka AC3)"),
+        A("a52 "),
+        A("a52b"),
+        A("ac-3"),
+        A("ms\x20\x00"),
+
+    B(VLC_CODEC_EAC3, "A/52 B Audio (aka E-AC3)"),
+        A("eac3"),
+
+    /* DTS Audio */
+    B(VLC_CODEC_DTS, "DTS Audio"),
+        A("dts "),
+        A("dtsb"),
+        A("ms\x20\x01"),
+
+    /* AAC audio */
+    B(VLC_CODEC_MP4A, "MPEG AAC Audio"),
+        A("mp4a"),
+        A("aac "),
+
+    /* 4X Technologies */
+    B(VLC_CODEC_ADPCM_4XM, "4X Technologies Audio"),
+        A("4xma"),
+
+    /* EA ADPCM */
+    B(VLC_CODEC_ADPCM_EA, "EA ADPCM Audio"),
+        A("ADEA"),
+
+    /* Interplay DPCM */
+    B(VLC_CODEC_INTERPLAY_DPCM, "Interplay DPCM Audio"),
+        A("idpc"),
+
+    /* Id RoQ */
+    B(VLC_CODEC_ROQ_DPCM, "Id RoQ DPCM Audio"),
+        A("RoQa"),
+
+    /* DCIN Audio */
+    B(VLC_CODEC_DSICINAUDIO, "Delphine CIN Audio"),
+        A("DCIA"),
+
+    /* Sony Playstation XA ADPCM */
+    B(VLC_CODEC_ADPCM_XA, "PSX XA ADPCM Audio"),
+        A("xa  "),
+
+    /* ADX ADPCM */
+    B(VLC_CODEC_ADPCM_ADX, "ADX ADPCM Audio"),
+        A("adx "),
+
+    /* Westwood ADPCM */
+    B(VLC_CODEC_ADPCM_IMA_WS, "Westwood IMA ADPCM audio"),
+        A("AIWS"),
+
+    /* Sierra VMD */
+    B(VLC_CODEC_VMDAUDIO, "Sierra VMD Audio"),
+        A("vmda"),
+
+    /* G.726 ADPCM */
+    B(VLC_CODEC_ADPCM_G726, "G.726 ADPCM Audio"),
+        A("g726"),
+
+    /* AMR */
+    B(VLC_CODEC_AMR_NB, "AMR narrow band"),
+        A("samr"),
+
+    B(VLC_CODEC_AMR_WB, "AMR wide band"),
+        A("sawb"),
+
+    /* FLAC */
+    B(VLC_CODEC_FLAC, "FLAC (Free Lossless Audio Codec)"),
+        A("flac"),
+
+    /* ALAC */
+    B(VLC_CODEC_ALAC, "Apple Lossless Audio Codec"),
+        A("alac"),
+
+    /* QDM2 */
+    B(VLC_CODEC_QDM2, "QDM2 Audio"),
+        A("QDM2"),
+
+    /* COOK */
+    B(VLC_CODEC_COOK, "Cook Audio"),
+        A("cook"),
+
+    /* TTA: The Lossless True Audio */
+    B(VLC_CODEC_TTA, "The Lossless True Audio"),
+        A("TTA1"),
+
+    /* Shorten */
+    B(VLC_CODEC_SHORTEN, "Shorten Lossless Audio"),
+        A("shn "),
+        A("shrn"),
+
+    B(VLC_CODEC_WAVPACK, "WavPack"),
+        A("WVPK"),
+        A("wvpk"),
+
+    B(VLC_CODEC_GSM, "GSM Audio"),
+        A("gsm "),
+
+    B(VLC_CODEC_GSM_MS, "Microsoft GSM Audio"),
+        A("agsm"),
+
+    B(VLC_CODEC_ATRAC3, "atrac 3"),
+        A("atrc"),
+        A("\x70\x02\x00\x00"),
+
+    B(VLC_CODEC_SONIC, "Sonic"),
+        A("SONC"),
+
+    B(VLC_CODEC_IMC, "IMC" ),
+        A("\x01\x04\x00\x00"),
+
+    B(VLC_CODEC_TRUESPEECH,"TrueSpeech"),
+        A("\x22\x00\x00\x00"),
+
+    B(VLC_CODEC_NELLYMOSER, "NellyMoser ASAO"),
+        A("NELL"),
+
+    B(VLC_CODEC_APE, "Monkey's Audio"),
+        A("APE "),
+
+    B(VLC_CODEC_MLP, "MLP/TrueHD Audio"),
+        A("mlp "),
+
+    B(VLC_CODEC_QCELP, "QCELP Audio"),
+        A("Qclp"),
+
+    B(VLC_CODEC_SPEEX, "Speex Audio"),
+        A("spx "),
+        A("spxr"),
+
+    B(VLC_CODEC_VORBIS, "Vorbis Audio"),
+        A("vorb"),
+
+    B(VLC_CODEC_302M, "302M Audio"),
+        A("302m"),
+
+    B(VLC_CODEC_DVD_LPCM, "DVD LPCM Audio"),
+        A("lpcm"),
+
+    B(VLC_CODEC_BD_LPCM, "BD LPCM Audio"),
+        A("bpcm"),
+
+    B(VLC_CODEC_SDDS, "SDDS Audio"),
+        A("sdds"),
+        A("sddb"),
+
+    B(VLC_CODEC_MIDI, "MIDI Audio"),
+        A("MIDI"),
+
+    /* PCM */
+    B(VLC_CODEC_S8, "PCM S8"),
+        A("s8  "),
+
+    B(VLC_CODEC_U8, "PCM U8"),
+        A("u8  "),
+
+    B(VLC_CODEC_S16L, "PCM S16 LE"),
+        A("s16l"),
+
+    B(VLC_CODEC_S16B, "PCM S16 BE"),
+        A("s16b"),
+
+    B(VLC_CODEC_U16L, "PCM U16 LE"),
+        A("u16l"),
+
+    B(VLC_CODEC_U16B, "PCM U16 BE"),
+        A("u16b"),
+
+    B(VLC_CODEC_S24L, "PCM S24 LE"),
+        A("s24l"),
+        A("42ni"),  /* Quicktime */
+
+    B(VLC_CODEC_S24B, "PCM S24 BE"),
+        A("s24b"),
+        A("in24"),  /* Quicktime */
+
+    B(VLC_CODEC_U24L, "PCM U24 LE"),
+        A("u24l"),
+
+    B(VLC_CODEC_U24B, "PCM U24 BE"),
+        A("u24b"),
+
+    B(VLC_CODEC_S32L, "PCM S32 LE"),
+        A("s32l"),
+        A("23ni"),  /* Quicktime */
+
+    B(VLC_CODEC_S32B, "PCM S32 BE"),
+        A("s32b"),
+        A("in32"),  /* Quicktime */
+
+    B(VLC_CODEC_U32L, "PCM U32 LE"),
+        A("u32l"),
+
+    B(VLC_CODEC_U32B, "PCM U32 BE"),
+        A("u32b"),
+
+    B(VLC_CODEC_ALAW, "PCM ALAW"),
+        A("alaw"),
+
+    B(VLC_CODEC_MULAW, "PCM MU-LAW"),
+        A("mlaw"),
+        A("ulaw"),
+
+    B(VLC_CODEC_S24DAUD, "PCM DAUD"),
+        A("daud"),
+
+    B(VLC_CODEC_FI32, "32 bits fixed float"),
+        A("fi32"),
+
+    B(VLC_CODEC_FL32, "32 bits float"),
+        A("fl32"),
+
+    B(VLC_CODEC_FL32, "64 bits float"),
+        A("fl64"),
+
+    B(0, "")
+};
+static const entry_t p_list_spu[] = {
+
+    B(VLC_CODEC_SPU, "DVD Subtitles"),
+        A("spu "),
+        A("spub"),
+
+    B(VLC_CODEC_DVBS, "DVB Subtitles"),
+        A("dvbs"),
+
+    B(VLC_CODEC_SUBT, "Text subtitles with various tags"),
+        A("subt"),
+
+    B(VLC_CODEC_XSUB, "DivX XSUB subtitles"),
+        A("XSUB"),
+        A("xsub"),
+
+    B(VLC_CODEC_SSA, "SubStation Alpha subtitles"),
+        A("ssa "),
+
+    B(VLC_CODEC_TEXT, "Plain text subtitles"),
+        A("TEXT"),
+
+    B(VLC_CODEC_TELETEXT, "Teletext"),
+        A("telx"),
+
+    B(VLC_CODEC_TELETEXT, "Kate subtiles"),
+        A("kate"),
+
+    B(VLC_CODEC_CMML, "CMML annotations/metadata"),
+        A("cmml"),
+
+    B(VLC_CODEC_ITU_T140, "ITU T.140 subtitles"),
+        A("t140"),
+
+    B(VLC_CODEC_ITU_T140, "ITU T.140 subtitles"),
+        A("t140"),
+
+    B(VLC_CODEC_USF, "USF subtitles"),
+        A("usf "),
+
+    B(VLC_CODEC_OGT, "OGT subtitles"),
+        A("ogt "),
+
+    B(VLC_CODEC_CVD, "CVD subtitles"),
+        A("cvd "),
+
+    B(0, "")
+};
+
+/* Create a fourcc from a string.
+ * XXX it assumes that the string is at least four bytes */
+static inline vlc_fourcc_t CreateFourcc( const char *psz_fourcc )
+{
+    return VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
+                       psz_fourcc[2], psz_fourcc[3] );
+}
+
+/* */
+static entry_t Lookup( const entry_t p_list[], vlc_fourcc_t i_fourcc )
+{
+    const char *p_class = NULL;
+    const char *psz_description = NULL;
+
+    entry_t e = B(0, "");
+
+    for( int i = 0; ; i++ )
+    {
+        const entry_t *p = &p_list[i];
+        const vlc_fourcc_t i_entry_fourcc = CreateFourcc( p->p_fourcc );
+        const vlc_fourcc_t i_entry_class = CreateFourcc( p->p_class );
+
+        if( i_entry_fourcc == 0 )
+            break;
+
+        if( i_entry_class != 0 )
+        {
+            p_class = p->p_class;
+            psz_description = p->psz_description;
+        }
+
+        if( i_entry_fourcc == i_fourcc )
+        {
+            assert( p_class != NULL );
+
+            memcpy( e.p_class, p_class, 4 );
+            memcpy( e.p_fourcc, p->p_fourcc, 4 );
+            e.psz_description = p->psz_description ?: psz_description;
+            break;
+        }
+    }
+    return e;
+}
+
+/* */
+static entry_t Find( int i_cat, vlc_fourcc_t i_fourcc )
+{
+    entry_t e;
+
+    switch( i_cat )
+    {
+    case VIDEO_ES:
+        return Lookup( p_list_video, i_fourcc );
+    case AUDIO_ES:
+        return Lookup( p_list_audio, i_fourcc );
+    case SPU_ES:
+        return Lookup( p_list_spu, i_fourcc );
+
+    default:
+        e = Find( VIDEO_ES, i_fourcc );
+        if( CreateFourcc( e.p_class ) == 0 )
+            e = Find( AUDIO_ES, i_fourcc );
+        if( CreateFourcc( e.p_class ) == 0 )
+            e = Find( SPU_ES, i_fourcc );
+        return e;
+    }
+}
+
+/* */
+vlc_fourcc_t vlc_fourcc_GetCodec( int i_cat, vlc_fourcc_t i_fourcc )
+{
+    entry_t e = Find( i_cat, i_fourcc );
+
+    if( CreateFourcc( e.p_class ) == 0 )
+        return i_fourcc;
+    return CreateFourcc( e.p_class );
+}
+
+vlc_fourcc_t vlc_fourcc_GetCodecFromString( int i_cat, const char *psz_fourcc )
+{
+    if( !psz_fourcc || strlen(psz_fourcc) != 4 )
+        return 0;
+    return vlc_fourcc_GetCodec( i_cat,
+                                VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
+                                            psz_fourcc[2], psz_fourcc[3] ) );
+}
+
+vlc_fourcc_t vlc_fourcc_GetCodecAudio( vlc_fourcc_t i_fourcc, int i_bits )
+{
+    const int i_bytes = ( i_bits + 7 ) / 8;
+
+    if( i_fourcc == VLC_FOURCC( 'a', 'f', 'l', 't' ) )
+    {
+        switch( i_bytes )
+        {
+        case 4:
+            return VLC_CODEC_FL32;
+        case 8:
+            return VLC_CODEC_FL64;
+        default:
+            return 0;
+        }
+    }
+    else if( i_fourcc == VLC_FOURCC( 'a', 'r', 'a', 'w' ) ||
+             i_fourcc == VLC_FOURCC( 'p', 'c', 'm', ' ' ) )
+    {
+        switch( i_bytes )
+        {
+        case 1:
+            return VLC_CODEC_U8;
+        case 2:
+            return VLC_CODEC_S16L;
+        case 3:
+            return VLC_CODEC_S24L;
+            break;
+        case 4:
+            return VLC_CODEC_S32L;
+        default:
+            return 0;
+        }
+    }
+    else if( i_fourcc == VLC_FOURCC( 't', 'w', 'o', 's' ) )
+    {
+        switch( i_bytes )
+        {
+        case 1:
+            return VLC_CODEC_S8;
+        case 2:
+            return VLC_CODEC_S16B;
+        case 3:
+            return VLC_CODEC_S24B;
+        case 4:
+            return VLC_CODEC_S32B;
+        default:
+            return 0;
+        }
+    }
+    else if( i_fourcc == VLC_FOURCC( 's', 'o', 'w', 't' ) )
+    {
+        switch( i_bytes )
+        {
+        case 1:
+            return VLC_CODEC_S8;
+        case 2:
+            return VLC_CODEC_S16L;
+        case 3:
+            return VLC_CODEC_S24L;
+        case 4:
+            return VLC_CODEC_S32L;
+        default:
+            return 0;
+        }
+    }
+    else
+    {
+        return vlc_fourcc_GetCodec( AUDIO_ES, i_fourcc );
+    }
+}
+
+/* */
+const char *vlc_fourcc_GetDescription( int i_cat, vlc_fourcc_t i_fourcc )
+{
+    entry_t e = Find( i_cat, i_fourcc );
+
+    return e.psz_description;
+}
+
index b0a808f82de35fa62dc996f15bfc905d42a5aaeb..ba567af1b2b43c49f7e8b8e5ddb51fab411c840f 100644 (file)
@@ -523,23 +523,23 @@ static const struct
 
 } ext_table[] =
 {
-    { VLC_FOURCC('j','p','e','g'), "jpeg" },
-    { VLC_FOURCC('j','p','e','g'), "jpg"  },
-    { VLC_FOURCC('l','j','p','g'), "ljpg" },
-    { VLC_FOURCC('p','n','g',' '), "png" },
-    { VLC_FOURCC('p','g','m',' '), "pgm" },
-    { VLC_FOURCC('p','g','m','y'), "pgmyuv" },
+    { VLC_CODEC_JPEG,              "jpeg" },
+    { VLC_CODEC_JPEG,              "jpg"  },
+    { VLC_CODEC_JPEGLS,            "ljpg" },
+    { VLC_CODEC_PNG,               "png" },
+    { VLC_CODEC_PGM,               "pgm" },
+    { VLC_CODEC_PGMYUV,            "pgmyuv" },
     { VLC_FOURCC('p','b','m',' '), "pbm" },
     { VLC_FOURCC('p','a','m',' '), "pam" },
-    { VLC_FOURCC('t','g','a',' '), "tga" },
-    { VLC_FOURCC('b','m','p',' '), "bmp" },
-    { VLC_FOURCC('p','n','m',' '), "pnm" },
+    { VLC_CODEC_TARGA,             "tga" },
+    { VLC_CODEC_BMP,               "bmp" },
+    { VLC_CODEC_PNM,               "pnm" },
     { VLC_FOURCC('x','p','m',' '), "xpm" },
     { VLC_FOURCC('x','c','f',' '), "xcf" },
-    { VLC_FOURCC('p','c','x',' '), "pcx" },
-    { VLC_FOURCC('g','i','f',' '), "gif" },
-    { VLC_FOURCC('t','i','f','f'), "tif" },
-    { VLC_FOURCC('t','i','f','f'), "tiff" },
+    { VLC_CODEC_PCX,               "pcx" },
+    { VLC_CODEC_GIF,               "gif" },
+    { VLC_CODEC_TIFF,              "tif" },
+    { VLC_CODEC_TIFF,              "tiff" },
     { VLC_FOURCC('l','b','m',' '), "lbm" },
     { 0, NULL }
 };
@@ -584,20 +584,20 @@ static const struct
     const char *psz_mime;
 } mime_table[] =
 {
-    { VLC_FOURCC('b','m','p',' '), "image/bmp" },
-    { VLC_FOURCC('b','m','p',' '), "image/x-bmp" },
-    { VLC_FOURCC('b','m','p',' '), "image/x-bitmap" },
-    { VLC_FOURCC('b','m','p',' '), "image/x-ms-bmp" },
-    { VLC_FOURCC('p','n','m',' '), "image/x-portable-anymap" },
-    { VLC_FOURCC('p','n','m',' '), "image/x-portable-bitmap" },
-    { VLC_FOURCC('p','n','m',' '), "image/x-portable-graymap" },
-    { VLC_FOURCC('p','n','m',' '), "image/x-portable-pixmap" },
-    { VLC_FOURCC('g','i','f',' '), "image/gif" },
-    { VLC_FOURCC('j','p','e','g'), "image/jpeg" },
-    { VLC_FOURCC('p','c','x',' '), "image/pcx" },
-    { VLC_FOURCC('p','n','g',' '), "image/png" },
-    { VLC_FOURCC('t','i','f','f'), "image/tiff" },
-    { VLC_FOURCC('t','g','a',' '), "iamge/x-tga" },
+    { VLC_CODEC_BMP,               "image/bmp" },
+    { VLC_CODEC_BMP,               "image/x-bmp" },
+    { VLC_CODEC_BMP,               "image/x-bitmap" },
+    { VLC_CODEC_BMP,               "image/x-ms-bmp" },
+    { VLC_CODEC_PNM,               "image/x-portable-anymap" },
+    { VLC_CODEC_PNM,               "image/x-portable-bitmap" },
+    { VLC_CODEC_PNM,               "image/x-portable-graymap" },
+    { VLC_CODEC_PNM,               "image/x-portable-pixmap" },
+    { VLC_CODEC_GIF,               "image/gif" },
+    { VLC_CODEC_JPEG,              "image/jpeg" },
+    { VLC_CODEC_PCX,               "image/pcx" },
+    { VLC_CODEC_PNG,               "image/png" },
+    { VLC_CODEC_TIFF,              "image/tiff" },
+    { VLC_CODEC_TARGA,             "iamge/x-tga" },
     { VLC_FOURCC('x','p','m',' '), "image/x-xpixmap" },
     { 0, NULL }
 };
diff --git a/src/misc/pthread.c b/src/misc/pthread.c
new file mode 100644 (file)
index 0000000..9391f05
--- /dev/null
@@ -0,0 +1,590 @@
+/*****************************************************************************
+ * pthread.c : pthread back-end for LibVLC
+ *****************************************************************************
+ * Copyright (C) 1999-2009 the VideoLAN team
+ *
+ * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
+ *          Samuel Hocevar <sam@zoy.org>
+ *          Gildas Bazin <gbazin@netcourrier.com>
+ *          Clément Sténac
+ *          Rémi Denis-Courmont
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+
+#include "libvlc.h"
+#include <stdarg.h>
+#include <assert.h>
+#include <unistd.h> /* fsync() */
+#include <signal.h>
+
+#include <sched.h>
+#ifdef __linux__
+# include <sys/syscall.h> /* SYS_gettid */
+#endif
+
+#ifdef HAVE_EXECINFO_H
+# include <execinfo.h>
+#endif
+
+#ifdef __APPLE__
+# include <sys/time.h> /* gettimeofday in vlc_cond_timedwait */
+#endif
+
+/**
+ * Print a backtrace to the standard error for debugging purpose.
+ */
+void vlc_trace (const char *fn, const char *file, unsigned line)
+{
+     fprintf (stderr, "at %s:%u in %s\n", file, line, fn);
+     fflush (stderr); /* needed before switch to low-level I/O */
+#ifdef HAVE_BACKTRACE
+     void *stack[20];
+     int len = backtrace (stack, sizeof (stack) / sizeof (stack[0]));
+     backtrace_symbols_fd (stack, len, 2);
+#endif
+     fsync (2);
+}
+
+static inline unsigned long vlc_threadid (void)
+{
+#if defined (__linux__)
+     /* glibc does not provide a call for this */
+     return syscall (SYS_gettid);
+
+#else
+     union { pthread_t th; unsigned long int i; } v = { };
+     v.th = pthread_self ();
+     return v.i;
+
+#endif
+}
+
+#ifndef NDEBUG
+/*****************************************************************************
+ * vlc_thread_fatal: Report an error from the threading layer
+ *****************************************************************************
+ * This is mostly meant for debugging.
+ *****************************************************************************/
+static void
+vlc_thread_fatal (const char *action, int error,
+                  const char *function, const char *file, unsigned line)
+{
+    fprintf (stderr, "LibVLC fatal error %s (%d) in thread %lu ",
+             action, error, vlc_threadid ());
+    vlc_trace (function, file, line);
+
+    /* Sometimes strerror_r() crashes too, so make sure we print an error
+     * message before we invoke it */
+#ifdef __GLIBC__
+    /* Avoid the strerror_r() prototype brain damage in glibc */
+    errno = error;
+    fprintf (stderr, " Error message: %m\n");
+#else
+    char buf[1000];
+    const char *msg;
+
+    switch (strerror_r (error, buf, sizeof (buf)))
+    {
+        case 0:
+            msg = buf;
+            break;
+        case ERANGE: /* should never happen */
+            msg = "unknwon (too big to display)";
+            break;
+        default:
+            msg = "unknown (invalid error number)";
+            break;
+    }
+    fprintf (stderr, " Error message: %s\n", msg);
+#endif
+    fflush (stderr);
+
+    abort ();
+}
+
+# define VLC_THREAD_ASSERT( action ) \
+    if (val) vlc_thread_fatal (action, val, __func__, __FILE__, __LINE__)
+#else
+# define VLC_THREAD_ASSERT( action ) ((void)val)
+#endif
+
+#if defined (__GLIBC__) && (__GLIBC_MINOR__ < 6)
+/* This is not prototyped under glibc, though it exists. */
+int pthread_mutexattr_setkind_np( pthread_mutexattr_t *attr, int kind );
+#endif
+
+/*****************************************************************************
+ * vlc_mutex_init: initialize a mutex
+ *****************************************************************************/
+int vlc_mutex_init( vlc_mutex_t *p_mutex )
+{
+    pthread_mutexattr_t attr;
+    int                 i_result;
+
+    pthread_mutexattr_init( &attr );
+
+#ifndef NDEBUG
+    /* Create error-checking mutex to detect problems more easily. */
+# if defined (__GLIBC__) && (__GLIBC_MINOR__ < 6)
+    pthread_mutexattr_setkind_np( &attr, PTHREAD_MUTEX_ERRORCHECK_NP );
+# else
+    pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_ERRORCHECK );
+# endif
+#endif
+    i_result = pthread_mutex_init( p_mutex, &attr );
+    pthread_mutexattr_destroy( &attr );
+    return i_result;
+}
+
+/*****************************************************************************
+ * vlc_mutex_init: initialize a recursive mutex (Do not use)
+ *****************************************************************************/
+int vlc_mutex_init_recursive( vlc_mutex_t *p_mutex )
+{
+    pthread_mutexattr_t attr;
+    int                 i_result;
+
+    pthread_mutexattr_init( &attr );
+#if defined (__GLIBC__) && (__GLIBC_MINOR__ < 6)
+    pthread_mutexattr_setkind_np( &attr, PTHREAD_MUTEX_RECURSIVE_NP );
+#else
+    pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
+#endif
+    i_result = pthread_mutex_init( p_mutex, &attr );
+    pthread_mutexattr_destroy( &attr );
+    return( i_result );
+}
+
+
+/**
+ * Destroys a mutex. The mutex must not be locked.
+ *
+ * @param p_mutex mutex to destroy
+ * @return always succeeds
+ */
+void vlc_mutex_destroy (vlc_mutex_t *p_mutex)
+{
+    int val = pthread_mutex_destroy( p_mutex );
+    VLC_THREAD_ASSERT ("destroying mutex");
+}
+
+#ifndef NDEBUG
+# ifdef HAVE_VALGRIND_VALGRIND_H
+#  include <valgrind/valgrind.h>
+# else
+#  define RUNNING_ON_VALGRIND (0)
+# endif
+
+void vlc_assert_locked (vlc_mutex_t *p_mutex)
+{
+    if (RUNNING_ON_VALGRIND > 0)
+        return;
+    assert (pthread_mutex_lock (p_mutex) == EDEADLK);
+}
+#endif
+
+/**
+ * Acquires a mutex. If needed, waits for any other thread to release it.
+ * Beware of deadlocks when locking multiple mutexes at the same time,
+ * or when using mutexes from callbacks.
+ * This function is not a cancellation-point.
+ *
+ * @param p_mutex mutex initialized with vlc_mutex_init() or
+ *                vlc_mutex_init_recursive()
+ */
+void vlc_mutex_lock (vlc_mutex_t *p_mutex)
+{
+    int val = pthread_mutex_lock( p_mutex );
+    VLC_THREAD_ASSERT ("locking mutex");
+}
+
+/**
+ * Acquires a mutex if and only if it is not currently held by another thread.
+ * This function never sleeps and can be used in delay-critical code paths.
+ * This function is not a cancellation-point.
+ *
+ * <b>Beware</b>: If this function fails, then the mutex is held... by another
+ * thread. The calling thread must deal with the error appropriately. That
+ * typically implies postponing the operations that would have required the
+ * mutex. If the thread cannot defer those operations, then it must use
+ * vlc_mutex_lock(). If in doubt, use vlc_mutex_lock() instead.
+ *
+ * @param p_mutex mutex initialized with vlc_mutex_init() or
+ *                vlc_mutex_init_recursive()
+ * @return 0 if the mutex could be acquired, an error code otherwise.
+ */
+int vlc_mutex_trylock (vlc_mutex_t *p_mutex)
+{
+    int val = pthread_mutex_trylock( p_mutex );
+
+    if (val != EBUSY)
+        VLC_THREAD_ASSERT ("locking mutex");
+    return val;
+}
+
+/**
+ * Releases a mutex (or crashes if the mutex is not locked by the caller).
+ * @param p_mutex mutex locked with vlc_mutex_lock().
+ */
+void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
+{
+    int val = pthread_mutex_unlock( p_mutex );
+    VLC_THREAD_ASSERT ("unlocking mutex");
+}
+
+/*****************************************************************************
+ * vlc_cond_init: initialize a condition variable
+ *****************************************************************************/
+int vlc_cond_init( vlc_cond_t *p_condvar )
+{
+    pthread_condattr_t attr;
+    int ret;
+
+    ret = pthread_condattr_init (&attr);
+    if (ret)
+        return ret;
+
+#if !defined (_POSIX_CLOCK_SELECTION)
+   /* Fairly outdated POSIX support (that was defined in 2001) */
+# define _POSIX_CLOCK_SELECTION (-1)
+#endif
+#if (_POSIX_CLOCK_SELECTION >= 0)
+    /* NOTE: This must be the same clock as the one in mtime.c */
+    pthread_condattr_setclock (&attr, CLOCK_MONOTONIC);
+#endif
+
+    ret = pthread_cond_init (p_condvar, &attr);
+    pthread_condattr_destroy (&attr);
+    return ret;
+}
+
+/**
+ * Destroys a condition variable. No threads shall be waiting or signaling the
+ * condition.
+ * @param p_condvar condition variable to destroy
+ */
+void vlc_cond_destroy (vlc_cond_t *p_condvar)
+{
+    int val = pthread_cond_destroy( p_condvar );
+    VLC_THREAD_ASSERT ("destroying condition");
+}
+
+/**
+ * Wakes up one thread waiting on a condition variable, if any.
+ * @param p_condvar condition variable
+ */
+void vlc_cond_signal (vlc_cond_t *p_condvar)
+{
+    int val = pthread_cond_signal( p_condvar );
+    VLC_THREAD_ASSERT ("signaling condition variable");
+}
+
+/**
+ * Wakes up all threads (if any) waiting on a condition variable.
+ * @param p_cond condition variable
+ */
+void vlc_cond_broadcast (vlc_cond_t *p_condvar)
+{
+    pthread_cond_broadcast (p_condvar);
+}
+
+/**
+ * Waits for a condition variable. The calling thread will be suspended until
+ * another thread calls vlc_cond_signal() or vlc_cond_broadcast() on the same
+ * condition variable, the thread is cancelled with vlc_cancel(), or the
+ * system causes a "spurious" unsolicited wake-up.
+ *
+ * A mutex is needed to wait on a condition variable. It must <b>not</b> be
+ * a recursive mutex. Although it is possible to use the same mutex for
+ * multiple condition, it is not valid to use different mutexes for the same
+ * condition variable at the same time from different threads.
+ *
+ * In case of thread cancellation, the mutex is always locked before
+ * cancellation proceeds.
+ *
+ * The canonical way to use a condition variable to wait for event foobar is:
+ @code
+   vlc_mutex_lock (&lock);
+   mutex_cleanup_push (&lock); // release the mutex in case of cancellation
+
+   while (!foobar)
+       vlc_cond_wait (&wait, &lock);
+
+   --- foobar is now true, do something about it here --
+
+   vlc_cleanup_run (); // release the mutex
+  @endcode
+ *
+ * @param p_condvar condition variable to wait on
+ * @param p_mutex mutex which is unlocked while waiting,
+ *                then locked again when waking up.
+ * @param deadline <b>absolute</b> timeout
+ *
+ * @return 0 if the condition was signaled, an error code in case of timeout.
+ */
+void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
+{
+    int val = pthread_cond_wait( p_condvar, p_mutex );
+    VLC_THREAD_ASSERT ("waiting on condition");
+}
+
+/**
+ * Waits for a condition variable up to a certain date.
+ * This works like vlc_cond_wait(), except for the additional timeout.
+ *
+ * @param p_condvar condition variable to wait on
+ * @param p_mutex mutex which is unlocked while waiting,
+ *                then locked again when waking up.
+ * @param deadline <b>absolute</b> timeout
+ *
+ * @return 0 if the condition was signaled, an error code in case of timeout.
+ */
+int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
+                        mtime_t deadline)
+{
+#ifdef __APPLE__
+    /* mdate() is mac_absolute_time on OSX, which we must convert to do
+     * the same base than gettimeofday() which pthread_cond_timedwait
+     * relies on. */
+    mtime_t oldbase = mdate();
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    mtime_t newbase = (mtime_t)tv.tv_sec * 1000000 + (mtime_t) tv.tv_usec;
+    deadline = deadline - oldbase + newbase;
+#endif
+    lldiv_t d = lldiv( deadline, CLOCK_FREQ );
+    struct timespec ts = { d.quot, d.rem * (1000000000 / CLOCK_FREQ) };
+
+    int val = pthread_cond_timedwait (p_condvar, p_mutex, &ts);
+    if (val != ETIMEDOUT)
+        VLC_THREAD_ASSERT ("timed-waiting on condition");
+    return val;
+}
+
+/**
+ * Allocates a thread-specific variable.
+ * @param key where to store the thread-specific variable handle
+ * @param destr a destruction callback. It is called whenever a thread exits
+ * and the thread-specific variable has a non-NULL value.
+ * @return 0 on success, a system error code otherwise. This function can
+ * actually fail because there is a fixed limit on the number of
+ * thread-specific variable in a process on most systems.
+ */
+int vlc_threadvar_create (vlc_threadvar_t *key, void (*destr) (void *))
+{
+    return pthread_key_create (key, destr);
+}
+
+void vlc_threadvar_delete (vlc_threadvar_t *p_tls)
+{
+    pthread_key_delete (*p_tls);
+}
+
+/**
+ * Sets a thread-specific variable.
+ * @param key thread-local variable key (created with vlc_threadvar_create())
+ * @param value new value for the variable for the calling thread
+ * @return 0 on success, a system error code otherwise.
+ */
+int vlc_threadvar_set (vlc_threadvar_t key, void *value)
+{
+    return pthread_setspecific (key, value);
+}
+
+/**
+ * Gets the value of a thread-local variable for the calling thread.
+ * This function cannot fail.
+ * @return the value associated with the given variable for the calling
+ * or NULL if there is no value.
+ */
+void *vlc_threadvar_get (vlc_threadvar_t key)
+{
+    return pthread_getspecific (key);
+}
+
+/**
+ * Creates and starts new thread.
+ *
+ * @param p_handle [OUT] pointer to write the handle of the created thread to
+ * @param entry entry point for the thread
+ * @param data data parameter given to the entry point
+ * @param priority thread priority value
+ * @return 0 on success, a standard error code on error.
+ */
+int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
+               int priority)
+{
+    int ret;
+
+    pthread_attr_t attr;
+    pthread_attr_init (&attr);
+
+    /* Block the signals that signals interface plugin handles.
+     * If the LibVLC caller wants to handle some signals by itself, it should
+     * block these before whenever invoking LibVLC. And it must obviously not
+     * start the VLC signals interface plugin.
+     *
+     * LibVLC will normally ignore any interruption caused by an asynchronous
+     * signal during a system call. But there may well be some buggy cases
+     * where it fails to handle EINTR (bug reports welcome). Some underlying
+     * libraries might also not handle EINTR properly.
+     */
+    sigset_t oldset;
+    {
+        sigset_t set;
+        sigemptyset (&set);
+        sigdelset (&set, SIGHUP);
+        sigaddset (&set, SIGINT);
+        sigaddset (&set, SIGQUIT);
+        sigaddset (&set, SIGTERM);
+
+        sigaddset (&set, SIGPIPE); /* We don't want this one, really! */
+        pthread_sigmask (SIG_BLOCK, &set, &oldset);
+    }
+
+#if defined (_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING >= 0) \
+ && defined (_POSIX_THREAD_PRIORITY_SCHEDULING) \
+ && (_POSIX_THREAD_PRIORITY_SCHEDULING >= 0)
+    {
+        struct sched_param sp = { .sched_priority = priority, };
+        int policy;
+
+        if (sp.sched_priority <= 0)
+            sp.sched_priority += sched_get_priority_max (policy = SCHED_OTHER);
+        else
+            sp.sched_priority += sched_get_priority_min (policy = SCHED_RR);
+
+        pthread_attr_setschedpolicy (&attr, policy);
+        pthread_attr_setschedparam (&attr, &sp);
+    }
+#else
+    (void) priority;
+#endif
+
+    /* The thread stack size.
+     * The lower the value, the less address space per thread, the highest
+     * maximum simultaneous threads per process. Too low values will cause
+     * stack overflows and weird crashes. Set with caution. Also keep in mind
+     * that 64-bits platforms consume more stack than 32-bits one.
+     *
+     * Thanks to on-demand paging, thread stack size only affects address space
+     * consumption. In terms of memory, threads only use what they need
+     * (rounded up to the page boundary).
+     *
+     * For example, on Linux i386, the default is 2 mega-bytes, which supports
+     * about 320 threads per processes. */
+#define VLC_STACKSIZE (128 * sizeof (void *) * 1024)
+
+#ifdef VLC_STACKSIZE
+    ret = pthread_attr_setstacksize (&attr, VLC_STACKSIZE);
+    assert (ret == 0); /* fails iif VLC_STACKSIZE is invalid */
+#endif
+
+    ret = pthread_create (p_handle, &attr, entry, data);
+    pthread_sigmask (SIG_SETMASK, &oldset, NULL);
+    pthread_attr_destroy (&attr);
+    return ret;
+}
+
+/**
+ * Marks a thread as cancelled. Next time the target thread reaches a
+ * cancellation point (while not having disabled cancellation), it will
+ * run its cancellation cleanup handler, the thread variable destructors, and
+ * terminate. vlc_join() must be used afterward regardless of a thread being
+ * cancelled or not.
+ */
+void vlc_cancel (vlc_thread_t thread_id)
+{
+    pthread_cancel (thread_id);
+}
+
+/**
+ * Waits for a thread to complete (if needed), and destroys it.
+ * This is a cancellation point; in case of cancellation, the join does _not_
+ * occur.
+ *
+ * @param handle thread handle
+ * @param p_result [OUT] pointer to write the thread return value or NULL
+ * @return 0 on success, a standard error code otherwise.
+ */
+void vlc_join (vlc_thread_t handle, void **result)
+{
+    int val = pthread_join (handle, result);
+    VLC_THREAD_ASSERT ("joining thread");
+}
+
+/**
+ * Save the current cancellation state (enabled or disabled), then disable
+ * cancellation for the calling thread.
+ * This function must be called before entering a piece of code that is not
+ * cancellation-safe, unless it can be proven that the calling thread will not
+ * be cancelled.
+ * @return Previous cancellation state (opaque value for vlc_restorecancel()).
+ */
+int vlc_savecancel (void)
+{
+    int state;
+    int val = pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
+
+    VLC_THREAD_ASSERT ("saving cancellation");
+    return state;
+}
+
+/**
+ * Restore the cancellation state for the calling thread.
+ * @param state previous state as returned by vlc_savecancel().
+ * @return Nothing, always succeeds.
+ */
+void vlc_restorecancel (int state)
+{
+#ifndef NDEBUG
+    int oldstate, val;
+
+    val = pthread_setcancelstate (state, &oldstate);
+    /* This should fail if an invalid value for given for state */
+    VLC_THREAD_ASSERT ("restoring cancellation");
+
+    if (oldstate != PTHREAD_CANCEL_DISABLE)
+         vlc_thread_fatal ("restoring cancellation while not disabled", EINVAL,
+                           __func__, __FILE__, __LINE__);
+#else
+    pthread_setcancelstate (state, NULL);
+#endif
+}
+
+/**
+ * Issues an explicit deferred cancellation point.
+ * This has no effect if thread cancellation is disabled.
+ * This can be called when there is a rather slow non-sleeping operation.
+ * This is also used to force a cancellation point in a function that would
+ * otherwise "not always" be a one (block_FifoGet() is an example).
+ */
+void vlc_testcancel (void)
+{
+    pthread_testcancel ();
+}
+
+void vlc_control_cancel (int cmd, ...)
+{
+    (void) cmd;
+    assert (0);
+}
index 149e761bb081df1fd8f173060dca356cf834c998..1999c9ec4c91725d82499c83ecd1f0786be4e1cd 100644 (file)
 #include <vlc_common.h>
 
 #include "libvlc.h"
-#include <stdarg.h>
 #include <assert.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-#include <signal.h>
 
 #if defined( LIBVLC_USE_PTHREAD )
 # include <sched.h>
-# ifdef __linux__
-#  include <sys/syscall.h> /* SYS_gettid */
-# endif
-#else
-static vlc_threadvar_t cancel_key;
-#endif
-
-#ifdef HAVE_EXECINFO_H
-# include <execinfo.h>
-#endif
-
-#ifdef __APPLE__
-# include <sys/time.h> /* gettimeofday in vlc_cond_timedwait */
-#endif
-
-/**
- * Print a backtrace to the standard error for debugging purpose.
- */
-void vlc_trace (const char *fn, const char *file, unsigned line)
-{
-     fprintf (stderr, "at %s:%u in %s\n", file, line, fn);
-     fflush (stderr); /* needed before switch to low-level I/O */
-#ifdef HAVE_BACKTRACE
-     void *stack[20];
-     int len = backtrace (stack, sizeof (stack) / sizeof (stack[0]));
-     backtrace_symbols_fd (stack, len, 2);
-#endif
-#ifndef WIN32
-     fsync (2);
-#endif
-}
-
-static inline unsigned long vlc_threadid (void)
-{
-#if defined (LIBVLC_USE_PTHREAD)
-# if defined (__linux__)
-     return syscall (SYS_gettid);
-
-# else
-     union { pthread_t th; unsigned long int i; } v = { };
-     v.th = pthread_self ();
-     return v.i;
-
-#endif
-#elif defined (WIN32)
-     return GetCurrentThreadId ();
-
-#else
-     return 0;
-
-#endif
-}
-
-#ifndef NDEBUG
-/*****************************************************************************
- * vlc_thread_fatal: Report an error from the threading layer
- *****************************************************************************
- * This is mostly meant for debugging.
- *****************************************************************************/
-static void
-vlc_thread_fatal (const char *action, int error,
-                  const char *function, const char *file, unsigned line)
-{
-    fprintf (stderr, "LibVLC fatal error %s (%d) in thread %lu ",
-             action, error, vlc_threadid ());
-    vlc_trace (function, file, line);
-
-    /* Sometimes strerror_r() crashes too, so make sure we print an error
-     * message before we invoke it */
-#ifdef __GLIBC__
-    /* Avoid the strerror_r() prototype brain damage in glibc */
-    errno = error;
-    fprintf (stderr, " Error message: %m\n");
-#elif !defined (WIN32)
-    char buf[1000];
-    const char *msg;
-
-    switch (strerror_r (error, buf, sizeof (buf)))
-    {
-        case 0:
-            msg = buf;
-            break;
-        case ERANGE: /* should never happen */
-            msg = "unknwon (too big to display)";
-            break;
-        default:
-            msg = "unknown (invalid error number)";
-            break;
-    }
-    fprintf (stderr, " Error message: %s\n", msg);
-#endif
-    fflush (stderr);
-
-    abort ();
-}
-
-# define VLC_THREAD_ASSERT( action ) \
-    if (val) vlc_thread_fatal (action, val, __func__, __FILE__, __LINE__)
-#else
-# define VLC_THREAD_ASSERT( action ) ((void)val)
-#endif
-
-/**
- * Per-thread cancellation data
- */
-#ifndef LIBVLC_USE_PTHREAD_CANCEL
-typedef struct vlc_cancel_t
-{
-    vlc_cleanup_t *cleaners;
-    bool           killable;
-    bool           killed;
-# ifdef UNDER_CE
-    HANDLE         cancel_event;
-# endif
-} vlc_cancel_t;
-
-# ifndef UNDER_CE
-#  define VLC_CANCEL_INIT { NULL, true, false }
-# else
-#  define VLC_CANCEL_INIT { NULL, true, false, NULL }
-# endif
-#endif
-
-#ifdef UNDER_CE
-static void CALLBACK vlc_cancel_self (ULONG_PTR dummy);
-
-static DWORD vlc_cancelable_wait (DWORD count, const HANDLE *handles,
-                                  DWORD delay)
-{
-    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
-    if (nfo == NULL)
-    {
-        /* Main thread - cannot be cancelled anyway */
-        return WaitForMultipleObjects (count, handles, FALSE, delay);
-    }
-    HANDLE new_handles[count + 1];
-    memcpy(new_handles, handles, count * sizeof(HANDLE));
-    new_handles[count] = nfo->cancel_event;
-    DWORD result = WaitForMultipleObjects (count + 1, new_handles, FALSE,
-                                           delay);
-    if (result == WAIT_OBJECT_0 + count)
-    {
-        vlc_cancel_self (NULL);
-        return WAIT_IO_COMPLETION;
-    }
-    else
-    {
-        return result;
-    }
-}
-
-DWORD SleepEx (DWORD dwMilliseconds, BOOL bAlertable)
-{
-    if (bAlertable)
-    {
-        DWORD result = vlc_cancelable_wait (0, NULL, dwMilliseconds);
-        return (result == WAIT_TIMEOUT) ? 0 : WAIT_IO_COMPLETION;
-    }
-    else
-    {
-        Sleep(dwMilliseconds);
-        return 0;
-    }
-}
-
-DWORD WaitForSingleObjectEx (HANDLE hHandle, DWORD dwMilliseconds,
-                             BOOL bAlertable)
-{
-    if (bAlertable)
-    {
-        /* The MSDN documentation specifies different return codes,
-         * but in practice they are the same. We just check that it
-         * remains so. */
-#if WAIT_ABANDONED != WAIT_ABANDONED_0
-# error Windows headers changed, code needs to be rewritten!
-#endif
-        return vlc_cancelable_wait (1, &hHandle, dwMilliseconds);
-    }
-    else
-    {
-        return WaitForSingleObject (hHandle, dwMilliseconds);
-    }
-}
-
-DWORD WaitForMultipleObjectsEx (DWORD nCount, const HANDLE *lpHandles,
-                                BOOL bWaitAll, DWORD dwMilliseconds,
-                                BOOL bAlertable)
-{
-    if (bAlertable)
-    {
-        /* We do not support the bWaitAll case */
-        assert (! bWaitAll);
-        return vlc_cancelable_wait (nCount, lpHandles, dwMilliseconds);
-    }
-    else
-    {
-        return WaitForMultipleObjects (nCount, lpHandles, bWaitAll,
-                                       dwMilliseconds);
-    }
-}
-#endif
-
-#ifdef WIN32
-static vlc_mutex_t super_mutex;
-
-BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
-{
-    (void) hinstDll;
-    (void) lpvReserved;
-
-    switch (fdwReason)
-    {
-        case DLL_PROCESS_ATTACH:
-            vlc_mutex_init (&super_mutex);
-            vlc_threadvar_create (&cancel_key, free);
-            break;
-
-        case DLL_PROCESS_DETACH:
-            vlc_threadvar_delete( &cancel_key );
-            vlc_mutex_destroy (&super_mutex);
-            break;
-    }
-    return TRUE;
-}
-#endif
-
-#if defined (__GLIBC__) && (__GLIBC_MINOR__ < 6)
-/* This is not prototyped under glibc, though it exists. */
-int pthread_mutexattr_setkind_np( pthread_mutexattr_t *attr, int kind );
-#endif
-
-/*****************************************************************************
- * vlc_mutex_init: initialize a mutex
- *****************************************************************************/
-int vlc_mutex_init( vlc_mutex_t *p_mutex )
-{
-#if defined( LIBVLC_USE_PTHREAD )
-    pthread_mutexattr_t attr;
-    int                 i_result;
-
-    pthread_mutexattr_init( &attr );
-
-# ifndef NDEBUG
-    /* Create error-checking mutex to detect problems more easily. */
-#  if defined (__GLIBC__) && (__GLIBC_MINOR__ < 6)
-    pthread_mutexattr_setkind_np( &attr, PTHREAD_MUTEX_ERRORCHECK_NP );
-#  else
-    pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_ERRORCHECK );
-#  endif
-# endif
-    i_result = pthread_mutex_init( p_mutex, &attr );
-    pthread_mutexattr_destroy( &attr );
-    return i_result;
-
-#elif defined( WIN32 )
-    /* This creates a recursive mutex. This is OK as fast mutexes have
-     * no defined behavior in case of recursive locking. */
-    InitializeCriticalSection (&p_mutex->mutex);
-    p_mutex->initialized = 1;
-    return 0;
-
-#endif
-}
-
-/*****************************************************************************
- * vlc_mutex_init: initialize a recursive mutex (Do not use)
- *****************************************************************************/
-int vlc_mutex_init_recursive( vlc_mutex_t *p_mutex )
-{
-#if defined( LIBVLC_USE_PTHREAD )
-    pthread_mutexattr_t attr;
-    int                 i_result;
-
-    pthread_mutexattr_init( &attr );
-#  if defined (__GLIBC__) && (__GLIBC_MINOR__ < 6)
-    pthread_mutexattr_setkind_np( &attr, PTHREAD_MUTEX_RECURSIVE_NP );
-#  else
-    pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
-#  endif
-    i_result = pthread_mutex_init( p_mutex, &attr );
-    pthread_mutexattr_destroy( &attr );
-    return( i_result );
-
-#elif defined( WIN32 )
-    InitializeCriticalSection( &p_mutex->mutex );
-    p_mutex->initialized = 1;
-    return 0;
-
-#endif
-}
-
-
-/**
- * Destroys a mutex. The mutex must not be locked.
- *
- * @param p_mutex mutex to destroy
- * @return always succeeds
- */
-void vlc_mutex_destroy (vlc_mutex_t *p_mutex)
-{
-#if defined( LIBVLC_USE_PTHREAD )
-    int val = pthread_mutex_destroy( p_mutex );
-    VLC_THREAD_ASSERT ("destroying mutex");
-
-#elif defined( WIN32 )
-    assert (InterlockedExchange (&p_mutex->initialized, -1) == 1);
-    DeleteCriticalSection (&p_mutex->mutex);
-
-#endif
-}
-
-#if defined(LIBVLC_USE_PTHREAD) && !defined(NDEBUG)
-# ifdef HAVE_VALGRIND_VALGRIND_H
-#  include <valgrind/valgrind.h>
-# else
-#  define RUNNING_ON_VALGRIND (0)
-# endif
-
-void vlc_assert_locked (vlc_mutex_t *p_mutex)
-{
-    if (RUNNING_ON_VALGRIND > 0)
-        return;
-    assert (pthread_mutex_lock (p_mutex) == EDEADLK);
-}
-#endif
-
-/**
- * Acquires a mutex. If needed, waits for any other thread to release it.
- * Beware of deadlocks when locking multiple mutexes at the same time,
- * or when using mutexes from callbacks.
- * This function is not a cancellation-point.
- *
- * @param p_mutex mutex initialized with vlc_mutex_init() or
- *                vlc_mutex_init_recursive()
- */
-void vlc_mutex_lock (vlc_mutex_t *p_mutex)
-{
-#if defined(LIBVLC_USE_PTHREAD)
-    int val = pthread_mutex_lock( p_mutex );
-    VLC_THREAD_ASSERT ("locking mutex");
-
-#elif defined( WIN32 )
-    if (InterlockedCompareExchange (&p_mutex->initialized, 0, 0) == 0)
-    { /* ^^ We could also lock super_mutex all the time... sluggish */
-        assert (p_mutex != &super_mutex); /* this one cannot be static */
-
-        vlc_mutex_lock (&super_mutex);
-        if (InterlockedCompareExchange (&p_mutex->initialized, 0, 0) == 0)
-            vlc_mutex_init (p_mutex);
-        /* FIXME: destroy the mutex some time... */
-        vlc_mutex_unlock (&super_mutex);
-    }
-    assert (InterlockedExchange (&p_mutex->initialized, 1) == 1);
-    EnterCriticalSection (&p_mutex->mutex);
-
-#endif
-}
-
-/**
- * Acquires a mutex if and only if it is not currently held by another thread.
- * This function never sleeps and can be used in delay-critical code paths.
- * This function is not a cancellation-point.
- *
- * <b>Beware</b>: If this function fails, then the mutex is held... by another
- * thread. The calling thread must deal with the error appropriately. That
- * typically implies postponing the operations that would have required the
- * mutex. If the thread cannot defer those operations, then it must use
- * vlc_mutex_lock(). If in doubt, use vlc_mutex_lock() instead.
- *
- * @param p_mutex mutex initialized with vlc_mutex_init() or
- *                vlc_mutex_init_recursive()
- * @return 0 if the mutex could be acquired, an error code otherwise.
- */
-int vlc_mutex_trylock (vlc_mutex_t *p_mutex)
-{
-#if defined(LIBVLC_USE_PTHREAD)
-    int val = pthread_mutex_trylock( p_mutex );
-
-    if (val != EBUSY)
-        VLC_THREAD_ASSERT ("locking mutex");
-    return val;
-
-#elif defined( WIN32 )
-    if (InterlockedCompareExchange (&p_mutex->initialized, 0, 0) == 0)
-    { /* ^^ We could also lock super_mutex all the time... sluggish */
-        assert (p_mutex != &super_mutex); /* this one cannot be static */
-
-        vlc_mutex_lock (&super_mutex);
-        if (InterlockedCompareExchange (&p_mutex->initialized, 0, 0) == 0)
-            vlc_mutex_init (p_mutex);
-        /* FIXME: destroy the mutex some time... */
-        vlc_mutex_unlock (&super_mutex);
-    }
-    assert (InterlockedExchange (&p_mutex->initialized, 1) == 1);
-    return TryEnterCriticalSection (&p_mutex->mutex) ? 0 : EBUSY;
-
-#endif
-}
-
-/**
- * Releases a mutex (or crashes if the mutex is not locked by the caller).
- * @param p_mutex mutex locked with vlc_mutex_lock().
- */
-void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
-{
-#if defined(LIBVLC_USE_PTHREAD)
-    int val = pthread_mutex_unlock( p_mutex );
-    VLC_THREAD_ASSERT ("unlocking mutex");
-
-#elif defined( WIN32 )
-    assert (InterlockedExchange (&p_mutex->initialized, 1) == 1);
-    LeaveCriticalSection (&p_mutex->mutex);
-
-#endif
-}
-
-/*****************************************************************************
- * vlc_cond_init: initialize a condition variable
- *****************************************************************************/
-int vlc_cond_init( vlc_cond_t *p_condvar )
-{
-#if defined( LIBVLC_USE_PTHREAD )
-    pthread_condattr_t attr;
-    int ret;
-
-    ret = pthread_condattr_init (&attr);
-    if (ret)
-        return ret;
-
-# if !defined (_POSIX_CLOCK_SELECTION)
-   /* Fairly outdated POSIX support (that was defined in 2001) */
-#  define _POSIX_CLOCK_SELECTION (-1)
-# endif
-# if (_POSIX_CLOCK_SELECTION >= 0)
-    /* NOTE: This must be the same clock as the one in mtime.c */
-    pthread_condattr_setclock (&attr, CLOCK_MONOTONIC);
-# endif
-
-    ret = pthread_cond_init (p_condvar, &attr);
-    pthread_condattr_destroy (&attr);
-    return ret;
-
-#elif defined( WIN32 )
-    /* Create a manual-reset event (manual reset is needed for broadcast). */
-    *p_condvar = CreateEvent( NULL, TRUE, FALSE, NULL );
-    return *p_condvar ? 0 : ENOMEM;
-
-#endif
-}
-
-/**
- * Destroys a condition variable. No threads shall be waiting or signaling the
- * condition.
- * @param p_condvar condition variable to destroy
- */
-void vlc_cond_destroy (vlc_cond_t *p_condvar)
-{
-#if defined( LIBVLC_USE_PTHREAD )
-    int val = pthread_cond_destroy( p_condvar );
-    VLC_THREAD_ASSERT ("destroying condition");
-
-#elif defined( WIN32 )
-    CloseHandle( *p_condvar );
-
-#endif
-}
-
-/**
- * Wakes up one thread waiting on a condition variable, if any.
- * @param p_condvar condition variable
- */
-void vlc_cond_signal (vlc_cond_t *p_condvar)
-{
-#if defined(LIBVLC_USE_PTHREAD)
-    int val = pthread_cond_signal( p_condvar );
-    VLC_THREAD_ASSERT ("signaling condition variable");
-
-#elif defined( WIN32 )
-    /* NOTE: This will cause a broadcast, that is wrong.
-     * This will also wake up the next waiting thread if no thread are yet
-     * waiting, which is also wrong. However both of these issues are allowed
-     * by the provision for spurious wakeups. Better have too many wakeups
-     * than too few (= deadlocks). */
-    SetEvent (*p_condvar);
-
-#endif
-}
-
-/**
- * Wakes up all threads (if any) waiting on a condition variable.
- * @param p_cond condition variable
- */
-void vlc_cond_broadcast (vlc_cond_t *p_condvar)
-{
-#if defined (LIBVLC_USE_PTHREAD)
-    pthread_cond_broadcast (p_condvar);
-
-#elif defined (WIN32)
-    SetEvent (*p_condvar);
-
-#endif
-}
-
-/**
- * Waits for a condition variable. The calling thread will be suspended until
- * another thread calls vlc_cond_signal() or vlc_cond_broadcast() on the same
- * condition variable, the thread is cancelled with vlc_cancel(), or the
- * system causes a "spurious" unsolicited wake-up.
- *
- * A mutex is needed to wait on a condition variable. It must <b>not</b> be
- * a recursive mutex. Although it is possible to use the same mutex for
- * multiple condition, it is not valid to use different mutexes for the same
- * condition variable at the same time from different threads.
- *
- * In case of thread cancellation, the mutex is always locked before
- * cancellation proceeds.
- *
- * The canonical way to use a condition variable to wait for event foobar is:
- @code
-   vlc_mutex_lock (&lock);
-   mutex_cleanup_push (&lock); // release the mutex in case of cancellation
-
-   while (!foobar)
-       vlc_cond_wait (&wait, &lock);
-
-   --- foobar is now true, do something about it here --
-
-   vlc_cleanup_run (); // release the mutex
-  @endcode
- *
- * @param p_condvar condition variable to wait on
- * @param p_mutex mutex which is unlocked while waiting,
- *                then locked again when waking up.
- * @param deadline <b>absolute</b> timeout
- *
- * @return 0 if the condition was signaled, an error code in case of timeout.
- */
-void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
-{
-#if defined(LIBVLC_USE_PTHREAD)
-    int val = pthread_cond_wait( p_condvar, p_mutex );
-    VLC_THREAD_ASSERT ("waiting on condition");
-
-#elif defined( WIN32 )
-    DWORD result;
-
-    do
-    {
-        vlc_testcancel ();
-        LeaveCriticalSection (&p_mutex->mutex);
-        result = WaitForSingleObjectEx (*p_condvar, INFINITE, TRUE);
-        EnterCriticalSection (&p_mutex->mutex);
-    }
-    while (result == WAIT_IO_COMPLETION);
-
-    assert (result != WAIT_ABANDONED); /* another thread failed to cleanup! */
-    assert (result != WAIT_FAILED);
-    ResetEvent (*p_condvar);
-
-#endif
-}
-
-/**
- * Waits for a condition variable up to a certain date.
- * This works like vlc_cond_wait(), except for the additional timeout.
- *
- * @param p_condvar condition variable to wait on
- * @param p_mutex mutex which is unlocked while waiting,
- *                then locked again when waking up.
- * @param deadline <b>absolute</b> timeout
- *
- * @return 0 if the condition was signaled, an error code in case of timeout.
- */
-int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
-                        mtime_t deadline)
-{
-#if defined(LIBVLC_USE_PTHREAD)
-#ifdef __APPLE__
-    /* mdate() is mac_absolute_time on osx, which we must convert to do
-     * the same base than gettimeofday() on which pthread_cond_timedwait
-     * counts on. */
-    mtime_t oldbase = mdate();
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    mtime_t newbase = (mtime_t)tv.tv_sec * 1000000 + (mtime_t) tv.tv_usec;
-    deadline = deadline - oldbase + newbase;
-#endif
-    lldiv_t d = lldiv( deadline, CLOCK_FREQ );
-    struct timespec ts = { d.quot, d.rem * (1000000000 / CLOCK_FREQ) };
-
-    int val = pthread_cond_timedwait (p_condvar, p_mutex, &ts);
-    if (val != ETIMEDOUT)
-        VLC_THREAD_ASSERT ("timed-waiting on condition");
-    return val;
-
-#elif defined( WIN32 )
-    DWORD result;
-
-    do
-    {
-        vlc_testcancel ();
-
-        mtime_t total = (deadline - mdate ())/1000;
-        if( total < 0 )
-            total = 0;
-
-        DWORD delay = (total > 0x7fffffff) ? 0x7fffffff : total;
-        LeaveCriticalSection (&p_mutex->mutex);
-        result = WaitForSingleObjectEx (*p_condvar, delay, TRUE);
-        EnterCriticalSection (&p_mutex->mutex);
-    }
-    while (result == WAIT_IO_COMPLETION);
-
-    assert (result != WAIT_ABANDONED);
-    assert (result != WAIT_FAILED);
-    ResetEvent (*p_condvar);
-
-    return (result == WAIT_OBJECT_0) ? 0 : ETIMEDOUT;
-
-#endif
-}
-
-/*****************************************************************************
- * vlc_tls_create: create a thread-local variable
- *****************************************************************************/
-int vlc_threadvar_create( vlc_threadvar_t *p_tls, void (*destr) (void *) )
-{
-    int i_ret;
-
-#if defined( LIBVLC_USE_PTHREAD )
-    i_ret =  pthread_key_create( p_tls, destr );
-#elif defined( WIN32 )
-    /* FIXME: remember/use the destr() callback and stop leaking whatever */
-    *p_tls = TlsAlloc();
-    i_ret = (*p_tls == TLS_OUT_OF_INDEXES) ? EAGAIN : 0;
-#else
-# error Unimplemented!
-#endif
-    return i_ret;
-}
-
-void vlc_threadvar_delete (vlc_threadvar_t *p_tls)
-{
-#if defined( LIBVLC_USE_PTHREAD )
-    pthread_key_delete (*p_tls);
-#elif defined( WIN32 )
-    TlsFree (*p_tls);
-#else
-# error Unimplemented!
-#endif
-}
-
-/**
- * Sets a thread-local variable.
- * @param key thread-local variable key (created with vlc_threadvar_create())
- * @param value new value for the variable for the calling thread
- * @return 0 on success, a system error code otherwise.
- */
-int vlc_threadvar_set (vlc_threadvar_t key, void *value)
-{
-#if defined(LIBVLC_USE_PTHREAD)
-    return pthread_setspecific (key, value);
-#elif defined( UNDER_CE ) || defined( WIN32 )
-    return TlsSetValue (key, value) ? ENOMEM : 0;
-#else
-# error Unimplemented!
-#endif
-}
-
-/**
- * Gets the value of a thread-local variable for the calling thread.
- * This function cannot fail.
- * @return the value associated with the given variable for the calling
- * or NULL if there is no value.
- */
-void *vlc_threadvar_get (vlc_threadvar_t key)
-{
-#if defined(LIBVLC_USE_PTHREAD)
-    return pthread_getspecific (key);
-#elif defined( UNDER_CE ) || defined( WIN32 )
-    return TlsGetValue (key);
-#else
-# error Unimplemented!
-#endif
-}
-
-#if defined (LIBVLC_USE_PTHREAD)
-#elif defined (WIN32)
-static unsigned __stdcall vlc_entry (void *data)
-{
-    vlc_cancel_t cancel_data = VLC_CANCEL_INIT;
-    vlc_thread_t self = data;
-#ifdef UNDER_CE
-    cancel_data.cancel_event = self->cancel_event;
-#endif
-
-    vlc_threadvar_set (cancel_key, &cancel_data);
-    self->data = self->entry (self->data);
-    return 0;
-}
-#endif
-
-/**
- * Creates and starts new thread.
- *
- * @param p_handle [OUT] pointer to write the handle of the created thread to
- * @param entry entry point for the thread
- * @param data data parameter given to the entry point
- * @param priority thread priority value
- * @return 0 on success, a standard error code on error.
- */
-int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
-               int priority)
-{
-    int ret;
-
-#if defined( LIBVLC_USE_PTHREAD )
-    pthread_attr_t attr;
-    pthread_attr_init (&attr);
-
-    /* Block the signals that signals interface plugin handles.
-     * If the LibVLC caller wants to handle some signals by itself, it should
-     * block these before whenever invoking LibVLC. And it must obviously not
-     * start the VLC signals interface plugin.
-     *
-     * LibVLC will normally ignore any interruption caused by an asynchronous
-     * signal during a system call. But there may well be some buggy cases
-     * where it fails to handle EINTR (bug reports welcome). Some underlying
-     * libraries might also not handle EINTR properly.
-     */
-    sigset_t oldset;
-    {
-        sigset_t set;
-        sigemptyset (&set);
-        sigdelset (&set, SIGHUP);
-        sigaddset (&set, SIGINT);
-        sigaddset (&set, SIGQUIT);
-        sigaddset (&set, SIGTERM);
-
-        sigaddset (&set, SIGPIPE); /* We don't want this one, really! */
-        pthread_sigmask (SIG_BLOCK, &set, &oldset);
-    }
-
-#if defined (_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING >= 0) \
- && defined (_POSIX_THREAD_PRIORITY_SCHEDULING) \
- && (_POSIX_THREAD_PRIORITY_SCHEDULING >= 0)
-    {
-        struct sched_param sp = { .sched_priority = priority, };
-        int policy;
-
-        if (sp.sched_priority <= 0)
-            sp.sched_priority += sched_get_priority_max (policy = SCHED_OTHER);
-        else
-            sp.sched_priority += sched_get_priority_min (policy = SCHED_RR);
-
-        pthread_attr_setschedpolicy (&attr, policy);
-        pthread_attr_setschedparam (&attr, &sp);
-    }
-#else
-    (void) priority;
-#endif
-
-    /* The thread stack size.
-     * The lower the value, the less address space per thread, the highest
-     * maximum simultaneous threads per process. Too low values will cause
-     * stack overflows and weird crashes. Set with caution. Also keep in mind
-     * that 64-bits platforms consume more stack than 32-bits one.
-     *
-     * Thanks to on-demand paging, thread stack size only affects address space
-     * consumption. In terms of memory, threads only use what they need
-     * (rounded up to the page boundary).
-     *
-     * For example, on Linux i386, the default is 2 mega-bytes, which supports
-     * about 320 threads per processes. */
-#define VLC_STACKSIZE (128 * sizeof (void *) * 1024)
-
-#ifdef VLC_STACKSIZE
-    ret = pthread_attr_setstacksize (&attr, VLC_STACKSIZE);
-    assert (ret == 0); /* fails iif VLC_STACKSIZE is invalid */
-#endif
-
-    ret = pthread_create (p_handle, &attr, entry, data);
-    pthread_sigmask (SIG_SETMASK, &oldset, NULL);
-    pthread_attr_destroy (&attr);
-
-#elif defined( WIN32 ) || defined( UNDER_CE )
-    /* When using the MSVCRT C library you have to use the _beginthreadex
-     * function instead of CreateThread, otherwise you'll end up with
-     * memory leaks and the signal functions not working (see Microsoft
-     * Knowledge Base, article 104641) */
-    HANDLE hThread;
-    vlc_thread_t th = malloc (sizeof (*th));
-
-    if (th == NULL)
-        return ENOMEM;
-
-    th->data = data;
-    th->entry = entry;
-#if defined( UNDER_CE )
-    th->cancel_event = CreateEvent (NULL, FALSE, FALSE, NULL);
-    if (th->cancel_event == NULL)
-    {
-        free(th);
-        return errno;
-    }
-    hThread = CreateThread (NULL, 128*1024, vlc_entry, th, CREATE_SUSPENDED, NULL);
-#else
-    hThread = (HANDLE)(uintptr_t)
-        _beginthreadex (NULL, 0, vlc_entry, th, CREATE_SUSPENDED, NULL);
-#endif
-
-    if (hThread)
-    {
-#ifndef UNDER_CE
-        /* Thread closes the handle when exiting, duplicate it here
-         * to be on the safe side when joining. */
-        if (!DuplicateHandle (GetCurrentProcess (), hThread,
-                              GetCurrentProcess (), &th->handle, 0, FALSE,
-                              DUPLICATE_SAME_ACCESS))
-        {
-            CloseHandle (hThread);
-            free (th);
-            return ENOMEM;
-        }
-#else
-        th->handle = hThread;
-#endif
-
-        ResumeThread (hThread);
-        if (priority)
-            SetThreadPriority (hThread, priority);
-
-        ret = 0;
-        *p_handle = th;
-    }
-    else
-    {
-        ret = errno;
-        free (th);
-    }
-
-#endif
-    return ret;
-}
-
-#if defined (WIN32)
-/* APC procedure for thread cancellation */
-static void CALLBACK vlc_cancel_self (ULONG_PTR dummy)
-{
-    (void)dummy;
-    vlc_control_cancel (VLC_DO_CANCEL);
-}
-#endif
-
-/**
- * Marks a thread as cancelled. Next time the target thread reaches a
- * cancellation point (while not having disabled cancellation), it will
- * run its cancellation cleanup handler, the thread variable destructors, and
- * terminate. vlc_join() must be used afterward regardless of a thread being
- * cancelled or not.
- */
-void vlc_cancel (vlc_thread_t thread_id)
-{
-#if defined (LIBVLC_USE_PTHREAD_CANCEL)
-    pthread_cancel (thread_id);
-#elif defined (UNDER_CE)
-    SetEvent (thread_id->cancel_event);
-#elif defined (WIN32)
-    QueueUserAPC (vlc_cancel_self, thread_id->handle, 0);
-#else
-#   warning vlc_cancel is not implemented!
-#endif
-}
-
-/**
- * Waits for a thread to complete (if needed), and destroys it.
- * This is a cancellation point; in case of cancellation, the join does _not_
- * occur.
- *
- * @param handle thread handle
- * @param p_result [OUT] pointer to write the thread return value or NULL
- * @return 0 on success, a standard error code otherwise.
- */
-void vlc_join (vlc_thread_t handle, void **result)
-{
-#if defined( LIBVLC_USE_PTHREAD )
-    int val = pthread_join (handle, result);
-    VLC_THREAD_ASSERT ("joining thread");
-
-#elif defined( UNDER_CE ) || defined( WIN32 )
-    do
-        vlc_testcancel ();
-    while (WaitForSingleObjectEx (handle->handle, INFINITE, TRUE)
-                                                        == WAIT_IO_COMPLETION);
-
-    CloseHandle (handle->handle);
-    if (result)
-        *result = handle->data;
-#if defined( UNDER_CE )
-    CloseHandle (handle->cancel_event);
-#endif
-    free (handle);
-
-#endif
-}
-
-/**
- * Save the current cancellation state (enabled or disabled), then disable
- * cancellation for the calling thread.
- * This function must be called before entering a piece of code that is not
- * cancellation-safe, unless it can be proven that the calling thread will not
- * be cancelled.
- * @return Previous cancellation state (opaque value for vlc_restorecancel()).
- */
-int vlc_savecancel (void)
-{
-    int state;
-
-#if defined (LIBVLC_USE_PTHREAD_CANCEL)
-    int val = pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
-    VLC_THREAD_ASSERT ("saving cancellation");
-
-#else
-    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
-    if (nfo == NULL)
-        return false; /* Main thread - cannot be cancelled anyway */
-
-     state = nfo->killable;
-     nfo->killable = false;
-
-#endif
-    return state;
-}
-
-/**
- * Restore the cancellation state for the calling thread.
- * @param state previous state as returned by vlc_savecancel().
- * @return Nothing, always succeeds.
- */
-void vlc_restorecancel (int state)
-{
-#if defined (LIBVLC_USE_PTHREAD_CANCEL)
-# ifndef NDEBUG
-    int oldstate, val;
-
-    val = pthread_setcancelstate (state, &oldstate);
-    /* This should fail if an invalid value for given for state */
-    VLC_THREAD_ASSERT ("restoring cancellation");
-
-    if (oldstate != PTHREAD_CANCEL_DISABLE)
-         vlc_thread_fatal ("restoring cancellation while not disabled", EINVAL,
-                           __func__, __FILE__, __LINE__);
-# else
-    pthread_setcancelstate (state, NULL);
-# endif
-
-#else
-    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
-    assert (state == false || state == true);
-
-    if (nfo == NULL)
-        return; /* Main thread - cannot be cancelled anyway */
-
-    assert (!nfo->killable);
-    nfo->killable = state != 0;
-
 #endif
-}
-
-/**
- * Issues an explicit deferred cancellation point.
- * This has no effect if thread cancellation is disabled.
- * This can be called when there is a rather slow non-sleeping operation.
- * This is also used to force a cancellation point in a function that would
- * otherwise "not always" be a one (block_FifoGet() is an example).
- */
-void vlc_testcancel (void)
-{
-#if defined (LIBVLC_USE_PTHREAD_CANCEL)
-    pthread_testcancel ();
-
-#else
-    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
-    if (nfo == NULL)
-        return; /* Main thread - cannot be cancelled anyway */
-
-    if (nfo->killable && nfo->killed)
-    {
-        for (vlc_cleanup_t *p = nfo->cleaners; p != NULL; p = p->next)
-             p->proc (p->data);
-# if defined (LIBVLC_USE_PTHREAD)
-        pthread_exit (PTHREAD_CANCELLED);
-# elif defined (UNDER_CE)
-        ExitThread(0);
-# elif defined (WIN32)
-        _endthread ();
-# else
-#  error Not implemented!
-# endif
-    }
-#endif
-}
 
 
 struct vlc_thread_boot
@@ -1248,55 +245,3 @@ void vlc_thread_cancel (vlc_object_t *obj)
     if (priv->b_thread)
         vlc_cancel (priv->thread_id);
 }
-
-void vlc_control_cancel (int cmd, ...)
-{
-    /* NOTE: This function only modifies thread-specific data, so there is no
-     * need to lock anything. */
-#ifdef LIBVLC_USE_PTHREAD_CANCEL
-    (void) cmd;
-    assert (0);
-#else
-    va_list ap;
-
-    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
-    if (nfo == NULL)
-    {
-#ifdef WIN32
-        /* Main thread - cannot be cancelled anyway */
-        return;
-#else
-        nfo = malloc (sizeof (*nfo));
-        if (nfo == NULL)
-            return; /* Uho! Expect problems! */
-        *nfo = VLC_CANCEL_INIT;
-        vlc_threadvar_set (cancel_key, nfo);
-#endif
-    }
-
-    va_start (ap, cmd);
-    switch (cmd)
-    {
-        case VLC_DO_CANCEL:
-            nfo->killed = true;
-            break;
-
-        case VLC_CLEANUP_PUSH:
-        {
-            /* cleaner is a pointer to the caller stack, no need to allocate
-             * and copy anything. As a nice side effect, this cannot fail. */
-            vlc_cleanup_t *cleaner = va_arg (ap, vlc_cleanup_t *);
-            cleaner->next = nfo->cleaners;
-            nfo->cleaners = cleaner;
-            break;
-        }
-
-        case VLC_CLEANUP_POP:
-        {
-            nfo->cleaners = nfo->cleaners->next;
-            break;
-        }
-    }
-    va_end (ap);
-#endif
-}
diff --git a/src/misc/w32thread.c b/src/misc/w32thread.c
new file mode 100644 (file)
index 0000000..a62e530
--- /dev/null
@@ -0,0 +1,513 @@
+/*****************************************************************************
+ * w32thread.c : Win32 back-end for LibVLC
+ *****************************************************************************
+ * Copyright (C) 1999-2009 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
+ *          Samuel Hocevar <sam@zoy.org>
+ *          Gildas Bazin <gbazin@netcourrier.com>
+ *          Clément Sténac
+ *          Rémi Denis-Courmont
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+
+#include "libvlc.h"
+#include <stdarg.h>
+#include <assert.h>
+
+static vlc_threadvar_t cancel_key;
+
+/**
+ * Per-thread cancellation data
+ */
+typedef struct vlc_cancel_t
+{
+    vlc_cleanup_t *cleaners;
+#ifdef UNDER_CE
+    HANDLE         cancel_event;
+#endif
+    bool           killable;
+    bool           killed;
+} vlc_cancel_t;
+
+#ifndef UNDER_CE
+# define VLC_CANCEL_INIT { NULL, true, false }
+#else
+# define VLC_CANCEL_INIT { NULL, NULL; true, false }
+#endif
+
+#ifdef UNDER_CE
+static void CALLBACK vlc_cancel_self (ULONG_PTR dummy);
+
+static DWORD vlc_cancelable_wait (DWORD count, const HANDLE *handles,
+                                  DWORD delay)
+{
+    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
+    if (nfo == NULL)
+    {
+        /* Main thread - cannot be cancelled anyway */
+        return WaitForMultipleObjects (count, handles, FALSE, delay);
+    }
+    HANDLE new_handles[count + 1];
+    memcpy(new_handles, handles, count * sizeof(HANDLE));
+    new_handles[count] = nfo->cancel_event;
+    DWORD result = WaitForMultipleObjects (count + 1, new_handles, FALSE,
+                                           delay);
+    if (result == WAIT_OBJECT_0 + count)
+    {
+        vlc_cancel_self (NULL);
+        return WAIT_IO_COMPLETION;
+    }
+    else
+    {
+        return result;
+    }
+}
+
+DWORD SleepEx (DWORD dwMilliseconds, BOOL bAlertable)
+{
+    if (bAlertable)
+    {
+        DWORD result = vlc_cancelable_wait (0, NULL, dwMilliseconds);
+        return (result == WAIT_TIMEOUT) ? 0 : WAIT_IO_COMPLETION;
+    }
+    else
+    {
+        Sleep(dwMilliseconds);
+        return 0;
+    }
+}
+
+DWORD WaitForSingleObjectEx (HANDLE hHandle, DWORD dwMilliseconds,
+                             BOOL bAlertable)
+{
+    if (bAlertable)
+    {
+        /* The MSDN documentation specifies different return codes,
+         * but in practice they are the same. We just check that it
+         * remains so. */
+#if WAIT_ABANDONED != WAIT_ABANDONED_0
+# error Windows headers changed, code needs to be rewritten!
+#endif
+        return vlc_cancelable_wait (1, &hHandle, dwMilliseconds);
+    }
+    else
+    {
+        return WaitForSingleObject (hHandle, dwMilliseconds);
+    }
+}
+
+DWORD WaitForMultipleObjectsEx (DWORD nCount, const HANDLE *lpHandles,
+                                BOOL bWaitAll, DWORD dwMilliseconds,
+                                BOOL bAlertable)
+{
+    if (bAlertable)
+    {
+        /* We do not support the bWaitAll case */
+        assert (! bWaitAll);
+        return vlc_cancelable_wait (nCount, lpHandles, dwMilliseconds);
+    }
+    else
+    {
+        return WaitForMultipleObjects (nCount, lpHandles, bWaitAll,
+                                       dwMilliseconds);
+    }
+}
+#endif
+
+static vlc_mutex_t super_mutex;
+
+BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
+{
+    (void) hinstDll;
+    (void) lpvReserved;
+
+    switch (fdwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            vlc_mutex_init (&super_mutex);
+            vlc_threadvar_create (&cancel_key, free);
+            break;
+
+        case DLL_PROCESS_DETACH:
+            vlc_threadvar_delete( &cancel_key );
+            vlc_mutex_destroy (&super_mutex);
+            break;
+    }
+    return TRUE;
+}
+
+/*** Mutexes ***/
+int vlc_mutex_init( vlc_mutex_t *p_mutex )
+{
+    /* This creates a recursive mutex. This is OK as fast mutexes have
+     * no defined behavior in case of recursive locking. */
+    InitializeCriticalSection (&p_mutex->mutex);
+    p_mutex->initialized = 1;
+    return 0;
+}
+
+int vlc_mutex_init_recursive( vlc_mutex_t *p_mutex )
+{
+    InitializeCriticalSection( &p_mutex->mutex );
+    p_mutex->initialized = 1;
+    return 0;
+}
+
+
+void vlc_mutex_destroy (vlc_mutex_t *p_mutex)
+{
+    assert (InterlockedExchange (&p_mutex->initialized, -1) == 1);
+    DeleteCriticalSection (&p_mutex->mutex);
+}
+
+void vlc_mutex_lock (vlc_mutex_t *p_mutex)
+{
+    if (InterlockedCompareExchange (&p_mutex->initialized, 0, 0) == 0)
+    { /* ^^ We could also lock super_mutex all the time... sluggish */
+        assert (p_mutex != &super_mutex); /* this one cannot be static */
+
+        vlc_mutex_lock (&super_mutex);
+        if (InterlockedCompareExchange (&p_mutex->initialized, 0, 0) == 0)
+            vlc_mutex_init (p_mutex);
+        /* FIXME: destroy the mutex some time... */
+        vlc_mutex_unlock (&super_mutex);
+    }
+    assert (InterlockedExchange (&p_mutex->initialized, 1) == 1);
+    EnterCriticalSection (&p_mutex->mutex);
+}
+
+int vlc_mutex_trylock (vlc_mutex_t *p_mutex)
+{
+    if (InterlockedCompareExchange (&p_mutex->initialized, 0, 0) == 0)
+    { /* ^^ We could also lock super_mutex all the time... sluggish */
+        assert (p_mutex != &super_mutex); /* this one cannot be static */
+
+        vlc_mutex_lock (&super_mutex);
+        if (InterlockedCompareExchange (&p_mutex->initialized, 0, 0) == 0)
+            vlc_mutex_init (p_mutex);
+        /* FIXME: destroy the mutex some time... */
+        vlc_mutex_unlock (&super_mutex);
+    }
+    assert (InterlockedExchange (&p_mutex->initialized, 1) == 1);
+    return TryEnterCriticalSection (&p_mutex->mutex) ? 0 : EBUSY;
+}
+
+void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
+{
+    assert (InterlockedExchange (&p_mutex->initialized, 1) == 1);
+    LeaveCriticalSection (&p_mutex->mutex);
+}
+
+/*** Condition variables ***/
+int vlc_cond_init( vlc_cond_t *p_condvar )
+{
+    /* Create a manual-reset event (manual reset is needed for broadcast). */
+    *p_condvar = CreateEvent (NULL, TRUE, FALSE, NULL);
+    return *p_condvar ? 0 : ENOMEM;
+}
+
+void vlc_cond_destroy (vlc_cond_t *p_condvar)
+{
+    CloseHandle (*p_condvar);
+}
+
+void vlc_cond_signal (vlc_cond_t *p_condvar)
+{
+    /* NOTE: This will cause a broadcast, that is wrong.
+     * This will also wake up the next waiting thread if no threads are yet
+     * waiting, which is also wrong. However both of these issues are allowed
+     * by the provision for spurious wakeups. Better have too many wakeups
+     * than too few (= deadlocks). */
+    SetEvent (*p_condvar);
+}
+
+void vlc_cond_broadcast (vlc_cond_t *p_condvar)
+{
+    SetEvent (*p_condvar);
+}
+
+void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
+{
+    DWORD result;
+
+    do
+    {
+        vlc_testcancel ();
+        LeaveCriticalSection (&p_mutex->mutex);
+        result = WaitForSingleObjectEx (*p_condvar, INFINITE, TRUE);
+        EnterCriticalSection (&p_mutex->mutex);
+    }
+    while (result == WAIT_IO_COMPLETION);
+
+    assert (result != WAIT_ABANDONED); /* another thread failed to cleanup! */
+    assert (result != WAIT_FAILED);
+    ResetEvent (*p_condvar);
+}
+
+int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
+                        mtime_t deadline)
+{
+    DWORD result;
+
+    do
+    {
+        vlc_testcancel ();
+
+        mtime_t total = (deadline - mdate ())/1000;
+        if( total < 0 )
+            total = 0;
+
+        DWORD delay = (total > 0x7fffffff) ? 0x7fffffff : total;
+        LeaveCriticalSection (&p_mutex->mutex);
+        result = WaitForSingleObjectEx (*p_condvar, delay, TRUE);
+        EnterCriticalSection (&p_mutex->mutex);
+    }
+    while (result == WAIT_IO_COMPLETION);
+
+    assert (result != WAIT_ABANDONED);
+    assert (result != WAIT_FAILED);
+    ResetEvent (*p_condvar);
+
+    return (result == WAIT_OBJECT_0) ? 0 : ETIMEDOUT;
+}
+
+/*** Thread-specific variables (TLS) ***/
+int vlc_threadvar_create (vlc_threadvar_t *p_tls, void (*destr) (void *))
+{
+#warning FIXME: use destr() callback and stop leaking!
+    *p_tls = TlsAlloc();
+    return (*p_tls == TLS_OUT_OF_INDEXES) ? EAGAIN : 0;
+}
+
+void vlc_threadvar_delete (vlc_threadvar_t *p_tls)
+{
+    TlsFree (*p_tls);
+}
+
+/**
+ * Sets a thread-local variable.
+ * @param key thread-local variable key (created with vlc_threadvar_create())
+ * @param value new value for the variable for the calling thread
+ * @return 0 on success, a system error code otherwise.
+ */
+int vlc_threadvar_set (vlc_threadvar_t key, void *value)
+{
+    return TlsSetValue (key, value) ? ENOMEM : 0;
+}
+
+/**
+ * Gets the value of a thread-local variable for the calling thread.
+ * This function cannot fail.
+ * @return the value associated with the given variable for the calling
+ * or NULL if there is no value.
+ */
+void *vlc_threadvar_get (vlc_threadvar_t key)
+{
+    return TlsGetValue (key);
+}
+
+
+/*** Threads ***/
+static unsigned __stdcall vlc_entry (void *data)
+{
+    vlc_cancel_t cancel_data = VLC_CANCEL_INIT;
+    vlc_thread_t self = data;
+#ifdef UNDER_CE
+    cancel_data.cancel_event = self->cancel_event;
+#endif
+
+    vlc_threadvar_set (cancel_key, &cancel_data);
+    self->data = self->entry (self->data);
+    return 0;
+}
+
+int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
+               int priority)
+{
+    /* When using the MSVCRT C library you have to use the _beginthreadex
+     * function instead of CreateThread, otherwise you'll end up with
+     * memory leaks and the signal functions not working (see Microsoft
+     * Knowledge Base, article 104641) */
+    HANDLE hThread;
+    vlc_thread_t th = malloc (sizeof (*th));
+
+    if (th == NULL)
+        return ENOMEM;
+
+    th->data = data;
+    th->entry = entry;
+#if defined( UNDER_CE )
+    th->cancel_event = CreateEvent (NULL, FALSE, FALSE, NULL);
+    if (th->cancel_event == NULL)
+    {
+        free(th);
+        return errno;
+    }
+    hThread = CreateThread (NULL, 128*1024, vlc_entry, th, CREATE_SUSPENDED, NULL);
+#else
+    hThread = (HANDLE)(uintptr_t)
+        _beginthreadex (NULL, 0, vlc_entry, th, CREATE_SUSPENDED, NULL);
+#endif
+
+    if (hThread)
+    {
+#ifndef UNDER_CE
+        /* Thread closes the handle when exiting, duplicate it here
+         * to be on the safe side when joining. */
+        if (!DuplicateHandle (GetCurrentProcess (), hThread,
+                              GetCurrentProcess (), &th->handle, 0, FALSE,
+                              DUPLICATE_SAME_ACCESS))
+        {
+            CloseHandle (hThread);
+            free (th);
+            return ENOMEM;
+        }
+#else
+        th->handle = hThread;
+#endif
+
+        ResumeThread (hThread);
+        if (priority)
+            SetThreadPriority (hThread, priority);
+
+        *p_handle = th;
+        return 0;
+    }
+    free (th);
+    return errno;
+}
+
+void vlc_join (vlc_thread_t handle, void **result)
+{
+    do
+        vlc_testcancel ();
+    while (WaitForSingleObjectEx (handle->handle, INFINITE, TRUE)
+                                                        == WAIT_IO_COMPLETION);
+
+    CloseHandle (handle->handle);
+    if (result)
+        *result = handle->data;
+#ifdef UNDER_CE
+    CloseHandle (handle->cancel_event);
+#endif
+    free (handle);
+}
+
+
+/*** Thread cancellation ***/
+
+/* APC procedure for thread cancellation */
+static void CALLBACK vlc_cancel_self (ULONG_PTR dummy)
+{
+    (void)dummy;
+    vlc_control_cancel (VLC_DO_CANCEL);
+}
+
+void vlc_cancel (vlc_thread_t thread_id)
+{
+#ifndef UNDER_CE
+    QueueUserAPC (vlc_cancel_self, thread_id->handle, 0);
+#else
+    SetEvent (thread_id->cancel_event);
+#endif
+}
+
+int vlc_savecancel (void)
+{
+    int state;
+
+    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
+    if (nfo == NULL)
+        return false; /* Main thread - cannot be cancelled anyway */
+
+    state = nfo->killable;
+    nfo->killable = false;
+    return state;
+}
+
+void vlc_restorecancel (int state)
+{
+    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
+    assert (state == false || state == true);
+
+    if (nfo == NULL)
+        return; /* Main thread - cannot be cancelled anyway */
+
+    assert (!nfo->killable);
+    nfo->killable = state != 0;
+}
+
+void vlc_testcancel (void)
+{
+    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
+    if (nfo == NULL)
+        return; /* Main thread - cannot be cancelled anyway */
+
+    if (nfo->killable && nfo->killed)
+    {
+        for (vlc_cleanup_t *p = nfo->cleaners; p != NULL; p = p->next)
+             p->proc (p->data);
+#ifndef UNDER_CE
+        _endthread ();
+#else
+        ExitThread(0);
+#endif
+    }
+}
+
+void vlc_control_cancel (int cmd, ...)
+{
+    /* NOTE: This function only modifies thread-specific data, so there is no
+     * need to lock anything. */
+    va_list ap;
+
+    vlc_cancel_t *nfo = vlc_threadvar_get (cancel_key);
+    if (nfo == NULL)
+        return; /* Main thread - cannot be cancelled anyway */
+
+    va_start (ap, cmd);
+    switch (cmd)
+    {
+        case VLC_DO_CANCEL:
+            nfo->killed = true;
+            break;
+
+        case VLC_CLEANUP_PUSH:
+        {
+            /* cleaner is a pointer to the caller stack, no need to allocate
+             * and copy anything. As a nice side effect, this cannot fail. */
+            vlc_cleanup_t *cleaner = va_arg (ap, vlc_cleanup_t *);
+            cleaner->next = nfo->cleaners;
+            nfo->cleaners = cleaner;
+            break;
+        }
+
+        case VLC_CLEANUP_POP:
+        {
+            nfo->cleaners = nfo->cleaners->next;
+            break;
+        }
+    }
+    va_end (ap);
+}
index 2c7a1c557939d6ec570e9623e339a8fd3d3dcd60..375a02af979e52b62279d41445b0a2dcad574697 100644 (file)
  * \param p_spu pointer to the subpicture queue the text is to be showed on
  * \param i_channel Subpicture channel
  * \param psz_string The text to be shown
- * \param p_style Pointer to a struct with text style info
+ * \param p_style Pointer to a struct with text style info (it is duplicated)
  * \param i_flags flags for alignment and such
  * \param i_hmargin horizontal margin in pixels
  * \param i_vmargin vertical margin in pixels
  * \param i_duration Amount of time the text is to be shown.
  */
 int osd_ShowTextRelative( spu_t *p_spu, int i_channel,
-                           const char *psz_string, text_style_t *p_style,
+                           const char *psz_string, const text_style_t *p_style,
                            int i_flags, int i_hmargin, int i_vmargin,
                            mtime_t i_duration )
 {
@@ -58,7 +58,7 @@ int osd_ShowTextRelative( spu_t *p_spu, int i_channel,
  * \param p_spu pointer to the subpicture queue the text is to be showed on
  * \param i_channel Subpicture channel
  * \param psz_string The text to be shown
- * \param p_style Pointer to a struct with text style info
+ * \param p_style Pointer to a struct with text style info (it is duplicated)
  * \param i_flags flags for alignment and such
  * \param i_hmargin horizontal margin in pixels
  * \param i_vmargin vertical margin in pixels
@@ -68,7 +68,7 @@ int osd_ShowTextRelative( spu_t *p_spu, int i_channel,
  *               is about to be shown
  */
 int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
-                           const char *psz_string, text_style_t *p_style,
+                           const char *psz_string, const text_style_t *p_style,
                            int i_flags, int i_hmargin, int i_vmargin,
                            mtime_t i_start, mtime_t i_stop )
 {
@@ -90,7 +90,7 @@ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_height = 0;
     fmt.i_x_offset = fmt.i_y_offset = 0;
index 5e880ead03e9e8faf0a411d1e81b9feade270ca6..32af4b8428d210622dae10929429851985d4fb7f 100644 (file)
@@ -159,7 +159,7 @@ static int CreatePicture( spu_t *p_spu, subpicture_t *p_subpic,
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt.i_chroma = VLC_CODEC_YUVA;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_visible_width = i_width;
     fmt.i_height = fmt.i_visible_height = i_height;
index c1d8065b08e558a57fb3f52dd1f84fda7702cd7a..5b068b4083b086510056700f8ffaedeb5c426669 100644 (file)
@@ -272,16 +272,14 @@ static void VariablesInit( playlist_t *p_playlist )
     var_Create( p_playlist, "intf-change", VLC_VAR_BOOL );
     var_SetBool( p_playlist, "intf-change", true );
 
-    var_Create( p_playlist, "item-change", VLC_VAR_INTEGER );
-    var_SetInteger( p_playlist, "item-change", -1 );
+    var_Create( p_playlist, "item-change", VLC_VAR_ADDRESS );
 
     var_Create( p_playlist, "playlist-item-deleted", VLC_VAR_INTEGER );
     var_SetInteger( p_playlist, "playlist-item-deleted", -1 );
 
     var_Create( p_playlist, "playlist-item-append", VLC_VAR_ADDRESS );
 
-    var_Create( p_playlist, "item-current", VLC_VAR_INTEGER );
-    var_SetInteger( p_playlist, "item-current", -1 );
+    var_Create( p_playlist, "item-current", VLC_VAR_ADDRESS );
 
     var_Create( p_playlist, "activity", VLC_VAR_INTEGER );
     var_SetInteger( p_playlist, "activity", 0 );
index c9384b4d2418cb1134f04042bfeca221b2d5879a..f8d8a422a761934057acb2eb61ac7a7d6bc1bb5e 100644 (file)
@@ -419,7 +419,7 @@ static void *Thread( void *p_data )
         {
             PL_DEBUG( "found art for %s in cache", psz_name );
             input_item_SetArtFetched( p_item, true );
-            var_SetInteger( p_playlist, "item-change", p_item->i_id );
+            var_SetAddress( p_playlist, "item-change", p_item );
         }
         else
         {
index 122411e0670282dd3054cc9c8cdb4c04fc18cd74..9210971ccba44b753bc233901ccbbc4eceaa4764 100644 (file)
@@ -64,7 +64,7 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
      * listening using the onelevel and the category representent
      * (Because of the playlist design) */
     p_child_in_category = playlist_ItemFindFromInputAndRoot(
-                            p_playlist, p_child->i_id,
+                            p_playlist, p_child,
                             p_playlist->p_root_category,
                             false /* Only non-node */ );
 
@@ -72,7 +72,7 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
     {
         /* Then, transform to a node if needed */
         p_item_in_category = playlist_ItemFindFromInputAndRoot(
-                                p_playlist, p_parent->i_id,
+                                p_playlist, p_parent,
                                 p_playlist->p_root_category,
                                 false /* Only non-node */ );
         if( !p_item_in_category )
@@ -117,7 +117,7 @@ static void input_item_changed( const vlc_event_t * p_event,
 {
     playlist_item_t *p_item = user_data;
     VLC_UNUSED( p_event );
-    var_SetInteger( p_item->p_playlist, "item-change", p_item->p_input->i_id );
+    var_SetAddress( p_item->p_playlist, "item-change", p_item->p_input );
 }
 
 /*****************************************************************************
@@ -218,12 +218,12 @@ int playlist_ItemRelease( playlist_item_t *p_item )
  *
  * Remove an input item when it appears from a root playlist item
  * \param p_playlist playlist object
- * \param i_input_id id of the input to delete
+ * \param p_input the input to delete
  * \param p_root root playlist item
  * \param b_do_stop must stop or not the playlist
  * \return VLC_SUCCESS or VLC_EGENERIC
 */
-static int DeleteFromInput( playlist_t *p_playlist, int i_input_id,
+static int DeleteFromInput( playlist_t *p_playlist, input_item_t *p_input,
                             playlist_item_t *p_root, bool b_do_stop )
 {
     int i;
@@ -231,14 +231,14 @@ static int DeleteFromInput( playlist_t *p_playlist, int i_input_id,
     for( i = 0 ; i< p_root->i_children ; i++ )
     {
         if( p_root->pp_children[i]->i_children == -1 &&
-            p_root->pp_children[i]->p_input->i_id == i_input_id )
+            p_root->pp_children[i]->p_input == p_input )
         {
             DeleteInner( p_playlist, p_root->pp_children[i], b_do_stop );
             return VLC_SUCCESS;
         }
         else if( p_root->pp_children[i]->i_children >= 0 )
         {
-            int i_ret = DeleteFromInput( p_playlist, i_input_id,
+            int i_ret = DeleteFromInput( p_playlist, p_input,
                                          p_root->pp_children[i], b_do_stop );
             if( i_ret == VLC_SUCCESS ) return VLC_SUCCESS;
         }
@@ -251,18 +251,18 @@ static int DeleteFromInput( playlist_t *p_playlist, int i_input_id,
  *
  * Remove an input item when it appears from a root playlist item
  * \param p_playlist playlist object
- * \param i_input_id id of the input to delete
+ * \param p_input the input to delete
  * \param p_root root playlist item
  * \param b_locked TRUE if the playlist is locked
  * \return VLC_SUCCESS or VLC_EGENERIC
  */
-int playlist_DeleteFromInputInParent( playlist_t *p_playlist, int i_input_id,
+int playlist_DeleteFromInputInParent( playlist_t *p_playlist,
+                                      input_item_t *p_item,
                                       playlist_item_t *p_root, bool b_locked )
 {
     int i_ret;
     PL_LOCK_IF( !b_locked );
-    i_ret = DeleteFromInput( p_playlist, i_input_id,
-                             p_root, true );
+    i_ret = DeleteFromInput( p_playlist, p_item, p_root, true );
     PL_UNLOCK_IF( !b_locked );
     return i_ret;
 }
@@ -272,18 +272,18 @@ int playlist_DeleteFromInputInParent( playlist_t *p_playlist, int i_input_id,
  *
  * Remove an input item from ONELEVEL and CATEGORY
  * \param p_playlist playlist object
- * \param i_input_id id of the input to delete
+ * \param p_input the input to delete
  * \param b_locked TRUE if the playlist is locked
  * \return VLC_SUCCESS or VLC_ENOITEM
  */
-int playlist_DeleteFromInput( playlist_t *p_playlist, int i_input_id,
+int playlist_DeleteFromInput( playlist_t *p_playlist, input_item_t *p_input,
                               bool b_locked )
 {
     int i_ret1, i_ret2;
     PL_LOCK_IF( !b_locked );
-    i_ret1 = DeleteFromInput( p_playlist, i_input_id,
+    i_ret1 = DeleteFromInput( p_playlist, p_input,
                              p_playlist->p_root_category, true );
-    i_ret2 = DeleteFromInput( p_playlist, i_input_id,
+    i_ret2 = DeleteFromInput( p_playlist, p_input,
                      p_playlist->p_root_onelevel, true );
     PL_UNLOCK_IF( !b_locked );
     return ( i_ret1 == VLC_SUCCESS || i_ret2 == VLC_SUCCESS ) ?
@@ -338,7 +338,7 @@ int playlist_DeleteFromItemId( playlist_t *p_playlist, int i_id )
  *        regardless of its size
  * \param b_playlist TRUE for playlist, FALSE for media library
  * \param b_locked TRUE if the playlist is locked
- * \return The id of the playlist item
+ * \return VLC_SUCCESS or a VLC error code
  */
 int playlist_Add( playlist_t *p_playlist, const char *psz_uri,
                   const char *psz_name, int i_mode, int i_pos,
@@ -364,26 +364,27 @@ int playlist_Add( playlist_t *p_playlist, const char *psz_uri,
  * \param i_option_flags options flags
  * \param b_playlist TRUE for playlist, FALSE for media library
  * \param b_locked TRUE if the playlist is locked
- * \return The id of the playlist item
+ * \return VLC_SUCCESS or a VLC error code
 */
 int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
                      const char *psz_name, int i_mode, int i_pos,
                      mtime_t i_duration,
-                     int i_options, const char *const *ppsz_options, unsigned i_option_flags,
+                     int i_options, const char *const *ppsz_options,
+                     unsigned i_option_flags,
                      bool b_playlist, bool b_locked )
 {
     int i_ret;
-    input_item_t *p_input = input_item_NewExt( p_playlist, psz_uri, psz_name,
-                                              i_options, ppsz_options, i_option_flags,
-                                              i_duration );
+    input_item_t *p_input;
 
+    p_input = input_item_NewExt( p_playlist, psz_uri, psz_name,
+                                 i_options, ppsz_options, i_option_flags,
+                                 i_duration );
+    if( p_input == NULL )
+        return VLC_ENOMEM;
     i_ret = playlist_AddInput( p_playlist, p_input, i_mode, i_pos, b_playlist,
                                b_locked );
-    int i_id = (i_ret == VLC_SUCCESS) ? p_input->i_id : -1;
-
     vlc_gc_decref( p_input );
-
-    return i_id;
+    return i_ret;
 }
 
 /**
@@ -480,8 +481,8 @@ int playlist_BothAddInput( playlist_t *p_playlist,
     }
     for( i_top = 0 ; i_top < p_playlist->p_root_onelevel->i_children; i_top++ )
     {
-        if( p_playlist->p_root_onelevel->pp_children[i_top]->p_input->i_id ==
-                             p_up->p_input->i_id )
+        if( p_playlist->p_root_onelevel->pp_children[i_top]->p_input ==
+                             p_up->p_input )
         {
             AddItem( p_playlist, p_item_one,
                      p_playlist->p_root_onelevel->pp_children[i_top],
@@ -579,14 +580,14 @@ static playlist_item_t *ItemToNode( playlist_t *p_playlist,
 
     /** \todo First look if we don't already have it */
     p_item_in_category = playlist_ItemFindFromInputAndRoot(
-                                            p_playlist, p_item->p_input->i_id,
+                                            p_playlist, p_item->p_input,
                                             p_playlist->p_root_category,
                                             true );
 
     if( p_item_in_category )
     {
         playlist_item_t *p_item_in_one = playlist_ItemFindFromInputAndRoot(
-                                            p_playlist, p_item->p_input->i_id,
+                                            p_playlist, p_item->p_input,
                                             p_playlist->p_root_onelevel,
                                             true );
         assert( p_item_in_one );
@@ -619,12 +620,12 @@ static playlist_item_t *ItemToNode( playlist_t *p_playlist,
                 if( p_prev_status_item )
                     set_current_status_item( p_playlist, p_prev_status_item );
             }
-            DeleteFromInput( p_playlist, p_item_in_one->p_input->i_id,
+            DeleteFromInput( p_playlist, p_item_in_one->p_input,
                              p_playlist->p_root_onelevel, false );
         }
         pl_priv(p_playlist)->b_reset_currently_playing = true;
         vlc_cond_signal( &pl_priv(p_playlist)->signal );
-        var_SetInteger( p_playlist, "item-change", p_item_in_category->p_input->i_id );
+        var_SetAddress( p_playlist, "item-change", p_item_in_category->p_input );
         PL_UNLOCK_IF( !b_locked );
         return p_item_in_category;
     }
@@ -640,13 +641,13 @@ static playlist_item_t *ItemToNode( playlist_t *p_playlist,
  * Find an item within a root, given its input id.
  *
  * \param p_playlist the playlist object
- * \param i_input_id id of the input
+ * \param p_item the input item
  * \param p_root root playlist item
  * \param b_items_only TRUE if we want the item himself
  * \return the first found item, or NULL if not found
  */
 playlist_item_t *playlist_ItemFindFromInputAndRoot( playlist_t *p_playlist,
-                                                    int i_input_id,
+                                                    input_item_t *p_item,
                                                     playlist_item_t *p_root,
                                                     bool b_items_only )
 {
@@ -654,14 +655,14 @@ playlist_item_t *playlist_ItemFindFromInputAndRoot( playlist_t *p_playlist,
     for( i = 0 ; i< p_root->i_children ; i++ )
     {
         if( ( b_items_only ? p_root->pp_children[i]->i_children == -1 : 1 ) &&
-            p_root->pp_children[i]->p_input->i_id == i_input_id )
+            p_root->pp_children[i]->p_input == p_item )
         {
             return p_root->pp_children[i];
         }
         else if( p_root->pp_children[i]->i_children >= 0 )
         {
             playlist_item_t *p_search =
-                 playlist_ItemFindFromInputAndRoot( p_playlist, i_input_id,
+                 playlist_ItemFindFromInputAndRoot( p_playlist, p_item,
                                                     p_root->pp_children[i],
                                                     b_items_only );
             if( p_search ) return p_search;
@@ -730,11 +731,11 @@ int playlist_TreeMove( playlist_t * p_playlist, playlist_item_t *p_item,
             playlist_item_t *p_node_onelevel;
             playlist_item_t *p_item_onelevel;
             p_node_onelevel = playlist_ItemFindFromInputAndRoot( p_playlist,
-                                                p_node->p_input->i_id,
+                                                p_node->p_input,
                                                 p_playlist->p_root_onelevel,
                                                 false );
             p_item_onelevel = playlist_ItemFindFromInputAndRoot( p_playlist,
-                                                p_item->p_input->i_id,
+                                                p_item->p_input,
                                                 p_playlist->p_root_onelevel,
                                                 false );
             if( p_node_onelevel && p_item_onelevel )
@@ -744,11 +745,11 @@ int playlist_TreeMove( playlist_t * p_playlist, playlist_item_t *p_item,
             playlist_item_t *p_node_category;
             playlist_item_t *p_item_category;
             p_node_category = playlist_ItemFindFromInputAndRoot( p_playlist,
-                                                p_node->p_input->i_id,
+                                                p_node->p_input,
                                                 p_playlist->p_root_category,
                                                 false );
             p_item_category = playlist_ItemFindFromInputAndRoot( p_playlist,
-                                                p_item->p_input->i_id,
+                                                p_item->p_input,
                                                 p_playlist->p_root_category,
                                                 false );
             if( p_node_category && p_item_category )
index cae5b040959b483053dd7d63128fa612209370ac..6afec4a26cd504a792a4a00c0d49eee9b8d3be1f 100644 (file)
@@ -139,10 +139,11 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *, input_item_t *,
 
 /* Tree walking */
 playlist_item_t *playlist_ItemFindFromInputAndRoot( playlist_t *p_playlist,
-                                   int i_input_id, playlist_item_t *p_root,
-                                   bool );
+                                input_item_t *p_input, playlist_item_t *p_root,
+                                bool );
 
-int playlist_DeleteFromInputInParent( playlist_t *, int, playlist_item_t *, bool );
+int playlist_DeleteFromInputInParent( playlist_t *, input_item_t *,
+                                      playlist_item_t *, bool );
 int playlist_DeleteFromItemId( playlist_t*, int );
 int playlist_ItemRelease( playlist_item_t * );
 
index 74b3961f475a75e0e3dd8c345d1e81815c058c76..f2cb2329191a7b2def984c43bcc168916bffdb2a 100644 (file)
@@ -130,7 +130,7 @@ static void Preparse( playlist_t *p_playlist, input_item_t *p_item )
         input_Preparse( VLC_OBJECT(p_playlist), p_item );
         input_item_SetPreparsed( p_item, true );
 
-        var_SetInteger( p_playlist, "item-change", p_item->i_id );
+        var_SetAddress( p_playlist, "item-change", p_item );
     }
 
     stats_TimerStop( p_playlist, STATS_TIMER_PREPARSE );
index 66bd3ad0929344f5861b4769eb48271362dc9b68..8de86c67a3befa81197bc03847ee352b8108dfaf 100644 (file)
@@ -71,7 +71,7 @@ playlist_item_t* playlist_ItemGetByInput( playlist_t * p_playlist,
     /** \todo Check if this is always incremental and whether we can bsearch */
     for( i =  0 ; i < p_playlist->all_items.i_size; i++ )
     {
-        if( ARRAY_VAL(p_playlist->all_items, i)->p_input->i_id == p_item->i_id )
+        if( ARRAY_VAL(p_playlist->all_items, i)->p_input == p_item )
         {
             return ARRAY_VAL(p_playlist->all_items, i);
         }
@@ -80,38 +80,6 @@ playlist_item_t* playlist_ItemGetByInput( playlist_t * p_playlist,
 }
 
 
-/**
- * Get input by item id
- *
- * Find the playlist item matching the input id under the given node
- * \param p_playlist the playlist
- * \param i_input_id the id of the input to find
- * \param p_root the root node of the search
- * \return the playlist item or NULL on failure
- */
-playlist_item_t * playlist_ItemGetByInputId( playlist_t *p_playlist,
-                                             int i_input_id,
-                                             playlist_item_t *p_root )
-{
-    int i;
-    PL_ASSERT_LOCKED;
-    assert( p_root != NULL );
-    for( i = 0 ; i< p_root->i_children ; i++ )
-    {
-        if( p_root->pp_children[i]->p_input &&
-            p_root->pp_children[i]->p_input->i_id == i_input_id )
-        {
-            return p_root->pp_children[i];
-        }
-        else if( p_root->pp_children[i]->i_children >= 0 )
-        {
-            return playlist_ItemGetByInputId( p_playlist, i_input_id,
-                                              p_root->pp_children[i] );
-        }
-    }
-    return NULL;
-}
-
 /***************************************************************************
  * Live search handling
  ***************************************************************************/
index 03c9f0de91d07a7558ce652a49effbe8d57d8591..aaa46688b63709a1d3848a2f412248f80a49858d 100644 (file)
@@ -213,13 +213,13 @@ static void playlist_sd_item_removed( const vlc_event_t * p_event, void * user_d
      * XXX: Why don't we have a function to ensure that in the playlist code ? */
     playlist_Lock( p_parent->p_playlist );
     p_pl_item = playlist_ItemFindFromInputAndRoot( p_parent->p_playlist,
-            p_input->i_id, p_parent, false );
+            p_input, p_parent, false );
 
     if( p_pl_item && p_pl_item->i_children > -1 )
         playlist_NodeDelete( p_parent->p_playlist, p_pl_item, true, false );
     else
         /* Delete the non-node item normally */
-        playlist_DeleteFromInputInParent( p_parent->p_playlist, p_input->i_id,
+        playlist_DeleteFromInputInParent( p_parent->p_playlist, p_input,
                                           p_parent, pl_Locked );
 
     playlist_Unlock( p_parent->p_playlist );
index eacfd379f37ff5b52fd86a79efa340e543b574de..3e7bf06ed0e06cfdb0ab55d019f7c658cdbd85d6 100644 (file)
@@ -297,7 +297,7 @@ static int PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
     }
 
     PL_UNLOCK;
-    var_SetInteger( p_playlist, "item-current", p_input->i_id );
+    var_SetAddress( p_playlist, "item-current", p_input );
     PL_LOCK;
 
     return VLC_SUCCESS;
index 1eab637c0ab5aa5467e2a02f5f29b8ea7d7d5101..32ef051be5999cde7fcacc6e3b6441df2ac441f2 100644 (file)
@@ -311,8 +311,8 @@ playlist_item_t * playlist_GetPreferredNode( playlist_t *p_playlist,
             return p_node;
         for( i = 0 ; i< p_playlist->p_root_onelevel->i_children; i++ )
         {
-            if( p_playlist->p_root_onelevel->pp_children[i]->p_input->i_id ==
-                    p_node->p_input->i_id )
+            if( p_playlist->p_root_onelevel->pp_children[i]->p_input ==
+                    p_node->p_input )
                 return p_playlist->p_root_onelevel->pp_children[i];
         }
     }
@@ -322,8 +322,8 @@ playlist_item_t * playlist_GetPreferredNode( playlist_t *p_playlist,
             return p_node;
         for( i = 0 ; i< p_playlist->p_root_category->i_children; i++ )
         {
-            if( p_playlist->p_root_category->pp_children[i]->p_input->i_id ==
-                    p_node->p_input->i_id )
+            if( p_playlist->p_root_category->pp_children[i]->p_input ==
+                    p_node->p_input )
                 return p_playlist->p_root_category->pp_children[i];
         }
     }
index 5777fbd44c8ca4be9013bcdfa269fde28f5f8eb5..a6672dede5784847466da56805d9bda44a0beec1 100644 (file)
@@ -47,6 +47,8 @@
 
 #include "input/input_interface.h"
 
+#define VLC_CODEC_NULL VLC_FOURCC( 'n', 'u', 'l', 'l' )
+
 #undef DEBUG_BUFFER
 /*****************************************************************************
  * Local prototypes
@@ -211,7 +213,7 @@ sout_packetizer_input_t *sout_InputNew( sout_instance_t *p_sout,
 
     msg_Dbg( p_sout, "adding a new sout input (sout_input:%p)", p_input );
 
-    if( p_fmt->i_codec == VLC_FOURCC( 'n', 'u', 'l', 'l' ) )
+    if( p_fmt->i_codec == VLC_CODEC_NULL )
     {
         vlc_object_release( p_sout );
         return p_input;
@@ -240,7 +242,7 @@ int sout_InputDelete( sout_packetizer_input_t *p_input )
 
     msg_Dbg( p_sout, "removing a sout input (sout_input:%p)", p_input );
 
-    if( p_input->p_fmt->i_codec != VLC_FOURCC( 'n', 'u', 'l', 'l' ) )
+    if( p_input->p_fmt->i_codec != VLC_CODEC_NULL )
     {
         vlc_mutex_lock( &p_sout->lock );
         p_sout->p_stream->pf_del( p_sout->p_stream, p_input->id );
@@ -261,7 +263,7 @@ int sout_InputSendBuffer( sout_packetizer_input_t *p_input,
     sout_instance_t     *p_sout = p_input->p_sout;
     int                 i_ret;
 
-    if( p_input->p_fmt->i_codec == VLC_FOURCC( 'n', 'u', 'l', 'l' ) )
+    if( p_input->p_fmt->i_codec == VLC_CODEC_NULL )
     {
         block_Release( p_buffer );
         return VLC_SUCCESS;
index d03e48ca6d8953c7ff0c05bb7a692ade263715d3..875c9a5f7b37a588f8fbba482e712428abe679b7 100644 (file)
@@ -66,6 +66,15 @@ static inline void test_path (const char *in, const char *out)
     test (make_URI, in, out);
 }
 
+static inline void test_current_directory_path (const char *in, const char *cwd, const char *out)
+{
+    char * expected_result = NULL;
+    int val = asprintf(&expected_result, "file://%s/%s", cwd, out);
+    assert (val != -1);
+    
+    test (make_URI, in, expected_result);
+}
+
 int main (void)
 {
     int val;
@@ -114,9 +123,16 @@ int main (void)
     assert (fd != -1);*/
     val = chdir ("/tmp");
     assert (val != -1);
-    test_path ("movie.ogg", "file:///tmp/movie.ogg");
-    test_path (".", "file:///tmp/.");
-    test_path ("", "file:///tmp/");
+
+    char buf[256];
+    char * tmpdir;
+    tmpdir = getcwd(buf, sizeof(buf)/sizeof(*buf));
+    assert (tmpdir);
+
+    test_current_directory_path ("movie.ogg", tmpdir, "movie.ogg");
+    test_current_directory_path (".", tmpdir, ".");
+    test_current_directory_path ("", tmpdir, "");
+
     /*val = fchdir (fd);
     assert (val != -1);*/
 
index 3c932f69856ca7315c1a3db263b412f0b4a616e0..c090c111fc1394d24c50f11260946a24204890d4 100644 (file)
@@ -208,7 +208,7 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
             free( psz_filter_chain );
         }
 
-        if( p_vout->fmt_render.i_chroma != p_fmt->i_chroma ||
+        if( p_vout->fmt_render.i_chroma != vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma ) ||
             p_vout->fmt_render.i_width != p_fmt->i_width ||
             p_vout->fmt_render.i_height != p_fmt->i_height ||
             p_vout->p->b_filter_change )
@@ -303,7 +303,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
 
     unsigned int i_width = p_fmt->i_width;
     unsigned int i_height = p_fmt->i_height;
-    vlc_fourcc_t i_chroma = p_fmt->i_chroma;
+    vlc_fourcc_t i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma );
     unsigned int i_aspect = p_fmt->i_aspect;
 
     config_chain_t *p_cfg;
@@ -816,10 +816,10 @@ static bool ChromaIsEqual( const picture_heap_t *p_output, const picture_heap_t
      if( !vout_ChromaCmp( p_output->i_chroma, p_render->i_chroma ) )
          return false;
 
-     if( p_output->i_chroma != FOURCC_RV15 &&
-         p_output->i_chroma != FOURCC_RV16 &&
-         p_output->i_chroma != FOURCC_RV24 &&
-         p_output->i_chroma != FOURCC_RV32 )
+     if( p_output->i_chroma != VLC_CODEC_RGB15 &&
+         p_output->i_chroma != VLC_CODEC_RGB16 &&
+         p_output->i_chroma != VLC_CODEC_RGB24 &&
+         p_output->i_chroma != VLC_CODEC_RGB32 )
          return true;
 
      return p_output->i_rmask == p_render->i_rmask &&
@@ -983,17 +983,6 @@ static int InitThread( vout_thread_t *p_vout )
         }
     }
 
-    /* Link pictures back to their heap */
-    for( i = 0 ; i < I_RENDERPICTURES ; i++ )
-    {
-        PP_RENDERPICTURE[ i ]->p_heap = &p_vout->render;
-    }
-
-    for( i = 0 ; i < I_OUTPUTPICTURES ; i++ )
-    {
-        PP_OUTPUTPICTURE[ i ]->p_heap = &p_vout->output;
-    }
-
     return VLC_SUCCESS;
 }
 
index d0e7a0ac3c7ca4e8faea8c94bf2f1891c5a2aa94..d5a8f6244bb2ee1263d20a6197c202a459bb81b6 100644 (file)
  * \param p_vout pointer to the vout the text is to be showed on
  * \param i_channel Subpicture channel
  * \param psz_string The text to be shown
- * \param p_style Pointer to a struct with text style info
+ * \param p_style Pointer to a struct with text style info (it is duplicated if non NULL)
  * \param i_flags flags for alignment and such
  * \param i_hmargin horizontal margin in pixels
  * \param i_vmargin vertical margin in pixels
  * \param i_duration Amount of time the text is to be shown.
  */
 int vout_ShowTextRelative( vout_thread_t *p_vout, int i_channel,
-                           char *psz_string, text_style_t *p_style,
+                           char *psz_string, const text_style_t *p_style,
                            int i_flags, int i_hmargin, int i_vmargin,
                            mtime_t i_duration )
 {
@@ -59,7 +59,7 @@ int vout_ShowTextRelative( vout_thread_t *p_vout, int i_channel,
  * \param p_vout pointer to the vout the text is to be showed on
  * \param i_channel Subpicture channel
  * \param psz_string The text to be shown
- * \param p_style Pointer to a struct with text style info
+ * \param p_style Pointer to a struct with text style info (it is duplicated if non NULL)
  * \param i_flags flags for alignment and such
  * \param i_hmargin horizontal margin in pixels
  * \param i_vmargin vertical margin in pixels
@@ -69,14 +69,12 @@ int vout_ShowTextRelative( vout_thread_t *p_vout, int i_channel,
  *               is about to be shown
  */
 int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
-                           const char *psz_string, text_style_t *p_style,
+                           const char *psz_string, const text_style_t *p_style,
                            int i_flags, int i_hmargin, int i_vmargin,
                            mtime_t i_start, mtime_t i_stop )
 {
-    (void)p_style;
     subpicture_t *p_spu;
     video_format_t fmt;
-    /* (void)p_style; FIXME: <-- why ask for this if it's unused?!? */
 
     if( !psz_string ) return VLC_EGENERIC;
 
@@ -94,7 +92,7 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
 
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
-    fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+    fmt.i_chroma = VLC_CODEC_TEXT;
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_height = 0;
     fmt.i_x_offset = fmt.i_y_offset = 0;
@@ -110,6 +108,8 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
     p_spu->p_region->i_align = i_flags & SUBPICTURE_ALIGN_MASK;
     p_spu->p_region->i_x = i_hmargin;
     p_spu->p_region->i_y = i_vmargin;
+    if( p_style )
+        p_spu->p_region->p_style = text_style_Duplicate( p_style );
 
     spu_DisplaySubpicture( p_vout->p_spu, p_spu );
 
@@ -151,3 +151,69 @@ void __vout_OSDMessage( vlc_object_t *p_caller, int i_channel,
         va_end( args );
     }
 }
+
+/* */
+text_style_t *text_style_New( void )
+{
+    text_style_t *p_style = calloc( 1, sizeof(*p_style) );
+    if( !p_style )
+        return NULL;
+
+    /* initialize to default text style */
+    p_style->psz_fontname = NULL;
+    p_style->i_font_size = 22;
+    p_style->i_font_color = 0xffffff;
+    p_style->i_font_alpha = 0xff;
+    p_style->i_style_flags = STYLE_OUTLINE;
+    p_style->i_outline_color = 0x000000;
+    p_style->i_outline_alpha = 0xff;
+    p_style->i_shadow_color = 0x000000;
+    p_style->i_shadow_alpha = 0xff;
+    p_style->i_background_color = 0xffffff;
+    p_style->i_background_alpha = 0x80;
+    p_style->i_karaoke_background_color = 0xffffff;
+    p_style->i_karaoke_background_alpha = 0xff;
+    p_style->i_outline_width = 1;
+    p_style->i_shadow_width = 0;
+    p_style->i_spacing = -1;
+
+    return p_style;
+}
+
+text_style_t *text_style_Copy( text_style_t *p_dst, const text_style_t *p_src )
+{
+    if( !p_src )
+        return p_dst;
+
+    /* */
+    if( p_dst->psz_fontname )
+        free( p_dst->psz_fontname );
+
+    /* */
+    *p_dst = *p_src;
+
+    /* */
+    if( p_dst->psz_fontname )
+        p_dst->psz_fontname = strdup( p_dst->psz_fontname );
+
+    return p_dst;
+}
+
+text_style_t *text_style_Duplicate( const text_style_t *p_src )
+{
+    if( !p_src )
+        return NULL;
+
+    text_style_t *p_dst = calloc( 1, sizeof(*p_dst) );
+    if( p_dst )
+        text_style_Copy( p_dst, p_src );
+    return p_dst;
+}
+
+void text_style_Delete( text_style_t *p_style )
+{
+    if( p_style )
+        free( p_style->psz_fontname );
+    free( p_style );
+}
+
index 80f23e94cfcf8bd5ee47f1bb3925bfcffcf4a6ab..095101ac0fc21b2aad6dd462ab59f07c0c149a5f 100644 (file)
@@ -469,7 +469,7 @@ static int VoutSnapshotPip( vout_thread_t *p_vout, picture_t *p_pic )
     /* */
     memset( &fmt_out, 0, sizeof(fmt_out) );
     fmt_out = fmt_in;
-    fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+    fmt_out.i_chroma = VLC_CODEC_YUVA;
 
     /* */
     image_handler_t *p_image = image_HandlerCreate( p_vout );
@@ -752,7 +752,7 @@ int vout_GetSnapshot( vout_thread_t *p_vout,
 
     if( pp_image )
     {
-        vlc_fourcc_t i_format = VLC_FOURCC('p','n','g',' ');
+        vlc_fourcc_t i_format = VLC_CODEC_PNG;
         if( psz_format && image_Type2Fourcc( psz_format ) )
             i_format = image_Type2Fourcc( psz_format );
 
index d0da611c43180080ebb1bfdf89019cfe995a8111..8033f38ec6b356c8adce906879b881cde8a5a252 100644 (file)
@@ -408,8 +408,6 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
                                   p_vout->fmt_out.i_aspect );
             p_tmp_pic->i_type = MEMORY_PICTURE;
             p_tmp_pic->i_status = RESERVED_PICTURE;
-            /* some modules (such as blend)  needs to know the extra information in picture heap */
-            p_tmp_pic->p_heap = &p_vout->output;
         }
 
         /* Convert image to the first direct buffer */
@@ -560,8 +558,8 @@ int __vout_AllocatePicture( vlc_object_t *p_this, picture_t *p_pic,
     i_width_aligned = (i_width + 15) >> 4 << 4;
     i_height_aligned = (i_height + 15) >> 4 << 4;
 
-    if( vout_InitPicture( p_this, p_pic, i_chroma,
-                          i_width, i_height, i_aspect ) != VLC_SUCCESS )
+    if( picture_Setup( p_pic, i_chroma,
+                       i_width, i_height, i_aspect ) != VLC_SUCCESS )
     {
         p_pic->i_planes = 0;
         return VLC_EGENERIC;
@@ -591,362 +589,6 @@ int __vout_AllocatePicture( vlc_object_t *p_this, picture_t *p_pic,
     return VLC_SUCCESS;
 }
 
-/**
- * Initialise the video format fields given chroma/size.
- *
- * This function initializes all the video_frame_format_t fields given the
- * static properties of a picture (chroma and size).
- * \param p_format Pointer to the format structure to initialize
- * \param i_chroma Chroma to set
- * \param i_width Width to set
- * \param i_height Height to set
- * \param i_aspect Aspect ratio
- */
-void vout_InitFormat( video_frame_format_t *p_format, vlc_fourcc_t i_chroma,
-                      int i_width, int i_height, int i_aspect )
-{
-    p_format->i_chroma   = i_chroma;
-    p_format->i_width    = p_format->i_visible_width  = i_width;
-    p_format->i_height   = p_format->i_visible_height = i_height;
-    p_format->i_x_offset = p_format->i_y_offset = 0;
-    p_format->i_aspect   = i_aspect;
-
-#if 0
-    /* Assume we have square pixels */
-    if( i_width && i_height )
-        p_format->i_aspect = i_width * VOUT_ASPECT_FACTOR / i_height;
-    else
-        p_format->i_aspect = 0;
-#endif
-
-    switch( i_chroma )
-    {
-        case FOURCC_YUVA:
-            p_format->i_bits_per_pixel = 32;
-            break;
-        case FOURCC_I444:
-        case FOURCC_J444:
-            p_format->i_bits_per_pixel = 24;
-            break;
-        case FOURCC_I422:
-        case FOURCC_YUY2:
-        case FOURCC_UYVY:
-        case FOURCC_J422:
-            p_format->i_bits_per_pixel = 16;
-            break;
-        case FOURCC_I440:
-        case FOURCC_J440:
-            p_format->i_bits_per_pixel = 16;
-            break;
-        case FOURCC_I411:
-        case FOURCC_YV12:
-        case FOURCC_I420:
-        case FOURCC_J420:
-        case FOURCC_IYUV:
-            p_format->i_bits_per_pixel = 12;
-            break;
-        case FOURCC_I410:
-        case FOURCC_YVU9:
-            p_format->i_bits_per_pixel = 9;
-            break;
-        case FOURCC_Y211:
-            p_format->i_bits_per_pixel = 8;
-            break;
-        case FOURCC_YUVP:
-            p_format->i_bits_per_pixel = 8;
-            break;
-
-        case FOURCC_RV32:
-        case FOURCC_RGBA:
-            p_format->i_bits_per_pixel = 32;
-            break;
-        case FOURCC_RV24:
-            p_format->i_bits_per_pixel = 24;
-            break;
-        case FOURCC_RV15:
-        case FOURCC_RV16:
-            p_format->i_bits_per_pixel = 16;
-            break;
-        case FOURCC_RGB2:
-            p_format->i_bits_per_pixel = 8;
-            break;
-
-        case FOURCC_GREY:
-        case FOURCC_Y800:
-        case FOURCC_Y8:
-        case FOURCC_RGBP:
-            p_format->i_bits_per_pixel = 8;
-            break;
-
-        default:
-            p_format->i_bits_per_pixel = 0;
-            break;
-    }
-}
-
-/**
- * Initialise the picture_t fields given chroma/size.
- *
- * This function initializes most of the picture_t fields given a chroma and
- * size. It makes the assumption that stride == width.
- * \param p_this The calling object
- * \param p_pic Pointer to the picture to initialize
- * \param i_chroma The chroma fourcc to set
- * \param i_width The width of the picture
- * \param i_height The height of the picture
- * \param i_aspect The aspect ratio of the picture
- */
-int __vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
-                        vlc_fourcc_t i_chroma,
-                        int i_width, int i_height, int i_aspect )
-{
-    int i_index, i_width_aligned, i_height_aligned;
-
-    /* Store default values */
-    for( i_index = 0; i_index < VOUT_MAX_PLANES; i_index++ )
-    {
-        p_pic->p[i_index].p_pixels = NULL;
-        p_pic->p[i_index].i_pixel_pitch = 1;
-    }
-
-    p_pic->pf_release = NULL;
-    p_pic->pf_lock = NULL;
-    p_pic->pf_unlock = NULL;
-    p_pic->i_refcount = 0;
-
-    p_pic->i_qtype = QTYPE_NONE;
-    p_pic->i_qstride = 0;
-    p_pic->p_q = NULL;
-
-    vout_InitFormat( &p_pic->format, i_chroma, i_width, i_height, i_aspect );
-
-    /* Make sure the real dimensions are a multiple of 16 */
-    i_width_aligned = (i_width + 15) >> 4 << 4;
-    i_height_aligned = (i_height + 15) >> 4 << 4;
-
-    /* Calculate coordinates */
-    switch( i_chroma )
-    {
-        case FOURCC_I411:
-            p_pic->p[ Y_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ Y_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ U_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ U_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ U_PLANE ].i_pitch = i_width_aligned / 4;
-            p_pic->p[ U_PLANE ].i_visible_pitch = i_width / 4;
-            p_pic->p[ V_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ V_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ V_PLANE ].i_pitch = i_width_aligned / 4;
-            p_pic->p[ V_PLANE ].i_visible_pitch = i_width / 4;
-            p_pic->i_planes = 3;
-            break;
-
-        case FOURCC_I410:
-        case FOURCC_YVU9:
-            p_pic->p[ Y_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ Y_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ U_PLANE ].i_lines = i_height_aligned / 4;
-            p_pic->p[ U_PLANE ].i_visible_lines = i_height / 4;
-            p_pic->p[ U_PLANE ].i_pitch = i_width_aligned / 4;
-            p_pic->p[ U_PLANE ].i_visible_pitch = i_width / 4;
-            p_pic->p[ V_PLANE ].i_lines = i_height_aligned / 4;
-            p_pic->p[ V_PLANE ].i_visible_lines = i_height / 4;
-            p_pic->p[ V_PLANE ].i_pitch = i_width_aligned / 4;
-            p_pic->p[ V_PLANE ].i_visible_pitch = i_width / 4;
-            p_pic->i_planes = 3;
-            break;
-
-        case FOURCC_YV12:
-        case FOURCC_I420:
-        case FOURCC_IYUV:
-        case FOURCC_J420:
-            p_pic->p[ Y_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ Y_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ U_PLANE ].i_lines = i_height_aligned / 2;
-            p_pic->p[ U_PLANE ].i_visible_lines = i_height / 2;
-            p_pic->p[ U_PLANE ].i_pitch = i_width_aligned / 2;
-            p_pic->p[ U_PLANE ].i_visible_pitch = i_width / 2;
-            p_pic->p[ V_PLANE ].i_lines = i_height_aligned / 2;
-            p_pic->p[ V_PLANE ].i_visible_lines = i_height / 2;
-            p_pic->p[ V_PLANE ].i_pitch = i_width_aligned / 2;
-            p_pic->p[ V_PLANE ].i_visible_pitch = i_width / 2;
-            p_pic->i_planes = 3;
-            break;
-
-        case FOURCC_I422:
-        case FOURCC_J422:
-            p_pic->p[ Y_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ Y_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ U_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ U_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ U_PLANE ].i_pitch = i_width_aligned / 2;
-            p_pic->p[ U_PLANE ].i_visible_pitch = i_width / 2;
-            p_pic->p[ V_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ V_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ V_PLANE ].i_pitch = i_width_aligned / 2;
-            p_pic->p[ V_PLANE ].i_visible_pitch = i_width / 2;
-            p_pic->i_planes = 3;
-            break;
-
-        case FOURCC_I440:
-        case FOURCC_J440:
-            p_pic->p[ Y_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ Y_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ U_PLANE ].i_lines = i_height_aligned / 2;
-            p_pic->p[ U_PLANE ].i_visible_lines = i_height / 2;
-            p_pic->p[ U_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ U_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ V_PLANE ].i_lines = i_height_aligned / 2;
-            p_pic->p[ V_PLANE ].i_visible_lines = i_height / 2;
-            p_pic->p[ V_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ V_PLANE ].i_visible_pitch = i_width;
-            p_pic->i_planes = 3;
-            break;
-
-        case FOURCC_I444:
-        case FOURCC_J444:
-            p_pic->p[ Y_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ Y_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ U_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ U_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ U_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ U_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ V_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ V_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ V_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ V_PLANE ].i_visible_pitch = i_width;
-            p_pic->i_planes = 3;
-            break;
-
-        case FOURCC_YUVA:
-            p_pic->p[ Y_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ Y_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ Y_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ U_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ U_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ U_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ U_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ V_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ V_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ V_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ V_PLANE ].i_visible_pitch = i_width;
-            p_pic->p[ A_PLANE ].i_lines = i_height_aligned;
-            p_pic->p[ A_PLANE ].i_visible_lines = i_height;
-            p_pic->p[ A_PLANE ].i_pitch = i_width_aligned;
-            p_pic->p[ A_PLANE ].i_visible_pitch = i_width;
-            p_pic->i_planes = 4;
-            break;
-
-        case FOURCC_YUVP:
-            p_pic->p->i_lines = i_height_aligned;
-            p_pic->p->i_visible_lines = i_height;
-            p_pic->p->i_pitch = i_width_aligned;
-            p_pic->p->i_visible_pitch = i_width;
-            p_pic->p->i_pixel_pitch = 8;
-            p_pic->i_planes = 1;
-            break;
-
-        case FOURCC_Y211:
-            p_pic->p->i_lines = i_height_aligned;
-            p_pic->p->i_visible_lines = i_height;
-            p_pic->p->i_pitch = i_width_aligned;
-            p_pic->p->i_visible_pitch = i_width;
-            p_pic->p->i_pixel_pitch = 4;
-            p_pic->i_planes = 1;
-            break;
-
-        case FOURCC_UYVY:
-        case FOURCC_YUY2:
-            p_pic->p->i_lines = i_height_aligned;
-            p_pic->p->i_visible_lines = i_height;
-            p_pic->p->i_pitch = i_width_aligned * 2;
-            p_pic->p->i_visible_pitch = i_width * 2;
-            p_pic->p->i_pixel_pitch = 4;
-            p_pic->i_planes = 1;
-            break;
-
-        case FOURCC_RGB2:
-            p_pic->p->i_lines = i_height_aligned;
-            p_pic->p->i_visible_lines = i_height;
-            p_pic->p->i_pitch = i_width_aligned;
-            p_pic->p->i_visible_pitch = i_width;
-            p_pic->p->i_pixel_pitch = 1;
-            p_pic->i_planes = 1;
-            break;
-
-        case FOURCC_RV15:
-            p_pic->p->i_lines = i_height_aligned;
-            p_pic->p->i_visible_lines = i_height;
-            p_pic->p->i_pitch = i_width_aligned * 2;
-            p_pic->p->i_visible_pitch = i_width * 2;
-            p_pic->p->i_pixel_pitch = 2;
-            p_pic->i_planes = 1;
-            break;
-
-        case FOURCC_RV16:
-            p_pic->p->i_lines = i_height_aligned;
-            p_pic->p->i_visible_lines = i_height;
-            p_pic->p->i_pitch = i_width_aligned * 2;
-            p_pic->p->i_visible_pitch = i_width * 2;
-            p_pic->p->i_pixel_pitch = 2;
-            p_pic->i_planes = 1;
-            break;
-
-        case FOURCC_RV24:
-            p_pic->p->i_lines = i_height_aligned;
-            p_pic->p->i_visible_lines = i_height;
-            p_pic->p->i_pitch = i_width_aligned * 3;
-            p_pic->p->i_visible_pitch = i_width * 3;
-            p_pic->p->i_pixel_pitch = 3;
-            p_pic->i_planes = 1;
-            break;
-
-        case FOURCC_RV32:
-        case FOURCC_RGBA:
-            p_pic->p->i_lines = i_height_aligned;
-            p_pic->p->i_visible_lines = i_height;
-            p_pic->p->i_pitch = i_width_aligned * 4;
-            p_pic->p->i_visible_pitch = i_width * 4;
-            p_pic->p->i_pixel_pitch = 4;
-            p_pic->i_planes = 1;
-            break;
-
-        case FOURCC_GREY:
-        case FOURCC_Y800:
-        case FOURCC_Y8:
-        case FOURCC_RGBP:
-            p_pic->p->i_lines = i_height_aligned;
-            p_pic->p->i_visible_lines = i_height;
-            p_pic->p->i_pitch = i_width_aligned;
-            p_pic->p->i_visible_pitch = i_width;
-            p_pic->p->i_pixel_pitch = 1;
-            p_pic->i_planes = 1;
-            break;
-
-        default:
-            if( p_this )
-                msg_Err( p_this, "unknown chroma type 0x%.8x (%4.4s)",
-                                 i_chroma, (char*)&i_chroma );
-            p_pic->i_planes = 0;
-            return VLC_EGENERIC;
-    }
-
-    return VLC_SUCCESS;
-}
-
 /**
  * Compare two chroma values
  *
@@ -956,30 +598,25 @@ int __vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
 int vout_ChromaCmp( vlc_fourcc_t i_chroma, vlc_fourcc_t i_amorhc )
 {
     static const vlc_fourcc_t p_I420[] = {
-        FOURCC_I420, FOURCC_IYUV, FOURCC_YV12, FOURCC_J420, 0
+        VLC_CODEC_I420, VLC_CODEC_YV12, VLC_CODEC_J420, 0
     };
     static const vlc_fourcc_t p_I422[] = {
-        FOURCC_I422, FOURCC_J422, 0
+        VLC_CODEC_I422, VLC_CODEC_J422, 0
     };
     static const vlc_fourcc_t p_I440[] = {
-        FOURCC_I440, FOURCC_J440, 0
+        VLC_CODEC_I440, VLC_CODEC_J440, 0
     };
     static const vlc_fourcc_t p_I444[] = {
-        FOURCC_I444, FOURCC_J444, 0
-    };
-    static const vlc_fourcc_t p_UYVY[] = {
-        FOURCC_UYVY, FOURCC_UYNV, FOURCC_Y422, 0
-    };
-    static const vlc_fourcc_t p_YUYV[] = {
-        FOURCC_YUY2, FOURCC_YUNV, 0
-    };
-    static const vlc_fourcc_t p_GREY[] = {
-        FOURCC_GREY, FOURCC_Y800, FOURCC_Y8, 0
+        VLC_CODEC_I444, VLC_CODEC_J444, 0
     };
     static const vlc_fourcc_t *pp_fcc[] = {
-        p_I420, p_I422, p_I440, p_I444, p_UYVY, p_YUYV, p_GREY, NULL
+        p_I420, p_I422, p_I440, p_I444, NULL
     };
 
+    /* */
+    i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, i_chroma );
+    i_amorhc = vlc_fourcc_GetCodec( VIDEO_ES, i_amorhc );
+
     /* If they are the same, they are the same ! */
     if( i_chroma == i_amorhc )
         return 1;
@@ -1011,6 +648,255 @@ static void PictureReleaseCallback( picture_t *p_picture )
         return;
     picture_Delete( p_picture );
 }
+
+/*****************************************************************************
+ *
+ *****************************************************************************/
+int picture_Setup( picture_t *p_picture, vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect )
+{
+    int i_index, i_width_aligned, i_height_aligned;
+
+    /* Store default values */
+    for( i_index = 0; i_index < VOUT_MAX_PLANES; i_index++ )
+    {
+        p_picture->p[i_index].p_pixels = NULL;
+        p_picture->p[i_index].i_pixel_pitch = 1;
+    }
+
+    p_picture->pf_release = NULL;
+    p_picture->p_release_sys = NULL;
+    p_picture->pf_lock = NULL;
+    p_picture->pf_unlock = NULL;
+    p_picture->i_refcount = 0;
+
+    p_picture->i_qtype = QTYPE_NONE;
+    p_picture->i_qstride = 0;
+    p_picture->p_q = NULL;
+
+    video_format_Setup( &p_picture->format, i_chroma, i_width, i_height, i_aspect );
+
+    /* Make sure the real dimensions are a multiple of 16 */
+    i_width_aligned = (i_width + 15) >> 4 << 4;
+    i_height_aligned = (i_height + 15) >> 4 << 4;
+
+    /* Calculate coordinates */
+    switch( vlc_fourcc_GetCodec( VIDEO_ES, i_chroma ) )
+    {
+    case VLC_CODEC_I411:
+        p_picture->p[ Y_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ Y_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ U_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ U_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ U_PLANE ].i_pitch = i_width_aligned / 4;
+        p_picture->p[ U_PLANE ].i_visible_pitch = i_width / 4;
+        p_picture->p[ V_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ V_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ V_PLANE ].i_pitch = i_width_aligned / 4;
+        p_picture->p[ V_PLANE ].i_visible_pitch = i_width / 4;
+        p_picture->i_planes = 3;
+        break;
+
+    case VLC_CODEC_I410:
+        p_picture->p[ Y_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ Y_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ U_PLANE ].i_lines = i_height_aligned / 4;
+        p_picture->p[ U_PLANE ].i_visible_lines = i_height / 4;
+        p_picture->p[ U_PLANE ].i_pitch = i_width_aligned / 4;
+        p_picture->p[ U_PLANE ].i_visible_pitch = i_width / 4;
+        p_picture->p[ V_PLANE ].i_lines = i_height_aligned / 4;
+        p_picture->p[ V_PLANE ].i_visible_lines = i_height / 4;
+        p_picture->p[ V_PLANE ].i_pitch = i_width_aligned / 4;
+        p_picture->p[ V_PLANE ].i_visible_pitch = i_width / 4;
+        p_picture->i_planes = 3;
+        break;
+
+    case VLC_CODEC_YV12:
+    case VLC_CODEC_I420:
+    case VLC_CODEC_J420:
+        p_picture->p[ Y_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ Y_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ U_PLANE ].i_lines = i_height_aligned / 2;
+        p_picture->p[ U_PLANE ].i_visible_lines = i_height / 2;
+        p_picture->p[ U_PLANE ].i_pitch = i_width_aligned / 2;
+        p_picture->p[ U_PLANE ].i_visible_pitch = i_width / 2;
+        p_picture->p[ V_PLANE ].i_lines = i_height_aligned / 2;
+        p_picture->p[ V_PLANE ].i_visible_lines = i_height / 2;
+        p_picture->p[ V_PLANE ].i_pitch = i_width_aligned / 2;
+        p_picture->p[ V_PLANE ].i_visible_pitch = i_width / 2;
+        p_picture->i_planes = 3;
+        break;
+
+    case VLC_CODEC_I422:
+    case VLC_CODEC_J422:
+        p_picture->p[ Y_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ Y_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ U_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ U_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ U_PLANE ].i_pitch = i_width_aligned / 2;
+        p_picture->p[ U_PLANE ].i_visible_pitch = i_width / 2;
+        p_picture->p[ V_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ V_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ V_PLANE ].i_pitch = i_width_aligned / 2;
+        p_picture->p[ V_PLANE ].i_visible_pitch = i_width / 2;
+        p_picture->i_planes = 3;
+        break;
+
+    case VLC_CODEC_I440:
+    case VLC_CODEC_J440:
+        p_picture->p[ Y_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ Y_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ U_PLANE ].i_lines = i_height_aligned / 2;
+        p_picture->p[ U_PLANE ].i_visible_lines = i_height / 2;
+        p_picture->p[ U_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ U_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ V_PLANE ].i_lines = i_height_aligned / 2;
+        p_picture->p[ V_PLANE ].i_visible_lines = i_height / 2;
+        p_picture->p[ V_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ V_PLANE ].i_visible_pitch = i_width;
+        p_picture->i_planes = 3;
+        break;
+
+    case VLC_CODEC_I444:
+    case VLC_CODEC_J444:
+        p_picture->p[ Y_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ Y_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ U_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ U_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ U_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ U_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ V_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ V_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ V_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ V_PLANE ].i_visible_pitch = i_width;
+        p_picture->i_planes = 3;
+        break;
+
+    case VLC_CODEC_YUVA:
+        p_picture->p[ Y_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ Y_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ Y_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ U_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ U_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ U_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ U_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ V_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ V_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ V_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ V_PLANE ].i_visible_pitch = i_width;
+        p_picture->p[ A_PLANE ].i_lines = i_height_aligned;
+        p_picture->p[ A_PLANE ].i_visible_lines = i_height;
+        p_picture->p[ A_PLANE ].i_pitch = i_width_aligned;
+        p_picture->p[ A_PLANE ].i_visible_pitch = i_width;
+        p_picture->i_planes = 4;
+        break;
+
+    case VLC_CODEC_YUVP:
+        p_picture->p->i_lines = i_height_aligned;
+        p_picture->p->i_visible_lines = i_height;
+        p_picture->p->i_pitch = i_width_aligned;
+        p_picture->p->i_visible_pitch = i_width;
+        p_picture->p->i_pixel_pitch = 8;
+        p_picture->i_planes = 1;
+        break;
+
+    case VLC_CODEC_Y211:
+        p_picture->p->i_lines = i_height_aligned;
+        p_picture->p->i_visible_lines = i_height;
+        p_picture->p->i_pitch = i_width_aligned;
+        p_picture->p->i_visible_pitch = i_width;
+        p_picture->p->i_pixel_pitch = 4;
+        p_picture->i_planes = 1;
+        break;
+
+    case VLC_CODEC_UYVY:
+    case VLC_CODEC_VYUY:
+    case VLC_CODEC_YUYV:
+    case VLC_CODEC_YVYU:
+        p_picture->p->i_lines = i_height_aligned;
+        p_picture->p->i_visible_lines = i_height;
+        p_picture->p->i_pitch = i_width_aligned * 2;
+        p_picture->p->i_visible_pitch = i_width * 2;
+        p_picture->p->i_pixel_pitch = 4;
+        p_picture->i_planes = 1;
+        break;
+
+    case VLC_CODEC_RGB8:
+        p_picture->p->i_lines = i_height_aligned;
+        p_picture->p->i_visible_lines = i_height;
+        p_picture->p->i_pitch = i_width_aligned;
+        p_picture->p->i_visible_pitch = i_width;
+        p_picture->p->i_pixel_pitch = 1;
+        p_picture->i_planes = 1;
+        break;
+
+    case VLC_CODEC_RGB15:
+        p_picture->p->i_lines = i_height_aligned;
+        p_picture->p->i_visible_lines = i_height;
+        p_picture->p->i_pitch = i_width_aligned * 2;
+        p_picture->p->i_visible_pitch = i_width * 2;
+        p_picture->p->i_pixel_pitch = 2;
+        p_picture->i_planes = 1;
+        break;
+
+    case VLC_CODEC_RGB16:
+        p_picture->p->i_lines = i_height_aligned;
+        p_picture->p->i_visible_lines = i_height;
+        p_picture->p->i_pitch = i_width_aligned * 2;
+        p_picture->p->i_visible_pitch = i_width * 2;
+        p_picture->p->i_pixel_pitch = 2;
+        p_picture->i_planes = 1;
+        break;
+
+    case VLC_CODEC_RGB24:
+        p_picture->p->i_lines = i_height_aligned;
+        p_picture->p->i_visible_lines = i_height;
+        p_picture->p->i_pitch = i_width_aligned * 3;
+        p_picture->p->i_visible_pitch = i_width * 3;
+        p_picture->p->i_pixel_pitch = 3;
+        p_picture->i_planes = 1;
+        break;
+
+    case VLC_CODEC_RGB32:
+    case VLC_CODEC_RGBA:
+        p_picture->p->i_lines = i_height_aligned;
+        p_picture->p->i_visible_lines = i_height;
+        p_picture->p->i_pitch = i_width_aligned * 4;
+        p_picture->p->i_visible_pitch = i_width * 4;
+        p_picture->p->i_pixel_pitch = 4;
+        p_picture->i_planes = 1;
+        break;
+
+    case VLC_CODEC_GREY:
+    case VLC_CODEC_RGBP:
+        p_picture->p->i_lines = i_height_aligned;
+        p_picture->p->i_visible_lines = i_height;
+        p_picture->p->i_pitch = i_width_aligned;
+        p_picture->p->i_visible_pitch = i_width;
+        p_picture->p->i_pixel_pitch = 1;
+        p_picture->i_planes = 1;
+        break;
+
+    default:
+        p_picture->i_planes = 0;
+        return VLC_EGENERIC;
+    }
+
+    return VLC_SUCCESS;
+}
+
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -1040,6 +926,7 @@ picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_
 void picture_Delete( picture_t *p_picture )
 {
     assert( p_picture && p_picture->i_refcount == 0 );
+    assert( p_picture->p_release_sys == NULL );
 
     free( p_picture->p_q );
     free( p_picture->p_data_orig );
@@ -1162,4 +1049,3 @@ int picture_Export( vlc_object_t *p_obj,
 /*****************************************************************************
  *
  *****************************************************************************/
-
index 8cfc8922827bfb2264d259ad61e23af0ecd21406..8d41545b56c85eb09f1baeffdf284735afb0e09b 100644 (file)
  * Fourcc definitions that we can handle internally
  *****************************************************************************/
 
-/* Packed RGB for 8bpp */
-#define FOURCC_BI_RGB       0x00000000
-#define FOURCC_RGB2         VLC_FOURCC('R','G','B','2')
-
-/* Packed RGB for 16, 24, 32bpp */
-#define FOURCC_BI_BITFIELDS 0x00000003
-
-/* Packed RGB 15bpp, usually 0x7c00, 0x03e0, 0x001f */
-#define FOURCC_RV15         VLC_FOURCC('R','V','1','5')
-
-/* Packed RGB 16bpp, usually 0xf800, 0x07e0, 0x001f */
-#define FOURCC_RV16         VLC_FOURCC('R','V','1','6')
-
-/* Packed RGB 24bpp, usually 0x00ff0000, 0x0000ff00, 0x000000ff */
-#define FOURCC_RV24         VLC_FOURCC('R','V','2','4')
-
-/* Packed RGB 32bpp, usually 0x00ff0000, 0x0000ff00, 0x000000ff */
-#define FOURCC_RV32         VLC_FOURCC('R','V','3','2')
-
-/* Packed RGBA 32bpp, like RV32 with 0xff000000 used for alpha */
-#define FOURCC_RGBA         VLC_FOURCC('R','G','B','A')
-
-/* Planar YUV 4:2:0, Y:U:V */
-#define FOURCC_I420         VLC_FOURCC('I','4','2','0')
-#define FOURCC_IYUV         VLC_FOURCC('I','Y','U','V')
-#define FOURCC_J420         VLC_FOURCC('J','4','2','0')
-
-/* Planar YUV 4:2:0, Y:V:U */
-#define FOURCC_YV12         VLC_FOURCC('Y','V','1','2')
-
-/* Packed YUV 4:2:2, U:Y:V:Y, interlaced */
-#define FOURCC_IUYV         VLC_FOURCC('I','U','Y','V')
-
-/* Packed YUV 4:2:2, U:Y:V:Y */
-#define FOURCC_UYVY         VLC_FOURCC('U','Y','V','Y')
-#define FOURCC_UYNV         VLC_FOURCC('U','Y','N','V')
-#define FOURCC_Y422         VLC_FOURCC('Y','4','2','2')
-
-/* Packed YUV 4:2:2, U:Y:V:Y, reverted */
-#define FOURCC_cyuv         VLC_FOURCC('c','y','u','v')
-
-/* Packed YUV 4:2:2, Y:U:Y:V */
-#define FOURCC_YUY2         VLC_FOURCC('Y','U','Y','2')
-#define FOURCC_YUNV         VLC_FOURCC('Y','U','N','V')
-
-/* Packed YUV 4:2:2, Y:V:Y:U */
-#define FOURCC_YVYU         VLC_FOURCC('Y','V','Y','U')
-
-/* Packed YUV 2:1:1, Y:U:Y:V */
-#define FOURCC_Y211         VLC_FOURCC('Y','2','1','1')
-
-/* Planar YUV 4:1:1, Y:U:V */
-#define FOURCC_I411         VLC_FOURCC('I','4','1','1')
-
-/* Planar YUV 4:1:0, Y:U:V */
-#define FOURCC_I410         VLC_FOURCC('I','4','1','0')
-#define FOURCC_YVU9         VLC_FOURCC('Y','V','U','9')
-
-/* Planar Y, packed UV, from Matrox */
-#define FOURCC_YMGA         VLC_FOURCC('Y','M','G','A')
-
-/* Planar 4:2:2, Y:U:V */
-#define FOURCC_I422         VLC_FOURCC('I','4','2','2')
-#define FOURCC_J422         VLC_FOURCC('J','4','2','2')
-
-/* Planar 4:4:0, Y:U:V */
-#define FOURCC_I440         VLC_FOURCC('I','4','4','0')
-#define FOURCC_J440         VLC_FOURCC('J','4','4','0')
-
-/* Planar 4:4:4, Y:U:V */
-#define FOURCC_I444         VLC_FOURCC('I','4','4','4')
-#define FOURCC_J444         VLC_FOURCC('J','4','4','4')
-
-/* Planar 4:4:4:4 Y:U:V:A */
-#define FOURCC_YUVA         VLC_FOURCC('Y','U','V','A')
-
-/* Palettized YUV with palette element Y:U:V:A */
-#define FOURCC_YUVP         VLC_FOURCC('Y','U','V','P')
-
-/* Palettized RGB with palette element R:G:B */
-#define FOURCC_RGBP         VLC_FOURCC('R','G','B','P')
-
-
-/* Planar 8-bit grayscale */
-#define FOURCC_GREY         VLC_FOURCC('G','R','E','Y')
-#define FOURCC_Y800         VLC_FOURCC('Y','8','0','0')
-#define FOURCC_Y8           VLC_FOURCC('Y','8',' ',' ')
-
 /* Alignment of critical dynamic data structure
  *
  * Not all platforms support memalign so we provide a vlc_memalign wrapper
index 393b4bbcec3d1de87bc771e50e4f65ae9e7d29ff..84ac9996fee7792978c0492e72e982dc478b59aa 100644 (file)
 /* Number of simultaneous subpictures */
 #define VOUT_MAX_SUBPICTURES (VOUT_MAX_PICTURES)
 
-#define VLC_FOURCC_YUVP VLC_FOURCC('Y','U','V','P')
-#define VLC_FOURCC_YUVA VLC_FOURCC('Y','U','V','A')
-#define VLC_FOURCC_RGBA VLC_FOURCC('R','G','B','A')
-#define VLC_FOURCC_TEXT VLC_FOURCC('T','E','X','T')
-
 /* */
 typedef struct
 {
@@ -735,7 +730,7 @@ subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
 
     p_region->fmt = *p_fmt;
     p_region->fmt.p_palette = NULL;
-    if( p_fmt->i_chroma == VLC_FOURCC_YUVP )
+    if( p_fmt->i_chroma == VLC_CODEC_YUVP )
     {
         p_region->fmt.p_palette = calloc( 1, sizeof(*p_region->fmt.p_palette) );
         if( p_fmt->p_palette )
@@ -748,7 +743,7 @@ subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
     p_region->p_style = NULL;
     p_region->p_picture = NULL;
 
-    if( p_fmt->i_chroma == VLC_FOURCC_TEXT )
+    if( p_fmt->i_chroma == VLC_CODEC_TEXT )
         return p_region;
 
     p_region->p_picture = picture_New( p_fmt->i_chroma, p_fmt->i_width, p_fmt->i_height,
@@ -779,7 +774,8 @@ void subpicture_region_Delete( subpicture_region_t *p_region )
 
     free( p_region->psz_text );
     free( p_region->psz_html );
-    //free( p_region->p_style ); FIXME --fenrir plugin does not allocate the memory for it. I think it might lead to segfault, video renderer can live longer than the decoder
+    if( p_region->p_style )
+        text_style_Delete( p_region->p_style );
     free( p_region );
 }
 
@@ -1035,11 +1031,11 @@ static void SpuRenderCreateAndLoadScale( spu_t *p_spu )
     /* XXX p_spu->p_scale is used for all conversion/scaling except yuvp to
      * yuva/rgba */
     p_spu->p->p_scale = CreateAndLoadScale( VLC_OBJECT(p_spu),
-                                            VLC_FOURCC_YUVA, VLC_FOURCC_YUVA, true );
+                                            VLC_CODEC_YUVA, VLC_CODEC_YUVA, true );
     /* This one is used for YUVP to YUVA/RGBA without scaling
      * FIXME rename it */
     p_spu->p->p_scale_yuvp = CreateAndLoadScale( VLC_OBJECT(p_spu),
-                                                 VLC_FOURCC_YUVP, VLC_FOURCC_YUVA, false );
+                                                 VLC_CODEC_YUVP, VLC_CODEC_YUVA, false );
 }
 
 static void SpuRenderText( spu_t *p_spu, bool *pb_rerender_text,
@@ -1048,7 +1044,7 @@ static void SpuRenderText( spu_t *p_spu, bool *pb_rerender_text,
 {
     filter_t *p_text = p_spu->p->p_text;
 
-    assert( p_region->fmt.i_chroma == VLC_FOURCC_TEXT );
+    assert( p_region->fmt.i_chroma == VLC_CODEC_TEXT );
 
     if( !p_text || !p_text->p_module )
         goto exit;
@@ -1353,14 +1349,14 @@ static void SpuRenderRegion( spu_t *p_spu,
     *p_area = spu_area_create( 0,0, 0,0, scale_size );
 
     /* Render text region */
-    if( p_region->fmt.i_chroma == VLC_FOURCC_TEXT )
+    if( p_region->fmt.i_chroma == VLC_CODEC_TEXT )
     {
         const int i_min_scale_ratio = SCALE_UNIT; /* FIXME what is the right value? (scale_size is not) */
         SpuRenderText( p_spu, &b_rerender_text, p_subpic, p_region, i_min_scale_ratio );
         b_restore_format = b_rerender_text;
 
         /* Check if the rendering has failed ... */
-        if( p_region->fmt.i_chroma == VLC_FOURCC_TEXT )
+        if( p_region->fmt.i_chroma == VLC_CODEC_TEXT )
             goto exit;
     }
 
@@ -1368,7 +1364,7 @@ static void SpuRenderRegion( spu_t *p_spu,
      * FIXME b_force_palette and b_force_crop are applied to all subpictures using palette
      * instead of only the right one (being the dvd spu).
      */
-    const bool b_using_palette = p_region->fmt.i_chroma == VLC_FOURCC_YUVP;
+    const bool b_using_palette = p_region->fmt.i_chroma == VLC_CODEC_YUVP;
     const bool b_force_palette = b_using_palette && p_sys->b_force_palette;
     const bool b_force_crop    = b_force_palette && p_sys->b_force_crop;
     bool b_changed_palette     = false;
@@ -1483,7 +1479,7 @@ static void SpuRenderRegion( spu_t *p_spu,
 
                 /* TODO converting to RGBA for RGB video output is better */
                 p_scale_yuvp->fmt_out.video = p_region->fmt;
-                p_scale_yuvp->fmt_out.video.i_chroma = VLC_FOURCC_YUVA;
+                p_scale_yuvp->fmt_out.video.i_chroma = VLC_CODEC_YUVA;
 
                 p_picture = p_scale_yuvp->pf_video_filter( p_scale_yuvp, p_picture );
                 if( !p_picture )
index 73c65b93d27143f05b5b40c59b6be81157b92827..8703d8fe51283da1afaf38613de7d8c62101c5a3 100644 (file)
@@ -38,30 +38,37 @@ samples/meta.sample:
        curl $(SAMPLES_SERVER)/metadata/id3tag/Wesh-Bonneville.mp3 > $@
 
 CFLAGS_tests = `$(VLC_CONFIG) --cflags libvlc` -DSRCDIR=\"$(srcdir)\"
+LDFLAGS_tests = -no-install -static
 
 test_libvlc_core_SOURCES = libvlc/core.c
 test_libvlc_core_LDADD = $(top_builddir)/src/libvlc.la
 test_libvlc_core_CFLAGS = $(CFLAGS_tests)
+test_libvlc_core_LDFLAGS = $(LDFLAGS_tests)
 
 test_libvlc_events_SOURCES = libvlc/events.c
 test_libvlc_events_LDADD = $(top_builddir)/src/libvlc.la
 test_libvlc_events_CFLAGS = $(CFLAGS_tests)
+test_libvlc_events_LDFLAGS = $(LDFLAGS_tests)
 
 test_libvlc_media_list_player_SOURCES = libvlc/media_list_player.c
 test_libvlc_media_list_player_LDADD = $(top_builddir)/src/libvlc.la
 test_libvlc_media_list_player_CFLAGS = $(CFLAGS_tests)
+test_libvlc_media_list_player_LDFLAGS = $(LDFLAGS_tests)
 
 test_libvlc_media_list_SOURCES = libvlc/media_list.c
 test_libvlc_media_list_LDADD = $(top_builddir)/src/libvlc.la
 test_libvlc_media_list_CFLAGS = $(CFLAGS_tests)
+test_libvlc_media_list_LDFLAGS = $(LDFLAGS_tests)
 
 test_libvlc_media_player_SOURCES = libvlc/media_player.c
 test_libvlc_media_player_LDADD = $(top_builddir)/src/libvlc.la
 test_libvlc_media_player_CFLAGS = $(CFLAGS_tests)
+test_libvlc_media_player_LDFLAGS = $(LDFLAGS_tests)
 
 test_libvlc_meta_SOURCES = libvlc/meta.c
 test_libvlc_meta_LDADD = $(top_builddir)/src/libvlc.la
 test_libvlc_meta_CFLAGS = $(CFLAGS_tests)
+test_libvlc_meta_LDFLAGS = $(LDFLAGS_tests)
 
 checkall:
        $(MAKE) check_PROGRAMS="$(check_PROGRAMS) $(EXTRA_PROGRAMS)" check
index 4f68bf110e414995fe21891417d8c5dda60e7f6d..e9d773c1520d1be43281f701f874da44e739467d 100644 (file)
@@ -34,16 +34,6 @@ static void test_core (const char ** argv, int argc)
     vlc = libvlc_new (argc, argv, &ex);
     catch ();
 
-    libvlc_playlist_clear (vlc, &ex);
-    catch ();
-
-    id = libvlc_playlist_add_extended (vlc, "/dev/null", "Test", 0, NULL,
-                                       &ex);
-    catch ();
-
-    libvlc_playlist_clear (vlc, &ex);
-    catch ();
-
     libvlc_retain (vlc);
     libvlc_release (vlc);
     libvlc_release (vlc);