mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
ffmpegcolorspace: remove plugin
This commit is contained in:
parent
db0a2f51b8
commit
35bec59536
16 changed files with 5 additions and 8820 deletions
|
@ -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"
|
||||||
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)
|
||||||
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
|
||||||
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
|
||||||
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 = \
|
||||||
$(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 \
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
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' \
|
|
||||||
> $@
|
|
|
@ -1,285 +0,0 @@
|
||||||
#ifndef AVCODEC_H
|
|
||||||
#define AVCODEC_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file avcodec.h
|
|
||||||
* external api header.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "_stdint.h"
|
|
||||||
|
|
||||||
#include <sys/types.h> /* size_t */
|
|
||||||
|
|
||||||
#define FFMPEG_VERSION_INT 0x000409
|
|
||||||
#define FFMPEG_VERSION "0.4.9-pre1"
|
|
||||||
#define LIBAVCODEC_BUILD 4728
|
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
|
|
||||||
#define LIBAVCODEC_VERSION FFMPEG_VERSION
|
|
||||||
|
|
||||||
#define AV_STRINGIFY(s) AV_TOSTRING(s)
|
|
||||||
#define AV_TOSTRING(s) #s
|
|
||||||
#define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)
|
|
||||||
|
|
||||||
enum CodecType {
|
|
||||||
CODEC_TYPE_UNKNOWN = -1,
|
|
||||||
CODEC_TYPE_VIDEO,
|
|
||||||
CODEC_TYPE_AUDIO,
|
|
||||||
CODEC_TYPE_DATA,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Pixel format. Notes:
|
|
||||||
*
|
|
||||||
* PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
|
|
||||||
* color is put together as:
|
|
||||||
* (A << 24) | (R << 16) | (G << 8) | B
|
|
||||||
* This is stored as BGRA on little endian CPU architectures and ARGB on
|
|
||||||
* big endian CPUs.
|
|
||||||
*
|
|
||||||
* When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
|
|
||||||
* image data is stored in AVFrame.data[0]. The palette is transported in
|
|
||||||
* AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
|
|
||||||
* formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
|
|
||||||
* also endian-specific). Note also that the individual RGB palette
|
|
||||||
* components stored in AVFrame.data[1] should be in the range 0..255.
|
|
||||||
* This is important as many custom PAL8 video codecs that were designed
|
|
||||||
* to run on the IBM VGA graphics adapter use 6-bit palette components.
|
|
||||||
*/
|
|
||||||
enum PixelFormat {
|
|
||||||
PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) (I420)
|
|
||||||
PIX_FMT_NV12, ///< Packed YUV 4:2:0 (separate Y plane, interleaved Cb & Cr planes)
|
|
||||||
PIX_FMT_NV21, ///< Packed YUV 4:2:0 (separate Y plane, interleaved Cb & Cr planes)
|
|
||||||
PIX_FMT_YVU420P, ///< Planar YUV 4:2:0 (1 Cb & Cr sample per 2x2 Y samples) (YV12)
|
|
||||||
PIX_FMT_YUV422, ///< Packed pixel, Y0 Cb Y1 Cr
|
|
||||||
PIX_FMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
|
|
||||||
PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
|
|
||||||
PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
|
|
||||||
PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
|
|
||||||
PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
|
|
||||||
PIX_FMT_BGRA32, ///< Packed pixel, 4 bytes per pixel, ARGBARGB...
|
|
||||||
PIX_FMT_ARGB32, ///< Packed pixel, 4 bytes per pixel, ABGRABGR..., stored in cpu endianness
|
|
||||||
PIX_FMT_ABGR32, ///< Packed pixel, 4 bytes per pixel, RGBARGBA...
|
|
||||||
PIX_FMT_RGB32, ///< Packed pixel, 4 bytes per pixel, BGRxBGRx..., stored in cpu endianness
|
|
||||||
PIX_FMT_xRGB32, ///< Packed pixel, 4 bytes per pixel, xBGRxBGR..., stored in cpu endianness
|
|
||||||
PIX_FMT_BGR32, ///< Packed pixel, 4 bytes per pixel, xRGBxRGB...
|
|
||||||
PIX_FMT_BGRx32, ///< Packed pixel, 4 bytes per pixel, RGBxRGBx...
|
|
||||||
PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
|
|
||||||
PIX_FMT_YVU410P, ///< Planar YVU 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
|
|
||||||
PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
|
|
||||||
PIX_FMT_Y800, ///< 8 bit Y plane (range [16-235])
|
|
||||||
PIX_FMT_Y16, ///< 16 bit Y plane (little endian)
|
|
||||||
PIX_FMT_RGB565, ///< always stored in cpu endianness
|
|
||||||
PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1
|
|
||||||
PIX_FMT_GRAY8,
|
|
||||||
PIX_FMT_GRAY16_L,
|
|
||||||
PIX_FMT_GRAY16_B,
|
|
||||||
PIX_FMT_MONOWHITE, ///< 0 is white
|
|
||||||
PIX_FMT_MONOBLACK, ///< 0 is black
|
|
||||||
PIX_FMT_PAL8, ///< 8 bit with RGBA palette
|
|
||||||
PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0 full scale (jpeg)
|
|
||||||
PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2 full scale (jpeg)
|
|
||||||
PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4 full scale (jpeg)
|
|
||||||
PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
|
|
||||||
PIX_FMT_XVMC_MPEG2_IDCT,
|
|
||||||
PIX_FMT_UYVY422, ///< Packed pixel, Cb Y0 Cr Y1
|
|
||||||
PIX_FMT_YVYU422, ///< Packed pixel, Y0 Cr Y1 Cb
|
|
||||||
PIX_FMT_UYVY411, ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3
|
|
||||||
PIX_FMT_V308, ///< Packed pixel, Y0 Cb Cr
|
|
||||||
|
|
||||||
PIX_FMT_AYUV4444, ///< Packed pixel, A0 Y0 Cb Cr
|
|
||||||
PIX_FMT_YUVA420P, ///< Planar YUV 4:4:2:0 (1 Cr & Cb sample per 2x2 Y & A samples) (A420)
|
|
||||||
PIX_FMT_NB
|
|
||||||
};
|
|
||||||
|
|
||||||
/* currently unused, may be used if 24/32 bits samples ever supported */
|
|
||||||
enum SampleFormat {
|
|
||||||
SAMPLE_FMT_S16 = 0, ///< signed 16 bits
|
|
||||||
};
|
|
||||||
|
|
||||||
/* thomas: extracted from imgconvert.c since it's also used in
|
|
||||||
* gstffmpegcodecmap.c */
|
|
||||||
|
|
||||||
/* start of extract */
|
|
||||||
|
|
||||||
#define FF_COLOR_RGB 0 /* RGB color space */
|
|
||||||
#define FF_COLOR_GRAY 1 /* gray color space */
|
|
||||||
#define FF_COLOR_YUV 2 /* YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
|
|
||||||
#define FF_COLOR_YUV_JPEG 3 /* YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
|
|
||||||
|
|
||||||
#define FF_PIXEL_PLANAR 0 /* each channel has one component in AVPicture */
|
|
||||||
#define FF_PIXEL_PACKED 1 /* only one components containing all the channels */
|
|
||||||
#define FF_PIXEL_PALETTE 2 /* one components containing indexes for a palette */
|
|
||||||
|
|
||||||
typedef struct PixFmtInfo
|
|
||||||
{
|
|
||||||
enum PixelFormat format;
|
|
||||||
const char *name;
|
|
||||||
uint8_t nb_channels; /* number of channels (including alpha) */
|
|
||||||
uint8_t color_type; /* color type (see FF_COLOR_xxx constants) */
|
|
||||||
uint8_t pixel_type; /* pixel storage type (see FF_PIXEL_xxx constants) */
|
|
||||||
uint8_t is_alpha:1; /* true if alpha can be specified */
|
|
||||||
uint8_t x_chroma_shift; /* X chroma subsampling factor is 2 ^ shift */
|
|
||||||
uint8_t y_chroma_shift; /* Y chroma subsampling factor is 2 ^ shift */
|
|
||||||
uint8_t depth; /* bit depth of the color components */
|
|
||||||
} PixFmtInfo;
|
|
||||||
|
|
||||||
PixFmtInfo * get_pix_fmt_info (enum PixelFormat format);
|
|
||||||
/* end of extract */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* main external api structure.
|
|
||||||
*/
|
|
||||||
typedef struct AVCodecContext {
|
|
||||||
/* video only */
|
|
||||||
/**
|
|
||||||
* frames per sec multiplied by frame_rate_base.
|
|
||||||
* for variable fps this is the precission, so if the timestamps
|
|
||||||
* can be specified in msec precssion then this is 1000*frame_rate_base
|
|
||||||
* - encoding: MUST be set by user
|
|
||||||
* - decoding: set by lavc. 0 or the frame_rate if available
|
|
||||||
*/
|
|
||||||
int frame_rate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* frame_rate_base.
|
|
||||||
* for variable fps this is 1
|
|
||||||
* - encoding: set by user.
|
|
||||||
* - decoding: set by lavc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int frame_rate_base;
|
|
||||||
/**
|
|
||||||
* picture width / height.
|
|
||||||
* - encoding: MUST be set by user.
|
|
||||||
* - decoding: set by lavc.
|
|
||||||
* Note, for compatibility its possible to set this instead of
|
|
||||||
* coded_width/height before decoding
|
|
||||||
*/
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pixel format, see PIX_FMT_xxx.
|
|
||||||
* - encoding: FIXME: used by ffmpeg to decide whether an pix_fmt
|
|
||||||
* conversion is in order. This only works for
|
|
||||||
* codecs with one supported pix_fmt, we should
|
|
||||||
* do something for a generic case as well.
|
|
||||||
* - decoding: set by lavc.
|
|
||||||
*/
|
|
||||||
enum PixelFormat pix_fmt;
|
|
||||||
|
|
||||||
/* audio only */
|
|
||||||
int sample_rate; ///< samples per sec
|
|
||||||
int channels;
|
|
||||||
int sample_fmt; ///< sample format, currenly unused
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Palette control structure
|
|
||||||
* - encoding: ??? (no palette-enabled encoder yet)
|
|
||||||
* - decoding: set by user.
|
|
||||||
*/
|
|
||||||
struct AVPaletteControl *palctrl;
|
|
||||||
} AVCodecContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* four components are given, that's all.
|
|
||||||
* the last component is alpha
|
|
||||||
*/
|
|
||||||
typedef struct AVPicture {
|
|
||||||
uint8_t *data[4];
|
|
||||||
int linesize[4]; ///< number of bytes per line
|
|
||||||
int interlaced;
|
|
||||||
} AVPicture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AVPaletteControl
|
|
||||||
* This structure defines a method for communicating palette changes
|
|
||||||
* between and demuxer and a decoder.
|
|
||||||
*/
|
|
||||||
#define AVPALETTE_SIZE 1024
|
|
||||||
#define AVPALETTE_COUNT 256
|
|
||||||
typedef struct AVPaletteControl {
|
|
||||||
|
|
||||||
/* demuxer sets this to 1 to indicate the palette has changed;
|
|
||||||
* decoder resets to 0 */
|
|
||||||
int palette_changed;
|
|
||||||
|
|
||||||
/* 4-byte ARGB palette entries, stored in native byte order; note that
|
|
||||||
* the individual palette components should be on a 8-bit scale; if
|
|
||||||
* the palette data comes from a IBM VGA native format, the component
|
|
||||||
* data is probably 6 bits in size and needs to be scaled */
|
|
||||||
unsigned int palette[AVPALETTE_COUNT];
|
|
||||||
|
|
||||||
} AVPaletteControl;
|
|
||||||
|
|
||||||
int avpicture_get_size(int pix_fmt, int width, int height);
|
|
||||||
|
|
||||||
void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
|
|
||||||
const char *avcodec_get_pix_fmt_name(int pix_fmt);
|
|
||||||
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
|
|
||||||
enum PixelFormat avcodec_get_pix_fmt(const char* name);
|
|
||||||
|
|
||||||
#define FF_LOSS_RESOLUTION 0x0001 /* loss due to resolution change */
|
|
||||||
#define FF_LOSS_DEPTH 0x0002 /* loss due to color depth change */
|
|
||||||
#define FF_LOSS_COLORSPACE 0x0004 /* loss due to color space conversion */
|
|
||||||
#define FF_LOSS_ALPHA 0x0008 /* loss of alpha bits */
|
|
||||||
#define FF_LOSS_COLORQUANT 0x0010 /* loss due to color quantization */
|
|
||||||
#define FF_LOSS_CHROMA 0x0020 /* loss of chroma (e.g. rgb to gray conversion) */
|
|
||||||
|
|
||||||
int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
|
|
||||||
int has_alpha);
|
|
||||||
int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
|
|
||||||
int has_alpha, int *loss_ptr);
|
|
||||||
|
|
||||||
#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
|
|
||||||
#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
|
|
||||||
int img_get_alpha_info(const AVPicture *src,
|
|
||||||
int pix_fmt, int width, int height);
|
|
||||||
|
|
||||||
/* convert among pixel formats */
|
|
||||||
int img_convert(AVPicture *dst, int dst_pix_fmt,
|
|
||||||
const AVPicture *src, int pix_fmt,
|
|
||||||
int width, int height);
|
|
||||||
|
|
||||||
void avcodec_init(void);
|
|
||||||
|
|
||||||
void avcodec_get_context_defaults(AVCodecContext *s);
|
|
||||||
AVCodecContext *avcodec_alloc_context(void);
|
|
||||||
|
|
||||||
/* memory */
|
|
||||||
void *av_malloc(unsigned int size);
|
|
||||||
void *av_mallocz(unsigned int size);
|
|
||||||
void *av_realloc(void *ptr, unsigned int size);
|
|
||||||
void av_free(void *ptr);
|
|
||||||
char *av_strdup(const char *s);
|
|
||||||
void av_freep(void *ptr);
|
|
||||||
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
|
|
||||||
/* for static data only */
|
|
||||||
/* call av_free_static to release all staticaly allocated tables */
|
|
||||||
void av_free_static(void);
|
|
||||||
void *av_mallocz_static(unsigned int size);
|
|
||||||
|
|
||||||
/* endian macros */
|
|
||||||
#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32)
|
|
||||||
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
|
|
||||||
#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
|
|
||||||
(((uint8_t*)(x))[1] << 16) | \
|
|
||||||
(((uint8_t*)(x))[2] << 8) | \
|
|
||||||
((uint8_t*)(x))[3])
|
|
||||||
#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
|
|
||||||
#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
|
|
||||||
(((uint8_t*)(x))[2] << 16) | \
|
|
||||||
(((uint8_t*)(x))[1] << 8) | \
|
|
||||||
((uint8_t*)(x))[0])
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* AVCODEC_H */
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
|
@ -1,181 +0,0 @@
|
||||||
<?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;"../../gst-libs";../../../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;"../../gst-libs";../../../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>
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,58 +0,0 @@
|
||||||
/* 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__ */
|
|
||||||
|
|
|
@ -1,482 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:element-ffmpegcolorspace
|
|
||||||
*
|
|
||||||
* Convert video frames between a great variety of colorspace formats.
|
|
||||||
*
|
|
||||||
* <refsect2>
|
|
||||||
* <title>Example launch line</title>
|
|
||||||
* |[
|
|
||||||
* gst-launch -v videotestsrc ! video/x-raw-yuv,format=\(fourcc\)YUY2 ! ffmpegcolorspace ! ximagesink
|
|
||||||
* ]|
|
|
||||||
* </refsect2>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gstffmpegcolorspace.h"
|
|
||||||
#include "gstffmpegcodecmap.h"
|
|
||||||
#include <gst/video/video.h>
|
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (ffmpegcolorspace_debug);
|
|
||||||
#define GST_CAT_DEFAULT ffmpegcolorspace_debug
|
|
||||||
GST_DEBUG_CATEGORY (ffmpegcolorspace_performance);
|
|
||||||
|
|
||||||
#define FFMPEGCSP_VIDEO_CAPS \
|
|
||||||
"video/x-raw-yuv, width = "GST_VIDEO_SIZE_RANGE" , " \
|
|
||||||
"height="GST_VIDEO_SIZE_RANGE",framerate="GST_VIDEO_FPS_RANGE"," \
|
|
||||||
"format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, A420} ;" \
|
|
||||||
GST_VIDEO_CAPS_RGB";" \
|
|
||||||
GST_VIDEO_CAPS_BGR";" \
|
|
||||||
GST_VIDEO_CAPS_RGBx";" \
|
|
||||||
GST_VIDEO_CAPS_xRGB";" \
|
|
||||||
GST_VIDEO_CAPS_BGRx";" \
|
|
||||||
GST_VIDEO_CAPS_xBGR";" \
|
|
||||||
GST_VIDEO_CAPS_RGBA";" \
|
|
||||||
GST_VIDEO_CAPS_ARGB";" \
|
|
||||||
GST_VIDEO_CAPS_BGRA";" \
|
|
||||||
GST_VIDEO_CAPS_ABGR";" \
|
|
||||||
GST_VIDEO_CAPS_RGB_16";" \
|
|
||||||
GST_VIDEO_CAPS_RGB_15";" \
|
|
||||||
"video/x-raw-rgb, bpp = (int)8, depth = (int)8, " \
|
|
||||||
"width = "GST_VIDEO_SIZE_RANGE" , " \
|
|
||||||
"height = " GST_VIDEO_SIZE_RANGE ", " \
|
|
||||||
"framerate = "GST_VIDEO_FPS_RANGE ";" \
|
|
||||||
GST_VIDEO_CAPS_GRAY8";" \
|
|
||||||
GST_VIDEO_CAPS_GRAY16("BIG_ENDIAN")";" \
|
|
||||||
GST_VIDEO_CAPS_GRAY16("LITTLE_ENDIAN")";"
|
|
||||||
|
|
||||||
static GstStaticPadTemplate gst_ffmpegcsp_src_template =
|
|
||||||
GST_STATIC_PAD_TEMPLATE ("src",
|
|
||||||
GST_PAD_SRC,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS (FFMPEGCSP_VIDEO_CAPS)
|
|
||||||
);
|
|
||||||
|
|
||||||
static GstStaticPadTemplate gst_ffmpegcsp_sink_template =
|
|
||||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
||||||
GST_PAD_SINK,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS (FFMPEGCSP_VIDEO_CAPS)
|
|
||||||
);
|
|
||||||
|
|
||||||
GType gst_ffmpegcsp_get_type (void);
|
|
||||||
|
|
||||||
static gboolean gst_ffmpegcsp_set_caps (GstBaseTransform * btrans,
|
|
||||||
GstCaps * incaps, GstCaps * outcaps);
|
|
||||||
static gboolean gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans,
|
|
||||||
GstCaps * caps, gsize * size);
|
|
||||||
static GstFlowReturn gst_ffmpegcsp_transform (GstBaseTransform * btrans,
|
|
||||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
|
||||||
|
|
||||||
static GQuark _QRAWRGB; /* "video/x-raw-rgb" */
|
|
||||||
static GQuark _QRAWYUV; /* "video/x-raw-yuv" */
|
|
||||||
static GQuark _QALPHAMASK; /* "alpha_mask" */
|
|
||||||
|
|
||||||
/* copies the given caps */
|
|
||||||
static GstCaps *
|
|
||||||
gst_ffmpegcsp_caps_remove_format_info (GstCaps * caps)
|
|
||||||
{
|
|
||||||
GstStructure *yuvst, *rgbst, *grayst;
|
|
||||||
gint i, n;
|
|
||||||
GstCaps *res;
|
|
||||||
|
|
||||||
res = gst_caps_new_empty ();
|
|
||||||
|
|
||||||
n = gst_caps_get_size (caps);
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
yuvst = gst_caps_get_structure (caps, i);
|
|
||||||
|
|
||||||
/* If this is already expressed by the existing caps
|
|
||||||
* skip this structure */
|
|
||||||
if (i > 0 && gst_caps_is_subset_structure (res, yuvst))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
yuvst = gst_structure_copy (yuvst);
|
|
||||||
gst_structure_set_name (yuvst, "video/x-raw-yuv");
|
|
||||||
gst_structure_remove_fields (yuvst, "format", "endianness", "depth",
|
|
||||||
"bpp", "red_mask", "green_mask", "blue_mask", "alpha_mask",
|
|
||||||
"palette_data", NULL);
|
|
||||||
|
|
||||||
rgbst = gst_structure_copy (yuvst);
|
|
||||||
gst_structure_set_name (rgbst, "video/x-raw-rgb");
|
|
||||||
gst_structure_remove_fields (rgbst, "color-matrix", "chroma-site", NULL);
|
|
||||||
|
|
||||||
grayst = gst_structure_copy (rgbst);
|
|
||||||
gst_structure_set_name (grayst, "video/x-raw-gray");
|
|
||||||
|
|
||||||
gst_caps_append_structure (res, yuvst);
|
|
||||||
gst_caps_append_structure (res, rgbst);
|
|
||||||
gst_caps_append_structure (res, grayst);
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The caps can be transformed into any other caps with format info removed.
|
|
||||||
* However, we should prefer passthrough, so if passthrough is possible,
|
|
||||||
* put it first in the list. */
|
|
||||||
static GstCaps *
|
|
||||||
gst_ffmpegcsp_transform_caps (GstBaseTransform * btrans,
|
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
|
|
||||||
{
|
|
||||||
GstCaps *tmp, *tmp2;
|
|
||||||
GstCaps *result;
|
|
||||||
|
|
||||||
/* Get all possible caps that we can transform to */
|
|
||||||
tmp = gst_ffmpegcsp_caps_remove_format_info (caps);
|
|
||||||
|
|
||||||
if (filter) {
|
|
||||||
tmp2 = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
|
|
||||||
gst_caps_unref (tmp);
|
|
||||||
tmp = tmp2;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = tmp;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (btrans, "transformed %" GST_PTR_FORMAT " into %"
|
|
||||||
GST_PTR_FORMAT, caps, result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
|
||||||
GstCaps * outcaps)
|
|
||||||
{
|
|
||||||
GstFFMpegCsp *space;
|
|
||||||
GstStructure *structure;
|
|
||||||
gint in_height, in_width;
|
|
||||||
gint out_height, out_width;
|
|
||||||
const GValue *in_framerate = NULL;
|
|
||||||
const GValue *out_framerate = NULL;
|
|
||||||
const GValue *in_par = NULL;
|
|
||||||
const GValue *out_par = NULL;
|
|
||||||
AVCodecContext *ctx;
|
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
space = GST_FFMPEGCSP (btrans);
|
|
||||||
|
|
||||||
/* parse in and output values */
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
|
||||||
|
|
||||||
/* we have to have width and height */
|
|
||||||
res = gst_structure_get_int (structure, "width", &in_width);
|
|
||||||
res &= gst_structure_get_int (structure, "height", &in_height);
|
|
||||||
if (!res)
|
|
||||||
goto no_width_height;
|
|
||||||
|
|
||||||
/* and framerate */
|
|
||||||
in_framerate = gst_structure_get_value (structure, "framerate");
|
|
||||||
if (in_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (in_framerate))
|
|
||||||
goto no_framerate;
|
|
||||||
|
|
||||||
/* this is optional */
|
|
||||||
in_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
|
|
||||||
|
|
||||||
structure = gst_caps_get_structure (outcaps, 0);
|
|
||||||
|
|
||||||
/* we have to have width and height */
|
|
||||||
res = gst_structure_get_int (structure, "width", &out_width);
|
|
||||||
res &= gst_structure_get_int (structure, "height", &out_height);
|
|
||||||
if (!res)
|
|
||||||
goto no_width_height;
|
|
||||||
|
|
||||||
/* and framerate */
|
|
||||||
out_framerate = gst_structure_get_value (structure, "framerate");
|
|
||||||
if (out_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (out_framerate))
|
|
||||||
goto no_framerate;
|
|
||||||
|
|
||||||
/* this is optional */
|
|
||||||
out_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
|
|
||||||
|
|
||||||
/* these must match */
|
|
||||||
if (in_width != out_width || in_height != out_height ||
|
|
||||||
gst_value_compare (in_framerate, out_framerate) != GST_VALUE_EQUAL)
|
|
||||||
goto format_mismatch;
|
|
||||||
|
|
||||||
/* if present, these must match too */
|
|
||||||
if (in_par && out_par
|
|
||||||
&& gst_value_compare (in_par, out_par) != GST_VALUE_EQUAL)
|
|
||||||
goto format_mismatch;
|
|
||||||
|
|
||||||
ctx = avcodec_alloc_context ();
|
|
||||||
|
|
||||||
space->width = ctx->width = in_width;
|
|
||||||
space->height = ctx->height = in_height;
|
|
||||||
|
|
||||||
space->interlaced = FALSE;
|
|
||||||
gst_structure_get_boolean (structure, "interlaced", &space->interlaced);
|
|
||||||
|
|
||||||
/* get from format */
|
|
||||||
ctx->pix_fmt = PIX_FMT_NB;
|
|
||||||
gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, incaps, ctx);
|
|
||||||
if (ctx->pix_fmt == PIX_FMT_NB)
|
|
||||||
goto invalid_in_caps;
|
|
||||||
space->from_pixfmt = ctx->pix_fmt;
|
|
||||||
|
|
||||||
/* palette, only for from data */
|
|
||||||
if (space->palette)
|
|
||||||
av_free (space->palette);
|
|
||||||
space->palette = ctx->palctrl;
|
|
||||||
ctx->palctrl = NULL;
|
|
||||||
|
|
||||||
/* get to format */
|
|
||||||
ctx->pix_fmt = PIX_FMT_NB;
|
|
||||||
gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, outcaps, ctx);
|
|
||||||
if (ctx->pix_fmt == PIX_FMT_NB)
|
|
||||||
goto invalid_out_caps;
|
|
||||||
space->to_pixfmt = ctx->pix_fmt;
|
|
||||||
|
|
||||||
GST_DEBUG ("reconfigured %d %d", space->from_pixfmt, space->to_pixfmt);
|
|
||||||
|
|
||||||
av_free (ctx);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* ERRORS */
|
|
||||||
no_width_height:
|
|
||||||
{
|
|
||||||
GST_DEBUG_OBJECT (space, "did not specify width or height");
|
|
||||||
space->from_pixfmt = PIX_FMT_NB;
|
|
||||||
space->to_pixfmt = PIX_FMT_NB;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
no_framerate:
|
|
||||||
{
|
|
||||||
GST_DEBUG_OBJECT (space, "did not specify framerate");
|
|
||||||
space->from_pixfmt = PIX_FMT_NB;
|
|
||||||
space->to_pixfmt = PIX_FMT_NB;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
format_mismatch:
|
|
||||||
{
|
|
||||||
GST_DEBUG_OBJECT (space, "input and output formats do not match");
|
|
||||||
space->from_pixfmt = PIX_FMT_NB;
|
|
||||||
space->to_pixfmt = PIX_FMT_NB;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
invalid_in_caps:
|
|
||||||
{
|
|
||||||
GST_DEBUG_OBJECT (space, "could not configure context for input format");
|
|
||||||
av_free (ctx);
|
|
||||||
space->from_pixfmt = PIX_FMT_NB;
|
|
||||||
space->to_pixfmt = PIX_FMT_NB;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
invalid_out_caps:
|
|
||||||
{
|
|
||||||
GST_DEBUG_OBJECT (space, "could not configure context for output format");
|
|
||||||
av_free (ctx);
|
|
||||||
space->from_pixfmt = PIX_FMT_NB;
|
|
||||||
space->to_pixfmt = PIX_FMT_NB;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define gst_ffmpegcsp_parent_class parent_class
|
|
||||||
G_DEFINE_TYPE (GstFFMpegCsp, gst_ffmpegcsp, GST_TYPE_VIDEO_FILTER);
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_ffmpegcsp_finalize (GObject * obj)
|
|
||||||
{
|
|
||||||
GstFFMpegCsp *space = GST_FFMPEGCSP (obj);
|
|
||||||
|
|
||||||
if (space->palette)
|
|
||||||
av_free (space->palette);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_ffmpegcsp_class_init (GstFFMpegCspClass * klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
|
||||||
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
|
||||||
GstBaseTransformClass *gstbasetransform_class =
|
|
||||||
(GstBaseTransformClass *) klass;
|
|
||||||
|
|
||||||
_QRAWRGB = g_quark_from_string ("video/x-raw-rgb");
|
|
||||||
_QRAWYUV = g_quark_from_string ("video/x-raw-yuv");
|
|
||||||
_QALPHAMASK = g_quark_from_string ("alpha_mask");
|
|
||||||
|
|
||||||
gobject_class->finalize = gst_ffmpegcsp_finalize;
|
|
||||||
|
|
||||||
gst_element_class_add_pad_template (gstelement_class,
|
|
||||||
gst_static_pad_template_get (&gst_ffmpegcsp_src_template));
|
|
||||||
gst_element_class_add_pad_template (gstelement_class,
|
|
||||||
gst_static_pad_template_get (&gst_ffmpegcsp_sink_template));
|
|
||||||
|
|
||||||
gst_element_class_set_details_simple (gstelement_class,
|
|
||||||
"FFMPEG Colorspace converter", "Filter/Converter/Video",
|
|
||||||
"Converts video from one colorspace to another",
|
|
||||||
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
|
|
||||||
|
|
||||||
gstbasetransform_class->transform_caps =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_ffmpegcsp_transform_caps);
|
|
||||||
gstbasetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_ffmpegcsp_set_caps);
|
|
||||||
gstbasetransform_class->get_unit_size =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_ffmpegcsp_get_unit_size);
|
|
||||||
gstbasetransform_class->transform =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_ffmpegcsp_transform);
|
|
||||||
|
|
||||||
gstbasetransform_class->passthrough_on_same_caps = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_ffmpegcsp_init (GstFFMpegCsp * space)
|
|
||||||
{
|
|
||||||
space->from_pixfmt = space->to_pixfmt = PIX_FMT_NB;
|
|
||||||
space->palette = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
|
||||||
gsize * size)
|
|
||||||
{
|
|
||||||
GstStructure *structure = NULL;
|
|
||||||
AVCodecContext *ctx = NULL;
|
|
||||||
gboolean ret = TRUE;
|
|
||||||
gint width, height;
|
|
||||||
|
|
||||||
g_assert (size);
|
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
|
||||||
gst_structure_get_int (structure, "width", &width);
|
|
||||||
gst_structure_get_int (structure, "height", &height);
|
|
||||||
|
|
||||||
ctx = avcodec_alloc_context ();
|
|
||||||
|
|
||||||
g_assert (ctx != NULL);
|
|
||||||
|
|
||||||
ctx->pix_fmt = PIX_FMT_NB;
|
|
||||||
|
|
||||||
gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx);
|
|
||||||
|
|
||||||
if (G_UNLIKELY (ctx->pix_fmt == PIX_FMT_NB)) {
|
|
||||||
ret = FALSE;
|
|
||||||
goto beach;
|
|
||||||
}
|
|
||||||
|
|
||||||
*size = avpicture_get_size (ctx->pix_fmt, width, height);
|
|
||||||
|
|
||||||
/* ffmpeg frames have the palette after the frame data, whereas
|
|
||||||
* GStreamer currently puts it into the caps as 'palette_data' field,
|
|
||||||
* so for paletted data the frame size avpicture_get_size() returns is
|
|
||||||
* 1024 bytes larger than what GStreamer expects. */
|
|
||||||
if (gst_structure_has_field (structure, "palette_data") &&
|
|
||||||
ctx->pix_fmt == PIX_FMT_PAL8) {
|
|
||||||
*size -= 4 * 256; /* = AVPALETTE_SIZE */
|
|
||||||
}
|
|
||||||
|
|
||||||
beach:
|
|
||||||
|
|
||||||
if (ctx->palctrl)
|
|
||||||
av_free (ctx->palctrl);
|
|
||||||
av_free (ctx);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstFlowReturn
|
|
||||||
gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf,
|
|
||||||
GstBuffer * outbuf)
|
|
||||||
{
|
|
||||||
GstFFMpegCsp *space;
|
|
||||||
gint result;
|
|
||||||
guint8 *indata, *outdata;
|
|
||||||
gsize insize, outsize;
|
|
||||||
|
|
||||||
space = GST_FFMPEGCSP (btrans);
|
|
||||||
|
|
||||||
GST_DEBUG ("from %d -> to %d", space->from_pixfmt, space->to_pixfmt);
|
|
||||||
|
|
||||||
if (G_UNLIKELY (space->from_pixfmt == PIX_FMT_NB ||
|
|
||||||
space->to_pixfmt == PIX_FMT_NB))
|
|
||||||
goto unknown_format;
|
|
||||||
|
|
||||||
/* fill from with source data */
|
|
||||||
indata = gst_buffer_map (inbuf, &insize, NULL, GST_MAP_READ);
|
|
||||||
gst_ffmpegcsp_avpicture_fill (&space->from_frame,
|
|
||||||
indata, space->from_pixfmt, space->width, space->height,
|
|
||||||
space->interlaced);
|
|
||||||
|
|
||||||
/* fill optional palette */
|
|
||||||
if (space->palette)
|
|
||||||
space->from_frame.data[1] = (uint8_t *) space->palette->palette;
|
|
||||||
|
|
||||||
/* fill target frame */
|
|
||||||
outdata = gst_buffer_map (outbuf, &outsize, NULL, GST_MAP_WRITE);
|
|
||||||
gst_ffmpegcsp_avpicture_fill (&space->to_frame,
|
|
||||||
outdata, space->to_pixfmt, space->width, space->height,
|
|
||||||
space->interlaced);
|
|
||||||
|
|
||||||
/* and convert */
|
|
||||||
result = img_convert (&space->to_frame, space->to_pixfmt,
|
|
||||||
&space->from_frame, space->from_pixfmt, space->width, space->height);
|
|
||||||
gst_buffer_unmap (outbuf, outdata, outsize);
|
|
||||||
gst_buffer_unmap (inbuf, indata, insize);
|
|
||||||
|
|
||||||
if (result == -1)
|
|
||||||
goto not_supported;
|
|
||||||
|
|
||||||
/* baseclass copies timestamps */
|
|
||||||
GST_DEBUG ("from %d -> to %d done", space->from_pixfmt, space->to_pixfmt);
|
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
|
|
||||||
/* ERRORS */
|
|
||||||
unknown_format:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL),
|
|
||||||
("attempting to convert colorspaces between unknown formats"));
|
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
|
||||||
}
|
|
||||||
not_supported:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL),
|
|
||||||
("cannot convert between formats"));
|
|
||||||
return GST_FLOW_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
plugin_init (GstPlugin * plugin)
|
|
||||||
{
|
|
||||||
GST_DEBUG_CATEGORY_INIT (ffmpegcolorspace_debug, "ffmpegcolorspace", 0,
|
|
||||||
"FFMPEG-based colorspace converter");
|
|
||||||
GST_DEBUG_CATEGORY_GET (ffmpegcolorspace_performance, "GST_PERFORMANCE");
|
|
||||||
|
|
||||||
avcodec_init ();
|
|
||||||
|
|
||||||
return gst_element_register (plugin, "ffmpegcolorspace",
|
|
||||||
GST_RANK_NONE, GST_TYPE_FFMPEGCSP);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
|
||||||
"ffmpegcolorspace",
|
|
||||||
"colorspace conversion copied from FFMpeg " FFMPEG_VERSION,
|
|
||||||
plugin_init, VERSION, "LGPL", "FFMpeg", "http://ffmpeg.sourceforge.net/")
|
|
|
@ -1,63 +0,0 @@
|
||||||
/* 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__ */
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,125 +0,0 @@
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
}
|
|
|
@ -1,159 +0,0 @@
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
*size = 17 * min_size / 16 + 32;
|
|
||||||
|
|
||||||
return av_realloc (ptr, *size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned int last_static = 0;
|
|
||||||
static unsigned int allocated_static = 0;
|
|
||||||
static void **array_static = NULL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* allocation of static arrays - do not use for normal allocation.
|
|
||||||
*/
|
|
||||||
void *
|
|
||||||
av_mallocz_static (unsigned int size)
|
|
||||||
{
|
|
||||||
void *ptr = av_mallocz (size);
|
|
||||||
|
|
||||||
if (ptr) {
|
|
||||||
array_static =
|
|
||||||
av_fast_realloc (array_static, &allocated_static,
|
|
||||||
sizeof (void *) * (last_static + 1));
|
|
||||||
array_static[last_static++] = ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* free all static arrays and reset pointers to 0.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
av_free_static (void)
|
|
||||||
{
|
|
||||||
while (last_static) {
|
|
||||||
av_freep (&array_static[--last_static]);
|
|
||||||
}
|
|
||||||
av_freep (&array_static);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frees memory and sets the pointer to NULL.
|
|
||||||
* @param arg pointer to the pointer which should be freed
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
av_freep (void *arg)
|
|
||||||
{
|
|
||||||
void **ptr = (void **) arg;
|
|
||||||
|
|
||||||
av_free (*ptr);
|
|
||||||
*ptr = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
avcodec_get_context_defaults (AVCodecContext * s)
|
|
||||||
{
|
|
||||||
memset (s, 0, sizeof (AVCodecContext));
|
|
||||||
|
|
||||||
s->frame_rate_base = 1;
|
|
||||||
s->frame_rate = 25;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* allocates a AVCodecContext and set it to defaults.
|
|
||||||
* this can be deallocated by simply calling free()
|
|
||||||
*/
|
|
||||||
AVCodecContext *
|
|
||||||
avcodec_alloc_context (void)
|
|
||||||
{
|
|
||||||
AVCodecContext *avctx = av_malloc (sizeof (AVCodecContext));
|
|
||||||
|
|
||||||
if (avctx == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
avcodec_get_context_defaults (avctx);
|
|
||||||
|
|
||||||
return avctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* must be called before any other functions */
|
|
||||||
void
|
|
||||||
avcodec_init (void)
|
|
||||||
{
|
|
||||||
static int inited = 0;
|
|
||||||
|
|
||||||
if (inited != 0)
|
|
||||||
return;
|
|
||||||
inited = 1;
|
|
||||||
|
|
||||||
dsputil_static_init ();
|
|
||||||
}
|
|
|
@ -1116,13 +1116,13 @@ gen_video_deinterlace_chain (GstPlaySink * playsink)
|
||||||
bin = GST_BIN_CAST (chain->chain.bin);
|
bin = GST_BIN_CAST (chain->chain.bin);
|
||||||
gst_object_ref_sink (bin);
|
gst_object_ref_sink (bin);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (playsink, "creating ffmpegcolorspace");
|
GST_DEBUG_OBJECT (playsink, "creating videoconvert");
|
||||||
chain->conv = gst_element_factory_make ("ffmpegcolorspace", "vdconv");
|
chain->conv = gst_element_factory_make ("videoconvert", "vdconv");
|
||||||
if (chain->conv == NULL) {
|
if (chain->conv == NULL) {
|
||||||
post_missing_element_message (playsink, "ffmpegcolorspace");
|
post_missing_element_message (playsink, "videoconvert");
|
||||||
GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
|
GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
|
||||||
(_("Missing element '%s' - check your GStreamer installation."),
|
(_("Missing element '%s' - check your GStreamer installation."),
|
||||||
"ffmpegcolorspace"), ("video rendering might fail"));
|
"videoconvert"), ("video rendering might fail"));
|
||||||
} else {
|
} else {
|
||||||
gst_bin_add (bin, chain->conv);
|
gst_bin_add (bin, chain->conv);
|
||||||
head = chain->conv;
|
head = chain->conv;
|
||||||
|
|
Loading…
Reference in a new issue