]> git.sesse.net Git - mlt/commitdiff
Add support for libavdevice (v4l/v4l2).
authorDan Dennedy <dan@dennedy.org>
Wed, 20 Jan 2010 06:57:21 +0000 (22:57 -0800)
committerDan Dennedy <dan@dennedy.org>
Wed, 20 Jan 2010 06:57:21 +0000 (22:57 -0800)
Thanks to hints from Volodymyr M. Lisivka.

LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so is required to get some
formats to work.

src/modules/avformat/configure
src/modules/avformat/factory.c
src/modules/avformat/producer_avformat.c

index 863c5f409616adced253806055f685f102fe0a42..fa0b8bb64206491ce462dc26d819135d6b16211d 100755 (executable)
@@ -147,12 +147,12 @@ else
        elif [ "$shared_ffmpeg" != "" ]
        then
                echo "PREFIX=$shared_ffmpeg" >> config.mak
-               echo "CFLAGS+=$(pkg-config --cflags libavformat) $TMP_CFLAGS" >> config.mak
-               echo "LDFLAGS+=$(pkg-config --libs libavformat)" >> config.mak
+               echo "CFLAGS+=$(pkg-config --cflags libavformat libavdevice) $TMP_CFLAGS" >> config.mak
+               echo "LDFLAGS+=$(pkg-config --libs-only-L libavformat libavdevice)" >> config.mak
                [ -d "$shared_ffmpeg/include/ffmpeg/libavformat" ] &&
-                       echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg/libavformat -I$shared_ffmpeg/include/ffmpeg/libavcodec" >> config.mak
+                       echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg/libavformat -I$shared_ffmpeg/include/ffmpeg/libavcodec -I$shared_ffmpeg/include/ffmpeg/libavdevice" >> config.mak
                [ -d "$shared_ffmpeg/include/libavformat" ] &&
-                       echo "CFLAGS+=-I$shared_ffmpeg/include/libavformat -I$shared_ffmpeg/include/libavcodec" >> config.mak
+                       echo "CFLAGS+=-I$shared_ffmpeg/include/libavformat -I$shared_ffmpeg/include/libavcodec -I$shared_ffmpeg/include/libavdevice" >> config.mak
                avcodec_version=$(pkg-config --modversion libavcodec)
                if [ "$swscale" != "" ] || ( [ $(echo $avcodec_version | cut -d. -f1) -ge 52 ] && [ $(echo $avcodec_version | cut -d. -f2) -ge 21 ] )
                then
index a8559f8e24b57820eaadb06014f5e0809b1e758c..8d35fea92689d77b6e3e1a139771c82fc1719018 100644 (file)
@@ -33,6 +33,7 @@ extern mlt_producer producer_avformat_init( mlt_profile profile, const char *ser
 
 // ffmpeg Header files
 #include <avformat.h>
+#include <avdevice.h>
 
 // A static flag used to determine if avformat has been initialised
 static int avformat_initialised = 0;
@@ -89,6 +90,7 @@ static void avformat_init( )
                avformat_initialised = 1;
                pthread_mutex_init( &avformat_mutex, NULL );
                av_register_all( );
+               avdevice_register_all();
                mlt_factory_register_for_clean_up( NULL, avformat_destroy );
                av_log_set_level( mlt_log_get_level() );
        }
index dda79b189ea90955ef7545ad0eb776dff8692f8b..e4a7438a5a47dba1bf346ead8f9363b47a7cbff1 100644 (file)
@@ -449,8 +449,6 @@ static int producer_open( producer_avformat this, mlt_profile profile, char *fil
                        params->sample_rate = 48000;
                }
 
-               // XXX: this does not work anymore since avdevice
-               // TODO: make producer_avddevice?
                // Parse out params
                mrl = strchr( file, '?' );
                while ( mrl )
@@ -527,6 +525,7 @@ static int producer_open( producer_avformat this, mlt_profile profile, char *fil
 
                        // Check if we're seekable (something funny about mpeg here :-/)
                        if ( strncmp( file, "pipe:", 5 ) &&
+                                strncmp( file, "/dev/", 5 ) &&
                                 strncmp( file, "http:", 5 ) &&
                                 strncmp( file, "udp:", 4 )  &&
                                 strncmp( file, "tcp:", 4 )  &&