Lines Matching refs:args
59 static u32 vidtv_pes_write_header_stuffing(struct pes_header_write_args *args) in vidtv_pes_write_header_stuffing() argument
67 if (args->n_pes_h_s_bytes > PES_HEADER_MAX_STUFFING_BYTES) { in vidtv_pes_write_header_stuffing()
70 args->n_pes_h_s_bytes = PES_HEADER_MAX_STUFFING_BYTES; in vidtv_pes_write_header_stuffing()
73 return vidtv_memset(args->dest_buf, in vidtv_pes_write_header_stuffing()
74 args->dest_offset, in vidtv_pes_write_header_stuffing()
75 args->dest_buf_sz, in vidtv_pes_write_header_stuffing()
77 args->n_pes_h_s_bytes); in vidtv_pes_write_header_stuffing()
80 static u32 vidtv_pes_write_pts_dts(struct pes_header_write_args *args) in vidtv_pes_write_pts_dts() argument
92 if (!args->send_pts && args->send_dts) in vidtv_pes_write_pts_dts()
100 if (args->send_pts && args->send_dts) { in vidtv_pes_write_pts_dts()
101 pts_dts.pts1 = (0x3 << 4) | ((args->pts & mask1) >> 29) | 0x1; in vidtv_pes_write_pts_dts()
102 pts_dts.pts2 = cpu_to_be16(((args->pts & mask2) >> 14) | 0x1); in vidtv_pes_write_pts_dts()
103 pts_dts.pts3 = cpu_to_be16(((args->pts & mask3) << 1) | 0x1); in vidtv_pes_write_pts_dts()
105 pts_dts.dts1 = (0x1 << 4) | ((args->dts & mask1) >> 29) | 0x1; in vidtv_pes_write_pts_dts()
106 pts_dts.dts2 = cpu_to_be16(((args->dts & mask2) >> 14) | 0x1); in vidtv_pes_write_pts_dts()
107 pts_dts.dts3 = cpu_to_be16(((args->dts & mask3) << 1) | 0x1); in vidtv_pes_write_pts_dts()
112 } else if (args->send_pts) { in vidtv_pes_write_pts_dts()
113 pts.pts1 = (0x1 << 5) | ((args->pts & mask1) >> 29) | 0x1; in vidtv_pes_write_pts_dts()
114 pts.pts2 = cpu_to_be16(((args->pts & mask2) >> 14) | 0x1); in vidtv_pes_write_pts_dts()
115 pts.pts3 = cpu_to_be16(((args->pts & mask3) << 1) | 0x1); in vidtv_pes_write_pts_dts()
122 nbytes += vidtv_memcpy(args->dest_buf, in vidtv_pes_write_pts_dts()
123 args->dest_offset + nbytes, in vidtv_pes_write_pts_dts()
124 args->dest_buf_sz, in vidtv_pes_write_pts_dts()
131 static u32 vidtv_pes_write_h(struct pes_header_write_args *args) in vidtv_pes_write_h() argument
138 u32 stream_id = (args->encoder_id == S302M) ? PRIVATE_STREAM_1_ID : args->stream_id; in vidtv_pes_write_h()
143 pes_header.length = cpu_to_be16(vidtv_pes_op_get_len(args->send_pts, in vidtv_pes_write_h()
144 args->send_dts) + in vidtv_pes_write_h()
145 args->access_unit_len); in vidtv_pes_write_h()
147 if (args->send_pts && args->send_dts) in vidtv_pes_write_h()
149 else if (args->send_pts) in vidtv_pes_write_h()
153 pes_optional.length = vidtv_pes_op_get_len(args->send_pts, args->send_dts) + in vidtv_pes_write_h()
154 args->n_pes_h_s_bytes - in vidtv_pes_write_h()
158 nbytes += vidtv_memcpy(args->dest_buf, in vidtv_pes_write_h()
159 args->dest_offset + nbytes, in vidtv_pes_write_h()
160 args->dest_buf_sz, in vidtv_pes_write_h()
165 nbytes += vidtv_memcpy(args->dest_buf, in vidtv_pes_write_h()
166 args->dest_offset + nbytes, in vidtv_pes_write_h()
167 args->dest_buf_sz, in vidtv_pes_write_h()
172 pts_dts_args = *args; in vidtv_pes_write_h()
173 pts_dts_args.dest_offset = args->dest_offset + nbytes; in vidtv_pes_write_h()
177 nbytes += vidtv_pes_write_header_stuffing(args); in vidtv_pes_write_h()
206 static u32 vidtv_pes_write_stuffing(struct pes_ts_header_write_args *args, in vidtv_pes_write_stuffing() argument
214 if (!args->n_stuffing_bytes) in vidtv_pes_write_stuffing()
226 stuff_nbytes = args->n_stuffing_bytes - ts_adap.length; in vidtv_pes_write_stuffing()
236 nbytes += vidtv_memcpy(args->dest_buf, in vidtv_pes_write_stuffing()
238 args->dest_buf_sz, in vidtv_pes_write_stuffing()
244 nbytes += vidtv_pes_write_pcr_bits(args->dest_buf, in vidtv_pes_write_stuffing()
246 args->pcr); in vidtv_pes_write_stuffing()
248 *last_pcr = args->pcr; in vidtv_pes_write_stuffing()
253 nbytes += vidtv_memset(args->dest_buf, in vidtv_pes_write_stuffing()
255 args->dest_buf_sz, in vidtv_pes_write_stuffing()
264 if (nbytes != args->n_stuffing_bytes) in vidtv_pes_write_stuffing()
266 nbytes, args->n_stuffing_bytes); in vidtv_pes_write_stuffing()
271 static u32 vidtv_pes_write_ts_h(struct pes_ts_header_write_args args, in vidtv_pes_write_ts_h() argument
277 u16 payload_start = !args.wrote_pes_header; in vidtv_pes_write_ts_h()
280 ts_header.bitfield = cpu_to_be16((payload_start << 14) | args.pid); in vidtv_pes_write_ts_h()
282 ts_header.adaptation_field = (args.n_stuffing_bytes) > 0; in vidtv_pes_write_ts_h()
283 ts_header.payload = (args.n_stuffing_bytes) < PES_TS_HEADER_MAX_STUFFING_BYTES; in vidtv_pes_write_ts_h()
285 ts_header.continuity_counter = *args.continuity_counter; in vidtv_pes_write_ts_h()
287 vidtv_ts_inc_cc(args.continuity_counter); in vidtv_pes_write_ts_h()
290 nbytes += vidtv_memcpy(args.dest_buf, in vidtv_pes_write_ts_h()
291 args.dest_offset + nbytes, in vidtv_pes_write_ts_h()
292 args.dest_buf_sz, in vidtv_pes_write_ts_h()
297 nbytes += vidtv_pes_write_stuffing(&args, args.dest_offset + nbytes, in vidtv_pes_write_ts_h()
303 u32 vidtv_pes_write_into(struct pes_write_args *args) in vidtv_pes_write_into() argument
305 u32 unaligned_bytes = (args->dest_offset % TS_PACKET_LEN); in vidtv_pes_write_into()
307 .dest_buf = args->dest_buf, in vidtv_pes_write_into()
308 .dest_buf_sz = args->dest_buf_sz, in vidtv_pes_write_into()
309 .pid = args->pid, in vidtv_pes_write_into()
310 .pcr = args->pcr, in vidtv_pes_write_into()
311 .continuity_counter = args->continuity_counter, in vidtv_pes_write_into()
314 .dest_buf = args->dest_buf, in vidtv_pes_write_into()
315 .dest_buf_sz = args->dest_buf_sz, in vidtv_pes_write_into()
316 .encoder_id = args->encoder_id, in vidtv_pes_write_into()
317 .send_pts = args->send_pts, in vidtv_pes_write_into()
318 .pts = args->pts, in vidtv_pes_write_into()
319 .send_dts = args->send_dts, in vidtv_pes_write_into()
320 .dts = args->dts, in vidtv_pes_write_into()
321 .stream_id = args->stream_id, in vidtv_pes_write_into()
322 .n_pes_h_s_bytes = args->n_pes_h_s_bytes, in vidtv_pes_write_into()
323 .access_unit_len = args->access_unit_len, in vidtv_pes_write_into()
325 u32 remaining_len = args->access_unit_len; in vidtv_pes_write_into()
327 u64 last_pcr = args->pcr; in vidtv_pes_write_into()
338 nbytes += vidtv_memset(args->dest_buf, in vidtv_pes_write_into()
339 args->dest_offset + nbytes, in vidtv_pes_write_into()
340 args->dest_buf_sz, in vidtv_pes_write_into()
353 available_space -= vidtv_pes_h_get_len(args->send_pts, in vidtv_pes_write_into()
354 args->send_dts); in vidtv_pes_write_into()
360 available_space -= args->n_pes_h_s_bytes; in vidtv_pes_write_into()
395 ts_header_args.dest_offset = args->dest_offset + nbytes; in vidtv_pes_write_into()
406 pes_header_args.dest_offset = args->dest_offset + in vidtv_pes_write_into()
413 nbytes += vidtv_memcpy(args->dest_buf, in vidtv_pes_write_into()
414 args->dest_offset + nbytes, in vidtv_pes_write_into()
415 args->dest_buf_sz, in vidtv_pes_write_into()
416 args->from, in vidtv_pes_write_into()
419 args->from += payload_size; in vidtv_pes_write_into()