This patch is based on Freescale release 10.11.01.

It is a forward port of the following patches:

gst-plugins-base-0.10.22-mpeg2avsyncfix.patch
gst-plugins-base-0.10.22-typefindaacplus2flac.patch
gst-plugins-base-0.10.25-optplaybin2.patch
gst-plugins-base-0.10.25-optplaybin-v2.patch

It allows playbin to properly select the freescale accelerated codecs.

diff -Naurp gst-plugins-base-0.10.32.old//gst/playback/gstdecodebin.c gst-plugins-base-0.10.32/gst/playback/gstdecodebin.c
--- gst-plugins-base-0.10.32.old//gst/playback/gstdecodebin.c	2010-11-25 16:18:44.000000000 -0500
+++ gst-plugins-base-0.10.32/gst/playback/gstdecodebin.c	2011-02-03 10:26:15.354018343 -0500
@@ -823,7 +823,7 @@ add_raw_queue (GstDecodeBin * decode_bin
 
   g_object_set (G_OBJECT (queue), "max-size-buffers", 0, NULL);
   g_object_set (G_OBJECT (queue), "max-size-time", G_GINT64_CONSTANT (0), NULL);
-  g_object_set (G_OBJECT (queue), "max-size-bytes", 8192, NULL);
+  g_object_set (G_OBJECT (queue), "max-size-bytes", 10*1024*1024, NULL);
   gst_bin_add (GST_BIN (decode_bin), queue);
   gst_element_set_state (queue, GST_STATE_READY);
   queuesinkpad = gst_element_get_static_pad (queue, "sink");
@@ -1102,7 +1102,7 @@ try_to_link_1 (GstDecodeBin * decode_bin
     g_object_set (G_OBJECT (queue), "max-size-buffers", 0, NULL);
     g_object_set (G_OBJECT (queue), "max-size-time", G_GINT64_CONSTANT (0),
         NULL);
-    g_object_set (G_OBJECT (queue), "max-size-bytes", 8192, NULL);
+    g_object_set (G_OBJECT (queue), "max-size-bytes", 10*1024*1024, NULL);
     gst_bin_add (GST_BIN (decode_bin), queue);
     gst_element_set_state (queue, GST_STATE_READY);
     queuesinkpad = gst_element_get_static_pad (queue, "sink");
diff -Naurp gst-plugins-base-0.10.32.old//gst/playback/gstplaybasebin.c gst-plugins-base-0.10.32/gst/playback/gstplaybasebin.c
--- gst-plugins-base-0.10.32.old//gst/playback/gstplaybasebin.c	2010-10-13 12:43:09.000000000 -0400
+++ gst-plugins-base-0.10.32/gst/playback/gstplaybasebin.c	2011-02-03 10:26:15.354018343 -0500
@@ -824,23 +824,11 @@ gen_preroll_element (GstPlayBaseBin * pl
    * after the source that measures the datarate and scales this
    * queue of encoded data instead.
    */
-  if (play_base_bin->raw_decoding_mode) {
-    if (type == GST_STREAM_TYPE_VIDEO) {
-      g_object_set (G_OBJECT (preroll),
-          "max-size-buffers", 2, "max-size-bytes", 0,
-          "max-size-time", (guint64) 0, NULL);
-    } else {
-      g_object_set (G_OBJECT (preroll),
-          "max-size-buffers", 0, "max-size-bytes",
-          2 * 1024 * 1024, "max-size-time", play_base_bin->queue_size, NULL);
-    }
-  } else {
-    g_object_set (G_OBJECT (preroll),
-        "max-size-buffers", 0, "max-size-bytes",
-        ((type == GST_STREAM_TYPE_VIDEO) ? 25 : 2) * 1024 * 1024,
-        "max-size-time", play_base_bin->queue_size, NULL);
-  }
-
+  if (type == GST_STREAM_TYPE_VIDEO)
+     g_object_set (G_OBJECT (preroll),"max-size-buffers", 1, "max-size-bytes", 0, "max-size-time", G_GINT64_CONSTANT (0), NULL);
+  else
+     g_object_set (G_OBJECT (preroll),"max-size-buffers", 1*1024*1024,"max-size-time", play_base_bin->queue_size, NULL);
+ 
   /* the overrun signal is always attached and serves two purposes:
    *
    *  1) when we are building a group and the overrun is called, we commit the 
@@ -919,8 +907,14 @@ gen_preroll_element (GstPlayBaseBin * pl
   gst_bin_add (target, selector);
   gst_bin_add (target, preroll);
 
-  gst_element_link (selector, preroll);
-
+// Fixed the bug of ENGR00112498 & ENGR00112504. Two places should be changed.
+// This is the first place to change.
+// The second place locates in setup_sinks() of gstplaybin.c
+  if(!(type==GST_STREAM_TYPE_VIDEO))
+  {
+    gst_element_link (selector, preroll);
+  }
+ 
   /* figure out target state and set */
   state = (GST_STATE (play_base_bin) == GST_STATE_PLAYING ?
       GST_STATE_PLAYING : GST_STATE_PAUSED);
diff -Naurp gst-plugins-base-0.10.32.old//gst/playback/gstplaybin2.c gst-plugins-base-0.10.32/gst/playback/gstplaybin2.c
--- gst-plugins-base-0.10.32.old//gst/playback/gstplaybin2.c	2010-12-31 07:12:21.000000000 -0500
+++ gst-plugins-base-0.10.32/gst/playback/gstplaybin2.c	2011-02-03 10:26:13.054216281 -0500
@@ -1192,7 +1192,8 @@ gst_play_bin_init (GstPlayBin * playbin)
   /* add sink */
   playbin->playsink = g_object_new (GST_TYPE_PLAY_SINK, NULL);
   gst_bin_add (GST_BIN_CAST (playbin), GST_ELEMENT_CAST (playbin->playsink));
-  gst_play_sink_set_flags (playbin->playsink, DEFAULT_FLAGS);
+  /* Fslmm: Do not connect csc and video scaler */
+  gst_play_sink_set_flags (playbin->playsink, DEFAULT_FLAGS|GST_PLAY_FLAG_NATIVE_VIDEO);
   /* Connect to notify::volume and notify::mute signals for proxying */
   g_signal_connect (playbin->playsink, "notify::volume",
       G_CALLBACK (notify_volume_cb), playbin);
diff -Naurp gst-plugins-base-0.10.32.old//gst/playback/gstplaybin.c gst-plugins-base-0.10.32/gst/playback/gstplaybin.c
--- gst-plugins-base-0.10.32.old//gst/playback/gstplaybin.c	2010-10-13 07:54:05.000000000 -0400
+++ gst-plugins-base-0.10.32/gst/playback/gstplaybin.c	2011-02-03 10:26:15.444010591 -0500
@@ -844,7 +844,8 @@ gen_video_element (GstPlayBin * play_bin
   if (play_bin->video_sink) {
     sink = play_bin->video_sink;
   } else {
-    sink = gst_element_factory_make ("autovideosink", "videosink");
+    sink = gst_element_factory_make ("mfw_v4lsink", "videosink");
+    play_bin->video_sink = sink;
     if (sink == NULL) {
       sink = gst_element_factory_make ("xvimagesink", "videosink");
     }
@@ -859,27 +860,12 @@ gen_video_element (GstPlayBin * play_bin
   element = gst_bin_new ("vbin");
   gst_bin_add (GST_BIN_CAST (element), sink);
 
-  conv = gst_element_factory_make ("ffmpegcolorspace", "vconv");
-  if (conv == NULL)
-    goto no_colorspace;
-  gst_bin_add (GST_BIN_CAST (element), conv);
-
-  scale = gst_element_factory_make ("videoscale", "vscale");
-  if (scale == NULL)
-    goto no_videoscale;
-  gst_bin_add (GST_BIN_CAST (element), scale);
-
   identity = gst_element_factory_make ("identity", "id");
   g_object_set (identity, "silent", TRUE, NULL);
   g_signal_connect (identity, "handoff", G_CALLBACK (handoff), play_bin);
   gst_bin_add (GST_BIN_CAST (element), identity);
 
-  gst_element_link_pads (identity, "src", conv, "sink");
-  gst_element_link_pads (conv, "src", scale, "sink");
-  /* be more careful with the pad from the custom sink element, it might not
-   * be named 'sink' */
-  if (!gst_element_link_pads (scale, "src", sink, NULL))
-    goto link_failed;
+  gst_element_link_pads (identity, "src", sink, "sink");
 
   pad = gst_element_get_static_pad (identity, "sink");
   gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
@@ -1110,7 +1096,7 @@ gen_audio_element (GstPlayBin * play_bin
   if (play_bin->audio_sink) {
     sink = play_bin->audio_sink;
   } else {
-    sink = gst_element_factory_make ("autoaudiosink", "audiosink");
+    sink = gst_element_factory_make ("alsasink", "audiosink");
     if (sink == NULL) {
       sink = gst_element_factory_make ("alsasink", "audiosink");
     }
@@ -1126,30 +1112,47 @@ gen_audio_element (GstPlayBin * play_bin
   element = gst_bin_new ("abin");
   gst_bin_add (GST_BIN_CAST (element), sink);
 
+{
+  GstElement *capsfilter;
+  GstCaps *audiocaps = NULL;
+
   conv = gst_element_factory_make ("audioconvert", "aconv");
   if (conv == NULL)
     goto no_audioconvert;
   gst_bin_add (GST_BIN_CAST (element), conv);
 
-  scale = gst_element_factory_make ("audioresample", "aresample");
-  if (scale == NULL)
-    goto no_audioresample;
-  gst_bin_add (GST_BIN_CAST (element), scale);
+  /* Add capsfilter to only support 2 channel output */
+  audiocaps = gst_caps_new_simple("audio/x-raw-int",
+  			    "channels", G_TYPE_INT, 2, NULL);
+
+  capsfilter = gst_element_factory_make ("capsfilter", "audio-caps");
+  if ( capsfilter == NULL)
+  {
+    GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
+        (_("Missing element '%s' - check your GStreamer installation."),
+            "capsfilter"), ("Do not know the root cause."));
+    goto link_failed;
+
+  }
+  g_object_set(G_OBJECT(capsfilter), "caps", audiocaps, NULL);
+  gst_caps_unref(audiocaps);
+
+  gst_bin_add (GST_BIN_CAST (element), capsfilter);
 
   volume = gst_element_factory_make ("volume", "volume");
-  if (volume == NULL)
-    goto no_volume;
   g_object_set (G_OBJECT (volume), "volume", play_bin->volume, NULL);
-  play_bin->volume_element = GST_ELEMENT_CAST (gst_object_ref (volume));
+  play_bin->volume_element = volume;
   gst_bin_add (GST_BIN_CAST (element), volume);
 
-  res = gst_element_link_pads (conv, "src", scale, "sink");
-  res &= gst_element_link_pads (scale, "src", volume, "sink");
+  res = gst_element_link_pads (conv, "src", capsfilter, "sink");
+  res &= gst_element_link_pads (capsfilter, "src", volume, "sink");
   res &= gst_element_link_pads (volume, "src", sink, NULL);
   if (!res)
     goto link_failed;
 
-  pad = gst_element_get_static_pad (conv, "sink");
+  pad = gst_element_get_pad (conv, "sink");
+}
+
   gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
   gst_object_unref (pad);
 
@@ -1704,9 +1707,12 @@ setup_sinks (GstPlayBaseBin * play_base_
   beach:
     if (!sink)
       return FALSE;
+// Fixed the bug of ENGR00112498 & ENGR00112504. Two places should be changed.
+// This is the second place to change.
+// The first place locates in gen_preroll_element() of gstplaybasebin.c
     pad =
         gst_element_get_static_pad (group->type[GST_STREAM_TYPE_VIDEO -
-            1].preroll, "src");
+            1].selector, "src");
     res = add_sink (play_bin, sink, pad, textsrcpad);
     gst_object_unref (pad);
     if (textsrcpad)
diff -Naurp gst-plugins-base-0.10.32.old//gst/typefind/gsttypefindfunctions.c gst-plugins-base-0.10.32/gst/typefind/gsttypefindfunctions.c
--- gst-plugins-base-0.10.32.old//gst/typefind/gsttypefindfunctions.c	2011-01-13 08:58:51.000000000 -0500
+++ gst-plugins-base-0.10.32/gst/typefind/gsttypefindfunctions.c	2011-02-03 10:26:20.293593175 -0500
@@ -4272,7 +4272,7 @@ plugin_init (GstPlugin * plugin)
       NULL, CMML_CAPS, NULL, NULL);
   TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-executable",
       GST_RANK_MARGINAL, NULL, "\177ELF", 4, GST_TYPE_FIND_MAXIMUM);
-  TYPE_FIND_REGISTER (plugin, "audio/aac", GST_RANK_SECONDARY,
+  TYPE_FIND_REGISTER (plugin, "audio/aac", GST_RANK_PRIMARY,
       aac_type_find, aac_exts, AAC_CAPS, NULL, NULL);
   TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-spc", GST_RANK_SECONDARY,
       spc_exts, "SNES-SPC700 Sound File Data", 27, GST_TYPE_FIND_MAXIMUM);
