--- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegaudioresample.c.ark 2011-04-28 12:19:54.178010468 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegaudioresample.c 2011-04-28 12:23:49.124671412 +0200 @@ -248,8 +248,8 @@ gst_ffmpegaudioresample_set_caps (GstBas return FALSE; resample->res = - audio_resample_init (resample->out_channels, resample->in_channels, - resample->out_rate, resample->in_rate); + av_audio_resample_init (resample->out_channels, resample->in_channels, + resample->out_rate, resample->in_rate, SAMPLE_FMT_S16, SAMPLE_FMT_S16, 16, 10, 0, 0.8); if (resample->res == NULL) return FALSE; --- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegcfg.c.ark 2011-04-28 11:57:18.831376818 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegcfg.c 2011-04-28 11:58:25.564708526 +0200 @@ -491,12 +491,12 @@ gst_ffmpeg_cfg_init (void) pspec = g_param_spec_int ("mb-qmin", "Minimum MB Quantizer", "Minimum MB Quantizer", 0, 31, 2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - 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", "Maximum MB Quantizer", 0, 31, 31, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - 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", "Minimum Lagrange Multiplier", 1, 31, 2, --- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegcodecmap.c.ark 2011-04-28 10:22:39.668181835 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegcodecmap.c 2011-04-28 10:28:10.774840435 +0200 @@ -743,7 +743,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID break; case CODEC_ID_RAWVIDEO: - caps = gst_ffmpeg_codectype_to_caps (CODEC_TYPE_VIDEO, context, codec_id, + caps = gst_ffmpeg_codectype_to_caps (AVMEDIA_TYPE_VIDEO, context, codec_id, encode); break; @@ -1180,7 +1180,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID case CODEC_ID_SNOW: case CODEC_ID_VIXL: case CODEC_ID_QPEG: - case CODEC_ID_XVID: + //case CODEC_ID_XVID: case CODEC_ID_PGMYUV: case CODEC_ID_FFVHUFF: case CODEC_ID_WNV1: @@ -1551,12 +1551,12 @@ gst_ffmpeg_codecid_to_caps (enum CodecID GST_LOG ("Could not create stream format caps for %s", codec->name); switch (codec->type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: mime = g_strdup_printf ("video/x-gst_ff-%s", codec->name); caps = gst_ff_vid_caps_new (context, codec_id, mime, NULL); g_free (mime); break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: mime = g_strdup_printf ("audio/x-gst_ff-%s", codec->name); caps = gst_ff_aud_caps_new (context, codec_id, mime, NULL); if (context) @@ -1880,21 +1880,21 @@ gst_ffmpeg_codectype_to_video_caps (AVCo * to a GstCaps. If the context is ommitted, no fixed values * for video/audio size will be included in the GstCaps * - * CodecType is primarily meant for uncompressed data GstCaps! + * AVMediaType is primarily meant for uncompressed data GstCaps! */ GstCaps * -gst_ffmpeg_codectype_to_caps (enum CodecType codec_type, +gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type, AVCodecContext * context, enum CodecID codec_id, gboolean encode) { GstCaps *caps; switch (codec_type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: caps = gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL); break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: caps = gst_ffmpeg_codectype_to_audio_caps (context, codec_id, encode, NULL); break; @@ -2100,22 +2100,22 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * AVCodecContext. If the context is ommitted, no fixed values * for video/audio size will be included in the context * - * CodecType is primarily meant for uncompressed data GstCaps! + * AVMediaType is primarily meant for uncompressed data GstCaps! */ void -gst_ffmpeg_caps_with_codectype (enum CodecType type, +gst_ffmpeg_caps_with_codectype (enum AVMediaType type, const GstCaps * caps, AVCodecContext * context) { if (context == NULL) return; switch (type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: gst_ffmpeg_caps_to_pixfmt (caps, context, TRUE); break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: gst_ffmpeg_caps_to_smpfmt (caps, context, TRUE); break; @@ -2222,7 +2222,7 @@ full_copy: void gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, - enum CodecType codec_type, const GstCaps * caps, AVCodecContext * context) + enum AVMediaType codec_type, const GstCaps * caps, AVCodecContext * context) { GstStructure *str; const GValue *value; @@ -2457,11 +2457,11 @@ gst_ffmpeg_caps_with_codecid (enum Codec /* common properties (width, height, fps) */ switch (codec_type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO); gst_ffmpeg_get_palette (caps, context); break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE); break; default: @@ -3307,11 +3307,11 @@ gst_ffmpeg_caps_to_codecid (const GstCap if (context != NULL) { if (video == TRUE) { - context->codec_type = CODEC_TYPE_VIDEO; + context->codec_type = AVMEDIA_TYPE_VIDEO; } else if (audio == TRUE) { - context->codec_type = CODEC_TYPE_AUDIO; + context->codec_type = AVMEDIA_TYPE_AUDIO; } else { - context->codec_type = CODEC_TYPE_UNKNOWN; + context->codec_type = AVMEDIA_TYPE_UNKNOWN; } context->codec_id = id; gst_ffmpeg_caps_with_codecid (id, context->codec_type, caps, context); --- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegcodecmap.h.ark 2011-04-28 10:26:45.081509191 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegcodecmap.h 2011-04-28 10:26:58.551508861 +0200 @@ -41,11 +41,11 @@ gst_ffmpeg_codecid_to_caps (enum Codec /* * _codectype_to_caps () gets the GstCaps that belongs to - * a certain CodecType for a pad with uncompressed data. + * a certain AVMediaType for a pad with uncompressed data. */ GstCaps * -gst_ffmpeg_codectype_to_caps (enum CodecType codec_type, +gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type, AVCodecContext *context, enum CodecID codec_id, gboolean encode); @@ -77,7 +77,7 @@ gst_ffmpeg_caps_to_codecid (const GstCap void gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, - enum CodecType codec_type, + enum AVMediaType codec_type, const GstCaps *caps, AVCodecContext *context); @@ -87,7 +87,7 @@ gst_ffmpeg_caps_with_codecid (enum Codec */ void -gst_ffmpeg_caps_with_codectype (enum CodecType type, +gst_ffmpeg_caps_with_codectype (enum AVMediaType type, const GstCaps *caps, AVCodecContext *context); --- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegdec.c.ark 2011-04-28 10:34:03.521498509 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegdec.c 2011-04-28 11:57:00.644710595 +0200 @@ -139,7 +139,8 @@ struct _GstFFMpegDec gboolean extra_ref; /* keep extra ref around in get/release */ /* some properties */ - gint hurry_up; + enum AVDiscard skip_frame; + enum AVDiscard skip_idct; gint lowres; gboolean direct_rendering; gboolean do_padding; @@ -309,7 +310,7 @@ gst_ffmpegdec_base_init (GstFFMpegDecCla /* construct the element details struct */ longname = g_strdup_printf ("FFmpeg %s decoder", in_plugin->long_name); classification = g_strdup_printf ("Codec/Decoder/%s", - (in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio"); + (in_plugin->type == AVMEDIA_TYPE_VIDEO) ? "Video" : "Audio"); description = g_strdup_printf ("FFmpeg %s decoder", in_plugin->name); gst_element_class_set_details_simple (element_class, longname, classification, description, @@ -326,7 +327,7 @@ gst_ffmpegdec_base_init (GstFFMpegDecCla GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name); sinkcaps = gst_caps_from_string ("unknown/unknown"); } - if (in_plugin->type == CODEC_TYPE_VIDEO) { + if (in_plugin->type == AVMEDIA_TYPE_VIDEO) { srccaps = gst_caps_from_string ("video/x-raw-rgb; video/x-raw-yuv"); } else { srccaps = gst_ffmpeg_codectype_to_audio_caps (NULL, @@ -363,7 +364,7 @@ gst_ffmpegdec_class_init (GstFFMpegDecCl gobject_class->set_property = gst_ffmpegdec_set_property; gobject_class->get_property = gst_ffmpegdec_get_property; - if (klass->in_plugin->type == CODEC_TYPE_VIDEO) { + if (klass->in_plugin->type == AVMEDIA_TYPE_VIDEO) { g_object_class_install_property (gobject_class, PROP_SKIPFRAME, g_param_spec_enum ("skip-frame", "Skip frames", "Which types of frames to skip during decoding", @@ -429,7 +430,8 @@ gst_ffmpegdec_init (GstFFMpegDec * ffmpe ffmpegdec->par = NULL; ffmpegdec->opened = FALSE; ffmpegdec->waiting_for_key = TRUE; - ffmpegdec->hurry_up = ffmpegdec->lowres = 0; + ffmpegdec->lowres = 0; + ffmpegdec->skip_frame = ffmpegdec->skip_idct = AVDISCARD_DEFAULT; ffmpegdec->direct_rendering = DEFAULT_DIRECT_RENDERING; ffmpegdec->do_padding = DEFAULT_DO_PADDING; ffmpegdec->debug_mv = DEFAULT_DEBUG_MV; @@ -665,7 +667,7 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpe } switch (oclass->in_plugin->type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: ffmpegdec->format.video.width = 0; ffmpegdec->format.video.height = 0; ffmpegdec->format.video.clip_width = -1; @@ -673,7 +675,7 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpe ffmpegdec->format.video.pix_fmt = PIX_FMT_NB; ffmpegdec->format.video.interlaced = FALSE; break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: ffmpegdec->format.audio.samplerate = 0; ffmpegdec->format.audio.channels = 0; ffmpegdec->format.audio.depth = 0; @@ -840,7 +842,8 @@ gst_ffmpegdec_setcaps (GstPad * pad, Gst /* for slow cpus */ ffmpegdec->context->lowres = ffmpegdec->lowres; - ffmpegdec->context->hurry_up = ffmpegdec->hurry_up; + ffmpegdec->context->skip_frame = ffmpegdec->skip_frame; + ffmpegdec->context->skip_idct = ffmpegdec->skip_idct; /* ffmpeg can draw motion vectors on top of the image (not every decoder * supports it) */ @@ -997,9 +1000,9 @@ gst_ffmpegdec_get_buffer (AVCodecContext } switch (context->codec_type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: /* some ffmpeg video plugins don't see the point in setting codec_type ... */ - case CODEC_TYPE_UNKNOWN: + case AVMEDIA_TYPE_UNKNOWN: { GstFlowReturn ret; gint clip_width, clip_height; @@ -1037,7 +1040,7 @@ gst_ffmpegdec_get_buffer (AVCodecContext GST_BUFFER_DATA (buf), context->pix_fmt, width, height); break; } - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: default: GST_ERROR_OBJECT (ffmpegdec, "_get_buffer() should never get called for non-video buffers !"); @@ -1187,7 +1190,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec)); switch (oclass->in_plugin->type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: if (!force && ffmpegdec->format.video.width == ffmpegdec->context->width && ffmpegdec->format.video.height == ffmpegdec->context->height && ffmpegdec->format.video.fps_n == ffmpegdec->format.video.old_fps_n @@ -1217,7 +1220,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec->format.video.par_d = ffmpegdec->context->sample_aspect_ratio.den; break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: { gint depth = av_smp_format_depth (ffmpegdec->context->sample_fmt); if (!force && ffmpegdec->format.audio.samplerate == @@ -1246,7 +1249,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * goto no_caps; switch (oclass->in_plugin->type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: { gint width, height; gboolean interlaced; @@ -1276,7 +1279,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * gst_caps_get_structure (caps, 0)); break; } - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: { break; } @@ -1312,7 +1315,7 @@ caps_failed: /* perform qos calculations before decoding the next frame. * - * Sets the hurry_up flag and if things are really bad, skips to the next + * Sets the skip_frame/skip_idct flags and if things are really bad, skips to the next * keyframe. * * Returns TRUE if the frame should be decoded, FALSE if the frame can be dropped @@ -1337,8 +1340,8 @@ gst_ffmpegdec_do_qos (GstFFMpegDec * ffm /* skip qos if we have no observation (yet) */ if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (earliest_time))) { - /* no hurry_up initialy */ - ffmpegdec->context->hurry_up = 0; + /* no skipping initialy */ + ffmpegdec->context->skip_frame = ffmpegdec->context->skip_idct = AVDISCARD_DEFAULT; goto no_qos; } @@ -1390,8 +1393,8 @@ skipping: } normal_mode: { - if (ffmpegdec->context->hurry_up != 0) { - ffmpegdec->context->hurry_up = 0; + if (ffmpegdec->context->skip_frame != AVDISCARD_DEFAULT || ffmpegdec->context->skip_idct != AVDISCARD_DEFAULT) { + ffmpegdec->context->skip_frame = ffmpegdec->context->skip_idct = AVDISCARD_DEFAULT; *mode_switch = TRUE; GST_DEBUG_OBJECT (ffmpegdec, "QOS: normal mode %g < 0.4", proportion); } @@ -1399,7 +1402,7 @@ normal_mode: } skip_to_keyframe: { - ffmpegdec->context->hurry_up = 1; + ffmpegdec->context->skip_frame = AVDISCARD_NONKEY; ffmpegdec->waiting_for_key = TRUE; *mode_switch = TRUE; GST_DEBUG_OBJECT (ffmpegdec, @@ -1409,8 +1412,8 @@ skip_to_keyframe: } hurry_up: { - if (ffmpegdec->context->hurry_up != 1) { - ffmpegdec->context->hurry_up = 1; + if (ffmpegdec->context->skip_frame != AVDISCARD_BIDIR) { + ffmpegdec->context->skip_frame = AVDISCARD_BIDIR; *mode_switch = TRUE; GST_DEBUG_OBJECT (ffmpegdec, "QOS: hurry up, diff %" G_GINT64_FORMAT " >= 0", diff); @@ -1695,7 +1698,7 @@ gst_ffmpegdec_video_frame (GstFFMpegDec gboolean iskeyframe; gboolean mode_switch; gboolean decode; - gint hurry_up = 0; + enum AVDiscard skip_frame = 0, skip_idct = 0; GstClockTime out_timestamp, out_duration, out_pts; gint64 out_offset; @@ -1730,10 +1733,12 @@ gst_ffmpegdec_video_frame (GstFFMpegDec } if (!decode) { - /* no decoding needed, save previous hurry_up value and brutely skip + /* no decoding needed, save previous skip values and brutely skip * decoding everything */ - hurry_up = ffmpegdec->context->hurry_up; - ffmpegdec->context->hurry_up = 2; + skip_frame = ffmpegdec->context->skip_frame; + skip_idct = ffmpegdec->context->skip_idct; + ffmpegdec->context->skip_frame = AVDISCARD_BIDIR; + ffmpegdec->context->skip_idct = AVDISCARD_ALL; } GST_DEBUG_OBJECT (ffmpegdec, @@ -1751,25 +1756,31 @@ gst_ffmpegdec_video_frame (GstFFMpegDec out_offset)); /* now decode the frame */ - len = avcodec_decode_video (ffmpegdec->context, - ffmpegdec->picture, &have_data, data, size); + AVPacket pkt; + av_init_packet(&pkt); + pkt.data = data; + pkt.size = size; + len = avcodec_decode_video2 (ffmpegdec->context, + ffmpegdec->picture, &have_data, &pkt); gst_ts_handler_consume (ffmpegdec, len); /* restore previous state */ - if (!decode) - ffmpegdec->context->hurry_up = hurry_up; + if (!decode) { + ffmpegdec->context->skip_frame = skip_frame; + ffmpegdec->context->skip_idct = skip_idct; + } GST_DEBUG_OBJECT (ffmpegdec, "after decode: len %d, have_data %d", len, have_data); /* when we are in hurry_up mode, don't complain when ffmpeg returned * no data because we told it to skip stuff. */ - if (len < 0 && (mode_switch || ffmpegdec->context->hurry_up)) + if (len < 0 && (mode_switch || ffmpegdec->context->skip_frame > AVDISCARD_DEFAULT)) len = 0; if (len > 0 && have_data <= 0 && (mode_switch - || ffmpegdec->context->hurry_up)) { + || ffmpegdec->context->skip_frame > AVDISCARD_DEFAULT)) { /* we consumed some bytes but nothing decoded and we are skipping frames, * disable the interpollation of DTS timestamps */ ffmpegdec->ts_is_dts = FALSE; @@ -2106,8 +2117,12 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec new_aligned_buffer (AVCODEC_MAX_AUDIO_FRAME_SIZE, GST_PAD_CAPS (ffmpegdec->srcpad)); - len = avcodec_decode_audio2 (ffmpegdec->context, - (int16_t *) GST_BUFFER_DATA (*outbuf), &have_data, data, size); + AVPacket pkt; + av_init_packet(&pkt); + pkt.data = data; + pkt.size = size; + len = avcodec_decode_audio3 (ffmpegdec->context, + (int16_t *) GST_BUFFER_DATA (*outbuf), &have_data, &pkt); GST_DEBUG_OBJECT (ffmpegdec, "Decode audio: len=%d, have_data=%d", len, have_data); @@ -2226,12 +2241,12 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmp oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec)); switch (oclass->in_plugin->type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: len = gst_ffmpegdec_video_frame (ffmpegdec, data, size, in_timestamp, in_duration, in_offset, &outbuf, ret); break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: len = gst_ffmpegdec_audio_frame (ffmpegdec, oclass->in_plugin, data, size, in_timestamp, in_duration, in_offset, &outbuf, ret); @@ -2523,7 +2538,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBu if (G_UNLIKELY (ffmpegdec->waiting_for_key)) { GST_DEBUG_OBJECT (ffmpegdec, "waiting for keyframe"); if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_DELTA_UNIT) && - oclass->in_plugin->type != CODEC_TYPE_AUDIO) + oclass->in_plugin->type != AVMEDIA_TYPE_AUDIO) goto skip_keyframe; GST_DEBUG_OBJECT (ffmpegdec, "got keyframe"); @@ -2586,8 +2601,8 @@ gst_ffmpegdec_chain (GstPad * pad, GstBu /* feed the parser. We store the raw gstreamer timestamp because * converting it to ffmpeg timestamps can corrupt it if the framerate is * wrong. */ - res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context, - &data, &size, bdata, bsize, in_timestamp, in_timestamp); + res = av_parser_parse2 (ffmpegdec->pctx, ffmpegdec->context, + &data, &size, bdata, bsize, in_timestamp, in_timestamp, 0); GST_LOG_OBJECT (ffmpegdec, "parser returned res %d and size %d", res, size); @@ -2776,7 +2791,7 @@ gst_ffmpegdec_set_property (GObject * ob ffmpegdec->lowres = ffmpegdec->context->lowres = g_value_get_enum (value); break; case PROP_SKIPFRAME: - ffmpegdec->hurry_up = ffmpegdec->context->hurry_up = + ffmpegdec->skip_frame = ffmpegdec->context->skip_frame = g_value_get_enum (value); break; case PROP_DIRECT_RENDERING: @@ -2809,7 +2824,7 @@ gst_ffmpegdec_get_property (GObject * ob g_value_set_enum (value, ffmpegdec->context->lowres); break; case PROP_SKIPFRAME: - g_value_set_enum (value, ffmpegdec->context->hurry_up); + g_value_set_enum (value, ffmpegdec->context->skip_frame); break; case PROP_DIRECT_RENDERING: g_value_set_boolean (value, ffmpegdec->direct_rendering); --- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegdeinterlace.c.ark 2011-04-28 12:19:31.168011030 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegdeinterlace.c 2011-04-28 12:19:39.548010826 +0200 @@ -125,7 +125,7 @@ gst_ffmpegdeinterlace_sink_setcaps (GstP ctx->width = deinterlace->width; ctx->height = deinterlace->height; ctx->pix_fmt = PIX_FMT_NB; - gst_ffmpeg_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx); + gst_ffmpeg_caps_with_codectype (AVMEDIA_TYPE_VIDEO, caps, ctx); if (ctx->pix_fmt == PIX_FMT_NB) { av_free (ctx); return FALSE; --- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegdemux.c.ark 2011-04-28 11:58:34.918041632 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegdemux.c 2011-04-28 12:13:56.244685854 +0200 @@ -42,6 +42,8 @@ #include "gstffmpegutils.h" #include "gstffmpegpipe.h" +#define MAX_STREAMS 50 + typedef struct _GstFFMpegDemux GstFFMpegDemux; typedef struct _GstFFStream GstFFStream; @@ -150,22 +152,22 @@ gst_ffmpegdemux_averror (gint av_errno) const gchar *message = NULL; switch (av_errno) { - case AVERROR_UNKNOWN: + case AVERROR(EINVAL): message = "Unknown error"; break; - case AVERROR_IO: + case AVERROR(EIO): message = "Input/output error"; break; - case AVERROR_NUMEXPECTED: + case AVERROR(EDOM): message = "Number syntax expected in filename"; break; - case AVERROR_NOMEM: + case AVERROR(ENOMEM): message = "Not enough memory"; break; - case AVERROR_NOFMT: + case AVERROR(EILSEQ): message = "Unknown format"; break; - case AVERROR_NOTSUPP: + case AVERROR(ENOSYS): message = "Operation not supported"; break; default: @@ -458,7 +460,7 @@ gst_ffmpegdemux_do_seek (GstFFMpegDemux /* if we need to land on a keyframe, try to do so, we don't try to do a * keyframe seek if we are not absolutely sure we have an index.*/ - if (segment->flags & GST_SEEK_FLAG_KEY_UNIT && demux->context->index_built) { + if (segment->flags & GST_SEEK_FLAG_KEY_UNIT /*&& demux->context->index_built*/) { gint keyframeidx; GST_LOG_OBJECT (demux, "looking for keyframe in ffmpeg for time %" @@ -869,7 +871,7 @@ gst_ffmpegdemux_src_convert (GstPad * pa return FALSE; avstream = stream->avstream; - if (avstream->codec->codec_type != CODEC_TYPE_VIDEO) + if (avstream->codec->codec_type != AVMEDIA_TYPE_VIDEO) return FALSE; switch (src_fmt) { @@ -979,11 +981,11 @@ gst_ffmpegdemux_get_stream (GstFFMpegDem stream->tags = NULL; switch (ctx->codec_type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: templ = oclass->videosrctempl; num = demux->videopads++; break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: templ = oclass->audiosrctempl; num = demux->audiopads++; break; @@ -1043,7 +1045,7 @@ gst_ffmpegdemux_get_stream (GstFFMpegDem stream->tags = gst_tag_list_new (); gst_tag_list_add (stream->tags, GST_TAG_MERGE_REPLACE, - (ctx->codec_type == CODEC_TYPE_VIDEO) ? + (ctx->codec_type == AVMEDIA_TYPE_VIDEO) ? GST_TAG_VIDEO_CODEC : GST_TAG_AUDIO_CODEC, codec, NULL); } @@ -1087,47 +1089,56 @@ gst_ffmpegdemux_read_tags (GstFFMpegDemu { GstTagList *tlist; gboolean hastag = FALSE; + AVMetadataTag *meta; tlist = gst_tag_list_new (); - if (*demux->context->title) { + meta = av_metadata_get(demux->context->metadata, "title", 0, 0); + if (meta) { gst_tag_list_add (tlist, GST_TAG_MERGE_REPLACE, - GST_TAG_TITLE, my_safe_copy (demux->context->title), NULL); + GST_TAG_TITLE, my_safe_copy (meta->value), NULL); hastag = TRUE; } - if (*demux->context->author) { + meta = av_metadata_get(demux->context->metadata, "artist", 0, 0); + if (meta) { gst_tag_list_add (tlist, GST_TAG_MERGE_REPLACE, - GST_TAG_ARTIST, my_safe_copy (demux->context->author), NULL); + GST_TAG_ARTIST, my_safe_copy (meta->value), NULL); hastag = TRUE; } - if (*demux->context->copyright) { + meta = av_metadata_get(demux->context->metadata, "copyright", 0, 0); + if (meta) { gst_tag_list_add (tlist, GST_TAG_MERGE_REPLACE, - GST_TAG_COPYRIGHT, my_safe_copy (demux->context->copyright), NULL); + GST_TAG_COPYRIGHT, my_safe_copy (meta->value), NULL); hastag = TRUE; } - if (*demux->context->comment) { + meta = av_metadata_get(demux->context->metadata, "comment", 0, 0); + if (meta) { gst_tag_list_add (tlist, GST_TAG_MERGE_REPLACE, - GST_TAG_COMMENT, my_safe_copy (demux->context->comment), NULL); + GST_TAG_COMMENT, my_safe_copy (meta->value), NULL); hastag = TRUE; } - if (*demux->context->album) { + meta = av_metadata_get(demux->context->metadata, "album", 0, 0); + if (meta) { gst_tag_list_add (tlist, GST_TAG_MERGE_REPLACE, - GST_TAG_ALBUM, my_safe_copy (demux->context->album), NULL); + GST_TAG_ALBUM, my_safe_copy (meta->value), NULL); hastag = TRUE; } - if (demux->context->track) { + meta = av_metadata_get(demux->context->metadata, "track", 0, 0); + if (meta) { gst_tag_list_add (tlist, GST_TAG_MERGE_REPLACE, - GST_TAG_TRACK_NUMBER, demux->context->track, NULL); + GST_TAG_TRACK_NUMBER, atoi(meta->value), NULL); hastag = TRUE; } - if (*demux->context->genre) { + meta = av_metadata_get(demux->context->metadata, "genre", 0, 0); + if (meta) { gst_tag_list_add (tlist, GST_TAG_MERGE_REPLACE, - GST_TAG_GENRE, my_safe_copy (demux->context->genre), NULL); + GST_TAG_GENRE, my_safe_copy (meta->value), NULL); hastag = TRUE; } - if (demux->context->year) { + meta = av_metadata_get(demux->context->metadata, "date", 0, 0); + if (meta) { gst_tag_list_add (tlist, GST_TAG_MERGE_REPLACE, - GST_TAG_DATE, g_date_new_dmy (1, 1, demux->context->year), NULL); + GST_TAG_DATE, my_safe_copy(meta->value), NULL); hastag = TRUE; } @@ -1391,7 +1402,7 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * d /* prepare to push packet to peer */ srcpad = stream->pad; - rawvideo = (avstream->codec->codec_type == CODEC_TYPE_VIDEO && + rawvideo = (avstream->codec->codec_type == AVMEDIA_TYPE_VIDEO && avstream->codec->codec_id == CODEC_ID_RAWVIDEO); if (rawvideo) @@ -1443,7 +1454,7 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * d GST_BUFFER_DURATION (outbuf) = duration; /* mark keyframes */ - if (!(pkt.flags & PKT_FLAG_KEY)) { + if (!(pkt.flags & AV_PKT_FLAG_KEY)) { GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT); } --- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegenc.c.ark 2011-04-28 10:33:42.298165694 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegenc.c 2011-04-28 10:33:48.254832215 +0200 @@ -136,7 +136,7 @@ gst_ffmpegenc_base_init (GstFFMpegEncCla /* construct the element details struct */ longname = g_strdup_printf ("FFmpeg %s encoder", in_plugin->long_name); classification = g_strdup_printf ("Codec/Encoder/%s", - (in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio"); + (in_plugin->type == AVMEDIA_TYPE_VIDEO) ? "Video" : "Audio"); description = g_strdup_printf ("FFmpeg %s encoder", in_plugin->name); gst_element_class_set_details_simple (element_class, longname, classification, description, @@ -151,7 +151,7 @@ gst_ffmpegenc_base_init (GstFFMpegEncCla srccaps = gst_caps_new_simple ("unknown/unknown", NULL); } - if (in_plugin->type == CODEC_TYPE_VIDEO) { + if (in_plugin->type == AVMEDIA_TYPE_VIDEO) { sinkcaps = gst_caps_from_string ("video/x-raw-rgb; video/x-raw-yuv; video/x-raw-gray"); } else { @@ -193,7 +193,7 @@ gst_ffmpegenc_class_init (GstFFMpegEncCl gobject_class->set_property = gst_ffmpegenc_set_property; gobject_class->get_property = gst_ffmpegenc_get_property; - if (klass->in_plugin->type == CODEC_TYPE_VIDEO) { + if (klass->in_plugin->type == AVMEDIA_TYPE_VIDEO) { g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE, g_param_spec_ulong ("bitrate", "Bit Rate", "Target Video Bitrate", 0, G_MAXULONG, DEFAULT_VIDEO_BITRATE, @@ -219,7 +219,7 @@ gst_ffmpegenc_class_init (GstFFMpegEncCl /* register additional properties, possibly dependent on the exact CODEC */ gst_ffmpeg_cfg_install_property (klass, ARG_CFG_BASE); - } else if (klass->in_plugin->type == CODEC_TYPE_AUDIO) { + } else if (klass->in_plugin->type == AVMEDIA_TYPE_AUDIO) { g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE, g_param_spec_ulong ("bitrate", "Bit Rate", "Target Audio Bitrate", 0, G_MAXULONG, DEFAULT_AUDIO_BITRATE, @@ -252,7 +252,7 @@ gst_ffmpegenc_init (GstFFMpegEnc * ffmpe ffmpegenc->file = NULL; ffmpegenc->delay = g_queue_new (); - if (oclass->in_plugin->type == CODEC_TYPE_VIDEO) { + if (oclass->in_plugin->type == AVMEDIA_TYPE_VIDEO) { gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_video); /* so we know when to flush the buffers on EOS */ gst_pad_set_event_function (ffmpegenc->sinkpad, gst_ffmpegenc_event_video); @@ -269,7 +269,7 @@ gst_ffmpegenc_init (GstFFMpegEnc * ffmpe ffmpegenc->max_key_interval = 0; gst_ffmpeg_cfg_set_defaults (ffmpegenc); - } else if (oclass->in_plugin->type == CODEC_TYPE_AUDIO) { + } else if (oclass->in_plugin->type == AVMEDIA_TYPE_AUDIO) { gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_audio); ffmpegenc->bitrate = DEFAULT_AUDIO_BITRATE; @@ -382,7 +382,7 @@ gst_ffmpegenc_getcaps (GstPad * pad) GST_DEBUG_OBJECT (ffmpegenc, "getting caps"); /* audio needs no special care */ - if (oclass->in_plugin->type == CODEC_TYPE_AUDIO) { + if (oclass->in_plugin->type == AVMEDIA_TYPE_AUDIO) { caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); GST_DEBUG_OBJECT (ffmpegenc, "audio caps, return template %" GST_PTR_FORMAT, @@ -666,7 +666,7 @@ gst_ffmpegenc_setcaps (GstPad * pad, Gst /* we may have failed mapping caps to a pixfmt, * and quite some codecs do not make up their own mind about that * in any case, _NONE can never work out later on */ - if (oclass->in_plugin->type == CODEC_TYPE_VIDEO && pix_fmt == PIX_FMT_NONE) { + if (oclass->in_plugin->type == AVMEDIA_TYPE_VIDEO && pix_fmt == PIX_FMT_NONE) { GST_DEBUG_OBJECT (ffmpegenc, "ffenc_%s: Failed to determine input format", oclass->in_plugin->name); return FALSE; --- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegmux.c.ark 2011-04-28 12:14:07.321352251 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegmux.c 2011-04-28 12:19:18.694678000 +0200 @@ -412,7 +412,7 @@ gst_ffmpegmux_request_new_pad (GstElemen gchar *padname; GstPad *pad; AVStream *st; - enum CodecType type; + enum AVMediaType type; gint bitrate = 0, framesize = 0; g_return_val_if_fail (templ != NULL, NULL); @@ -422,12 +422,12 @@ gst_ffmpegmux_request_new_pad (GstElemen /* figure out a name that *we* like */ if (templ == gst_element_class_get_pad_template (klass, "video_%d")) { padname = g_strdup_printf ("video_%d", ffmpegmux->videopads++); - type = CODEC_TYPE_VIDEO; + type = AVMEDIA_TYPE_VIDEO; bitrate = 64 * 1024; framesize = 1152; } else if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) { padname = g_strdup_printf ("audio_%d", ffmpegmux->audiopads++); - type = CODEC_TYPE_AUDIO; + type = AVMEDIA_TYPE_AUDIO; bitrate = 285 * 1024; } else { g_warning ("ffmux: unknown pad template!"); @@ -560,12 +560,12 @@ gst_ffmpegmux_collected (GstCollectPads if (st->codec->codec_id == CODEC_ID_NONE) { GST_ELEMENT_ERROR (ffmpegmux, CORE, NEGOTIATION, (NULL), ("no caps set on stream %d (%s)", collect_pad->padnum, - (st->codec->codec_type == CODEC_TYPE_VIDEO) ? + (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) ? "video" : "audio")); return GST_FLOW_ERROR; } /* set framerate for audio */ - if (st->codec->codec_type == CODEC_TYPE_AUDIO) { + if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { switch (st->codec->codec_id) { case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16BE: @@ -602,31 +602,27 @@ gst_ffmpegmux_collected (GstCollectPads /* get the interesting ones */ if (gst_tag_list_get_string (tags, GST_TAG_TITLE, &s)) { - strncpy (ffmpegmux->context->title, s, - sizeof (ffmpegmux->context->title)); + av_metadata_set2(&ffmpegmux->context->metadata, "title", s, 0); } if (gst_tag_list_get_string (tags, GST_TAG_ARTIST, &s)) { - strncpy (ffmpegmux->context->author, s, - sizeof (ffmpegmux->context->author)); + av_metadata_set2(&ffmpegmux->context->metadata, "artist", s, 0); } if (gst_tag_list_get_string (tags, GST_TAG_COPYRIGHT, &s)) { - strncpy (ffmpegmux->context->copyright, s, - sizeof (ffmpegmux->context->copyright)); + av_metadata_set2(&ffmpegmux->context->metadata, "copyright", s, 0); } if (gst_tag_list_get_string (tags, GST_TAG_COMMENT, &s)) { - strncpy (ffmpegmux->context->comment, s, - sizeof (ffmpegmux->context->comment)); + av_metadata_set2(&ffmpegmux->context->metadata, "comment", s, 0); } if (gst_tag_list_get_string (tags, GST_TAG_ALBUM, &s)) { - strncpy (ffmpegmux->context->album, s, - sizeof (ffmpegmux->context->album)); + av_metadata_set2(&ffmpegmux->context->metadata, "album", s, 0); } if (gst_tag_list_get_string (tags, GST_TAG_GENRE, &s)) { - strncpy (ffmpegmux->context->genre, s, - sizeof (ffmpegmux->context->genre)); + av_metadata_set2(&ffmpegmux->context->metadata, "genre", s, 0); } if (gst_tag_list_get_int (tags, GST_TAG_TRACK_NUMBER, &i)) { - ffmpegmux->context->track = i; + char tn[16]; + snprintf(tn, 16, "%d", i); + av_metadata_set2(&ffmpegmux->context->metadata, "title", tn, 0); } } @@ -743,7 +739,7 @@ gst_ffmpegmux_collected (GstCollectPads pkt.flags = 0; if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) - pkt.flags |= PKT_FLAG_KEY; + pkt.flags |= AV_PKT_FLAG_KEY; if (GST_BUFFER_DURATION_IS_VALID (buf)) pkt.duration = --- gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegprotocol.c.ark 2011-04-28 10:25:13.074844764 +0200 +++ gst-ffmpeg-0.10.11/ext/ffmpeg/gstffmpegprotocol.c 2011-04-28 10:26:26.381509644 +0200 @@ -101,7 +101,7 @@ gst_ffmpegdata_peek (URLContext * h, uns GstFlowReturn ret; int total = 0; - g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR_IO); + g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR(EIO)); info = (GstProtocolInfo *) h->priv_data; GST_DEBUG ("Pulling %d bytes at position %" G_GUINT64_FORMAT, size, @@ -154,7 +154,7 @@ gst_ffmpegdata_read (URLContext * h, uns } static int -gst_ffmpegdata_write (URLContext * h, unsigned char *buf, int size) +gst_ffmpegdata_write (URLContext * h, const unsigned char *buf, int size) { GstProtocolInfo *info; GstBuffer *outbuf;