diff options
44 files changed, 314 insertions, 1134 deletions
diff --git a/contrib/ffmpeg/libavutil/Makefile b/contrib/ffmpeg/libavutil/Makefile index a760401ab..4afcd3b99 100644 --- a/contrib/ffmpeg/libavutil/Makefile +++ b/contrib/ffmpeg/libavutil/Makefile @@ -15,10 +15,11 @@ OBJS= mathematics.o \ random.o \ aes.o \ base64.o \ + sha1.o \ HEADERS = avutil.h common.h mathematics.h integer.h rational.h \ intfloat_readwrite.h md5.h adler32.h log.h fifo.h lzo.h \ - random.h mem.h base64.h + random.h mem.h base64.h sha1.h NAME=avutil LIBVERSION=$(LAVUVERSION) diff --git a/contrib/ffmpeg/libavutil/sha1.c b/contrib/ffmpeg/libavutil/sha1.c index 6c10791f4..7f4fdb767 100644 --- a/contrib/ffmpeg/libavutil/sha1.c +++ b/contrib/ffmpeg/libavutil/sha1.c @@ -11,6 +11,8 @@ typedef struct AVSHA1 { uint32_t state[5]; } AVSHA1; +const int av_sha1_size = sizeof(AVSHA1); + #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ diff --git a/m4/decoders.m4 b/m4/decoders.m4 index 3552ba6a2..5a57045c9 100644 --- a/m4/decoders.m4 +++ b/m4/decoders.m4 @@ -106,9 +106,11 @@ AC_DEFUN([XINE_DECODER_PLUGINS], [ x"no") with_external_ffmpeg=no ;; x"soft") PKG_CHECK_MODULES([FFMPEG], [libavcodec >= 51.20.0], [with_external_ffmpeg=yes], [with_external_ffmpeg=no]) + PKG_CHECK_MODULES([AVUTIL], [libavutil], , [with_external_ffmpeg=no]) ;; x*) PKG_CHECK_MODULES([FFMPEG], [libavcodec >= 51.20.0], [with_external_ffmpeg=yes]) + PKG_CHECK_MODULES([AVUTIL], [libavutil]) ;; esac if test x"$with_external_ffmpeg" != x"no"; then @@ -125,7 +127,25 @@ use internal ffmpeg. *********************************************************************]) else AC_MSG_RESULT([Using included ffmpeg]) + FFMPEG_CFLAGS='$(AVUTIL_CFLAGS) -I$(top_srcdir)/contrib/ffmpeg/libavcodec' + FFMPEG_LIBS='$(top_builddir)/contrib/ffmpeg/libavcodec/libavcodec.a $(AVUTIL_LIBS)' + FFMPEG_DEPS='$(top_builddir)/contrib/ffmpeg/libavcodec/libavcodec.a $(AVUTIL_DEPS)' + FFMPEG_POSTPROC_CFLAGS='$(AVUTIL_CFLAGS) -I$(top_srcdir)/contrib/ffmpeg/libpostproc' + FFMPEG_POSTPROC_LIBS='$(top_builddir)/contrib/ffmpeg/libpostproc/libpostproc.a $(AVUTIL_LIBS)' + FFMPEG_POSTPROC_DEPS='$(top_builddir)/contrib/ffmpeg/libpostproc/libpostproc.a $(AVUTIL_DEPS)' + AVUTIL_CFLAGS='-I$(top_srcdir)/contrib/ffmpeg/libavutil' + AVUTIL_LIBS='$(top_builddir)/contrib/ffmpeg/libavutil/libavutil.a' + AVUTIL_DEPS='$(top_builddir)/contrib/ffmpeg/libavutil/libavutil.a' fi + AC_SUBST([FFMPEG_CFLAGS]) + AC_SUBST([FFMPEG_LIBS]) + AC_SUBST([FFMPEG_DEPS]) + AC_SUBST([FFMPEG_POSTPROC_CFLAGS]) + AC_SUBST([FFMPEG_POSTPROC_LIBS]) + AC_SUBST([FFMPEG_POSTPROC_DEPS]) + AC_SUBST([AVUTIL_CFLAGS]) + AC_SUBST([AVUTIL_LIBS]) + AC_SUBST([AVUTIL_DEPS]) AM_CONDITIONAL([FFMPEG_DISABLE_UNCOMMON_CODECS], [test x"$enable_ffmpeg_uncommon_codecs" = x"no"]) AM_CONDITIONAL([FFMPEG_DISABLE_POPULAR_CODECS], [test x"$enable_ffmpeg_popular_codecs" = x"no"]) AM_CONDITIONAL([WITH_EXTERNAL_FFMPEG], [test x"$with_external_ffmpeg" != x"no"]) diff --git a/misc/Makefile.common b/misc/Makefile.common index edafcea4b..96c981ee3 100644 --- a/misc/Makefile.common +++ b/misc/Makefile.common @@ -14,6 +14,9 @@ $(XINE_LIB): $(top_builddir)/contrib/libxdg-basedir/libxdg-basedir.la: $(MAKE) -C $(top_builddir)/contrib/libxdg-basedir +$(top_builddir)/contrib/ffmpeg/libavutil/libavutil.a: + $(MAKE) -C $(top_builddir)/contrib/ ffmpeg/libavutil/libavutil.a + install-data-hook: @if test $$MAKELEVEL -le 4 ; then \ if test -x "$(top_srcdir)/post-install.sh" ; then \ diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index ba3041d5d..7e4f1db3a 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -59,7 +59,9 @@ xineplug_dmx_avi_la_SOURCES = demux_avi.c xineplug_dmx_avi_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) xineplug_dmx_mpeg_block_la_SOURCES = demux_mpeg_block.c -xineplug_dmx_mpeg_block_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) +xineplug_dmx_mpeg_block_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) +xineplug_dmx_mpeg_block_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_dmx_mpeg_block_la_DEPS = $(AVUTIL_DEPS) xineplug_dmx_mpeg_la_SOURCES = demux_mpeg.c xineplug_dmx_mpeg_la_LIBADD = $(XINE_LIB) @@ -68,10 +70,14 @@ xineplug_dmx_mpeg_elem_la_SOURCES = demux_elem.c xineplug_dmx_mpeg_elem_la_LIBADD = $(XINE_LIB) xineplug_dmx_mpeg_pes_la_SOURCES = demux_mpeg_pes.c -xineplug_dmx_mpeg_pes_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) +xineplug_dmx_mpeg_pes_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) +xineplug_dmx_mpeg_pes_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_dmx_mpeg_pes_la_DEPS = $(AVUTIL_DEPS) xineplug_dmx_mpeg_ts_la_SOURCES = demux_ts.c -xineplug_dmx_mpeg_ts_la_LIBADD = $(XINE_LIB) +xineplug_dmx_mpeg_ts_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) +xineplug_dmx_mpeg_ts_la_LIBADD = $(XINE_LIB) $(AVUTIL_LIBS) +xineplug_dmx_mpeg_ts_la_DEPS = $(AVUTIL_DEPS) xineplug_dmx_qt_la_SOURCES = demux_qt.c xineplug_dmx_qt_la_LIBADD = $(XINE_LIB) $(ZLIB_LIBS) diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 2f7c48d44..e6ae7df8d 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -31,6 +31,9 @@ #include <unistd.h> #include <string.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "demux_mpeg_block" #define LOG_VERBOSE /* @@ -70,7 +73,6 @@ typedef struct demux_mpeg_block_s { char cur_mrl[256]; uint8_t *scratch; - void *scratch_base; int64_t nav_last_end_pts; int64_t nav_last_start_pts; @@ -1176,7 +1178,7 @@ static void demux_mpeg_block_dispose (demux_plugin_t *this_gen) { demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen; - free (this->scratch_base); + av_free (this->scratch); free (this); } @@ -1385,7 +1387,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.get_optional_data = demux_mpeg_block_get_optional_data; this->demux_plugin.demux_class = class_gen; - this->scratch = xine_xmalloc_aligned (512, 4096, &this->scratch_base); + this->scratch = av_mallocz(4096); this->status = DEMUX_FINISHED; lprintf ("open_plugin:detection_method=%d\n", @@ -1397,7 +1399,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* use demux_mpeg for non-block devices */ if (!(input->get_capabilities(input) & INPUT_CAP_BLOCK)) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1411,7 +1413,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->blocksize = demux_mpeg_detect_blocksize( this, input ); if (!this->blocksize) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1424,7 +1426,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str || (this->scratch[2] != 0x01) || (this->scratch[3] != 0xba)) { lprintf("open_plugin:scratch failed\n"); - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1432,7 +1434,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* if it's a file then make sure it's mpeg-2 */ if ( !input->get_blocksize(input) && ((this->scratch[4]>>4) != 4) ) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1446,7 +1448,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; } } - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1467,7 +1469,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str ending = strrchr(mrl, '.'); if (!ending) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1477,7 +1479,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->blocksize = 2048; demux_mpeg_block_accept_input(this, input); } else { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1495,7 +1497,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->blocksize = demux_mpeg_detect_blocksize( this, input ); if (!this->blocksize) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1505,7 +1507,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; default: - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 1ec5b8365..64fe764a4 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -35,6 +35,9 @@ #include <unistd.h> #include <string.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "demux_mpeg_pes" #define LOG_VERBOSE /* @@ -73,7 +76,6 @@ typedef struct demux_mpeg_pes_s { char cur_mrl[256]; uint8_t *scratch; - void *scratch_base; int64_t nav_last_end_pts; int64_t nav_last_start_pts; @@ -1441,7 +1443,7 @@ static void demux_mpeg_pes_dispose (demux_plugin_t *this_gen) { demux_mpeg_pes_t *this = (demux_mpeg_pes_t *) this_gen; - free (this->scratch_base); + av_free (this->scratch); free (this); } @@ -1627,7 +1629,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.get_optional_data = demux_mpeg_pes_get_optional_data; this->demux_plugin.demux_class = class_gen; - this->scratch = xine_xmalloc_aligned (512, 4096, &this->scratch_base); + this->scratch = av_mallocz(4096); this->status = DEMUX_FINISHED; /* Don't start demuxing stream until we see a program_stream_pack_header */ /* We need to system header in order to identify is the stream is mpeg1 or mpeg2. */ @@ -1646,7 +1648,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* use demux_mpeg_block for block devices */ if ((input->get_capabilities(input) & INPUT_CAP_BLOCK)) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1662,7 +1664,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str || (this->preview_data[2] != 0x01) ) { lprintf("open_plugin:preview_data failed\n"); - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1673,7 +1675,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case 0xbd ... 0xbe: break; default: - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1695,7 +1697,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str || (this->scratch[2] != 0x01) ) { lprintf("open_plugin:scratch failed\n"); - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1706,7 +1708,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case 0xbd ... 0xbe: break; default: - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1720,7 +1722,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str } } - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1736,7 +1738,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; default: - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 5b671f3c4..1f760203e 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -141,6 +141,9 @@ #include <unistd.h> #include <string.h> +/* libavutil from FFmpeg */ +#include <crc.h> + #define LOG_MODULE "demux_ts" #define LOG_VERBOSE /* @@ -573,7 +576,10 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, } /* Check CRC. */ - calc_crc32 = _x_compute_crc32 (pkt+5, section_length+3-4, 0xffffffff); + if ( ! *av_crc04C11DB7 ) + av_crc_init(av_crc04C11DB7, 0, 32, AV_CRC_32_IEEE, sizeof(AVCRC)*257); + + calc_crc32 = av_crc(av_crc04C11DB7, 0xffffffff, pkt+5, section_length+3-4); if (crc32 != calc_crc32) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PAT with invalid CRC32: packet_crc32: %.8x calc_crc32: %.8x\n", @@ -1179,8 +1185,12 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num crc32 |= (uint32_t) this->pmt[program_count][section_length+3-1] ; /* Check CRC. */ - calc_crc32 = _x_compute_crc32 (this->pmt[program_count], - section_length+3-4, 0xffffffff); + if ( ! *av_crc04C11DB7 ) + av_crc_init(av_crc04C11DB7, 0, 32, AV_CRC_32_IEEE, sizeof(AVCRC)*257); + + calc_crc32 = av_crc(av_crc04C11DB7, 0xffffffff, + this->pmt[program_count], section_length+3-4); + if (crc32 != calc_crc32) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PMT with invalid CRC32: packet_crc32: %#.8x calc_crc32: %#.8x\n", diff --git a/src/dxr3/Makefile.am b/src/dxr3/Makefile.am index f53a2d081..d494f5470 100644 --- a/src/dxr3/Makefile.am +++ b/src/dxr3/Makefile.am @@ -43,4 +43,6 @@ xineplug_vo_out_dxr3_la_SOURCES = \ dxr3_scr.c \ video_out_dxr3.c -xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB) $(LTLIBINTL) $(DYNAMIC_LD_LIBS) -lm +xineplug_vo_out_dxr3_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) +xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB) $(LTLIBINTL) $(DYNAMIC_LD_LIBS) $(AVUTIL_LIBS) -lm +xineplug_vo_out_dxr3_la_DEPS = $(AVUTIL_DEPS)
\ No newline at end of file diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c index 0c59b0b93..97971ebbc 100644 --- a/src/dxr3/dxr3_mpeg_encoders.c +++ b/src/dxr3/dxr3_mpeg_encoders.c @@ -44,6 +44,9 @@ #include <math.h> #include <unistd.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "dxr3_mpeg_encoder" /* #define LOG_VERBOSE */ /* #define LOG */ @@ -99,7 +102,7 @@ typedef struct { char *buffer; /* temporary buffer for mpeg data */ /* temporary buffer for YUY2->YV12 conversion */ uint8_t *out[3]; /* aligned buffer for YV12 data */ - uint8_t *buf; /* unaligned YV12 buffer */ + uint8_t *buf; /* base address of YV12 buffer */ } fame_data_t; /* helper function */ @@ -337,8 +340,7 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) fame_parameters_t init_fp = FAME_PARAMETERS_INITIALIZER; double fps; - if (this->buf) free(this->buf); - this->buf = 0; + av_freep(&this->buf); this->out[0] = this->out[1] = this->out[2] = 0; /* if YUY2 and dimensions changed, we need to re-allocate the @@ -346,8 +348,7 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { int image_size = frame->vo_frame.width * frame->oheight; - this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2, - (void *)&this->buf); + this->out[0] = this->buf = av_mallocz(image_size * 3/2); this->out[1] = this->out[0] + image_size; this->out[2] = this->out[1] + image_size/4; diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index b073e6f63..a421644d4 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.c @@ -575,7 +575,7 @@ static void dxr3_frame_dispose(vo_frame_t *frame_gen) { dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; - if (frame->mem) free(frame->mem); + av_free(frame->mem); pthread_mutex_destroy(&frame_gen->mutex); free(frame); } @@ -615,12 +615,9 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge frame->aspect = XINE_VO_ASPECT_ANAMORPHIC; frame->pan_scan = flags & VO_PAN_SCAN_FLAG; - if (frame->mem) { - free(frame->mem); - frame->mem = NULL; - frame->real_base[0] = frame->real_base[1] = frame->real_base[2] = NULL; - frame_gen->base[0] = frame_gen->base[1] = frame_gen->base[2] = NULL; - } + av_freep(&frame->mem); + frame->real_base[0] = frame->real_base[1] = frame->real_base[2] = NULL; + frame_gen->base[0] = frame_gen->base[1] = frame_gen->base[2] = NULL; return; } @@ -705,10 +702,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* if dimensions changed, we need to re-allocate frame memory */ if ((frame->vo_frame.width != width) || (frame->vo_frame.height != height) || (frame->oheight != oheight) || (frame->vo_frame.format != format)) { - if (frame->mem) { - free (frame->mem); - frame->mem = NULL; - } + av_freep(&frame->mem); if (format == XINE_IMGFMT_YUY2) { int i, image_size; @@ -719,8 +713,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* planar format, only base[0] */ /* add one extra line for field swap stuff */ - frame->real_base[0] = xine_xmalloc_aligned(16, image_size + frame->vo_frame.pitches[0], - &frame->mem); + frame->real_base[0] = frame->mem = av_mallocz(image_size + frame->vo_frame.pitches[0]); /* don't use first line */ frame->real_base[0] += frame->vo_frame.pitches[0]; @@ -747,8 +740,8 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge image_size_v = frame->vo_frame.pitches[2] * ((oheight + 1) / 2); /* add one extra line for field swap stuff */ - frame->real_base[0] = xine_xmalloc_aligned(16, image_size_y + frame->vo_frame.pitches[0] + - image_size_u + image_size_v, &frame->mem); + frame->real_base[0] = frame->mem = av_mallocz(image_size_y + frame->vo_frame.pitches[0] + + image_size_u + image_size_v); /* don't use first line */ frame->real_base[0] += frame->vo_frame.pitches[0]; diff --git a/src/input/Makefile.am b/src/input/Makefile.am index ed32ad7c5..25541cc2c 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -106,17 +106,17 @@ xineplug_inp_pnm_la_SOURCES = input_pnm.c net_buf_ctrl.c pnm.c xineplug_inp_pnm_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_inp_dvb_la_SOURCES = input_dvb.c net_buf_ctrl.c -xineplug_inp_dvb_la_DEPS = $(XDG_BASEDIR_DEPS) -xineplug_inp_dvb_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(XDG_BASEDIR_LIBS) -xineplug_inp_dvb_la_CPPFLAGS = $(AM_CPPFLAGS) $(XDG_BASEDIR_CPPFLAGS) +xineplug_inp_dvb_la_DEPS = $(XDG_BASEDIR_DEPS) $(AVUTIL_DEPS) +xineplug_inp_dvb_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(XDG_BASEDIR_LIBS) $(AVUTIL_LIBS) +xineplug_inp_dvb_la_CPPFLAGS = $(AM_CPPFLAGS) $(XDG_BASEDIR_CPPFLAGS) $(AVUTIL_CFLAGS) xineplug_inp_rtsp_la_SOURCES = input_rtsp.c net_buf_ctrl.c xineplug_inp_rtsp_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) libreal/libreal.la librtsp/librtsp.la -xineplug_inp_cdda_la_SOURCES = input_cdda.c media_helper.c sha1.c sha1.h base64.c base64.h -xineplug_inp_cdda_la_DEPS = $(XDG_BASEDIR_DEPS) -xineplug_inp_cdda_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(XDG_BASEDIR_LIBS) -xineplug_inp_cdda_la_CPPFLAGS = $(AM_CPPFLAGS) $(XDG_BASEDIR_CPPFLAGS) +xineplug_inp_cdda_la_SOURCES = input_cdda.c media_helper.c +xineplug_inp_cdda_la_DEPS = $(XDG_BASEDIR_DEPS) $(AVUTIL_DEPS) +xineplug_inp_cdda_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(XDG_BASEDIR_LIBS) $(AVUTIL_LIBS) +xineplug_inp_cdda_la_CPPFLAGS = $(AM_CPPFLAGS) $(XDG_BASEDIR_CPPFLAGS) $(AVUTIL_CFLAGS) xineplug_inp_v4l_la_SOURCES = input_v4l.c xineplug_inp_v4l_la_LIBADD = $(ALSA_LIBS) $(XINE_LIB) $(LTLIBINTL) diff --git a/src/input/base64.c b/src/input/base64.c deleted file mode 100644 index ffb039802..000000000 --- a/src/input/base64.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2000 Robert Kaye - * - * This file is part of xine, a free video player. - * - * xine 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. - * - * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * Base64 encoding modified for Musicbrainz - * relicensed under the GNU General Public License for use in xine-lib - */ -/* -------------------------------------------------------------------------- - - MusicBrainz -- The Internet music metadatabase - - Copyright (C) 2000 Robert Kaye - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - -----------------------------------------------------------------------------*/ -/* - * Program: RFC-822 routines (originally from SMTP) - * - * Author: Mark Crispin - * Networks and Distributed Computing - * Computing & Communications - * University of Washington - * Administration Building, AG-44 - * Seattle, WA 98195 - * Internet: MRC@CAC.Washington.EDU - * - * Date: 27 July 1988 - * Last Edited: 10 September 1998 - * - * Sponsorship: The original version of this work was developed in the - * Symbolic Systems Resources Group of the Knowledge Systems - * Laboratory at Stanford University in 1987-88, and was funded - * by the Biomedical Research Technology Program of the National - * Institutes of Health under grant number RR-00785. - * - * Original version Copyright 1988 by The Leland Stanford Junior University - * Copyright 1998 by the University of Washington - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notices appear in all copies and that both the - * above copyright notices and this permission notice appear in supporting - * documentation, and that the name of the University of Washington or The - * Leland Stanford Junior University not be used in advertising or publicity - * pertaining to distribution of the software without specific, written prior - * permission. This software is made available "as is", and - * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY - * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE, - * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF - * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <ctype.h> -#include <stdio.h> -#include <time.h> -#include <stdlib.h> - -#include "base64.h" - - -/* NOTE: This is not true RFC822 anymore. The use of the characters - '/', '+', and '=' is no bueno when the ID will be used as part of a URL. - '_', '.', and '-' have been used instead -*/ - -/* Convert binary contents to BASE64 - * Accepts: source - * length of source - * pointer to return destination length - * Returns: destination as BASE64 - */ - -unsigned char *rfc822_binary (void *src,unsigned long srcl,unsigned long *len) -{ - unsigned char *ret,*d; - unsigned char *s = (unsigned char *) src; - char *v = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; - unsigned long i = ((srcl + 2) / 3) * 4; - *len = i += 2 * ((i / 60) + 1); - d = ret = (unsigned char *) malloc ((size_t) ++i); - for (i = 0; srcl; s += 3) { /* process tuplets */ - *d++ = v[s[0] >> 2]; /* byte 1: high 6 bits (1) */ - /* byte 2: low 2 bits (1), high 4 bits (2) */ - *d++ = v[((s[0] << 4) + (--srcl ? (s[1] >> 4) : 0)) & 0x3f]; - /* byte 3: low 4 bits (2), high 2 bits (3) */ - *d++ = srcl ? v[((s[1] << 2) + (--srcl ? (s[2] >> 6) : 0)) & 0x3f] : '-'; - /* byte 4: low 6 bits (3) */ - *d++ = srcl ? v[s[2] & 0x3f] : '-'; - if (srcl) srcl--; /* count third character if processed */ - if ((++i) == 15) { /* output 60 characters? */ - i = 0; /* restart line break count, insert CRLF */ - *d++ = '\015'; *d++ = '\012'; - } - } - *d = '\0'; /* tie off string */ - - return ret; /* return the resulting string */ -} diff --git a/src/input/base64.h b/src/input/base64.h deleted file mode 100644 index 5cc94d7f0..000000000 --- a/src/input/base64.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2000 Robert Kaye - * - * This file is part of xine, a free video player. - * - * xine 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. - * - * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * Base64 encoding modified for Musicbrainz - * relicensed under the GNU General Public License for use in xine-lib - */ -/* -------------------------------------------------------------------------- - - MusicBrainz -- The Internet music metadatabase - - Copyright (C) 2000 Robert Kaye - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - -----------------------------------------------------------------------------*/ -/* - * Program: RFC-822 routines (originally from SMTP) - * - * Author: Mark Crispin - * Networks and Distributed Computing - * Computing & Communications - * University of Washington - * Administration Building, AG-44 - * Seattle, WA 98195 - * Internet: MRC@CAC.Washington.EDU - * - * Date: 27 July 1988 - * Last Edited: 10 September 1998 - * - * Sponsorship: The original version of this work was developed in the - * Symbolic Systems Resources Group of the Knowledge Systems - * Laboratory at Stanford University in 1987-88, and was funded - * by the Biomedical Research Technology Program of the National - * Institutes of Health under grant number RR-00785. - * - * Original version Copyright 1988 by The Leland Stanford Junior University - * Copyright 1998 by the University of Washington - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notices appear in all copies and that both the - * above copyright notices and this permission notice appear in supporting - * documentation, and that the name of the University of Washington or The - * Leland Stanford Junior University not be used in advertising or publicity - * pertaining to distribution of the software without specific, written prior - * permission. This software is made available "as is", and - * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY - * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE, - * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF - * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef BASE64_H -#define BASE64_H - -unsigned char *rfc822_binary (void *src,unsigned long srcl,unsigned long *len); - -#endif diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index df4617e22..a1e0b473e 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -58,14 +58,16 @@ #include <basedir.h> +/* libavutil from FFmpeg */ +#include <base64.h> +#include <sha1.h> + #define LOG_MODULE "input_cdda" #define LOG_VERBOSE /* #define LOG */ -#include "sha1.h" -#include "base64.h" #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" @@ -1930,39 +1932,42 @@ static unsigned long _cdda_calc_cddb_id(cdda_input_plugin_t *this) { */ static void _cdda_cdindex(cdda_input_plugin_t *this, cdrom_toc *toc) { char temp[10]; - SHA_INFO sha; - unsigned char digest[33], *base64; + struct AVSHA1 *sha_ctx = malloc(av_sha1_size); + unsigned char digest[20]; + /* We're going to encode 20 bytes in base64, which will become + * 6 * 32 / 8 = 24 bytes. + * libavutil's base64 encoding functions, though, wants the size to + * be at least len * 4 / 3 + 12, so let's use 39. + */ + char base64[39]; int i; - unsigned long size; - sha_init(&sha); + av_sha1_init(sha_ctx); sprintf(temp, "%02X", toc->first_track); - sha_update(&sha, (unsigned char*) temp, strlen(temp)); + av_sha1_update(sha_ctx, (unsigned char*) temp, strlen(temp)); sprintf(temp, "%02X", toc->last_track - toc->ignore_last_track); - sha_update(&sha, (unsigned char*) temp, strlen(temp)); + av_sha1_update(sha_ctx, (unsigned char*) temp, strlen(temp)); sprintf (temp, "%08X", toc->leadout_track.first_frame);// + 150); - sha_update(&sha, (unsigned char*) temp, strlen(temp)); + av_sha1_update(sha_ctx, (unsigned char*) temp, strlen(temp)); for (i = toc->first_track; i <= toc->last_track - toc->ignore_last_track; i++) { sprintf(temp, "%08X", toc->toc_entries[i - 1].first_frame); - sha_update(&sha, (unsigned char*) temp, strlen(temp)); + av_sha1_update(sha_ctx, (unsigned char*) temp, strlen(temp)); } for (i = toc->last_track - toc->ignore_last_track + 1; i < 100; i++) { - sha_update(&sha, (unsigned char*) temp, strlen(temp)); + av_sha1_update(sha_ctx, (unsigned char*) temp, strlen(temp)); } - sha_final(digest, &sha); + av_sha1_final(sha_ctx, digest); + free(sha_ctx); - base64 = rfc822_binary(digest, 20, &size); - base64[size] = 0; + av_base64_encode(base64, 39, digest, 20); _x_meta_info_set_utf8(this->stream, XINE_META_INFO_CDINDEX_DISCID, base64); - - free (base64); } /* diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 1151d9a81..9a40b1996 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -100,6 +100,9 @@ #endif #include <ctype.h> +/* libavutil from FFmpeg */ +#include <crc.h> + /* XDG */ #include <basedir.h> @@ -2445,6 +2448,9 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin originalPkt+=data_offset; if (pid == 0 && sync_byte==0x47) { + if ( ! *av_crc04C11DB7 ) + av_crc_init(av_crc04C11DB7, 0, 32, AV_CRC_32_IEEE, sizeof(AVCRC)*257); + unsigned long crc; originalPkt[3]=13; /* section length including CRC - first 3 bytes */ @@ -2456,7 +2462,7 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin originalPkt[11]=(this->channels[this->channel].pmtpid >> 8) & 0xff; originalPkt[12]=this->channels[this->channel].pmtpid & 0xff; - crc= _x_compute_crc32 (originalPkt+1, 12, 0xffffffff); + crc = av_crc(av_crc04C11DB7, 0xffffffff, originalPkt+1, 12); originalPkt[13]=(crc>>24) & 0xff; originalPkt[14]=(crc>>16) & 0xff; diff --git a/src/input/libreal/Makefile.am b/src/input/libreal/Makefile.am index bd97a7548..74ac41366 100644 --- a/src/input/libreal/Makefile.am +++ b/src/input/libreal/Makefile.am @@ -1,10 +1,12 @@ include $(top_srcdir)/misc/Makefile.common AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) -AM_CPPFLAGS = -I$(top_srcdir)/src/input/librtsp +AM_CPPFLAGS = -I$(top_srcdir)/src/input/librtsp $(AVUTIL_CFLAGS) noinst_HEADERS = real.h asmrp.h rmff.h sdpplin.h noinst_LTLIBRARIES = libreal.la libreal_la_SOURCES = real.c asmrp.c rmff.c sdpplin.c +libreal_la_LIBADD = $(AVUTIL_LIBS) +libreal_la_DEPS = $(AVUTIL_DEPS) diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index c62b6bbc1..3bc5af608 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -31,65 +31,8 @@ #include "sdpplin.h" #include "xineutils.h" -/* - * Decodes base64 strings (based upon b64 package) - */ - -static char *b64_decode(const char *in, char *out, int *size) -{ - char dtable[256]; /* Encode / decode table */ - int i,k; - size_t j; - - for (i = 0; i < 255; i++) { - dtable[i] = 0x80; - } - for (i = 'A'; i <= 'Z'; i++) { - dtable[i] = 0 + (i - 'A'); - } - for (i = 'a'; i <= 'z'; i++) { - dtable[i] = 26 + (i - 'a'); - } - for (i = '0'; i <= '9'; i++) { - dtable[i] = 52 + (i - '0'); - } - dtable['+'] = 62; - dtable['/'] = 63; - dtable['='] = 0; - - k=0; - - /*CONSTANTCONDITION*/ - for (j=0; j<strlen(in); j+=4) - { - char a[4], b[4]; - - for (i = 0; i < 4; i++) { - int c = in[i+j]; - - if (dtable[c] & 0x80) { - fprintf(stderr, "Illegal character '%c' in input.\n", c); - *size = 0; - return NULL; - } - a[i] = (char) c; - b[i] = (char) dtable[c]; - } - xine_buffer_ensure_size(out, k+3); - out[k++] = (b[0] << 2) | (b[1] >> 4); - out[k++] = (b[1] << 4) | (b[2] >> 2); - out[k++] = (b[2] << 6) | b[3]; - i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3); - if (i < 3) { - out[k]=0; - *size=k; - return out; - } - } - out[k]=0; - *size=k; - return out; -} +/* libavutil from FFmpeg */ +#include <base64.h> static char *nl(char *data) { @@ -124,7 +67,6 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { sdpplin_stream_t *desc = xine_xmalloc(sizeof(sdpplin_stream_t)); char *buf=xine_buffer_init(32); - char *decoded=xine_buffer_init(32); int handled; if (filter(*data, "m=", &buf)) { @@ -197,8 +139,9 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { } if(filter(*data,"a=OpaqueData:buffer;",&buf)) { - decoded = b64_decode(buf, decoded, &(desc->mlti_data_size)); - if ( decoded != NULL ) { + uint8_t decoded[32]; + desc->mlti_data_size = av_base64_decode(decoded, buf, 32); + if ( desc->mlti_data_size > 0 ) { desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size); memcpy(desc->mlti_data, decoded, desc->mlti_data_size); handled=1; @@ -225,7 +168,6 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { } xine_buffer_free(buf); - xine_buffer_free(decoded); return desc; } @@ -235,9 +177,9 @@ sdpplin_t *sdpplin_parse(char *data) { sdpplin_t *desc = xine_xmalloc(sizeof(sdpplin_t)); sdpplin_stream_t *stream; char *buf=xine_buffer_init(32); - char *decoded=xine_buffer_init(32); int handled; int len; + uint8_t decoded[32]; desc->stream = NULL; @@ -257,8 +199,8 @@ sdpplin_t *sdpplin_parse(char *data) { } if(filter(data,"a=Title:buffer;",&buf)) { - decoded=b64_decode(buf, decoded, &len); - if ( decoded != NULL ) { + len = av_base64_decode(decoded, buf, 32); + if ( len > 0 ) { desc->title=strdup(decoded); handled=1; data=nl(data); @@ -266,8 +208,8 @@ sdpplin_t *sdpplin_parse(char *data) { } if(filter(data,"a=Author:buffer;",&buf)) { - decoded=b64_decode(buf, decoded, &len); - if ( decoded != NULL ) { + len = av_base64_decode(decoded, buf, 32); + if ( len > 0 ) { desc->author=strdup(decoded); handled=1; data=nl(data); @@ -275,8 +217,8 @@ sdpplin_t *sdpplin_parse(char *data) { } if(filter(data,"a=Copyright:buffer;",&buf)) { - decoded=b64_decode(buf, decoded, &len); - if ( decoded != NULL ) { + len = av_base64_decode(decoded, buf, 32); + if ( len > 0 ) { desc->copyright=strdup(decoded); handled=1; data=nl(data); @@ -284,8 +226,8 @@ sdpplin_t *sdpplin_parse(char *data) { } if(filter(data,"a=Abstract:buffer;",&buf)) { - decoded=b64_decode(buf, decoded, &len); - if ( decoded != NULL ) { + len = av_base64_decode(decoded, buf, 32); + if ( len > 0 ) { desc->abstract=strdup(decoded); handled=1; data=nl(data); @@ -317,7 +259,6 @@ sdpplin_t *sdpplin_parse(char *data) { } xine_buffer_free(buf); - xine_buffer_free(decoded); return desc; } diff --git a/src/input/sha1.c b/src/input/sha1.c deleted file mode 100644 index b70e50d5f..000000000 --- a/src/input/sha1.c +++ /dev/null @@ -1,327 +0,0 @@ -/* (PD) 2001 The Bitzi Corporation - * Please see file COPYING or http://bitzi.com/publicdomain - * for more info. - * - * NIST Secure Hash Algorithm - * heavily modified by Uwe Hollerbach <uh@alumni.caltech edu> - * from Peter C. Gutmann's implementation as found in - * Applied Cryptography by Bruce Schneier - * Further modifications to include the "UNRAVEL" stuff, below - * - * This code is in the public domain - */ - -#include <string.h> -#include "sha1.h" - -/* UNRAVEL should be fastest & biggest */ -/* UNROLL_LOOPS should be just as big, but slightly slower */ -/* both undefined should be smallest and slowest */ - -#define UNRAVEL -/* #define UNROLL_LOOPS */ - -/* SHA f()-functions */ - -#define f1(x,y,z) ((x & y) | (~x & z)) -#define f2(x,y,z) (x ^ y ^ z) -#define f3(x,y,z) ((x & y) | (x & z) | (y & z)) -#define f4(x,y,z) (x ^ y ^ z) - -/* SHA constants */ - -#define CONST1 0x5a827999L -#define CONST2 0x6ed9eba1L -#define CONST3 0x8f1bbcdcL -#define CONST4 0xca62c1d6L - -/* truncate to 32 bits -- should be a null op on 32-bit machines */ - -#define T32(x) ((x) & 0xffffffffL) - -/* 32-bit rotate */ - -#define R32(x,n) T32(((x << n) | (x >> (32 - n)))) - -/* the generic case, for when the overall rotation is not unraveled */ - -#define FG(n) \ - T = T32(R32(A,5) + f##n(B,C,D) + E + *WP++ + CONST##n); \ - E = D; D = C; C = R32(B,30); B = A; A = T - -/* specific cases, for when the overall rotation is unraveled */ - -#define FA(n) \ - T = T32(R32(A,5) + f##n(B,C,D) + E + *WP++ + CONST##n); B = R32(B,30) - -#define FB(n) \ - E = T32(R32(T,5) + f##n(A,B,C) + D + *WP++ + CONST##n); A = R32(A,30) - -#define FC(n) \ - D = T32(R32(E,5) + f##n(T,A,B) + C + *WP++ + CONST##n); T = R32(T,30) - -#define FD(n) \ - C = T32(R32(D,5) + f##n(E,T,A) + B + *WP++ + CONST##n); E = R32(E,30) - -#define FE(n) \ - B = T32(R32(C,5) + f##n(D,E,T) + A + *WP++ + CONST##n); D = R32(D,30) - -#define FT(n) \ - A = T32(R32(B,5) + f##n(C,D,E) + T + *WP++ + CONST##n); C = R32(C,30) - -/* do SHA transformation */ - -static void sha_transform(SHA_INFO *sha_info) -{ - int i; - SHA_BYTE *dp; - SHA_LONG T, A, B, C, D, E, W[80], *WP; - - dp = sha_info->data; - -/* -the following makes sure that at least one code block below is -traversed or an error is reported, without the necessity for nested -preprocessor if/else/endif blocks, which are a great pain in the -nether regions of the anatomy... -*/ -#undef SWAP_DONE - -#if (SHA_BYTE_ORDER == 1234) -#define SWAP_DONE - for (i = 0; i < 16; ++i) { - T = *((SHA_LONG *) dp); - dp += 4; - W[i] = ((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) | - ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff); - } -#endif /* SHA_BYTE_ORDER == 1234 */ - -#if (SHA_BYTE_ORDER == 4321) -#define SWAP_DONE - for (i = 0; i < 16; ++i) { - T = *((SHA_LONG *) dp); - dp += 4; - W[i] = T32(T); - } -#endif /* SHA_BYTE_ORDER == 4321 */ - -#if (SHA_BYTE_ORDER == 12345678) -#define SWAP_DONE - for (i = 0; i < 16; i += 2) { - T = *((SHA_LONG *) dp); - dp += 8; - W[i] = ((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) | - ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff); - T >>= 32; - W[i+1] = ((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) | - ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff); - } -#endif /* SHA_BYTE_ORDER == 12345678 */ - -#if (SHA_BYTE_ORDER == 87654321) -#define SWAP_DONE - for (i = 0; i < 16; i += 2) { - T = *((SHA_LONG *) dp); - dp += 8; - W[i] = T32(T >> 32); - W[i+1] = T32(T); - } -#endif /* SHA_BYTE_ORDER == 87654321 */ - -#ifndef SWAP_DONE -#error Unknown byte order -- you need to add code here -#endif /* SWAP_DONE */ - - for (i = 16; i < 80; ++i) { - W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]; -#if (SHA_VERSION == 1) - W[i] = R32(W[i], 1); -#endif /* SHA_VERSION */ - } - A = sha_info->digest[0]; - B = sha_info->digest[1]; - C = sha_info->digest[2]; - D = sha_info->digest[3]; - E = sha_info->digest[4]; - WP = W; -#ifdef UNRAVEL - FA(1); FB(1); FC(1); FD(1); FE(1); FT(1); FA(1); FB(1); FC(1); FD(1); - FE(1); FT(1); FA(1); FB(1); FC(1); FD(1); FE(1); FT(1); FA(1); FB(1); - FC(2); FD(2); FE(2); FT(2); FA(2); FB(2); FC(2); FD(2); FE(2); FT(2); - FA(2); FB(2); FC(2); FD(2); FE(2); FT(2); FA(2); FB(2); FC(2); FD(2); - FE(3); FT(3); FA(3); FB(3); FC(3); FD(3); FE(3); FT(3); FA(3); FB(3); - FC(3); FD(3); FE(3); FT(3); FA(3); FB(3); FC(3); FD(3); FE(3); FT(3); - FA(4); FB(4); FC(4); FD(4); FE(4); FT(4); FA(4); FB(4); FC(4); FD(4); - FE(4); FT(4); FA(4); FB(4); FC(4); FD(4); FE(4); FT(4); FA(4); FB(4); - sha_info->digest[0] = T32(sha_info->digest[0] + E); - sha_info->digest[1] = T32(sha_info->digest[1] + T); - sha_info->digest[2] = T32(sha_info->digest[2] + A); - sha_info->digest[3] = T32(sha_info->digest[3] + B); - sha_info->digest[4] = T32(sha_info->digest[4] + C); -#else /* !UNRAVEL */ -#ifdef UNROLL_LOOPS - FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); - FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); - FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); - FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); - FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); - FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); - FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); - FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); -#else /* !UNROLL_LOOPS */ - for (i = 0; i < 20; ++i) { FG(1); } - for (i = 20; i < 40; ++i) { FG(2); } - for (i = 40; i < 60; ++i) { FG(3); } - for (i = 60; i < 80; ++i) { FG(4); } -#endif /* !UNROLL_LOOPS */ - sha_info->digest[0] = T32(sha_info->digest[0] + A); - sha_info->digest[1] = T32(sha_info->digest[1] + B); - sha_info->digest[2] = T32(sha_info->digest[2] + C); - sha_info->digest[3] = T32(sha_info->digest[3] + D); - sha_info->digest[4] = T32(sha_info->digest[4] + E); -#endif /* !UNRAVEL */ -} - -/* initialize the SHA digest */ - -void sha_init(SHA_INFO *sha_info) -{ - sha_info->digest[0] = 0x67452301L; - sha_info->digest[1] = 0xefcdab89L; - sha_info->digest[2] = 0x98badcfeL; - sha_info->digest[3] = 0x10325476L; - sha_info->digest[4] = 0xc3d2e1f0L; - sha_info->count_lo = 0L; - sha_info->count_hi = 0L; - sha_info->local = 0; -} - -/* update the SHA digest */ - -void sha_update(SHA_INFO *sha_info, SHA_BYTE *buffer, int count) -{ - int i; - SHA_LONG clo; - - clo = T32(sha_info->count_lo + ((SHA_LONG) count << 3)); - if (clo < sha_info->count_lo) { - ++sha_info->count_hi; - } - sha_info->count_lo = clo; - sha_info->count_hi += (SHA_LONG) count >> 29; - if (sha_info->local) { - i = SHA_BLOCKSIZE - sha_info->local; - if (i > count) { - i = count; - } - memcpy(((SHA_BYTE *) sha_info->data) + sha_info->local, buffer, i); - count -= i; - buffer += i; - sha_info->local += i; - if (sha_info->local == SHA_BLOCKSIZE) { - sha_transform(sha_info); - } else { - return; - } - } - while (count >= SHA_BLOCKSIZE) { - memcpy(sha_info->data, buffer, SHA_BLOCKSIZE); - buffer += SHA_BLOCKSIZE; - count -= SHA_BLOCKSIZE; - sha_transform(sha_info); - } - memcpy(sha_info->data, buffer, count); - sha_info->local = count; -} - -/* finish computing the SHA digest */ - -void sha_final(unsigned char digest[20], SHA_INFO *sha_info) -{ - int count; - SHA_LONG lo_bit_count, hi_bit_count; - - lo_bit_count = sha_info->count_lo; - hi_bit_count = sha_info->count_hi; - count = (int) ((lo_bit_count >> 3) & 0x3f); - ((SHA_BYTE *) sha_info->data)[count++] = 0x80; - if (count > SHA_BLOCKSIZE - 8) { - memset(((SHA_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count); - sha_transform(sha_info); - memset((SHA_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8); - } else { - memset(((SHA_BYTE *) sha_info->data) + count, 0, - SHA_BLOCKSIZE - 8 - count); - } - sha_info->data[56] = (unsigned char) ((hi_bit_count >> 24) & 0xff); - sha_info->data[57] = (unsigned char) ((hi_bit_count >> 16) & 0xff); - sha_info->data[58] = (unsigned char) ((hi_bit_count >> 8) & 0xff); - sha_info->data[59] = (unsigned char) ((hi_bit_count >> 0) & 0xff); - sha_info->data[60] = (unsigned char) ((lo_bit_count >> 24) & 0xff); - sha_info->data[61] = (unsigned char) ((lo_bit_count >> 16) & 0xff); - sha_info->data[62] = (unsigned char) ((lo_bit_count >> 8) & 0xff); - sha_info->data[63] = (unsigned char) ((lo_bit_count >> 0) & 0xff); - sha_transform(sha_info); - digest[ 0] = (unsigned char) ((sha_info->digest[0] >> 24) & 0xff); - digest[ 1] = (unsigned char) ((sha_info->digest[0] >> 16) & 0xff); - digest[ 2] = (unsigned char) ((sha_info->digest[0] >> 8) & 0xff); - digest[ 3] = (unsigned char) ((sha_info->digest[0] ) & 0xff); - digest[ 4] = (unsigned char) ((sha_info->digest[1] >> 24) & 0xff); - digest[ 5] = (unsigned char) ((sha_info->digest[1] >> 16) & 0xff); - digest[ 6] = (unsigned char) ((sha_info->digest[1] >> 8) & 0xff); - digest[ 7] = (unsigned char) ((sha_info->digest[1] ) & 0xff); - digest[ 8] = (unsigned char) ((sha_info->digest[2] >> 24) & 0xff); - digest[ 9] = (unsigned char) ((sha_info->digest[2] >> 16) & 0xff); - digest[10] = (unsigned char) ((sha_info->digest[2] >> 8) & 0xff); - digest[11] = (unsigned char) ((sha_info->digest[2] ) & 0xff); - digest[12] = (unsigned char) ((sha_info->digest[3] >> 24) & 0xff); - digest[13] = (unsigned char) ((sha_info->digest[3] >> 16) & 0xff); - digest[14] = (unsigned char) ((sha_info->digest[3] >> 8) & 0xff); - digest[15] = (unsigned char) ((sha_info->digest[3] ) & 0xff); - digest[16] = (unsigned char) ((sha_info->digest[4] >> 24) & 0xff); - digest[17] = (unsigned char) ((sha_info->digest[4] >> 16) & 0xff); - digest[18] = (unsigned char) ((sha_info->digest[4] >> 8) & 0xff); - digest[19] = (unsigned char) ((sha_info->digest[4] ) & 0xff); -} - -/* compute the SHA digest of a FILE stream */ - -#define BLOCK_SIZE 8192 - -void sha_stream(unsigned char digest[20], SHA_INFO *sha_info, FILE *fin) -{ - int i; - SHA_BYTE data[BLOCK_SIZE]; - - sha_init(sha_info); - while ((i = fread(data, 1, BLOCK_SIZE, fin)) > 0) { - sha_update(sha_info, data, i); - } - sha_final(digest, sha_info); -} - -/* print a SHA digest */ - -void sha_print(unsigned char digest[20]) -{ - int i, j; - - for (j = 0; j < 5; ++j) { - for (i = 0; i < 4; ++i) { - printf("%02x", *digest++); - } - printf("%c", (j < 4) ? ' ' : '\n'); - } -} - -char *sha_version(void) -{ -#if (SHA_VERSION == 1) - static char *version = "SHA-1"; -#else - static char *version = "SHA"; -#endif - return(version); -} - diff --git a/src/input/sha1.h b/src/input/sha1.h deleted file mode 100644 index 9f2659d60..000000000 --- a/src/input/sha1.h +++ /dev/null @@ -1,60 +0,0 @@ -/* NIST Secure Hash Algorithm */ -/* heavily modified by Uwe Hollerbach <uh@alumni.caltech edu> */ -/* from Peter C. Gutmann's implementation as found in */ -/* Applied Cryptography by Bruce Schneier */ -/* This code is in the public domain */ - -#ifndef SHA_H -#define SHA_H - -#include <stdlib.h> -#include <stdio.h> - -/* Useful defines & typedefs */ -typedef unsigned char SHA_BYTE; /* 8-bit quantity */ -typedef unsigned long SHA_LONG; /* 32-or-more-bit quantity */ - -#define SHA_BLOCKSIZE 64 -#define SHA_DIGESTSIZE 20 - -typedef struct { - SHA_LONG digest[5]; /* message digest */ - SHA_LONG count_lo, count_hi; /* 64-bit bit count */ - SHA_BYTE data[SHA_BLOCKSIZE]; /* SHA data buffer */ - int local; /* unprocessed amount in data */ -} SHA_INFO; - -void sha_init(SHA_INFO *); -void sha_update(SHA_INFO *, SHA_BYTE *, int); -void sha_final(unsigned char [20], SHA_INFO *); - -void sha_stream(unsigned char [20], SHA_INFO *, FILE *); -void sha_print(unsigned char [20]); -char *sha_version(void); - -#define SHA_VERSION 1 - -#ifdef HAVE_CONFIG_H -#include "config.h" - -#ifdef WORDS_BIGENDIAN -# if SIZEOF_LONG == 4 -# define SHA_BYTE_ORDER 4321 -# elif SIZEOF_LONG == 8 -# define SHA_BYTE_ORDER 87654321 -# endif -#else -# if SIZEOF_LONG == 4 -# define SHA_BYTE_ORDER 1234 -# elif SIZEOF_LONG == 8 -# define SHA_BYTE_ORDER 12345678 -# endif -#endif - -#else - -#define SHA_BYTE_ORDER 1234 - -#endif - -#endif /* SHA_H */ diff --git a/src/libffmpeg/Makefile.am b/src/libffmpeg/Makefile.am index 42fe20f95..784be31c1 100644 --- a/src/libffmpeg/Makefile.am +++ b/src/libffmpeg/Makefile.am @@ -4,23 +4,11 @@ AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) AM_CPPFLAGS = $(ZLIB_CPPFLAGS) AM_LDFLAGS = $(xineplug_ldflags) -if WITH_EXTERNAL_FFMPEG -AM_CFLAGS += $(FFMPEG_CFLAGS) $(FFMPEG_POSTPROC_CFLAGS) -link_ffmpeg = $(FFMPEG_LIBS) $(FFMPEG_POSTPROC_LIBS) -else -AM_CPPFLAGS += -I$(top_srcdir)/contrib/ffmpeg/libavutil \ - -I$(top_srcdir)/contrib/ffmpeg/libavcodec \ - -I$(top_srcdir)/contrib/ffmpeg/libpostproc -link_ffmpeg = $(top_builddir)/contrib/ffmpeg/libavcodec/libavcodec.a \ - $(top_builddir)/contrib/ffmpeg/libavutil/libavutil.a \ - $(top_builddir)/contrib/ffmpeg/libpostproc/libpostproc.a +if !WITH_EXTERNAL_FFMPEG $(top_builddir)/contrib/ffmpeg/libavcodec/libavcodec.a: $(MAKE) -C $(top_builddir)/contrib/ ffmpeg/libavcodec/libavcodec.a -$(top_builddir)/contrib/ffmpeg/libavutil/libavutil.a: - $(MAKE) -C $(top_builddir)/contrib/ ffmpeg/libavutil/libavutil.a - $(top_builddir)/contrib/ffmpeg/libpostproc/libpostproc.a: $(MAKE) -C $(top_builddir)/contrib/ ffmpeg/libpostproc/libpostproc.a @@ -53,10 +41,12 @@ endif nodist_xineplug_decode_ff_la_SOURCES = ffmpeg_config.h +xineplug_decode_ff_la_CFLAGS = $(AM_CFLAGS) $(FFMPEG_CFLAGS) $(FFMPEG_POSTPROC_CFLAGS) xineplug_decode_ff_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) -lm $(ZLIB_LIBS) \ - $(link_ffmpeg) $(PTHREAD_LIBS) $(LTLIBINTL) + $(FFMPEG_LIBS) $(FFMPEG_POSTPROC_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_decode_ff_la_DEPS = $(FFMPEG_DEPS) $(FFMPEG_POSTPROC_DEPS) xineplug_decode_ff_la_LDFLAGS = $(AM_LDFLAGS) $(IMPURE_TEXT_LDFLAGS) xineplug_decode_dvaudio_la_SOURCES = ff_dvaudio_decoder.c xineplug_decode_dvaudio_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) -xineplug_decode_dvaudio_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/contrib/ffmpeg/libavcodec +xineplug_decode_dvaudio_la_CPPFLAGS = $(AM_CPPFLAGS) $(FFMPEG_CFLAGS) -I$(top_srcdir)/contrib/ffmpeg/libavcodec diff --git a/src/libffmpeg/ffmpeg_encoder.c b/src/libffmpeg/ffmpeg_encoder.c index 7fe65c7fa..f7401f6ab 100644 --- a/src/libffmpeg/ffmpeg_encoder.c +++ b/src/libffmpeg/ffmpeg_encoder.c @@ -61,7 +61,7 @@ typedef struct lavc_data_s { uint8_t *ffmpeg_buffer; /* lavc buffer */ AVFrame *picture; /* picture to be encoded */ uint8_t *out[3]; /* aligned buffer for YV12 data */ - uint8_t *buf; /* unaligned YV12 buffer */ + uint8_t *buf; /* base address of YV12 buffer */ } lavc_data_t; @@ -108,8 +108,7 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { int image_size = frame->vo_frame.pitches[0] * frame->oheight; - this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2, - (void *)&this->buf); + this->out[0] = this->buf = av_mallocz(image_size * 3/2); this->out[1] = this->out[0] + image_size; this->out[2] = this->out[1] + image_size/4; diff --git a/src/libmpeg2/Makefile.am b/src/libmpeg2/Makefile.am index d772f0e09..1cf18c325 100644 --- a/src/libmpeg2/Makefile.am +++ b/src/libmpeg2/Makefile.am @@ -28,5 +28,6 @@ xineplug_decode_mpeg2_la_SOURCES = \ xine_mpeg2_decoder.c \ libmpeg2_accel.c -xineplug_decode_mpeg2_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) -lm -xineplug_decode_mpeg2_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) +xineplug_decode_mpeg2_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(AVUTIL_LIBS) -lm +xineplug_decode_mpeg2_la_DEPS = $(AVUTIL_DEPS) +xineplug_decode_mpeg2_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) $(AVUTIL_CFLAGS) diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 58f34ccbc..839289b59 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -37,6 +37,9 @@ #define LOG */ +/* libavutil from FFmpeg */ +#include <mem.h> + #include "xine_internal.h" #include "video_out.h" #include "mpeg2.h" @@ -69,11 +72,9 @@ void mpeg2_init (mpeg2dec_t * mpeg2dec, } if( !mpeg2dec->chunk_buffer ) - mpeg2dec->chunk_buffer = xine_xmalloc_aligned (16, BUFFER_SIZE + 4, - &mpeg2dec->chunk_base); + mpeg2dec->chunk_buffer = av_mallocz(BUFFER_SIZE + 4); if( !mpeg2dec->picture ) - mpeg2dec->picture = xine_xmalloc_aligned (16, sizeof (picture_t), - &mpeg2dec->picture_base); + mpeg2dec->picture = av_mallocz(sizeof(picture_t)); mpeg2dec->shift = 0xffffff00; mpeg2dec->new_sequence = 0; @@ -91,8 +92,6 @@ void mpeg2_init (mpeg2dec_t * mpeg2dec, mpeg2dec->afd_value_seen = XINE_VIDEO_AFD_NOT_PRESENT; mpeg2dec->afd_value_reported = (XINE_VIDEO_AFD_NOT_PRESENT - 1); - memset (mpeg2dec->picture, 0, sizeof (picture_t)); - /* initialize substructures */ mpeg2_header_state_init (mpeg2dec->picture); @@ -866,16 +865,9 @@ void mpeg2_close (mpeg2dec_t * mpeg2dec) picture->backward_reference_frame = NULL; } - if ( mpeg2dec->chunk_buffer ) { - free (mpeg2dec->chunk_base); - mpeg2dec->chunk_buffer = NULL; - } - - if ( mpeg2dec->picture ) { - free (mpeg2dec->picture_base); - mpeg2dec->picture = NULL; - } - + av_freep(&mpeg2dec->chunk_buffer); + av_freep(&mpeg2dec->picture_base); + if ( mpeg2dec->cc_dec) { /* dispose the closed caption decoder */ mpeg2dec->cc_dec->dispose(mpeg2dec->cc_dec); diff --git a/src/libxineadec/Makefile.am b/src/libxineadec/Makefile.am index a85497bbf..fc3a6ea51 100644 --- a/src/libxineadec/Makefile.am +++ b/src/libxineadec/Makefile.am @@ -76,8 +76,8 @@ xineplug_decode_mad_la_CFLAGS = $(AM_CFLAGS) $(LIBMAD_CFLAGS) xineplug_decode_a52_la_SOURCES = xine_a52_decoder.c xineplug_decode_a52_la_DEPENDENCIES = $(A52DEC_DEPS) -xineplug_decode_a52_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(A52DEC_LIBS) -lm -xineplug_decode_a52_la_CFLAGS = $(AM_CFLAGS) $(A52DEC_CFLAGS) +xineplug_decode_a52_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(A52DEC_LIBS) $(AVUTIL_LIBS) -lm +xineplug_decode_a52_la_CFLAGS = $(AM_CFLAGS) $(A52DEC_CFLAGS) $(AVUTIL_CFLAGS) xineplug_decode_faad_la_SOURCES = xine_faad_decoder.c xineplug_decode_faad_la_DEPENDENCIES = $(FAAD_DEPS) diff --git a/src/libxineadec/xine_a52_decoder.c b/src/libxineadec/xine_a52_decoder.c index 2d901d00a..c3fa5fa7a 100644 --- a/src/libxineadec/xine_a52_decoder.c +++ b/src/libxineadec/xine_a52_decoder.c @@ -62,7 +62,8 @@ #include "buffer.h" #include "xineutils.h" -#include "../../contrib/a52dec/crc.c" +/* libavutil from FFmpeg */ +#include <crc.h> #undef DEBUG_A52 #ifdef DEBUG_A52 @@ -420,8 +421,6 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { uint8_t *end = buf->content + buf->size; uint8_t byte; int32_t n; - uint16_t crc16; - uint16_t crc16_result; lprintf ("decode data %d bytes of type %08x, pts=%"PRId64"\n", buf->size, buf->type, buf->pts); @@ -587,10 +586,11 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->sync_state = 3; } else break; - case 3: /* Ready for decode */ - crc16 = (uint16_t) ((this->frame_buffer[2] << 8) | this->frame_buffer[3]) ; - crc16_result = crc16_block(&this->frame_buffer[2], this->frame_length - 2) ; /* frame_length */ - if (crc16_result != 0) { /* CRC16 failed */ + case 3: { /* Ready for decode */ + if ( ! *av_crc8005 ) + av_crc_init(av_crc8005, 0, 16, AV_CRC_16, sizeof(AVCRC)*257); + + if (av_crc(av_crc8005, 0, &this->frame_buffer[2], this->frame_length - 2) != 0) { /* CRC16 failed */ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "liba52:a52 frame failed crc16 checksum.\n"); current = sync_start; this->pts = 0; @@ -598,6 +598,7 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->sync_state = 0; break; } + } #if 0 a52dec_decode_frame (this, this->pts_list[0], buf->decoder_flags & BUF_FLAG_PREVIEW); #else diff --git a/src/post/planar/Makefile.am b/src/post/planar/Makefile.am index cb1ee68f9..68a3953bf 100644 --- a/src/post/planar/Makefile.am +++ b/src/post/planar/Makefile.am @@ -4,27 +4,19 @@ AM_CFLAGS = $(VISIBILITY_FLAG) $(ff_cflags) AM_CPPFLAGS = AM_LDFLAGS = -if WITH_EXTERNAL_FFMPEG -postproc_lib = $(FFMPEG_POSTPROC_LIBS) -ff_cflags = $(FFMPEG_POSTPROC_CFLAGS) -else -AM_CPPFLAGS += -I$(top_srcdir)/contrib/ffmpeg/libpostproc -postproc_lib = $(top_builddir)/contrib/ffmpeg/libpostproc/libpostproc.a \ - $(top_builddir)/contrib/ffmpeg/libavutil/libavutil.a - $(top_builddir)/contrib/ffmpeg/libpostproc/libpostproc.a: $(MAKE) -C $(top_builddir)/contrib ffmpeg/libpostproc/libpostproc.a -$(top_builddir)/contrib/ffmpeg/libavutil/libavutil.a: - $(MAKE) -C $(top_builddir)/contrib ffmpeg/libavutil/libavutil.a -endif noinst_LTLIBRARIES = libpost_planar_asm.la libpost_planar_asm_la_SOURCES = eq.c eq2.c noise.c -libpost_planar_asm_la_CFLAGS = $(O1_CFLAGS) -fomit-frame-pointer $(AM_CFLAGS) +libpost_planar_asm_la_CFLAGS = $(O1_CFLAGS) -fomit-frame-pointer $(AM_CFLAGS) $(AVUTIL_CFLAGS) +libpost_planar_asm_la_LIBADD = $(AVUTIL_LIBS) +libpost_planar_asm_la_DEPS = $(AVUTIL_DEPS) xinepost_LTLIBRARIES = xineplug_post_planar.la xineplug_post_planar_la_SOURCES = planar.c invert.c expand.c fill.c boxblur.c \ denoise3d.c unsharp.c pp.c -xineplug_post_planar_la_LIBADD = $(XINE_LIB) $(postproc_lib) -lm $(PTHREAD_LIBS) $(LTLIBINTL) $(noinst_LTLIBRARIES) -xineplug_post_planar_la_CFLAGS = $(DEFAULT_OCFLAGS) $(AM_CFLAGS) +xineplug_post_planar_la_LIBADD = $(XINE_LIB) $(FFMPEG_POSTPROC_LIBS) -lm $(PTHREAD_LIBS) $(LTLIBINTL) $(noinst_LTLIBRARIES) +xineplug_post_planar_la_DEPS = $(FFMPEG_POSTPROC_DEPS) +xineplug_post_planar_la_CFLAGS = $(DEFAULT_OCFLAGS) $(AM_CFLAGS) $(FFMPEG_POSTPROC_CFLAGS) xineplug_post_planar_la_LDFLAGS = $(AM_LDFLAGS) $(xineplug_ldflags) $(IMPURE_TEXT_LDFLAGS) diff --git a/src/post/planar/noise.c b/src/post/planar/noise.c index 53dc3065d..394b6a7b4 100644 --- a/src/post/planar/noise.c +++ b/src/post/planar/noise.c @@ -27,6 +27,8 @@ #include <math.h> #include <pthread.h> +/* libavutil from FFmpeg */ +#include <mem.h> #ifdef ARCH_X86_64 # define REG_a "rax" @@ -55,7 +57,6 @@ typedef struct noise_param_t { shiftptr; int8_t *noise, *prev_shift[MAX_RES][3]; - void *base; } noise_param_t; static int nonTempRandShift[MAX_RES]= {-1}; @@ -72,9 +73,8 @@ static int8_t *initNoise(noise_param_t *fp){ int pattern= fp->pattern; int8_t *noise; int i, j; - void *base; - noise = xine_xmalloc_aligned(16, MAX_NOISE*sizeof(int8_t), &base); + noise = av_mallocz(MAX_NOISE*sizeof(int8_t)); srand(123457); for(i=0,j=0; i<MAX_NOISE; i++,j++) @@ -130,7 +130,6 @@ static int8_t *initNoise(noise_param_t *fp){ } fp->noise= noise; - fp->base = base; fp->shiftptr= 0; return noise; } @@ -525,6 +524,8 @@ static void noise_dispose(post_plugin_t *this_gen) if (_x_post_dispose(this_gen)) { pthread_mutex_destroy(&this->lock); + av_free(this->params[0].noise); + av_free(this->params[1].noise); free(this); } } diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index c2ea443e0..aff164494 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -91,6 +91,13 @@ if ENABLE_MACOSX_VIDEO macosx_module = xineplug_vo_out_macosx.la endif +noinst_LTLIBRARIES = libyuv2rgb.la + +libyuv2rgb_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c +libyuv2rgb_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) $(AVUTIL_CFLAGS) +libyuv2rgb_la_LIBADD = $(XINE_LIB) $(MLIB_LIBS) $(AVUTIL_LIBS) +libyuv2rgb_la_DEPENDENCIES = $(AVUTIL_DEPS) + xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ $(opengl_module) \ $(syncfb_module) \ @@ -108,18 +115,19 @@ xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ $(xcbxv_module) \ xineplug_vo_out_none.la -xineplug_vo_out_xcbshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c video_out_xcbshm.c $(XCBOSD) -xineplug_vo_out_xcbshm_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) $(LTLIBINTL) -xineplug_vo_out_xcbshm_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) +xineplug_vo_out_xcbshm_la_SOURCES = video_out_xcbshm.c $(XCBOSD) +xineplug_vo_out_xcbshm_la_LIBADD = libyuv2rgb.la $(XINE_LIB) $(PTHREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_xcbshm_la_DEPENDENCIES = $(AVUTIL_DEPS) +xineplug_vo_out_xcbshm_la_CFLAGS = $(AM_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) $(AVUTIL_CFLAGS) xineplug_vo_out_xcbxv_la_SOURCES = video_out_xcbxv.c $(XCBOSD) xineplug_vo_out_xcbxv_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(XCBXV_LIBS) $(XCB_LIBS) xineplug_vo_out_xcbxv_la_CFLAGS = $(AM_CFLAGS) $(XCB_CFLAGS) $(XCBXV_CFLAGS) -xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - video_out_xshm.c $(X11OSD) -xineplug_vo_out_xshm_la_LIBADD = $(MLIB_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_xshm_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing +xineplug_vo_out_xshm_la_SOURCES = video_out_xshm.c $(X11OSD) +xineplug_vo_out_xshm_la_LIBADD = libyuv2rgb.la $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_xshm_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(AVUTIL_CFLAGS) -fno-strict-aliasing +xineplug_vo_out_xshm_la_DEPENDENCIES = $(AVUTIL_DEPS) xineplug_vo_out_xv_la_SOURCES = $(X11OSD) video_out_xv.c xineplug_vo_out_xv_la_LIBADD = $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) @@ -134,11 +142,11 @@ xineplug_vo_out_xxmc_la_SOURCES = $(X11OSD) video_out_xxmc.c\ xineplug_vo_out_xxmc_la_LIBADD = $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_xxmc_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing -xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - video_out_opengl.c myglext.h $(X11OSD) -xineplug_vo_out_opengl_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ - $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) -xineplug_vo_out_opengl_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing +xineplug_vo_out_opengl_la_SOURCES = video_out_opengl.c myglext.h $(X11OSD) +xineplug_vo_out_opengl_la_LIBADD = libyuv2rgb.la $(OPENGL_LIBS) $(GLUT_LIBS) \ + $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_opengl_la_DEPENDENCIES = $(AVUTIL_DEPS) +xineplug_vo_out_opengl_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(AVUTIL_CFLAGS) -fno-strict-aliasing xineplug_vo_out_syncfb_la_SOURCES = video_out_syncfb.c xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) @@ -162,18 +170,19 @@ xineplug_vo_out_vidix_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/contrib/vid xineplug_vo_out_aa_la_SOURCES = video_out_aa.c -xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_aa_la_CFLAGS = $(AM_CFLAGS) $(AALIB_CFLAGS) +xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_aa_la_DEPENDENCIES = $(AVUTIL_DEPS) +xineplug_vo_out_aa_la_CFLAGS = $(AM_CFLAGS) $(AALIB_CFLAGS) $(AVUTIL_CFLAGS) -xineplug_vo_out_caca_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - video_out_caca.c -xineplug_vo_out_caca_la_LIBADD = $(CACA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_caca_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS) +xineplug_vo_out_caca_la_SOURCES = video_out_caca.c +xineplug_vo_out_caca_la_LIBADD = libyuv2rgb.la $(CACA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_caca_la_DEPENDENCIES = $(AVUTIL_DEPS) +xineplug_vo_out_caca_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS) $(AVUTIL_CFLAGS) -xineplug_vo_out_fb_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - video_out_fb.c -xineplug_vo_out_fb_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_fb_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) +xineplug_vo_out_fb_la_SOURCES = video_out_fb.c +xineplug_vo_out_fb_la_LIBADD = libyuv2rgb.la $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_fb_la_DEPENDENCIES = $(AVUTIL_DEPS) +xineplug_vo_out_fb_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) xineplug_vo_out_directfb_la_SOURCES = video_out_directfb.c xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) @@ -191,8 +200,8 @@ xineplug_vo_out_stk_la_SOURCES = video_out_stk.c xineplug_vo_out_stk_la_LIBADD = $(XINE_LIB) $(LIBSTK_LIBS) $(PTHREAD_LIBS) xineplug_vo_out_stk_la_CFLAGS = $(AM_CFLAGS) $(LIBSTK_CFLAGS) -xineplug_vo_out_directx_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c video_out_directx.c -xineplug_vo_out_directx_la_LIBADD = $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) +xineplug_vo_out_directx_la_SOURCES = video_out_directx.c +xineplug_vo_out_directx_la_LIBADD = libyuv2rgb.la $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_directx_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS) xineplug_vo_out_none_la_SOURCES = video_out_none.c diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index bcbe2477e..b30e3c496 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.c @@ -35,6 +35,9 @@ #include <sys/mman.h> #include <sys/time.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include <aalib.h> #include "xine.h" @@ -51,7 +54,6 @@ typedef struct aa_frame_s { vo_frame_t vo_frame; int width, height; - uint8_t *mem[3]; double ratio; @@ -87,9 +89,9 @@ static uint32_t aa_get_capabilities (vo_driver_t *this) { static void aa_dispose_frame (vo_frame_t *vo_img) { aa_frame_t *frame = (aa_frame_t *)vo_img; - free (frame->mem[0]); - free (frame->mem[1]); - free (frame->mem[2]); + av_free (frame->vo_frame.base[0]); + av_free (frame->vo_frame.base[1]); + av_free (frame->vo_frame.base[2]); free (frame); } @@ -129,9 +131,9 @@ static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { - free (frame->mem[0]); frame->mem[0] = NULL; - free (frame->mem[1]); frame->mem[1] = NULL; - free (frame->mem[2]); frame->mem[2] = NULL; + av_freep (&frame->vo_frame.base[0]); + av_freep (&frame->vo_frame.base[1]); + av_freep (&frame->vo_frame.base[2]); frame->width = width; frame->height = height; @@ -142,15 +144,15 @@ static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * height, (void**) &frame->mem[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[1] * ((height+1)/2), (void**) &frame->mem[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[2] * ((height+1)/2), (void**) &frame->mem[2]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[1] = av_mallocz(frame->vo_frame.pitches[1] * ((height+1)/2)); + frame->vo_frame.base[2] = av_mallocz(frame->vo_frame.pitches[2] * ((height+1)/2)); /* printf ("allocated yuv memory for %d x %d image\n", width, height); */ } else if (format == XINE_IMGFMT_YUY2) { frame->vo_frame.pitches[0] = 8*((width + 3) / 4); - frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * height, (void**) &frame->mem[0]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); } else { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "alert! unsupported image format %04x\n", format); _x_abort(); diff --git a/src/video_out/video_out_caca.c b/src/video_out/video_out_caca.c index 231befcdb..f98733098 100644 --- a/src/video_out/video_out_caca.c +++ b/src/video_out/video_out_caca.c @@ -37,6 +37,9 @@ #include <cucul.h> #include <caca.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include "xine.h" #include "video_out.h" #include "xine_internal.h" @@ -54,7 +57,6 @@ typedef struct caca_frame_s { cucul_dither_t *pixmap_s; /* pixmap info structure */ uint8_t *pixmap_d; /* pixmap data */ int width, height; - uint8_t *mem[3]; int format; /* XINE_IMGFMT_* flags */ @@ -94,9 +96,9 @@ static uint32_t caca_get_capabilities (vo_driver_t *this) { static void caca_dispose_frame (vo_frame_t *vo_img) { caca_frame_t *frame = (caca_frame_t *)vo_img; - free (frame->mem[0]); - free (frame->mem[1]); - free (frame->mem[2]); + av_free (frame->vo_frame.base[0]); + av_free (frame->vo_frame.base[1]); + av_free (frame->vo_frame.base[2]); free (frame->pixmap_d); if (frame->pixmap_s) @@ -144,9 +146,9 @@ static void caca_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { - free (frame->mem[0]); frame->mem[0] = NULL; - free (frame->mem[1]); frame->mem[1] = NULL; - free (frame->mem[2]); frame->mem[2] = NULL; + av_freep (&frame->vo_frame.base[0]); + av_freep (&frame->vo_frame.base[1]); + av_freep (&frame->vo_frame.base[2]); free (frame->pixmap_d); frame->pixmap_d = NULL; @@ -167,19 +169,15 @@ static void caca_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - frame->vo_frame.base[0] = xine_xmalloc_aligned(16, - frame->vo_frame.pitches[0] * height, (void**) &frame->mem[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned(16, - frame->vo_frame.pitches[1] * ((height+1)/2), (void**) &frame->mem[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned(16, - frame->vo_frame.pitches[2] * ((height+1)/2), (void**) &frame->mem[2]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[1] = av_mallocz(frame->vo_frame.pitches[1] * ((height+1)/2)); + frame->vo_frame.base[2] = av_mallocz(frame->vo_frame.pitches[2] * ((height+1)/2)); frame->yuv2rgb->configure (frame->yuv2rgb, width, height, frame->vo_frame.pitches[0], frame->vo_frame.pitches[1], width, height, width * 4); } else if (format == XINE_IMGFMT_YUY2) { frame->vo_frame.pitches[0] = 8*((width + 3) / 4); - frame->vo_frame.base[0] = xine_xmalloc_aligned(16, - frame->vo_frame.pitches[0] * height, (void**) &frame->mem[0]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); frame->yuv2rgb->configure (frame->yuv2rgb, width, height, frame->vo_frame.pitches[0], frame->vo_frame.pitches[0], width, height, width * 4); diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 859959455..f07cb9c23 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -68,6 +68,9 @@ #include <pthread.h> #include <netinet/in.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include <linux/fb.h> #include <linux/kd.h> #include <linux/vt.h> @@ -92,8 +95,6 @@ typedef struct fb_frame_s vo_scale_t sc; - uint8_t *chunk[3]; /* mem alloc by xmalloc_aligned */ - yuv2rgb_t *yuv2rgb; /* yuv2rgb converter for this frame */ uint8_t *rgb_dst; int yuv_stride; @@ -324,10 +325,9 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags) static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, uint32_t width, uint32_t height, int format) { - free(frame->chunk[0]); - free(frame->chunk[1]); - free(frame->chunk[2]); - memset(frame->chunk, 0, sizeof(frame->chunk[0])*3); + av_freep(&frame->vo_frame.base[0]); + av_freep(&frame->vo_frame.base[1]); + av_freep(&frame->vo_frame.base[2]); if(this->use_zero_copy) { @@ -349,35 +349,15 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - frame->vo_frame.base[0] = - xine_xmalloc_aligned(16, - frame->vo_frame.pitches[0] * - height, - (void **)&frame->chunk[0]); - - frame->vo_frame.base[1] = - xine_xmalloc_aligned(16, - frame->vo_frame.pitches[1] * - ((height+1)/2), - (void **)&frame->chunk[1]); - - frame->vo_frame.base[2] = - xine_xmalloc_aligned(16, - frame->vo_frame.pitches[2] * - ((height+1)/2), - (void **)&frame->chunk[2]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[1] = av_mallocz(frame->vo_frame.pitches[1] * ((height+1)/2)); + frame->vo_frame.base[2] = av_mallocz(frame->vo_frame.pitches[2] * ((height+1)/2)); } else { frame->vo_frame.pitches[0] = 8 * ((width + 3) / 4); - frame->vo_frame.base[0] = - xine_xmalloc_aligned(16, - frame->vo_frame.pitches[0] * - height, - (void **)&frame->chunk[0]); - frame->chunk[1] = NULL; - frame->chunk[2] = NULL; + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); } } diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index 04413eb80..e47ab97fd 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.c @@ -47,6 +47,9 @@ #include <ctype.h> #include <pthread.h> +/* libavutil from FFmpeg */ +#include <mem.h> + /* defines for debugging extensions only */ /* #define GL_GLEXT_LEGACY */ #include <GL/gl.h> @@ -140,7 +143,6 @@ typedef struct { int width, height, format, flags; double ratio; - uint8_t *chunk[4]; /* mem alloc by xmalloc_aligned */ uint8_t *rgb, *rgb_dst; yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ @@ -1269,10 +1271,10 @@ static void opengl_frame_dispose (vo_frame_t *vo_img) { frame->yuv2rgb->dispose (frame->yuv2rgb); - free (frame->chunk[0]); - free (frame->chunk[1]); - free (frame->chunk[2]); - free (frame->chunk[3]); + av_free (frame->vo_frame.base[0]); + av_free (frame->vo_frame.base[1]); + av_free (frame->vo_frame.base[2]); + av_free (frame->rgb); free (frame); } @@ -1350,26 +1352,23 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, XLockDisplay (this->display); /* (re-) allocate render space */ - free (frame->chunk[0]); - free (frame->chunk[1]); - free (frame->chunk[2]); - free (frame->chunk[3]); + av_freep(&frame->vo_frame.base[0]); + av_freep(&frame->vo_frame.base[1]); + av_freep(&frame->vo_frame.base[2]); + av_freep(&frame->rgb); if (format == XINE_IMGFMT_YV12) { frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[1] * ((height+1)/2), (void **) &frame->chunk[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[2] * ((height+1)/2), (void **) &frame->chunk[2]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[1] = av_mallocz(frame->vo_frame.pitches[1] * ((height+1)/2)); + frame->vo_frame.base[2] = av_mallocz(frame->vo_frame.pitches[2] * ((height+1)/2)); } else { frame->vo_frame.pitches[0] = 8*((width + 3) / 4); - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); - frame->chunk[1] = NULL; - frame->chunk[2] = NULL; + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); } - frame->rgb = xine_xmalloc_aligned (16, BYTES_PER_PIXEL*width*height, - (void **) &frame->chunk[3]); + frame->rgb = av_mallocz(BYTES_PER_PIXEL*width*height); /* set up colorspace converter */ switch (flags) { diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 013695c46..c8373df28 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.c @@ -525,9 +525,6 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, switch(format) { case XINE_IMGFMT_YV12: -/* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame_size, (void **)&frame->data_mem[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[2]);*/ frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); @@ -536,7 +533,6 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, frame->vo_frame.base[2] = malloc(frame->vo_frame.pitches[2] * ((height+1)/2)); break; case XINE_IMGFMT_YUY2: -/* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, (frame_size*2), (void **)&frame->data_mem[0]);*/ frame->vo_frame.pitches[0] = 8*((width + 3) / 4); frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height); frame->vo_frame.base[1] = NULL; diff --git a/src/video_out/video_out_xcbshm.c b/src/video_out/video_out_xcbshm.c index c6ad9e2f1..9881e7888 100644 --- a/src/video_out/video_out_xcbshm.c +++ b/src/video_out/video_out_xcbshm.c @@ -50,6 +50,9 @@ #include <pthread.h> #include <netinet/in.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "video_out_xcbshm" #define LOG_VERBOSE /* @@ -76,8 +79,6 @@ typedef struct { int bytes_per_line; xcb_shm_seg_t shmseg; - uint8_t *chunk[3]; /* mem alloc by xmalloc_aligned */ - yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ uint8_t *rgb_dst; @@ -287,9 +288,9 @@ static void xshm_frame_dispose (vo_frame_t *vo_img) { frame->yuv2rgb->dispose (frame->yuv2rgb); - free (frame->chunk[0]); - free (frame->chunk[1]); - free (frame->chunk[2]); + av_free (frame->vo_frame.base[0]); + av_free (frame->vo_frame.base[1]); + av_free (frame->vo_frame.base[2]); free (frame); } @@ -437,18 +438,9 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, dispose_ximage(this, frame); - if (frame->chunk[0]){ - free (frame->chunk[0]); - frame->chunk[0] = NULL; - } - if (frame->chunk[1]) { - free (frame->chunk[1]); - frame->chunk[1] = NULL; - } - if (frame->chunk[2]) { - free (frame->chunk[2]); - frame->chunk[2] = NULL; - } + av_freep(&frame->vo_frame.base[0]); + av_freep(&frame->vo_frame.base[1]); + av_freep(&frame->vo_frame.base[2]); } create_ximage(this, frame, frame->sc.output_width, frame->sc.output_height); @@ -459,14 +451,12 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[1] * ((height+1)/2), (void **) &frame->chunk[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[2] * ((height+1)/2), (void **) &frame->chunk[2]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[1] = av_mallocz(frame->vo_frame.pitches[1] * ((height+1)/2)); + frame->vo_frame.base[2] = av_mallocz(frame->vo_frame.pitches[2] * ((height+1)/2)); } else { frame->vo_frame.pitches[0] = 8*((width + 3) / 4); - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); - frame->chunk[1] = NULL; - frame->chunk[2] = NULL; + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); } lprintf ("stripe out_ht=%i, deliv_ht=%i\n", diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index ddcdb677c..41a93cdad 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -51,6 +51,9 @@ #include <pthread.h> #include <netinet/in.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "video_out_xshm" #define LOG_VERBOSE /* @@ -80,8 +83,6 @@ typedef struct { XImage *image; XShmSegmentInfo shminfo; - uint8_t *chunk[3]; /* mem alloc by xmalloc_aligned */ - yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ uint8_t *rgb_dst; @@ -380,9 +381,9 @@ static void xshm_frame_dispose (vo_frame_t *vo_img) { frame->yuv2rgb->dispose (frame->yuv2rgb); - free (frame->chunk[0]); - free (frame->chunk[1]); - free (frame->chunk[2]); + av_free (frame->vo_frame.base[0]); + av_free (frame->vo_frame.base[1]); + av_free (frame->vo_frame.base[2]); free (frame); } @@ -530,18 +531,9 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, dispose_ximage (this, &frame->shminfo, frame->image); - if (frame->chunk[0]){ - free (frame->chunk[0]); - frame->chunk[0] = NULL; - } - if (frame->chunk[1]) { - free (frame->chunk[1]); - frame->chunk[1] = NULL; - } - if (frame->chunk[2]) { - free (frame->chunk[2]); - frame->chunk[2] = NULL; - } + av_freep(&frame->vo_frame.base[0]); + av_freep(&frame->vo_frame.base[1]); + av_freep(&frame->vo_frame.base[2]); frame->image = NULL; } @@ -555,14 +547,12 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[1] * ((height+1)/2), (void **) &frame->chunk[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[2] * ((height+1)/2), (void **) &frame->chunk[2]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[1] = av_mallocz(frame->vo_frame.pitches[1] * ((height+1)/2)); + frame->vo_frame.base[2] = av_mallocz(frame->vo_frame.pitches[2] * ((height+1)/2)); } else { frame->vo_frame.pitches[0] = 8*((width + 3) / 4); - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); - frame->chunk[1] = NULL; - frame->chunk[2] = NULL; + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); } lprintf ("stripe out_ht=%i, deliv_ht=%i\n", diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index 0ca6537a7..99afed05f 100644 --- a/src/video_out/yuv2rgb.c +++ b/src/video_out/yuv2rgb.c @@ -31,6 +31,9 @@ #include <string.h> #include <inttypes.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include "yuv2rgb.h" #define LOG_MODULE "yuv2rgb" @@ -3182,7 +3185,7 @@ static yuv2rgb_t *yuv2rgb_create_converter (yuv2rgb_factory_t *factory) { static void yuv2rgb_factory_dispose (yuv2rgb_factory_t *this) { free (this->table_base); - free (this->table_mmx_base); + av_free(this->table_mmx); free (this); } @@ -3203,7 +3206,6 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, this->matrix_coefficients = 6; this->table_base = NULL; this->table_mmx = NULL; - this->table_mmx_base = NULL; yuv2rgb_set_csc_levels (this, 0, 128, 128); diff --git a/src/video_out/yuv2rgb_mmx.c b/src/video_out/yuv2rgb_mmx.c index 20a9b5a00..3d834d672 100644 --- a/src/video_out/yuv2rgb_mmx.c +++ b/src/video_out/yuv2rgb_mmx.c @@ -31,6 +31,9 @@ #include <string.h> #include <inttypes.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include "yuv2rgb.h" #include "xineutils.h" @@ -70,7 +73,7 @@ void mmx_yuv2rgb_set_csc_levels(yuv2rgb_factory_t *this, /* 'table_mmx' is 64bit aligned for better performance */ if (this->table_mmx == NULL) { - this->table_mmx = xine_xmalloc_aligned (8, sizeof(mmx_csc_t), &this->table_mmx_base); + this->table_mmx = av_mallocz(sizeof(mmx_csc_t)); } if( brightness <= 16 ) { diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index b90bd0ee9..fa53965a3 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -1,7 +1,8 @@ include $(top_srcdir)/misc/Makefile.common include $(top_srcdir)/lib/Makefile.common -AM_CFLAGS = $(DEFAULT_OCFLAGS) $(X_CFLAGS) $(FT2_CFLAGS) $(FONTCONFIG_CFLAGS) $(VISIBILITY_FLAG) +AM_CFLAGS = $(DEFAULT_OCFLAGS) $(X_CFLAGS) $(FT2_CFLAGS) $(FONTCONFIG_CFLAGS) \ + $(AVUTIL_CFLAGS) $(VISIBILITY_FLAG) AM_CPPFLAGS = $(XDG_BASEDIR_CPPFLAGS) $(ZLIB_CPPFLAGS) -DXINE_LIBRARY_COMPILE XINEUTILS_LIB = $(top_builddir)/src/xine-utils/libxineutils.la @@ -32,11 +33,12 @@ libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \ input_rip.c input_cache.c info_helper.c refcounter.c \ alphablend.c -libxine_la_DEPENDENCIES = $(XINEUTILS_LIB) $(XDG_BASEDIR_DEPS) \ +libxine_la_DEPENDENCIES = $(XINEUTILS_LIB) $(XDG_BASEDIR_DEPS) $(AVUTIL_DEPS) \ $(pthread_dep) $(LIBXINEPOSIX) libxine_la_LIBADD = $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(ZLIB_LIBS) \ -lm $(XINEUTILS_LIB) $(LTLIBICONV) $(FT2_LIBS) $(FONTCONFIG_LIBS) \ - $(LIBXINEPOSIX) $(RT_LIBS) $(NET_LIBS) $(XDG_BASEDIR_LIBS) + $(LIBXINEPOSIX) $(RT_LIBS) $(NET_LIBS) $(XDG_BASEDIR_LIBS) \ + $(AVUTIL_LIBS) libxine_la_LDFLAGS = $(AM_LDFLAGS) $(def_ldflags) \ -version-info $(XINE_LT_CURRENT):$(XINE_LT_REVISION):$(XINE_LT_AGE) diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c index 93ad75ba0..c116f180a 100644 --- a/src/xine-engine/buffer.c +++ b/src/xine-engine/buffer.c @@ -36,6 +36,9 @@ #include <stdlib.h> #include <assert.h> +/* libavutil from FFmpeg */ +#include <mem.h> + /********** logging **********/ #define LOG_MODULE "buffer" #define LOG_VERBOSE @@ -358,7 +361,7 @@ static void fifo_buffer_dispose (fifo_buffer_t *this) { received++; } - free (this->buffer_pool_base); + av_free (this->buffer_pool_base); pthread_mutex_destroy(&this->mutex); pthread_cond_destroy(&this->not_empty); pthread_mutex_destroy(&this->buffer_pool_mutex); @@ -497,7 +500,6 @@ fifo_buffer_t *_x_fifo_buffer_new (int num_buffers, uint32_t buf_size) { fifo_buffer_t *this; int i; - int alignment = 2048; unsigned char *multi_buffer = NULL; this = xine_xmalloc (sizeof (fifo_buffer_t)); @@ -527,15 +529,11 @@ fifo_buffer_t *_x_fifo_buffer_new (int num_buffers, uint32_t buf_size) { */ - if (buf_size % alignment != 0) - buf_size += alignment - (buf_size % alignment); - /* - printf ("Allocating %d buffers of %ld bytes in one chunk (alignment = %d)\n", - num_buffers, (long int) buf_size, alignment); + printf ("Allocating %d buffers of %ld bytes in one chunk\n", + num_buffers, (long int) buf_size); */ - multi_buffer = xine_xmalloc_aligned (alignment, num_buffers * buf_size, - &this->buffer_pool_base); + multi_buffer = this->buffer_pool_base = av_mallocz (num_buffers * buf_size); this->buffer_pool_top = NULL; diff --git a/src/xine-utils/Makefile.am b/src/xine-utils/Makefile.am index bacb2720f..10f1714f9 100644 --- a/src/xine-utils/Makefile.am +++ b/src/xine-utils/Makefile.am @@ -32,7 +32,6 @@ libxineutils_la_SOURCES = $(pppc_files) \ cpu_accel.c \ color.c \ copy.c \ - crc.c \ list.c \ memcpy.c \ monitor.c \ diff --git a/src/xine-utils/crc.c b/src/xine-utils/crc.c deleted file mode 100644 index ba0e3010b..000000000 --- a/src/xine-utils/crc.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2000-2007 the xine project - * - * This file is part of xine, a free video player. - * - * xine 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. - * - * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * Common CRC calculation code. - */ - -#include "xineutils.h" - -static const uint32_t crc32_table[256] = { - 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, - 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, - 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, - 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, - 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, - 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, - 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, - 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, - 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, - 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, - 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, - 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, - 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, - 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, - 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, - 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, - 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, - 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, - 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, - 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, - 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, - 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, - 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, - 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, - 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, - 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, - 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, - 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, - 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, - 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, - 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, - 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, - 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, - 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, - 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, - 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, - 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, - 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, - 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, - 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, - 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, - 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, - 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, - 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, - 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, - 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, - 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, - 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, - 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, - 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, - 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, - 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, - 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, - 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, - 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, - 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, - 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, - 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, - 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, - 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, - 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, - 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, - 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, - 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 -}; - -uint32_t _x_compute_crc32 (const uint8_t *data, int32_t length, uint32_t crc32) -{ - int32_t i; - for (i = 0; i < length; ++i) - crc32 = (crc32 << 8) ^ crc32_table[(crc32 >> 24) ^ data[i]]; - return crc32; -} - -#if 0 -/* generate the CRC data */ - -#include <stdio.h> - -static void build_crc32_table (void) -{ - uint32_t i; - - for (i = 0; i < 256; ++i) - { - uint32_t j, k = 0; - for (j = (i << 24) | 0x800000; j != 0x80000000; j <<= 1) - k = (k << 1) ^ (((k ^ j) & 0x80000000) ? 0x04c11db7 : 0); - crc32_table[i] = k; - } -} - -int main (void) -{ - build_crc32_table (); - int i; - for (i = 0; i < 256; ++i) - printf ("0x%08x,%c", crc32_table[i], (3 & ~i) ? ' ' : '\n'); - return 0; -} - -#endif diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index d9eb7fb3f..1c267b800 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -274,18 +274,6 @@ void *xine_xcalloc(size_t nmemb, size_t size) { return ptr; } -void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) { - - char *ptr; - - *base = ptr = xine_xmalloc (size+alignment); - - while ((size_t) ptr % alignment) - ptr++; - - return ptr; -} - #ifdef WIN32 /* * Parse command line with Windows XP syntax and copy the command (argv[0]). diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 3296b2ba9..c074429ec 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -626,13 +626,6 @@ void *xine_xmalloc(size_t size) XINE_MALLOC XINE_PROTECTED; void *xine_xcalloc(size_t nmemb, size_t size) XINE_MALLOC XINE_PROTECTED; /* - * Same as above, but memory is aligned to 'alignement'. - * **base is used to return pointer to un-aligned memory, use - * this to free the mem chunk - */ -void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) XINE_PROTECTED; - -/* * Get user home directory. */ const char *xine_get_homedir(void) XINE_PROTECTED; @@ -970,11 +963,6 @@ const char *xine_guess_spu_encoding(void) XINE_PROTECTED; */ int xine_monotonic_clock(struct timeval *tv, struct timezone *tz) XINE_PROTECTED; -/** - * CRC functions - */ -uint32_t _x_compute_crc32 (const uint8_t * data, int32_t length, uint32_t crc32) XINE_PROTECTED; - /* don't harm following code */ #ifdef extern # undef extern |