]> git.sesse.net Git - vlc/blobdiff - modules/codec/ffmpeg/demux.c
* modules/demux/real.c, modules/codec/ffmpeg/demux.c: removed debug I left in there.
[vlc] / modules / codec / ffmpeg / demux.c
index 746f4231fdeeb442c66044169f8eb550d0239937..bb71b93c2c8101b572a1cc2708767603014c911a 100644 (file)
@@ -32,7 +32,7 @@
 #include "vlc_meta.h"
 
 /* ffmpeg header */
-#ifdef HAVE_FFMPEG_AVCODEC_H
+#ifdef HAVE_FFMPEG_AVFORMAT_H
 #   include <ffmpeg/avformat.h>
 #else
 #   include <avformat.h>
@@ -43,7 +43,7 @@
 //#define AVFORMAT_DEBUG 1
 
 /* Version checking */
-#if (LIBAVFORMAT_BUILD >= 4629) && defined(HAVE_LIBAVFORMAT)
+#if (LIBAVFORMAT_BUILD >= 4629) && (defined(HAVE_FFMPEG_AVFORMAT_H) || defined(HAVE_LIBAVFORMAT_TREE))
 
 /*****************************************************************************
  * demux_sys_t: demux descriptor
@@ -74,7 +74,7 @@ static int Demux  ( demux_t *p_demux );
 static int Control( demux_t *p_demux, int i_query, va_list args );
 
 static int IORead( void *opaque, uint8_t *buf, int buf_size );
-static int IOSeek( void *opaque, offset_t offset, int whence );
+static offset_t IOSeek( void *opaque, offset_t offset, int whence );
 
 /*****************************************************************************
  * Open
@@ -256,6 +256,7 @@ void E_(CloseDemux)( vlc_object_t *p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = p_demux->p_sys;
 
+    FREENULL( p_sys->tk );
     if( p_sys->ic ) av_close_input_file( p_sys->ic );
     if( p_sys->io_buffer ) free( p_sys->io_buffer );
     free( p_sys );
@@ -338,7 +339,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 *pf = (double)stream_Tell( p_demux->s ) / (double)i64;
             }
 
-            if( p_sys->ic->duration != AV_NOPTS_VALUE && p_sys->i_pcr > 0 )
+            if( (p_sys->ic->duration != AV_NOPTS_VALUE) && (p_sys->i_pcr > 0) )
             {
                 *pf = (double)p_sys->i_pcr / (double)p_sys->ic->duration;
             }
@@ -401,8 +402,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_GET_META:
         {
-            vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
-            vlc_meta_t *meta;
+            vlc_meta_t *p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
 
             if( !p_sys->ic->title[0] || !p_sys->ic->author[0] ||
                 !p_sys->ic->copyright[0] || !p_sys->ic->comment[0] ||
@@ -411,18 +411,16 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 return VLC_EGENERIC;
             }
 
-            *pp_meta = meta = vlc_meta_New();
-
             if( p_sys->ic->title[0] )
-                vlc_meta_Add( meta, VLC_META_TITLE, p_sys->ic->title );
+                vlc_meta_SetTitle( p_meta, p_sys->ic->title );
             if( p_sys->ic->author[0] )
-                vlc_meta_Add( meta, VLC_META_AUTHOR, p_sys->ic->author );
+                vlc_meta_SetArtist( p_meta, p_sys->ic->author );
             if( p_sys->ic->copyright[0] )
-                vlc_meta_Add( meta, VLC_META_COPYRIGHT, p_sys->ic->copyright );
+                vlc_meta_SetCopyright( p_meta, p_sys->ic->copyright );
             if( p_sys->ic->comment[0] )
-                vlc_meta_Add( meta, VLC_META_DESCRIPTION, p_sys->ic->comment );
+                vlc_meta_SetDescription( p_meta, p_sys->ic->comment );
             if( p_sys->ic->genre[0] )
-                vlc_meta_Add( meta, VLC_META_GENRE, p_sys->ic->genre );
+                vlc_meta_SetGenre( p_meta, p_sys->ic->genre );
             return VLC_SUCCESS;
         }
 
@@ -442,7 +440,7 @@ static int IORead( void *opaque, uint8_t *buf, int buf_size )
     return i_ret ? i_ret : -1;
 }
 
-static int IOSeek( void *opaque, offset_t offset, int whence )
+static offset_t IOSeek( void *opaque, offset_t offset, int whence )
 {
     URLContext *p_url = opaque;
     demux_t *p_demux = p_url->priv_data;