locked
FileNotFound exception when call the c++ component from a c# win8 store app

    Question

  • Hi,

    I want to write a wrapper for ffmpeg library for my c# app

    here is my header file:

    #pragma once
    extern "C"
    {
    #include <libavutil/avutil.h>
    #include <libavcodec/avcodec.h>
    #include <libavformat/avformat.h>
    #include <libavcodec/avcodec.h>
    #include <libavutil/mathematics.h>
    #include <libavutil/opt.h>
    #include <libavcodec/avcodec.h>
    #include <libavutil/channel_layout.h>
    #include <libavutil/common.h>
    #include <libavutil/imgutils.h>
    #include <libavutil/mathematics.h>
    #include <libavutil/samplefmt.h>
    }
    
    using namespace Platform;
    
    	namespace FFMpegWrapper
    	{
    		public ref class PhotoStory sealed
    		{
    		public:
    			PhotoStory();
    			//void initFile(String^ outputFilePath);
    			void finish();
    
    			void initFile(String^ outputFilePath,int width,int height);
    			int addAudio(String^ audioFilename);
    			int addFrame(String^ imageFilename);
    
    
    		private:
    				~PhotoStory();
    				AVCodec *codec;
    				AVCodecContext *context;
    
    				int i, out_size, size, outbuf_size;  
    				int output_width,output_height;
    				FILE *outputFile;  
    				AVFrame *picture;  
    				uint8_t *outbuf;  
    
    				char* String2Char(String^ input);
    
    				AVFrame* OpenImage(const char* imageFileName);
    			
    		};
    	}


    and the cpp file:

    #include "pch.h";
    #include "PhotoStory.h"
    
    
    using namespace FFMpegWrapper;
    
    PhotoStory::PhotoStory()
    {
    }
    
    
    PhotoStory::~PhotoStory()
    {
    }
    
    void PhotoStory::initFile(String^ outputFilePath,int width,int height){
    	
    }
    
    int PhotoStory::addAudio(String^ audioFilename){
    	return 0;
    }
    
    
    int PhotoStory::addFrame(String^ imageFilename){
    
    	return 0;
    }
    
    void PhotoStory::finish()
    {
    	
    }
    
    AVFrame* PhotoStory::OpenImage(const char* imageFileName)
    {
    	return NULL;
    }



    I call it from c# store app  project

     FFMpegWrapper.PhotoStory c = new FFMpegWrapper.PhotoStory();


    it works,

    But if I add any lines to the cpp file which should call the ffmpeg APIs,

    for example, I changed funtion initFile to this:

    void PhotoStory::initFile(String^ outputFilePath,int width,int height){
    	av_register_all();
    }

    the c# code above will throw a FileNotFoundException/Module could not be found( HRESULT:0x8007007E)

    I downloaded the ffmpeg lib from this url:

    http://ffmpeg.zeranoe.com/builds/win32/dev/ffmpeg-20130406-git-7775992-win32-dev.7z


    Monday, April 08, 2013 1:27 AM

Answers

  • OK

    I found the problem

    I need to copy the ffmpeg dll files into the app project and set it be copied to the output folder

    • Marked as answer by Astro-Boy Monday, April 08, 2013 2:13 AM
    Monday, April 08, 2013 2:13 AM

All replies

  • OK

    I found the problem

    I need to copy the ffmpeg dll files into the app project and set it be copied to the output folder

    • Marked as answer by Astro-Boy Monday, April 08, 2013 2:13 AM
    Monday, April 08, 2013 2:13 AM
  • Thanks for sharing the solution.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 09, 2013 2:45 AM