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