4 years agodebian/changelog: release package version 0.1.7-1 debian/master debian/0.1.7-1
Antonio Ospite [Sat, 3 Mar 2018 15:19:34 +0000 (16:19 +0100)]
debian/changelog: release package version 0.1.7-1

Gbp-Dch: ignore

4 years agodebian/control: drop the dependency on dpkg-dev
Antonio Ospite [Sat, 3 Mar 2018 14:48:03 +0000 (15:48 +0100)]
debian/control: drop the dependency on dpkg-dev

dpkg-dev is an essential package and it's not necessary to depend on it
unless a versioned dependency is used.

Removing the dependency fixes the following lintian error:

E: libam7xxx source: depends-on-build-essential-package-without-using-version dpkg-dev [build-depends: dpkg-dev]
N:    The package declares a depends on a build essential package without
N:    using a versioned depends. Packages do not have to build-depend on any
N:    package included in build-essential. It is the responsibility of anyone
N:    building packages to have all build-essential packages installed. The
N:    only reason for an explicit dependency on a package included in
N:    build-essential is if a particular version of that package is required,
N:    in which case the dependency should include the version.
N:    Refer to Debian Policy Manual section 4.2 (Package relationships) for
N:    details.
N:    Severity: important, Certainty: certain
N:    Check: fields, Type: binary, udeb, source

4 years agodebian/control: remove obsolete Conflicts/Replaces
Antonio Ospite [Sat, 3 Mar 2018 14:38:13 +0000 (15:38 +0100)]
debian/control: remove obsolete Conflicts/Replaces

The conflicting packages are not in the Debian archive anymore.

This silences the following messages from cme:

Warning in 'binary:"libam7xxx0.1-bin" Replaces:0' value 'libam7xxx-bin': package libam7xxx-bin is unknown. Check for typos if not a virtual package.
Warning in 'binary:"libam7xxx0.1-doc" Conflicts:0' value 'libam7xxx-doc': package libam7xxx-doc is unknown. Check for typos if not a virtual package.

4 years agodebian/control: remove unnecessary greater-than versioned dependencies
Antonio Ospite [Sat, 3 Mar 2018 14:35:37 +0000 (15:35 +0100)]
debian/control: remove unnecessary greater-than versioned dependencies

This fixes the following cme warnings:

Warning in 'source Build-Depends:1' value 'dpkg-dev (>= 1.16.1~)': unnecessary greater-than versioned dependency: dpkg-dev (>= 1.16.1~). Debian has oldoldstable -> 1.16.18; oldstable-kfreebsd -> 1.17.25; oldstable -> 1.17.27; stable -> 1.18.24; unstable ->; testing ->; unstable ->;
Warning in 'binary:"libam7xxx0.1" Recommends:2' value 'usb-modeswitch-data (>= 20111023-1)': unnecessary greater-than versioned dependency: usb-modeswitch-data (>= 20111023-1). Debian has oldoldstable -> 20120815-2; oldstable -> 20150115-1; oldstable-kfreebsd -> 20150115-1; jessie-backports -> 20170120-1~bpo8+1; stable -> 20170120-1; unstable -> 20170806-2; testing -> 20170806-2;

4 years agodebian/copyright: update copyright years
Antonio Ospite [Sat, 3 Mar 2018 14:33:46 +0000 (15:33 +0100)]
debian/copyright: update copyright years

4 years agodebian/libam7xxx0.1-doc.lintian-overrides: remove unused override
Antonio Ospite [Fri, 2 Mar 2018 17:49:40 +0000 (18:49 +0100)]
debian/libam7xxx0.1-doc.lintian-overrides: remove unused override

Lintian noticed that one of the overrides was unused, remove it and
silence the following notice:

I: libam7xxx0.1-doc: unused-override embedded-javascript-library usr/share/doc/libam7xxx0.1-doc/html/jquery.js please use libjs-jquery
N:    Lintian discovered an unused override entry in its database. Most likely
N:    it was used for a false-positive that has been fixed. However, some tags
N:    are only triggered in packages built on certain architectures. In this
N:    case, the override may need an architecture qualifier.
N:    Alternatively, the additional information provided by Lintian in the
N:    tag's output may changed since the override was last modified.
N:    If the override is unused, please remove it from the overrides file.
N:    Refer to Lintian User's Manual section 2.4.3 (Architecture specific
N:    overrides) for details.
N:    Severity: wishlist, Certainty: certain

4 years agodebian/libam7xxx0.1-doc.*: additional doc is now installed in the main package
Antonio Ospite [Fri, 2 Mar 2018 22:02:18 +0000 (23:02 +0100)]
debian/libam7xxx0.1-doc.*: additional doc is now installed in the main package

debhelper >= 11 installs the files provide by the documentation package
in /usr/share/doc/main-package as recommended by the Debian policy
manual 3.9.7 in S12.3.

Adjust the paths in the lintian overrides and most importantly in the
.doc-base references to fix the following lintian errors caused by the
new behavior:

E: libam7xxx0.1-doc: doc-base-file-references-missing-file libam7xxx:9 /usr/share/doc/libam7xxx0.1-doc/html/index.html
N:    One of the files referenced in an Index or Files field in this doc-base
N:    control file does not exist in the package. The doc-base control files
N:    should be installed by the package that provides the documents they are
N:    registering.
N:    Severity: important, Certainty: certain
N:    Check: menus, Type: binary
E: libam7xxx0.1-doc: doc-base-file-references-missing-file libam7xxx:10 /usr/share/doc/libam7xxx0.1-doc/html/*.html

4 years agodebian/{compat,control}: bump debhelper compatibility to 11
Antonio Ospite [Fri, 2 Mar 2018 22:20:00 +0000 (23:20 +0100)]
debian/{compat,control}: bump debhelper compatibility to 11

This silences the following lintian notice:

P: libam7xxx source: package-uses-old-debhelper-compat-version 9
N:    The debhelper compatibility version used by this package is marked as
N:    not recommended by the debhelper developer. You may consider using a
N:    recommended compatibility version.
N:    The compatibility version can be set in (preferred) debian/compat or by
N:    setting and exporting DH_COMPAT in debian/rules. If it is not set in
N:    either place, debhelper defaults to the deprecated compatibility version
N:    1.
N:    Refer to the debhelper(7) manual page for details.
N:    Severity: pedantic, Certainty: certain
N:    Check: debhelper, Type: source

4 years agodebian/control: bump Standards-Version to 4.1.3
Antonio Ospite [Fri, 2 Mar 2018 17:51:48 +0000 (18:51 +0100)]
debian/control: bump Standards-Version to 4.1.3

This silences a lintian notice:

W: libam7xxx source: ancient-standards-version 3.9.6 (released 2014-09-17) (current is 4.1.3)
N:    The source package refers to a Standards-Version that has been obsolete
N:    for more than two years. Please update your package to latest Policy and
N:    set this control field appropriately.
N:    If the package is already compliant with the current standards, you
N:    don't have to re-upload the package just to adjust the Standards-Version
N:    control field. However, please remember to update this field next time
N:    you upload the package.
N:    See /usr/share/doc/debian-policy/upgrading-checklist.txt.gz in the
N:    debian-policy package for a summary of changes in newer versions of
N:    Policy.
N:    Refer to
N: for
N:    details.
N:    Severity: normal, Certainty: certain
N:    Check: standards-version, Type: source

4 years agodebian: use https in URLs
Antonio Ospite [Fri, 2 Mar 2018 17:47:19 +0000 (18:47 +0100)]
debian: use https in URLs

The changes silence some lintian notices:

I: libam7xxx source: vcs-field-uses-insecure-uri vcs-git git:// -b debian/master
I: libam7xxx source: vcs-field-uses-insecure-uri vcs-browser
P: libam7xxx source: insecure-copyright-format-uri
I: libam7xxx source: debian-watch-uses-insecure-uri

4 years agodebian/{control,rules}: drop the obsolete -dbg package
Antonio Ospite [Fri, 2 Mar 2018 17:40:44 +0000 (18:40 +0100)]
debian/{control,rules}: drop the obsolete -dbg package

This silences the following lintian notice:

I: libam7xxx source: debian-control-has-obsolete-dbg-package libam7xxx0.1-dbg
N:    The debian/control file includes declaration of -dbg package.
N:    Debug package are now autogenerated avoiding waste of miror space.
N:    Please note that -dbg should be dropped from control file and must not
N:    be transitioned to a dummy package depending on -dbgsym.
N:    Refer to for details.
N:    Severity: wishlist, Certainty: possible
N:    Check: control-file, Type: source

4 years agodebian/libam7xxx0.1.install: install the AppStream metainfo file
Antonio Ospite [Fri, 2 Mar 2018 15:54:55 +0000 (16:54 +0100)]
debian/libam7xxx0.1.install: install the AppStream metainfo file

This fixes the following lintian warning:

W: libam7xxx0.1: appstream-metadata-missing-modalias-provide lib/udev/rules.d/60-libam7xxx0.1.rules
N:    This package contain a udev rule for providing device access to the
N:    console user (using the uaccess udev TAG) or to members of the plugdev
N:    file group without announcing the hardware support using AppStream.
N:    Refer to for details.
N:    Severity: normal, Certainty: certain
N:    Check: appstream-metadata, Type: binary

4 years agodebian/patches: add patch to add the AppStream metadata
Antonio Ospite [Fri, 2 Mar 2018 15:52:07 +0000 (16:52 +0100)]
debian/patches: add patch to add the AppStream metadata

4 years agodebian/*.install: fix paths for multi-arch objects
Antonio Ospite [Fri, 2 Mar 2018 14:14:26 +0000 (15:14 +0100)]
debian/*.install: fix paths for multi-arch objects

4 years agodebian/patches: add a patch to use GNUInstallDirs when building with cmake
Antonio Ospite [Fri, 2 Mar 2018 14:08:28 +0000 (15:08 +0100)]
debian/patches: add a patch to use GNUInstallDirs when building with cmake

4 years agodebian/patches: add a patch to fix udev rules
Antonio Ospite [Fri, 2 Mar 2018 10:25:03 +0000 (11:25 +0100)]
debian/patches: add a patch to fix udev rules

Add debian/patches/contrib-add-TAG-uaccess-to-udev-rules.patch to
support the systemd way to provide access to devices.

The patch fixes the following lintian warning:

W: libam7xxx0.1: udev-rule-missing-uaccess lib/udev/rules.d/60-libam7xxx0.1.rules:2 user accessible device missing TAG+="uaccess"
N:    The package set up a device for user access without using the uaccess
N:    tag. Some udev rules get the same effect using other markers enabling
N:    console user access using rules in /lib/udev/rules.d/70-uaccess.rules.
N:    Others should specify TAG+="uaccess" in the udev rule.
N:    Refer to for details.
N:    Severity: normal, Certainty: possible
N:    Check: udev, Type: binary

4 years agodebian/control: replace priority "extra" with "optional"
Antonio Ospite [Thu, 1 Mar 2018 23:25:38 +0000 (00:25 +0100)]
debian/control: replace priority "extra" with "optional"

This fixes the following lintian warning:

W: libam7xxx-dev: priority-extra-is-replaced-by-priority-optional
N:    Since Debian Policy version 4.0.1, the priority extra has been
N:    deprecated.
N:    Please update debian/control and replace all instances of Priority:
N:    extra with Priority: optional.
N:    Refer to Debian Policy Manual section 2.5 (Priorities) for details.
N:    Severity: minor, Certainty: certain
N:    Check: fields, Type: binary, udeb, source

4 years agodebian/rules: enable all hardening flags
Antonio Ospite [Thu, 1 Mar 2018 23:21:44 +0000 (00:21 +0100)]
debian/rules: enable all hardening flags

In particular this enables the bindnow feature to fix the following
lintian notice:

I: libam7xxx0.1: hardening-no-bindnow usr/lib/
N:    This package provides an ELF binary that lacks the "bindnow" linker
N:    flag.
N:    This is needed (together with "relro") to make the "Global Offset Table"
N:    (GOT) fully read-only. The bindnow feature trades startup time for
N:    improved security. Please consider enabling this feature or consider
N:    overriding the tag (possibly with a comment about why).
N:    If you use dpkg-buildflags, you may have to add hardening=+bindnow or
N:    hardening=+all to DEB_BUILD_MAINT_OPTIONS.
N:    The relevant compiler flags are set in LDFLAGS.
N:    Refer to for details.
N:    Severity: wishlist, Certainty: certain
N:    Check: binaries, Type: binary, udeb

4 years agodebian/rules: don't include manually
Antonio Ospite [Thu, 1 Mar 2018 22:19:21 +0000 (23:19 +0100)]
debian/rules: don't include manually

Don't include manually, debhelper >= 9 does it already,
just export the appropriate variables as specified in

4 years agodebian/patches: add a patch to fix the version number
Antonio Ospite [Thu, 1 Mar 2018 17:50:19 +0000 (18:50 +0100)]
debian/patches: add a patch to fix the version number

I forgot to do this upstream before tagging the stable release.

4 years agodebian/patches: drop a patch merged upstream
Antonio Ospite [Thu, 1 Mar 2018 17:41:38 +0000 (18:41 +0100)]
debian/patches: drop a patch merged upstream

4 years agodebian/{control,gbp.conf}: change the debian branch name to follow DEP-14
Antonio Ospite [Thu, 1 Mar 2018 17:35:17 +0000 (18:35 +0100)]
debian/{control,gbp.conf}: change the debian branch name to follow DEP-14

4 years agodebian/changelog: prepare for 0.1.7-1
Antonio Ospite [Thu, 1 Mar 2018 17:37:06 +0000 (18:37 +0100)]
debian/changelog: prepare for 0.1.7-1

Gbp-Dch: ignore

4 years agoMerge tag 'v0.1.7' into debian/master
Antonio Ospite [Thu, 1 Mar 2018 17:24:21 +0000 (18:24 +0100)]
Merge tag 'v0.1.7' into debian/master

Release version 0.1.7

4 years agoNEWS: Release version 0.1.7 v0.1.7
Antonio Ospite [Thu, 1 Mar 2018 16:37:11 +0000 (17:37 +0100)]
NEWS: Release version 0.1.7

4 years agoHACKING.asciidoc: update some info about the supported ffmpeg version
Antonio Ospite [Thu, 1 Mar 2018 16:34:05 +0000 (17:34 +0100)]
HACKING.asciidoc: update some info about the supported ffmpeg version

4 years agoREADME.asciidoc: update information about running libam7xx on Windows
Antonio Ospite [Thu, 1 Mar 2018 16:26:01 +0000 (17:26 +0100)]
README.asciidoc: update information about running libam7xx on Windows

4 years agoRefresh contrib/libam7xxx-compile-on-Ubuntu-14.04-LTS.diff
Antonio Ospite [Thu, 1 Mar 2018 14:46:46 +0000 (15:46 +0100)]
Refresh contrib/libam7xxx-compile-on-Ubuntu-14.04-LTS.diff

4 years agoRefresh contrib/performance/0001-Instrument-code-with-fps-meter.patch
Antonio Ospite [Thu, 1 Mar 2018 14:33:34 +0000 (15:33 +0100)]
Refresh contrib/performance/0001-Instrument-code-with-fps-meter.patch

4 years agoexamples: remove some trailing spaces
Antonio Ospite [Thu, 1 Mar 2018 14:00:25 +0000 (15:00 +0100)]
examples: remove some trailing spaces

4 years agoam7xxx-play: add a comment to explain why a run-time warning can be ignored
Antonio Ospite [Wed, 28 Feb 2018 16:09:46 +0000 (17:09 +0100)]
am7xxx-play: add a comment to explain why a run-time warning can be ignored

Using the AV_PIX_FMT_YUVJ420P pixel format results n a run-time warning
from swscaler:

[swscaler @ 0x5600046b3cc0] deprecated pixel format used, make sure you did set range correctly

However this cannot be changed because the mjpeg codec relies on it,
otherwise it fails with the following error message:

[mjpeg @ 0x560eea5f5360] Specified pixel format yuv420p is invalid or not supported

So just add a comment, to avoid loosing time figuring things out again
in the future.

4 years agoam7xxx-play: stop using avcodec_decode_video2() and avcodec_encode_video2()
Antonio Ospite [Wed, 28 Feb 2018 15:23:34 +0000 (16:23 +0100)]
am7xxx-play: stop using avcodec_decode_video2() and avcodec_encode_video2()

Since FFMpeg 3.1, avcodec_decode_video2() and avcodec_encode_video2()
have been deprecated in favor of the more generic send/receive API.

Provide some wrappers to ease the transition between the two APIs.

The change fixes the following warnings:

  .../libam7xxx/examples/am7xxx-play.c: In function ‘am7xxx_play’:
  .../libam7xxx/examples/am7xxx-play.c:372:3: warning: ‘avcodec_decode_video2’ is deprecated [-Wdeprecated-declarations]
     ret = avcodec_decode_video2(input_ctx.codec_ctx, frame_raw, &got_frame, &in_packet);
  In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:319:0,
                   from /usr/include/x86_64-linux-gnu/libavdevice/avdevice.h:51,
                   from .../libam7xxx/examples/am7xxx-play.c:32:
  /usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4993:5: note: declared here
   int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
  .../libam7xxx/examples/am7xxx-play.c:403:5: warning: ‘avcodec_encode_video2’ is deprecated [-Wdeprecated-declarations]
       ret = avcodec_encode_video2(output_ctx.codec_ctx,
  In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:319:0,
                   from /usr/include/x86_64-linux-gnu/libavdevice/avdevice.h:51,
                   from .../libam7xxx/examples/am7xxx-play.c:32:
  /usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:5508:5: note: declared here
   int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,

4 years agoam7xxx-play: s/picture/frame/ to make the variable names match the data types
Antonio Ospite [Wed, 28 Feb 2018 14:17:28 +0000 (15:17 +0100)]
am7xxx-play: s/picture/frame/ to make the variable names match the data types

No functional changes, just a word substitution to match more closely
what the data types represent.

4 years agoam7xxx-play: use av_find_best_stream() instead of open-coding the search
Antonio Ospite [Wed, 28 Feb 2018 12:50:31 +0000 (13:50 +0100)]
am7xxx-play: use av_find_best_stream() instead of open-coding the search

4 years agoam7xxx-play: remove useless call to avcodec_close() in video_output_init()
Antonio Ospite [Wed, 28 Feb 2018 12:25:07 +0000 (13:25 +0100)]
am7xxx-play: remove useless call to avcodec_close() in video_output_init()

If the code reaches the "cleanup" exit path in video_output_init() the
output codec context was never opened, so there is no need to close it.

4 years agoam7xxx-play: free AVCodecContext variables with avcodec_free_context()
Antonio Ospite [Wed, 28 Feb 2018 12:01:51 +0000 (13:01 +0100)]
am7xxx-play: free AVCodecContext variables with avcodec_free_context()

Deallocate AVCodecContext variables with avcodec_free_context() instead
of av_free() this is for symmetry with the allocation functions.

Adjust and update the comment to the new code.

4 years agoam7xxx-play: use AVStream.codecpar instead of the deprecated AVStream.codec
Antonio Ospite [Wed, 28 Feb 2018 11:48:31 +0000 (12:48 +0100)]
am7xxx-play: use AVStream.codecpar instead of the deprecated AVStream.codec

AVStream.codec has been deprecated and AVStream.codecpar should be used
instead, as shown in:;h=9200514ad8717c63f82101dc394f4378854325bf

The changes fix the following compilation warnings:

  .../libam7xxx/examples/am7xxx-play.c: In function ‘video_input_init’:
  .../libam7xxx/examples/am7xxx-play.c:104:3: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
     if (input_format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
  In file included from /usr/include/x86_64-linux-gnu/libavdevice/avdevice.h:51:0,
                   from .../libam7xxx/examples/am7xxx-play.c:32:
  /usr/include/x86_64-linux-gnu/libavformat/avformat.h:893:21: note: declared here
       AVCodecContext *codec;
  .../libam7xxx/examples/am7xxx-play.c:115:2: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
    input_codec_ctx = input_format_ctx->streams[video_index]->codec;
  In file included from /usr/include/x86_64-linux-gnu/libavdevice/avdevice.h:51:0,
                   from .../libam7xxx/examples/am7xxx-play.c:32:
  /usr/include/x86_64-linux-gnu/libavformat/avformat.h:893:21: note: declared here
       AVCodecContext *codec;

4 years agoam7xxx-play: don't override return value when there is a usable one
Antonio Ospite [Wed, 28 Feb 2018 11:43:33 +0000 (12:43 +0100)]
am7xxx-play: don't override return value when there is a usable one

Don't override the avcodec_open2() return value, we can pass along the
negative return value as is to the caller.

4 years agoam7xxx-play: remove some code which will never be executed
Antonio Ospite [Wed, 28 Feb 2018 09:18:07 +0000 (10:18 +0100)]
am7xxx-play: remove some code which will never be executed

input_codec_ctx is guaranteed to be defined here, otherwise the code
would have bailed out earlier.

4 years agoam7xxx-play: remove any usage of ENOTSUP
Antonio Ospite [Tue, 27 Feb 2018 22:42:32 +0000 (23:42 +0100)]
am7xxx-play: remove any usage of ENOTSUP

There's really no need to use ENOTSUP here, the return value is not
checked against the specific value, but just for the sign.

Replacing it with EINVAL makes the code more aligned with the other
error paths and also allows to remove a conditional define.

4 years agoam7xxx: return EINVAL instead of ENOTSUP in am7xxx_get_device_info()
Antonio Ospite [Tue, 27 Feb 2018 17:41:44 +0000 (18:41 +0100)]
am7xxx: return EINVAL instead of ENOTSUP in am7xxx_get_device_info()

All the other error paths about invalid results or unsupported
operations return EINVAL, so remove the only instance of ENOTSUP.

Since the API documentation makes no promises on the actual negative
value of the returned error, this little change of behavior should be

4 years agoam7xxx: fix C99 conformance for printf & co. when compiling with MinGW
Antonio Ospite [Tue, 27 Feb 2018 16:03:36 +0000 (17:03 +0100)]
am7xxx: fix C99 conformance for printf & co. when compiling with MinGW

C99 format specifiers like "%hhd" are used with log_message() but MinGW
(and Windows) does not really supports them, so the compiler suggests to
use the "gnu_printf" attribute for the function.

However "gnu_printf"is not available on clang so it's not an option,
a better alternative is the solution suggested by MinGW at

The change fixes the following warnings when compiling with MinGW:

.../libam7xxx/src/am7xxx.c: In function ‘log_message’:
.../libam7xxx/src/am7xxx.c:647:3: warning: function ‘log_message’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
   vfprintf(stderr, fmt, ap);
.../libam7xxx/src/am7xxx.c: In function ‘open_device’:
.../libam7xxx/src/am7xxx.c:772:15: warning: unknown conversion type character ‘h’ in format [-Wformat=]
    debug(ctx, "Cannot set configuration %hhu\n",
.../libam7xxx/src/am7xxx.c:65:85: note: in definition of macro ‘debug’
 #define debug(ctx, ...)   log_message(ctx,  AM7XXX_LOG_DEBUG,   __func__, 0,        __VA_ARGS__)
.../libam7xxx/src/am7xxx.c:772:15: warning: too many arguments for format [-Wformat-extra-args]
    debug(ctx, "Cannot set configuration %hhu\n",
.../libam7xxx/src/am7xxx.c:65:85: note: in definition of macro ‘debug’
 #define debug(ctx, ...)   log_message(ctx,  AM7XXX_LOG_DEBUG,   __func__, 0,        __VA_ARGS__)
.../libam7xxx/src/am7xxx.c:785:14: warning: unknown conversion type character ‘h’ in format [-Wformat=]
   debug(ctx, "Cannot claim interface %hhu\n",
.../libam7xxx/src/am7xxx.c:65:85: note: in definition of macro ‘debug’
 #define debug(ctx, ...)   log_message(ctx,  AM7XXX_LOG_DEBUG,   __func__, 0,        __VA_ARGS__)
.../libam7xxx/src/am7xxx.c:785:14: warning: too many arguments for format [-Wformat-extra-args]
   debug(ctx, "Cannot claim interface %hhu\n",
.../libam7xxx/src/am7xxx.c:65:85: note: in definition of macro ‘debug’
 #define debug(ctx, ...)   log_message(ctx,  AM7XXX_LOG_DEBUG,   __func__, 0,        __VA_ARGS__)
.../libam7xxx/src/am7xxx.c:803:14: warning: unknown conversion type character ‘h’ in format [-Wformat=]
   debug(ctx, "libusb configuration changed (expected: %hhu, current: %d)\n",
.../libam7xxx/src/am7xxx.c:65:85: note: in definition of macro ‘debug’
 #define debug(ctx, ...)   log_message(ctx,  AM7XXX_LOG_DEBUG,   __func__, 0,        __VA_ARGS__)
.../libam7xxx/src/am7xxx.c:803:14: warning: too many arguments for format [-Wformat-extra-args]
   debug(ctx, "libusb configuration changed (expected: %hhu, current: %d)\n",
.../libam7xxx/src/am7xxx.c:65:85: note: in definition of macro ‘debug’
 #define debug(ctx, ...)   log_message(ctx,  AM7XXX_LOG_DEBUG,   __func__, 0,        __VA_ARGS__)

4 years agoam7xxx: use the same indenting style for all preprocessor directives
Antonio Ospite [Mon, 26 Feb 2018 17:29:38 +0000 (18:29 +0100)]
am7xxx: use the same indenting style for all preprocessor directives

While at it also reformat a multi-line comment to follow the style of
the other comments.

4 years agodoc: update
Antonio Ospite [Mon, 26 Feb 2018 16:02:43 +0000 (17:02 +0100)]
doc: update

4 years agoam7xxx: specify LIBUSB_CALL for send_data_async_complete_cb()
Antonio Ospite [Mon, 26 Feb 2018 15:05:20 +0000 (16:05 +0100)]
am7xxx: specify LIBUSB_CALL for send_data_async_complete_cb()

send_data_async_complete_cb() is used as a callback for
libusb_fill_bulk_transfer() and it is expected to be of type
'libusb_transfer_cb_fn' which is defined using LIBUSB_CALL.

LIBUSB_CALL is only used on Windows and not having it results in the
following warning when compiling for Windows:

  .../libam7xxx/src/am7xxx.c: In function ‘send_data_async’:
  .../libam7xxx/src/am7xxx.c:508:7: warning: passing argument 6 of ‘libusb_fill_bulk_transfer’ from incompatible pointer type [-Wincompatible-pointer-types]
         send_data_async_complete_cb, dev, 0);
  In file included from /home/ao2/Proj/picoProjector/libam7xxx/src/am7xxx.c:24:0:
  .../libam7xxx/build/libusb-1.0.21/include/libusb-1.0/libusb.h:1553:20: note: expected ‘libusb_transfer_cb_fn’ but argument is of type ‘void (*)(struct libusb_transfer *)’
   static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer,

4 years agosrc/tools.c: fix compilation on Windows
Antonio Ospite [Mon, 26 Feb 2018 14:50:53 +0000 (15:50 +0100)]
src/tools.c: fix compilation on Windows

On Windows nanosleep() is not available and compiling fails with the
following error:

  CMakeFiles/am7xxx.dir/objects.a(tools.c.obj):tools.c:(.text+0x4a): undefined reference to `nanosleep'
  collect2: error: ld returned 1 exit status
  make[2]: *** [src/CMakeFiles/am7xxx.dir/build.make:153: lib/libam7xxx.dll] Error 1
  make[1]: *** [CMakeFiles/Makefile2:189: src/CMakeFiles/am7xxx.dir/all] Error 2
  make: *** [Makefile:130: all] Error 2

Using the native Windows function Sleep() fixes the error.

4 years agoHACKING.asciidoc: update the Windows build instructions
Antonio Ospite [Mon, 26 Feb 2018 14:44:22 +0000 (15:44 +0100)]
HACKING.asciidoc: update the Windows build instructions

4 years agoexamples/CMakeLists.txt: restrict required libraries for avformat_open_input()
Antonio Ospite [Mon, 26 Feb 2018 14:39:12 +0000 (15:39 +0100)]
examples/CMakeLists.txt: restrict required libraries for avformat_open_input()

When checking if avformat_open_input() exists, link only with
FFMPEG_LIBAVFORMAT_LIBRARIES, this is more essential and also more
symmetric from a readability point of view.

4 years agoexamples/CMakeLists.txt: use a relative path for the include file
Antonio Ospite [Mon, 26 Feb 2018 14:01:40 +0000 (15:01 +0100)]
examples/CMakeLists.txt: use a relative path for the include file

This is the correct way to include a file when calling
check_symbol_exists(), since the include paths are already set with:


4 years agomingw_cross_toolchain.cmake: remove the deprecated CMAKE_FORCE_C_COMPILER
Antonio Ospite [Mon, 26 Feb 2018 13:53:48 +0000 (14:53 +0100)]
mingw_cross_toolchain.cmake: remove the deprecated CMAKE_FORCE_C_COMPILER

This fixes the following warning:

  CMake Deprecation Warning at /usr/share/cmake-3.10/Modules/CMakeForceCompiler.cmake:69 (message):
    The CMAKE_FORCE_C_COMPILER macro is deprecated.  Instead just set
    CMAKE_C_COMPILER and allow CMake to identify the compiler.

4 years agoChangeLog: remove the file, users can look at the git history for details
Antonio Ospite [Mon, 26 Feb 2018 10:11:44 +0000 (11:11 +0100)]
ChangeLog: remove the file, users can look at the git history for details

4 years agoam7xxx-play: rename CODEC_FLAG_QSCALE to AV_CODEC_FLAG_QSCALE
Antonio Ospite [Mon, 26 Feb 2018 10:03:13 +0000 (11:03 +0100)]

In FFMpeg 3.5+ the unprefixed CODEC_* constants have been removed, only
the correspondent AV_CODEC_* ones are available.

This fixes a build failure:

  .../examples/am7xxx-play.c: In function 'video_output_init':
  .../examples/am7xxx-play.c:240:34: error: 'CODEC_FLAG_QSCALE' undeclared (first use in this function); did you mean 'AV_CODEC_FLAG_QSCALE'?
    output_codec_ctx->flags      |= CODEC_FLAG_QSCALE;

4 years agocontrib/howto-picopix.asciidoc: minor fixes
Antonio Ospite [Thu, 28 Sep 2017 12:06:54 +0000 (14:06 +0200)]
contrib/howto-picopix.asciidoc: minor fixes

4 years agocontrib: add a HOWTO for new users
Antonio Ospite [Thu, 28 Sep 2017 12:02:34 +0000 (14:02 +0200)]
contrib: add a HOWTO for new users

Thanks to Étienne Morin,

4 years agocontrib: add a patch to allow compiling libam7xxx on Ubuntu 14.04 LTS
Antonio Ospite [Thu, 28 Sep 2017 09:37:55 +0000 (11:37 +0200)]
contrib: add a patch to allow compiling libam7xxx on Ubuntu 14.04 LTS

The patch has not been tested, it is here just as a convenient starting
point for interested users.

4 years agodoc/lsusb_dumps: show that the PicoPix 2330 and 2340 have the same descriptor
Antonio Ospite [Thu, 28 Sep 2017 07:14:52 +0000 (09:14 +0200)]
doc/lsusb_dumps: show that the PicoPix 2330 and 2340 have the same descriptor

Rename lsusb_Philips-PicoPix-2330.log to show that the PicoPix 2340 has
the same descriptor.

5 years agoam7xxx: simplify the device info caching operation in am7xxx_open_device()
Antonio Ospite [Tue, 14 Feb 2017 09:04:19 +0000 (10:04 +0100)]
am7xxx: simplify the device info caching operation in am7xxx_open_device()

Now that am7xxx_get_device_info() is more robust, the check in the
caller can be avoided.

5 years agoam7xxx: make sure am7xxx_get_device_info() always returns sensible values
Antonio Ospite [Tue, 14 Feb 2017 08:49:24 +0000 (09:49 +0100)]
am7xxx: make sure am7xxx_get_device_info() always returns sensible values

am7xxx_get_device_info() was not covering the case of a non-NULL output
parameter on the very first invocation, this case would not usually
happen in normal operation, but the problem was there: in that case the
output device_info structure would have contained garbage, as spotted by
the static analyzer:

.../src/am7xxx.c:1279:21: warning: The right operand of '<=' is a garbage value
            original_width <= device_info.native_width &&
                           ^  ~~~~~~~~~~~~~~~~~~~~~~~~
.../src/am7xxx.c:1288:39: warning: The right operand of '/' is a garbage value
        width_ratio =  (float)original_width / device_info.native_width;
                                             ^ ~~~~~~~~~~~~~~~~~~~~~~~~

While at it also fix the symmetric case of a NULL output parameter on
subsequent invocation: check that the output argument is non-NULL before
memcpy-ing to it.

5 years agoam7xxx-play: get rid of the deprecated function av_free_packet()
Antonio Ospite [Thu, 30 Jun 2016 16:05:53 +0000 (18:05 +0200)]
am7xxx-play: get rid of the deprecated function av_free_packet()

This also fixes this warning:

  warning: ‘av_free_packet’ is deprecated

5 years agoam7xxx-play: get rd of the deprecated function avpicture_fill()
Antonio Ospite [Thu, 30 Jun 2016 16:02:45 +0000 (18:02 +0200)]
am7xxx-play: get rd of the deprecated function avpicture_fill()

This also fixes this warning:

  warning: ‘avpicture_fill’ is deprecated

5 years agoam7xxx-play: get rid of the deprecated function avpicture_get_size()
Antonio Ospite [Thu, 30 Jun 2016 16:00:33 +0000 (18:00 +0200)]
am7xxx-play: get rid of the deprecated function avpicture_get_size()

This also fixes this warning:

  warning: ‘avpicture_get_size’ is deprecated

5 years agoam7xxx: simplify one return path in am7xxx_init()
Antonio Ospite [Thu, 30 Jun 2016 15:58:33 +0000 (17:58 +0200)]
am7xxx: simplify one return path in am7xxx_init()

Just return directly when there is no cleanup to do, it is more

5 years agoexamples/CMakeLists.txt: clean up Feature Test Macro Requirements defines
Antonio Ospite [Wed, 29 Jun 2016 17:35:21 +0000 (19:35 +0200)]
examples/CMakeLists.txt: clean up Feature Test Macro Requirements defines

Setting _POSIX_C_SOURCE to the right value enables all the needed

This also avoids using _DEFAULT_SOURCE explicitly to get rid of the
_BSD_SOURCE deprecation warning.

5 years agosrc/CMakeLists.txt: fix a compilation warning about _BSD_SOURCE deprecation
Antonio Ospite [Wed, 29 Jun 2016 17:32:29 +0000 (19:32 +0200)]
src/CMakeLists.txt: fix a compilation warning about _BSD_SOURCE deprecation

Fix this warning from recent compilers:
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

5 years agoam7xxx-play: add more informations about how the raw format is handled
Antonio Ospite [Wed, 29 Jun 2016 17:04:28 +0000 (19:04 +0200)]
am7xxx-play: add more informations about how the raw format is handled

This new comment should make it easier to understand why there is no
need to encode the frame when outputting data in the raw format
supported by the device

5 years agoam7xxx-play: output more informative message when get_x_screen_size() is a stub
Antonio Ospite [Wed, 29 Jun 2016 17:02:21 +0000 (19:02 +0200)]
am7xxx-play: output more informative message when get_x_screen_size() is a stub

5 years agoHACKING.asciidoc: mention libxcb1-dev as a build dependency
Antonio Ospite [Wed, 29 Jun 2016 16:56:49 +0000 (18:56 +0200)]
HACKING.asciidoc: mention libxcb1-dev as a build dependency

Without libxcb1-dev am7xxx-play can't figure out the screen dimensions.

6 years agoFix a missing parenthesis in some output strings
Antonio Ospite [Sat, 9 Jan 2016 12:18:40 +0000 (13:18 +0100)]
Fix a missing parenthesis in some output strings

6 years agoam7xxx-modeswitch: adjust comment formatting
Antonio Ospite [Sat, 9 Jan 2016 12:17:49 +0000 (13:17 +0100)]
am7xxx-modeswitch: adjust comment formatting

6 years agoNEWS: fix a typo s/am7xx-play/am7xxx-play/
Antonio Ospite [Wed, 18 Nov 2015 15:52:39 +0000 (16:52 +0100)]
NEWS: fix a typo s/am7xx-play/am7xxx-play/

6 years agodebian/changelog: improve the description of one patch
Antonio Ospite [Wed, 18 Nov 2015 13:48:08 +0000 (14:48 +0100)]
debian/changelog: improve the description of one patch

Gbp-Dch: ignore

6 years agodebian/changelog: release package version 0.1.6-2 debian/0.1.6-2
Antonio Ospite [Tue, 17 Nov 2015 18:19:57 +0000 (19:19 +0100)]
debian/changelog: release package version 0.1.6-2

Gbp-Dch: ignore

6 years agodebian/libam7xxx0.1-doc.lintian-overrides: drop unused-overrides
Antonio Ospite [Tue, 17 Nov 2015 18:06:19 +0000 (19:06 +0100)]
debian/libam7xxx0.1-doc.lintian-overrides: drop unused-overrides

6 years agodebian/patches: add am7xxx-bump-_POSIX_C_SOURCE-to-200112L-for-lroundf.patch
Antonio Ospite [Tue, 17 Nov 2015 17:47:33 +0000 (18:47 +0100)]
debian/patches: add am7xxx-bump-_POSIX_C_SOURCE-to-200112L-for-lroundf.patch

This should fix this warning from the QA site:
  W implicit-declaration /??PKGBUILDDIR??/src/am7xxx.c:1216 ...

6 years agoam7xxx: bump _POSIX_C_SOURCE to 200112L for lroundf()
Antonio Ospite [Tue, 17 Nov 2015 17:42:39 +0000 (18:42 +0100)]
am7xxx: bump _POSIX_C_SOURCE to 200112L for lroundf()

The library code uses lroundf() from math.h but some compilers may warn
about an implicit definition of it, so make sure it it actually
available by following the requirements from the LROUND(3) man page.

6 years agoam7xxx: remove a useless empty line
Antonio Ospite [Tue, 17 Nov 2015 17:41:18 +0000 (18:41 +0100)]
am7xxx: remove a useless empty line

6 years agodebian/patches: add a patch to make the build of Doxygen docs reproducible
Antonio Ospite [Tue, 17 Nov 2015 17:28:17 +0000 (18:28 +0100)]
debian/patches: add a patch to make the build of Doxygen docs reproducible

The patch disables HTML_TIMESTAMPS as suggested here:

6 years agodebian/changelog: release package version 0.1.6-1 debian/0.1.6-1
Antonio Ospite [Tue, 17 Nov 2015 17:19:39 +0000 (18:19 +0100)]
debian/changelog: release package version 0.1.6-1

Gbp-Dch: ignore

6 years agodebian/control: increase Standards-Version to 3.9.6
Antonio Ospite [Tue, 17 Nov 2015 16:23:46 +0000 (17:23 +0100)]
debian/control: increase Standards-Version to 3.9.6

6 years agodebian/patches: drop all patches, they have all been applied upstream
Antonio Ospite [Tue, 17 Nov 2015 16:10:17 +0000 (17:10 +0100)]
debian/patches: drop all patches, they have all been applied upstream

6 years agodebian/changelog: prepare for the 0.1.6-1 release
Antonio Ospite [Tue, 17 Nov 2015 15:44:12 +0000 (16:44 +0100)]
debian/changelog: prepare for the 0.1.6-1 release

Gbp-Dch: ignore

6 years agoMerge tag 'v0.1.6' into debian
Antonio Ospite [Tue, 17 Nov 2015 15:39:40 +0000 (16:39 +0100)]
Merge tag 'v0.1.6' into debian

Release version 0.1.6

6 years agoRelease version 0.1.6 v0.1.6
Antonio Ospite [Tue, 17 Nov 2015 15:37:28 +0000 (16:37 +0100)]
Release version 0.1.6

6 years agoRefresh contrib/performance/0001-Instrument-code-with-fps-meter.patch
Antonio Ospite [Tue, 17 Nov 2015 15:30:35 +0000 (16:30 +0100)]
Refresh contrib/performance/0001-Instrument-code-with-fps-meter.patch

6 years agoStrip trailing spaces here and there
Antonio Ospite [Tue, 17 Nov 2015 14:46:15 +0000 (15:46 +0100)]
Strip trailing spaces here and there

6 years agoam7xxx-play: fix warning about deprecated fields in the output codec
Antonio Ospite [Tue, 17 Nov 2015 12:21:31 +0000 (13:21 +0100)]
am7xxx-play: fix warning about deprecated fields in the output codec

  warning: ‘lmin’ is deprecated [-Wdeprecated-declarations]
    output_codec_ctx->mb_lmin    = output_codec_ctx->lmin = output_codec_ctx->qmin * FF_QP2LAMBDA;
  warning: ‘lmax’ is deprecated [-Wdeprecated-declarations]
    output_codec_ctx->mb_lmax    = output_codec_ctx->lmax = output_codec_ctx->qmax * FF_QP2LAMBDA;

6 years agoam7xxx-play: don't dump the last frame unconditionally
Antonio Ospite [Tue, 17 Nov 2015 12:10:40 +0000 (13:10 +0100)]
am7xxx-play: don't dump the last frame unconditionally

Stop dumping the last frame unconditionally in DEBUG mode, it's not the
expected behavior; instead add an option to explicitly enable dumping
the last frame but still leave this active only in DEBUG mode.

6 years agoam7xxx-play: fix runtime warnings from ffmpeg
Antonio Ospite [Tue, 17 Nov 2015 09:47:36 +0000 (10:47 +0100)]
am7xxx-play: fix runtime warnings from ffmpeg

ffmpeg emits warnings at runtime about some AVFrame fields not being

  [mjpeg @ 0x669040] AVFrame.format is not set
  [mjpeg @ 0x669040] AVFrame.width or height is not set

This happens in a loop so the message is repeated over and over and
becomes annoying, fix this by setting the missing values.

6 years agoTODO: add some ideas for minor enhancements
Antonio Ospite [Tue, 17 Nov 2015 09:43:46 +0000 (10:43 +0100)]
TODO: add some ideas for minor enhancements

6 years agoam7xxx-play: fix an error message, we now use am7xxx_send_image_async()
Antonio Ospite [Tue, 17 Nov 2015 09:41:58 +0000 (10:41 +0100)]
am7xxx-play: fix an error message, we now use am7xxx_send_image_async()

6 years agoFix some format string warnings from clang
Antonio Ospite [Sat, 7 Nov 2015 21:33:03 +0000 (22:33 +0100)]
Fix some format string warnings from clang

Building with clang gives some format string warnings as below, fix them
by using the correct format string when printing out the values.

  .../libam7xxx/src/am7xxx.c:804:38: warning:
  format specifies type 'unsigned char' but the argument has type 'int'
                        (*dev)->desc->configuration, current_configuration);
  .../libam7xxx/src/am7xxx.c:65:85: note:
  expanded from macro 'debug'
  #define debug(ctx, ...)   log_message(ctx, AM7XXX_LOG_DEBUG, __func__, 0, __VA_ARGS__)
  1 warning generated.


  warning: format specifies type 'unsigned char' but the argument has type
  'int' [-Wformat]
  note: expanded from macro 'AM7XXX_STORAGE_CONFIGURATION'
  warning: format specifies type 'unsigned char' but the argument has type
  'int' [-Wformat]
  note: expanded from macro 'AM7XXX_STORAGE_INTERFACE'
  warning: format specifies type 'unsigned char' but the argument has type
  'int' [-Wformat]
                          AM7XXX_STORAGE_CONFIGURATION, current_configuration);
  note: expanded from macro 'AM7XXX_STORAGE_CONFIGURATION'
  warning: format specifies type 'unsigned char' but the argument has type
  'int' [-Wformat]
                          AM7XXX_STORAGE_CONFIGURATION, current_configuration);
  4 warnings generated.

6 years agoam7xxx-play: Replace deprecated FFmpeg API symbol PIX_FMT_NV12
Andreas Cadhalpun [Sun, 1 Nov 2015 23:00:00 +0000 (00:00 +0100)]
am7xxx-play: Replace deprecated FFmpeg API symbol PIX_FMT_NV12

PIX_FMT_NV12 is not going to be available in ffmpeg 2.9 so prepare for
that by using AV_PIX_FMT_NV12, which BTW has been available for quite
some time already.

6 years agoam7xxx: put some spaces around operators
Antonio Ospite [Wed, 8 Jul 2015 09:26:13 +0000 (11:26 +0200)]
am7xxx: put some spaces around operators

6 years agoam7xxx-modeswitch: fix the Length field in the switch command
Antonio Ospite [Fri, 26 Jun 2015 08:25:26 +0000 (10:25 +0200)]
am7xxx-modeswitch: fix the Length field in the switch command

The switch_command is a USB storage message, the bulk_cb_wrap structure
from include/linux/usb/storage.h in the Linux kernel shows the fields

struct bulk_cb_wrap {
__le32 Signature; /* contains 'USBC' */
__u32 Tag; /* unique per command id */
__le32 DataTransferLength; /* size of data */
__u8 Flags; /* direction in bit 0 */
__u8 Lun; /* LUN normally 0 */
__u8 Length; /* length of the CDB */
__u8 CDB[16]; /* max command */

In switch_command the data in CDB is 16 bytes long (0x10), so using 0x0c
was wrong, it worked on some devices but it did not on others.

Use the correct value.

Thanks-to: Balasubramanian S <>

6 years agoam7xxx: remove a redundant debug message in open_device()
Antonio Ospite [Wed, 10 Jun 2015 11:30:09 +0000 (13:30 +0200)]
am7xxx: remove a redundant debug message in open_device()

The calling function will show an error for the same condition.

6 years agoam7xxx: use debug() instead of fatal() in add_new_device()
Antonio Ospite [Wed, 10 Jun 2015 11:16:02 +0000 (13:16 +0200)]
am7xxx: use debug() instead of fatal() in add_new_device()

We are guaranteed that ctx is non-null by a previous check.

6 years agoam7xxx: rename the "function" argument of log_message() to "function_name"
Antonio Ospite [Wed, 10 Jun 2015 10:51:38 +0000 (12:51 +0200)]
am7xxx: rename the "function" argument of log_message() to "function_name"

This express better the meaning of the variable.

6 years agoam7xxx: split declaration and initialization of the "transferred" variable
Antonio Ospite [Wed, 10 Jun 2015 10:42:39 +0000 (12:42 +0200)]
am7xxx: split declaration and initialization of the "transferred" variable

This makes it clearer than we mean to initialize the variable to
0 before _each_ libusb_bulk_transfer() call.

6 years agoam7xxx-modeswitch: add a blank line for readability
Antonio Ospite [Wed, 10 Jun 2015 10:41:57 +0000 (12:41 +0200)]
am7xxx-modeswitch: add a blank line for readability

6 years agoam7xxx-modeswitch: set USB configuration following libusb documentation
Antonio Ospite [Wed, 10 Jun 2015 10:38:21 +0000 (12:38 +0200)]
am7xxx-modeswitch: set USB configuration following libusb documentation

For the details see: