gst_plugins_base/gst/gdp/gstgdpdepay.c
changeset 16 8e837d1bf446
parent 0 0e761a78d257
child 30 7e817e7e631c
equal deleted inserted replaced
15:4b0c6ed43234 16:8e837d1bf446
    19 
    19 
    20 /**
    20 /**
    21  * SECTION:element-gdpdepay
    21  * SECTION:element-gdpdepay
    22  * @see_also: gdppay
    22  * @see_also: gdppay
    23  *
    23  *
    24  * <refsect2>
       
    25  * <para>
       
    26  * This element depayloads GStreamer Data Protocol buffers back to deserialized
    24  * This element depayloads GStreamer Data Protocol buffers back to deserialized
    27  * buffers and events.
    25  * buffers and events.
    28  * </para>
    26  *
    29  * <para>
    27  * <refsect2>
    30  * <programlisting>
    28  * |[
    31  * gst-launch -v -m filesrc location=test.gdp ! gdpdepay ! xvimagesink
    29  * gst-launch -v -m filesrc location=test.gdp ! gdpdepay ! xvimagesink
    32  * </programlisting>
    30  * ]| This pipeline plays back a serialized video stream as created in the
    33  * This pipeline plays back a serialized video stream as created in the
       
    34  * example for gdppay.
    31  * example for gdppay.
    35  * </para>
       
    36  * </refsect2>
    32  * </refsect2>
    37  */
    33  */
    38 
    34 
    39 #ifdef HAVE_CONFIG_H
    35 #ifdef HAVE_CONFIG_H
    40 #include "config.h"
    36 #include "config.h"
   258         /* free previous header and store new one. */
   254         /* free previous header and store new one. */
   259         g_free (this->header);
   255         g_free (this->header);
   260         this->header = header;
   256         this->header = header;
   261 
   257 
   262         GST_LOG_OBJECT (this,
   258         GST_LOG_OBJECT (this,
   263             "read GDP header, payload size %d, switching to state PAYLOAD",
   259             "read GDP header, payload size %d, payload type %d, switching to state PAYLOAD",
   264             this->payload_length);
   260             this->payload_length, this->payload_type);
   265         this->state = GST_GDP_DEPAY_STATE_PAYLOAD;
   261         this->state = GST_GDP_DEPAY_STATE_PAYLOAD;
   266         break;
   262         break;
   267       }
   263       }
   268       case GST_GDP_DEPAY_STATE_PAYLOAD:
   264       case GST_GDP_DEPAY_STATE_PAYLOAD:
   269       {
   265       {
   285           GST_LOG_OBJECT (this, "switching to state EVENT");
   281           GST_LOG_OBJECT (this, "switching to state EVENT");
   286           this->state = GST_GDP_DEPAY_STATE_EVENT;
   282           this->state = GST_GDP_DEPAY_STATE_EVENT;
   287         } else {
   283         } else {
   288           goto wrong_type;
   284           goto wrong_type;
   289         }
   285         }
       
   286 
       
   287         if (this->payload_length
       
   288             && (!gst_dp_validate_payload (GST_DP_HEADER_LENGTH, this->header,
       
   289                     gst_adapter_peek (this->adapter, this->payload_length)))) {
       
   290           goto payload_validate_error;
       
   291         }
       
   292 
   290         break;
   293         break;
   291       }
   294       }
   292       case GST_GDP_DEPAY_STATE_BUFFER:
   295       case GST_GDP_DEPAY_STATE_BUFFER:
   293       {
   296       {
   294 
   297 
   390     GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
   393     GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
   391         ("GDP packet header does not validate"));
   394         ("GDP packet header does not validate"));
   392     ret = GST_FLOW_ERROR;
   395     ret = GST_FLOW_ERROR;
   393     goto done;
   396     goto done;
   394   }
   397   }
       
   398 payload_validate_error:
       
   399   {
       
   400     GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
       
   401         ("GDP packet payload does not validate"));
       
   402     ret = GST_FLOW_ERROR;
       
   403     goto done;
       
   404   }
   395 wrong_type:
   405 wrong_type:
   396   {
   406   {
   397     GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
   407     GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
   398         ("GDP packet header is of wrong type"));
   408         ("GDP packet header is of wrong type"));
   399     ret = GST_FLOW_ERROR;
   409     ret = GST_FLOW_ERROR;