Commit aeb5eea9 authored by François Cartegnie's avatar François Cartegnie 🤞

codec: cc: always create header bits on byte 0

parent c319ad49
......@@ -28,6 +28,8 @@
#define BLOCK_FLAG_ORDERED_CAPTIONS (0x01 << BLOCK_FLAG_PRIVATE_SHIFT)
#define CC_PKT_BYTE0(field) (0xFC | (0x03 & field))
/* CC have a maximum rate of 9600 bit/s (per field?) */
#define CC_MAX_DATA_SIZE (2 * 3*600)
enum
......@@ -235,7 +237,7 @@ static inline void cc_Extract( cc_data_t *c, bool b_top_field_first, const uint8
if( c->i_data + 3 > CC_MAX_DATA_SIZE )
continue;
cc_AppendData( c, i_field, &cc[1] );
cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[1] );
}
}
c->b_reorder = false;
......@@ -251,7 +253,7 @@ static inline void cc_Extract( cc_data_t *c, bool b_top_field_first, const uint8
{
const int i_field = i == 0 ? 1 : 0;
cc_AppendData( c, i_field, &cc[2] );
cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[2] );
}
c->b_reorder = false;
}
......@@ -284,7 +286,7 @@ static inline void cc_Extract( cc_data_t *c, bool b_top_field_first, const uint8
if (!b_top_field_first)
i_field ^= 1;
cc_AppendData( c, i_field, &cc[0] );
cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[0] );
}
c->b_reorder = true;
}
......
......@@ -368,7 +368,7 @@ static block_t * MP4_EIA608_Convert( block_t * p_block )
do
{
p_write[i_copied++] = 0; /* cc1 == field 0 */
p_write[i_copied++] = CC_PKT_BYTE0(0); /* cc1 == field 0 */
p_write[i_copied++] = p_read[0];
p_write[i_copied++] = p_read[1];
p_read += 2;
......@@ -387,7 +387,7 @@ static block_t * MP4_EIA608_Convert( block_t * p_block )
i_remaining -= 8;
do
{
p_write[i_copied++] = 0; /* cc1 == field 0 */
p_write[i_copied++] = CC_PKT_BYTE0(0); /* cc1 == field 0 */
p_write[i_copied++] = p_read[0];
p_write[i_copied++] = p_read[1];
p_read += 2;
......
......@@ -1042,7 +1042,7 @@ static int DemuxRecCc( demux_t *p_demux, ty_rec_hdr_t *rec_hdr, block_t *p_block
if( p_sys->cc.i_data + 3 > CC_MAX_DATA_SIZE )
return 0;
cc_AppendData( &p_sys->cc, i_field, rec_hdr->ex );
cc_AppendData( &p_sys->cc, CC_PKT_BYTE0(i_field), rec_hdr->ex );
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment