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


C++ GST_READ_UINT16_BE函数代码示例

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


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

示例1: gst_mpegts_descriptor_parse_logical_channel

/**
 * gst_mpegts_descriptor_parse_logical_channel:
 * @descriptor: a %GST_MTS_DESC_DTG_LOGICAL_CHANNEL #GstMpegtsDescriptor
 * @res: (out) (transfer none): the #GstMpegtsLogicalChannelDescriptor to fill
 *
 * Extracts the logical channels from @descriptor.
 *
 * Returns: %TRUE if parsing succeeded, else %FALSE.
 */
gboolean
gst_mpegts_descriptor_parse_logical_channel (const GstMpegtsDescriptor *
    descriptor, GstMpegtsLogicalChannelDescriptor * res)
{
  guint i;
  guint8 *data;

  g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE);
  /* This descriptor loop can be empty, no size check required */
  __common_desc_check_base (descriptor, GST_MTS_DESC_DTG_LOGICAL_CHANNEL,
      FALSE);

  data = (guint8 *) descriptor->data + 2;

  res->nb_channels = descriptor->length / 4;

  for (i = 0; i < res->nb_channels; i++) {
    res->channels[i].service_id = GST_READ_UINT16_BE (data);
    data += 2;
    res->channels[i].visible_service = *data >> 7;
    res->channels[i].logical_channel_number =
        GST_READ_UINT16_BE (data) & 0x03ff;
    data += 2;
  }

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

示例2: gst_rtp_buffer_get_extension_data

/**
 * gst_rtp_buffer_get_extension_data:
 * @buffer: the buffer
 * @bits: location for result bits
 * @data: location for data
 * @wordlen: location for length of @data in 32 bits words
 *
 * Get the extension data. @bits will contain the extension 16 bits of custom
 * data. @data will point to the data in the extension and @wordlen will contain
 * the length of @data in 32 bits words.
 *
 * If @buffer did not contain an extension, this function will return %FALSE
 * with @bits, @data and @wordlen unchanged.
 * 
 * Returns: TRUE if @buffer had the extension bit set.
 *
 * Since: 0.10.15
 */
gboolean
gst_rtp_buffer_get_extension_data (GstBuffer * buffer, guint16 * bits,
    gpointer * data, guint * wordlen)
{
  guint len;
  guint8 *pdata;

  pdata = GST_BUFFER_DATA (buffer);

  if (!GST_RTP_HEADER_EXTENSION (pdata))
    return FALSE;

  /* move to the extension */
  len = GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (pdata);
  pdata += len;

  if (bits)
    *bits = GST_READ_UINT16_BE (pdata);
  if (wordlen)
    *wordlen = GST_READ_UINT16_BE (pdata + 2);
  if (data)
    *data = pdata + 4;

  return TRUE;
}
开发者ID:zsx,项目名称:ossbuild,代码行数:43,代码来源:gstrtpbuffer.c

示例3: mxf_product_version_parse

gboolean
mxf_product_version_parse (MXFProductVersion * product_version,
    const guint8 * data, guint size)
{
  g_return_val_if_fail (product_version != NULL, FALSE);
  g_return_val_if_fail (data != NULL, FALSE);

  memset (product_version, 0, sizeof (MXFProductVersion));

  if (size < 9)
    return FALSE;

  product_version->major = GST_READ_UINT16_BE (data);
  product_version->minor = GST_READ_UINT16_BE (data + 2);
  product_version->patch = GST_READ_UINT16_BE (data + 4);
  product_version->build = GST_READ_UINT16_BE (data + 6);

  /* Avid writes a 9 byte product version */
  if (size == 9)
    product_version->release = GST_READ_UINT8 (data + 8);
  else
    product_version->release = GST_READ_UINT16_BE (data + 8);

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

示例4: gst_mpegts_descriptor_parse_ca

gboolean
gst_mpegts_descriptor_parse_ca (GstMpegtsDescriptor * descriptor,
    guint16 * ca_system_id, guint16 * ca_pid,
    const guint8 ** private_data, gsize * private_data_size)
{
  guint8 *data;

  g_return_val_if_fail (descriptor != NULL && ca_system_id != NULL
      && ca_pid != NULL, FALSE);
  /* The smallest CA is 4 bytes (though not having any private data
   * sounds a bit ... weird) */
  __common_desc_checks (descriptor, GST_MTS_DESC_CA, 4, FALSE);

  data = (guint8 *) descriptor->data + 2;
  *ca_system_id = GST_READ_UINT16_BE (data);
  data += 2;
  *ca_pid = GST_READ_UINT16_BE (data) & 0x1fff;
  data += 2;
  if (private_data && private_data_size) {
    *private_data = data;
    *private_data_size = descriptor->length - 4;
  }

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

示例5: rtp_jpeg_do_packet_loss

static void
rtp_jpeg_do_packet_loss (gdouble prob, gint num_expected)
{
  GstHarness *h;
  gboolean eos = FALSE;
  gchar *s;
  guint i, buffer_count;

  s = g_strdup_printf ("videotestsrc pattern=ball num-buffers=100 ! "
      "jpegenc quality=50 ! rtpjpegpay ! identity drop-probability=%g ! "
      "rtpjpegdepay", prob);
  GST_INFO ("running pipeline %s", s);
  h = gst_harness_new_parse (s);
  g_free (s);

  gst_harness_play (h);

  do {
    GstEvent *event;

    event = gst_harness_pull_event (h);
    eos = (GST_EVENT_TYPE (event) == GST_EVENT_EOS);
    gst_event_unref (event);
  } while (!eos);

  buffer_count = gst_harness_buffers_received (h);
  GST_INFO ("Got %u buffers", buffer_count);

  if (num_expected >= 0) {
    fail_unless_equals_int (num_expected, buffer_count);
  }

  for (i = 0; i < buffer_count; ++i) {
    GstBuffer *buf;
    GstMapInfo map;
    guint16 soi, eoi;

    buf = gst_harness_pull (h);
    fail_unless (buf != NULL);

    fail_unless (gst_buffer_map (buf, &map, GST_MAP_READ));
    GST_MEMDUMP ("jpeg frame", map.data, map.size);
    fail_unless (map.size > 4);
    soi = GST_READ_UINT16_BE (map.data);
    fail_unless (soi == 0xffd8, "expected JPEG frame start FFD8 not %02X", soi);
    eoi = GST_READ_UINT16_BE (map.data + map.size - 2);
    fail_unless (eoi == 0xffd9, "expected JPEG frame end FFD9 not %02X", eoi);
    gst_buffer_unmap (buf, &map);
    gst_buffer_unref (buf);
  }

  gst_harness_teardown (h);
}
开发者ID:Dhruv-Mohan,项目名称:gst-plugins-good,代码行数:53,代码来源:rtp-payloading.c

示例6: parse_MThd

static gboolean
parse_MThd (GstMidiParse * midiparse, guint8 * data, guint size)
{
  guint16 format, ntracks, division;
  gboolean multitrack;

  format = GST_READ_UINT16_BE (data);
  switch (format) {
    case 0:
      multitrack = FALSE;
      break;
    case 1:
      multitrack = TRUE;
      break;
    default:
    case 2:
      goto invalid_format;
  }
  ntracks = GST_READ_UINT16_BE (data + 2);
  if (ntracks > 1 && !multitrack)
    goto invalid_tracks;

  division = GST_READ_UINT16_BE (data + 4);
  if (division & 0x8000)
    goto invalid_division;

  GST_DEBUG_OBJECT (midiparse, "format %u, tracks %u, division %u",
      format, ntracks, division);

  midiparse->ntracks = ntracks;
  midiparse->division = division;

  return TRUE;

invalid_format:
  {
    GST_ERROR_OBJECT (midiparse, "unsupported midi format %u", format);
    return FALSE;
  }
invalid_tracks:
  {
    GST_ERROR_OBJECT (midiparse, "invalid number of tracks %u for format %u",
        ntracks, format);
    return FALSE;
  }
invalid_division:
  {
    GST_ERROR_OBJECT (midiparse, "unsupported division");
    return FALSE;
  }
}
开发者ID:cbetz421,项目名称:gst-plugins-bad,代码行数:51,代码来源:midiparse.c

示例7: gst_rdt_packet_data_get_stream_id

guint16
gst_rdt_packet_data_get_stream_id (GstRDTPacket * packet)
{
  guint16 result;
  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;
  result = (bufdata[header] & 0x3e) >> 1;
  if (result == 31) {
    /* skip seq_no and header bits */
    header += 3;

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

    /* stream_id_expansion */
    result = GST_READ_UINT16_BE (&bufdata[header]);
  }
  return result;
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:33,代码来源:gstrdtbuffer.c

示例8: 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

示例9: check_rtp_buffer

static void
check_rtp_buffer (GstClockTime ts, GstClockTime duration, gboolean start,
    gboolean end, guint rtpts, guint ssrc, guint volume, guint number,
    guint rtpduration)
{
  GstBuffer *buffer;
  GstRTPBuffer rtpbuffer = GST_RTP_BUFFER_INIT;
  gchar *payload;

  g_mutex_lock (&check_mutex);
  while (buffers == NULL)
    g_cond_wait (&check_cond, &check_mutex);
  g_mutex_unlock (&check_mutex);
  fail_unless (buffers != NULL);

  buffer = buffers->data;
  buffers = g_list_delete_link (buffers, buffers);

  fail_unless (GST_BUFFER_PTS (buffer) == ts);
  fail_unless (GST_BUFFER_DURATION (buffer) == duration);

  fail_unless (gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtpbuffer));
  fail_unless (gst_rtp_buffer_get_marker (&rtpbuffer) == start);
  fail_unless (gst_rtp_buffer_get_timestamp (&rtpbuffer) == rtpts);
  payload = gst_rtp_buffer_get_payload (&rtpbuffer);

  fail_unless (payload[0] == number);
  fail_unless ((payload[1] & 0x7F) == volume);
  fail_unless (! !(payload[1] & 0x80) == end);
  fail_unless (GST_READ_UINT16_BE (payload + 2) == rtpduration);

  gst_rtp_buffer_unmap (&rtpbuffer);
  gst_buffer_unref (buffer);
}
开发者ID:Lachann,项目名称:gst-plugins-good,代码行数:34,代码来源:dtmf.c

示例10: deserialize_orientation

static gint
deserialize_orientation (GstExifReader * exif_reader,
    GstByteReader * reader, const GstExifTagMatch * exiftag,
    GstExifTagData * tagdata)
{
  gint ret = 1;
  const gchar *str = NULL;
  gint value;

  GST_LOG ("Starting to parse %s tag in exif 0x%x", exiftag->gst_tag,
      exiftag->exif_tag);

  /* validate tag */
  if (tagdata->tag_type != EXIF_TYPE_SHORT || tagdata->count != 1) {
    GST_WARNING ("Orientation tag has unexpected type/count");
    return ret;
  }

  if (exif_reader->byte_order == G_LITTLE_ENDIAN) {
    value = GST_READ_UINT16_LE (tagdata->offset_as_data);
  } else {
    value = GST_READ_UINT16_BE (tagdata->offset_as_data);
  }

  str = gst_tag_image_orientation_from_exif_value (value);
  if (str == NULL) {
    GST_WARNING ("Invalid value for exif orientation tag: %d", value);
    return ret;
  }
  gst_tag_list_add (exif_reader->taglist, GST_TAG_MERGE_REPLACE,
      exiftag->gst_tag, str, NULL);

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

示例11: gst_irtsp_parse_check_valid_frame

static gboolean
gst_irtsp_parse_check_valid_frame (GstBaseParse * parse,
    GstBaseParseFrame * frame, guint * framesize, gint * skipsize)
{
  GstIRTSPParse *IRTSPParse = GST_IRTSP_PARSE (parse);
  GstBuffer *buf = frame->buffer;
  GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buf);
  gint off;

  if (G_UNLIKELY (GST_BUFFER_SIZE (buf) < 4))
    return FALSE;

  off = gst_byte_reader_masked_scan_uint32 (&reader, 0xffff0000,
      0x24000000 + (IRTSPParse->channel_id << 16), 0, GST_BUFFER_SIZE (buf));

  GST_LOG_OBJECT (parse, "possible sync at buffer offset %d", off);

  /* didn't find anything that looks like a sync word, skip */
  if (off < 0) {
    *skipsize = GST_BUFFER_SIZE (buf) - 3;
    return FALSE;
  }

  /* possible frame header, but not at offset 0? skip bytes before sync */
  if (off > 0) {
    *skipsize = off;
    return FALSE;
  }

  *framesize = GST_READ_UINT16_BE (GST_BUFFER_DATA (frame->buffer) + 2) + 4;
  GST_LOG_OBJECT (parse, "got frame size %d", *framesize);

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

示例12: id3demux_read_id3v2_tag

/* caller must pass buffer with full ID3 tag */
ID3TagsResult
id3demux_read_id3v2_tag (GstBuffer * buffer, guint * id3v2_size,
    GstTagList ** tags)
{
  guint8 *data, *uu_data = NULL;
  guint read_size;
  ID3TagsWorking work;
  guint8 flags;
  ID3TagsResult result;
  guint16 version;

  read_size = id3demux_calc_id3v2_tag_size (buffer);

  if (id3v2_size)
    *id3v2_size = read_size;

  /* Ignore tag if it has no frames attached, but skip the header then */
  if (read_size <= ID3V2_HDR_SIZE)
    return ID3TAGS_BROKEN_TAG;

  data = GST_BUFFER_DATA (buffer);

  /* Read the version */
  version = GST_READ_UINT16_BE (data + 3);

  /* Read the flags */
  flags = data[5];

  /* Validate the version. At the moment, we only support up to 2.4.0 */
  if (ID3V2_VER_MAJOR (version) > 4 || ID3V2_VER_MINOR (version) > 0) {
    GST_WARNING ("ID3v2 tag is from revision 2.%d.%d, "
        "but decoder only supports 2.%d.%d. Ignoring as per spec.",
        version >> 8, version & 0xff, ID3V2_VERSION >> 8, ID3V2_VERSION & 0xff);
    return ID3TAGS_READ_TAG;
  }
开发者ID:spunktsch,项目名称:svtplayer,代码行数:36,代码来源:id3tags.c

示例13: test_mpeg_audio_parse_handle_frame

static GstFlowReturn
test_mpeg_audio_parse_handle_frame (GstBaseParse * parse,
    GstBaseParseFrame * frame, gint * skipsize)
{
  guint8 data[2];

  gst_buffer_extract (frame->buffer, 0, data, 2);

  if ((GST_READ_UINT16_BE (data) & 0xffe0) == 0xffe0) {
    if (GST_BUFFER_OFFSET (frame->buffer) == 0) {
      GstCaps *caps;

      caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1,
          "mpegaudioversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3,
          "rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 2, NULL);
      gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps);
      gst_caps_unref (caps);
    }

    /* this framesize is hard-coded for ../test.mp3 */
    return gst_base_parse_finish_frame (parse, frame, 1045);
  } else {
    *skipsize = 1;
    return GST_FLOW_OK;
  }
}
开发者ID:thaytan,项目名称:gst-plugins-base,代码行数:26,代码来源:decodebin.c

示例14: _parse_u16

static int
_parse_u16 (AmfParser * parser)
{
  int x;
  x = GST_READ_UINT16_BE (parser->data + parser->offset);
  parser->offset += 2;
  return x;
}
开发者ID:dschleef,项目名称:gst-rtmp,代码行数:8,代码来源:amf.c

示例15: gst_audio_format_fill_silence

/**
 * gst_audio_format_fill_silence:
 * @info: a #GstAudioFormatInfo
 * @dest: (array length=length) (element-type guint8): a destination
 *   to fill
 * @length: the length to fill
 *
 * Fill @length bytes in @dest with silence samples for @info.
 */
void
gst_audio_format_fill_silence (const GstAudioFormatInfo * info,
    gpointer dest, gsize length)
{
  guint8 *dptr = dest;

  g_return_if_fail (info != NULL);
  g_return_if_fail (dest != NULL);

  if (info->flags & GST_AUDIO_FORMAT_FLAG_FLOAT ||
      info->flags & GST_AUDIO_FORMAT_FLAG_SIGNED) {
    /* float or signed always 0 */
    orc_memset (dest, 0, length);
  } else {
    gint i, j, bps = info->width >> 3;

    switch (bps) {
      case 1:
        orc_memset (dest, info->silence[0], length);
        break;
      case 2:{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
        guint16 silence = GST_READ_UINT16_LE (info->silence);
#else
        guint16 silence = GST_READ_UINT16_BE (info->silence);
#endif
        audio_orc_splat_u16 (dest, silence, length / bps);
        break;
      }
      case 4:{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
        guint32 silence = GST_READ_UINT32_LE (info->silence);
#else
        guint32 silence = GST_READ_UINT32_BE (info->silence);
#endif
        audio_orc_splat_u32 (dest, silence, length / bps);
        break;
      }
      case 8:{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
        guint64 silence = GST_READ_UINT64_LE (info->silence);
#else
        guint64 silence = GST_READ_UINT64_BE (info->silence);
#endif
        audio_orc_splat_u64 (dest, silence, length / bps);
        break;
      }
      default:
        for (i = 0; i < length; i += bps) {
          for (j = 0; j < bps; j++)
            *dptr++ = info->silence[j];
        }
        break;
    }
  }
}
开发者ID:hyperlobic,项目名称:gst-plugins-base,代码行数:65,代码来源:audio-format.c


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