fixed prevent issues.
authorKitae Kim <kt920.kim@samsung.com>
Fri, 5 Jul 2013 11:41:33 +0000 (20:41 +0900)
committerKitae Kim <kt920.kim@samsung.com>
Fri, 5 Jul 2013 11:41:33 +0000 (20:41 +0900)
Change-Id: Ic7dd6f671ec2da374545eed61c3915f5221b9247
Signed-off-by: Kitae Kim <kt920.kim@samsung.com>
packaging/gst-plugins-emulator.changes
packaging/gst-plugins-emulator.spec
src/gstemuldec.c
src/gstemulenc.c

index b182845..54bbcf4 100644 (file)
@@ -1,3 +1,6 @@
+* Fri Jul  5 11:33:44 UTC 2013 Kitae Kim <kt920.kim@samsung.com>
+- fixed prevent issues.
+
 * Thu Jun 27 15:04:20 UTC 2013 Kitae Kim <kt920.kim@samsung.com>
 - fixed prevent issues.
 
index 542bc55..544a544 100644 (file)
@@ -1,5 +1,5 @@
 Name: gst-plugins-emulator
-Version: 0.1.2
+Version: 0.1.3
 Release: 2 
 Summary: GStreamer Streaming-media framework plug-in for Tizen emulator.
 Group: TO_BE/FILLED_IN
index 4160f47..53ae410 100644 (file)
@@ -717,7 +717,6 @@ static gboolean
 gst_emuldec_open (GstEmulDec *emuldec)
 {
   GstEmulDecClass *oclass;
-  int width, height, buf_size;
 
   oclass = (GstEmulDecClass *) (G_OBJECT_GET_CLASS (emuldec));
 
@@ -725,28 +724,6 @@ gst_emuldec_open (GstEmulDec *emuldec)
     return FALSE;
   }
 
-#if 0
-  switch (oclass->codec->media_type) {
-  case AVMEDIA_TYPE_VIDEO:
-    width = emuldec->context->video.width;
-    height = emuldec->context->video.height;
-    buf_size = gst_emul_avpicture_size (0, width, height) + 100;
-    break;
-  case AVMEDIA_TYPE_AUDIO:
-    buf_size = FF_MAX_AUDIO_FRAME_SIZE + 100;
-    break;
-  default:
-    buf_size = -1;
-    break;
-  }
-
-  if (buf_size < 0) {
-    return FALSE;
-  }
-
-  emuldec->dev->buf_size = gst_emul_align_size(buf_size);
-#endif
-
   if (gst_emul_avcodec_open (emuldec->context,
                             oclass->codec, emuldec->dev) < 0) {
     gst_emuldec_close (emuldec);
@@ -1580,7 +1557,7 @@ gst_emuldec_register (GstPlugin *plugin, GList *element)
       return FALSE;
     }
     g_free (type_name);
-  } while ((elem = g_list_next (elem)));
+  } while ((elem = elem->next));
 
   return TRUE;
 }
index 6013ab3..585c40d 100644 (file)
@@ -351,7 +351,12 @@ gst_emulenc_getcaps (GstPad *pad)
 
   GST_DEBUG_OBJECT (emulenc, "getting caps");
 
-  if (oclass->codec && oclass->codec->media_type == AVMEDIA_TYPE_AUDIO) {
+  if (!oclass->codec)  {
+    GST_ERROR_OBJECT (emulenc, "codec element is null.");
+    return NULL;
+  }
+
+  if (oclass->codec->media_type == AVMEDIA_TYPE_AUDIO) {
     caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
 
     GST_DEBUG_OBJECT (emulenc, "audio caps, return template %" GST_PTR_FORMAT,
@@ -369,30 +374,29 @@ gst_emulenc_getcaps (GstPad *pad)
   GST_DEBUG_OBJECT (emulenc, "probing caps");
   i = pixfmt = 0;
 
-#if 1
   for (pixfmt = 0;; pixfmt++) {
     GstCaps *tmpcaps;
 
-//    if (oclass->codec->pix_fmts) {
-       if ((pixfmt = oclass->codec->pix_fmts[i++]) == PIX_FMT_NONE) {
-               GST_DEBUG_OBJECT (emulenc,
-                               "At the end of official pixfmt for this codec, breaking out");
-               break;
-       }
-       GST_DEBUG_OBJECT (emulenc,
-                       "Got an official pixfmt [%d], attempting to get caps", pixfmt);
-       tmpcaps = gst_emul_pixfmt_to_caps (pixfmt, NULL, oclass->codec->name);
-       if (tmpcaps) {
-               GST_DEBUG_OBJECT (emulenc, "Got caps, breaking out");
-               if (!caps) {
-                       caps = gst_caps_new_empty ();
-               }
-               gst_caps_append (caps, tmpcaps);
-               continue;
-       }
-       GST_DEBUG_OBJECT (emulenc,
-                       "Couldn't figure out caps without context, trying again with a context");
-//    }
+    if ((pixfmt = oclass->codec->pix_fmts[i++]) == PIX_FMT_NONE) {
+      GST_DEBUG_OBJECT (emulenc,
+          "At the end of official pixfmt for this codec, breaking out");
+      break;
+    }
+
+    GST_DEBUG_OBJECT (emulenc,
+        "Got an official pixfmt [%d], attempting to get caps", pixfmt);
+    tmpcaps = gst_emul_pixfmt_to_caps (pixfmt, NULL, oclass->codec->name);
+    if (tmpcaps) {
+      GST_DEBUG_OBJECT (emulenc, "Got caps, breaking out");
+      if (!caps) {
+        caps = gst_caps_new_empty ();
+      }
+      gst_caps_append (caps, tmpcaps);
+      continue;
+    }
+
+    GST_DEBUG_OBJECT (emulenc,
+        "Couldn't figure out caps without context, trying again with a context");
 
     GST_DEBUG_OBJECT (emulenc, "pixfmt: %d", pixfmt);
     if (pixfmt >= PIX_FMT_NB) {
@@ -413,23 +417,23 @@ gst_emulenc_getcaps (GstPad *pad)
     ctx->video.ticks_per_frame = 1;
     ctx->bit_rate = DEFAULT_VIDEO_BITRATE;
 
-//    ctx->strict_std_compliance = -1;
+//  ctx->strict_std_compliance = -1;
     ctx->video.pix_fmt = pixfmt;
 
     GST_DEBUG ("Attempting to open codec");
     if (gst_emul_avcodec_open (ctx, oclass->codec, emulenc->dev) >= 0
-      && ctx->video.pix_fmt == pixfmt) {
+        && ctx->video.pix_fmt == pixfmt) {
       ctx->video.width = -1;
       if (!caps) {
         caps = gst_caps_new_empty ();
       }
       tmpcaps = gst_emul_codectype_to_caps (oclass->codec->media_type, ctx,
-        oclass->codec->name, TRUE);
+          oclass->codec->name, TRUE);
       if (tmpcaps) {
         gst_caps_append (caps, tmpcaps);
       } else {
         GST_LOG_OBJECT (emulenc,
-          "Couldn't get caps for codec: %s", oclass->codec->name);
+            "Couldn't get caps for codec: %s", oclass->codec->name);
       }
       gst_emul_avcodec_close (ctx, emulenc->dev);
     } else {
@@ -444,7 +448,6 @@ gst_emulenc_getcaps (GstPad *pad)
 #endif
     g_free (ctx);
   }
-#endif
 
   if (!caps) {
     caps = gst_emulenc_get_possible_sizes (emulenc, pad,
@@ -933,7 +936,6 @@ gst_emulenc_flush_buffers (GstEmulEnc *emulenc, gboolean send)
 
   GST_DEBUG_OBJECT (emulenc, "flushing buffers with sending %d", send);
 
-
   if (!emulenc->opened) {
     while (!g_queue_is_empty (emulenc->delay)) {
       gst_buffer_unref (g_queue_pop_head (emulenc->delay));
@@ -941,7 +943,6 @@ gst_emulenc_flush_buffers (GstEmulEnc *emulenc, gboolean send)
   }
 
 #if 0
-
   while (!g_queue_is_empty (emulenc->delay)) {
     emulenc_setup_working_buf (emulenc);
 
@@ -1118,7 +1119,7 @@ gst_emulenc_register (GstPlugin *plugin, GList *element)
   CodecElement *codec = NULL;
 
   if (!elem) {
-         return FALSE;
+    return FALSE;
   }
 
   /* register element */
@@ -1126,7 +1127,6 @@ gst_emulenc_register (GstPlugin *plugin, GList *element)
     codec = (CodecElement *)(elem->data);
     if (!codec) {
       return FALSE;
-      break;
     }
 
     if (codec->codec_type != CODEC_TYPE_ENCODE) {
@@ -1145,7 +1145,7 @@ gst_emulenc_register (GstPlugin *plugin, GList *element)
       return FALSE;
     }
     g_free (type_name);
-  } while ((elem = g_list_next (elem)));
+  } while ((elem = elem->next));
 
   return TRUE;
 }