jpegdec: Clean up handling of reset/start/stop
authorSebastian Dröge <slomo@circular-chaos.org>
Thu, 25 Jul 2013 12:12:56 +0000 (14:12 +0200)
committerSebastian Dröge <slomo@circular-chaos.org>
Thu, 25 Jul 2013 12:26:37 +0000 (14:26 +0200)
ext/jpeg/gstjpegdec.c

index b96ef94..378165b 100644 (file)
@@ -98,7 +98,6 @@ static void gst_jpeg_dec_get_property (GObject * object, guint prop_id,
 
 static gboolean gst_jpeg_dec_set_format (GstVideoDecoder * dec,
     GstVideoCodecState * state);
-static gboolean gst_jpeg_dec_start (GstVideoDecoder * bdec);
 static gboolean gst_jpeg_dec_stop (GstVideoDecoder * bdec);
 static gboolean gst_jpeg_dec_reset (GstVideoDecoder * bdec, gboolean hard);
 static GstFlowReturn gst_jpeg_dec_parse (GstVideoDecoder * bdec,
@@ -169,7 +168,6 @@ gst_jpeg_dec_class_init (GstJpegDecClass * klass)
       "Codec/Decoder/Image",
       "Decode images from JPEG format", "Wim Taymans <wim@fluendo.com>");
 
-  vdec_class->start = gst_jpeg_dec_start;
   vdec_class->stop = gst_jpeg_dec_stop;
   vdec_class->reset = gst_jpeg_dec_reset;
   vdec_class->parse = gst_jpeg_dec_parse;
@@ -1350,6 +1348,13 @@ gst_jpeg_dec_reset (GstVideoDecoder * bdec, gboolean hard)
   dec->parse_resync = FALSE;
   dec->saw_header = FALSE;
 
+  if (hard) {
+    dec->parse_entropy_len = 0;
+    dec->parse_resync = FALSE;
+
+    gst_video_decoder_set_packetized (bdec, FALSE);
+  }
+
   return TRUE;
 }
 
@@ -1398,20 +1403,6 @@ gst_jpeg_dec_get_property (GObject * object, guint prop_id, GValue * value,
 }
 
 static gboolean
-gst_jpeg_dec_start (GstVideoDecoder * bdec)
-{
-  GstJpegDec *dec = (GstJpegDec *) bdec;
-
-  dec->error_count = 0;
-  dec->parse_entropy_len = 0;
-  dec->parse_resync = FALSE;
-
-  gst_video_decoder_set_packetized (bdec, FALSE);
-
-  return TRUE;
-}
-
-static gboolean
 gst_jpeg_dec_stop (GstVideoDecoder * bdec)
 {
   GstJpegDec *dec = (GstJpegDec *) bdec;