Merge branch 'master' into 0.11
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 9 Nov 2011 11:18:01 +0000 (12:18 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 9 Nov 2011 11:18:01 +0000 (12:18 +0100)
Conflicts:
ext/flac/gstflacdec.c
gst/audioparsers/gstflacparse.c
gst/isomp4/qtdemux.c

1  2 
gst/audioparsers/gstflacparse.c
gst/flv/gstflvdemux.c
gst/flv/gstflvdemux.h
gst/isomp4/qtdemux.c
gst/rtp/gstrtph263ppay.c

@@@ -697,72 -712,62 +725,71 @@@ gst_flac_parse_check_valid_frame (GstBa
  
      GST_DEBUG_OBJECT (flacparse, "Found metadata block of size %u", size);
      *framesize = size;
 -    return TRUE;
 -  } else {
 -    if ((GST_READ_UINT16_BE (data) & 0xfffe) == 0xfff8) {
 -      gboolean ret;
 -      guint next;
 +    goto cleanup;
 +  }
  
 -      flacparse->offset = GST_BUFFER_OFFSET (buffer);
 -      flacparse->blocking_strategy = 0;
 -      flacparse->sample_number = 0;
 -
 -      GST_DEBUG_OBJECT (flacparse, "Found sync code");
 -      ret = gst_flac_parse_frame_is_valid (flacparse, frame, &next);
 -      if (ret) {
 -        *framesize = next;
 -        return TRUE;
 -      } else {
 -        /* If we're at EOS and the frame was not valid, drop it! */
 -        if (G_UNLIKELY (GST_BASE_PARSE_DRAINING (flacparse))) {
 -          GST_WARNING_OBJECT (flacparse, "EOS");
 -          return FALSE;
 -        }
 +  if ((GST_READ_UINT16_BE (data) & 0xfffe) == 0xfff8) {
 +    gboolean ret;
 +    guint next;
  
 -        if (next == 0) {
 -        } else if (next > GST_BUFFER_SIZE (buffer)) {
 -          GST_DEBUG_OBJECT (flacparse, "Requesting %u bytes", next);
 -          *skipsize = 0;
 -          gst_base_parse_set_min_frame_size (parse, next);
 -          return FALSE;
 -        } else {
 -          GST_ERROR_OBJECT (flacparse,
 -              "Giving up on invalid frame (%d bytes)",
 -              GST_BUFFER_SIZE (buffer));
 -          return FALSE;
 -        }
 -      }
 -    } else {
 -      GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buffer);
 -      gint off;
 +    flacparse->offset = GST_BUFFER_OFFSET (buffer);
 +    flacparse->blocking_strategy = 0;
-     flacparse->block_size = 0;
 +    flacparse->sample_number = 0;
  
 -      off =
 -          gst_byte_reader_masked_scan_uint32 (&reader, 0xfffc0000, 0xfff80000,
 -          0, GST_BUFFER_SIZE (buffer));
 +    GST_DEBUG_OBJECT (flacparse, "Found sync code");
 +    ret = gst_flac_parse_frame_is_valid (flacparse, frame, &next);
 +    if (ret) {
 +      *framesize = next;
 +      goto cleanup;
 +    } else {
 +      /* If we're at EOS and the frame was not valid, drop it! */
 +      if (G_UNLIKELY (GST_BASE_PARSE_DRAINING (flacparse))) {
 +        GST_WARNING_OBJECT (flacparse, "EOS");
 +        result = FALSE;
 +        goto cleanup;
 +      }
  
 -      if (off > 0) {
 -        GST_DEBUG_OBJECT (parse, "Possible sync at buffer offset %d", off);
 -        *skipsize = off;
 -        return FALSE;
 +      if (next == 0) {
 +      } else if (next > bufsize) {
 +        GST_DEBUG_OBJECT (flacparse, "Requesting %u bytes", next);
 +        *skipsize = 0;
 +        gst_base_parse_set_min_frame_size (parse, next);
 +        result = FALSE;
 +        goto cleanup;
        } else {
 -        GST_DEBUG_OBJECT (flacparse, "Sync code not found");
 -        *skipsize = GST_BUFFER_SIZE (buffer) - 3;
 -        return FALSE;
 +        GST_ERROR_OBJECT (flacparse,
 +            "Giving up on invalid frame (%d bytes)", bufsize);
 +        result = FALSE;
 +        goto cleanup;
        }
      }
 +  } else {
 +    GstByteReader reader;
 +    gint off;
 +
 +    gst_byte_reader_init (&reader, data, bufsize);
 +    off =
 +        gst_byte_reader_masked_scan_uint32 (&reader, 0xfffc0000, 0xfff80000,
 +        0, bufsize);
 +
 +    if (off > 0) {
 +      GST_DEBUG_OBJECT (parse, "Possible sync at buffer offset %d", off);
 +      *skipsize = off;
 +      result = FALSE;
 +      goto cleanup;
 +    } else {
 +      GST_DEBUG_OBJECT (flacparse, "Sync code not found");
 +      *skipsize = bufsize - 3;
 +      result = FALSE;
 +      goto cleanup;
 +    }
    }
  
 -  return FALSE;
 +  result = FALSE;
 +
 +cleanup:
 +  gst_buffer_unmap (buffer, data, bufsize);
 +  return result;
  }
  
  static gboolean
@@@ -1404,16 -1361,9 +1431,15 @@@ gst_flac_parse_parse_frame (GstBasePars
  
      flacparse->offset = -1;
      flacparse->blocking_strategy = 0;
-     flacparse->block_size = 0;
      flacparse->sample_number = 0;
 -    return GST_FLOW_OK;
 +    res = GST_FLOW_OK;
    }
 +
 +cleanup:
 +  if (data)
 +    gst_buffer_unmap (buffer, data, bufsize);
 +
 +  return res;
  }
  
  static GstFlowReturn
Simple merge
Simple merge
@@@ -8868,8 -8875,13 +8876,13 @@@ qtdemux_parse_tree (GstQTDemux * qtdemu
  
    /* set duration in the segment info */
    gst_qtdemux_get_duration (qtdemux, &duration);
-   if (duration)
+   if (duration) {
 -    gst_segment_set_duration (&qtdemux->segment, GST_FORMAT_TIME, duration);
 +    qtdemux->segment.duration = duration;
+     /* also do not exceed duration; stop is set that way post seek anyway,
+      * and segment activation falls back to duration,
+      * whereas loop only checks stop, so let's align this here as well */
+     qtdemux->segment.stop = duration;
+   }
  
    /* parse all traks */
    trak = qtdemux_tree_get_child_by_type (qtdemux->moov_node, FOURCC_trak);
Simple merge