当前位置: 首页>>代码示例>>C++>>正文


C++ GST_READ_UINT32_BE函数代码示例

本文整理汇总了C++中GST_READ_UINT32_BE函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_READ_UINT32_BE函数的具体用法?C++ GST_READ_UINT32_BE怎么用?C++ GST_READ_UINT32_BE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GST_READ_UINT32_BE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: image_description_from_codec_data

ImageDescription *
image_description_from_codec_data (GstBuffer * buf, guint32 codectype)
{
  ImageDescription *desc = NULL;

  GST_LOG ("codectype:%" GST_FOURCC_FORMAT " buf:%p",
      GST_FOURCC_ARGS (codectype), buf);

  if ((GST_BUFFER_SIZE (buf) == GST_READ_UINT32_BE (GST_BUFFER_DATA (buf))) &&
      (QT_MAKE_FOURCC_LE ('s', 't', 's',
              'd') == GST_READ_UINT32_BE (GST_BUFFER_DATA (buf) + 4))) {
    /* We have the full stsd (ImageDescription) in our codec_data */
    desc = image_description_from_stsd_buffer (buf);
  } else {
    switch (codectype) {
      case QT_MAKE_FOURCC_LE ('m', 'p', '4', 'v'):
        desc = image_description_for_mp4v (buf);
        break;
      case QT_MAKE_FOURCC_LE ('a', 'v', 'c', '1'):
        desc = image_description_for_avc1 (buf);
        break;
      default:
        GST_WARNING ("Format not handled !");
    }
  }
  return desc;
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:27,代码来源:imagedescription.c

示例2: write_one

static gboolean
write_one (GstPluginLoader * l)
{
  guint8 *out;
  guint32 to_write, magic;
  int res;

  if (l->tx_buf_read + HEADER_SIZE > l->tx_buf_write)
    return FALSE;

  out = l->tx_buf + l->tx_buf_read;

  magic = GST_READ_UINT32_BE (out + 8);
  if (magic != HEADER_MAGIC) {
    GST_ERROR ("Packet magic number is missing. Memory corruption detected");
    goto fail_and_cleanup;
  }

  to_write = GST_READ_UINT32_BE (out + 4) + HEADER_SIZE;
  /* Check that the magic is intact, and the size is sensible */
  if (to_write > l->tx_buf_size) {
    GST_ERROR ("Indicated packet size is too large. Corruption detected");
    goto fail_and_cleanup;
  }

  l->tx_buf_read += to_write;

  GST_LOG ("Writing packet of size %d bytes to fd %d", to_write, l->fd_w.fd);

  do {
    res = write (l->fd_w.fd, out, to_write);
    if (G_UNLIKELY (res < 0)) {
      if (errno == EAGAIN || errno == EINTR)
        continue;
      /* Failed to write -> child died */
      goto fail_and_cleanup;
    }
    to_write -= res;
    out += res;
  } while (to_write > 0);

  if (l->tx_buf_read == l->tx_buf_write) {
    gst_poll_fd_ctl_write (l->fdset, &l->fd_w, FALSE);
    l->tx_buf_read = l->tx_buf_write = 0;
  }

  return TRUE;

fail_and_cleanup:
  plugin_loader_cleanup_child (l);
  return FALSE;
}
开发者ID:AlerIl,项目名称:gstreamer0.10,代码行数:52,代码来源:gstpluginloader.c

示例3: create_overlay_buffer

static GstBuffer *
create_overlay_buffer (void)
{
  GZlibDecompressor *decompress;
  GConverterResult decomp_res;
  guchar *gzipped_pixdata, *pixdata;
  gsize gzipped_size, bytes_read, pixdata_size;
  GstBuffer *logo_pixels;
  guint w, h, stride;

  gzipped_pixdata = g_base64_decode (gzipped_pixdata_base64, &gzipped_size);
  g_assert (gzipped_pixdata != NULL);

  pixdata = g_malloc (64 * 1024);

  decompress = g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP);
  decomp_res = g_converter_convert (G_CONVERTER (decompress),
      gzipped_pixdata, gzipped_size, pixdata, 64 * 1024,
      G_CONVERTER_INPUT_AT_END, &bytes_read, &pixdata_size, NULL);
  g_assert (decomp_res == G_CONVERTER_FINISHED);
  g_assert (bytes_read == gzipped_size);
  g_free (gzipped_pixdata);
  g_object_unref (decompress);

  /* 0: Pixbuf magic (0x47646b50) */
  g_assert (GST_READ_UINT32_BE (pixdata) == 0x47646b50);

  /* 4: length incl. header */
  /* 8: pixdata_type */
  /* 12: rowstride (900) */
  stride = GST_READ_UINT32_BE (pixdata + 12);
  /* 16: width (225) */
  w = GST_READ_UINT32_BE (pixdata + 16);
  /* 20: height (57) */
  h = GST_READ_UINT32_BE (pixdata + 20);
  /* 24: pixel_data */
  GST_LOG ("%dx%d @ %d", w, h, stride);
  /* we assume that the last line also has padding at the end */
  g_assert (pixdata_size - 24 >= h * stride);

  logo_pixels = gst_buffer_new_and_alloc (h * stride);
  gst_buffer_fill (logo_pixels, 0, pixdata + 24, h * stride);
  gst_buffer_add_video_meta (logo_pixels, GST_VIDEO_FRAME_FLAG_NONE,
      GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, w, h);

  g_free (pixdata);

  return logo_pixels;
}
开发者ID:ConfusedReality,项目名称:pkg_multimedia_gst-plugins-base,代码行数:49,代码来源:test-overlay-blending.c

示例4: image_description_from_stsd_buffer

static ImageDescription *
image_description_from_stsd_buffer (GstBuffer * buf)
{
  ImageDescription *desc = NULL;
  guint8 *content;
  guint size;
  gint imds;

  GST_LOG ("buffer %p, size:%u", buf, GST_BUFFER_SIZE (buf));

  /* The buffer contains a full atom, we only need the contents */
  /* This buffer has data in big-endian, we need to read it as such.
   * except for the fourcc which are ALWAYS big-endian. */
  content = GST_BUFFER_DATA (buf) + 16;
  size = GST_BUFFER_SIZE (buf) - 16;

#if DEBUG_DUMP
  GST_LOG ("incoming data in big-endian");
  gst_util_dump_mem (content, size);
#endif

  desc = g_malloc0 (size);
  desc->idSize = size;
  desc->cType = GST_READ_UINT32_BE (content + 4);
  desc->version = QT_UINT16 (content + 16);
  desc->revisionLevel = QT_UINT16 (content + 18);
  desc->vendor = GST_READ_UINT32_BE (content + 20);
  desc->temporalQuality = QT_UINT32 (content + 24);
  desc->spatialQuality = QT_UINT32 (content + 24);
  desc->dataSize = QT_UINT32 (content + 44);
  desc->frameCount = QT_UINT16 (content + 48);
  desc->depth = QT_UINT16 (content + 82);
  desc->clutID = QT_UINT16 (content + 84);

  imds = 86;                    /* sizeof (ImageDescription); */

  if (desc->idSize > imds) {
    GST_LOG ("Copying %d bytes from %p to %p",
        size - imds, content + imds, desc + imds);
    memcpy ((guint8 *) desc + imds, (guint8 *) content + imds, size - imds);
  }
#if DEBUG_DUMP
  GST_LOG ("outgoing data in machine-endian");
  dump_image_description (desc);
#endif

  return desc;
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:48,代码来源:imagedescription.c

示例5: moov_recov_parse_tkhd

static gboolean
moov_recov_parse_tkhd (MoovRecovFile * moovrf, TrakRecovData * trakrd)
{
  guint32 size;
  guint32 fourcc;
  guint8 data[4];

  /* make sure we are on a tkhd atom */
  if (!read_atom_header (moovrf->file, &fourcc, &size))
    return FALSE;
  if (fourcc != FOURCC_tkhd)
    return FALSE;

  trakrd->tkhd_file_offset = ftell (moovrf->file) - 8;

  /* move 8 bytes forward to the trak_id pos */
  if (fseek (moovrf->file, 12, SEEK_CUR) != 0)
    return FALSE;
  if (fread (data, 1, 4, moovrf->file) != 4)
    return FALSE;

  /* advance the rest of tkhd */
  fseek (moovrf->file, 68, SEEK_CUR);

  trakrd->trak_id = GST_READ_UINT32_BE (data);
  return TRUE;
}
开发者ID:Acidburn0zzz,项目名称:gstreamer-libde265,代码行数:27,代码来源:atomsrecovery.c

示例6: moov_recov_parse_mdhd

static gboolean
moov_recov_parse_mdhd (MoovRecovFile * moovrf, TrakRecovData * trakrd)
{
  guint32 size;
  guint32 fourcc;
  guint8 data[4];

  /* make sure we are on a tkhd atom */
  if (!read_atom_header (moovrf->file, &fourcc, &size))
    return FALSE;
  if (fourcc != FOURCC_mdhd)
    return FALSE;

  trakrd->mdhd_file_offset = ftell (moovrf->file) - 8;

  /* get the timescale */
  if (fseek (moovrf->file, 12, SEEK_CUR) != 0)
    return FALSE;
  if (fread (data, 1, 4, moovrf->file) != 4)
    return FALSE;
  trakrd->timescale = GST_READ_UINT32_BE (data);
  if (fseek (moovrf->file, 8, SEEK_CUR) != 0)
    return FALSE;
  return TRUE;
}
开发者ID:Acidburn0zzz,项目名称:gstreamer-libde265,代码行数:25,代码来源:atomsrecovery.c

示例7: parse_exif_tag_header

static gboolean
parse_exif_tag_header (GstByteReader * reader, gint byte_order,
    GstExifTagData * _tagdata)
{
  g_assert (_tagdata);

  /* read the fields */
  if (byte_order == G_LITTLE_ENDIAN) {
    if (!gst_byte_reader_get_uint16_le (reader, &_tagdata->tag) ||
        !gst_byte_reader_get_uint16_le (reader, &_tagdata->tag_type) ||
        !gst_byte_reader_get_uint32_le (reader, &_tagdata->count) ||
        !gst_byte_reader_get_data (reader, 4, &_tagdata->offset_as_data)) {
      return FALSE;
    }
    _tagdata->offset = GST_READ_UINT32_LE (_tagdata->offset_as_data);
  } else {
    if (!gst_byte_reader_get_uint16_be (reader, &_tagdata->tag) ||
        !gst_byte_reader_get_uint16_be (reader, &_tagdata->tag_type) ||
        !gst_byte_reader_get_uint32_be (reader, &_tagdata->count) ||
        !gst_byte_reader_get_data (reader, 4, &_tagdata->offset_as_data)) {
      return FALSE;
    }
    _tagdata->offset = GST_READ_UINT32_BE (_tagdata->offset_as_data);
  }

  return TRUE;
}
开发者ID:genesi,项目名称:gst-base-plugins,代码行数:27,代码来源:gstexiftag.c

示例8: verify_buffer_packetized

static gboolean
verify_buffer_packetized (buffer_verify_data_s * vdata, GstBuffer * buffer)
{
  GstMapInfo map;

  gst_buffer_map (buffer, &map, GST_MAP_READ);

  fail_unless (map.size > 4);
  fail_unless (GST_READ_UINT32_BE (map.data) == 0x01);
  if (vdata->discard) {
    /* check separate header NALs */
    guint8 *data;
    gint size;

    if (vdata->buffer_counter == 0) {
      data = h264_sps;
      size = sizeof (h264_sps);
    } else {
      data = h264_pps;
      size = sizeof (h264_pps);
    }

    fail_unless (map.size == size);
    fail_unless (memcmp (map.data + 4, data + 4, size - 4) == 0);
  } else {
    fail_unless (map.size == vdata->data_to_verify_size);
    fail_unless (memcmp (map.data + 4,
            vdata->data_to_verify + 4, map.size - 4) == 0);
  }
  gst_buffer_unmap (buffer, &map);

  return TRUE;
}
开发者ID:Lachann,项目名称:gst-plugins-bad,代码行数:33,代码来源:h264parse.c

示例9: gst_rdt_packet_data_get_timestamp

guint32
gst_rdt_packet_data_get_timestamp (GstRDTPacket * packet)
{
  guint header;
  gboolean length_included_flag;
  guint8 *bufdata;

  g_return_val_if_fail (packet != NULL, 0);
  g_return_val_if_fail (GST_RDT_IS_DATA_TYPE (packet->type), 0);

  bufdata = GST_BUFFER_DATA (packet->buffer);

  header = packet->offset;

  length_included_flag = (bufdata[header] & 0x80) == 0x80;

  /* skip seq_no and header bits */
  header += 3;

  if (length_included_flag) {
    /* skip length */
    header += 2;
  }
  /* skip asm_rule_number */
  header += 1;

  /* get timestamp */
  return GST_READ_UINT32_BE (&bufdata[header]);
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:29,代码来源:gstrdtbuffer.c

示例10: verify_buffer_packetized

static gboolean
verify_buffer_packetized (buffer_verify_data_s * vdata, GstBuffer * buffer)
{
  fail_unless (GST_BUFFER_SIZE (buffer) > 4);
  fail_unless (GST_READ_UINT32_BE (GST_BUFFER_DATA (buffer)) == 0x01);
  if (vdata->discard) {
    /* check separate header NALs */
    guint8 *data;
    gint size;

    if (vdata->buffer_counter == 0) {
      data = h264_sps;
      size = sizeof (h264_sps);
    } else {
      data = h264_pps;
      size = sizeof (h264_pps);
    }

    fail_unless (GST_BUFFER_SIZE (buffer) == size);
    fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 4, data + 4,
            size - 4) == 0);
  } else {
    fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size);
    fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 4,
            vdata->data_to_verify + 4, GST_BUFFER_SIZE (buffer) - 4) == 0);
  }

  return TRUE;
}
开发者ID:dylansong77,项目名称:gstreamer,代码行数:29,代码来源:h264parse.c

示例11: flv_script_data_read_string

static gboolean
flv_script_data_read_string(FlvScriptDataReader* reader, gchar** dest, gboolean longString)
{
    gsize length;

    /* Read length of string */
    if ((reader->position + (longString ? 4 : 2)) > reader->end)
        return FALSE;
    if (longString) {
        length = GST_READ_UINT32_BE(reader->position);
        reader->position += 4;
    } else {
        length = GST_READ_UINT16_BE(reader->position);
        reader->position += 2;
    }

    /* Alloc buffer and copy string into it */
    if ((reader->position + length) > reader->end)
        return FALSE;

    if (length >= G_MAXSIZE - 1)
        return FALSE;

    *dest = g_malloc(length + 1);
    if (*dest == NULL)
        return FALSE;
    memcpy(*dest, reader->position, length);
    (*dest)[length] = 0;
    reader->position += length;

    return TRUE;
}
开发者ID:166MMX,项目名称:openjdk.java.net-openjfx-8u40-rt,代码行数:32,代码来源:flvmetadata.c

示例12: check_protocol_version

static gboolean
check_protocol_version (GstPluginLoader * l, guint8 * payload,
    guint payload_len)
{
  guint32 got_version;
  guint8 *binary_reg_ver;

  if (payload_len < sizeof (guint32) + GST_MAGIC_BINARY_VERSION_LEN)
    return FALSE;

  got_version = GST_READ_UINT32_BE (payload);
  GST_LOG ("Got VERSION %u from child. Ours is %u", got_version,
      loader_protocol_version);
  if (got_version != loader_protocol_version)
    return FALSE;

  binary_reg_ver = payload + sizeof (guint32);
  if (strcmp ((gchar *) binary_reg_ver, GST_MAGIC_BINARY_VERSION_STR)) {
    GST_LOG ("Binary chunk format of child is different. Ours: %s, child %s\n",
        GST_MAGIC_BINARY_VERSION_STR, binary_reg_ver);
    return FALSE;
  }

  return TRUE;
};
开发者ID:AlerIl,项目名称:gstreamer0.10,代码行数:25,代码来源:gstpluginloader.c

示例13: mxf_fraction_parse

gboolean
mxf_fraction_parse (MXFFraction * fraction, const guint8 * data, guint size)
{
  g_return_val_if_fail (fraction != NULL, FALSE);
  g_return_val_if_fail (data != NULL, FALSE);

  memset (fraction, 0, sizeof (MXFFraction));

  if (size < 8)
    return FALSE;

  fraction->n = GST_READ_UINT32_BE (data);
  fraction->d = GST_READ_UINT32_BE (data + 4);

  return TRUE;
}
开发者ID:prajnashi,项目名称:gst-plugins-bad,代码行数:16,代码来源:mxfparse.c

示例14: gst_rdt_packet_data_get_timestamp

guint32
gst_rdt_packet_data_get_timestamp (GstRDTPacket * packet)
{
  GstMapInfo map;
  guint header;
  gboolean length_included_flag;
  guint32 result;

  g_return_val_if_fail (packet != NULL, 0);
  g_return_val_if_fail (GST_RDT_IS_DATA_TYPE (packet->type), 0);

  gst_buffer_map (packet->buffer, &map, GST_MAP_READ);

  header = packet->offset;

  length_included_flag = (map.data[header] & 0x80) == 0x80;

  /* skip seq_no and header bits */
  header += 3;

  if (length_included_flag) {
    /* skip length */
    header += 2;
  }
  /* skip asm_rule_number */
  header += 1;

  /* get timestamp */
  result = GST_READ_UINT32_BE (&map.data[header]);
  gst_buffer_unmap (packet->buffer, &map);

  return result;
}
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:33,代码来源:gstrdtbuffer.c

示例15: gst_omx_h264_enc_handle_output_frame

static GstFlowReturn
gst_omx_h264_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port,
    GstOMXBuffer * buf, GstVideoFrame * frame)
{
  if (buf->omx_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
    /* The codec data is SPS/PPS with a startcode => bytestream stream format
     * For bytestream stream format the SPS/PPS is only in-stream and not
     * in the caps!
     */
    if (buf->omx_buf->nFilledLen >= 4 &&
        GST_READ_UINT32_BE (buf->omx_buf->pBuffer +
            buf->omx_buf->nOffset) == 0x00000001) {
      GstBuffer *hdrs;

      GST_DEBUG_OBJECT (self, "got codecconfig in byte-stream format");
      buf->omx_buf->nFlags &= ~OMX_BUFFERFLAG_CODECCONFIG;

      hdrs = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen);
      memcpy (GST_BUFFER_DATA (hdrs),
          buf->omx_buf->pBuffer + buf->omx_buf->nOffset,
          buf->omx_buf->nFilledLen);
      gst_base_video_encoder_set_headers (GST_BASE_VIDEO_ENCODER (self), hdrs);
      gst_buffer_unref (hdrs);
    }
  }

  return GST_OMX_VIDEO_ENC_CLASS (parent_class)->handle_output_frame (self,
      port, buf, frame);
}
开发者ID:beidl,项目名称:gst-omx,代码行数:29,代码来源:gstomxh264enc.c


注:本文中的GST_READ_UINT32_BE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。