@@ -149,6 +149,9 @@ struct upipe_h265f {
149149 /** active picture parameter set, or -1 */
150150 int active_pps ;
151151
152+ /** alternative transfer characteristics */
153+ int preferred_transfer_characteristics ;
154+
152155 /* parsing results - headers */
153156 /** VPS profile space */
154157 uint8_t profile_space ;
@@ -348,6 +351,8 @@ static struct upipe *upipe_h265f_alloc(struct upipe_mgr *mgr,
348351 upipe_h265f -> pps [i ] = NULL ;
349352 upipe_h265f -> active_pps = -1 ;
350353
354+ upipe_h265f -> preferred_transfer_characteristics = 2 ;
355+
351356 upipe_h265f -> acquired = false;
352357 upipe_throw_ready (upipe );
353358 return upipe ;
@@ -1281,6 +1286,10 @@ static bool upipe_h265f_activate_sps(struct upipe *upipe, uint32_t sps_id)
12811286 else if (unlikely (!ubase_check (err )))
12821287 upipe_throw_fatal (upipe , err );
12831288
1289+ if (transfer_characteristics != upipe_h265f -> preferred_transfer_characteristics )
1290+ transfer_characteristics = upipe_h265f -> preferred_transfer_characteristics ;
1291+ upipe_h265f -> preferred_transfer_characteristics = 2 ;
1292+
12841293 err = uref_pic_flow_set_transfer_characteristics_val (
12851294 flow_def , transfer_characteristics );
12861295 if (unlikely (err == UBASE_ERR_UNHANDLED ))
@@ -1514,6 +1523,24 @@ static int upipe_h265f_handle_sei_buffering_period(struct upipe *upipe,
15141523 return UBASE_ERR_NONE ;
15151524}
15161525
1526+ /** @internal @This handles the supplemental enhancement information called
1527+ * alternative transfer characteristics.
1528+ *
1529+ * @param upipe description structure of the pipe
1530+ * @param s block stream parsing structure
1531+ * @return an error code
1532+ */
1533+ static int upipe_h265f_handle_sei_alternative_transfer_characteristics (struct upipe * upipe ,
1534+ struct ubuf_block_stream * s )
1535+ {
1536+ struct upipe_h265f * upipe_h265f = upipe_h265f_from_upipe (upipe );
1537+
1538+ upipe_h26xf_stream_fill_bits (s , 8 );
1539+ upipe_h265f -> preferred_transfer_characteristics = ubuf_block_stream_show_bits (s , 8 );
1540+
1541+ return UBASE_ERR_NONE ;
1542+ }
1543+
15171544/** @internal @This handles the supplemental enhancement information called
15181545 * picture timing.
15191546 *
@@ -1559,6 +1586,7 @@ static int upipe_h265f_handle_sei(struct upipe *upipe, struct ubuf *ubuf,
15591586
15601587 switch (type ) {
15611588 case H265SEI_BUFFERING_PERIOD :
1589+ case H265SEI_ALTERNATIVE_TRANSFER_CHARACTERISTICS :
15621590 case H265SEI_PIC_TIMING : {
15631591 struct upipe_h26xf_stream f ;
15641592 upipe_h26xf_stream_init (& f );
@@ -1580,6 +1608,9 @@ static int upipe_h265f_handle_sei(struct upipe *upipe, struct ubuf *ubuf,
15801608 case H265SEI_PIC_TIMING :
15811609 err = upipe_h265f_handle_sei_pic_timing (upipe , s );
15821610 break ;
1611+ case H265SEI_ALTERNATIVE_TRANSFER_CHARACTERISTICS :
1612+ err = upipe_h265f_handle_sei_alternative_transfer_characteristics (upipe , s );
1613+ break ;
15831614 default :
15841615 break ;
15851616 }
0 commit comments