Skip to content

Commit

Permalink
[depends] - add libzvbi
Browse files Browse the repository at this point in the history
  • Loading branch information
Memphiz committed Dec 1, 2014
1 parent ffad6b8 commit eb4b65b
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tools/depends/target/zvbi/01-zvbi-ssize_max.patch
@@ -0,0 +1,28 @@
Linear memory extents over SSIZE_MAX are undefined, so there is no
point in protecting against them.
diff -ru zvbi.orig/src/export.c zvbi/src/export.c
--- zvbi.orig/src/export.c 2011-11-06 11:22:47.000000000 +0200
+++ zvbi/src/export.c 2011-11-06 11:27:39.000000000 +0200
@@ -1076,8 +1076,6 @@
size_t count;

count = src_size;
- if (unlikely (src_size > SSIZE_MAX))
- count = SSIZE_MAX & -4096;

for (retry = 10;; --retry) {
actual = write (e->_handle.fd, src, count);
@@ -1632,12 +1630,7 @@
free (e->buffer.data);
}

- if (unlikely (e->buffer.offset > (size_t) SSIZE_MAX)) {
- errno = EOVERFLOW;
- actual = -1; /* failed */
- } else {
- actual = e->buffer.offset;
- }
+ actual = e->buffer.offset;
} else {
if (VBI_EXPORT_TARGET_ALLOC == e->target)
free (e->buffer.data);
19 changes: 19 additions & 0 deletions tools/depends/target/zvbi/02-zvbi-ioctl.patch
@@ -0,0 +1,19 @@
diff -ru zvbi.orig/contrib/ntsc-cc.c zvbi/contrib/ntsc-cc.c
--- zvbi.orig/contrib/ntsc-cc.c 2011-11-06 11:22:47.000000000 +0200
+++ zvbi/contrib/ntsc-cc.c 2011-11-06 11:29:04.000000000 +0200
@@ -32,7 +32,6 @@
#include <fcntl.h>
#include <errno.h>
#include <locale.h>
-#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/time.h>
#ifdef HAVE_GETOPT_LONG
@@ -44,6 +43,7 @@
#include "src/libzvbi.h"

#ifdef ENABLE_V4L2
+# include <sys/ioctl.h>
# include <asm/types.h>
# include "src/videodev2k.h"
#endif
30 changes: 30 additions & 0 deletions tools/depends/target/zvbi/03-zvbi-fix-clang-support.patch
@@ -0,0 +1,30 @@
diff -ru zvbi/src/misc.h zvbi-fixed/src/misc.h
--- zvbi/src/misc.h 2013-07-02 04:32:31.000000000 +0200
+++ zvbi-fixed/src/misc.h 2013-08-08 21:37:22.000000000 +0200
@@ -52,17 +52,6 @@
# define unlikely(expr) __builtin_expect(expr, 0)
#endif

-#undef __i386__
-#undef __i686__
-/* FIXME #cpu is deprecated
-#if #cpu (i386)
-# define __i386__ 1
-#endif
-#if #cpu (i686)
-# define __i686__ 1
-#endif
-*/
-
/* &x == PARENT (&x.tm_min, struct tm, tm_min),
safer than &x == (struct tm *) &x.tm_min. A NULL _ptr is safe and
will return NULL, not -offsetof(_member). */
@@ -156,8 +145,6 @@

#define likely(expr) (expr)
#define unlikely(expr) (expr)
-#undef __i386__
-#undef __i686__

static char *
PARENT_HELPER (char *p, unsigned int offset)
53 changes: 53 additions & 0 deletions tools/depends/target/zvbi/Makefile
@@ -0,0 +1,53 @@
include ../../Makefile.include
DEPS= ../../Makefile.include Makefile

# lib name, version
PACKAGENAME=zvbi
LIBNAME=lib$(PACKAGENAME)
VERSION=0.2.35
SOURCE=$(PACKAGENAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.bz2

# configuration settings
CONFIGURE=./configure --prefix=$(PREFIX) --without-x --disable-dvb --disable-bktr \
--disable-nls --disable-proxy \
--without-doxygen

LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a

CLEAN_FILES=$(ARCHIVE) $(PLATFORM)

all: $(LIBDYLIB) .installed-$(PLATFORM)

$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); patch -p1 < ../01-zvbi-ssize_max.patch
cd $(PLATFORM); patch -p1 < ../02-zvbi-ioctl.patch
ifeq ($(OS),osx)
cd $(PLATFORM); patch -p1 < ../03-zvbi-fix-clang-support.patch
endif
cd $(PLATFORM); autoreconf -vif
cd $(PLATFORM); $(CONFIGURE)

$(LIBDYLIB): $(PLATFORM)
$(MAKE) -C $(PLATFORM)

.installed-$(PLATFORM): $(LIBDYLIB)
ifeq ($(OS),android)
rm -f $(PLATFORM)/src/.libs/libzvbi.la $(PLATFORM)/src/.libs/libzvbi.so $(PLATFORM)/src/.libs/libzvbi.so.0
mv -f $(PLATFORM)/src/.libs/libzvbi.so.0.0.0 $(PLATFORM)/src/.libs/libzvbi.so
$(RPL) -e "libzvbi.so.0" "libzvbi.so\x00\x00" $(PLATFORM)/src/.libs/libzvbi.so
-$(READELF) --dynamic $(PLATFORM)/src/.libs/libzvbi.so | grep ibrary
endif
$(MAKE) -C $(PLATFORM) install
touch $@
clean:
$(MAKE) -C $(PLATFORM) clean
rm -r .installed-$(PLATFORM)

distclean::
rm -rf $(PLATFORM) .installed-$(PLATFORM)

20 comments on commit eb4b65b

@Memphiz
Copy link
Owner Author

@Memphiz Memphiz commented on eb4b65b Dec 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FernetMenta - here is the complete win32 patch to get it to compile in mingw:

http://pastebin.com/AxuXZUPb

@FernetMenta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, thanks!

@Memphiz
Copy link
Owner Author

@Memphiz Memphiz commented on eb4b65b Dec 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh now that i look at it - the first patch for conv.c could also fix android - will try at home ...

@FernetMenta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wsnipex ENABLE_BKTR should be undefined on android

@wsnipex
Copy link

@wsnipex wsnipex commented on eb4b65b Dec 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean without --disable-bktr? not yet. Is that in any way related to the incomplete pthread implementation on android?

@FernetMenta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do you configure it?

@wsnipex
Copy link

@wsnipex wsnipex commented on eb4b65b Dec 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just used this Makefile

@Memphiz
Copy link
Owner Author

@Memphiz Memphiz commented on eb4b65b Dec 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that configure line is borrowed from vlc btw :)

@Memphiz
Copy link
Owner Author

@Memphiz Memphiz commented on eb4b65b Dec 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wsnipex @FernetMenta fyi - i finally uploaded the zvbi tarball to our mirrors ;)

@FernetMenta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks much! Next I will try to write some code and figure out how this lib works.

@Memphiz
Copy link
Owner Author

@Memphiz Memphiz commented on eb4b65b Dec 5, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So its not like just enabling it in ffmpeg i guess?

@FernetMenta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I need to write a new overlay decoder for this. Also touch demuxer to get the cc data. i was talking about a challange :)

@Memphiz
Copy link
Owner Author

@Memphiz Memphiz commented on eb4b65b Dec 5, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so what @notspiff wrote was a bit to optimistic? ^^

@notspiff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libzvbi_dec.c

Demuxer work is definitely necessary but wouldnt overlay be ass or ffmpeg ?

@FernetMenta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overlay would be a combination of those. first ffmpeg converts to ass and second stage we need to handle ass the way we do already. but this 2 fold codec has to be written.

@notspiff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, suspected as much but i thought it [c|w]ould be done as a bsf in the demuxer layer. i don't know all the details of how ass is handled in dvdplayer though so i guess if an overlay-in-overlay makes more sense to you that is the better solution.

@FernetMenta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about the approach of doing the conversion in the demuxer layer but thought it won't be nice having a decoder in that stage. Anyhow, things may chnage, first I need.to get something working to play with

@FernetMenta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, this turns out to be more work than I thought. neither ffmpeg nor zvbi is any help here. zvbi is only capable of cea 608 (line 21, outdated) and ffmpeg can only extract 608 at wrong stage. I need to write a separate demuxer and 708 decoder.

@Memphiz
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not worth the hazzle if you ask me then - if ffmpeg can't do it its just a pity for those users - so be it...

@FernetMenta
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is that I already got started and I hate things not working :)

Please sign in to comment.