[FFmpeg-devel] [PATCHv2 4/4] lavc: add teletext decoder using libzvbi
Michael Niedermayer
michaelni at gmx.at
Tue Aug 6 20:24:58 CEST 2013
On Tue, Aug 06, 2013 at 07:45:32PM +0200, Marton Balint wrote:
>
> On Mon, 5 Aug 2013, Michael Niedermayer wrote:
>
> >On Sun, Aug 04, 2013 at 06:37:47PM +0200, Marton Balint wrote:
> >>Based on a patch by Wolfram Gloger <wmglo at dent.med.uni-muenchen.de>.
> >>http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2012-December/136677.html
> >>
> >>The original patch was rebased by Tudor SUCIU <tudor.suciu at gmail.com>.
> >>
> >>Lots of additional features and fixes are made by me.
> >>
> >>Signed-off-by: Marton Balint <cus at passwd.hu>
> >>---
> >> Changelog | 1 +
> >> configure | 5 +
> >> libavcodec/Makefile | 1 +
> >> libavcodec/allcodecs.c | 1 +
> >> libavcodec/avcodec.h | 6 +
> >> libavcodec/teletextdec.c | 468 +++++++++++++++++++++++++++++++++++++++++++++++
> >> libavformat/mpegts.c | 8 +
> >> libavformat/version.h | 2 +-
> >> 8 files changed, 491 insertions(+), 1 deletion(-)
> >> create mode 100644 libavcodec/teletextdec.c
> >>
> >>diff --git a/Changelog b/Changelog
> >>index 48f93c7..0cbfffb 100644
> >>--- a/Changelog
> >>+++ b/Changelog
> >>@@ -8,6 +8,7 @@ version <next>
> >> - ffprobe -show_programs option
> >> - compand filter
> >> - RTMP seek support
> >>+- dvb teletext decoder
> >>
> >>
> >> version 2.0:
> >>diff --git a/configure b/configure
> >>index 539c581..0895b61 100755
> >>--- a/configure
> >>+++ b/configure
> >>@@ -241,6 +241,7 @@ External library support:
> >> --enable-libxvid enable Xvid encoding via xvidcore,
> >> native MPEG-4/Xvid encoder exists [no]
> >> --enable-libzmq enable message passing via libzmq [no]
> >>+ --enable-libzvbi enable teletext support via libzvbi [no]
> >> --enable-openal enable OpenAL 1.1 capture support [no]
> >> --enable-opencl enable OpenCL code
> >> --enable-openssl enable openssl [no]
> >>@@ -1204,6 +1205,7 @@ EXTERNAL_LIBRARY_LIST="
> >> libxavs
> >> libxvid
> >> libzmq
> >>+ libzvbi
> >> openal
> >> opencl
> >> openssl
> >>@@ -2031,6 +2033,7 @@ libxavs_encoder_deps="libxavs"
> >> libxvid_encoder_deps="libxvid"
> >> libutvideo_decoder_deps="libutvideo"
> >> libutvideo_encoder_deps="libutvideo"
> >>+teletext_decoder_deps="libzvbi"
> >>
> >> # demuxers / muxers
> >> ac3_demuxer_select="ac3_parser"
> >>@@ -4206,6 +4209,7 @@ enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &
> >> enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
> >> enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
> >> enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
> >>+enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
> >> enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
> >> check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
> >> die "ERROR: openal not found"; } &&
> >>@@ -4596,6 +4600,7 @@ echo "threading support ${thread_type-no}"
> >> echo "safe bitstream reader ${safe_bitstream_reader-no}"
> >> echo "SDL support ${sdl-no}"
> >> echo "opencl enabled ${opencl-no}"
> >>+echo "libzvbi enabled ${libzvbi-no}"
> >> echo "texi2html enabled ${texi2html-no}"
> >> echo "perl enabled ${perl-no}"
> >> echo "pod2man enabled ${pod2man-no}"
> >>diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> >>index 31477ac..62fb250 100644
> >>--- a/libavcodec/Makefile
> >>+++ b/libavcodec/Makefile
> >>@@ -719,6 +719,7 @@ OBJS-$(CONFIG_LIBWAVPACK_ENCODER) += libwavpackenc.o
> >> OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o
> >> OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o
> >> OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o
> >>+OBJS-$(CONFIG_TELETEXT_DECODER) += teletextdec.o
> >>
> >> # parsers
> >> OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
> >>diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> >>index 5cdf778..daf5915 100644
> >>--- a/libavcodec/allcodecs.c
> >>+++ b/libavcodec/allcodecs.c
> >>@@ -470,6 +470,7 @@ void avcodec_register_all(void)
> >> REGISTER_ENCDEC (SUBRIP, subrip);
> >> REGISTER_DECODER(SUBVIEWER, subviewer);
> >> REGISTER_DECODER(SUBVIEWER1, subviewer1);
> >>+ REGISTER_DECODER(TELETEXT, teletext);
> >> REGISTER_DECODER(TEXT, text);
> >> REGISTER_DECODER(VPLAYER, vplayer);
> >> REGISTER_DECODER(WEBVTT, webvtt);
> >>diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> >>index ae6625f..0704639 100644
> >>--- a/libavcodec/avcodec.h
> >>+++ b/libavcodec/avcodec.h
> >>@@ -1001,6 +1001,12 @@ enum AVPacketSideDataType {
> >> * follow the timestamp specifier of a WebVTT cue.
> >> */
> >> AV_PKT_DATA_WEBVTT_SETTINGS,
> >>+
> >>+ /**
> >>+ * PES header of the packet generated by the mpegts demuxer. Only set for
> >>+ * dvb teletext subtitles. (libzvbi needs also the pes header for decoding)
> >>+ */
> >>+ AV_PKT_DATA_MPEGTS_PESHEADER,
> >
> >why does libzvbi need the header ?
>
> The way I see it it does some sanity checks on it (length, etc) and
> decodes the PTS in the PES header. The decoder later uses that PTS
> to provide timestamp information to libzvbi which detects dropped
> vbi frames if the difference is too big (or small) between two pts
> values.
>
> >
> >what if the stream comes from a non PES based container ?
> >like if someone transcodes mpeg->mkv/nut whatever and then tries to
> >play that
>
> Probably we should create a fake PES header based on the packet pts,
> and feed it to libzvbi.
>
> However, because of the fix pts stuff in the mpegts demuxer some
> errors in the packet pts values are possible which errors may be
> misdetected as frame drops by libzvbi.
>
> So probably the best thing we can do is if we always pass 0 as PTS
> to libzvbi to disable this desync feature of it, and accept the
> possibly of corrupt pages in case of a packet loss.
>
> What do you think, should I remove the pes header side data
> entirely, or keep it in the demuxer, but if it does not exist in the
> decoder, then generate the fake PES header?
i would remove it entirely, as thats the simplest solution, it
could be added back if its needed.
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130806/af555ac9/attachment.asc>
More information about the ffmpeg-devel
mailing list