Commit f85c7374 authored by Edward Hervey's avatar Edward Hervey 🤘

ext/ffmpeg/: gst-indent cleanup.

Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (gst_ffmpeg_avcodec_open),
(gst_ffmpeg_avcodec_close), (gst_ffmpeg_av_find_stream_info),
(gst_ffmpeg_log_callback), (plugin_init):
* ext/ffmpeg/gstffmpegcfg.c: (gst_ffmpeg_mb_decision_get_type),
(gst_ffmpeg_flags_get_type), (gst_ffmpeg_cfg_init),
(gst_ffmpeg_cfg_codec_has_pspec),
(gst_ffmpeg_cfg_install_property), (gst_ffmpeg_cfg_set_property),
(gst_ffmpeg_cfg_get_property), (gst_ffmpeg_cfg_set_defaults),
(gst_ffmpeg_cfg_fill_context), (gst_ffmpeg_cfg_finalize):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_save_incoming_values),
(gst_ffmpegdec_get_best_values), (gst_ffmpegdec_video_frame):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_base_init),
(gst_ffmpegdemux_src_query):
* ext/ffmpeg/gstffmpegenc.c: (ffmpegenc_setup_working_buf),
(gst_ffmpegenc_chain_video), (gst_ffmpegenc_flush_buffers):
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_read),
(gst_ffmpegdata_write), (gst_ffmpegdata_seek),
(gst_ffmpegdata_close):
gst-indent cleanup.
parent 62c4f570
2007-11-03 Edward Hervey <bilboed@bilboed.com>
* ext/ffmpeg/gstffmpeg.c: (gst_ffmpeg_avcodec_open),
(gst_ffmpeg_avcodec_close), (gst_ffmpeg_av_find_stream_info),
(gst_ffmpeg_log_callback), (plugin_init):
* ext/ffmpeg/gstffmpegcfg.c: (gst_ffmpeg_mb_decision_get_type),
(gst_ffmpeg_flags_get_type), (gst_ffmpeg_cfg_init),
(gst_ffmpeg_cfg_codec_has_pspec),
(gst_ffmpeg_cfg_install_property), (gst_ffmpeg_cfg_set_property),
(gst_ffmpeg_cfg_get_property), (gst_ffmpeg_cfg_set_defaults),
(gst_ffmpeg_cfg_fill_context), (gst_ffmpeg_cfg_finalize):
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_open),
(gst_ffmpegdec_setcaps), (gst_ffmpegdec_save_incoming_values),
(gst_ffmpegdec_get_best_values), (gst_ffmpegdec_video_frame):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_base_init),
(gst_ffmpegdemux_src_query):
* ext/ffmpeg/gstffmpegenc.c: (ffmpegenc_setup_working_buf),
(gst_ffmpegenc_chain_video), (gst_ffmpegenc_flush_buffers):
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_read),
(gst_ffmpegdata_write), (gst_ffmpegdata_seek),
(gst_ffmpegdata_close):
gst-indent cleanup.
2007-10-12 Tim-Philipp Müller <tim at centricular dot net>
* configure.ac:
......
......@@ -44,29 +44,32 @@ static GStaticMutex gst_avcodec_mutex = G_STATIC_MUTEX_INIT;
int
gst_ffmpeg_avcodec_open (AVCodecContext *avctx, AVCodec *codec) {
gst_ffmpeg_avcodec_open (AVCodecContext * avctx, AVCodec * codec)
{
int ret;
g_static_mutex_lock (&gst_avcodec_mutex);
ret = avcodec_open (avctx, codec);
g_static_mutex_unlock (&gst_avcodec_mutex);
return ret;
}
int
gst_ffmpeg_avcodec_close (AVCodecContext *avctx) {
gst_ffmpeg_avcodec_close (AVCodecContext * avctx)
{
int ret;
g_static_mutex_lock (&gst_avcodec_mutex);
ret = avcodec_close (avctx);
g_static_mutex_unlock (&gst_avcodec_mutex);
return ret;
}
int
gst_ffmpeg_av_find_stream_info(AVFormatContext *ic) {
gst_ffmpeg_av_find_stream_info (AVFormatContext * ic)
{
int ret;
g_static_mutex_lock (&gst_avcodec_mutex);
......@@ -78,7 +81,7 @@ gst_ffmpeg_av_find_stream_info(AVFormatContext *ic) {
#ifndef GST_DISABLE_GST_DEBUG
static void
gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
gst_ffmpeg_log_callback (void *ptr, int level, const char *fmt, va_list vl)
{
GstDebugLevel gst_level;
gint len = strlen (fmt);
......@@ -106,14 +109,15 @@ gst_ffmpeg_log_callback (void * ptr, int level, const char * fmt, va_list vl)
}
/* remove trailing newline as it gets already appended by the logger */
if (fmt[len-1] == '\n') {
if (fmt[len - 1] == '\n') {
fmt2 = g_strdup (fmt);
fmt2[len-1] = '\0';
fmt2[len - 1] = '\0';
}
gst_debug_log_valist (ffmpeg_debug, gst_level, "", "", 0, NULL, fmt2?fmt2:fmt, vl);
gst_debug_log_valist (ffmpeg_debug, gst_level, "", "", 0, NULL,
fmt2 ? fmt2 : fmt, vl);
g_free(fmt2);
g_free (fmt2);
}
#endif
......@@ -130,7 +134,7 @@ plugin_init (GstPlugin * plugin)
av_log_set_callback (gst_ffmpeg_log_callback);
#endif
gst_ffmpeg_init_pix_fmt_info();
gst_ffmpeg_init_pix_fmt_info ();
av_register_all ();
......@@ -156,5 +160,3 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
"All FFMPEG codecs (" FFMPEG_SOURCE ")",
plugin_init,
PACKAGE_VERSION, "LGPL", "FFMpeg", "http://ffmpeg.sourceforge.net/")
This diff is collapsed.
......@@ -277,12 +277,12 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
"systemstream", G_TYPE_BOOLEAN, FALSE,
"rmversion", G_TYPE_INT, version, NULL);
if (context) {
gst_caps_set_simple (caps,
"format", G_TYPE_INT, context->sub_id, NULL);
gst_caps_set_simple (caps, "format", G_TYPE_INT, context->sub_id, NULL);
if (context->extradata_size >= 8) {
gst_caps_set_simple (caps,
"subformat", G_TYPE_INT, GST_READ_UINT32_BE (context->extradata), NULL);
}
"subformat", G_TYPE_INT, GST_READ_UINT32_BE (context->extradata),
NULL);
}
}
}
break;
......
......@@ -544,7 +544,8 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
}
/* out-of-order incoming buffer handling */
if ((oclass->in_plugin->id == CODEC_ID_H264) && (ffmpegdec->context->extradata_size != 0))
if ((oclass->in_plugin->id == CODEC_ID_H264)
&& (ffmpegdec->context->extradata_size != 0))
ffmpegdec->outoforder = TRUE;
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE;
......@@ -630,7 +631,7 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
GST_DEBUG_OBJECT (ffmpegdec, "Using framerate from codec");
}
if(oclass->in_plugin->id != CODEC_ID_H264) {
if (oclass->in_plugin->id != CODEC_ID_H264) {
/* do *not* draw edges */
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
}
......@@ -852,13 +853,14 @@ no_par:
}
static void
gst_ffmpegdec_save_incoming_values (GstFFMpegDec * ffmpegdec, GstClockTime timestamp,
GstClockTime duration)
gst_ffmpegdec_save_incoming_values (GstFFMpegDec * ffmpegdec,
GstClockTime timestamp, GstClockTime duration)
{
GST_LOG_OBJECT (ffmpegdec, "BEFORE timestamp:%"GST_TIME_FORMAT"/%"GST_TIME_FORMAT
" duration:%"GST_TIME_FORMAT"/%"GST_TIME_FORMAT,
GST_TIME_ARGS (ffmpegdec->tstamp1), GST_TIME_ARGS (ffmpegdec->tstamp2),
GST_TIME_ARGS (ffmpegdec->dur1), GST_TIME_ARGS (ffmpegdec->dur2));
GST_LOG_OBJECT (ffmpegdec,
"BEFORE timestamp:%" GST_TIME_FORMAT "/%" GST_TIME_FORMAT " duration:%"
GST_TIME_FORMAT "/%" GST_TIME_FORMAT, GST_TIME_ARGS (ffmpegdec->tstamp1),
GST_TIME_ARGS (ffmpegdec->tstamp2), GST_TIME_ARGS (ffmpegdec->dur1),
GST_TIME_ARGS (ffmpegdec->dur2));
/* shift previous new values to oldest */
if (ffmpegdec->tstamp2 != GST_CLOCK_TIME_NONE)
......@@ -869,16 +871,17 @@ gst_ffmpegdec_save_incoming_values (GstFFMpegDec * ffmpegdec, GstClockTime times
ffmpegdec->tstamp2 = timestamp;
ffmpegdec->dur2 = duration;
GST_LOG_OBJECT (ffmpegdec, "AFTER timestamp:%"GST_TIME_FORMAT"/%"GST_TIME_FORMAT
" duration:%"GST_TIME_FORMAT"/%"GST_TIME_FORMAT,
GST_TIME_ARGS (ffmpegdec->tstamp1), GST_TIME_ARGS (ffmpegdec->tstamp2),
GST_TIME_ARGS (ffmpegdec->dur1), GST_TIME_ARGS (ffmpegdec->dur2));
GST_LOG_OBJECT (ffmpegdec,
"AFTER timestamp:%" GST_TIME_FORMAT "/%" GST_TIME_FORMAT " duration:%"
GST_TIME_FORMAT "/%" GST_TIME_FORMAT, GST_TIME_ARGS (ffmpegdec->tstamp1),
GST_TIME_ARGS (ffmpegdec->tstamp2), GST_TIME_ARGS (ffmpegdec->dur1),
GST_TIME_ARGS (ffmpegdec->dur2));
}
static void
gst_ffmpegdec_get_best_values (GstFFMpegDec * ffmpegdec, GstClockTime *timestamp,
GstClockTime *duration)
gst_ffmpegdec_get_best_values (GstFFMpegDec * ffmpegdec,
GstClockTime * timestamp, GstClockTime * duration)
{
/* Best timestamp is the smallest valid timestamp */
if (ffmpegdec->tstamp1 == GST_CLOCK_TIME_NONE) {
......@@ -904,9 +907,9 @@ gst_ffmpegdec_get_best_values (GstFFMpegDec * ffmpegdec, GstClockTime *timestamp
ffmpegdec->dur1 = GST_CLOCK_TIME_NONE;
}
GST_LOG_OBJECT (ffmpegdec, "Returning timestamp:%"GST_TIME_FORMAT" duration:%"GST_TIME_FORMAT,
GST_TIME_ARGS (*timestamp),
GST_TIME_ARGS (*duration));
GST_LOG_OBJECT (ffmpegdec,
"Returning timestamp:%" GST_TIME_FORMAT " duration:%" GST_TIME_FORMAT,
GST_TIME_ARGS (*timestamp), GST_TIME_ARGS (*duration));
}
static gboolean
......@@ -1429,7 +1432,7 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
/* if we have an input framerate, use that */
if (ffmpegdec->format.video.fps_n != -1 &&
(ffmpegdec->format.video.fps_n != 1000 &&
ffmpegdec->format.video.fps_d != 1)) {
ffmpegdec->format.video.fps_d != 1)) {
GST_LOG_OBJECT (ffmpegdec, "using input framerate for duration");
in_duration = gst_util_uint64_scale_int (GST_SECOND,
ffmpegdec->format.video.fps_d, ffmpegdec->format.video.fps_n);
......@@ -1447,8 +1450,7 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
GST_LOG_OBJECT (ffmpegdec, "no valid duration found");
}
}
}
else {
} else {
GST_LOG_OBJECT (ffmpegdec, "using in_duration");
}
......
......@@ -171,8 +171,7 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass * klass)
GstElementDetails details;
GstPadTemplate *sinktempl, *audiosrctempl, *videosrctempl;
params =
(GstFFMpegDemuxClassParams *)
params = (GstFFMpegDemuxClassParams *)
g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), GST_FFDEMUX_PARAMS_QDATA);
g_assert (params != NULL);
......@@ -711,8 +710,8 @@ gst_ffmpegdemux_src_query (GstPad * pad, GstQuery * query)
timeduration =
gst_ffmpeg_time_ff_to_gst (avstream->duration, avstream->time_base);
if (!(GST_CLOCK_TIME_IS_VALID (timeduration))) {
/* use duration of complete file if the stream duration is not known */
timeduration = demux->duration;
/* use duration of complete file if the stream duration is not known */
timeduration = demux->duration;
if (!(GST_CLOCK_TIME_IS_VALID (timeduration)))
break;
}
......
......@@ -570,9 +570,9 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
}
static void
ffmpegenc_setup_working_buf (GstFFMpegEnc *ffmpegenc)
ffmpegenc_setup_working_buf (GstFFMpegEnc * ffmpegenc)
{
if (ffmpegenc->working_buf == NULL ||
if (ffmpegenc->working_buf == NULL ||
ffmpegenc->working_buf_size != ffmpegenc->buffer_size) {
if (ffmpegenc->working_buf)
g_free (ffmpegenc->working_buf);
......@@ -605,8 +605,7 @@ gst_ffmpegenc_chain_video (GstPad * pad, GstBuffer * inbuf)
ffmpegenc_setup_working_buf (ffmpegenc);
ret_size = avcodec_encode_video (ffmpegenc->context,
ffmpegenc->working_buf, ffmpegenc->working_buf_size,
ffmpegenc->picture);
ffmpegenc->working_buf, ffmpegenc->working_buf_size, ffmpegenc->picture);
if (ret_size < 0) {
#ifndef GST_DISABLE_GST_DEBUG
......@@ -758,7 +757,7 @@ gst_ffmpegenc_flush_buffers (GstFFMpegEnc * ffmpegenc, gboolean send)
ffmpegenc_setup_working_buf (ffmpegenc);
ret_size = avcodec_encode_video (ffmpegenc->context,
ffmpegenc->working_buf, ffmpegenc->working_buf_size, NULL);
ffmpegenc->working_buf, ffmpegenc->working_buf_size, NULL);
if (ret_size < 0) { /* there should be something, notify and give up */
#ifndef GST_DISABLE_GST_DEBUG
......
......@@ -57,7 +57,7 @@ gst_ffmpegdata_open (URLContext * h, const char *filename, int flags)
info->set_streamheader = flags & GST_FFMPEG_URL_STREAMHEADER;
flags &= ~GST_FFMPEG_URL_STREAMHEADER;
h->flags &= ~GST_FFMPEG_URL_STREAMHEADER;
/* we don't support R/W together */
if (flags != URL_RDONLY && flags != URL_WRONLY) {
GST_WARNING ("Only read-only or write-only are supported");
......@@ -98,14 +98,14 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
GstProtocolInfo *info;
GstBuffer *inbuf = NULL;
GstFlowReturn ret;
int total = 0;
int total = 0;
g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR_IO);
info = (GstProtocolInfo *) h->priv_data;
GST_DEBUG ("Pulling %d bytes at position %lld", size, info->offset);
ret = gst_pad_pull_range(info->pad, info->offset, (guint) size, &inbuf);
ret = gst_pad_pull_range (info->pad, info->offset, (guint) size, &inbuf);
switch (ret) {
case GST_FLOW_OK:
......@@ -125,7 +125,8 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
break;
}
GST_DEBUG ("Got %d (%s) return result %d", ret, gst_flow_get_name (ret), total);
GST_DEBUG ("Got %d (%s) return result %d", ret, gst_flow_get_name (ret),
total);
return total;
}
......@@ -140,7 +141,7 @@ gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size)
GST_DEBUG ("Reading %d bytes of data at position %lld", size, info->offset);
res = gst_ffmpegdata_peek(h, buf, size);
res = gst_ffmpegdata_peek (h, buf, size);
if (res >= 0)
info->offset += res;
......@@ -161,15 +162,13 @@ gst_ffmpegdata_write (URLContext * h, unsigned char *buf, int size)
g_return_val_if_fail (h->flags != URL_RDONLY, -EIO);
/* create buffer and push data further */
if (gst_pad_alloc_buffer_and_set_caps(info->pad,
info->offset,
size, GST_PAD_CAPS (info->pad),
&outbuf) != GST_FLOW_OK)
if (gst_pad_alloc_buffer_and_set_caps (info->pad,
info->offset, size, GST_PAD_CAPS (info->pad), &outbuf) != GST_FLOW_OK)
return 0;
memcpy (GST_BUFFER_DATA (outbuf), buf, size);
if (gst_pad_push(info->pad, outbuf) != GST_FLOW_OK)
if (gst_pad_push (info->pad, outbuf) != GST_FLOW_OK)
return 0;
info->offset += size;
......@@ -189,59 +188,60 @@ gst_ffmpegdata_seek (URLContext * h, offset_t pos, int whence)
/* TODO : if we are push-based, we need to return sensible info */
switch (h->flags) {
case URL_RDONLY:
case URL_RDONLY:
{
/* sinkpad */
switch (whence) {
case SEEK_SET:
info->offset = (guint64) pos;
break;
case SEEK_CUR:
info->offset += pos;
break;
case SEEK_END:
/* ffmpeg wants to know the current end position in bytes ! */
{
GstFormat format = GST_FORMAT_BYTES;
gint64 duration;
if (gst_pad_is_linked (info->pad))
if (gst_pad_query_duration (GST_PAD_PEER (info->pad), &format, &duration))
info->offset = ((guint64) duration) + pos;
}
break;
default:
break;
case SEEK_SET:
info->offset = (guint64) pos;
break;
case SEEK_CUR:
info->offset += pos;
break;
case SEEK_END:
/* ffmpeg wants to know the current end position in bytes ! */
{
GstFormat format = GST_FORMAT_BYTES;
gint64 duration;
if (gst_pad_is_linked (info->pad))
if (gst_pad_query_duration (GST_PAD_PEER (info->pad), &format,
&duration))
info->offset = ((guint64) duration) + pos;
}
break;
default:
break;
}
/* FIXME : implement case for push-based behaviour */
newpos = info->offset;
}
break;
case URL_WRONLY:
break;
case URL_WRONLY:
{
/* srcpad */
switch (whence) {
case SEEK_SET:
info->offset = (guint64) pos;
gst_pad_push_event (info->pad,gst_event_new_new_segment
(TRUE, 1.0, GST_FORMAT_BYTES, info->offset,
GST_CLOCK_TIME_NONE, info->offset));
break;
case SEEK_CUR:
info->offset += pos;
gst_pad_push_event (info->pad,gst_event_new_new_segment
(TRUE, 1.0, GST_FORMAT_BYTES, info->offset,
GST_CLOCK_TIME_NONE, info->offset));
break;
default:
break;
case SEEK_SET:
info->offset = (guint64) pos;
gst_pad_push_event (info->pad, gst_event_new_new_segment
(TRUE, 1.0, GST_FORMAT_BYTES, info->offset,
GST_CLOCK_TIME_NONE, info->offset));
break;
case SEEK_CUR:
info->offset += pos;
gst_pad_push_event (info->pad, gst_event_new_new_segment
(TRUE, 1.0, GST_FORMAT_BYTES, info->offset,
GST_CLOCK_TIME_NONE, info->offset));
break;
default:
break;
}
newpos = info->offset;
}
break;
default:
g_assert(0);
break;
break;
default:
g_assert (0);
break;
}
GST_DEBUG ("Now at offset %lld", info->offset);
......@@ -263,13 +263,13 @@ gst_ffmpegdata_close (URLContext * h)
case URL_WRONLY:
{
/* send EOS - that closes down the stream */
gst_pad_push_event (info->pad, gst_event_new_eos());
gst_pad_push_event (info->pad, gst_event_new_eos ());
break;
}
default:
break;
}
/* clean up data */
g_free (info);
h->priv_data = NULL;
......@@ -279,10 +279,10 @@ gst_ffmpegdata_close (URLContext * h)
URLProtocol gstreamer_protocol = {
/*.name = */"gstreamer",
/*.url_open = */gst_ffmpegdata_open,
/*.url_read = */gst_ffmpegdata_read,
/*.url_write = */gst_ffmpegdata_write,
/*.url_seek = */gst_ffmpegdata_seek,
/*.url_close = */gst_ffmpegdata_close,
/*.name = */ "gstreamer",
/*.url_open = */ gst_ffmpegdata_open,
/*.url_read = */ gst_ffmpegdata_read,
/*.url_write = */ gst_ffmpegdata_write,
/*.url_seek = */ gst_ffmpegdata_seek,
/*.url_close = */ gst_ffmpegdata_close,
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment