Merge branch 'master' into 0.11
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 10 Jan 2012 10:35:55 +0000 (11:35 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 10 Jan 2012 10:35:55 +0000 (11:35 +0100)
Conflicts:
configure.ac
ext/ffmpeg/gstffmpegcodecmap.c
ext/ffmpeg/gstffmpegdec.c
ext/ffmpeg/gstffmpegdeinterlace.c
ext/ffmpeg/gstffmpegmux.c
ext/libswscale/gstffmpegscale.c

1  2 
ext/ffmpeg/gstffmpegaudioresample.c
ext/ffmpeg/gstffmpegdec.c
ext/ffmpeg/gstffmpegmux.c
ext/libpostproc/gstpostproc.c

Simple merge
@@@ -473,30 -474,49 +473,47 @@@ gst_ffmpegdec_finalize (GObject * objec
  }
  
  static gboolean
 -gst_ffmpegdec_query (GstPad * pad, GstQuery * query)
 +gst_ffmpegdec_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
  {
-   gboolean res;
-   /* just forward to peer */
-   res = gst_pad_query_default (pad, parent, query);
- #if 0
-   {
-     GstFormat bfmt;
-     bfmt = GST_FORMAT_BYTES;
+   GstFFMpegDec *ffmpegdec;
+   gboolean res = FALSE;
  
-     /* ok, do bitrate calc... */
-     if ((type != GST_QUERY_POSITION && type != GST_QUERY_TOTAL) ||
-         *fmt != GST_FORMAT_TIME || ffmpegdec->context->bit_rate == 0 ||
-         !gst_pad_query (peer, type, &bfmt, value))
-       return FALSE;
 -  ffmpegdec = (GstFFMpegDec *) gst_pad_get_parent (pad);
++  ffmpegdec = (GstFFMpegDec *) parent;
  
-     if (ffmpegdec->pcache && type == GST_QUERY_POSITION)
-       *value -= GST_BUFFER_SIZE (ffmpegdec->pcache);
-     *value *= GST_SECOND / ffmpegdec->context->bit_rate;
+   switch (GST_QUERY_TYPE (query)) {
+     case GST_QUERY_LATENCY:
+     {
+       GST_DEBUG_OBJECT (ffmpegdec, "latency query %d",
+           ffmpegdec->context->has_b_frames);
+       if ((res = gst_pad_peer_query (ffmpegdec->sinkpad, query))) {
+         if (ffmpegdec->context->has_b_frames) {
+           gboolean live;
+           GstClockTime min_lat, max_lat, our_lat;
+           gst_query_parse_latency (query, &live, &min_lat, &max_lat);
+           if (ffmpegdec->format.video.fps_n > 0)
+             our_lat =
+                 gst_util_uint64_scale_int (ffmpegdec->context->has_b_frames *
+                 GST_SECOND, ffmpegdec->format.video.fps_d,
+                 ffmpegdec->format.video.fps_n);
+           else
+             our_lat =
+                 gst_util_uint64_scale_int (ffmpegdec->context->has_b_frames *
+                 GST_SECOND, 1, 25);
+           if (min_lat != -1)
+             min_lat += our_lat;
+           if (max_lat != -1)
+             max_lat += our_lat;
+           gst_query_set_latency (query, live, min_lat, max_lat);
+         }
+       }
+     }
+       break;
+     default:
+       res = gst_pad_query_default (pad, query);
+       break;
    }
- #endif
  
 -  gst_object_unref (ffmpegdec);
 -
    return res;
  }
  
@@@ -113,12 -113,11 +113,12 @@@ static void gst_ffmpegmux_finalize (GOb
  
  static gboolean gst_ffmpegmux_setcaps (GstPad * pad, GstCaps * caps);
  static GstPad *gst_ffmpegmux_request_new_pad (GstElement * element,
 -    GstPadTemplate * templ, const gchar * name);
 +    GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
- static GstFlowReturn gst_ffmpegmux_collected (GstCollectPads * pads,
+ static GstFlowReturn gst_ffmpegmux_collected (GstCollectPads2 * pads,
      gpointer user_data);
  
 -static gboolean gst_ffmpegmux_sink_event (GstPad * pad, GstEvent * event);
 +static gboolean gst_ffmpegmux_sink_event (GstPad * pad, GstObject * parent,
 +    GstEvent * event);
  
  static GstStateChangeReturn gst_ffmpegmux_change_state (GstElement * element,
      GstStateChange transition);
@@@ -272,17 -272,20 +272,20 @@@ gst_ffmpegmux_base_init (gpointer g_cla
    /* pad templates */
    srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
    gst_element_class_add_pad_template (element_class, srctempl);
+   gst_object_unref (srctempl);
  
    if (audiosinkcaps) {
 -    audiosinktempl = gst_pad_template_new ("audio_%d",
 +    audiosinktempl = gst_pad_template_new ("audio_%u",
          GST_PAD_SINK, GST_PAD_REQUEST, audiosinkcaps);
      gst_element_class_add_pad_template (element_class, audiosinktempl);
+     gst_object_unref (audiosinktempl);
    }
  
    if (videosinkcaps) {
 -    videosinktempl = gst_pad_template_new ("video_%d",
 +    videosinktempl = gst_pad_template_new ("video_%u",
          GST_PAD_SINK, GST_PAD_REQUEST, videosinkcaps);
      gst_element_class_add_pad_template (element_class, videosinktempl);
+     gst_object_unref (videosinktempl);
    }
  
  beach:
@@@ -721,11 -718,10 +724,11 @@@ gst_ffmpegmux_collected (GstCollectPads
      GstBuffer *buf;
      AVPacket pkt;
      gboolean need_free = FALSE;
 +    gsize size;
  
      /* push out current buffer */
-     buf = gst_collect_pads_pop (ffmpegmux->collect,
-         (GstCollectData *) best_pad);
+     buf = gst_collect_pads2_pop (ffmpegmux->collect,
+         (GstCollectData2 *) best_pad);
  
      ffmpegmux->context->streams[best_pad->padnum]->codec->frame_number++;
  
Simple merge