~ubuntu-branches/ubuntu/precise/gst-plugins-bad0.10/precise-proposed

« back to all changes in this revision

Viewing changes to gst/asfmux/gstasfobjects.c

Tags: upstream-0.10.17.2
Import upstream version 0.10.17.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 * Returns: The generated GUID
65
65
 */
66
66
Guid
67
 
gst_asf_generate_file_id ()
 
67
gst_asf_generate_file_id (void)
68
68
{
69
69
  guint32 aux;
70
70
  Guid guid;
168
168
 
169
169
/**
170
170
 * gst_asf_file_info_new:
 
171
 *
171
172
 * Creates a new #GstAsfFileInfo
 
173
 * 
172
174
 * Returns: the created struct
173
175
 */
174
176
GstAsfFileInfo *
175
 
gst_asf_file_info_new ()
 
177
gst_asf_file_info_new (void)
176
178
{
177
179
  return g_new0 (GstAsfFileInfo, 1);
178
180
}
180
182
/**
181
183
 * gst_asf_file_info_reset:
182
184
 * @info: the #GstAsfFileInfo to be reset
 
185
 * 
183
186
 * resets the data of a #GstFileInfo
184
187
 */
185
188
void
237
240
 * Returns:
238
241
 */
239
242
guint64
240
 
gst_asf_get_current_time ()
 
243
gst_asf_get_current_time (void)
241
244
{
242
245
  GTimeVal timeval;
243
246
  guint64 secs;
284
287
void
285
288
gst_asf_put_i32 (guint8 * buf, gint32 data)
286
289
{
287
 
  *(gint32 *) buf = data;
 
290
  GST_WRITE_UINT32_LE (buf, (guint32) data);
288
291
}
289
292
 
290
293
/**
516
519
 
517
520
gboolean
518
521
gst_asf_parse_packet (GstBuffer * buffer, GstAsfPacketInfo * packet,
519
 
    gboolean trust_delta_flag)
 
522
    gboolean trust_delta_flag, guint packet_size)
520
523
{
521
524
  GstByteReader *reader;
522
525
  gboolean ret = TRUE;
536
539
  guint16 duration = 0;
537
540
  gboolean has_keyframe;
538
541
 
 
542
  if (packet_size != 0 && GST_BUFFER_SIZE (buffer) != packet_size) {
 
543
    GST_WARNING ("ASF packets should be aligned with buffers");
 
544
    return FALSE;
 
545
  }
 
546
 
539
547
  reader = gst_byte_reader_new_from_buffer (buffer);
540
548
 
541
549
  GST_LOG ("Starting packet parsing, size: %u", GST_BUFFER_SIZE (buffer));
596
604
          padding_len_type, &padd_len))
597
605
    goto error;
598
606
 
599
 
  if (packet_len_type != ASF_FIELD_TYPE_NONE &&
600
 
      packet_len != GST_BUFFER_SIZE (buffer)) {
601
 
    GST_WARNING ("ASF packets should be aligned with buffers");
602
 
    ret = FALSE;
603
 
    goto end;
 
607
  /* some packet size validation */
 
608
  if (packet_size != 0 && packet_len_type != ASF_FIELD_TYPE_NONE) {
 
609
    if (padding_len_type != ASF_FIELD_TYPE_NONE &&
 
610
        packet_len + padd_len != packet_size) {
 
611
      GST_WARNING ("Packet size (payload=%u + padding=%u) doesn't "
 
612
          "match expected size %u", packet_len, padd_len, packet_size);
 
613
      ret = FALSE;
 
614
    }
 
615
 
 
616
    /* Be forgiving if packet_len has the full packet size
 
617
     * as the spec isn't really clear on its meaning.
 
618
     *
 
619
     * I had been taking it as the full packet size (fixed)
 
620
     * until bug #607555, that convinced me that it is more likely
 
621
     * the actual payloaded data size.
 
622
     */
 
623
    if (packet_len == packet_size) {
 
624
      GST_DEBUG ("This packet's length field represents the full "
 
625
          "packet and not the payloaded data length");
 
626
      ret = TRUE;
 
627
    }
 
628
 
 
629
    if (!ret)
 
630
      goto end;
604
631
  }
605
632
 
606
633
  GST_LOG ("Getting send time and duration");