expand tabs

Original commit message from CVS:
expand tabs
This commit is contained in:
Thomas Vander Stichele 2005-12-06 19:57:08 +00:00
parent 6ba0fee53f
commit 9783a9207a
9 changed files with 237 additions and 214 deletions

View file

@ -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 === === release 0.10.0 ===
2005-12-05 <thomas (at) apestaart (dot) org> 2005-12-05 <thomas (at) apestaart (dot) org>

View file

@ -81,34 +81,34 @@ gst_ffmpeg_set_palette (GstCaps *caps, AVCodecContext *context)
* but I'm too lazy today. Maybe later. * but I'm too lazy today. Maybe later.
*/ */
#define GST_FF_VID_CAPS_NEW(mimetype, ...) \ #define GST_FF_VID_CAPS_NEW(mimetype, ...) \
(context != NULL) ? \ (context != NULL) ? \
gst_caps_new_simple (mimetype, \ gst_caps_new_simple (mimetype, \
"width", G_TYPE_INT, context->width, \ "width", G_TYPE_INT, context->width, \
"height", G_TYPE_INT, context->height, \ "height", G_TYPE_INT, context->height, \
"framerate", GST_TYPE_FRACTION, context->time_base.den, \ "framerate", GST_TYPE_FRACTION, context->time_base.den, \
context->time_base.num, __VA_ARGS__, NULL) \ context->time_base.num, __VA_ARGS__, NULL) \
: \ : \
gst_caps_new_simple (mimetype, \ gst_caps_new_simple (mimetype, \
"width", GST_TYPE_INT_RANGE, 16, 4096, \ "width", GST_TYPE_INT_RANGE, 16, 4096, \
"height", GST_TYPE_INT_RANGE, 16, 4096, \ "height", GST_TYPE_INT_RANGE, 16, 4096, \
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, \ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, \
G_MAXINT, 1, __VA_ARGS__, NULL) G_MAXINT, 1, __VA_ARGS__, NULL)
/* same for audio - now with channels/sample rate /* same for audio - now with channels/sample rate
*/ */
#define GST_FF_AUD_CAPS_NEW(mimetype, ...) \ #define GST_FF_AUD_CAPS_NEW(mimetype, ...) \
(context != NULL) ? \ (context != NULL) ? \
gst_caps_new_simple (mimetype, \ gst_caps_new_simple (mimetype, \
"rate", G_TYPE_INT, context->sample_rate, \ "rate", G_TYPE_INT, context->sample_rate, \
"channels", G_TYPE_INT, context->channels, \ "channels", G_TYPE_INT, context->channels, \
__VA_ARGS__, NULL) \ __VA_ARGS__, NULL) \
: \ : \
gst_caps_new_simple (mimetype, \ gst_caps_new_simple (mimetype, \
"rate", GST_TYPE_INT_RANGE, 8000, 96000, \ "rate", GST_TYPE_INT_RANGE, 8000, 96000, \
"channels", GST_TYPE_INT_RANGE, 1, 2, \ "channels", GST_TYPE_INT_RANGE, 1, 2, \
__VA_ARGS__, NULL) __VA_ARGS__, NULL)
/* Convert a FFMPEG codec ID and optional AVCodecContext /* Convert a FFMPEG codec ID and optional AVCodecContext
* to a GstCaps. If the context is ommitted, no fixed values * 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) { switch (context->codec_tag) {
case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'): case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'):
caps = GST_FF_VID_CAPS_NEW ("video/x-divx", caps = GST_FF_VID_CAPS_NEW ("video/x-divx",
"divxversion", G_TYPE_INT, 5, NULL); "divxversion", G_TYPE_INT, 5, NULL);
break; break;
case GST_MAKE_FOURCC ('m', 'p', '4', 'v'): case GST_MAKE_FOURCC ('m', 'p', '4', 'v'):
default: default:
@ -450,10 +450,10 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
case CODEC_ID_MSRLE: case CODEC_ID_MSRLE:
caps = GST_FF_VID_CAPS_NEW ("video/x-rle", caps = GST_FF_VID_CAPS_NEW ("video/x-rle",
"layout", G_TYPE_STRING, "microsoft", NULL); "layout", G_TYPE_STRING, "microsoft", NULL);
if (context) { if (context) {
gst_caps_set_simple (caps, 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 { } else {
gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL); 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: case CODEC_ID_MSVIDEO1:
caps = GST_FF_VID_CAPS_NEW ("video/x-msvideocodec", caps = GST_FF_VID_CAPS_NEW ("video/x-msvideocodec",
"msvideoversion", G_TYPE_INT, 1, NULL); "msvideoversion", G_TYPE_INT, 1, NULL);
break; break;
case CODEC_ID_WMV3: case CODEC_ID_WMV3:
@ -899,8 +899,8 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
case PIX_FMT_GRAY8: case PIX_FMT_GRAY8:
bpp = depth = 8; bpp = depth = 8;
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-gray", caps = GST_FF_VID_CAPS_NEW ("video/x-raw-gray",
"bpp", G_TYPE_INT, bpp, "bpp", G_TYPE_INT, bpp,
"depth", G_TYPE_INT, depth, NULL); "depth", G_TYPE_INT, depth, NULL);
break; break;
default: default:
/* give up ... */ /* give up ... */
@ -910,28 +910,28 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
if (caps == NULL) { if (caps == NULL) {
if (bpp != 0) { if (bpp != 0) {
if (r_mask != 0) { if (r_mask != 0) {
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb", caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
"bpp", G_TYPE_INT, bpp, "bpp", G_TYPE_INT, bpp,
"depth", G_TYPE_INT, depth, "depth", G_TYPE_INT, depth,
"red_mask", G_TYPE_INT, r_mask, "red_mask", G_TYPE_INT, r_mask,
"green_mask", G_TYPE_INT, g_mask, "green_mask", G_TYPE_INT, g_mask,
"blue_mask", G_TYPE_INT, b_mask, "blue_mask", G_TYPE_INT, b_mask,
"endianness", G_TYPE_INT, endianness, NULL); "endianness", G_TYPE_INT, endianness, NULL);
if (a_mask) { if (a_mask) {
gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, a_mask, NULL); gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, a_mask, NULL);
} }
} else { } else {
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb", caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
"bpp", G_TYPE_INT, bpp, "bpp", G_TYPE_INT, bpp,
"depth", G_TYPE_INT, depth, "depth", G_TYPE_INT, depth,
"endianness", G_TYPE_INT, endianness, NULL); "endianness", G_TYPE_INT, endianness, NULL);
if (context) { if (context) {
gst_ffmpeg_set_palette (caps, context); gst_ffmpeg_set_palette (caps, context);
} }
} }
} else if (fmt) { } else if (fmt) {
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-yuv", 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); context->time_base.num = gst_value_get_fraction_denominator (fps);
GST_DEBUG ("setting framerate %d/%d = %lf", GST_DEBUG ("setting framerate %d/%d = %lf",
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); 1. * context->time_base.den / context->time_base.num);
} }
if (!raw) if (!raw)
@ -1273,7 +1273,7 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
if (!context->extradata) { if (!context->extradata) {
gint halfpel_flag, thirdpel_flag, low_delay, unknown_svq3_flag; gint halfpel_flag, thirdpel_flag, low_delay, unknown_svq3_flag;
guint16 flags; guint16 flags;
if (gst_structure_get_int (str, "halfpel_flag", &halfpel_flag) || if (gst_structure_get_int (str, "halfpel_flag", &halfpel_flag) ||
gst_structure_get_int (str, "thirdpel_flag", &thirdpel_flag) || gst_structure_get_int (str, "thirdpel_flag", &thirdpel_flag) ||
gst_structure_get_int (str, "low_delay", &low_delay) || 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)) || if ((codec = avcodec_find_decoder_by_name (ext)) ||
(codec = avcodec_find_encoder_by_name (ext))) { (codec = avcodec_find_encoder_by_name (ext))) {
id = codec->id; id = codec->id;
audio = TRUE; audio = TRUE;
} }
} }
} else if (!strncmp (mimetype, "video/x-gst_ff-", 15)) { } else if (!strncmp (mimetype, "video/x-gst_ff-", 15)) {

View file

@ -35,7 +35,7 @@
GstCaps * GstCaps *
gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
AVCodecContext *context, AVCodecContext *context,
gboolean encode); gboolean encode);
/* /*
* _codectype_to_caps () gets the GstCaps that belongs to * _codectype_to_caps () gets the GstCaps that belongs to
@ -63,9 +63,9 @@ gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
void void
gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
enum CodecType codec_type, enum CodecType codec_type,
const GstCaps *caps, const GstCaps *caps,
AVCodecContext *context); AVCodecContext *context);
/* /*
* caps_with_codectype () transforms a GstCaps that belongs to * caps_with_codectype () transforms a GstCaps that belongs to
@ -95,8 +95,8 @@ gst_ffmpeg_formatid_to_caps (const gchar *format_name);
gboolean gboolean
gst_ffmpeg_formatid_get_codecids (const gchar *format_name, gst_ffmpeg_formatid_get_codecids (const gchar *format_name,
enum CodecID ** video_codec_list, enum CodecID ** video_codec_list,
enum CodecID ** audio_codec_list); enum CodecID ** audio_codec_list);
/* /*
* Since FFMpeg has such really cool and useful descriptions * 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 int
gst_ffmpeg_avpicture_fill (AVPicture * picture, gst_ffmpeg_avpicture_fill (AVPicture * picture,
uint8_t * ptr, uint8_t * ptr,
enum PixelFormat pix_fmt, enum PixelFormat pix_fmt,
int width, int width,
int height); int height);
/* /*
* convert an image, we only use this for copying the image, ie, * convert an image, we only use this for copying the image, ie,
@ -129,8 +129,8 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
*/ */
int int
gst_ffmpeg_img_convert (AVPicture * dst, int dst_pix_fmt, gst_ffmpeg_img_convert (AVPicture * dst, int dst_pix_fmt,
const AVPicture * src, int src_pix_fmt, const AVPicture * src, int src_pix_fmt,
int src_width, int src_height); int src_width, int src_height);
/* /*
* Convert from/to a GStreamer <-> FFMpeg timestamp. * Convert from/to a GStreamer <-> FFMpeg timestamp.

View file

@ -183,7 +183,7 @@ gst_ffmpegdeinterlace_pad_link (GstPad * pad, const GstCaps * caps)
deinterlace->width = width; deinterlace->width = width;
deinterlace->height = height; deinterlace->height = height;
deinterlace->to_size = avpicture_get_size (deinterlace->pixfmt, deinterlace->to_size = avpicture_get_size (deinterlace->pixfmt,
deinterlace->width, deinterlace->height); deinterlace->width, deinterlace->height);
return GST_PAD_LINK_OK; return GST_PAD_LINK_OK;
} }
@ -246,16 +246,16 @@ static void
gst_ffmpegdeinterlace_init (GstFFMpegDeinterlace * deinterlace) gst_ffmpegdeinterlace_init (GstFFMpegDeinterlace * deinterlace)
{ {
deinterlace->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get deinterlace->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get
(&gst_ffmpegdeinterlace_sink_template), (&gst_ffmpegdeinterlace_sink_template),
"sink"); "sink");
gst_pad_set_link_function (deinterlace->sinkpad, gst_ffmpegdeinterlace_pad_link); gst_pad_set_link_function (deinterlace->sinkpad, gst_ffmpegdeinterlace_pad_link);
gst_pad_set_getcaps_function (deinterlace->sinkpad, gst_ffmpegdeinterlace_getcaps); gst_pad_set_getcaps_function (deinterlace->sinkpad, gst_ffmpegdeinterlace_getcaps);
gst_pad_set_chain_function (deinterlace->sinkpad, gst_ffmpegdeinterlace_chain); gst_pad_set_chain_function (deinterlace->sinkpad, gst_ffmpegdeinterlace_chain);
gst_element_add_pad (GST_ELEMENT (deinterlace), deinterlace->sinkpad); gst_element_add_pad (GST_ELEMENT (deinterlace), deinterlace->sinkpad);
deinterlace->srcpad = gst_pad_new_from_template (gst_static_pad_template_get deinterlace->srcpad = gst_pad_new_from_template (gst_static_pad_template_get
(&gst_ffmpegdeinterlace_src_template), (&gst_ffmpegdeinterlace_src_template),
"src"); "src");
gst_element_add_pad (GST_ELEMENT (deinterlace), deinterlace->srcpad); gst_element_add_pad (GST_ELEMENT (deinterlace), deinterlace->srcpad);
gst_pad_set_link_function (deinterlace->srcpad, gst_ffmpegdeinterlace_pad_link); gst_pad_set_link_function (deinterlace->srcpad, gst_ffmpegdeinterlace_pad_link);
gst_pad_set_getcaps_function (deinterlace->srcpad, gst_ffmpegdeinterlace_getcaps); 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, 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_ffmpeg_avpicture_fill (&deinterlace->from_frame,
GST_BUFFER_DATA (inbuf), GST_BUFFER_DATA (inbuf),
deinterlace->pixfmt, deinterlace->pixfmt,
deinterlace->width, deinterlace->height); deinterlace->width, deinterlace->height);
gst_ffmpeg_avpicture_fill (&deinterlace->to_frame, gst_ffmpeg_avpicture_fill (&deinterlace->to_frame,
GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (outbuf),
deinterlace->pixfmt, deinterlace->pixfmt,
deinterlace->width, deinterlace->height); deinterlace->width, deinterlace->height);
avpicture_deinterlace (&deinterlace->to_frame, &deinterlace->from_frame, 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); gst_buffer_stamp (outbuf, (const GstBuffer *) inbuf);

View file

@ -228,7 +228,7 @@ gst_ffmpegenc_class_init (GstFFMpegEncClass * klass)
"Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); "Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_RTP_PAYLOAD_SIZE, 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)); "Target GOB length", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
} else if (klass->in_plugin->type == CODEC_TYPE_AUDIO) { } else if (klass->in_plugin->type == CODEC_TYPE_AUDIO) {
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE, 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 /* this is panic! we got a buffer, but still don't have enough
* data. Merge them and retry in the next cycle... */ * data. Merge them and retry in the next cycle... */
ffmpegenc->cache = gst_buffer_span (ffmpegenc->cache, 0, inbuf, 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) { } else if (in_size == size) {
/* exactly the same! how wonderful */ /* exactly the same! how wonderful */
ffmpegenc->cache = inbuf; ffmpegenc->cache = inbuf;
@ -593,7 +593,7 @@ gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)
GST_BUFFER_DURATION (subbuf) = GST_BUFFER_DURATION (subbuf) =
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size; GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size;
subbuf = gst_buffer_span (ffmpegenc->cache, 0, subbuf, 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; ffmpegenc->cache = NULL;
} else { } else {
subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size); subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size);

View file

@ -414,10 +414,10 @@ gst_ffmpegmux_loop (GstElement * element)
gst_tag_list_free (tags); gst_tag_list_free (tags);
} }
/* set the streamheader flag for gstffmpegprotocol if codec supports it */ /* set the streamheader flag for gstffmpegprotocol if codec supports it */
if (!strcmp (ffmpegmux->context->oformat->name, "flv") ) { if (!strcmp (ffmpegmux->context->oformat->name, "flv") ) {
open_flags |= GST_FFMPEG_URL_STREAMHEADER; open_flags |= GST_FFMPEG_URL_STREAMHEADER;
} }
if (url_fopen (&ffmpegmux->context->pb, if (url_fopen (&ffmpegmux->context->pb,
ffmpegmux->context->filename, open_flags) < 0) { ffmpegmux->context->filename, open_flags) < 0) {
@ -441,7 +441,7 @@ gst_ffmpegmux_loop (GstElement * element)
("Failed to write file header - check codec settings")); ("Failed to write file header - check codec settings"));
return; return;
} }
/* flush the header so it will be used as streamheader */ /* flush the header so it will be used as streamheader */
put_flush_packet (&ffmpegmux->context->pb); put_flush_packet (&ffmpegmux->context->pb);
} }

View file

@ -220,7 +220,7 @@ gst_ffmpegdata_write (URLContext * h, unsigned char *buf, int size)
g_value_init (&list, GST_TYPE_FIXED_LIST); g_value_init (&list, GST_TYPE_FIXED_LIST);
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_IN_CAPS); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_IN_CAPS);
g_value_init (&value, GST_TYPE_BUFFER); g_value_init (&value, GST_TYPE_BUFFER);
g_value_set_boxed (&value, outbuf); g_value_set_boxed (&value, outbuf);
gst_value_list_append_value (&list, &value); 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 */ /* only set the first buffer */
info->set_streamheader = FALSE; info->set_streamheader = FALSE;
} }
gst_pad_push (info->pad, GST_DATA (outbuf)); gst_pad_push (info->pad, GST_DATA (outbuf));
return size; return size;

View file

@ -255,7 +255,7 @@ gst_ffmpegscale_pad_link (GstPad * pad, const GstCaps * caps)
if (scale->res != NULL) img_resample_close (scale->res); if (scale->res != NULL) img_resample_close (scale->res);
scale->res = img_resample_init (scale->to_width, scale->to_height, 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) gst_ffmpegscale_init (GstFFMpegScale * scale)
{ {
scale->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get scale->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get
(&gst_ffmpegscale_sink_template), (&gst_ffmpegscale_sink_template),
"sink"); "sink");
gst_pad_set_link_function (scale->sinkpad, gst_ffmpegscale_pad_link); gst_pad_set_link_function (scale->sinkpad, gst_ffmpegscale_pad_link);
gst_pad_set_getcaps_function (scale->sinkpad, gst_ffmpegscale_getcaps); gst_pad_set_getcaps_function (scale->sinkpad, gst_ffmpegscale_getcaps);
gst_pad_set_chain_function (scale->sinkpad, gst_ffmpegscale_chain); gst_pad_set_chain_function (scale->sinkpad, gst_ffmpegscale_chain);
gst_element_add_pad (GST_ELEMENT (scale), scale->sinkpad); gst_element_add_pad (GST_ELEMENT (scale), scale->sinkpad);
scale->srcpad = gst_pad_new_from_template (gst_static_pad_template_get scale->srcpad = gst_pad_new_from_template (gst_static_pad_template_get
(&gst_ffmpegscale_src_template), (&gst_ffmpegscale_src_template),
"src"); "src");
gst_element_add_pad (GST_ELEMENT (scale), scale->srcpad); gst_element_add_pad (GST_ELEMENT (scale), scale->srcpad);
gst_pad_set_link_function (scale->srcpad, gst_ffmpegscale_pad_link); gst_pad_set_link_function (scale->srcpad, gst_ffmpegscale_pad_link);
gst_pad_set_getcaps_function (scale->srcpad, gst_ffmpegscale_getcaps); 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); 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_ffmpeg_avpicture_fill (&scale->from_frame,
GST_BUFFER_DATA (inbuf), GST_BUFFER_DATA (inbuf),
scale->pixfmt, scale->pixfmt,
scale->from_width, scale->from_height); scale->from_width, scale->from_height);
gst_ffmpeg_avpicture_fill (&scale->to_frame, gst_ffmpeg_avpicture_fill (&scale->to_frame,
GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (outbuf),
scale->pixfmt, scale->pixfmt,
scale->to_width, scale->to_height); scale->to_width, scale->to_height);
img_resample (scale->res, &scale->to_frame, &scale->from_frame); img_resample (scale->res, &scale->to_frame, &scale->from_frame);
@ -398,7 +398,7 @@ gst_ffmpegscale_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
if (scale->res != NULL) if (scale->res != NULL)
img_resample_close (scale->res); img_resample_close (scale->res);
break; break;
} }

View file

@ -36,54 +36,54 @@
typedef struct _PostProcDetails PostProcDetails; typedef struct _PostProcDetails PostProcDetails;
struct _PostProcDetails { struct _PostProcDetails {
char *shortname; char *shortname;
char *longname; char *longname;
char *description; char *description;
}; };
static PostProcDetails filterdetails[] = { static PostProcDetails filterdetails[] = {
{"hb", "hdeblock", "horizontal deblocking filter"}, {"hb", "hdeblock", "horizontal deblocking filter"},
{"vb", "vdeblock", "vertical deblocking filter"}, {"vb", "vdeblock", "vertical deblocking filter"},
{"h1", "x1hdeblock", "experimental horizontal deblocking filter 1"}, {"h1", "x1hdeblock", "experimental horizontal deblocking filter 1"},
{"v1", "x1vdeblock", "experimental vertical deblocking filter 1"}, {"v1", "x1vdeblock", "experimental vertical deblocking filter 1"},
{"ha", "ahdeblock", "another horizontal deblocking filter"}, {"ha", "ahdeblock", "another horizontal deblocking filter"},
{"va", "avdeblock", "another vertical deblocking filter"}, {"va", "avdeblock", "another vertical deblocking filter"},
{"dr", "dering", "deringing filter"}, {"dr", "dering", "deringing filter"},
{"al", "autolevels", "automatic brightness/contrast filter"}, {"al", "autolevels", "automatic brightness/contrast filter"},
{"lb", "linblenddeint", "linear blend interpolater"}, {"lb", "linblenddeint", "linear blend interpolater"},
{"li", "linipoldeint", "linear interpolation deinterlacer"}, {"li", "linipoldeint", "linear interpolation deinterlacer"},
{"ci", "cubicipoldeint", "cubic interpolation deinterlacer"}, {"ci", "cubicipoldeint", "cubic interpolation deinterlacer"},
{"md", "mediandeint", "median deinterlacer"}, {"md", "mediandeint", "median deinterlacer"},
{"fd", "ffmpegdeint", "ffmpeg deinterlacer"}, {"fd", "ffmpegdeint", "ffmpeg deinterlacer"},
{"l5", "lowpass5", "FIR lowpass deinterlacer"}, {"l5", "lowpass5", "FIR lowpass deinterlacer"},
{"tn", "tmpnoise", "temporal noise reducer"}, {"tn", "tmpnoise", "temporal noise reducer"},
{"fq", "forcequant", "force quantizer"}, {"fq", "forcequant", "force quantizer"},
{"de", "default", "default filters"}, {"de", "default", "default filters"},
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
typedef struct _GstPostProc GstPostProc; typedef struct _GstPostProc GstPostProc;
struct _GstPostProc { struct _GstPostProc {
GstElement element; GstElement element;
GstPad *sinkpad, *srcpad; GstPad *sinkpad, *srcpad;
guint quality; guint quality;
gint width, height; gint width, height;
gint ystride, ustride, vstride; gint ystride, ustride, vstride;
gint ysize, usize, vsize; gint ysize, usize, vsize;
pp_mode_t *mode; pp_mode_t *mode;
pp_context_t *context; pp_context_t *context;
}; };
typedef struct _GstPostProcClass GstPostProcClass; typedef struct _GstPostProcClass GstPostProcClass;
struct _GstPostProcClass { struct _GstPostProcClass {
GstElementClass parent_class; GstElementClass parent_class;
gint filterid; gint filterid;
}; };
enum { enum {
@ -92,46 +92,46 @@ enum {
}; };
/* hashtable, key = gtype, value = filterdetails index */ /* hashtable, key = gtype, value = filterdetails index */
static GHashTable *global_plugins; static GHashTable *global_plugins;
/* TODO : add support for the other format supported by libpostproc */ /* TODO : add support for the other format supported by libpostproc */
static GstStaticPadTemplate gst_postproc_src_template = static GstStaticPadTemplate gst_postproc_src_template =
GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420")) GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
); );
static GstStaticPadTemplate gst_postproc_sink_template = static GstStaticPadTemplate gst_postproc_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420")) GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
); );
GST_DEBUG_CATEGORY (postproc_debug); GST_DEBUG_CATEGORY (postproc_debug);
#define GST_CAT_DEFAULT postproc_debug #define GST_CAT_DEFAULT postproc_debug
static void gst_postproc_class_init (GstPostProcClass * klass); static void gst_postproc_class_init (GstPostProcClass * klass);
static void gst_postproc_base_init (GstPostProcClass * klass); static void gst_postproc_base_init (GstPostProcClass * klass);
static void gst_postproc_init (GstPostProc * pproc); static void gst_postproc_init (GstPostProc * pproc);
static void gst_postproc_dispose (GObject * object); 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); GstStateChange transition);
static void gst_postproc_set_property ( GObject * object, guint prop_id, static void gst_postproc_set_property ( GObject * object, guint prop_id,
const GValue * value, const GValue * value,
GParamSpec *pspec ); GParamSpec *pspec );
static void gst_postproc_get_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 );
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
static void static void
@ -168,15 +168,15 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
static void static void
change_context ( GstPostProc * postproc , gint width, gint height ) change_context ( GstPostProc * postproc , gint width, gint height )
{ {
GstCPUFlags flags; GstCPUFlags flags;
int ppflags; int ppflags;
/* /*
TODO : We need to find out what CPU flags we have in order to set TODO : We need to find out what CPU flags we have in order to set
MMX/MMX2/3DNOW optimizations MMX/MMX2/3DNOW optimizations
*/ */
GST_DEBUG ("change_context, width:%d, height:%d", GST_DEBUG ("change_context, width:%d, height:%d",
width, height); width, height);
if ((width != postproc->width) && (height != postproc->height)) { if ((width != postproc->width) && (height != postproc->height)) {
if (postproc->context) 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->usize = postproc->ustride * ROUND_UP_2 (height) / 2;
postproc->vsize = postproc->vstride * ROUND_UP_2 (height) / 2; postproc->vsize = postproc->vstride * ROUND_UP_2 (height) / 2;
GST_DEBUG ("new strides are (YUV) : %d %d %d", 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) if (postproc->mode)
pp_free_mode (postproc->mode); pp_free_mode (postproc->mode);
postproc->mode = pp_get_mode_by_name_and_quality (filterdetails[klass->filterid].shortname, postproc->mode = pp_get_mode_by_name_and_quality (filterdetails[klass->filterid].shortname,
postproc->quality); postproc->quality);
} }
static void static void
@ -216,7 +216,7 @@ gst_postproc_base_init ( GstPostProcClass * klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstElementDetails details; GstElementDetails details;
gint ppidx; gint ppidx;
ppidx = GPOINTER_TO_INT (g_hash_table_lookup (global_plugins, ppidx = GPOINTER_TO_INT (g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class)))); GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class))));
@ -230,9 +230,9 @@ gst_postproc_base_init ( GstPostProcClass * klass)
g_free(details.description); g_free(details.description);
gst_element_class_add_pad_template (element_class, 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_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; klass->filterid = ppidx;
} }
@ -240,15 +240,15 @@ gst_postproc_base_init ( GstPostProcClass * klass)
static void static void
gst_postproc_class_init (GstPostProcClass * klass) 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); GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
g_object_class_install_property (gobject_class, ARG_QUALITY, g_object_class_install_property (gobject_class, ARG_QUALITY,
g_param_spec_uint ("quality", "Quality", g_param_spec_uint ("quality", "Quality",
"Quality level of filter (6:best)", "Quality level of filter (6:best)",
0, 6, 6, G_PARAM_READWRITE)); 0, 6, 6, G_PARAM_READWRITE));
gobject_class->dispose = gst_postproc_dispose; gobject_class->dispose = gst_postproc_dispose;
gobject_class->set_property = gst_postproc_set_property; 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); GST_FLAG_SET (postproc, GST_ELEMENT_WORK_IN_PLACE);
postproc->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get postproc->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get
(&gst_postproc_sink_template), (&gst_postproc_sink_template),
"sink"); "sink");
gst_pad_set_link_function (postproc->sinkpad, gst_postproc_link); gst_pad_set_link_function (postproc->sinkpad, gst_postproc_link);
gst_pad_set_chain_function (postproc->sinkpad, gst_postproc_chain); gst_pad_set_chain_function (postproc->sinkpad, gst_postproc_chain);
gst_element_add_pad (GST_ELEMENT (postproc), postproc->sinkpad); gst_element_add_pad (GST_ELEMENT (postproc), postproc->sinkpad);
postproc->srcpad = gst_pad_new_from_template (gst_static_pad_template_get postproc->srcpad = gst_pad_new_from_template (gst_static_pad_template_get
(&gst_postproc_src_template), (&gst_postproc_src_template),
"src"); "src");
gst_element_add_pad (GST_ELEMENT (postproc), postproc->srcpad); gst_element_add_pad (GST_ELEMENT (postproc), postproc->srcpad);
postproc->quality = 6; postproc->quality = 6;
@ -302,12 +302,12 @@ gst_postproc_dispose (GObject * object)
static GstPadLinkReturn static GstPadLinkReturn
gst_postproc_link (GstPad * pad, const GstCaps * caps) gst_postproc_link (GstPad * pad, const GstCaps * caps)
{ {
GstPostProc *postproc; GstPostProc *postproc;
GstStructure *structure; GstStructure *structure;
GstPad *otherpad; GstPad *otherpad;
gboolean res; gboolean res;
GstPadLinkReturn ret; GstPadLinkReturn ret;
gint width, height; gint width, height;
/* create/replace pp_context here */ /* create/replace pp_context here */
postproc = (GstPostProc *) gst_pad_get_parent (pad); postproc = (GstPostProc *) gst_pad_get_parent (pad);
@ -333,10 +333,10 @@ gst_postproc_link (GstPad * pad, const GstCaps * caps)
static void static void
gst_postproc_chain (GstPad * pad, GstData * data) gst_postproc_chain (GstPad * pad, GstData * data)
{ {
GstPostProc *postproc; GstPostProc *postproc;
GstBuffer *in, *out; GstBuffer *in, *out;
int stride[3]; int stride[3];
unsigned char * outplane[3]; unsigned char * outplane[3];
GST_DEBUG("chaining"); GST_DEBUG("chaining");
@ -361,34 +361,34 @@ gst_postproc_chain (GstPad * pad, GstData * data)
outplane[2] = outplane[1] + postproc->usize; outplane[2] = outplane[1] + postproc->usize;
GST_DEBUG ("calling pp_postprocess, width:%d, height:%d", GST_DEBUG ("calling pp_postprocess, width:%d, height:%d",
postproc->width, postproc->height); postproc->width, postproc->height);
pp_postprocess (outplane, stride, pp_postprocess (outplane, stride,
outplane, stride, outplane, stride,
postproc->width, postproc->width,
postproc->height, postproc->height,
"", 0, "", 0,
postproc->mode, postproc->context, 1); postproc->mode, postproc->context, 1);
gst_buffer_stamp (out, in); gst_buffer_stamp (out, in);
gst_pad_push (postproc->srcpad, GST_DATA (out)); gst_pad_push (postproc->srcpad, GST_DATA (out));
/* /*
void pp_postprocess(uint8_t * src[3], int srcStride[3], void pp_postprocess(uint8_t * src[3], int srcStride[3],
uint8_t * dst[3], int dstStride[3], uint8_t * dst[3], int dstStride[3],
int horizontalSize, int verticalSize, int horizontalSize, int verticalSize,
QP_STORE_T *QP_store, int QP_stride, QP_STORE_T *QP_store, int QP_stride,
pp_mode_t *mode, pp_context_t *ppContext, int pict_type); pp_mode_t *mode, pp_context_t *ppContext, int pict_type);
src is the src buffer data src is the src buffer data
srcStride is ->ystride, ->ustride, ->vstride srcStride is ->ystride, ->ustride, ->vstride
dst same as src dst same as src
dstStride same as srcStride dstStride same as srcStride
horizontalSize and VerticalsSize are obvious horizontalSize and VerticalsSize are obvious
QP_store can be null and qp_stride too QP_store can be null and qp_stride too
mode = mode mode = mode
context = context context = context
pict_type = 0 pict_type = 0
*/ */
} }
@ -396,7 +396,7 @@ gst_postproc_chain (GstPad * pad, GstData * data)
static GstStateChangeReturn static GstStateChangeReturn
gst_postproc_change_state (GstElement * element, GstStateChange transition) 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 */ /* don't go to play if we don't have mode and context */
switch (transition) { switch (transition) {
@ -413,10 +413,10 @@ gst_postproc_change_state (GstElement * element, GstStateChange transition)
static void static void
gst_postproc_set_property ( GObject * object, guint prop_id, gst_postproc_set_property ( GObject * object, guint prop_id,
const GValue * value, const GValue * value,
GParamSpec *pspec ) GParamSpec *pspec )
{ {
GstPostProc *postproc = (GstPostProc *) object; GstPostProc *postproc = (GstPostProc *) object;
gint quality; gint quality;
switch (prop_id) { switch (prop_id) {
@ -434,9 +434,9 @@ gst_postproc_set_property ( GObject * object, guint prop_id,
static void static void
gst_postproc_get_property ( GObject * object, guint prop_id, 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) { switch (prop_id) {
case ARG_QUALITY: case ARG_QUALITY:
@ -451,7 +451,7 @@ gst_postproc_get_property ( GObject * object, guint prop_id,
gboolean gboolean
gst_postproc_register(GstPlugin * plugin) gst_postproc_register(GstPlugin * plugin)
{ {
GTypeInfo typeinfo = { GTypeInfo typeinfo = {
sizeof (GstPostProcClass), sizeof (GstPostProcClass),
(GBaseInitFunc) gst_postproc_base_init, (GBaseInitFunc) gst_postproc_base_init,
NULL, NULL,
@ -463,15 +463,15 @@ gst_postproc_register(GstPlugin * plugin)
(GInstanceInitFunc) gst_postproc_init, (GInstanceInitFunc) gst_postproc_init,
}; };
GType type; GType type;
int i; int i;
global_plugins = g_hash_table_new (NULL, NULL); global_plugins = g_hash_table_new (NULL, NULL);
for (i = 0; filterdetails[i].shortname; i++) { for (i = 0; filterdetails[i].shortname; i++) {
gchar *type_name; gchar *type_name;
g_hash_table_insert (global_plugins, g_hash_table_insert (global_plugins,
GINT_TO_POINTER (0), GINT_TO_POINTER (0),
GINT_TO_POINTER (i)); GINT_TO_POINTER (i));
/* create type_name */ /* create type_name */
type_name = g_strdup_printf("postproc_%s", filterdetails[i].longname); 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); type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
g_hash_table_insert (global_plugins, g_hash_table_insert (global_plugins,
GINT_TO_POINTER (type), GINT_TO_POINTER (type),
GINT_TO_POINTER (i)); GINT_TO_POINTER (i));
/* register element */ /* register element */
if (!gst_element_register (plugin, type_name, GST_RANK_PRIMARY, type)) { if (!gst_element_register (plugin, type_name, GST_RANK_PRIMARY, type)) {