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.
This commit is contained in:
Edward Hervey 2007-11-03 16:14:53 +00:00
parent 62c4f57092
commit f85c737410
8 changed files with 248 additions and 232 deletions

View file

@ -1,3 +1,28 @@
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> 2007-10-12 Tim-Philipp Müller <tim at centricular dot net>
* configure.ac: * configure.ac:

View file

@ -44,29 +44,32 @@ static GStaticMutex gst_avcodec_mutex = G_STATIC_MUTEX_INIT;
int int
gst_ffmpeg_avcodec_open (AVCodecContext *avctx, AVCodec *codec) { gst_ffmpeg_avcodec_open (AVCodecContext * avctx, AVCodec * codec)
{
int ret; int ret;
g_static_mutex_lock (&gst_avcodec_mutex); g_static_mutex_lock (&gst_avcodec_mutex);
ret = avcodec_open (avctx, codec); ret = avcodec_open (avctx, codec);
g_static_mutex_unlock (&gst_avcodec_mutex); g_static_mutex_unlock (&gst_avcodec_mutex);
return ret; return ret;
} }
int int
gst_ffmpeg_avcodec_close (AVCodecContext *avctx) { gst_ffmpeg_avcodec_close (AVCodecContext * avctx)
{
int ret; int ret;
g_static_mutex_lock (&gst_avcodec_mutex); g_static_mutex_lock (&gst_avcodec_mutex);
ret = avcodec_close (avctx); ret = avcodec_close (avctx);
g_static_mutex_unlock (&gst_avcodec_mutex); g_static_mutex_unlock (&gst_avcodec_mutex);
return ret; return ret;
} }
int int
gst_ffmpeg_av_find_stream_info(AVFormatContext *ic) { gst_ffmpeg_av_find_stream_info (AVFormatContext * ic)
{
int ret; int ret;
g_static_mutex_lock (&gst_avcodec_mutex); g_static_mutex_lock (&gst_avcodec_mutex);
@ -78,7 +81,7 @@ gst_ffmpeg_av_find_stream_info(AVFormatContext *ic) {
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
static void 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; GstDebugLevel gst_level;
gint len = strlen (fmt); 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 */ /* 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 = 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 #endif
@ -130,7 +134,7 @@ plugin_init (GstPlugin * plugin)
av_log_set_callback (gst_ffmpeg_log_callback); av_log_set_callback (gst_ffmpeg_log_callback);
#endif #endif
gst_ffmpeg_init_pix_fmt_info(); gst_ffmpeg_init_pix_fmt_info ();
av_register_all (); av_register_all ();
@ -156,5 +160,3 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
"All FFMPEG codecs (" FFMPEG_SOURCE ")", "All FFMPEG codecs (" FFMPEG_SOURCE ")",
plugin_init, plugin_init,
PACKAGE_VERSION, "LGPL", "FFMpeg", "http://ffmpeg.sourceforge.net/") PACKAGE_VERSION, "LGPL", "FFMpeg", "http://ffmpeg.sourceforge.net/")

View file

@ -86,7 +86,8 @@ gst_ffmpeg_mb_decision_get_type (void)
if (!ffmpeg_mb_decision_type) { if (!ffmpeg_mb_decision_type) {
static const GEnumValue ffmpeg_mb_decisions[] = { static const GEnumValue ffmpeg_mb_decisions[] = {
{FF_MB_DECISION_SIMPLE, "Use method set by mb-cmp", "simple"}, {FF_MB_DECISION_SIMPLE, "Use method set by mb-cmp", "simple"},
{FF_MB_DECISION_BITS, "Chooses the one which needs the fewest bits aka vhq mode", "bits"}, {FF_MB_DECISION_BITS,
"Chooses the one which needs the fewest bits aka vhq mode", "bits"},
{FF_MB_DECISION_RD, "Rate Distortion", "rd"}, {FF_MB_DECISION_RD, "Rate Distortion", "rd"},
{0, NULL, NULL}, {0, NULL, NULL},
}; };
@ -263,16 +264,23 @@ gst_ffmpeg_flags_get_type (void)
{CODEC_FLAG_QPEL, "Quartel Pel Motion Compensation", "qpel"}, {CODEC_FLAG_QPEL, "Quartel Pel Motion Compensation", "qpel"},
{CODEC_FLAG_GMC, "GMC", "gmc"}, {CODEC_FLAG_GMC, "GMC", "gmc"},
{CODEC_FLAG_MV0, "Always try a MB with MV (0,0)", "mv0"}, {CODEC_FLAG_MV0, "Always try a MB with MV (0,0)", "mv0"},
{CODEC_FLAG_PART, "Store MV, DC and AC coefficients in seperate partitions", "part"}, {CODEC_FLAG_PART,
"Store MV, DC and AC coefficients in seperate partitions", "part"},
{CODEC_FLAG_GRAY, "Only decode/encode grayscale", "gray"}, {CODEC_FLAG_GRAY, "Only decode/encode grayscale", "gray"},
{CODEC_FLAG_NORMALIZE_AQP, "Normalize Adaptive Quantization (masking, etc)", "aqp"}, {CODEC_FLAG_NORMALIZE_AQP,
"Normalize Adaptive Quantization (masking, etc)", "aqp"},
{CODEC_FLAG_TRELLIS_QUANT, "Trellis Quantization", "trellis"}, {CODEC_FLAG_TRELLIS_QUANT, "Trellis Quantization", "trellis"},
{CODEC_FLAG_GLOBAL_HEADER, "Global headers in extradata instead of every keyframe", "global-headers"}, {CODEC_FLAG_GLOBAL_HEADER,
{CODEC_FLAG_AC_PRED, "H263 Advanced Intra Coding / MPEG4 AC prediction", "aic"}, "Global headers in extradata instead of every keyframe",
"global-headers"},
{CODEC_FLAG_AC_PRED, "H263 Advanced Intra Coding / MPEG4 AC prediction",
"aic"},
{CODEC_FLAG_H263P_UMV, "Unlimited Motion Vector", "umv"}, {CODEC_FLAG_H263P_UMV, "Unlimited Motion Vector", "umv"},
{CODEC_FLAG_CBP_RD, "Rate Distoration Optimization for CBP", "cbp-rd"}, {CODEC_FLAG_CBP_RD, "Rate Distoration Optimization for CBP", "cbp-rd"},
{CODEC_FLAG_QP_RD, "Rate Distoration Optimization for QP selection", "qp-rd"}, {CODEC_FLAG_QP_RD, "Rate Distoration Optimization for QP selection",
{CODEC_FLAG_SVCD_SCAN_OFFSET, "Reserve space for SVCD scan offset user data", "scanoffset"}, "qp-rd"},
{CODEC_FLAG_SVCD_SCAN_OFFSET,
"Reserve space for SVCD scan offset user data", "scanoffset"},
{CODEC_FLAG_CLOSED_GOP, "Closed GOP", "closedgop"}, {CODEC_FLAG_CLOSED_GOP, "Closed GOP", "closedgop"},
{0, NULL, NULL}, {0, NULL, NULL},
}; };
@ -375,13 +383,11 @@ gst_ffmpeg_cfg_init ()
/* list properties here */ /* list properties here */
pspec = g_param_spec_enum ("pass", "Encoding pass/type", pspec = g_param_spec_enum ("pass", "Encoding pass/type",
"Encoding pass/type", GST_TYPE_FFMPEG_PASS, "Encoding pass/type", GST_TYPE_FFMPEG_PASS, 0, G_PARAM_READWRITE);
0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, pass, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, pass, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("quantizer", "Constant Quantizer", pspec = g_param_spec_float ("quantizer", "Constant Quantizer",
"Constant Quantizer", 0, 30, 0.01f, "Constant Quantizer", 0, 30, 0.01f, G_PARAM_READWRITE);
G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, quantizer, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, quantizer, FALSE, mpeg, NULL);
pspec = g_param_spec_string ("statsfile", "Statistics Filename", pspec = g_param_spec_string ("statsfile", "Statistics Filename",
@ -404,7 +410,9 @@ gst_ffmpeg_cfg_init ()
GST_TYPE_FFMPEG_CMP_FUNCTION, FF_CMP_SAD, G_PARAM_READWRITE); GST_TYPE_FFMPEG_CMP_FUNCTION, FF_CMP_SAD, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.mb_cmp, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.mb_cmp, FALSE, mpeg, NULL);
pspec = g_param_spec_enum ("me-pre-cmp", "Motion Estimation Pre Pass Compare Function", pspec =
g_param_spec_enum ("me-pre-cmp",
"Motion Estimation Pre Pass Compare Function",
"Motion Estimation Pre Pass Compare Function", "Motion Estimation Pre Pass Compare Function",
GST_TYPE_FFMPEG_CMP_FUNCTION, FF_CMP_SAD, G_PARAM_READWRITE); GST_TYPE_FFMPEG_CMP_FUNCTION, FF_CMP_SAD, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.me_pre_cmp, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.me_pre_cmp, FALSE, mpeg, NULL);
@ -436,18 +444,15 @@ gst_ffmpeg_cfg_init ()
gst_ffmpeg_add_pspec (pspec, config.idct_algo, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.idct_algo, FALSE, mpeg, NULL);
pspec = g_param_spec_enum ("quant-type", "Quantizer Type", pspec = g_param_spec_enum ("quant-type", "Quantizer Type",
"Quantizer Type", "Quantizer Type", GST_TYPE_FFMPEG_QUANT_TYPE, 0, G_PARAM_READWRITE);
GST_TYPE_FFMPEG_QUANT_TYPE, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.mpeg_quant, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.mpeg_quant, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("qmin", "Minimum Quantizer", pspec = g_param_spec_int ("qmin", "Minimum Quantizer",
"Minimum Quantizer", "Minimum Quantizer", 1, 31, 2, G_PARAM_READWRITE);
1, 31, 2, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.qmin, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.qmin, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("qmax", "Maximum Quantizer", pspec = g_param_spec_int ("qmax", "Maximum Quantizer",
"Maximum Quantizer", "Maximum Quantizer", 1, 31, 31, G_PARAM_READWRITE);
1, 31, 31, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.qmax, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.qmax, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("max-qdiff", "Maximum Quantizer Difference", pspec = g_param_spec_int ("max-qdiff", "Maximum Quantizer Difference",
@ -456,23 +461,19 @@ gst_ffmpeg_cfg_init ()
gst_ffmpeg_add_pspec (pspec, config.max_qdiff, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.max_qdiff, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("mb_qmin", "Minimum MB Quantizer", pspec = g_param_spec_int ("mb_qmin", "Minimum MB Quantizer",
"Minimum MB Quantizer", "Minimum MB Quantizer", 0, 31, 2, G_PARAM_READWRITE);
0, 31, 2, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.mb_qmin, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.mb_qmin, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("mb_qmax", "Maximum MB Quantizer", pspec = g_param_spec_int ("mb_qmax", "Maximum MB Quantizer",
"Maximum MB Quantizer", "Maximum MB Quantizer", 0, 31, 31, G_PARAM_READWRITE);
0, 31, 31, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.mb_qmax, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.mb_qmax, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("lmin", "Minimum Lagrange Multiplier", pspec = g_param_spec_int ("lmin", "Minimum Lagrange Multiplier",
"Minimum Lagrange Multiplier", "Minimum Lagrange Multiplier", 1, 31, 2, G_PARAM_READWRITE);
1, 31, 2, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, lmin, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, lmin, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("lmax", "Maximum Lagrange Multiplier", pspec = g_param_spec_int ("lmax", "Maximum Lagrange Multiplier",
"Maximum Lagrange Multiplier", "Maximum Lagrange Multiplier", 1, 31, 31, G_PARAM_READWRITE);
1, 31, 31, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, lmax, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, lmax, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("qcompress", "Quantizer Change", pspec = g_param_spec_float ("qcompress", "Quantizer Change",
@ -481,8 +482,7 @@ gst_ffmpeg_cfg_init ()
gst_ffmpeg_add_pspec (pspec, config.qcompress, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.qcompress, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("qblur", "Quantizer Smoothing", pspec = g_param_spec_float ("qblur", "Quantizer Smoothing",
"Quantizer Smoothing over time", "Quantizer Smoothing over time", 0, 1.0f, 0.5f, G_PARAM_READWRITE);
0, 1.0f, 0.5f, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.qblur, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.qblur, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("rc-qsquish", "Ratecontrol Limiting Method", pspec = g_param_spec_float ("rc-qsquish", "Ratecontrol Limiting Method",
@ -491,43 +491,41 @@ gst_ffmpeg_cfg_init ()
gst_ffmpeg_add_pspec (pspec, config.rc_qsquish, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.rc_qsquish, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("rc-qmod-amp", "Ratecontrol Mod", pspec = g_param_spec_float ("rc-qmod-amp", "Ratecontrol Mod",
"Ratecontrol Mod", "Ratecontrol Mod", 0, 99.0f, 0, G_PARAM_READWRITE);
0, 99.0f, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.rc_qmod_amp, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.rc_qmod_amp, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("rc-qmod-freq", "Ratecontrol Freq", pspec = g_param_spec_int ("rc-qmod-freq", "Ratecontrol Freq",
"Ratecontrol Freq", "Ratecontrol Freq", 0, 0, 0, G_PARAM_READWRITE);
0, 0, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.rc_qmod_freq, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.rc_qmod_freq, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("rc-buffer-size", "Ratecontrol Buffer Size", pspec = g_param_spec_int ("rc-buffer-size", "Ratecontrol Buffer Size",
"Decoder bitstream buffer size", "Decoder bitstream buffer size", 0, G_MAXINT, 0, G_PARAM_READWRITE);
0, G_MAXINT, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.rc_buffer_size, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.rc_buffer_size, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("rc-buffer-aggressivity", "Ratecontrol Buffer Aggressivity", pspec =
"Ratecontrol Buffer Aggressivity", g_param_spec_float ("rc-buffer-aggressivity",
0, 99.0f, 1.0f, G_PARAM_READWRITE); "Ratecontrol Buffer Aggressivity", "Ratecontrol Buffer Aggressivity", 0,
gst_ffmpeg_add_pspec (pspec, config.rc_buffer_aggressivity, FALSE, mpeg, NULL); 99.0f, 1.0f, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.rc_buffer_aggressivity, FALSE, mpeg,
NULL);
pspec = g_param_spec_int ("rc-max-rate", "Ratecontrol Maximum Bitrate", pspec = g_param_spec_int ("rc-max-rate", "Ratecontrol Maximum Bitrate",
"Ratecontrol Maximum Bitrate", "Ratecontrol Maximum Bitrate", 0, G_MAXINT, 0, G_PARAM_READWRITE);
0, G_MAXINT, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.rc_max_rate, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.rc_max_rate, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("rc-min-rate", "Ratecontrol Minimum Bitrate", pspec = g_param_spec_int ("rc-min-rate", "Ratecontrol Minimum Bitrate",
"Ratecontrol Minimum Bitrate", "Ratecontrol Minimum Bitrate", 0, G_MAXINT, 0, G_PARAM_READWRITE);
0, G_MAXINT, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.rc_min_rate, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.rc_min_rate, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("rc-initial-cplx", "Initial Complexity for Pass 1 Ratecontrol", pspec =
g_param_spec_float ("rc-initial-cplx",
"Initial Complexity for Pass 1 Ratecontrol", "Initial Complexity for Pass 1 Ratecontrol",
0, 9999999.0f, 0, G_PARAM_READWRITE); "Initial Complexity for Pass 1 Ratecontrol", 0, 9999999.0f, 0,
G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.rc_initial_cplx, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.rc_initial_cplx, FALSE, mpeg, NULL);
pspec = g_param_spec_string ("rc-eq", "Ratecontrol Equation", pspec = g_param_spec_string ("rc-eq", "Ratecontrol Equation",
"Ratecontrol Equation", "Ratecontrol Equation", "tex^qComp", G_PARAM_READWRITE);
"tex^qComp", G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.rc_eq, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.rc_eq, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("b-quant-factor", "B-Quantizer Factor", pspec = g_param_spec_float ("b-quant-factor", "B-Quantizer Factor",
@ -569,30 +567,25 @@ gst_ffmpeg_cfg_init ()
gst_ffmpeg_add_pspec (pspec, config.chroma_elim_threshold, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.chroma_elim_threshold, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("lumi-masking", "Luminance Masking", pspec = g_param_spec_float ("lumi-masking", "Luminance Masking",
"Luminance Masking", "Luminance Masking", -1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
-1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.lumi_masking, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.lumi_masking, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("dark-masking", "Darkness Masking", pspec = g_param_spec_float ("dark-masking", "Darkness Masking",
"Darkness Masking", "Darkness Masking", -1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
-1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.dark_masking, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.dark_masking, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("temporal-cplx-masking", pspec = g_param_spec_float ("temporal-cplx-masking",
"Temporal Complexity Masking", "Temporal Complexity Masking",
"Temporal Complexity Masking", "Temporal Complexity Masking", -1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
-1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.temporal_cplx_masking, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.temporal_cplx_masking, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("spatial-cplx-masking", pspec = g_param_spec_float ("spatial-cplx-masking",
"Spatial Complexity Masking", "Spatial Complexity Masking",
"Spatial Complexity Masking", "Spatial Complexity Masking", -1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
-1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.spatial_cplx_masking, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.spatial_cplx_masking, FALSE, mpeg, NULL);
pspec = g_param_spec_float ("p-masking", "P Block Masking", pspec = g_param_spec_float ("p-masking", "P Block Masking",
"P Block Masking", "P Block Masking", -1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
-1.0f, 1.0f, 0.0f, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.p_masking, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.p_masking, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("dia-size", pspec = g_param_spec_int ("dia-size",
@ -610,7 +603,7 @@ gst_ffmpeg_cfg_init ()
pspec = g_param_spec_int ("last-predictor-count", pspec = g_param_spec_int ("last-predictor-count",
"Last Predictor Count", "Last Predictor Count",
"Amount of previous Motion Vector predictors", "Amount of previous Motion Vector predictors",
0, 2000, 0, G_PARAM_READWRITE); 0, 2000, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.last_predictor_count, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.last_predictor_count, FALSE, mpeg, NULL);
pspec = g_param_spec_enum ("pre-me", pspec = g_param_spec_enum ("pre-me",
@ -645,31 +638,26 @@ gst_ffmpeg_cfg_init ()
pspec = g_param_spec_int ("noise-reduction", pspec = g_param_spec_int ("noise-reduction",
"Noise Reduction", "Noise Reduction",
"Noise Reduction Strength", "Noise Reduction Strength", 0, 1000000, 0, G_PARAM_READWRITE);
0, 1000000, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.noise_reduction, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.noise_reduction, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("intra-dc-precision", pspec = g_param_spec_int ("intra-dc-precision",
"Intra DC precision", "Intra DC precision",
"Precision of the Intra DC coefficient - 8", "Precision of the Intra DC coefficient - 8", 0, 16, 0, G_PARAM_READWRITE);
0, 16, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.intra_dc_precision, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.intra_dc_precision, FALSE, mpeg, NULL);
/* TODO skipped coder_type, context_model, inter_threshold, scenechange_threshold */ /* TODO skipped coder_type, context_model, inter_threshold, scenechange_threshold */
pspec = g_param_spec_flags ("flags", "Flags", pspec = g_param_spec_flags ("flags", "Flags",
"Flags", "Flags", GST_TYPE_FFMPEG_FLAGS, 0, G_PARAM_READWRITE);
GST_TYPE_FFMPEG_FLAGS, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.flags, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.flags, FALSE, mpeg, NULL);
pspec = g_param_spec_boolean ("interlaced", "Interlaced Material", pspec = g_param_spec_boolean ("interlaced", "Interlaced Material",
"Interlaced Material", "Interlaced Material", FALSE, G_PARAM_READWRITE);
FALSE, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, interlaced, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, interlaced, FALSE, mpeg, NULL);
pspec = g_param_spec_int ("max-bframes", "Max B-Frames", pspec = g_param_spec_int ("max-bframes", "Max B-Frames",
"Maximum B-frames in a row", "Maximum B-frames in a row", 0, FF_MAX_B_FRAMES, 0, G_PARAM_READWRITE);
0, FF_MAX_B_FRAMES, 0, G_PARAM_READWRITE);
gst_ffmpeg_add_pspec (pspec, config.max_b_frames, FALSE, mpeg, NULL); gst_ffmpeg_add_pspec (pspec, config.max_b_frames, FALSE, mpeg, NULL);
pspec = g_param_spec_enum ("prediction-method", "Prediction Method", pspec = g_param_spec_enum ("prediction-method", "Prediction Method",
@ -683,17 +671,17 @@ gst_ffmpeg_cfg_init ()
/* return TRUE if property described by pspec applies to the codec with codec_id */ /* return TRUE if property described by pspec applies to the codec with codec_id */
static gboolean static gboolean
gst_ffmpeg_cfg_codec_has_pspec (enum CodecID codec_id, GParamSpec *pspec) gst_ffmpeg_cfg_codec_has_pspec (enum CodecID codec_id, GParamSpec * pspec)
{ {
GParamSpecData *qdata; GParamSpecData *qdata;
gint* codec; gint *codec;
gboolean ret = FALSE; gboolean ret = FALSE;
qdata = g_param_spec_get_qdata (pspec, quark); qdata = g_param_spec_get_qdata (pspec, quark);
/* check if excluded first */ /* check if excluded first */
if ((codec = qdata->exclude_list)) { if ((codec = qdata->exclude_list)) {
for ( ; *codec != CODEC_ID_NONE; ++codec) { for (; *codec != CODEC_ID_NONE; ++codec) {
if (*codec == codec_id) if (*codec == codec_id)
return FALSE; return FALSE;
} }
@ -701,7 +689,7 @@ gst_ffmpeg_cfg_codec_has_pspec (enum CodecID codec_id, GParamSpec *pspec)
/* no include list means it is accepted */ /* no include list means it is accepted */
if ((codec = qdata->include_list)) { if ((codec = qdata->include_list)) {
for ( ; *codec != CODEC_ID_NONE; ++codec) { for (; *codec != CODEC_ID_NONE; ++codec) {
if (*codec == codec_id) if (*codec == codec_id)
ret = TRUE; ret = TRUE;
} }
@ -724,7 +712,7 @@ gst_ffmpeg_cfg_install_property (GstFFMpegEncClass * klass, guint base)
prop_id = base; prop_id = base;
g_return_if_fail (base > 0); g_return_if_fail (base > 0);
ctx = avcodec_alloc_context(); ctx = avcodec_alloc_context ();
if (ctx) if (ctx)
avcodec_get_context_defaults (ctx); avcodec_get_context_defaults (ctx);
else else
@ -736,9 +724,9 @@ gst_ffmpeg_cfg_install_property (GstFFMpegEncClass * klass, guint base)
/* 'clone' the paramspec for the various codecs, /* 'clone' the paramspec for the various codecs,
* since a single paramspec cannot be owned by distinct types */ * since a single paramspec cannot be owned by distinct types */
const gchar* name = g_param_spec_get_name (pspec); const gchar *name = g_param_spec_get_name (pspec);
const gchar* nick = g_param_spec_get_nick (pspec); const gchar *nick = g_param_spec_get_nick (pspec);
const gchar* blurb = g_param_spec_get_blurb (pspec); const gchar *blurb = g_param_spec_get_blurb (pspec);
GParamSpecData *qdata = g_param_spec_get_qdata (pspec, quark); GParamSpecData *qdata = g_param_spec_get_qdata (pspec, quark);
gint ctx_offset = 0; gint ctx_offset = 0;
gboolean lavc_default; gboolean lavc_default;
@ -756,71 +744,73 @@ gst_ffmpeg_cfg_install_property (GstFFMpegEncClass * klass, guint base)
} }
switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) { switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) {
case G_TYPE_STRING: { case G_TYPE_STRING:{
GParamSpecString* pstring = G_PARAM_SPEC_STRING (pspec); GParamSpecString *pstring = G_PARAM_SPEC_STRING (pspec);
pspec = g_param_spec_string (name, nick, blurb, pspec = g_param_spec_string (name, nick, blurb,
lavc_default ? G_STRUCT_MEMBER (gchar*, ctx, ctx_offset) lavc_default ? G_STRUCT_MEMBER (gchar *, ctx, ctx_offset)
: pstring->default_value, : pstring->default_value, pspec->flags);
pspec->flags);
break; break;
} }
case G_TYPE_INT: { case G_TYPE_INT:{
GParamSpecInt* pint = G_PARAM_SPEC_INT (pspec); GParamSpecInt *pint = G_PARAM_SPEC_INT (pspec);
pspec = g_param_spec_int (name, nick, blurb, pspec = g_param_spec_int (name, nick, blurb,
pint->minimum, pint->maximum, pint->minimum, pint->maximum,
lavc_default ? G_STRUCT_MEMBER (gint, ctx, ctx_offset) lavc_default ? G_STRUCT_MEMBER (gint, ctx, ctx_offset)
: pint->default_value, : pint->default_value, pspec->flags);
pspec->flags);
break; break;
} }
case G_TYPE_UINT: { case G_TYPE_UINT:{
GParamSpecUInt* puint = G_PARAM_SPEC_UINT (pspec); GParamSpecUInt *puint = G_PARAM_SPEC_UINT (pspec);
pspec = g_param_spec_uint (name, nick, blurb, pspec = g_param_spec_uint (name, nick, blurb,
puint->minimum, puint->maximum, puint->minimum, puint->maximum,
lavc_default ? G_STRUCT_MEMBER (guint, ctx, ctx_offset) lavc_default ? G_STRUCT_MEMBER (guint, ctx, ctx_offset)
: puint->default_value, : puint->default_value, pspec->flags);
pspec->flags);
break; break;
} }
case G_TYPE_ULONG: { case G_TYPE_ULONG:{
GParamSpecULong* pulong = G_PARAM_SPEC_ULONG (pspec); GParamSpecULong *pulong = G_PARAM_SPEC_ULONG (pspec);
pspec = g_param_spec_ulong (name, nick, blurb, pspec = g_param_spec_ulong (name, nick, blurb,
pulong->minimum, pulong->maximum, pulong->minimum, pulong->maximum,
lavc_default ? G_STRUCT_MEMBER (gulong, ctx, ctx_offset) lavc_default ? G_STRUCT_MEMBER (gulong, ctx, ctx_offset)
: pulong->default_value, : pulong->default_value, pspec->flags);
pspec->flags);
break; break;
} }
case G_TYPE_FLOAT: { case G_TYPE_FLOAT:{
GParamSpecFloat* pfloat = G_PARAM_SPEC_FLOAT (pspec); GParamSpecFloat *pfloat = G_PARAM_SPEC_FLOAT (pspec);
pspec = g_param_spec_float (name, nick, blurb, pspec = g_param_spec_float (name, nick, blurb,
pfloat->minimum, pfloat->maximum, pfloat->minimum, pfloat->maximum,
lavc_default ? G_STRUCT_MEMBER (gfloat, ctx, ctx_offset) lavc_default ? G_STRUCT_MEMBER (gfloat, ctx, ctx_offset)
: pfloat->default_value, : pfloat->default_value, pspec->flags);
pspec->flags);
break; break;
} }
case G_TYPE_BOOLEAN: { case G_TYPE_BOOLEAN:{
GParamSpecBoolean* pboolean = G_PARAM_SPEC_BOOLEAN (pspec); GParamSpecBoolean *pboolean = G_PARAM_SPEC_BOOLEAN (pspec);
pspec = g_param_spec_boolean (name, nick, blurb, pspec = g_param_spec_boolean (name, nick, blurb,
lavc_default ? G_STRUCT_MEMBER (gboolean, ctx, ctx_offset) lavc_default ? G_STRUCT_MEMBER (gboolean, ctx, ctx_offset)
: pboolean->default_value, : pboolean->default_value, pspec->flags);
pspec->flags);
break; break;
} }
default: default:
if (G_IS_PARAM_SPEC_ENUM (pspec)) { if (G_IS_PARAM_SPEC_ENUM (pspec)) {
GParamSpecEnum* penum = G_PARAM_SPEC_ENUM (pspec); GParamSpecEnum *penum = G_PARAM_SPEC_ENUM (pspec);
pspec = g_param_spec_enum (name, nick, blurb, pspec = g_param_spec_enum (name, nick, blurb,
pspec->value_type, pspec->value_type,
lavc_default ? G_STRUCT_MEMBER (gint, ctx, ctx_offset) lavc_default ? G_STRUCT_MEMBER (gint, ctx, ctx_offset)
: penum->default_value, pspec->flags); : penum->default_value, pspec->flags);
} else if (G_IS_PARAM_SPEC_FLAGS (pspec)) { } else if (G_IS_PARAM_SPEC_FLAGS (pspec)) {
GParamSpecFlags* pflags = G_PARAM_SPEC_FLAGS (pspec); GParamSpecFlags *pflags = G_PARAM_SPEC_FLAGS (pspec);
pspec = g_param_spec_flags (name, nick, blurb, pspec = g_param_spec_flags (name, nick, blurb,
pspec->value_type, pspec->value_type,
lavc_default ? G_STRUCT_MEMBER (guint, ctx, ctx_offset) lavc_default ? G_STRUCT_MEMBER (guint, ctx, ctx_offset)
: pflags->default_value, pspec->flags); : pflags->default_value, pspec->flags);
} else { } else {
g_critical ("%s does not yet support type %s", GST_FUNCTION, g_critical ("%s does not yet support type %s", GST_FUNCTION,
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec))); g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
@ -881,22 +871,22 @@ gst_ffmpeg_cfg_set_property (GObject * object,
g_value_get_float (value); g_value_get_float (value);
break; break;
case G_TYPE_STRING: case G_TYPE_STRING:
g_return_val_if_fail (qdata->size == sizeof (gchar*), TRUE); g_return_val_if_fail (qdata->size == sizeof (gchar *), TRUE);
g_free (G_STRUCT_MEMBER (gchar*, ffmpegenc, qdata->offset)); g_free (G_STRUCT_MEMBER (gchar *, ffmpegenc, qdata->offset));
G_STRUCT_MEMBER (gchar*, ffmpegenc, qdata->offset) = G_STRUCT_MEMBER (gchar *, ffmpegenc, qdata->offset) =
g_value_dup_string (value); g_value_dup_string (value);
break; break;
default: /* must be enum, given the check above */ default: /* must be enum, given the check above */
if (G_IS_PARAM_SPEC_ENUM (pspec)) { if (G_IS_PARAM_SPEC_ENUM (pspec)) {
g_return_val_if_fail (qdata->size == sizeof (gint), TRUE); g_return_val_if_fail (qdata->size == sizeof (gint), TRUE);
G_STRUCT_MEMBER (gint, ffmpegenc, qdata->offset) = G_STRUCT_MEMBER (gint, ffmpegenc, qdata->offset) =
g_value_get_enum (value); g_value_get_enum (value);
} else if (G_IS_PARAM_SPEC_FLAGS (pspec)) { } else if (G_IS_PARAM_SPEC_FLAGS (pspec)) {
g_return_val_if_fail (qdata->size == sizeof (guint), TRUE); g_return_val_if_fail (qdata->size == sizeof (guint), TRUE);
G_STRUCT_MEMBER (guint, ffmpegenc, qdata->offset) = G_STRUCT_MEMBER (guint, ffmpegenc, qdata->offset) =
g_value_get_flags (value); g_value_get_flags (value);
} else { /* oops, bit lazy we don't cover this case yet */ } else { /* oops, bit lazy we don't cover this case yet */
g_critical ("%s does not yet support type %s",GST_FUNCTION, g_critical ("%s does not yet support type %s", GST_FUNCTION,
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec))); g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
} }
@ -935,8 +925,7 @@ gst_ffmpeg_cfg_get_property (GObject * object,
break; break;
case G_TYPE_INT: case G_TYPE_INT:
g_return_val_if_fail (qdata->size == sizeof (gint), TRUE); g_return_val_if_fail (qdata->size == sizeof (gint), TRUE);
g_value_set_int (value, g_value_set_int (value, G_STRUCT_MEMBER (gint, ffmpegenc, qdata->offset));
G_STRUCT_MEMBER (gint, ffmpegenc, qdata->offset));
break; break;
case G_TYPE_ULONG: case G_TYPE_ULONG:
g_return_val_if_fail (qdata->size == sizeof (gulong), TRUE); g_return_val_if_fail (qdata->size == sizeof (gulong), TRUE);
@ -949,11 +938,11 @@ gst_ffmpeg_cfg_get_property (GObject * object,
G_STRUCT_MEMBER (gfloat, ffmpegenc, qdata->offset)); G_STRUCT_MEMBER (gfloat, ffmpegenc, qdata->offset));
break; break;
case G_TYPE_STRING: case G_TYPE_STRING:
g_return_val_if_fail (qdata->size == sizeof (gchar*), TRUE); g_return_val_if_fail (qdata->size == sizeof (gchar *), TRUE);
g_value_take_string (value, g_value_take_string (value,
g_strdup (G_STRUCT_MEMBER (gchar*, ffmpegenc, qdata->offset))); g_strdup (G_STRUCT_MEMBER (gchar *, ffmpegenc, qdata->offset)));
break; break;
default: /* must be enum, given the check above */ default: /* must be enum, given the check above */
if (G_IS_PARAM_SPEC_ENUM (pspec)) { if (G_IS_PARAM_SPEC_ENUM (pspec)) {
g_return_val_if_fail (qdata->size == sizeof (gint), TRUE); g_return_val_if_fail (qdata->size == sizeof (gint), TRUE);
g_value_set_enum (value, g_value_set_enum (value,
@ -962,7 +951,7 @@ gst_ffmpeg_cfg_get_property (GObject * object,
g_return_val_if_fail (qdata->size == sizeof (guint), TRUE); g_return_val_if_fail (qdata->size == sizeof (guint), TRUE);
g_value_set_flags (value, g_value_set_flags (value,
G_STRUCT_MEMBER (guint, ffmpegenc, qdata->offset)); G_STRUCT_MEMBER (guint, ffmpegenc, qdata->offset));
} else { /* oops, bit lazy we don't cover this case yet */ } else { /* oops, bit lazy we don't cover this case yet */
g_critical ("%s does not yet support type %s", GST_FUNCTION, g_critical ("%s does not yet support type %s", GST_FUNCTION,
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec))); g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
} }
@ -982,8 +971,9 @@ gst_ffmpeg_cfg_set_defaults (GstFFMpegEnc * ffmpegenc)
&num_props); &num_props);
for (i = 0; i < num_props; ++i) { for (i = 0; i < num_props; ++i) {
GValue val = {0, }; GValue val = { 0, };
GParamSpec *pspec = pspecs[i]; GParamSpec *pspec = pspecs[i];
/* only touch those that are really ours; i.e. should have some qdata */ /* only touch those that are really ours; i.e. should have some qdata */
if (!g_param_spec_get_qdata (pspec, quark)) if (!g_param_spec_get_qdata (pspec, quark))
continue; continue;
@ -1020,8 +1010,7 @@ gst_ffmpeg_cfg_fill_context (GstFFMpegEnc * ffmpegenc, AVCodecContext * context)
&& context_offset >= 0) { && context_offset >= 0) {
/* memcpy a bit heavy for a small copy, but hardly part of 'inner loop' */ /* memcpy a bit heavy for a small copy, but hardly part of 'inner loop' */
memcpy (G_STRUCT_MEMBER_P (context, context_offset), memcpy (G_STRUCT_MEMBER_P (context, context_offset),
G_STRUCT_MEMBER_P (ffmpegenc, qdata->offset), G_STRUCT_MEMBER_P (ffmpegenc, qdata->offset), qdata->size);
qdata->size);
} }
list = list->next; list = list->next;
} }
@ -1048,9 +1037,9 @@ gst_ffmpeg_cfg_finalize (GstFFMpegEnc * ffmpegenc)
switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) { switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) {
case G_TYPE_STRING: case G_TYPE_STRING:
if(qdata->size == sizeof (gchar*)) { if (qdata->size == sizeof (gchar *)) {
g_free (G_STRUCT_MEMBER (gchar*, ffmpegenc, qdata->offset)); g_free (G_STRUCT_MEMBER (gchar *, ffmpegenc, qdata->offset));
G_STRUCT_MEMBER (gchar*, ffmpegenc, qdata->offset) = NULL; G_STRUCT_MEMBER (gchar *, ffmpegenc, qdata->offset) = NULL;
} }
break; break;
default: default:

View file

@ -277,12 +277,12 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
"systemstream", G_TYPE_BOOLEAN, FALSE, "systemstream", G_TYPE_BOOLEAN, FALSE,
"rmversion", G_TYPE_INT, version, NULL); "rmversion", G_TYPE_INT, version, NULL);
if (context) { if (context) {
gst_caps_set_simple (caps, gst_caps_set_simple (caps, "format", G_TYPE_INT, context->sub_id, NULL);
"format", G_TYPE_INT, context->sub_id, NULL);
if (context->extradata_size >= 8) { if (context->extradata_size >= 8) {
gst_caps_set_simple (caps, 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; break;

View file

@ -544,7 +544,8 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
} }
/* out-of-order incoming buffer handling */ /* 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->outoforder = TRUE;
ffmpegdec->next_ts = GST_CLOCK_TIME_NONE; 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"); 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 */ /* do *not* draw edges */
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE; ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
} }
@ -852,13 +853,14 @@ no_par:
} }
static void static void
gst_ffmpegdec_save_incoming_values (GstFFMpegDec * ffmpegdec, GstClockTime timestamp, gst_ffmpegdec_save_incoming_values (GstFFMpegDec * ffmpegdec,
GstClockTime duration) GstClockTime timestamp, GstClockTime duration)
{ {
GST_LOG_OBJECT (ffmpegdec, "BEFORE timestamp:%"GST_TIME_FORMAT"/%"GST_TIME_FORMAT GST_LOG_OBJECT (ffmpegdec,
" duration:%"GST_TIME_FORMAT"/%"GST_TIME_FORMAT, "BEFORE timestamp:%" GST_TIME_FORMAT "/%" GST_TIME_FORMAT " duration:%"
GST_TIME_ARGS (ffmpegdec->tstamp1), GST_TIME_ARGS (ffmpegdec->tstamp2), GST_TIME_FORMAT "/%" GST_TIME_FORMAT, GST_TIME_ARGS (ffmpegdec->tstamp1),
GST_TIME_ARGS (ffmpegdec->dur1), GST_TIME_ARGS (ffmpegdec->dur2)); GST_TIME_ARGS (ffmpegdec->tstamp2), GST_TIME_ARGS (ffmpegdec->dur1),
GST_TIME_ARGS (ffmpegdec->dur2));
/* shift previous new values to oldest */ /* shift previous new values to oldest */
if (ffmpegdec->tstamp2 != GST_CLOCK_TIME_NONE) if (ffmpegdec->tstamp2 != GST_CLOCK_TIME_NONE)
@ -869,16 +871,17 @@ gst_ffmpegdec_save_incoming_values (GstFFMpegDec * ffmpegdec, GstClockTime times
ffmpegdec->tstamp2 = timestamp; ffmpegdec->tstamp2 = timestamp;
ffmpegdec->dur2 = duration; ffmpegdec->dur2 = duration;
GST_LOG_OBJECT (ffmpegdec, "AFTER timestamp:%"GST_TIME_FORMAT"/%"GST_TIME_FORMAT GST_LOG_OBJECT (ffmpegdec,
" duration:%"GST_TIME_FORMAT"/%"GST_TIME_FORMAT, "AFTER timestamp:%" GST_TIME_FORMAT "/%" GST_TIME_FORMAT " duration:%"
GST_TIME_ARGS (ffmpegdec->tstamp1), GST_TIME_ARGS (ffmpegdec->tstamp2), GST_TIME_FORMAT "/%" GST_TIME_FORMAT, GST_TIME_ARGS (ffmpegdec->tstamp1),
GST_TIME_ARGS (ffmpegdec->dur1), GST_TIME_ARGS (ffmpegdec->dur2)); GST_TIME_ARGS (ffmpegdec->tstamp2), GST_TIME_ARGS (ffmpegdec->dur1),
GST_TIME_ARGS (ffmpegdec->dur2));
} }
static void static void
gst_ffmpegdec_get_best_values (GstFFMpegDec * ffmpegdec, GstClockTime *timestamp, gst_ffmpegdec_get_best_values (GstFFMpegDec * ffmpegdec,
GstClockTime *duration) GstClockTime * timestamp, GstClockTime * duration)
{ {
/* Best timestamp is the smallest valid timestamp */ /* Best timestamp is the smallest valid timestamp */
if (ffmpegdec->tstamp1 == GST_CLOCK_TIME_NONE) { 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; ffmpegdec->dur1 = GST_CLOCK_TIME_NONE;
} }
GST_LOG_OBJECT (ffmpegdec, "Returning timestamp:%"GST_TIME_FORMAT" duration:%"GST_TIME_FORMAT, GST_LOG_OBJECT (ffmpegdec,
GST_TIME_ARGS (*timestamp), "Returning timestamp:%" GST_TIME_FORMAT " duration:%" GST_TIME_FORMAT,
GST_TIME_ARGS (*duration)); GST_TIME_ARGS (*timestamp), GST_TIME_ARGS (*duration));
} }
static gboolean static gboolean
@ -1429,7 +1432,7 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
/* if we have an input framerate, use that */ /* if we have an input framerate, use that */
if (ffmpegdec->format.video.fps_n != -1 && if (ffmpegdec->format.video.fps_n != -1 &&
(ffmpegdec->format.video.fps_n != 1000 && (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"); GST_LOG_OBJECT (ffmpegdec, "using input framerate for duration");
in_duration = gst_util_uint64_scale_int (GST_SECOND, in_duration = gst_util_uint64_scale_int (GST_SECOND,
ffmpegdec->format.video.fps_d, ffmpegdec->format.video.fps_n); 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"); GST_LOG_OBJECT (ffmpegdec, "no valid duration found");
} }
} }
} } else {
else {
GST_LOG_OBJECT (ffmpegdec, "using in_duration"); GST_LOG_OBJECT (ffmpegdec, "using in_duration");
} }

View file

@ -171,8 +171,7 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass * klass)
GstElementDetails details; GstElementDetails details;
GstPadTemplate *sinktempl, *audiosrctempl, *videosrctempl; GstPadTemplate *sinktempl, *audiosrctempl, *videosrctempl;
params = params = (GstFFMpegDemuxClassParams *)
(GstFFMpegDemuxClassParams *)
g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), GST_FFDEMUX_PARAMS_QDATA); g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), GST_FFDEMUX_PARAMS_QDATA);
g_assert (params != NULL); g_assert (params != NULL);
@ -711,8 +710,8 @@ gst_ffmpegdemux_src_query (GstPad * pad, GstQuery * query)
timeduration = timeduration =
gst_ffmpeg_time_ff_to_gst (avstream->duration, avstream->time_base); gst_ffmpeg_time_ff_to_gst (avstream->duration, avstream->time_base);
if (!(GST_CLOCK_TIME_IS_VALID (timeduration))) { if (!(GST_CLOCK_TIME_IS_VALID (timeduration))) {
/* use duration of complete file if the stream duration is not known */ /* use duration of complete file if the stream duration is not known */
timeduration = demux->duration; timeduration = demux->duration;
if (!(GST_CLOCK_TIME_IS_VALID (timeduration))) if (!(GST_CLOCK_TIME_IS_VALID (timeduration)))
break; break;
} }

View file

@ -570,9 +570,9 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
} }
static void 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) { ffmpegenc->working_buf_size != ffmpegenc->buffer_size) {
if (ffmpegenc->working_buf) if (ffmpegenc->working_buf)
g_free (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); ffmpegenc_setup_working_buf (ffmpegenc);
ret_size = avcodec_encode_video (ffmpegenc->context, ret_size = avcodec_encode_video (ffmpegenc->context,
ffmpegenc->working_buf, ffmpegenc->working_buf_size, ffmpegenc->working_buf, ffmpegenc->working_buf_size, ffmpegenc->picture);
ffmpegenc->picture);
if (ret_size < 0) { if (ret_size < 0) {
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
@ -758,7 +757,7 @@ gst_ffmpegenc_flush_buffers (GstFFMpegEnc * ffmpegenc, gboolean send)
ffmpegenc_setup_working_buf (ffmpegenc); ffmpegenc_setup_working_buf (ffmpegenc);
ret_size = avcodec_encode_video (ffmpegenc->context, 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 */ if (ret_size < 0) { /* there should be something, notify and give up */
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG

View file

@ -57,7 +57,7 @@ gst_ffmpegdata_open (URLContext * h, const char *filename, int flags)
info->set_streamheader = flags & GST_FFMPEG_URL_STREAMHEADER; info->set_streamheader = flags & GST_FFMPEG_URL_STREAMHEADER;
flags &= ~GST_FFMPEG_URL_STREAMHEADER; flags &= ~GST_FFMPEG_URL_STREAMHEADER;
h->flags &= ~GST_FFMPEG_URL_STREAMHEADER; h->flags &= ~GST_FFMPEG_URL_STREAMHEADER;
/* we don't support R/W together */ /* we don't support R/W together */
if (flags != URL_RDONLY && flags != URL_WRONLY) { if (flags != URL_RDONLY && flags != URL_WRONLY) {
GST_WARNING ("Only read-only or write-only are supported"); 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; GstProtocolInfo *info;
GstBuffer *inbuf = NULL; GstBuffer *inbuf = NULL;
GstFlowReturn ret; GstFlowReturn ret;
int total = 0; int total = 0;
g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR_IO); g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR_IO);
info = (GstProtocolInfo *) h->priv_data; info = (GstProtocolInfo *) h->priv_data;
GST_DEBUG ("Pulling %d bytes at position %lld", size, info->offset); 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) { switch (ret) {
case GST_FLOW_OK: case GST_FLOW_OK:
@ -125,7 +125,8 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
break; 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; 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); 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) if (res >= 0)
info->offset += res; 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); g_return_val_if_fail (h->flags != URL_RDONLY, -EIO);
/* create buffer and push data further */ /* create buffer and push data further */
if (gst_pad_alloc_buffer_and_set_caps(info->pad, if (gst_pad_alloc_buffer_and_set_caps (info->pad,
info->offset, info->offset, size, GST_PAD_CAPS (info->pad), &outbuf) != GST_FLOW_OK)
size, GST_PAD_CAPS (info->pad),
&outbuf) != GST_FLOW_OK)
return 0; return 0;
memcpy (GST_BUFFER_DATA (outbuf), buf, size); 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; return 0;
info->offset += size; 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 */ /* TODO : if we are push-based, we need to return sensible info */
switch (h->flags) { switch (h->flags) {
case URL_RDONLY: case URL_RDONLY:
{ {
/* sinkpad */ /* sinkpad */
switch (whence) { switch (whence) {
case SEEK_SET: case SEEK_SET:
info->offset = (guint64) pos; info->offset = (guint64) pos;
break; break;
case SEEK_CUR: case SEEK_CUR:
info->offset += pos; info->offset += pos;
break; break;
case SEEK_END: case SEEK_END:
/* ffmpeg wants to know the current end position in bytes ! */ /* ffmpeg wants to know the current end position in bytes ! */
{ {
GstFormat format = GST_FORMAT_BYTES; GstFormat format = GST_FORMAT_BYTES;
gint64 duration; gint64 duration;
if (gst_pad_is_linked (info->pad)) if (gst_pad_is_linked (info->pad))
if (gst_pad_query_duration (GST_PAD_PEER (info->pad), &format, &duration)) if (gst_pad_query_duration (GST_PAD_PEER (info->pad), &format,
info->offset = ((guint64) duration) + pos; &duration))
} info->offset = ((guint64) duration) + pos;
break; }
default: break;
break; default:
break;
} }
/* FIXME : implement case for push-based behaviour */ /* FIXME : implement case for push-based behaviour */
newpos = info->offset; newpos = info->offset;
} }
break; break;
case URL_WRONLY: case URL_WRONLY:
{ {
/* srcpad */ /* srcpad */
switch (whence) { switch (whence) {
case SEEK_SET: case SEEK_SET:
info->offset = (guint64) pos; info->offset = (guint64) pos;
gst_pad_push_event (info->pad,gst_event_new_new_segment gst_pad_push_event (info->pad, gst_event_new_new_segment
(TRUE, 1.0, GST_FORMAT_BYTES, info->offset, (TRUE, 1.0, GST_FORMAT_BYTES, info->offset,
GST_CLOCK_TIME_NONE, info->offset)); GST_CLOCK_TIME_NONE, info->offset));
break; break;
case SEEK_CUR: case SEEK_CUR:
info->offset += pos; info->offset += pos;
gst_pad_push_event (info->pad,gst_event_new_new_segment gst_pad_push_event (info->pad, gst_event_new_new_segment
(TRUE, 1.0, GST_FORMAT_BYTES, info->offset, (TRUE, 1.0, GST_FORMAT_BYTES, info->offset,
GST_CLOCK_TIME_NONE, info->offset)); GST_CLOCK_TIME_NONE, info->offset));
break; break;
default: default:
break; break;
} }
newpos = info->offset; newpos = info->offset;
} }
break; break;
default: default:
g_assert(0); g_assert (0);
break; break;
} }
GST_DEBUG ("Now at offset %lld", info->offset); GST_DEBUG ("Now at offset %lld", info->offset);
@ -263,13 +263,13 @@ gst_ffmpegdata_close (URLContext * h)
case URL_WRONLY: case URL_WRONLY:
{ {
/* send EOS - that closes down the stream */ /* 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; break;
} }
default: default:
break; break;
} }
/* clean up data */ /* clean up data */
g_free (info); g_free (info);
h->priv_data = NULL; h->priv_data = NULL;
@ -279,10 +279,10 @@ gst_ffmpegdata_close (URLContext * h)
URLProtocol gstreamer_protocol = { URLProtocol gstreamer_protocol = {
/*.name = */"gstreamer", /*.name = */ "gstreamer",
/*.url_open = */gst_ffmpegdata_open, /*.url_open = */ gst_ffmpegdata_open,
/*.url_read = */gst_ffmpegdata_read, /*.url_read = */ gst_ffmpegdata_read,
/*.url_write = */gst_ffmpegdata_write, /*.url_write = */ gst_ffmpegdata_write,
/*.url_seek = */gst_ffmpegdata_seek, /*.url_seek = */ gst_ffmpegdata_seek,
/*.url_close = */gst_ffmpegdata_close, /*.url_close = */ gst_ffmpegdata_close,
}; };