Friday, May 25, 2012

FIX: Install libam7xxx under ubuntu 11.10

libam7xxx is an open source library that  is used for communicating with USB projectors..
The supported projectors and more information along with the original drivers can be found here.

http://ao2.it/en/blog/2012/03/30/open-source-driver-usb-pico-projectors


This is all for all those who have tried to compile the libam7xxx libraries on Ubuntu 11.10 and failed to do it. Try giving this a try:

The libavformat version that is present in the repository is older than what is being used in the code.
All you need to do is to make some changes in the code to get it to compile

Follow these steps and it should compile:

get the stable 0.1.2 release of libam7xxx from here

Normally if you cmake and try to compile and after getting even the latest version of libavformat, libavdevice, libswscale, libavfilter an libavutil from the package manager the thing wont compile. undefined reference to avformat_close_input().

The problem is that libavformat53 does not have that avformat_close_input()

To get it to work you need to make some changes in the code of am7xxx-play.c

go to examples/am7xxx-play.c

Look for the function call to avformat_close_input()
Replace each such instance with av_close_input_file()


Also the parameter passed that was passed to avformat_close_input() was of type struct AVFormatContext **  you need to change fix that also as av_close_input_file() takes argument of type struct AVFormatContext *

Here is my patch:

diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c
index 324ed89..261d2fe 100644
--- a/examples/am7xxx-play.c
+++ b/examples/am7xxx-play.c
@@ -149,7 +149,7 @@ static int video_input_init(struct video_input_ctx *input_ctx,
     goto out;
 
 cleanup:
-    avformat_close_input(&input_format_ctx);
+    av_close_input_file(input_format_ctx);
 out:
     av_dict_free(input_options);
     *input_options = NULL;
@@ -451,7 +451,7 @@ cleanup_output:
 
 cleanup_input:
     avcodec_close(input_ctx.codec_ctx);
-    avformat_close_input(&(input_ctx.format_ctx));
+    av_close_input_file((input_ctx.format_ctx));
 
 out:
     return ret;





That is all
now it should compile easily if you have all the dependencies installed.


Hope this helps!
All the best!

10 comments:

  1. We get good information from your blog.This is a very nice blog Commercial Projects in Noida

    ReplyDelete
  2. Hair transplant mumbai is good to get the cheap and safe hair treatment of Follicular unit extraction or other techniques of hair loss therapies.

    ReplyDelete