Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Florian Franzmann (c061be96e98d43602ced4a6af0ac82ccfa19218b)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Florian Franzmann <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Florian Franzmann (c061be96e98d43602ced4a6af0ac82ccfa19218b)
  • Date: Fri, 16 Nov 2007 19:41:06 -0600

GIT changes to master grimoire by Florian Franzmann
<siflfran AT hawo.stw.uni-erlangen.de>:

video/dvbcut/BUILD | 4
video/dvbcut/DEPENDS | 5
video/dvbcut/DETAILS | 9
video/dvbcut/HISTORY | 9
video/dvbcut/PRE_BUILD | 5
video/dvbcut/dvbcut-0.5.3-ffmpeg-compat.patch | 38 ++
video/dvbcut/dvbcut-0.5.4-ffmpeg-compat2.patch | 129 +++++++++
video/dvbcut/dvbcut-0.5.4-ffmpeg-compat3.patch | 199 ++++++++++++++
video/dvbcut/dvbcut-0.5.4-gcc42.patch | 13
video/dvbcut/dvbcut-newffmpeg.diff | 337
-------------------------
10 files changed, 403 insertions(+), 345 deletions(-)

New commits:
commit c061be96e98d43602ced4a6af0ac82ccfa19218b
Author: Florian Franzmann <siflfran AT hawo.stw.uni-erlangen.de>
Commit: Florian Franzmann <siflfran AT hawo.stw.uni-erlangen.de>

video/dvbcut: updated to 0.5.4

diff --git a/video/dvbcut/BUILD b/video/dvbcut/BUILD
index d96966b..abc1fff 100755
--- a/video/dvbcut/BUILD
+++ b/video/dvbcut/BUILD
@@ -1 +1,3 @@
-make PREFIX=$INSTALL_ROOT/usr MANPATH=$INSTALL_ROOT/usr/share/man
+make PREFIX=$INSTALL_ROOT/usr \
+ MANPATH=$INSTALL_ROOT/usr/share/man \
+ FFMPEG=$INSTALL_ROOT/usr
diff --git a/video/dvbcut/DEPENDS b/video/dvbcut/DEPENDS
index 936f6c7..fa600cb 100755
--- a/video/dvbcut/DEPENDS
+++ b/video/dvbcut/DEPENDS
@@ -1,3 +1,6 @@
depends qt-x11 &&
depends libao &&
-depends scons
+depends scons &&
+depends libmad &&
+depends a52dec &&
+depends ffmpeg-svn
diff --git a/video/dvbcut/DETAILS b/video/dvbcut/DETAILS
index a3dc7c9..4301601 100755
--- a/video/dvbcut/DETAILS
+++ b/video/dvbcut/DETAILS
@@ -1,9 +1,8 @@
SPELL=dvbcut
- VERSION=20070330
- SOURCE="${SPELL}-${VERSION}.tar.bz2"
-# SOURCE_URL[0]=svn_http://svn.sourceforge.net/svnroot/dvbcut/trunk:dvbcut
-
SOURCE_URL[0]='http://www.hawo.stw.uni-erlangen.de/~siflfran/smgl/$SPELL/$SOURCE'
-
SOURCE_HASH=sha512:c7b5464a151890554ca3d3010c2e7279b8512a4c18217441ab6bf1d93f0244a9374ec509c1ab96392225cb2d8acd351c8b58328134749050fbacf76fb3cefb94
+ VERSION=0.5.4
+ SOURCE="${SPELL}_${VERSION}.tar.bz2"
+ SOURCE_URL[0]="${SOURCEFORGE_URL}/${SPELL}/${SOURCE}"
+
SOURCE_HASH=sha512:f60069262e08fb1600bae9679083d50156f2a2a62ce139d24b7c521c0a68b741f497f54b87fa7ea4ef18c372c89eb196e1d03464f787e3e697dc2b5b128fc62f
SOURCE_DIRECTORY="${BUILD_DIRECTORY}/$SPELL-$VERSION"
WEB_SITE="http://dvbcut.sourceforge.net";
LICENSE[0]=GPL
diff --git a/video/dvbcut/HISTORY b/video/dvbcut/HISTORY
index a1eb316..724e518 100644
--- a/video/dvbcut/HISTORY
+++ b/video/dvbcut/HISTORY
@@ -1,3 +1,12 @@
+2007-11-17 Florian Franzmann <siflfran AT hawo.stw.uni-erlangen.de>
+ * DETAILS: updated to 0.5.4
+ * DEPENDS, BUILD: added missing dependencies, use system ffmpeg
+ dvbcut-0.5.3-ffmpeg-compat.patch,
+ dvbcut-0.5.4-ffmpeg-compat2.patch,
+ dvbcut-0.5.4-ffmpeg-compat3.patch,
+ dvbcut-0.5.4-gcc42.patch, PRE_BUILD: added patches from gentoo
+ to make dvbcut compile
+
2007-04-07 Florian Franzmann <siflfran AT hawo.stw.uni-erlangen.de>
* dvbcut-SConstruct.diff: removed binary garbage

diff --git a/video/dvbcut/PRE_BUILD b/video/dvbcut/PRE_BUILD
index 35bba38..1e365fc 100755
--- a/video/dvbcut/PRE_BUILD
+++ b/video/dvbcut/PRE_BUILD
@@ -1,4 +1,7 @@
default_pre_build &&
cd $SOURCE_DIRECTORY &&
-patch -p1 < ${SCRIPT_DIRECTORY}/dvbcut-newffmpeg.diff &&
+patch -p1 < ${SCRIPT_DIRECTORY}/dvbcut-0.5.3-ffmpeg-compat.patch &&
+patch -p1 < ${SCRIPT_DIRECTORY}/dvbcut-0.5.4-ffmpeg-compat2.patch &&
+patch -p1 < ${SCRIPT_DIRECTORY}/dvbcut-0.5.4-ffmpeg-compat3.patch &&
+patch -p1 < ${SCRIPT_DIRECTORY}/dvbcut-0.5.4-gcc42.patch &&
patch -p1 < ${SCRIPT_DIRECTORY}/dvbcut-SConstruct.diff
diff --git a/video/dvbcut/dvbcut-0.5.3-ffmpeg-compat.patch
b/video/dvbcut/dvbcut-0.5.3-ffmpeg-compat.patch
new file mode 100644
index 0000000..fdb8a4e
--- /dev/null
+++ b/video/dvbcut/dvbcut-0.5.3-ffmpeg-compat.patch
@@ -0,0 +1,38 @@
+Index: dvbcut-0.5.3/SConstruct
+===================================================================
+--- dvbcut-0.5.3.orig/SConstruct
++++ dvbcut-0.5.3/SConstruct
+@@ -101,6 +101,7 @@ if (ffmpegpath!='/usr'):
+ env.Append(LIBPATH=os.path.join(str(ffmpegpath),'lib'))
+ env.Append(LIBS=['avformat','avcodec','avutil'])
+
++env.Append(CPPDEFINES="__STDC_CONSTANT_MACROS")
+ ###### WORK
+
+ env.bin_targets=[]
+Index: dvbcut-0.5.3/src/psfile.cpp
+===================================================================
+--- dvbcut-0.5.3.orig/src/psfile.cpp
++++ dvbcut-0.5.3/src/psfile.cpp
+@@ -100,7 +100,7 @@ psfile::psfile(const std::string &filena
+ streamnumber[sid]=audiostream(audiostreams);
+ stream *S=&s[audiostream(audiostreams++)];
+ S->id=sid;
+- S->dec=&ac3_decoder;
++ S->dec=&liba52_decoder;
+ S->type=streamtype::ac3audio;
+ if (audiostreams>=MAXAUDIOSTREAMS)
+ break;
+Index: dvbcut-0.5.3/src/tsfile.cpp
+===================================================================
+--- dvbcut-0.5.3.orig/src/tsfile.cpp
++++ dvbcut-0.5.3/src/tsfile.cpp
+@@ -73,7 +73,7 @@ tsfile::tsfile(const std::string &filena
+ stream *S=&s[audiostream(audiostreams++)];
+ S->id=it->second;
+ if (it->first==0xbd) {
+- S->dec=&ac3_decoder;
++ S->dec=&liba52_decoder;
+ S->enc=&ac3_encoder;
+ S->type=streamtype::ac3audio;
+ } else {
diff --git a/video/dvbcut/dvbcut-0.5.4-ffmpeg-compat2.patch
b/video/dvbcut/dvbcut-0.5.4-ffmpeg-compat2.patch
new file mode 100644
index 0000000..b582286
--- /dev/null
+++ b/video/dvbcut/dvbcut-0.5.4-ffmpeg-compat2.patch
@@ -0,0 +1,129 @@
+Index: dvbcut-0.5.4/src/avframe.h
+===================================================================
+--- dvbcut-0.5.4.orig/src/avframe.h
++++ dvbcut-0.5.4/src/avframe.h
+@@ -19,7 +19,9 @@
+ #ifndef _DVBCUT_AVFRAME_H
+ #define _DVBCUT_AVFRAME_H
+
++extern "C" {
+ #include <ffmpeg/avcodec.h>
++}
+
+ class QImage;
+
+Index: dvbcut-0.5.4/src/lavfmuxer.cpp
+===================================================================
+--- dvbcut-0.5.4.orig/src/lavfmuxer.cpp
++++ dvbcut-0.5.4/src/lavfmuxer.cpp
+@@ -16,7 +16,9 @@
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
++extern "C" {
+ #include <ffmpeg/avformat.h>
++}
+ #include <string.h>
+ #include <utility>
+ #include <list>
+Index: dvbcut-0.5.4/src/lavfmuxer.h
+===================================================================
+--- dvbcut-0.5.4.orig/src/lavfmuxer.h
++++ dvbcut-0.5.4/src/lavfmuxer.h
+@@ -19,7 +19,9 @@
+ #ifndef _DVBCUT_LAVFMUXER_H
+ #define _DVBCUT_LAVFMUXER_H
+
++extern "C" {
+ #include <ffmpeg/avformat.h>
++}
+ #include "mpgfile.h"
+ #include "muxer.h"
+
+Index: dvbcut-0.5.4/src/main.cpp
+===================================================================
+--- dvbcut-0.5.4.orig/src/main.cpp
++++ dvbcut-0.5.4/src/main.cpp
+@@ -27,7 +27,9 @@
+ #endif // HAVE_LIB_AO
+
+ #include <qapplication.h>
++extern "C" {
+ #include <ffmpeg/avformat.h>
++}
+ #include <qimage.h>
+ #include <qsettings.h>
+ #include "dvbcut.h"
+Index: dvbcut-0.5.4/src/mpgfile.h
+===================================================================
+--- dvbcut-0.5.4.orig/src/mpgfile.h
++++ dvbcut-0.5.4/src/mpgfile.h
+@@ -19,7 +19,10 @@
+ #ifndef _DVBCUT_MPGFILE_H
+ #define _DVBCUT_MPGFILE_H
+
++extern "C" {
+ #include <ffmpeg/avcodec.h>
++}
++
+ #include <string>
+ #include <vector>
+ #include <list>
+Index: dvbcut-0.5.4/src/playaudio.cpp
+===================================================================
+--- dvbcut-0.5.4.orig/src/playaudio.cpp
++++ dvbcut-0.5.4/src/playaudio.cpp
+@@ -19,7 +19,10 @@
+ #ifdef HAVE_LIB_AO
+ #include <stdio.h>
+ #include <ao/ao.h>
++extern "C" {
+ #include <ffmpeg/avcodec.h>
++}
++
+ #include "playaudio.h"
+
+ #define MIN_BUFFER_SAMPLES (1536*6)
+Index: dvbcut-0.5.4/src/psfile.cpp
+===================================================================
+--- dvbcut-0.5.4.orig/src/psfile.cpp
++++ dvbcut-0.5.4/src/psfile.cpp
+@@ -19,7 +19,10 @@
+ #include "psfile.h"
+ #include "streamhandle.h"
+ #include "stream.h"
++
++extern "C" {
+ #include <ffmpeg/avcodec.h>
++}
+
+ psfile::psfile(const std::string &filename, inbuffer &b, int initial_offset)
+ : mpgfile(filename, b, initial_offset)
+Index: dvbcut-0.5.4/src/streamdata.h
+===================================================================
+--- dvbcut-0.5.4.orig/src/streamdata.h
++++ dvbcut-0.5.4/src/streamdata.h
+@@ -21,7 +21,9 @@
+
+ #include <string>
+ #include <list>
++extern "C" {
+ #include <ffmpeg/avformat.h>
++}
+
+ #include "port.h"
+ #include "tsfile.h"
+Index: dvbcut-0.5.4/src/tsfile.cpp
+===================================================================
+--- dvbcut-0.5.4.orig/src/tsfile.cpp
++++ dvbcut-0.5.4/src/tsfile.cpp
+@@ -22,7 +22,9 @@
+ #include <list>
+ #include <utility>
+
++extern "C" {
+ #include <ffmpeg/avcodec.h>
++}
+
+ tsfile::tsfile(const std::string &filename, inbuffer &b, int initial_offset)
+ : mpgfile(filename, b, initial_offset)
diff --git a/video/dvbcut/dvbcut-0.5.4-ffmpeg-compat3.patch
b/video/dvbcut/dvbcut-0.5.4-ffmpeg-compat3.patch
new file mode 100644
index 0000000..53e762a
--- /dev/null
+++ b/video/dvbcut/dvbcut-0.5.4-ffmpeg-compat3.patch
@@ -0,0 +1,199 @@
+Index: dvbcut-svn/src/psfile.cpp
+===================================================================
+--- dvbcut-svn.orig/src/psfile.cpp
++++ dvbcut-svn/src/psfile.cpp
+@@ -90,7 +90,7 @@ psfile::psfile(const std::string &filena
+ streamnumber[sid]=audiostream(audiostreams);
+ stream *S=&s[audiostream(audiostreams++)];
+ S->id=sid;
+- S->dec=&mp2_decoder;
++ S->dec=avcodec_find_decoder(CODEC_ID_MP2);
+ S->type=streamtype::mpegaudio;
+ if (audiostreams>=MAXAUDIOSTREAMS)
+ break;
+@@ -100,7 +100,7 @@ psfile::psfile(const std::string &filena
+ streamnumber[sid]=audiostream(audiostreams);
+ stream *S=&s[audiostream(audiostreams++)];
+ S->id=sid;
+- S->dec=&liba52_decoder;
++ S->dec=avcodec_find_decoder(CODEC_ID_AC3);
+ S->type=streamtype::ac3audio;
+ if (audiostreams>=MAXAUDIOSTREAMS)
+ break;
+@@ -114,8 +114,8 @@ psfile::psfile(const std::string &filena
+ S->allocavcc();
+ S->avcc->codec_type=CODEC_TYPE_VIDEO;
+ S->avcc->codec_id=CODEC_ID_MPEG2VIDEO;
+- S->dec=&mpeg2video_decoder;
+- S->enc=&mpeg2video_encoder;
++ S->dec=avcodec_find_decoder(CODEC_ID_MPEG2VIDEO);
++ S->enc=avcodec_find_encoder(CODEC_ID_MPEG2VIDEO);
+ S->type=streamtype::mpeg2video;
+ }
+
+Index: dvbcut-svn/src/tsfile.cpp
+===================================================================
+--- dvbcut-svn.orig/src/tsfile.cpp
++++ dvbcut-svn/src/tsfile.cpp
+@@ -78,12 +78,12 @@ tsfile::tsfile(const std::string &filena
+ stream *S=&s[audiostream(audiostreams++)];
+ S->id=it->second;
+ if (it->first==0xbd) {
+- S->dec=&liba52_decoder;
+- S->enc=&ac3_encoder;
++ S->dec=avcodec_find_decoder(CODEC_ID_AC3);
++ S->enc=avcodec_find_encoder(CODEC_ID_AC3);
+ S->type=streamtype::ac3audio;
+ } else {
+- S->dec=&mp2_decoder;
+- S->enc=&mp2_encoder;
++ S->dec=avcodec_find_decoder(CODEC_ID_MP2);
++ S->enc=avcodec_find_decoder(CODEC_ID_MP2);
+ S->type=streamtype::mpegaudio;
+ }
+ if (audiostreams>=MAXAUDIOSTREAMS)
+@@ -98,8 +98,8 @@ tsfile::tsfile(const std::string &filena
+ S->allocavcc();
+ S->avcc->codec_type=CODEC_TYPE_VIDEO;
+ S->avcc->codec_id=CODEC_ID_MPEG2VIDEO;
+- S->dec=&mpeg2video_decoder;
+- S->enc=&mpeg2video_encoder;
++ S->dec=avcodec_find_decoder(CODEC_ID_MPEG2VIDEO);
++ S->enc=avcodec_find_encoder(CODEC_ID_MPEG2VIDEO);
+ S->type=streamtype::mpeg2video;
+ }
+
+Index: dvbcut-svn/src/avframe.cpp
+===================================================================
+--- dvbcut-svn.orig/src/avframe.cpp
++++ dvbcut-svn/src/avframe.cpp
+@@ -23,7 +23,11 @@
+ #include <stdio.h>
+ #include "avframe.h"
+
++#ifdef HAVE_LIB_SWSCALE
++avframe::avframe() :
tobefreed(0),w(0),h(0),dw(0),pix_fmt(),img_convert_ctx(0)
++#else
+ avframe::avframe() : tobefreed(0),w(0),h(0),dw(0),pix_fmt()
++#endif
+ {
+ f=avcodec_alloc_frame();
+ }
+@@ -54,7 +58,11 @@ avframe::avframe(AVFrame *src, AVCodecCo
+ h=ctx->height;
+ pix_fmt=ctx->pix_fmt;
+ dw=w*ctx->sample_aspect_ratio.num/ctx->sample_aspect_ratio.den;
+-
++#ifdef HAVE_LIB_SWSCALE
++ img_convert_ctx=sws_getContext(w, h, pix_fmt,
++ w, h, PIX_FMT_BGR24, SWS_BICUBIC,
++ NULL, NULL, NULL);
++#endif
+ }
+
+ avframe::~avframe()
+@@ -63,11 +71,19 @@ avframe::~avframe()
+ free(tobefreed);
+ if (f)
+ av_free(f);
++#ifdef HAVE_LIB_SWSCALE
++ if (img_convert_ctx)
++ sws_freeContext(img_convert_ctx);
++#endif
+ }
+
+ QImage avframe::getqimage(bool scaled, int viewscalefactor)
+ {
++#ifdef HAVE_LIB_SWSCALE
++ if (w<=0 || h<=0 || img_convert_ctx==NULL)
++#else
+ if (w<=0 || h<=0)
++#endif
+ return QImage();
+
+ uint8_t *rgbbuffer=(uint8_t*)malloc(avpicture_get_size(PIX_FMT_RGB24, w,
h)+64);
+@@ -79,11 +95,20 @@ QImage avframe::getqimage(bool scaled, i
+ rgbbuffer+headerlen,
+ PIX_FMT_RGB24,w,h);
+
++#ifdef HAVE_LIB_SWSCALE
++ sws_scale(img_convert_ctx, f->data, f->linesize, 0, h,
++ avframergb->data, avframergb->linesize);
++#else
+ img_convert((AVPicture *)avframergb, PIX_FMT_RGB24, (AVPicture*)f,
pix_fmt, w, h);
++#endif
+
+ QImage im;
+ im.loadFromData(rgbbuffer, headerlen+w*h*3, "PPM");
+
++#ifdef HAVE_LIB_SWSCALE
++ im = im.swapRGB();
++#endif
++
+ if ((scaled && w!=dw)||(viewscalefactor!=1)) {
+ #ifdef SMOOTHSCALE
+ im = im.smoothScale((scaled?dw:w)/viewscalefactor, h/viewscalefactor);
+Index: dvbcut-svn/src/avframe.h
+===================================================================
+--- dvbcut-svn.orig/src/avframe.h
++++ dvbcut-svn/src/avframe.h
+@@ -23,6 +23,9 @@
+
+ extern "C" {
+ #include <ffmpeg/avcodec.h>
++#ifdef HAVE_LIB_SWSCALE
++#include <ffmpeg/swscale.h>
++#endif
+ }
+
+ class QImage;
+@@ -37,6 +40,9 @@ protected:
+ void *tobefreed;
+ int w,h,dw;
+ enum PixelFormat pix_fmt;
++#ifdef HAVE_LIB_SWSCALE
++ struct SwsContext *img_convert_ctx;
++#endif
+
+ public:
+ avframe();
+Index: dvbcut-svn/SConstruct
+===================================================================
+--- dvbcut-svn.orig/SConstruct
++++ dvbcut-svn/SConstruct
+@@ -88,10 +88,6 @@ if (not env.GetOption('clean')):
+ print "Checking for libao... found"
+ else:
+ print "Checking for libao... not found"
+-
+-### FINISH
+-
+-env=conf.Finish()
+
+ ###### BUILD ENVIRONMENT (pt2)
+
+@@ -117,8 +113,23 @@ if (ffmpegpath!='/usr'):
+ env.Append(CPPPATH=os.path.join(str(ffmpegpath),'include'))
+ env.Append(LIBPATH=os.path.join(str(ffmpegpath),'lib'))
+ env.Append(LIBS=['avformat','avcodec','avutil'])
++if (localffmpeg==False):
++ env.Append(CPPDEFINES=["__STDC_CONSTANT_MACROS", "__STDC_LIMIT_MACROS"])
++
++
++### LIBSWSCALE
++if (not env.GetOption('clean') and not localffmpeg):
++ if (conf.TryAction('pkg-config --exists libswscale')[0]):
++ conf.env.Append(CPPDEFINES="HAVE_LIB_SWSCALE")
++ conf.env.ParseConfig('pkg-config --cflags --libs libswscale')
++ print "Checking for C library swscale... yes"
++ elif (conf.CheckLibWithHeader('swscale', 'ffmpeg/swscale.h', 'C')):
++ conf.env.Append(CPPDEFINES="HAVE_LIB_SWSCALE")
++
++### FINISH
++
++env=conf.Finish()
+
+-env.Append(CPPDEFINES="__STDC_CONSTANT_MACROS")
+ ###### WORK
+
+ env.bin_targets=[]
diff --git a/video/dvbcut/dvbcut-0.5.4-gcc42.patch
b/video/dvbcut/dvbcut-0.5.4-gcc42.patch
new file mode 100644
index 0000000..ba61fcd
--- /dev/null
+++ b/video/dvbcut/dvbcut-0.5.4-gcc42.patch
@@ -0,0 +1,13 @@
+Index: dvbcut-0.5.4/src/playaudio.cpp
+===================================================================
+--- dvbcut-0.5.4.orig/src/playaudio.cpp
++++ dvbcut-0.5.4/src/playaudio.cpp
+@@ -38,7 +38,7 @@ void playaudio(const void *data, uint32_
+ const uint8_t *d=(const uint8_t*)data;
+
+ while (len>0) {
+- int16_t samples[MIN_BUFFER_SAMPLES >? avcc->frame_size];
++ int16_t samples[MIN_BUFFER_SAMPLES > avcc->frame_size ?
MIN_BUFFER_SAMPLES : avcc->frame_size ];
+ int frame_size;
+
+ int
bytesDecoded=avcodec_decode_audio(avcc,samples,&frame_size,(uint8_t*)d,len);
diff --git a/video/dvbcut/dvbcut-newffmpeg.diff
b/video/dvbcut/dvbcut-newffmpeg.diff
deleted file mode 100644
index 2409401..0000000
--- a/video/dvbcut/dvbcut-newffmpeg.diff
+++ /dev/null
@@ -1,337 +0,0 @@
-diff -Naur dvbcut.orig/ffmpeg-patches/cvs20050918.diff
dvbcut-newffmpeg/ffmpeg-patches/cvs20050918.diff
---- dvbcut.orig/ffmpeg-patches/cvs20050918.diff 2007-03-30
22:54:44.000000000 +0200
-+++ dvbcut-newffmpeg/ffmpeg-patches/cvs20050918.diff 2007-03-30
22:55:19.000000000 +0200
-@@ -762,7 +762,7 @@
- #ifdef CONFIG_AC3
- -#ifdef CONFIG_AC3_DECODER
- + register_avcodec(&ac3_encoder);
-- register_avcodec(&ac3_decoder);
-+ register_avcodec(&liba52_decoder);
- -#endif //CONFIG_AC3_DECODER
- #endif
- +
-diff -Naur dvbcut.orig/ffmpeg.src/libavcodec/a52dec.c
dvbcut-newffmpeg/ffmpeg.src/libavcodec/a52dec.c
---- dvbcut.orig/ffmpeg.src/libavcodec/a52dec.c 2007-03-30 22:54:44.000000000
+0200
-+++ dvbcut-newffmpeg/ffmpeg.src/libavcodec/a52dec.c 2007-03-30
22:55:19.000000000 +0200
-@@ -250,7 +250,7 @@
- return 0;
- }
-
--AVCodec ac3_decoder = {
-+AVCodec liba52_decoder = {
- "ac3",
- CODEC_TYPE_AUDIO,
- CODEC_ID_AC3,
-diff -Naur dvbcut.orig/ffmpeg.src/libavcodec/allcodecs.c
dvbcut-newffmpeg/ffmpeg.src/libavcodec/allcodecs.c
---- dvbcut.orig/ffmpeg.src/libavcodec/allcodecs.c 2007-03-30
22:54:44.000000000 +0200
-+++ dvbcut-newffmpeg/ffmpeg.src/libavcodec/allcodecs.c 2007-03-30
22:55:19.000000000 +0200
-@@ -47,7 +47,7 @@
-
- #ifdef CONFIG_AC3
- register_avcodec(&ac3_encoder);
-- register_avcodec(&ac3_decoder);
-+ register_avcodec(&liba52_decoder);
- #endif
-
- #ifdef CONFIG_DTS
-diff -Naur dvbcut.orig/ffmpeg.src/libavcodec/avcodec.h
dvbcut-newffmpeg/ffmpeg.src/libavcodec/avcodec.h
---- dvbcut.orig/ffmpeg.src/libavcodec/avcodec.h 2007-03-30
22:54:44.000000000 +0200
-+++ dvbcut-newffmpeg/ffmpeg.src/libavcodec/avcodec.h 2007-03-30
22:55:19.000000000 +0200
-@@ -2115,7 +2115,7 @@
- extern AVCodec rawvideo_decoder;
-
- /* the following codecs use external GPL libs */
--extern AVCodec ac3_decoder;
-+extern AVCodec liba52_decoder;
- extern AVCodec dts_decoder;
-
- /* subtitles */
-diff -Naur dvbcut.orig/SConscript.ffmpeg dvbcut-newffmpeg/SConscript.ffmpeg
---- dvbcut.orig/SConscript.ffmpeg 2007-03-30 22:54:44.000000000 +0200
-+++ dvbcut-newffmpeg/SConscript.ffmpeg 2007-03-30 22:55:19.000000000 +0200
-@@ -20,8 +20,8 @@
- --disable-audio-oss
- --enable-codec=mpeg2encoder
- --enable-codec=mp2_encoder
-- --enable-codec=ac3_decoder
-- --enable-codec=ac3_encoder
-+ --enable-codec=liba52_decoder
-+ --enable-codec=liba52_decoder
- --enable-a52
- """%(Dir('.').abspath,)).split()
-
-diff -Naur dvbcut.orig/src/psfile.cpp dvbcut-newffmpeg/src/psfile.cpp
---- dvbcut.orig/src/psfile.cpp 2007-03-30 22:54:44.000000000 +0200
-+++ dvbcut-newffmpeg/src/psfile.cpp 2007-03-30 22:55:19.000000000 +0200
-@@ -100,7 +100,7 @@
- streamnumber[sid]=audiostream(audiostreams);
- stream *S=&s[audiostream(audiostreams++)];
- S->id=sid;
-- S->dec=&ac3_decoder;
-+ S->dec=&liba52_decoder;
- S->type=streamtype::ac3audio;
- if (audiostreams>=MAXAUDIOSTREAMS)
- break;
-diff -Naur dvbcut.orig/src/tsfile.cpp dvbcut-newffmpeg/src/tsfile.cpp
---- dvbcut.orig/src/tsfile.cpp 2007-03-30 22:54:44.000000000 +0200
-+++ dvbcut-newffmpeg/src/tsfile.cpp 2007-03-30 22:55:19.000000000 +0200
-@@ -78,7 +78,7 @@
- stream *S=&s[audiostream(audiostreams++)];
- S->id=it->second;
- if (it->first==0xbd) {
-- S->dec=&ac3_decoder;
-+ S->dec=&liba52_decoder;
- S->enc=&ac3_encoder;
- S->type=streamtype::ac3audio;
- } else {
-diff -Naur dvbcut.orig/src/tsfile.cpp~ dvbcut-newffmpeg/src/tsfile.cpp~
---- dvbcut.orig/src/tsfile.cpp~ 1970-01-01 01:00:00.000000000 +0100
-+++ dvbcut-newffmpeg/src/tsfile.cpp~ 2007-03-30 22:55:19.000000000 +0200
-@@ -0,0 +1,247 @@
-+/* dvbcut
-+ Copyright (c) 2005 Sven Over <svenover AT svenover.de>
-+
-+ This program is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2 of the License, or
-+ (at your option) any later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program; if not, write to the Free Software
-+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
-+*/
-+
-+#include "port.h"
-+#include "tsfile.h"
-+#include "streamhandle.h"
-+#include <list>
-+#include <utility>
-+
-+#include <ffmpeg/avcodec.h>
-+
-+tsfile::tsfile(const std::string &filename, inbuffer &b, int initial_offset)
-+ : mpgfile(filename, b, initial_offset)
-+ {
-+ int vid=-1;
-+ for(unsigned int i=0;i<8192;++i)
-+ streamnumber[i]=-1;
-+
-+ int inpackets=buf.providedata(buf.getsize(),initialoffset)/TSPACKETSIZE;
-+ if (inpackets>40000) inpackets=40000;
-+
-+ // Find video PID and audio PID(s)
-+ bool apid[8192]={};
-+ std::list<std::pair<int,int> > audios;
-+ for(int i=0;i<inpackets;++i) {
-+ const tspacket &p=((const tspacket*)buf.data())[i];
-+ if (p.transport_error_indicator())
-+ continue; // drop invalid packet --mr
-+ int pid=p.pid();
-+ if (apid[pid])
-+ continue; // already had this pid --mr
-+ int sid=p.sid();
-+ if (sid<0)
-+ continue;
-+ // if ((sid==0xbd || sid==0xbf)&&p.payload_length()>9) // private
stream
-+ // {
-+ // const uint8_t *payload=(const uint8_t*) p.payload();
-+ // if (p.payload_length()>9+payload[8])
-+ // sid=payload[9+payload[8]] | ((sid==0xbd)?0x100:0x200);
-+ // }
-+
-+ if ((sid&0xe0) == 0xc0) // mpeg audio stream
-+ {
-+ audios.push_back(std::pair<int,int>(sid,pid));
-+ apid[pid]=true;
-+ } else if (sid==0xbd) // private stream 1, possibly AC3 audio stream
-+ {
-+ const uint8_t *payload=(const uint8_t*) p.payload();
-+ // if (p.payload_length()>9+payload[8])
-+ // sid=payload[9+payload[8]] | ((sid==0xbd)?0x100:0x200);
-+ if ((p.payload_length()>=9) && (p.payload_length()>=11+payload[8]) &&
-+ (*(uint16_t*)&payload[9+payload[8]]==mbo16(0xb77)) )
-+ {
-+ audios.push_back(std::pair<int,int>(sid,pid));
-+ apid[pid]=true;
-+ }
-+ } else if (vid<0 && ((sid&0xf0)==0xe0)) // mpeg video stream
-+ vid=pid;
-+ }
-+ audios.sort();
-+ for (std::list<std::pair<int,int> >::iterator
it=audios.begin();it!=audios.end();++it) {
-+ streamnumber[it->second]=audiostream(audiostreams);
-+ stream *S=&s[audiostream(audiostreams++)];
-+ S->id=it->second;
-+ if (it->first==0xbd) {
-+ S->dec=&ac3_decoder;
-+ S->enc=&ac3_encoder;
-+ S->type=streamtype::ac3audio;
-+ } else {
-+ S->dec=&mp2_decoder;
-+ S->enc=&mp2_encoder;
-+ S->type=streamtype::mpegaudio;
-+ }
-+ if (audiostreams>=MAXAUDIOSTREAMS)
-+ break;
-+ }
-+
-+ if (vid>=0) {
-+ videostreams=1;
-+ streamnumber[vid]=VIDEOSTREAM;
-+ stream *S=&s[VIDEOSTREAM];
-+ S->id=vid;
-+ S->allocavcc();
-+ S->avcc->codec_type=CODEC_TYPE_VIDEO;
-+ S->avcc->codec_id=CODEC_ID_MPEG2VIDEO;
-+ S->dec=&mpeg2video_decoder;
-+ S->enc=&mpeg2video_encoder;
-+ S->type=streamtype::mpeg2video;
-+ }
-+
-+ for (int i=0;i<audiostreams;++i)
-+ initaudiocodeccontext(i);
-+ }
-+
-+tsfile::~tsfile()
-+ {}
-+
-+int tsfile::streamreader(streamhandle &s)
-+ {
-+ int returnvalue=0;
-+ bool lostsync(false);
-+
-+ for(;;) {
-+ dvbcut_off_t packetpos=s.fileposition;
-+ {
-+ int pd=buf.providedata(TSPACKETSIZE,packetpos);
-+ if (pd<0)
-+ return pd;
-+ if (pd<TSPACKETSIZE)
-+ return returnvalue;
-+ }
-+
-+ const tspacket *p=(const tspacket*) buf.data();
-+
-+ if ((p->data[0]!=TSSYNCBYTE)||lostsync) // we lost sync
-+ {
-+
-+ {
-+ int pd=buf.providedata(4<<10,packetpos);
-+ if (pd<(4<<10))
-+ {
-+ return returnvalue; // end of file, probably
-+ }
-+ }
-+
-+ lostsync=true;
-+ const uint8_t *data = (const uint8_t*) buf.data();
-+ int ts;
-+ for (ts = 0; ts < 2048; ++ts)
-+ {
-+ int pos;
-+ for (pos = ts;pos < 4096;pos += TSPACKETSIZE)
-+ if (data[ pos ] != TSSYNCBYTE)
-+ break;
-+ if (pos >= 4096) // from here, we are in sync again
-+ { lostsync=false;
-+ break;
-+ }
-+ }
-+
-+ s.fileposition+=ts;
-+ continue;
-+ }
-+
-+ s.fileposition+=TSPACKETSIZE;
-+
-+ // Abandon invalid packets --mr
-+ if (p->transport_error_indicator())
-+ continue;
-+ // Abandon packets which have no payload or have invalid adaption field
length
-+ if (p->payload_length()<=0)
-+ continue;
-+ int sn=streamnumber[p->pid()];
-+ if (sn<0)
-+ continue;
-+ streamdata *sd=s.stream[sn];
-+ if (!sd)
-+ continue;
-+
-+ if (p->payload_unit_start_indicator()) {
-+ sd->header=std::string((const char
*)p->payload(),p->payload_length());
-+ sd->nextfilepos=packetpos;
-+ } else if (!sd->header.empty())
-+ sd->header+=std::string((const char
*)p->payload(),p->payload_length());
-+ else {
-+ if (!sd->itemlist().empty()) {
-+ returnvalue += p->payload_length();
-+ sd->append(p->payload(),p->payload_length());
-+ }
-+ continue;
-+ }
-+
-+ if (sd->header.size()<9)
-+ continue;
-+
-+ if (sd->header[0]!=0 || sd->header[1]!=0 || sd->header[2]!=1) {
-+ sd->header.clear();
-+ continue;
-+ }
-+ int sid=(uint8_t)sd->header[3];
-+
-+ unsigned int payloadbegin=9u+(uint8_t)sd->header[8];
-+
-+ if (sd->header.size()<payloadbegin)
-+ continue;
-+ // if (sid==0xbd || sid==0xbf)
-+ // {
-+ // if (sd->header.size()<payloadbegin+1) continue;
-+ // sid=((sid==0xbd)?0x100:0x200)|((unsigned char)
sd->header[payloadbegin]);
-+ // ++payloadbegin;
-+ // }
-+ // else
-+ {
-+ if (sid>=0xe0 && sid<0xf0 && sd->header.size()>=payloadbegin+4)
-+ if (
*(uint32_t*)(sd->header.c_str()+payloadbegin)==mbo32(0x00000001) )
-+ ++payloadbegin;
-+ }
-+
-+ sd->appenditem(filepos_t(sd->nextfilepos,0),
std::string(sd->header,6,payloadbegin-6),
-+ sd->header.c_str()+payloadbegin,
sd->header.size()-payloadbegin);
-+ returnvalue += sd->header.size()-payloadbegin;
-+ sd->header.clear();
-+ return returnvalue;
-+ }
-+ }
-+
-+/// This function probes the data in the given inbuffer for an mpeg
transport stream.
-+/// If it finds a syncbyte (ascii 'G') within the first 8kB which is then
followed by
-+/// another syncbyte every 188 bytes (ts packet size) in the next 2kB, then
-+/// this data is assumed to be a transport stream.
-+/// It returns the buffer offset at which the transport stream starts, or
-1 if
-+/// no transport stream was identified.
-+int tsfile::probe(inbuffer &buf)
-+ {
-+ int latestsync=buf.inbytes()-2048;
-+ if (latestsync>(8<<10))
-+ latestsync=8<<10;
-+
-+ // Find TS syncbyte 'G' within the first 2048 bytes?
-+ const uint8_t *data = (const uint8_t*) buf.data();
-+ int ts;
-+ for (ts = 0; ts < latestsync; ++ts) {
-+ int testupto=ts+2048;
-+ int pos;
-+ for (pos = ts;pos < testupto;pos += TSPACKETSIZE)
-+ if (data[ pos ] != TSSYNCBYTE)
-+ break;
-+ if (pos >= testupto) // this is a MPEG TS file
-+ return ts;
-+ }
-+ return -1;
-+ }



  • [SM-Commit] GIT changes to master grimoire by Florian Franzmann (c061be96e98d43602ced4a6af0ac82ccfa19218b), Florian Franzmann, 11/16/2007

Archive powered by MHonArc 2.6.24.

Top of Page