Commit 35bec595 authored by Wim Taymans's avatar Wim Taymans

ffmpegcolorspace: remove plugin

parent db0a2f51
...@@ -171,10 +171,6 @@ dnl *** checks for header files *** ...@@ -171,10 +171,6 @@ dnl *** checks for header files ***
dnl check if we have ANSI C header files dnl check if we have ANSI C header files
AC_HEADER_STDC AC_HEADER_STDC
dnl used in gst/ffmpegcolorspace/mem.c
dnl FIXME: could be fixed by redefining av_malloc and av_free to GLib's
AC_CHECK_HEADERS([malloc.h])
ac_cppflags_save="$CPPFLAGS" ac_cppflags_save="$CPPFLAGS"
CPPFLAGS="`$PKG_CONFIG --cflags libxml-2.0`" CPPFLAGS="`$PKG_CONFIG --cflags libxml-2.0`"
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
...@@ -213,7 +209,6 @@ LIBS="$save_libs" ...@@ -213,7 +209,6 @@ LIBS="$save_libs"
dnl used in gst-libs/gst/pbutils and associated unit test dnl used in gst-libs/gst/pbutils and associated unit test
AC_CHECK_HEADERS([process.h sys/types.h sys/wait.h sys/stat.h]) AC_CHECK_HEADERS([process.h sys/types.h sys/wait.h sys/stat.h])
dnl ffmpegcolorspace includes _stdint.h
dnl also, Windows does not have long long dnl also, Windows does not have long long
AX_CREATE_STDINT_H AX_CREATE_STDINT_H
...@@ -425,7 +420,6 @@ AG_GST_CHECK_PLUGIN(audioconvert) ...@@ -425,7 +420,6 @@ AG_GST_CHECK_PLUGIN(audioconvert)
AG_GST_CHECK_PLUGIN(audiorate) AG_GST_CHECK_PLUGIN(audiorate)
AG_GST_CHECK_PLUGIN(audiotestsrc) AG_GST_CHECK_PLUGIN(audiotestsrc)
AG_GST_CHECK_PLUGIN(encoding) AG_GST_CHECK_PLUGIN(encoding)
AG_GST_CHECK_PLUGIN(ffmpegcolorspace)
AG_GST_CHECK_PLUGIN(videoconvert) AG_GST_CHECK_PLUGIN(videoconvert)
AG_GST_CHECK_PLUGIN(gdp) AG_GST_CHECK_PLUGIN(gdp)
AG_GST_CHECK_PLUGIN(playback) AG_GST_CHECK_PLUGIN(playback)
...@@ -864,7 +858,6 @@ gst/audiorate/Makefile ...@@ -864,7 +858,6 @@ gst/audiorate/Makefile
gst/audiotestsrc/Makefile gst/audiotestsrc/Makefile
gst/encoding/Makefile gst/encoding/Makefile
gst/videoconvert/Makefile gst/videoconvert/Makefile
gst/ffmpegcolorspace/Makefile
gst/gdp/Makefile gst/gdp/Makefile
gst/playback/Makefile gst/playback/Makefile
gst/audioresample/Makefile gst/audioresample/Makefile
......
...@@ -64,7 +64,7 @@ CFILE_GLOB=$(DOC_SOURCE_DIR)/*/*/*.c ...@@ -64,7 +64,7 @@ CFILE_GLOB=$(DOC_SOURCE_DIR)/*/*/*.c
SCANOBJ_DEPS = SCANOBJ_DEPS =
# Header files to ignore when scanning. # Header files to ignore when scanning.
IGNORE_HFILES = avcodec.h gstffmpegcodecmap.h dsputil.h arch.h speex_resampler.h speex_resampler_wrapper.h fixed_arm4.h fixed_arm5e.h fixed_bfin.h fixed_debug.h fixed_generic.h resample_sse.h IGNORE_HFILES = avcodec.h dsputil.h arch.h speex_resampler.h speex_resampler_wrapper.h fixed_arm4.h fixed_arm5e.h fixed_bfin.h fixed_debug.h fixed_generic.h resample_sse.h
IGNORE_CFILES = utils.c mem.c imgconvert.c IGNORE_CFILES = utils.c mem.c imgconvert.c
# we add all .h files of elements that have signals/args we want # we add all .h files of elements that have signals/args we want
...@@ -102,7 +102,6 @@ EXTRA_HFILES = \ ...@@ -102,7 +102,6 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/audioconvert/gstaudioconvert.h \ $(top_srcdir)/gst/audioconvert/gstaudioconvert.h \
$(top_srcdir)/gst/audiotestsrc/gstaudiotestsrc.h \ $(top_srcdir)/gst/audiotestsrc/gstaudiotestsrc.h \
$(top_srcdir)/gst/encoding/gstencodebin.h \ $(top_srcdir)/gst/encoding/gstencodebin.h \
$(top_srcdir)/gst/ffmpegcolorspace/gstffmpegcolorspace.h \
$(top_srcdir)/gst/gdp/gstgdpdepay.h \ $(top_srcdir)/gst/gdp/gstgdpdepay.h \
$(top_srcdir)/gst/gdp/gstgdppay.h \ $(top_srcdir)/gst/gdp/gstgdppay.h \
$(top_srcdir)/gst/playback/gstplay-enum.h \ $(top_srcdir)/gst/playback/gstplay-enum.h \
......
plugin_LTLIBRARIES = libgstffmpegcolorspace.la
libgstffmpegcolorspace_la_SOURCES = \
gstffmpegcolorspace.c \
gstffmpegcodecmap.c \
dsputil.c \
mem.c \
utils.c \
imgconvert.c
libgstffmpegcolorspace_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstffmpegcolorspace_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstffmpegcolorspace_la_LIBADD = \
$(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
$(GST_BASE_LIBS) $(GST_LIBS)
libgstffmpegcolorspace_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstffmpegcolorspace.h \
gstffmpegcodecmap.h \
imgconvert_template.h \
dsputil.h \
avcodec.h
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
-:PROJECT libgstffmpegcolorspace -:SHARED libgstffmpegcolorspace \
-:TAGS eng debug \
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-:SOURCES $(libgstffmpegcolorspace_la_SOURCES) \
-:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstffmpegcolorspace_la_CFLAGS) \
-:LDFLAGS $(libgstffmpegcolorspace_la_LDFLAGS) \
$(libgstffmpegcolorspace_la_LIBADD) \
-ldl \
-:PASSTHROUGH LOCAL_ARM_MODE:=arm \
LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
> $@
This diff is collapsed.
/*
* DSP utils
* Copyright (c) 2000, 2001 Fabrice Bellard.
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
*
* 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* gmc & q-pel & 32/64 bit based MC by Michael Niedermayer <michaelni@gmx.at>
*/
/**
* @file dsputil.c
* DSP utils
*/
#include "avcodec.h"
#include "dsputil.h"
uint8_t cropTbl[256 + 2 * MAX_NEG_CROP] = { 0, };
/* init static data */
void
dsputil_static_init (void)
{
int i;
for (i = 0; i < 256; i++)
cropTbl[i + MAX_NEG_CROP] = i;
for (i = 0; i < MAX_NEG_CROP; i++) {
cropTbl[i] = 0;
cropTbl[i + MAX_NEG_CROP + 256] = 255;
}
}
/*
* DSP utils
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard.
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
*
* 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* @file dsputil.h
* DSP utils.
* note, many functions in here may use MMX which trashes the FPU state, it is
* absolutely necessary to call emms_c() between dsp & float/double code
*/
#ifndef DSPUTIL_H
#define DSPUTIL_H
/* pixel operations */
#define MAX_NEG_CROP 1024
/* temporary */
extern uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];
void dsputil_static_init(void);
#endif
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="ffmpegcolorspace"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678B1}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../win32/Debug"
IntermediateDirectory="../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ffmpegcolorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstffmpegcolorspace.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/ffmpegcolorspace.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstffmpegcolorspace.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../win32/Release"
IntermediateDirectory="../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;ffmpegcolorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstffmpegcolorspace.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstffmpegcolorspace.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\gstffmpegcolorspace.c">
</File>
<File
RelativePath=".\gstffmpeg.c">
</File>
<File
RelativePath=".\gstffmpegcodecmap.c">
</File>
<File
RelativePath=".\dsputil.c">
</File>
<File
RelativePath=".\mem.c">
</File>
<File
RelativePath=".\utils.c">
</File>
<File
RelativePath=".\imgconvert.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\gstffmpegcodecmap.h">
</File>
<File
RelativePath=".\imgconvert_template.h">
</File>
<File
RelativePath=".\common.h">
</File>
<File
RelativePath=".\dsputil.h">
</File>
<File
RelativePath=".\mmx.h">
</File>
<File
RelativePath=".\avcodec.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_FFMPEG_CODECMAP_H__
#define __GST_FFMPEG_CODECMAP_H__
#include "avcodec.h"
#include <gst/gst.h>
/*
* _codectype_to_caps () gets the GstCaps that belongs to
* a certain CodecType for a pad with uncompressed data.
*/
GstCaps *
gst_ffmpegcsp_codectype_to_caps (enum CodecType codec_type,
AVCodecContext *context);
/*
* caps_with_codectype () transforms a GstCaps that belongs to
* a pad for uncompressed data to a filled-in context.
*/
void
gst_ffmpegcsp_caps_with_codectype (enum CodecType type,
const GstCaps *caps,
AVCodecContext *context);
/*
* Fill in pointers in an AVPicture, aligned by 4 (required by X).
*/
int
gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
uint8_t * ptr,
enum PixelFormat pix_fmt,
int width,
int height,
int interlaced);
#endif /* __GST_FFMPEG_CODECMAP_H__ */
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* This file:
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_FFMPEGCOLORSPACE_H__
#define __GST_FFMPEGCOLORSPACE_H__
#include <gst/gst.h>
#include <gst/video/gstvideofilter.h>
#include "avcodec.h"
G_BEGIN_DECLS
#define GST_TYPE_FFMPEGCSP (gst_ffmpegcsp_get_type())
#define GST_FFMPEGCSP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGCSP,GstFFMpegCsp))
#define GST_FFMPEGCSP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGCSP,GstFFMpegCspClass))
#define GST_IS_FFMPEGCSP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGCSP))
#define GST_IS_FFMPEGCSP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGCSP))
typedef struct _GstFFMpegCsp GstFFMpegCsp;
typedef struct _GstFFMpegCspClass GstFFMpegCspClass;
/**
* GstFFMpegCsp:
*
* Opaque object data structure.
*/
struct _GstFFMpegCsp {
GstVideoFilter element;
gint width, height;
gboolean interlaced;
gfloat fps;
enum PixelFormat from_pixfmt, to_pixfmt;
AVPicture from_frame, to_frame;
AVPaletteControl *palette;
};
struct _GstFFMpegCspClass
{
GstVideoFilterClass parent_class;
};
G_END_DECLS
#endif /* __GST_FFMPEGCOLORSPACE_H__ */
This diff is collapsed.
This diff is collapsed.
/*
* default memory allocator for libavcodec
* Copyright (c) 2002 Fabrice Bellard.
*
* 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* @file mem.c
* default memory allocator for libavcodec.
*/
#include "avcodec.h"
/* here we can use OS dependant allocation functions */
#undef malloc
#undef free
#undef realloc
#include <stdlib.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
/* you can redefine av_malloc and av_free in your project to use your
memory allocator. You do not need to suppress this file because the
linker will do it automatically */
/**
* Memory allocation of size byte with alignment suitable for all
* memory accesses (including vectors if available on the
* CPU). av_malloc(0) must return a non NULL pointer.
*/
void *
av_malloc (unsigned int size)
{
void *ptr;
#ifdef MEMALIGN_HACK
int diff;
ptr = malloc (size + 16 + 1);
diff = ((-(int) ptr - 1) & 15) + 1;
ptr += diff;
((char *) ptr)[-1] = diff;
#elif defined (HAVE_MEMALIGN)
ptr = memalign (16, size);
/* Why 64?
Indeed, we should align it:
on 4 for 386
on 16 for 486
on 32 for 586, PPro - k6-III
on 64 for K7 (maybe for P3 too).
Because L1 and L2 caches are aligned on those values.
But I don't want to code such logic here!
*/
/* Why 16?
because some cpus need alignment, for example SSE2 on P4, & most RISC cpus
it will just trigger an exception and the unaligned load will be done in the
exception handler or it will just segfault (SSE2 on P4)
Why not larger? because i didnt see a difference in benchmarks ...
*/
/* benchmarks with p3
memalign(64)+1 3071,3051,3032
memalign(64)+2 3051,3032,3041
memalign(64)+4 2911,2896,2915
memalign(64)+8 2545,2554,2550
memalign(64)+16 2543,2572,2563
memalign(64)+32 2546,2545,2571
memalign(64)+64 2570,2533,2558
btw, malloc seems to do 8 byte alignment by default here
*/
#else
ptr = malloc (size);
#endif
return ptr;
}
/**
* av_realloc semantics (same as glibc): if ptr is NULL and size > 0,
* identical to malloc(size). If size is zero, it is identical to
* free(ptr) and NULL is returned.
*/
void *
av_realloc (void *ptr, unsigned int size)
{
#ifdef MEMALIGN_HACK
//FIXME this isnt aligned correctly though it probably isnt needed
int diff;
if (!ptr)
return av_malloc (size);
diff = ((char *) ptr)[-1];
return realloc (ptr - diff, size + diff) + diff;
#else
return realloc (ptr, size);
#endif
}
/* NOTE: ptr = NULL is explicetly allowed */
void
av_free (void *ptr)
{
/* XXX: this test should not be needed on most libcs */
if (ptr)
#ifdef MEMALIGN_HACK
free (ptr - ((char *) ptr)[-1]);
#else
free (ptr);
#endif
}
/*
* utils for libavcodec
* Copyright (c) 2001 Fabrice Bellard.
* Copyright (c) 2003 Michel Bardiaux for the av_log API
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
*
* 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* @file utils.c
* utils.
*/
#include "avcodec.h"
#include "dsputil.h"
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <limits.h>
void *
av_mallocz (unsigned int size)
{
void *ptr;
ptr = av_malloc (size);
if (!ptr)
return NULL;
memset (ptr, 0, size);
return ptr;
}
char *
av_strdup (const char *s)
{
char *ptr;
int len;
len = strlen (s) + 1;
ptr = av_malloc (len);
if (!ptr)
return NULL;
memcpy (ptr, s, len);
return ptr;
}
/**
* realloc which does nothing if the block is large enough
*/
void *
av_fast_realloc (void *ptr, unsigned int *size, unsigned int min_size)
{
if (min_size < *size)
return ptr;