Hi,
        Considering the attached, what is the expected behavior? If
I change who is linked to what (second example) it works.  Seems
wrong to me.

        Because of this, transcode does not work on my freebsd machine.

bash-2.03$ make clean all test
rm -f load1 load2.so
c++ -o load1 load1.cc -pthread -L/usr/local/lib
c++ -shared -o load2.so  `avifile-config --cflags` load2.cc -L/usr/local/lib -laviplay
./load1 ./load2.so doit
Set_LDT
./load2.so opened.
/usr/local/lib/avifile0.6/libwin32-0.6.so: found  A: 12  V: 42 plugins
/usr/local/lib/avifile0.6/libmpeg_audiodec-0.6.so: found  A: 1  V: 0 plugin
/usr/local/lib/avifile0.6/libmp3lamebin_audioenc-0.6.so: found  A: 1  V: 0 plugin
/usr/local/lib/avifile0.6/libmad-0.6.so: found  A: 1  V: 0 plugin
/usr/local/lib/avifile0.6/libffmpeg-0.6.so: found  A: 2  V: 3 plugins
/usr/local/lib/avifile0.6/libaudiodec-0.6.so: found  A: 5  V: 0 plugins
/usr/local/lib/avifile0.6/libac3pass-0.6.so: found  A: 1  V: 0 plugin
Codec match DivX ;-) DirectShow
WARNING: plugin /usr/local/lib/avifile0.6/libwin32-0.6.so could not be opened: 
/usr/local/lib/avifile0.6/libwin32-0.6.so: Undefined symbol "__ti13IVideoDecoder"
bash-2.03$ 


bash-2.03$ make clean all test
rm -f load1 load2.so
c++ -o load1 load1.cc -pthread -L/usr/local/lib -laviplay
c++ -shared -o load2.so  `avifile-config --cflags` load2.cc -L/usr/local/lib
./load1 ./load2.so doit
Set_LDT
./load2.so opened.
/usr/local/lib/avifile0.6/libwin32-0.6.so: found  A: 12  V: 42 plugins
/usr/local/lib/avifile0.6/libmpeg_audiodec-0.6.so: found  A: 1  V: 0 plugin
/usr/local/lib/avifile0.6/libmp3lamebin_audioenc-0.6.so: found  A: 1  V: 0 plugin
/usr/local/lib/avifile0.6/libmad-0.6.so: found  A: 1  V: 0 plugin
/usr/local/lib/avifile0.6/libffmpeg-0.6.so: found  A: 2  V: 3 plugins
/usr/local/lib/avifile0.6/libaudiodec-0.6.so: found  A: 5  V: 0 plugins
/usr/local/lib/avifile0.6/libac3pass-0.6.so: found  A: 1  V: 0 plugin
Codec match DivX ;-) DirectShow
bash-2.03$ 

        --Mat
# Makefile
all: load1 load2.so

load2.so: load2.cc
        c++ -shared -o load2.so  `avifile-config --cflags` load2.cc -L/usr/local/lib 
-laviplay

load1: load1.cc
        c++ -o load1 load1.cc -pthread -L/usr/local/lib 
clean:
        rm -f load1 load2.so

test: load1 load2.so
        ./load1 ./load2.so doit
/*
 * load1.cc:  A simple 'dlopen'er and symbol caller
 */
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <err.h>

int 
main(int argc, char **argv) {

        void *modref;
        int (*modsym)(void);

        if(argc<3)
           errx(1, "%s filename symbol\n", argv[0]);

        modref=dlopen(argv[1], RTLD_LAZY|RTLD_GLOBAL );
        if(modref == NULL) 
           errx(2, "%s failed to open. (%s)", argv[1], dlerror());

        printf("%s opened.\n", argv[1]);

        (void *)modsym=dlsym(modref, argv[2]);
        if(modsym== NULL)
           errx(3, "%s failed to find symbol '%s'. (%s)", argv[1], argv[2], dlerror());

        modsym();

        return 0;
}
/*
 * load2.so: does a sample call to avifile
 */
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <fourcc.h>
#include <creators.h>                                                                  
                                                    
void
_init(void) {
        printf("%s _init called.\n",__FILE__);
}

extern "C" {

int
doit() {
        const CodecInfo* ci;
        BITMAPINFOHEADER m_bh;

        ci=CodecInfo::match(fccDIV3, CodecInfo::Video);
        printf("Codec match %s\n", ci->GetName());
        Creators::SetCodecAttr(*ci, "BitRate", 780000); // bits/second
        IVideoEncoder* pEnc=Creators::CreateVideoEncoder(fccDIVX, m_bh, ci->GetName());
        return 0;
}

}

Reply via email to