mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
expand tabs
Original commit message from CVS: expand tabs
This commit is contained in:
parent
6ba0fee53f
commit
9783a9207a
9 changed files with 237 additions and 214 deletions
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
|||
2005-12-06 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
|
||||
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_pixfmt),
|
||||
(gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid):
|
||||
* ext/ffmpeg/gstffmpegcodecmap.h:
|
||||
* ext/ffmpeg/gstffmpegdeinterlace.c:
|
||||
(gst_ffmpegdeinterlace_pad_link), (gst_ffmpegdeinterlace_init),
|
||||
(gst_ffmpegdeinterlace_chain):
|
||||
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_class_init),
|
||||
(gst_ffmpegenc_chain_audio):
|
||||
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_loop):
|
||||
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_write):
|
||||
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_pad_link),
|
||||
(gst_ffmpegscale_init), (gst_ffmpegscale_chain),
|
||||
(gst_ffmpegscale_change_state):
|
||||
* ext/libpostproc/gstpostproc.c: (change_context), (change_mode),
|
||||
(gst_postproc_base_init), (gst_postproc_class_init),
|
||||
(gst_postproc_init), (gst_postproc_link), (gst_postproc_chain),
|
||||
(gst_postproc_change_state), (gst_postproc_set_property),
|
||||
(gst_postproc_get_property), (gst_postproc_register):
|
||||
expand tabs
|
||||
|
||||
=== release 0.10.0 ===
|
||||
|
||||
2005-12-05 <thomas (at) apestaart (dot) org>
|
||||
|
|
|
@ -81,34 +81,34 @@ gst_ffmpeg_set_palette (GstCaps *caps, AVCodecContext *context)
|
|||
* but I'm too lazy today. Maybe later.
|
||||
*/
|
||||
|
||||
#define GST_FF_VID_CAPS_NEW(mimetype, ...) \
|
||||
(context != NULL) ? \
|
||||
gst_caps_new_simple (mimetype, \
|
||||
"width", G_TYPE_INT, context->width, \
|
||||
"height", G_TYPE_INT, context->height, \
|
||||
"framerate", GST_TYPE_FRACTION, context->time_base.den, \
|
||||
context->time_base.num, __VA_ARGS__, NULL) \
|
||||
: \
|
||||
gst_caps_new_simple (mimetype, \
|
||||
"width", GST_TYPE_INT_RANGE, 16, 4096, \
|
||||
"height", GST_TYPE_INT_RANGE, 16, 4096, \
|
||||
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, \
|
||||
#define GST_FF_VID_CAPS_NEW(mimetype, ...) \
|
||||
(context != NULL) ? \
|
||||
gst_caps_new_simple (mimetype, \
|
||||
"width", G_TYPE_INT, context->width, \
|
||||
"height", G_TYPE_INT, context->height, \
|
||||
"framerate", GST_TYPE_FRACTION, context->time_base.den, \
|
||||
context->time_base.num, __VA_ARGS__, NULL) \
|
||||
: \
|
||||
gst_caps_new_simple (mimetype, \
|
||||
"width", GST_TYPE_INT_RANGE, 16, 4096, \
|
||||
"height", GST_TYPE_INT_RANGE, 16, 4096, \
|
||||
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, \
|
||||
G_MAXINT, 1, __VA_ARGS__, NULL)
|
||||
|
||||
/* same for audio - now with channels/sample rate
|
||||
*/
|
||||
|
||||
#define GST_FF_AUD_CAPS_NEW(mimetype, ...) \
|
||||
(context != NULL) ? \
|
||||
gst_caps_new_simple (mimetype, \
|
||||
"rate", G_TYPE_INT, context->sample_rate, \
|
||||
"channels", G_TYPE_INT, context->channels, \
|
||||
__VA_ARGS__, NULL) \
|
||||
: \
|
||||
gst_caps_new_simple (mimetype, \
|
||||
"rate", GST_TYPE_INT_RANGE, 8000, 96000, \
|
||||
"channels", GST_TYPE_INT_RANGE, 1, 2, \
|
||||
__VA_ARGS__, NULL)
|
||||
#define GST_FF_AUD_CAPS_NEW(mimetype, ...) \
|
||||
(context != NULL) ? \
|
||||
gst_caps_new_simple (mimetype, \
|
||||
"rate", G_TYPE_INT, context->sample_rate, \
|
||||
"channels", G_TYPE_INT, context->channels, \
|
||||
__VA_ARGS__, NULL) \
|
||||
: \
|
||||
gst_caps_new_simple (mimetype, \
|
||||
"rate", GST_TYPE_INT_RANGE, 8000, 96000, \
|
||||
"channels", GST_TYPE_INT_RANGE, 1, 2, \
|
||||
__VA_ARGS__, NULL)
|
||||
|
||||
/* Convert a FFMPEG codec ID and optional AVCodecContext
|
||||
* to a GstCaps. If the context is ommitted, no fixed values
|
||||
|
@ -259,7 +259,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
|||
switch (context->codec_tag) {
|
||||
case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'):
|
||||
caps = GST_FF_VID_CAPS_NEW ("video/x-divx",
|
||||
"divxversion", G_TYPE_INT, 5, NULL);
|
||||
"divxversion", G_TYPE_INT, 5, NULL);
|
||||
break;
|
||||
case GST_MAKE_FOURCC ('m', 'p', '4', 'v'):
|
||||
default:
|
||||
|
@ -450,10 +450,10 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
|||
|
||||
case CODEC_ID_MSRLE:
|
||||
caps = GST_FF_VID_CAPS_NEW ("video/x-rle",
|
||||
"layout", G_TYPE_STRING, "microsoft", NULL);
|
||||
"layout", G_TYPE_STRING, "microsoft", NULL);
|
||||
if (context) {
|
||||
gst_caps_set_simple (caps,
|
||||
"depth", G_TYPE_INT, (gint) context->bits_per_sample, NULL);
|
||||
"depth", G_TYPE_INT, (gint) context->bits_per_sample, NULL);
|
||||
} else {
|
||||
gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL);
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
|||
|
||||
case CODEC_ID_MSVIDEO1:
|
||||
caps = GST_FF_VID_CAPS_NEW ("video/x-msvideocodec",
|
||||
"msvideoversion", G_TYPE_INT, 1, NULL);
|
||||
"msvideoversion", G_TYPE_INT, 1, NULL);
|
||||
break;
|
||||
|
||||
case CODEC_ID_WMV3:
|
||||
|
@ -899,8 +899,8 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
|
|||
case PIX_FMT_GRAY8:
|
||||
bpp = depth = 8;
|
||||
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-gray",
|
||||
"bpp", G_TYPE_INT, bpp,
|
||||
"depth", G_TYPE_INT, depth, NULL);
|
||||
"bpp", G_TYPE_INT, bpp,
|
||||
"depth", G_TYPE_INT, depth, NULL);
|
||||
break;
|
||||
default:
|
||||
/* give up ... */
|
||||
|
@ -910,28 +910,28 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
|
|||
if (caps == NULL) {
|
||||
if (bpp != 0) {
|
||||
if (r_mask != 0) {
|
||||
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
|
||||
"bpp", G_TYPE_INT, bpp,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"red_mask", G_TYPE_INT, r_mask,
|
||||
"green_mask", G_TYPE_INT, g_mask,
|
||||
"blue_mask", G_TYPE_INT, b_mask,
|
||||
"endianness", G_TYPE_INT, endianness, NULL);
|
||||
if (a_mask) {
|
||||
gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, a_mask, NULL);
|
||||
}
|
||||
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
|
||||
"bpp", G_TYPE_INT, bpp,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"red_mask", G_TYPE_INT, r_mask,
|
||||
"green_mask", G_TYPE_INT, g_mask,
|
||||
"blue_mask", G_TYPE_INT, b_mask,
|
||||
"endianness", G_TYPE_INT, endianness, NULL);
|
||||
if (a_mask) {
|
||||
gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, a_mask, NULL);
|
||||
}
|
||||
} else {
|
||||
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
|
||||
"bpp", G_TYPE_INT, bpp,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"endianness", G_TYPE_INT, endianness, NULL);
|
||||
if (context) {
|
||||
gst_ffmpeg_set_palette (caps, context);
|
||||
}
|
||||
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
|
||||
"bpp", G_TYPE_INT, bpp,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"endianness", G_TYPE_INT, endianness, NULL);
|
||||
if (context) {
|
||||
gst_ffmpeg_set_palette (caps, context);
|
||||
}
|
||||
}
|
||||
} else if (fmt) {
|
||||
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-yuv",
|
||||
"format", GST_TYPE_FOURCC, fmt, NULL);
|
||||
"format", GST_TYPE_FOURCC, fmt, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1116,8 +1116,8 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
|
|||
context->time_base.num = gst_value_get_fraction_denominator (fps);
|
||||
|
||||
GST_DEBUG ("setting framerate %d/%d = %lf",
|
||||
context->time_base.den, context->time_base.num,
|
||||
1. * context->time_base.den / context->time_base.num);
|
||||
context->time_base.den, context->time_base.num,
|
||||
1. * context->time_base.den / context->time_base.num);
|
||||
}
|
||||
|
||||
if (!raw)
|
||||
|
@ -1273,7 +1273,7 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
|||
if (!context->extradata) {
|
||||
gint halfpel_flag, thirdpel_flag, low_delay, unknown_svq3_flag;
|
||||
guint16 flags;
|
||||
|
||||
|
||||
if (gst_structure_get_int (str, "halfpel_flag", &halfpel_flag) ||
|
||||
gst_structure_get_int (str, "thirdpel_flag", &thirdpel_flag) ||
|
||||
gst_structure_get_int (str, "low_delay", &low_delay) ||
|
||||
|
@ -1872,7 +1872,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
|
|||
if ((codec = avcodec_find_decoder_by_name (ext)) ||
|
||||
(codec = avcodec_find_encoder_by_name (ext))) {
|
||||
id = codec->id;
|
||||
audio = TRUE;
|
||||
audio = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (!strncmp (mimetype, "video/x-gst_ff-", 15)) {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
GstCaps *
|
||||
gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
||||
AVCodecContext *context,
|
||||
gboolean encode);
|
||||
gboolean encode);
|
||||
|
||||
/*
|
||||
* _codectype_to_caps () gets the GstCaps that belongs to
|
||||
|
@ -63,9 +63,9 @@ gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
|
|||
|
||||
void
|
||||
gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
||||
enum CodecType codec_type,
|
||||
const GstCaps *caps,
|
||||
AVCodecContext *context);
|
||||
enum CodecType codec_type,
|
||||
const GstCaps *caps,
|
||||
AVCodecContext *context);
|
||||
|
||||
/*
|
||||
* caps_with_codectype () transforms a GstCaps that belongs to
|
||||
|
@ -95,8 +95,8 @@ gst_ffmpeg_formatid_to_caps (const gchar *format_name);
|
|||
|
||||
gboolean
|
||||
gst_ffmpeg_formatid_get_codecids (const gchar *format_name,
|
||||
enum CodecID ** video_codec_list,
|
||||
enum CodecID ** audio_codec_list);
|
||||
enum CodecID ** video_codec_list,
|
||||
enum CodecID ** audio_codec_list);
|
||||
|
||||
/*
|
||||
* Since FFMpeg has such really cool and useful descriptions
|
||||
|
@ -118,10 +118,10 @@ gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height);
|
|||
|
||||
int
|
||||
gst_ffmpeg_avpicture_fill (AVPicture * picture,
|
||||
uint8_t * ptr,
|
||||
enum PixelFormat pix_fmt,
|
||||
int width,
|
||||
int height);
|
||||
uint8_t * ptr,
|
||||
enum PixelFormat pix_fmt,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/*
|
||||
* convert an image, we only use this for copying the image, ie,
|
||||
|
@ -129,8 +129,8 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
|
|||
*/
|
||||
int
|
||||
gst_ffmpeg_img_convert (AVPicture * dst, int dst_pix_fmt,
|
||||
const AVPicture * src, int src_pix_fmt,
|
||||
int src_width, int src_height);
|
||||
const AVPicture * src, int src_pix_fmt,
|
||||
int src_width, int src_height);
|
||||
|
||||
/*
|
||||
* Convert from/to a GStreamer <-> FFMpeg timestamp.
|
||||
|
|
|
@ -183,7 +183,7 @@ gst_ffmpegdeinterlace_pad_link (GstPad * pad, const GstCaps * caps)
|
|||
deinterlace->width = width;
|
||||
deinterlace->height = height;
|
||||
deinterlace->to_size = avpicture_get_size (deinterlace->pixfmt,
|
||||
deinterlace->width, deinterlace->height);
|
||||
deinterlace->width, deinterlace->height);
|
||||
return GST_PAD_LINK_OK;
|
||||
}
|
||||
|
||||
|
@ -246,16 +246,16 @@ static void
|
|||
gst_ffmpegdeinterlace_init (GstFFMpegDeinterlace * deinterlace)
|
||||
{
|
||||
deinterlace->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_ffmpegdeinterlace_sink_template),
|
||||
"sink");
|
||||
(&gst_ffmpegdeinterlace_sink_template),
|
||||
"sink");
|
||||
gst_pad_set_link_function (deinterlace->sinkpad, gst_ffmpegdeinterlace_pad_link);
|
||||
gst_pad_set_getcaps_function (deinterlace->sinkpad, gst_ffmpegdeinterlace_getcaps);
|
||||
gst_pad_set_chain_function (deinterlace->sinkpad, gst_ffmpegdeinterlace_chain);
|
||||
gst_element_add_pad (GST_ELEMENT (deinterlace), deinterlace->sinkpad);
|
||||
|
||||
deinterlace->srcpad = gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_ffmpegdeinterlace_src_template),
|
||||
"src");
|
||||
(&gst_ffmpegdeinterlace_src_template),
|
||||
"src");
|
||||
gst_element_add_pad (GST_ELEMENT (deinterlace), deinterlace->srcpad);
|
||||
gst_pad_set_link_function (deinterlace->srcpad, gst_ffmpegdeinterlace_pad_link);
|
||||
gst_pad_set_getcaps_function (deinterlace->srcpad, gst_ffmpegdeinterlace_getcaps);
|
||||
|
@ -285,20 +285,20 @@ gst_ffmpegdeinterlace_chain (GstPad * pad, GstData * data)
|
|||
}
|
||||
|
||||
outbuf = gst_pad_alloc_buffer_and_set_caps (deinterlace->srcpad,
|
||||
GST_BUFFER_OFFSET_NONE, deinterlace->to_size);
|
||||
GST_BUFFER_OFFSET_NONE, deinterlace->to_size);
|
||||
|
||||
gst_ffmpeg_avpicture_fill (&deinterlace->from_frame,
|
||||
GST_BUFFER_DATA (inbuf),
|
||||
deinterlace->pixfmt,
|
||||
deinterlace->width, deinterlace->height);
|
||||
GST_BUFFER_DATA (inbuf),
|
||||
deinterlace->pixfmt,
|
||||
deinterlace->width, deinterlace->height);
|
||||
|
||||
gst_ffmpeg_avpicture_fill (&deinterlace->to_frame,
|
||||
GST_BUFFER_DATA (outbuf),
|
||||
deinterlace->pixfmt,
|
||||
deinterlace->width, deinterlace->height);
|
||||
GST_BUFFER_DATA (outbuf),
|
||||
deinterlace->pixfmt,
|
||||
deinterlace->width, deinterlace->height);
|
||||
|
||||
avpicture_deinterlace (&deinterlace->to_frame, &deinterlace->from_frame,
|
||||
deinterlace->pixfmt, deinterlace->width, deinterlace->height);
|
||||
deinterlace->pixfmt, deinterlace->width, deinterlace->height);
|
||||
|
||||
gst_buffer_stamp (outbuf, (const GstBuffer *) inbuf);
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ gst_ffmpegenc_class_init (GstFFMpegEncClass * klass)
|
|||
"Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_RTP_PAYLOAD_SIZE,
|
||||
g_param_spec_ulong ("rtp_payload_size", "RTP Payload Size",
|
||||
g_param_spec_ulong ("rtp_payload_size", "RTP Payload Size",
|
||||
"Target GOB length", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
|
||||
} else if (klass->in_plugin->type == CODEC_TYPE_AUDIO) {
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
|
||||
|
@ -566,7 +566,7 @@ gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)
|
|||
/* this is panic! we got a buffer, but still don't have enough
|
||||
* data. Merge them and retry in the next cycle... */
|
||||
ffmpegenc->cache = gst_buffer_span (ffmpegenc->cache, 0, inbuf,
|
||||
GST_BUFFER_SIZE (ffmpegenc->cache) + GST_BUFFER_SIZE (inbuf));
|
||||
GST_BUFFER_SIZE (ffmpegenc->cache) + GST_BUFFER_SIZE (inbuf));
|
||||
} else if (in_size == size) {
|
||||
/* exactly the same! how wonderful */
|
||||
ffmpegenc->cache = inbuf;
|
||||
|
@ -593,7 +593,7 @@ gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)
|
|||
GST_BUFFER_DURATION (subbuf) =
|
||||
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size;
|
||||
subbuf = gst_buffer_span (ffmpegenc->cache, 0, subbuf,
|
||||
GST_BUFFER_SIZE (ffmpegenc->cache) + GST_BUFFER_SIZE (subbuf));
|
||||
GST_BUFFER_SIZE (ffmpegenc->cache) + GST_BUFFER_SIZE (subbuf));
|
||||
ffmpegenc->cache = NULL;
|
||||
} else {
|
||||
subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size);
|
||||
|
|
|
@ -414,10 +414,10 @@ gst_ffmpegmux_loop (GstElement * element)
|
|||
gst_tag_list_free (tags);
|
||||
}
|
||||
|
||||
/* set the streamheader flag for gstffmpegprotocol if codec supports it */
|
||||
if (!strcmp (ffmpegmux->context->oformat->name, "flv") ) {
|
||||
open_flags |= GST_FFMPEG_URL_STREAMHEADER;
|
||||
}
|
||||
/* set the streamheader flag for gstffmpegprotocol if codec supports it */
|
||||
if (!strcmp (ffmpegmux->context->oformat->name, "flv") ) {
|
||||
open_flags |= GST_FFMPEG_URL_STREAMHEADER;
|
||||
}
|
||||
|
||||
if (url_fopen (&ffmpegmux->context->pb,
|
||||
ffmpegmux->context->filename, open_flags) < 0) {
|
||||
|
@ -441,7 +441,7 @@ gst_ffmpegmux_loop (GstElement * element)
|
|||
("Failed to write file header - check codec settings"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* flush the header so it will be used as streamheader */
|
||||
put_flush_packet (&ffmpegmux->context->pb);
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ gst_ffmpegdata_write (URLContext * h, unsigned char *buf, int size)
|
|||
g_value_init (&list, GST_TYPE_FIXED_LIST);
|
||||
|
||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_IN_CAPS);
|
||||
|
||||
|
||||
g_value_init (&value, GST_TYPE_BUFFER);
|
||||
g_value_set_boxed (&value, outbuf);
|
||||
gst_value_list_append_value (&list, &value);
|
||||
|
@ -234,7 +234,7 @@ gst_ffmpegdata_write (URLContext * h, unsigned char *buf, int size)
|
|||
/* only set the first buffer */
|
||||
info->set_streamheader = FALSE;
|
||||
}
|
||||
|
||||
|
||||
gst_pad_push (info->pad, GST_DATA (outbuf));
|
||||
|
||||
return size;
|
||||
|
|
|
@ -255,7 +255,7 @@ gst_ffmpegscale_pad_link (GstPad * pad, const GstCaps * caps)
|
|||
if (scale->res != NULL) img_resample_close (scale->res);
|
||||
|
||||
scale->res = img_resample_init (scale->to_width, scale->to_height,
|
||||
scale->from_width, scale->from_height);
|
||||
scale->from_width, scale->from_height);
|
||||
|
||||
}
|
||||
|
||||
|
@ -321,16 +321,16 @@ static void
|
|||
gst_ffmpegscale_init (GstFFMpegScale * scale)
|
||||
{
|
||||
scale->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_ffmpegscale_sink_template),
|
||||
"sink");
|
||||
(&gst_ffmpegscale_sink_template),
|
||||
"sink");
|
||||
gst_pad_set_link_function (scale->sinkpad, gst_ffmpegscale_pad_link);
|
||||
gst_pad_set_getcaps_function (scale->sinkpad, gst_ffmpegscale_getcaps);
|
||||
gst_pad_set_chain_function (scale->sinkpad, gst_ffmpegscale_chain);
|
||||
gst_element_add_pad (GST_ELEMENT (scale), scale->sinkpad);
|
||||
|
||||
scale->srcpad = gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_ffmpegscale_src_template),
|
||||
"src");
|
||||
(&gst_ffmpegscale_src_template),
|
||||
"src");
|
||||
gst_element_add_pad (GST_ELEMENT (scale), scale->srcpad);
|
||||
gst_pad_set_link_function (scale->srcpad, gst_ffmpegscale_pad_link);
|
||||
gst_pad_set_getcaps_function (scale->srcpad, gst_ffmpegscale_getcaps);
|
||||
|
@ -370,14 +370,14 @@ gst_ffmpegscale_chain (GstPad * pad, GstData * data)
|
|||
outbuf = gst_pad_alloc_buffer_and_set_caps (scale->srcpad, GST_BUFFER_OFFSET_NONE, scale->to_size);
|
||||
|
||||
gst_ffmpeg_avpicture_fill (&scale->from_frame,
|
||||
GST_BUFFER_DATA (inbuf),
|
||||
scale->pixfmt,
|
||||
scale->from_width, scale->from_height);
|
||||
GST_BUFFER_DATA (inbuf),
|
||||
scale->pixfmt,
|
||||
scale->from_width, scale->from_height);
|
||||
|
||||
gst_ffmpeg_avpicture_fill (&scale->to_frame,
|
||||
GST_BUFFER_DATA (outbuf),
|
||||
scale->pixfmt,
|
||||
scale->to_width, scale->to_height);
|
||||
GST_BUFFER_DATA (outbuf),
|
||||
scale->pixfmt,
|
||||
scale->to_width, scale->to_height);
|
||||
|
||||
img_resample (scale->res, &scale->to_frame, &scale->from_frame);
|
||||
|
||||
|
@ -398,7 +398,7 @@ gst_ffmpegscale_change_state (GstElement * element, GstStateChange transition)
|
|||
switch (transition) {
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
if (scale->res != NULL)
|
||||
img_resample_close (scale->res);
|
||||
img_resample_close (scale->res);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,54 +36,54 @@
|
|||
typedef struct _PostProcDetails PostProcDetails;
|
||||
|
||||
struct _PostProcDetails {
|
||||
char *shortname;
|
||||
char *longname;
|
||||
char *description;
|
||||
char *shortname;
|
||||
char *longname;
|
||||
char *description;
|
||||
};
|
||||
|
||||
static PostProcDetails filterdetails[] = {
|
||||
{"hb", "hdeblock", "horizontal deblocking filter"},
|
||||
{"vb", "vdeblock", "vertical deblocking filter"},
|
||||
{"h1", "x1hdeblock", "experimental horizontal deblocking filter 1"},
|
||||
{"v1", "x1vdeblock", "experimental vertical deblocking filter 1"},
|
||||
{"ha", "ahdeblock", "another horizontal deblocking filter"},
|
||||
{"va", "avdeblock", "another vertical deblocking filter"},
|
||||
{"dr", "dering", "deringing filter"},
|
||||
{"al", "autolevels", "automatic brightness/contrast filter"},
|
||||
{"lb", "linblenddeint", "linear blend interpolater"},
|
||||
{"li", "linipoldeint", "linear interpolation deinterlacer"},
|
||||
{"ci", "cubicipoldeint", "cubic interpolation deinterlacer"},
|
||||
{"md", "mediandeint", "median deinterlacer"},
|
||||
{"fd", "ffmpegdeint", "ffmpeg deinterlacer"},
|
||||
{"l5", "lowpass5", "FIR lowpass deinterlacer"},
|
||||
{"tn", "tmpnoise", "temporal noise reducer"},
|
||||
{"fq", "forcequant", "force quantizer"},
|
||||
{"de", "default", "default filters"},
|
||||
{NULL, NULL, NULL}
|
||||
{"hb", "hdeblock", "horizontal deblocking filter"},
|
||||
{"vb", "vdeblock", "vertical deblocking filter"},
|
||||
{"h1", "x1hdeblock", "experimental horizontal deblocking filter 1"},
|
||||
{"v1", "x1vdeblock", "experimental vertical deblocking filter 1"},
|
||||
{"ha", "ahdeblock", "another horizontal deblocking filter"},
|
||||
{"va", "avdeblock", "another vertical deblocking filter"},
|
||||
{"dr", "dering", "deringing filter"},
|
||||
{"al", "autolevels", "automatic brightness/contrast filter"},
|
||||
{"lb", "linblenddeint", "linear blend interpolater"},
|
||||
{"li", "linipoldeint", "linear interpolation deinterlacer"},
|
||||
{"ci", "cubicipoldeint", "cubic interpolation deinterlacer"},
|
||||
{"md", "mediandeint", "median deinterlacer"},
|
||||
{"fd", "ffmpegdeint", "ffmpeg deinterlacer"},
|
||||
{"l5", "lowpass5", "FIR lowpass deinterlacer"},
|
||||
{"tn", "tmpnoise", "temporal noise reducer"},
|
||||
{"fq", "forcequant", "force quantizer"},
|
||||
{"de", "default", "default filters"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
typedef struct _GstPostProc GstPostProc;
|
||||
typedef struct _GstPostProc GstPostProc;
|
||||
|
||||
struct _GstPostProc {
|
||||
GstElement element;
|
||||
struct _GstPostProc {
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad, *srcpad;
|
||||
guint quality;
|
||||
gint width, height;
|
||||
GstPad *sinkpad, *srcpad;
|
||||
guint quality;
|
||||
gint width, height;
|
||||
|
||||
gint ystride, ustride, vstride;
|
||||
gint ysize, usize, vsize;
|
||||
gint ystride, ustride, vstride;
|
||||
gint ysize, usize, vsize;
|
||||
|
||||
pp_mode_t *mode;
|
||||
pp_context_t *context;
|
||||
pp_mode_t *mode;
|
||||
pp_context_t *context;
|
||||
};
|
||||
|
||||
typedef struct _GstPostProcClass GstPostProcClass;
|
||||
typedef struct _GstPostProcClass GstPostProcClass;
|
||||
|
||||
struct _GstPostProcClass {
|
||||
GstElementClass parent_class;
|
||||
struct _GstPostProcClass {
|
||||
GstElementClass parent_class;
|
||||
|
||||
gint filterid;
|
||||
gint filterid;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -92,46 +92,46 @@ enum {
|
|||
};
|
||||
|
||||
/* hashtable, key = gtype, value = filterdetails index */
|
||||
static GHashTable *global_plugins;
|
||||
static GHashTable *global_plugins;
|
||||
|
||||
/* TODO : add support for the other format supported by libpostproc */
|
||||
|
||||
static GstStaticPadTemplate gst_postproc_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
|
||||
);
|
||||
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_postproc_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
|
||||
);
|
||||
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
|
||||
);
|
||||
|
||||
GST_DEBUG_CATEGORY (postproc_debug);
|
||||
#define GST_CAT_DEFAULT postproc_debug
|
||||
|
||||
static void gst_postproc_class_init (GstPostProcClass * klass);
|
||||
static void gst_postproc_base_init (GstPostProcClass * klass);
|
||||
static void gst_postproc_init (GstPostProc * pproc);
|
||||
static void gst_postproc_dispose (GObject * object);
|
||||
static void gst_postproc_class_init (GstPostProcClass * klass);
|
||||
static void gst_postproc_base_init (GstPostProcClass * klass);
|
||||
static void gst_postproc_init (GstPostProc * pproc);
|
||||
static void gst_postproc_dispose (GObject * object);
|
||||
|
||||
static GstPadLinkReturn gst_postproc_link (GstPad * pad, const GstCaps * caps);
|
||||
static GstPadLinkReturn gst_postproc_link (GstPad * pad, const GstCaps * caps);
|
||||
|
||||
static void gst_postproc_chain (GstPad * pad, GstData * data);
|
||||
static void gst_postproc_chain (GstPad * pad, GstData * data);
|
||||
|
||||
static GstStateChangeReturn gst_postproc_change_state (GstElement * element,
|
||||
static GstStateChangeReturn gst_postproc_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
|
||||
static void gst_postproc_set_property ( GObject * object, guint prop_id,
|
||||
const GValue * value,
|
||||
GParamSpec *pspec );
|
||||
static void gst_postproc_get_property ( GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec *pspec );
|
||||
static void gst_postproc_set_property ( GObject * object, guint prop_id,
|
||||
const GValue * value,
|
||||
GParamSpec *pspec );
|
||||
static void gst_postproc_get_property ( GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec *pspec );
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
static void
|
||||
|
@ -168,15 +168,15 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
|
|||
static void
|
||||
change_context ( GstPostProc * postproc , gint width, gint height )
|
||||
{
|
||||
GstCPUFlags flags;
|
||||
int ppflags;
|
||||
GstCPUFlags flags;
|
||||
int ppflags;
|
||||
/*
|
||||
TODO : We need to find out what CPU flags we have in order to set
|
||||
MMX/MMX2/3DNOW optimizations
|
||||
*/
|
||||
|
||||
GST_DEBUG ("change_context, width:%d, height:%d",
|
||||
width, height);
|
||||
width, height);
|
||||
|
||||
if ((width != postproc->width) && (height != postproc->height)) {
|
||||
if (postproc->context)
|
||||
|
@ -195,7 +195,7 @@ change_context ( GstPostProc * postproc , gint width, gint height )
|
|||
postproc->usize = postproc->ustride * ROUND_UP_2 (height) / 2;
|
||||
postproc->vsize = postproc->vstride * ROUND_UP_2 (height) / 2;
|
||||
GST_DEBUG ("new strides are (YUV) : %d %d %d",
|
||||
postproc->ystride, postproc->ustride, postproc->vstride);
|
||||
postproc->ystride, postproc->ustride, postproc->vstride);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ change_mode ( GstPostProc * postproc )
|
|||
if (postproc->mode)
|
||||
pp_free_mode (postproc->mode);
|
||||
postproc->mode = pp_get_mode_by_name_and_quality (filterdetails[klass->filterid].shortname,
|
||||
postproc->quality);
|
||||
postproc->quality);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -216,7 +216,7 @@ gst_postproc_base_init ( GstPostProcClass * klass)
|
|||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstElementDetails details;
|
||||
gint ppidx;
|
||||
gint ppidx;
|
||||
|
||||
ppidx = GPOINTER_TO_INT (g_hash_table_lookup (global_plugins,
|
||||
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class))));
|
||||
|
@ -230,9 +230,9 @@ gst_postproc_base_init ( GstPostProcClass * klass)
|
|||
g_free(details.description);
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_postproc_src_template));
|
||||
gst_static_pad_template_get (&gst_postproc_src_template));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_postproc_sink_template));
|
||||
gst_static_pad_template_get (&gst_postproc_sink_template));
|
||||
|
||||
klass->filterid = ppidx;
|
||||
}
|
||||
|
@ -240,15 +240,15 @@ gst_postproc_base_init ( GstPostProcClass * klass)
|
|||
static void
|
||||
gst_postproc_class_init (GstPostProcClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_QUALITY,
|
||||
g_param_spec_uint ("quality", "Quality",
|
||||
"Quality level of filter (6:best)",
|
||||
0, 6, 6, G_PARAM_READWRITE));
|
||||
"Quality level of filter (6:best)",
|
||||
0, 6, 6, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->dispose = gst_postproc_dispose;
|
||||
gobject_class->set_property = gst_postproc_set_property;
|
||||
|
@ -262,15 +262,15 @@ gst_postproc_init (GstPostProc * postproc)
|
|||
GST_FLAG_SET (postproc, GST_ELEMENT_WORK_IN_PLACE);
|
||||
|
||||
postproc->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_postproc_sink_template),
|
||||
"sink");
|
||||
(&gst_postproc_sink_template),
|
||||
"sink");
|
||||
gst_pad_set_link_function (postproc->sinkpad, gst_postproc_link);
|
||||
gst_pad_set_chain_function (postproc->sinkpad, gst_postproc_chain);
|
||||
gst_element_add_pad (GST_ELEMENT (postproc), postproc->sinkpad);
|
||||
|
||||
postproc->srcpad = gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_postproc_src_template),
|
||||
"src");
|
||||
(&gst_postproc_src_template),
|
||||
"src");
|
||||
gst_element_add_pad (GST_ELEMENT (postproc), postproc->srcpad);
|
||||
|
||||
postproc->quality = 6;
|
||||
|
@ -302,12 +302,12 @@ gst_postproc_dispose (GObject * object)
|
|||
static GstPadLinkReturn
|
||||
gst_postproc_link (GstPad * pad, const GstCaps * caps)
|
||||
{
|
||||
GstPostProc *postproc;
|
||||
GstStructure *structure;
|
||||
GstPad *otherpad;
|
||||
gboolean res;
|
||||
GstPadLinkReturn ret;
|
||||
gint width, height;
|
||||
GstPostProc *postproc;
|
||||
GstStructure *structure;
|
||||
GstPad *otherpad;
|
||||
gboolean res;
|
||||
GstPadLinkReturn ret;
|
||||
gint width, height;
|
||||
/* create/replace pp_context here */
|
||||
|
||||
postproc = (GstPostProc *) gst_pad_get_parent (pad);
|
||||
|
@ -333,10 +333,10 @@ gst_postproc_link (GstPad * pad, const GstCaps * caps)
|
|||
static void
|
||||
gst_postproc_chain (GstPad * pad, GstData * data)
|
||||
{
|
||||
GstPostProc *postproc;
|
||||
GstBuffer *in, *out;
|
||||
int stride[3];
|
||||
unsigned char * outplane[3];
|
||||
GstPostProc *postproc;
|
||||
GstBuffer *in, *out;
|
||||
int stride[3];
|
||||
unsigned char * outplane[3];
|
||||
|
||||
GST_DEBUG("chaining");
|
||||
|
||||
|
@ -361,34 +361,34 @@ gst_postproc_chain (GstPad * pad, GstData * data)
|
|||
outplane[2] = outplane[1] + postproc->usize;
|
||||
|
||||
GST_DEBUG ("calling pp_postprocess, width:%d, height:%d",
|
||||
postproc->width, postproc->height);
|
||||
postproc->width, postproc->height);
|
||||
|
||||
pp_postprocess (outplane, stride,
|
||||
outplane, stride,
|
||||
postproc->width,
|
||||
postproc->height,
|
||||
"", 0,
|
||||
postproc->mode, postproc->context, 1);
|
||||
outplane, stride,
|
||||
postproc->width,
|
||||
postproc->height,
|
||||
"", 0,
|
||||
postproc->mode, postproc->context, 1);
|
||||
|
||||
gst_buffer_stamp (out, in);
|
||||
|
||||
gst_pad_push (postproc->srcpad, GST_DATA (out));
|
||||
/*
|
||||
void pp_postprocess(uint8_t * src[3], int srcStride[3],
|
||||
uint8_t * dst[3], int dstStride[3],
|
||||
int horizontalSize, int verticalSize,
|
||||
QP_STORE_T *QP_store, int QP_stride,
|
||||
pp_mode_t *mode, pp_context_t *ppContext, int pict_type);
|
||||
uint8_t * dst[3], int dstStride[3],
|
||||
int horizontalSize, int verticalSize,
|
||||
QP_STORE_T *QP_store, int QP_stride,
|
||||
pp_mode_t *mode, pp_context_t *ppContext, int pict_type);
|
||||
|
||||
src is the src buffer data
|
||||
srcStride is ->ystride, ->ustride, ->vstride
|
||||
dst same as src
|
||||
dstStride same as srcStride
|
||||
horizontalSize and VerticalsSize are obvious
|
||||
QP_store can be null and qp_stride too
|
||||
mode = mode
|
||||
context = context
|
||||
pict_type = 0
|
||||
src is the src buffer data
|
||||
srcStride is ->ystride, ->ustride, ->vstride
|
||||
dst same as src
|
||||
dstStride same as srcStride
|
||||
horizontalSize and VerticalsSize are obvious
|
||||
QP_store can be null and qp_stride too
|
||||
mode = mode
|
||||
context = context
|
||||
pict_type = 0
|
||||
*/
|
||||
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ gst_postproc_chain (GstPad * pad, GstData * data)
|
|||
static GstStateChangeReturn
|
||||
gst_postproc_change_state (GstElement * element, GstStateChange transition)
|
||||
{
|
||||
GstPostProc *postproc = (GstPostProc *) element;
|
||||
GstPostProc *postproc = (GstPostProc *) element;
|
||||
/* don't go to play if we don't have mode and context */
|
||||
|
||||
switch (transition) {
|
||||
|
@ -413,10 +413,10 @@ gst_postproc_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
static void
|
||||
gst_postproc_set_property ( GObject * object, guint prop_id,
|
||||
const GValue * value,
|
||||
GParamSpec *pspec )
|
||||
const GValue * value,
|
||||
GParamSpec *pspec )
|
||||
{
|
||||
GstPostProc *postproc = (GstPostProc *) object;
|
||||
GstPostProc *postproc = (GstPostProc *) object;
|
||||
gint quality;
|
||||
|
||||
switch (prop_id) {
|
||||
|
@ -434,9 +434,9 @@ gst_postproc_set_property ( GObject * object, guint prop_id,
|
|||
|
||||
static void
|
||||
gst_postproc_get_property ( GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec *pspec )
|
||||
GValue * value, GParamSpec *pspec )
|
||||
{
|
||||
GstPostProc *postproc = (GstPostProc *) object;
|
||||
GstPostProc *postproc = (GstPostProc *) object;
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_QUALITY:
|
||||
|
@ -451,7 +451,7 @@ gst_postproc_get_property ( GObject * object, guint prop_id,
|
|||
gboolean
|
||||
gst_postproc_register(GstPlugin * plugin)
|
||||
{
|
||||
GTypeInfo typeinfo = {
|
||||
GTypeInfo typeinfo = {
|
||||
sizeof (GstPostProcClass),
|
||||
(GBaseInitFunc) gst_postproc_base_init,
|
||||
NULL,
|
||||
|
@ -463,15 +463,15 @@ gst_postproc_register(GstPlugin * plugin)
|
|||
(GInstanceInitFunc) gst_postproc_init,
|
||||
};
|
||||
GType type;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
global_plugins = g_hash_table_new (NULL, NULL);
|
||||
for (i = 0; filterdetails[i].shortname; i++) {
|
||||
gchar *type_name;
|
||||
gchar *type_name;
|
||||
|
||||
g_hash_table_insert (global_plugins,
|
||||
GINT_TO_POINTER (0),
|
||||
GINT_TO_POINTER (i));
|
||||
GINT_TO_POINTER (0),
|
||||
GINT_TO_POINTER (i));
|
||||
|
||||
/* create type_name */
|
||||
type_name = g_strdup_printf("postproc_%s", filterdetails[i].longname);
|
||||
|
@ -484,8 +484,8 @@ gst_postproc_register(GstPlugin * plugin)
|
|||
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
||||
|
||||
g_hash_table_insert (global_plugins,
|
||||
GINT_TO_POINTER (type),
|
||||
GINT_TO_POINTER (i));
|
||||
GINT_TO_POINTER (type),
|
||||
GINT_TO_POINTER (i));
|
||||
|
||||
/* register element */
|
||||
if (!gst_element_register (plugin, type_name, GST_RANK_PRIMARY, type)) {
|
||||
|
|
Loading…
Reference in a new issue