Lines Matching refs:data
172 /* user data */
191 /* data needed to handle file based ts */
194 /** packet containing Audio/Video data */
210 /* private mpegts data */
456 static void mpegts_drm_get_sync_header_index(uint8_t *data, uint32_t data_size, uint32_t *pos_index)
460 if ((data[i] != g_video_frame_arr[DRM_ARR_SUBSCRIPT_ZERO]) ||
461 (data[i + DRM_ARR_SUBSCRIPT_ONE] != g_video_frame_arr[DRM_ARR_SUBSCRIPT_ONE]) ||
462 (data[i + DRM_ARR_SUBSCRIPT_TWO] != g_video_frame_arr[DRM_ARR_SUBSCRIPT_TWO])) {
472 static int mpegts_drm_find_avs_cei_nal_unit(uint8_t *data, uint32_t data_size, uint32_t *cei_start_pos,
478 * data[i + DRM_LEGACY_LEN] is the nal unit header(00~b8),
481 if (((data[i + DRM_LEGACY_LEN] > 0) && (data[i + DRM_LEGACY_LEN] < 0xb8)) &&
482 (data[i + DRM_LEGACY_LEN] != 0xb0) && (data[i + DRM_LEGACY_LEN] != 0xb5) &&
483 (data[i + DRM_LEGACY_LEN] != 0xb1)) {
487 if ((data[i + DRM_LEGACY_LEN] == 0xb5) && (i + DRM_LEGACY_LEN + 1 < data_size)) {
488 /* extension_and_user_data found, 0xd0: extension user data tag, 0xf0: the higher 4 bits */
489 if ((data[i + DRM_LEGACY_LEN + 1] & 0xf0) == 0xd0) {
493 av_log(NULL, AV_LOG_ERROR, "cei not found, type=0x%x\n", (data[i + DRM_LEGACY_LEN + 1] & 0xf0));
499 static int mpegts_drm_find_hevc_cei_nal_unit(uint8_t *data, uint32_t data_size, uint32_t *cei_start_pos,
503 uint8_t nal_type = (data[i + DRM_LEGACY_LEN] >> DRM_SHIFT_LEFT_NUM) & DRM_H265_VIDEO_NAL_TYPE_UMASK_NUM;
506 /* sei is not after frame data. */
510 if (data[i + DRM_H265_PAYLOAD_TYPE_OFFSET] == DRM_USER_DATA_UNREGISTERED_TAG) {
518 mpegts_drm_get_sync_header_index(data, data_size, &end_pos);
520 if (memcmp(data + start_pos, g_user_registered_uuid,
531 static int mpegts_drm_find_h264_cei_nal_unit(uint8_t *data, uint32_t data_size, uint32_t *cei_start_pos,
535 uint8_t nal_type = data[i + DRM_LEGACY_LEN] & DRM_H264_VIDEO_NAL_TYPE_UMASK_NUM;
538 /* sei is not after frame data. */
543 (data[i + DRM_LEGACY_LEN + 1] == DRM_USER_DATA_UNREGISTERED_TAG)) {
551 mpegts_drm_get_sync_header_index(data, data_size, &end_pos);
553 if (memcmp(data + start_pos, g_user_registered_uuid,
564 static int mpegts_drm_find_cei_nal_unit(enum AVCodecID codec_id, uint8_t *data, uint32_t data_size,
569 ret = mpegts_drm_find_avs_cei_nal_unit(data, data_size, cei_start_pos, index);
571 ret = mpegts_drm_find_hevc_cei_nal_unit(data, data_size, cei_start_pos, index);
573 ret = mpegts_drm_find_h264_cei_nal_unit(data, data_size, cei_start_pos, index);
578 static int mpegts_drm_find_cei_pos(enum AVCodecID codec_id, uint8_t *data, uint32_t data_size,
584 if ((data[i] == g_video_frame_arr[DRM_ARR_SUBSCRIPT_ZERO]) &&
585 (data[i + DRM_ARR_SUBSCRIPT_ONE] == g_video_frame_arr[DRM_ARR_SUBSCRIPT_ONE]) &&
586 (data[i + DRM_ARR_SUBSCRIPT_TWO] == g_video_frame_arr[DRM_ARR_SUBSCRIPT_TWO])) {
593 if (!mpegts_drm_find_cei_nal_unit(codec_id, data, data_size, &start_pos, i)) {
610 static void mpegts_drm_remove_ambiguity_bytes(uint8_t *data, uint32_t *data_size, uint32_t offset)
615 if ((data[i] == g_ambiguity_arr[DRM_ARR_SUBSCRIPT_ZERO]) &&
616 (data[i + DRM_ARR_SUBSCRIPT_ONE] == g_ambiguity_arr[DRM_ARR_SUBSCRIPT_ONE]) &&
617 (data[i + DRM_ARR_SUBSCRIPT_TWO] == g_ambiguity_arr[DRM_ARR_SUBSCRIPT_TWO])) {
618 if (data[i + DRM_ARR_SUBSCRIPT_THREE] >= DRM_AMBIGUITY_START_NUM &&
619 data[i + DRM_ARR_SUBSCRIPT_THREE] <= DRM_AMBIGUITY_END_NUM) {
620 memmove(data + i + DRM_ARR_SUBSCRIPT_TWO, data + i + DRM_ARR_SUBSCRIPT_THREE,
631 static int mpegts_drm_get_key_id(uint8_t *data, uint32_t *data_size, uint32_t *pos, uint8_t *drm_descriptor_flag,
636 av_log(NULL, AV_LOG_ERROR, "cei data too short\n");
639 uint8_t encryption_flag = (data[offset] & 0x80) >> 7; // 0x80 get encryption_flag & 7 get bits
640 uint8_t next_key_id_flag = (data[offset] & 0x40) >> 6; // 0x40 get next_key_id_flag & 6 get bits
641 *drm_descriptor_flag = (data[offset] & 0x20) >> 5; // 0x20 get drm_descriptor_flag & 5 get bits
643 mpegts_drm_remove_ambiguity_bytes(data, data_size, offset);
647 av_log(NULL, AV_LOG_ERROR, "cei data too short\n");
650 memcpy(cenc_info->key_id, data + offset, AV_DRM_KEY_ID_SIZE);
663 static int mpegts_drm_get_iv(uint8_t *data, uint32_t data_size, uint32_t *pos, AV_DrmCencInfo *cenc_info)
667 av_log(NULL, AV_LOG_ERROR, "cei data too short\n");
670 uint32_t iv_len = (uint32_t)(data[offset]);
673 av_log(NULL, AV_LOG_ERROR, "cei data too short\n");
676 memcpy(cenc_info->iv, data + offset, iv_len);
684 static int mpegts_drm_parse_drm_descriptor(AVStream *avstream, uint8_t *data, uint32_t data_size, uint32_t *pos,
695 av_log(NULL, AV_LOG_ERROR, "cei data too short\n");
698 drm_descriptor_len = (uint32_t)(data[offset + 1]); // 1 drm descriptor len offset
700 av_log(NULL, AV_LOG_ERROR, "drm descriptor data too short\n");
704 ret = mpegts_get_drm_info(data + offset + DRM_MIN_DRM_INFO_LEN, drm_descriptor_len, &drm_info);
714 static int mpegts_drm_set_key_info(AVStream *avstream, uint8_t *data, uint32_t data_size, uint32_t cei_start_pos,
724 av_log(NULL, AV_LOG_ERROR, "malloc cei data failed\n");
727 memcpy(cei_buf, data, data_size);
730 av_log(NULL, AV_LOG_ERROR, "cei data too short\n");
806 static int mpegts_drm_get_cenc_info(AVStream *avstream, enum AVCodecID codec_id, uint8_t *data, uint32_t data_size,
826 ret = mpegts_drm_find_cei_pos(codec_id, data, data_size, &cei_start_pos, &cei_end_pos);
828 (void)mpegts_drm_set_key_info(avstream, data, cei_end_pos, cei_start_pos, cenc_info);
836 if (pkt == NULL || pkt->data == NULL || pkt->size == 0) {
860 int ret = mpegts_drm_get_cenc_info(s->streams[pkt->stream_index], codec_id, pkt->data, pkt->size, &cenc_info);
1161 /* referenced private data will be freed later in
1600 pkt->data = (uint8_t *)buffer;
1611 pkt->data = pes->buffer->data;
1620 memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
1879 /* Skip PES private data, program packet sequence counter and P-STD buffer */
1987 // pes packet size is < ts size packet and pes data is padded with 0xff
1998 memcpy(pes->buffer->data + pes->data_index, p, buf_size);
2525 /* 8 bytes per DVB subtitle substream data:
2748 case 0xfd: /* ARIB data coding type descriptor */
3574 const uint8_t **data)
3580 len = ffio_read_indirect(pb, buf, TS_PACKET_SIZE, data);
3584 if ((*data)[0] != 0x47) {
3587 if (mpegts_resync(s, raw_packet_size, *data) < 0)
3610 const uint8_t *data;
3647 ret = read_packet(s, packet, ts->raw_packet_size, &data);
3650 ret = handle_packet(ts, data, avio_tell(s->pb));
3781 const uint8_t *data;
3797 ret = read_packet(s, packet, ts->raw_packet_size, &data);
3800 pid = AV_RB16(data + 1) & 0x1fff;
3802 parse_pcr(&pcr_h, &pcr_l, data) == 0) {
3847 const uint8_t *data;
3851 ret = read_packet(s, pkt->data, ts->raw_packet_size, &data);
3856 if (data != pkt->data)
3857 memcpy(pkt->data, data, TS_PACKET_SIZE);
3861 if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) {
3897 /* flush pes data left */