Commit 51cc5d44 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Massive renaming of functions in preparation of release.

The function arguments and its order have changed during cleaning up.
This breaks the old API and a rename of functions was needed to properly
mark the older API as deprecated.
parent 0c2c5155
...@@ -4,23 +4,23 @@ ...@@ -4,23 +4,23 @@
needed some cleanup. The following issue are addressed in this version:</p> needed some cleanup. The following issue are addressed in this version:</p>
<ul> <ul>
<li>explicit library handle allocation with <em>dvbpsi_NewHandle()</em> (delete with <em>dvbpsi_DeleteHandle()</em>)</li> <li>explicit library handle allocation with <em>dvbpsi_new()</em> (delete with <em>dvbpsi_delete()</em>)</li>
<li>consistent API for table and descriptor decoder/encoders</li> <li>consistent API for table and descriptor decoder/encoders</li>
<li>message callback function for easier intergrating libdvbpsi logging in applications</li> <li>message callback function for easier intergrating libdvbpsi logging in applications</li>
</ul> </ul>
<p>The biggest change is the addition off an explicit dvbpsi_t pointer to <p>The biggest change is the addition off an explicit dvbpsi_t pointer to
ALL table decoder and encoder API's. This dvbpsi_t pointer is a dvbpsi handle ALL table decoder and encoder API's. This dvbpsi_t pointer is a dvbpsi handle
which must be allocated using <em>dvbpsi_NewHandle()</em> and takes a callback function which must be allocated using <em>dvbpsi_new()</em> and takes a callback function
for logging. The handle must be deleted with <em>dvbpsi_DeleteHandle()</em> if it is no for logging. The handle must be deleted with <em>dvbpsi_delete()</em> if it is no
longer needed. longer needed.
</p> </p>
<code>dvbpsi_t *dvbpsi_NewHandle(dvbpsi_message_cb callback, enum dvbpsi_msg_level level);</code> <code>dvbpsi_t *dvbpsi_new(dvbpsi_message_cb callback, enum dvbpsi_msg_level level);</code>
<p>The dvbpsi_t pointer must be released by calling <em>dvbpsi_DeleteHandle()</em></p> <p>The dvbpsi_t pointer must be released by calling <em>dvbpsi_delete()</em></p>
<code>void dvbpsi_DeleteHandle(dvbpsi_t *handle);</code> <code>void dvbpsi_delete(dvbpsi_t *handle);</code>
<h2>Example</h2> <h2>Example</h2>
...@@ -41,12 +41,12 @@ and especially to the file examples/dvbinfo/libdvbpsi.c from the dvbinfo applica ...@@ -41,12 +41,12 @@ and especially to the file examples/dvbinfo/libdvbpsi.c from the dvbinfo applica
<p>The same scheme is used for other PSI tables too, this translate to the following code sequence:</p> <p>The same scheme is used for other PSI tables too, this translate to the following code sequence:</p>
<code> <code>
&nbsp; dvbpsi_t *handle = dvbpsi_NewHandle(&dvbpsi_message, DVBPSI_MSG_DEBUG); <br /> &nbsp; dvbpsi_t *handle = dvbpsi_new(&dvbpsi_message, DVBPSI_MSG_DEBUG); <br />
&nbsp; if (handle == NULL) <br /> &nbsp; if (handle == NULL) <br />
&nbsp;&nbsp; goto error; <br /> &nbsp;&nbsp; goto error; <br />
&nbsp; if (!dvbpsi_AttachPAT(handle, handle_PAT, data)) <br /> &nbsp; if (!dvbpsi_pat_attach(handle, handle_PAT, data)) <br />
&nbsp; { <br /> &nbsp; { <br />
&nbsp; &nbsp; dvbpsi_DeleteHandle(handle); <br /> &nbsp; &nbsp; dvbpsi_delete(handle); <br />
&nbsp; &nbsp; handle = NULL; <br /> &nbsp; &nbsp; handle = NULL; <br />
&nbsp; &nbsp; goto error; <br /> &nbsp; &nbsp; goto error; <br />
&nbsp; } <br /> &nbsp; } <br />
...@@ -54,10 +54,10 @@ and especially to the file examples/dvbinfo/libdvbpsi.c from the dvbinfo applica ...@@ -54,10 +54,10 @@ and especially to the file examples/dvbinfo/libdvbpsi.c from the dvbinfo applica
&nbsp; return 0; <br /> &nbsp; return 0; <br />
&nbsp; <br /> &nbsp; <br />
error: <br /> error: <br />
&nbsp; if (dvbpsi_HasDecoder(handle)) <br /> &nbsp; if (dvbpsi_decoder_present(handle)) <br />
&nbsp; &nbsp; dvbpsi_DetachPAT(andle); <br /> &nbsp; &nbsp; dvbpsi_pat_detach(handle); <br />
&nbsp; if (handle) <br /> &nbsp; if (handle) <br />
&nbsp; &nbsp; dvbpsi_DeleteHandle(handle); <br /> &nbsp; &nbsp; dvbpsi_delete(handle); <br />
&nbsp; return -1; <br /> &nbsp; return -1; <br />
</code> </code>
......
/*! \page usage API usage /*! \page usage API usage
<p>Each application requires a handle to the dvbpsi library. The function <p>Each application requires a handle to the dvbpsi library. The function
dvbpsi_NewHandle(&message_cb, DVBPSI_MSG_DEBUG) will return a handle. All dvbpsi_new(&message_cb, DVBPSI_MSG_DEBUG) will return a handle. All
error, warning or debug messages will trigger the <em>message_cb</em> function. error, warning or debug messages will trigger the <em>message_cb</em> function.
Unless DVBPSI_MSG_NONE is passed to dvbpsi_NewHandle(). For each <em> Unless DVBPSI_MSG_NONE is passed to dvbpsi_new(). For each <em>
dvbpsi_AttachXXX()</em> function a unique dvbpsi handle must be used.</p> dvbpsi_XXX_attach()</em> function a unique dvbpsi handle must be used.</p>
<p>A dvbpsi handle must be passed to an <em>dvbpsi_AttachXXX()</em> function <p>A dvbpsi handle must be passed to an <em>dvbpsi_XXX_attach()</em> function
which attaches a decoder to the (dvbpsi_t*)->p_private pointer. The which attaches a decoder to the (dvbpsi_t*)->p_decoder pointer. The
<em>dvbpsi_AttachXXX()</em> function where XXX is the name of the table <em>dvbpsi_XXX_attach()</em> function where XXX is the name of the table
(ex: dvbpsi_AttachPAT()). The function returns the dvbpsi handle with the (ex: dvbpsi_pat_attach()). The function returns the dvbpsi handle with the
new decoder attached decoder.</p> new decoder attached decoder.</p>
<p>Then the application has to send the TS packets needed by the decoder <p>Then the application has to send the TS packets needed by the decoder
by calling the dvbpsi_PushPacket() function. If a new table is complete by calling the dvbpsi_packet_push() function. If a new table is complete
then the decoder calls the callback specified by the application when it then the decoder calls the callback specified by the application when it
called <em>dvbpsi_AttachXXX()</em>.</p> called <em>dvbpsi_XXX_attach()</em>.</p>
<p>When the application don't need the decoder anymore it just has to <p>When the application don't need the decoder anymore it just has to
call the <em>dvbpsi_DetachXXX()</em> function (ex: call the <em>dvbpsi_XXX_detach()</em> function (ex:
dvbpsi_DetachPAT()). The dvbpsi handle must be released by calling dvbpsi_pat_detach()). The dvbpsi handle must be released by calling
dvbpsi_DeleteHandle(). At the time of calling the decoder must already dvbpsi_delete(). At the time of calling the decoder must already
have been detached.</p> have been detached.</p>
<p>Look at the header files for specific table, see the list below:</p> <p>Look at the header files for specific table, see the list below:</p>
......
...@@ -191,7 +191,7 @@ static void DumpBAT(void* p_zero, dvbpsi_bat_t* p_bat) ...@@ -191,7 +191,7 @@ static void DumpBAT(void* p_zero, dvbpsi_bat_t* p_bat)
DumpBAT_verbose(p_zero,p_bat); DumpBAT_verbose(p_zero,p_bat);
printf("\n"); printf("\n");
} }
dvbpsi_DeleteBAT(p_bat); dvbpsi_bat_delete(p_bat);
} }
...@@ -203,7 +203,7 @@ static void NewSubtableBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -203,7 +203,7 @@ static void NewSubtableBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
{ {
if(i_table_id == 0x4a) if(i_table_id == 0x4a)
{ {
if (!dvbpsi_AttachBAT(p_dvbpsi, i_table_id, i_extension, DumpBAT, NULL)) if (!dvbpsi_bat_attach(p_dvbpsi, i_table_id, i_extension, DumpBAT, NULL))
fprintf(stderr, "failed to attach BAT subdecoder\n"); fprintf(stderr, "failed to attach BAT subdecoder\n");
} }
} }
...@@ -238,7 +238,7 @@ int main(int i_argc, char* pa_argv[]) ...@@ -238,7 +238,7 @@ int main(int i_argc, char* pa_argv[])
if (i_fd < 0) if (i_fd < 0)
return 1; return 1;
p_dvbpsi = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); p_dvbpsi = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_dvbpsi == NULL) if (p_dvbpsi == NULL)
goto out; goto out;
if (!dvbpsi_AttachDemux(p_dvbpsi, NewSubtableBAT, NULL)) if (!dvbpsi_AttachDemux(p_dvbpsi, NewSubtableBAT, NULL))
...@@ -250,7 +250,7 @@ int main(int i_argc, char* pa_argv[]) ...@@ -250,7 +250,7 @@ int main(int i_argc, char* pa_argv[])
{ {
uint16_t i_pid = ((uint16_t)(data[1] & 0x1f) << 8) + data[2]; uint16_t i_pid = ((uint16_t)(data[1] & 0x1f) << 8) + data[2];
if(i_pid == 0x11) if(i_pid == 0x11)
dvbpsi_PushPacket(p_dvbpsi, data); dvbpsi_packet_push(p_dvbpsi, data);
b_ok = ReadPacket(i_fd, data); b_ok = ReadPacket(i_fd, data);
} }
...@@ -258,7 +258,7 @@ out: ...@@ -258,7 +258,7 @@ out:
if (p_dvbpsi) if (p_dvbpsi)
{ {
dvbpsi_DetachDemux(p_dvbpsi); dvbpsi_DetachDemux(p_dvbpsi);
dvbpsi_DeleteHandle(p_dvbpsi); dvbpsi_delete(p_dvbpsi);
} }
close(i_fd); close(i_fd);
return 0; return 0;
......
...@@ -317,8 +317,8 @@ static void DumpPAT(void* p_data, dvbpsi_pat_t* p_pat) ...@@ -317,8 +317,8 @@ static void DumpPAT(void* p_data, dvbpsi_pat_t* p_pat)
if (p_stream->pmt.handle) if (p_stream->pmt.handle)
{ {
fprintf(stderr, "freeing old PMT\n"); fprintf(stderr, "freeing old PMT\n");
dvbpsi_DetachPMT(p_stream->pmt.handle); dvbpsi_pmt_detach(p_stream->pmt.handle);
dvbpsi_DeleteHandle(p_stream->pmt.handle); dvbpsi_delete(p_stream->pmt.handle);
p_stream->pmt.handle = NULL; p_stream->pmt.handle = NULL;
} }
...@@ -334,23 +334,23 @@ static void DumpPAT(void* p_data, dvbpsi_pat_t* p_pat) ...@@ -334,23 +334,23 @@ static void DumpPAT(void* p_data, dvbpsi_pat_t* p_pat)
{ {
if (p_stream->pmt.handle) if (p_stream->pmt.handle)
{ {
dvbpsi_DetachPMT(p_stream->pmt.handle); dvbpsi_pmt_detach(p_stream->pmt.handle);
dvbpsi_DeleteHandle(p_stream->pmt.handle); dvbpsi_delete(p_stream->pmt.handle);
p_stream->pmt.handle = NULL; p_stream->pmt.handle = NULL;
} }
p_stream->i_pmt++; p_stream->i_pmt++;
p_stream->pmt.i_number = p_program->i_number; p_stream->pmt.i_number = p_program->i_number;
p_stream->pmt.pid_pmt = &p_stream->pid[p_program->i_pid]; p_stream->pmt.pid_pmt = &p_stream->pid[p_program->i_pid];
p_stream->pmt.pid_pmt->i_pid = p_program->i_pid; p_stream->pmt.pid_pmt->i_pid = p_program->i_pid;
p_stream->pmt.handle = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); p_stream->pmt.handle = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_stream->pmt.handle == NULL) if (p_stream->pmt.handle == NULL)
{ {
fprintf(stderr, "could not allocate new dvbpsi_t handle\n"); fprintf(stderr, "could not allocate new dvbpsi_t handle\n");
break; break;
} }
if (!dvbpsi_AttachPMT(p_stream->pmt.handle, p_program->i_number, DumpPMT, p_stream )) if (!dvbpsi_pmt_attach(p_stream->pmt.handle, p_program->i_number, DumpPMT, p_stream ))
{ {
dvbpsi_DeleteHandle(p_stream->pmt.handle); dvbpsi_delete(p_stream->pmt.handle);
fprintf(stderr, "could not attach PMT\n"); fprintf(stderr, "could not attach PMT\n");
break; break;
} }
...@@ -359,7 +359,7 @@ static void DumpPAT(void* p_data, dvbpsi_pat_t* p_pat) ...@@ -359,7 +359,7 @@ static void DumpPAT(void* p_data, dvbpsi_pat_t* p_pat)
p_program = p_program->p_next; p_program = p_program->p_next;
} }
fprintf( stderr, " active : %d\n", p_pat->b_current_next); fprintf( stderr, " active : %d\n", p_pat->b_current_next);
dvbpsi_DeletePAT(p_pat); dvbpsi_pat_delete(p_pat);
} }
/***************************************************************************** /*****************************************************************************
...@@ -515,7 +515,7 @@ static void DumpPMT(void* p_data, dvbpsi_pmt_t* p_pmt) ...@@ -515,7 +515,7 @@ static void DumpPMT(void* p_data, dvbpsi_pmt_t* p_pmt)
DumpDescriptors(" | ]", p_es->p_first_descriptor); DumpDescriptors(" | ]", p_es->p_first_descriptor);
p_es = p_es->p_next; p_es = p_es->p_next;
} }
dvbpsi_DeletePMT(p_pmt); dvbpsi_pmt_delete(p_pmt);
} }
/***************************************************************************** /*****************************************************************************
...@@ -681,10 +681,10 @@ int main(int i_argc, char* pa_argv[]) ...@@ -681,10 +681,10 @@ int main(int i_argc, char* pa_argv[])
report_Header( i_report ); report_Header( i_report );
#endif #endif
p_stream->pat.handle = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); p_stream->pat.handle = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_stream->pat.handle == NULL) if (p_stream->pat.handle == NULL)
goto dvbpsi_out; goto dvbpsi_out;
if (!dvbpsi_AttachPAT(p_stream->pat.handle, DumpPAT, p_stream)) if (!dvbpsi_pat_attach(p_stream->pat.handle, DumpPAT, p_stream))
goto dvbpsi_out; goto dvbpsi_out;
/* Enter infinite loop */ /* Enter infinite loop */
...@@ -723,9 +723,9 @@ int main(int i_argc, char* pa_argv[]) ...@@ -723,9 +723,9 @@ int main(int i_argc, char* pa_argv[])
continue; continue;
if( i_pid == 0x0 ) if( i_pid == 0x0 )
dvbpsi_PushPacket(p_stream->pat.handle, p_tmp); dvbpsi_packet_push(p_stream->pat.handle, p_tmp);
else if( p_stream->pmt.pid_pmt && i_pid == p_stream->pmt.pid_pmt->i_pid ) else if( p_stream->pmt.pid_pmt && i_pid == p_stream->pmt.pid_pmt->i_pid )
dvbpsi_PushPacket(p_stream->pmt.handle, p_tmp); dvbpsi_packet_push(p_stream->pmt.handle, p_tmp);
/* Remember PID */ /* Remember PID */
if( !p_stream->pid[i_pid].b_seen ) if( !p_stream->pid[i_pid].b_seen )
...@@ -818,13 +818,13 @@ int main(int i_argc, char* pa_argv[]) ...@@ -818,13 +818,13 @@ int main(int i_argc, char* pa_argv[])
} }
if( p_stream->pmt.handle ) if( p_stream->pmt.handle )
{ {
dvbpsi_DetachPMT( p_stream->pmt.handle ); dvbpsi_pmt_detach( p_stream->pmt.handle );
dvbpsi_DeleteHandle( p_stream->pmt.handle ); dvbpsi_delete( p_stream->pmt.handle );
} }
if( p_stream->pat.handle ) if( p_stream->pat.handle )
{ {
dvbpsi_DetachPAT( p_stream->pat.handle ); dvbpsi_pat_detach( p_stream->pat.handle );
dvbpsi_DeleteHandle( p_stream->pat.handle ); dvbpsi_delete( p_stream->pat.handle );
} }
/* clean up */ /* clean up */
...@@ -851,8 +851,8 @@ out_of_memory: ...@@ -851,8 +851,8 @@ out_of_memory:
dvbpsi_out: dvbpsi_out:
if( p_stream->pat.handle ) if( p_stream->pat.handle )
{ {
dvbpsi_DetachPAT( p_stream->pat.handle ); dvbpsi_pat_detach( p_stream->pat.handle );
dvbpsi_DeleteHandle( p_stream->pat.handle ); dvbpsi_delete( p_stream->pat.handle );
} }
error: error:
......
...@@ -93,7 +93,7 @@ static void DumpPAT(void* p_zero, dvbpsi_pat_t* p_pat) ...@@ -93,7 +93,7 @@ static void DumpPAT(void* p_zero, dvbpsi_pat_t* p_pat)
p_program = p_program->p_next; p_program = p_program->p_next;
} }
printf( " active : %d\n", p_pat->b_current_next); printf( " active : %d\n", p_pat->b_current_next);
dvbpsi_DeletePAT(p_pat); dvbpsi_pat_delete(p_pat);
} }
static void message(dvbpsi_t *handle, const dvbpsi_msg_level_t level, const char* msg) static void message(dvbpsi_t *handle, const dvbpsi_msg_level_t level, const char* msg)
...@@ -126,11 +126,11 @@ int main(int i_argc, char* pa_argv[]) ...@@ -126,11 +126,11 @@ int main(int i_argc, char* pa_argv[])
if (i_fd < 0) if (i_fd < 0)
return 1; return 1;
p_dvbpsi = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); p_dvbpsi = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_dvbpsi == NULL) if (p_dvbpsi == NULL)
goto out; goto out;
if (!dvbpsi_AttachPAT(p_dvbpsi, DumpPAT, NULL)) if (!dvbpsi_pat_attach(p_dvbpsi, DumpPAT, NULL))
goto out; goto out;
b_ok = ReadPacket(i_fd, data); b_ok = ReadPacket(i_fd, data);
...@@ -139,15 +139,15 @@ int main(int i_argc, char* pa_argv[]) ...@@ -139,15 +139,15 @@ int main(int i_argc, char* pa_argv[])
{ {
uint16_t i_pid = ((uint16_t)(data[1] & 0x1f) << 8) + data[2]; uint16_t i_pid = ((uint16_t)(data[1] & 0x1f) << 8) + data[2];
if(i_pid == 0x0) if(i_pid == 0x0)
dvbpsi_PushPacket(p_dvbpsi, data); dvbpsi_packet_push(p_dvbpsi, data);
b_ok = ReadPacket(i_fd, data); b_ok = ReadPacket(i_fd, data);
} }
out: out:
if (p_dvbpsi) if (p_dvbpsi)
{ {
dvbpsi_DetachPAT(p_dvbpsi); dvbpsi_pat_detach(p_dvbpsi);
dvbpsi_DeleteHandle(p_dvbpsi); dvbpsi_delete(p_dvbpsi);
} }
close(i_fd); close(i_fd);
......
...@@ -236,7 +236,7 @@ static void DumpPMT(void* p_zero, dvbpsi_pmt_t* p_pmt) ...@@ -236,7 +236,7 @@ static void DumpPMT(void* p_zero, dvbpsi_pmt_t* p_pmt)
DumpDescriptors(" | ]", p_es->p_first_descriptor); DumpDescriptors(" | ]", p_es->p_first_descriptor);
p_es = p_es->p_next; p_es = p_es->p_next;
} }
dvbpsi_DeletePMT(p_pmt); dvbpsi_pmt_delete(p_pmt);
} }
static void message(dvbpsi_t *handle, const dvbpsi_msg_level_t level, const char* msg) static void message(dvbpsi_t *handle, const dvbpsi_msg_level_t level, const char* msg)
...@@ -273,11 +273,11 @@ int main(int i_argc, char* pa_argv[]) ...@@ -273,11 +273,11 @@ int main(int i_argc, char* pa_argv[])
i_program_number = atoi(pa_argv[2]); i_program_number = atoi(pa_argv[2]);
i_pmt_pid = atoi(pa_argv[3]); i_pmt_pid = atoi(pa_argv[3]);
p_dvbpsi = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); p_dvbpsi = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_dvbpsi == NULL) if (p_dvbpsi == NULL)
goto out; goto out;
if (!dvbpsi_AttachPMT(p_dvbpsi, i_program_number, DumpPMT, NULL)) if (!dvbpsi_pmt_attach(p_dvbpsi, i_program_number, DumpPMT, NULL))
goto out; goto out;
b_ok = ReadPacket(i_fd, data); b_ok = ReadPacket(i_fd, data);
...@@ -286,15 +286,15 @@ int main(int i_argc, char* pa_argv[]) ...@@ -286,15 +286,15 @@ int main(int i_argc, char* pa_argv[])
{ {
uint16_t i_pid = ((uint16_t)(data[1] & 0x1f) << 8) + data[2]; uint16_t i_pid = ((uint16_t)(data[1] & 0x1f) << 8) + data[2];
if(i_pid == i_pmt_pid) if(i_pid == i_pmt_pid)
dvbpsi_PushPacket(p_dvbpsi, data); dvbpsi_packet_push(p_dvbpsi, data);
b_ok = ReadPacket(i_fd, data); b_ok = ReadPacket(i_fd, data);
} }
out: out:
if (p_dvbpsi) if (p_dvbpsi)
{ {
dvbpsi_DetachPMT(p_dvbpsi); dvbpsi_pmt_detach(p_dvbpsi);
dvbpsi_DeleteHandle(p_dvbpsi); dvbpsi_delete(p_dvbpsi);
} }
close(i_fd); close(i_fd);
......
...@@ -119,7 +119,7 @@ static void DumpSDT(void* p_zero, dvbpsi_sdt_t* p_sdt) ...@@ -119,7 +119,7 @@ static void DumpSDT(void* p_zero, dvbpsi_sdt_t* p_sdt)
DumpDescriptors(" | ]", p_service->p_first_descriptor); DumpDescriptors(" | ]", p_service->p_first_descriptor);
p_service = p_service->p_next; p_service = p_service->p_next;
} }
dvbpsi_DeleteSDT(p_sdt); dvbpsi_sdt_delete(p_sdt);
} }
/***************************************************************************** /*****************************************************************************
...@@ -146,7 +146,7 @@ static void NewSubtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_exten ...@@ -146,7 +146,7 @@ static void NewSubtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_exten
{ {
if(i_table_id == 0x42) if(i_table_id == 0x42)
{ {
if (!dvbpsi_AttachSDT(p_dvbpsi, i_table_id, i_extension, DumpSDT, NULL)) if (!dvbpsi_sdt_attach(p_dvbpsi, i_table_id, i_extension, DumpSDT, NULL))
fprintf(stderr, "Failed to attach SDT subdecoder\n"); fprintf(stderr, "Failed to attach SDT subdecoder\n");
} }
} }
...@@ -168,7 +168,7 @@ int main(int i_argc, char* pa_argv[]) ...@@ -168,7 +168,7 @@ int main(int i_argc, char* pa_argv[])
if (i_fd < 0) if (i_fd < 0)
return 1; return 1;
p_dvbpsi = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); p_dvbpsi = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_dvbpsi == NULL) if (p_dvbpsi == NULL)
goto out; goto out;
...@@ -181,7 +181,7 @@ int main(int i_argc, char* pa_argv[]) ...@@ -181,7 +181,7 @@ int main(int i_argc, char* pa_argv[])
{ {
uint16_t i_pid = ((uint16_t)(data[1] & 0x1f) << 8) + data[2]; uint16_t i_pid = ((uint16_t)(data[1] & 0x1f) << 8) + data[2];
if(i_pid == 0x11) if(i_pid == 0x11)
dvbpsi_PushPacket(p_dvbpsi, data); dvbpsi_packet_push(p_dvbpsi, data);
b_ok = ReadPacket(i_fd, data); b_ok = ReadPacket(i_fd, data);
} }
...@@ -189,7 +189,7 @@ out: ...@@ -189,7 +189,7 @@ out:
if (p_dvbpsi) if (p_dvbpsi)
{ {
dvbpsi_DetachDemux(p_dvbpsi); dvbpsi_DetachDemux(p_dvbpsi);
dvbpsi_DeleteHandle(p_dvbpsi); dvbpsi_delete(p_dvbpsi);
} }
close(i_fd); close(i_fd);
return 0; return 0;
......
/***************************************************************************** /*****************************************************************************
* dvbpsi.c: DVB PSI Information * dvbpsi.c: DVB PSI Information
***************************************************************************** *****************************************************************************
* Copyright (C) 2010-2011 M2X BV * Copyright (C) 2010-2012 M2X BV
* *
* Authors: Jean-Paul Saman <jpsaman@videolan.org> * Authors: Jean-Paul Saman <jpsaman@videolan.org>
* *
...@@ -543,11 +543,11 @@ static void handle_subtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_e ...@@ -543,11 +543,11 @@ static void handle_subtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_e
#endif #endif
case 0x40: // NIT network_information_section - actual_network case 0x40: // NIT network_information_section - actual_network
case 0x41: // NIT network_information_section - other_network case 0x41: // NIT network_information_section - other_network
if (!dvbpsi_AttachNIT(p_dvbpsi, i_table_id, i_extension, handle_NIT, p_data)) if (!dvbpsi_nit_attach(p_dvbpsi, i_table_id, i_extension, handle_NIT, p_data))
fprintf(stderr, "dvbinfo: Failed to attach NIT subdecoder\n"); fprintf(stderr, "dvbinfo: Failed to attach NIT subdecoder\n");
break; break;
case 0x42: case 0x42:
if (!dvbpsi_AttachSDT(p_dvbpsi, i_table_id, i_extension, handle_SDT, p_data)) if (!dvbpsi_sdt_attach(p_dvbpsi, i_table_id, i_extension, handle_SDT, p_data))
fprintf(stderr, "dvbinfo: Failed to attach SDT subdecoder\n"); fprintf(stderr, "dvbinfo: Failed to attach SDT subdecoder\n");
break; break;
#if 0 #if 0
...@@ -556,7 +556,7 @@ static void handle_subtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_e ...@@ -556,7 +556,7 @@ static void handle_subtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_e
//0x47 to 0x49 reserved for future use //0x47 to 0x49 reserved for future use
#endif #endif
case 0x4A: // BAT bouquet_association_section case 0x4A: // BAT bouquet_association_section
if (!dvbpsi_AttachBAT(p_dvbpsi, i_table_id, i_extension, handle_BAT, p_data)) if (!dvbpsi_bat_attach(p_dvbpsi, i_table_id, i_extension, handle_BAT, p_data))
fprintf(stderr, "dvbinfo: Failed to attach BAT subdecoder\n"); fprintf(stderr, "dvbinfo: Failed to attach BAT subdecoder\n");
break; break;
//0x4B to 0x4D reserved for future use //0x4B to 0x4D reserved for future use
...@@ -596,12 +596,12 @@ static void handle_subtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_e ...@@ -596,12 +596,12 @@ static void handle_subtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_e
case 0x6D: case 0x6D:
case 0x6E: case 0x6E:
case 0x6F: case 0x6F:
if (!dvbpsi_AttachEIT(p_dvbpsi, i_table_id, i_extension, handle_EIT, p_data)) if (!dvbpsi_eit_attach(p_dvbpsi, i_table_id, i_extension, handle_EIT, p_data))
fprintf(stderr, "dvbinfo: Failed to attach EIT subdecoder\n"); fprintf(stderr, "dvbinfo: Failed to attach EIT subdecoder\n");
break; break;
case 0x70: case 0x70:
case 0x73: /* TOT only */ case 0x73: /* TOT only */
if (!dvbpsi_AttachTOT(p_dvbpsi, i_table_id, i_extension, handle_TOT, p_data)) if (!dvbpsi_tot_attach(p_dvbpsi, i_table_id, i_extension, handle_TOT, p_data))
fprintf(stderr, "dvbinfo: Failed to attach TOT subdecoder\n"); fprintf(stderr, "dvbinfo: Failed to attach TOT subdecoder\n");
break; break;
#if 0 #if 0
...@@ -616,7 +616,7 @@ static void handle_subtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_e ...@@ -616,7 +616,7 @@ static void handle_subtable(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_e
#endif #endif
#ifdef TS_USE_SCTE_SIS #ifdef TS_USE_SCTE_SIS
case 0xFC: case 0xFC:
if (!dvbpsi_AttachSIS(p_dvbpsi, i_table_id, i_extension, handle_SIS, p_data)) if (!dvbpsi_sis_attach(p_dvbpsi, i_table_id, i_extension, handle_SIS, p_data))
fprintf(stderr, "dvbinfo: Failed to attach SIS subdecoder\n"); fprintf(stderr, "dvbinfo: Failed to attach SIS subdecoder\n");
break; break;
#endif #endif
...@@ -646,8 +646,8 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat) ...@@ -646,8 +646,8 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat)
while (p_program) while (p_program)
{ {
/* Remove old PMT table decoder */ /* Remove old PMT table decoder */
if (dvbpsi_HasDecoder(p_stream->pmt.handle)) if (dvbpsi_decoder_present(p_stream->pmt.handle))
dvbpsi_DetachPMT(p_stream->pmt.handle); dvbpsi_pmt_detach(p_stream->pmt.handle);
/* Attach new PMT decoder */ /* Attach new PMT decoder */
p_stream->i_pmt++; p_stream->i_pmt++;
...@@ -655,7 +655,7 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat) ...@@ -655,7 +655,7 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat)
p_stream->pmt.pid_pmt = &p_stream->pid[p_program->i_pid]; p_stream->pmt.pid_pmt = &p_stream->pid[p_program->i_pid];
p_stream->pmt.pid_pmt->i_pid = p_program->i_pid; p_stream->pmt.pid_pmt->i_pid = p_program->i_pid;
if (!dvbpsi_AttachPMT(p_stream->pmt.handle, p_program->i_number, handle_PMT, p_stream)) if (!dvbpsi_pmt_attach(p_stream->pmt.handle, p_program->i_number, handle_PMT, p_stream))
{ {
fprintf(stderr, "dvbinfo: Failed to attach new pmt decoder\n"); fprintf(stderr, "dvbinfo: Failed to attach new pmt decoder\n");
break; break;
...@@ -665,7 +665,7 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat) ...@@ -665,7 +665,7 @@ static void handle_PAT(void* p_data, dvbpsi_pat_t* p_pat)
p_program = p_program->p_next; p_program = p_program->p_next;
} }
printf("\tActive : %s\n", p_pat->b_current_next ? "yes" : "no"); printf("\tActive : %s\n", p_pat->b_current_next ? "yes" : "no");
dvbpsi_DeletePAT(p_pat); dvbpsi_pat_delete(p_pat);
} }
/***************************************************************************** /*****************************************************************************
...@@ -1028,7 +1028,7 @@ static void handle_SIS(void* p_data, dvbpsi_sis_t* p_sis) ...@@ -1028,7 +1028,7 @@ static void handle_SIS(void* p_data, dvbpsi_sis_t* p_sis)
} }
printf("\n"); printf("\n");
DumpSISDescriptors("\t ]", p_sis->p_first_descriptor); DumpSISDescriptors("\t ]", p_sis->p_first_descriptor);
dvbpsi_DeleteSIS(p_sis); dvbpsi_sis_delete(p_sis);
} }
#endif #endif
...@@ -1115,7 +1115,7 @@ static void handle_SDT(void* p_data, dvbpsi_sdt_t* p_sdt) ...@@ -1115,7 +1115,7 @@ static void handle_SDT(void* p_data, dvbpsi_sdt_t* p_sdt)
DumpDescriptors("\t | ]", p_service->p_first_descriptor); DumpDescriptors("\t | ]", p_service->p_first_descriptor);
p_service = p_service->p_next; p_service = p_service->p_next;
} }
dvbpsi_DeleteSDT(p_sdt); dvbpsi_sdt_delete(p_sdt);
} }
static void DumpEITEventDescriptors(dvbpsi_eit_event_t *p_eit_event) static void DumpEITEventDescriptors(dvbpsi_eit_event_t *p_eit_event)
...@@ -1152,7 +1152,7 @@ static void handle_EIT(void* p_data, dvbpsi_eit_t* p_eit) ...@@ -1152,7 +1152,7 @@ static void handle_EIT(void* p_data, dvbpsi_eit_t* p_eit)
DumpEITEventDescriptors(p_eit->p_first_event); DumpEITEventDescriptors(p_eit->p_first_event);
dvbpsi_DeleteEIT(p_eit); dvbpsi_eit_delete(p_eit);
} }
static void handle_TOT(void* p_data, dvbpsi_tot_t* p_tot) static void handle_TOT(void* p_data, dvbpsi_tot_t* p_tot)
...@@ -1174,7 +1174,7 @@ static void handle_TOT(void* p_data, dvbpsi_tot_t* p_tot) ...@@ -1174,7 +1174,7 @@ static void handle_TOT(void* p_data, dvbpsi_tot_t* p_tot)
if (table_id == 0x73) /* TOT */ if (table_id == 0x73) /* TOT */
printf("\tCRC 32 : %d\n", p_tot->i_crc); printf("\tCRC 32 : %d\n", p_tot->i_crc);
DumpDescriptors("\t | ]", p_tot->p_first_descriptor); DumpDescriptors("\t | ]", p_tot->p_first_descriptor);
dvbpsi_DeleteTOT(p_tot); dvbpsi_tot_delete(p_tot);
} }
/***************************************************************************** /*****************************************************************************
...@@ -1204,7 +1204,7 @@ static void handle_NIT(void* p_data, dvbpsi_nit_t* p_nit) ...@@ -1204,7 +1204,7 @@ static void handle_NIT(void* p_data, dvbpsi_nit_t* p_nit)
printf("\tCurrent next : %s\n", p_nit->b_current_next ? "yes" : "no"); printf("\tCurrent next : %s\n", p_nit->b_current_next ? "yes" : "no");
DumpDescriptors("\t | ]", p_nit->p_first_descriptor); DumpDescriptors("\t | ]", p_nit->p_first_descriptor);
DumpTSDescriptorsNIT(p_nit->p_first_ts); DumpTSDescriptorsNIT(p_nit->p_first_ts);
dvbpsi_DeleteNIT(p_nit); dvbpsi_nit_delete(p_nit);
} }
/***************************************************************************** /*****************************************************************************
...@@ -1234,7 +1234,7 @@ static void handle_BAT(void* p_data, dvbpsi_bat_t* p_bat) ...@@ -1234,7 +1234,7 @@ static void handle_BAT(void* p_data, dvbpsi_bat_t* p_bat)
printf("\tCurrent next : %s\n", p_bat->b_current_next ? "yes" : "no"); printf("\tCurrent next : %s\n", p_bat->b_current_next ? "yes" : "no");
DumpDescriptors("\t | ]", p_bat->p_first_descriptor); DumpDescriptors("\t | ]", p_bat->p_first_descriptor);
DumpTSDescriptorsBAT(p_bat->p_first_ts); DumpTSDescriptorsBAT(p_bat->p_first_ts);
dvbpsi_DeleteBAT(p_bat); dvbpsi_bat_delete(p_bat);
} }
/***************************************************************************** /*****************************************************************************
...@@ -1265,7 +1265,7 @@ static void handle_PMT(void* p_data, dvbpsi_pmt_t* p_pmt) ...@@ -1265,7 +1265,7 @@ static void handle_PMT(void* p_data, dvbpsi_pmt_t* p_pmt)
DumpDescriptors("\t| ]", p_es->p_first_descriptor); DumpDescriptors("\t| ]", p_es->p_first_descriptor);
p_es = p_es->p_next; p_es = p_es->p_next;
} }
dvbpsi_DeletePMT(p_pmt); dvbpsi_pmt_delete(p_pmt);
} }
/***************************************************************************** /*****************************************************************************
...@@ -1283,7 +1283,7 @@ static void handle_CAT(void *p_data, dvbpsi_cat_t *p_cat) ...@@ -1283,7 +1283,7 @@ static void handle_CAT(void *p_data, dvbpsi_cat_t *p_cat)
printf("\tCurrent next : %s\n", p_cat->b_current_next ? "yes" : "no"); printf("\tCurrent next : %s\n", p_cat->b_current_next ? "yes" : "no");
DumpDescriptors("\t ]", p_cat->p_first_descriptor); DumpDescriptors("\t ]", p_cat->p_first_descriptor);
printf("\n"); printf("\n");
dvbpsi_DeleteCAT(p_cat); dvbpsi_cat_delete(p_cat);
} }
/***************************************************************************** /*****************************************************************************
...@@ -1311,56 +1311,56 @@ ts_stream_t *libdvbpsi_init(int debug, ts_stream_log_cb pf_log, void *cb_data) ...@@ -1311,56 +1311,56 @@ ts_stream_t *libdvbpsi_init(int debug, ts_stream_log_cb pf_log, void *cb_data)
} }
/* PAT */ /* PAT */
stream->pat.handle = dvbpsi_NewHandle(&dvbpsi_message, stream->level); stream->pat.handle = dvbpsi_new(&dvbpsi_message, stream->level);
if (stream->pat.handle == NULL) if (stream->pat.handle == NULL)
goto error; goto error;
if (!dvbpsi_AttachPAT(stream->pat.handle, handle_PAT, stream)) if (!dvbpsi_pat_attach(stream->pat.handle, handle_PAT, stream))
{ {
dvbpsi_DeleteHandle(stream->pat.handle); dvbpsi_delete(stream->pat.handle);
stream->pat.handle = NULL; stream->pat.handle = NULL;
goto error; goto error;
} }
/* PMT */ /* PMT */
stream->pmt.handle = dvbpsi_NewHandle(&dvbpsi_message, stream->level); stream->pmt.handle = dvbpsi_new(&dvbpsi_message, stream->level);
if (stream->pmt.handle == NULL) if (stream->pmt.handle == NULL)
goto error; goto error;
/* CAT */ /* CAT */
stream->cat.handle = dvbpsi_NewHandle(&dvbpsi_message, stream->level); stream->cat.handle = dvbpsi_new(&dvbpsi_message, stream->level);
if (stream->cat.handle == NULL) if (stream->cat.handle == NULL)
goto error; goto error;
if (!dvbpsi_AttachCAT(stream->cat.handle, handle_CAT, stream)) if (!dvbpsi_cat_attach(stream->cat.handle, handle_CAT, stream))
{ {
dvbpsi_DeleteHandle(stream->cat.handle); dvbpsi_delete(stream->cat.handle);
stream->cat.handle = NULL; stream->cat.handle = NULL;
goto error; goto error;
} }
/* SDT demuxer */ /* SDT demuxer */
stream->sdt.handle = dvbpsi_NewHandle(&dvbpsi_message, stream->level); stream->sdt.handle = dvbpsi_new(&dvbpsi_message, stream->level);
if (stream->sdt.handle == NULL) if (stream->sdt.handle == NULL)
goto error; goto error;
if (!dvbpsi_AttachDemux(stream->sdt.handle, handle_subtable, stream)) if (!dvbpsi_AttachDemux(stream->sdt.handle, handle_subtable, stream))
{ {
dvbpsi_DeleteHandle(stream->sdt.handle); dvbpsi_delete(stream->sdt.handle);
stream->sdt.handle = NULL; stream->sdt.handle = NULL;
goto error; goto error;
} }
/* EIT demuxer */ /* EIT demuxer */
stream->eit.handle = dvbpsi_NewHandle(&dvbpsi_message, stream->level); stream->eit.handle = dvbpsi_new(&dvbpsi_message, stream->level);
if (stream->eit.handle == NULL) if (stream->eit.handle == NULL)
goto error; goto error;
if (!dvbpsi_AttachDemux(stream->eit.handle, handle_subtable, stream)) if (!dvbpsi_AttachDemux(stream->eit.handle, handle_subtable, stream))
{ {
dvbpsi_DeleteHandle(stream->eit.handle); dvbpsi_delete(stream->eit.handle);
stream->eit.handle = NULL; stream->eit.handle = NULL;
goto error; goto error;
} }
/* TDT demuxer */ /* TDT demuxer */
stream->tdt.handle = dvbpsi_NewHandle(&dvbpsi_message, stream->level); stream->tdt.handle = dvbpsi_new(&dvbpsi_message, stream->level);
if (stream->tdt.handle == NULL) if (stream->tdt.handle == NULL)
goto error; goto error;
if (!dvbpsi_AttachDemux(stream->tdt.handle, handle_subtable, stream)) if (!dvbpsi_AttachDemux(stream->tdt.handle, handle_subtable, stream))
{ {
dvbpsi_DeleteHandle(stream->tdt.handle); dvbpsi_delete(stream->tdt.handle);
stream->tdt.handle = NULL; stream->tdt.handle = NULL;
goto error; goto error;
} }
...@@ -1378,29 +1378,29 @@ ts_stream_t *libdvbpsi_init(int debug, ts_stream_log_cb pf_log, void *cb_data) ...@@ -1378,29 +1378,29 @@ ts_stream_t *libdvbpsi_init(int debug, ts_stream_log_cb pf_log, void *cb_data)
return stream; return stream;
error: error:
if (dvbpsi_HasDecoder(stream->pat.handle)) if (dvbpsi_decoder_present(stream->pat.handle))
dvbpsi_DetachPAT(stream->pat.handle); dvbpsi_pat_detach(stream->pat.handle);
if (dvbpsi_HasDecoder(stream->cat.handle)) if (dvbpsi_decoder_present(stream->cat.handle))
dvbpsi_DetachCAT(stream->cat.handle); dvbpsi_cat_detach(stream->cat.handle);
if (dvbpsi_HasDecoder(stream->sdt.handle)) if (dvbpsi_decoder_present(stream->sdt.handle))
dvbpsi_DetachDemux(stream->sdt.handle); dvbpsi_DetachDemux(stream->sdt.handle);
if (dvbpsi_HasDecoder(stream->eit.handle)) if (dvbpsi_decoder_present(stream->eit.handle))
dvbpsi_DetachDemux(stream->eit.handle); dvbpsi_DetachDemux(stream->eit.handle);
if (dvbpsi_HasDecoder(stream->tdt.handle)) if (dvbpsi_decoder_present(stream->tdt.handle))
dvbpsi_DetachDemux(stream->tdt.handle); dvbpsi_DetachDemux(stream->tdt.handle);
if (stream->pat.handle) if (stream->pat.handle)
dvbpsi_DeleteHandle(stream->pat.handle); dvbpsi_delete(stream->pat.handle);
if (stream->pmt.handle) if (stream->pmt.handle)
dvbpsi_DeleteHandle(stream->pmt.handle); dvbpsi_delete(stream->pmt.handle);
if (stream->cat.handle) if (stream->cat.handle)
dvbpsi_DeleteHandle(stream->cat.handle); dvbpsi_delete(stream->cat.handle);
if (stream->sdt.handle) if (stream->sdt.handle)
dvbpsi_DeleteHandle(stream->sdt.handle); dvbpsi_delete(stream->sdt.handle);
if (stream->eit.handle) if (stream->eit.handle)
dvbpsi_DeleteHandle(stream->eit.handle); dvbpsi_delete(stream->eit.handle);
if (stream->tdt.handle) if (stream->tdt.handle)
dvbpsi_DeleteHandle(stream->tdt.handle); dvbpsi_delete(stream->tdt.handle);
free(stream); free(stream);
return NULL; return NULL;
...@@ -1410,31 +1410,31 @@ void libdvbpsi_exit(ts_stream_t *stream) ...@@ -1410,31 +1410,31 @@ void libdvbpsi_exit(ts_stream_t *stream)
{ {
summary(stdout, stream); summary(stdout, stream);
if (dvbpsi_HasDecoder(stream->pat.handle)) if (dvbpsi_decoder_present(stream->pat.handle))
dvbpsi_DetachPAT(stream->pat.handle); dvbpsi_pat_detach(stream->pat.handle);
if (dvbpsi_HasDecoder(stream->pmt.handle)) if (dvbpsi_decoder_present(stream->pmt.handle))
dvbpsi_DetachPMT(stream->pmt.handle); dvbpsi_pmt_detach(stream->pmt.handle);
if (dvbpsi_HasDecoder(stream->cat.handle)) if (dvbpsi_decoder_present(stream->cat.handle))
dvbpsi_DetachCAT(stream->cat.handle); dvbpsi_cat_detach(stream->cat.handle);
if (dvbpsi_HasDecoder(stream->sdt.handle)) if (dvbpsi_decoder_present(stream->sdt.handle))
dvbpsi_DetachDemux(stream->sdt.handle); dvbpsi_DetachDemux(stream->sdt.handle);
if (dvbpsi_HasDecoder(stream->eit.handle)) if (dvbpsi_decoder_present(stream->eit.handle))
dvbpsi_DetachDemux(stream->eit.handle); dvbpsi_DetachDemux(stream->eit.handle);
if (dvbpsi_HasDecoder(stream->tdt.handle)) if (dvbpsi_decoder_present(stream->tdt.handle))
dvbpsi_DetachDemux(stream->tdt.handle); dvbpsi_DetachDemux(stream->tdt.handle);
if (stream->pat.handle) if (stream->pat.handle)
dvbpsi_DeleteHandle(stream->pat.handle); dvbpsi_delete(stream->pat.handle);
if (stream->pmt.handle) if (stream->pmt.handle)
dvbpsi_DeleteHandle(stream->pmt.handle); dvbpsi_delete(stream->pmt.handle);
if (stream->cat.handle) if (stream->cat.handle)
dvbpsi_DeleteHandle(stream->cat.handle); dvbpsi_delete(stream->cat.handle);
if (stream->sdt.handle) if (stream->sdt.handle)
dvbpsi_DeleteHandle(stream->sdt.handle); dvbpsi_delete(stream->sdt.handle);
if (stream->eit.handle) if (stream->eit.handle)
dvbpsi_DeleteHandle(stream->eit.handle); dvbpsi_delete(stream->eit.handle);
if (stream->tdt.handle) if (stream->tdt.handle)
dvbpsi_DeleteHandle(stream->tdt.handle); dvbpsi_delete(stream->tdt.handle);
free(stream); free(stream);
stream = NULL; stream = NULL;
...@@ -1498,23 +1498,23 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ ...@@ -1498,23 +1498,23 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_
date, stream->i_packets, i_pid, i_pid, i_cc); date, stream->i_packets, i_pid, i_pid, i_cc);
if (i_pid == 0x0) /* PAT */ if (i_pid == 0x0) /* PAT */
dvbpsi_PushPacket(stream->pat.handle, p_tmp); dvbpsi_packet_push(stream->pat.handle, p_tmp);
else if (i_pid == 0x01) /* CAT */ else if (i_pid == 0x01) /* CAT */
dvbpsi_PushPacket(stream->cat.handle, p_tmp); dvbpsi_packet_push(stream->cat.handle, p_tmp);
else if (i_pid == 0x02) /* Transport Stream Description Table */ else if (i_pid == 0x02) /* Transport Stream Description Table */
dvbpsi_PushPacket(stream->tdt.handle, p_tmp); dvbpsi_packet_push(stream->tdt.handle, p_tmp);
#if 0 #if 0
else if (i_pid == 0x03) /* IPMP Control Information Table */ else if (i_pid == 0x03) /* IPMP Control Information Table */
dvbpsi_PushPacket(stream->ipmp.handle, p_tmp); dvbpsi_packet_push(stream->ipmp.handle, p_tmp);
#endif #endif
else if (i_pid == 0x11) /* SDT/BAT/NIT */ else if (i_pid == 0x11) /* SDT/BAT/NIT */
dvbpsi_PushPacket(stream->sdt.handle, p_tmp); dvbpsi_packet_push(stream->sdt.handle, p_tmp);
else if (i_pid == 0x12) /* EIT */ else if (i_pid == 0x12) /* EIT */
dvbpsi_PushPacket(stream->eit.handle, p_tmp); dvbpsi_packet_push(stream->eit.handle, p_tmp);
else if (i_pid == 0x14) /* TDT/TOT */ else if (i_pid == 0x14) /* TDT/TOT */
dvbpsi_PushPacket(stream->tdt.handle, p_tmp); dvbpsi_packet_push(stream->tdt.handle, p_tmp);
else if (stream->pmt.pid_pmt && i_pid == stream->pmt.pid_pmt->i_pid) else if (stream->pmt.pid_pmt && i_pid == stream->pmt.pid_pmt->i_pid)
dvbpsi_PushPacket(stream->pmt.handle, p_tmp); dvbpsi_packet_push(stream->pmt.handle, p_tmp);
/* Remember PID */ /* Remember PID */
if (!stream->pid[i_pid].b_seen) if (!stream->pid[i_pid].b_seen)
......
...@@ -93,7 +93,7 @@ static void PMTCallback( void *_unused, dvbpsi_pmt_t *p_pmt ) ...@@ -93,7 +93,7 @@ static void PMTCallback( void *_unused, dvbpsi_pmt_t *p_pmt )
{ {
if ( p_pmt->i_program_number != i_program ) if ( p_pmt->i_program_number != i_program )
{ {
dvbpsi_DeletePMT( p_pmt ); dvbpsi_pmt_delete( p_pmt );
return; return;
} }
...@@ -112,7 +112,7 @@ static void PATCallback( void *_unused, dvbpsi_pat_t *p_pat ) ...@@ -112,7 +112,7 @@ static void PATCallback( void *_unused, dvbpsi_pat_t *p_pat )
if (i_nb_programs >= MAX_PROGRAMS) if (i_nb_programs >= MAX_PROGRAMS)
{ {
fprintf(stderr, "Too many PMT programs\n"); fprintf(stderr, "Too many PMT programs\n");
dvbpsi_DeletePAT( p_pat ); dvbpsi_pat_delete( p_pat );
return; return;
} }
...@@ -123,17 +123,17 @@ static void PATCallback( void *_unused, dvbpsi_pat_t *p_pat ) ...@@ -123,17 +123,17 @@ static void PATCallback( void *_unused, dvbpsi_pat_t *p_pat )
&& (!i_program || i_program == p_program->i_number) ) && (!i_program || i_program == p_program->i_number) )
{ {
pi_pmt_pids[i_nb_programs] = p_program->i_pid; pi_pmt_pids[i_nb_programs] = p_program->i_pid;
p_pmt_dvbpsi_fds[i_nb_programs] = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); p_pmt_dvbpsi_fds[i_nb_programs] = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_pmt_dvbpsi_fds[i_nb_programs]) if (p_pmt_dvbpsi_fds[i_nb_programs])
{ {
if (dvbpsi_AttachPMT(p_pmt_dvbpsi_fds[i_nb_programs], if (dvbpsi_pmt_attach(p_pmt_dvbpsi_fds[i_nb_programs],
p_program->i_number, PMTCallback, NULL)) p_program->i_number, PMTCallback, NULL))
i_nb_programs++; i_nb_programs++;
} }
} }
} }
dvbpsi_DeletePAT( p_pat ); dvbpsi_pat_delete( p_pat );
} }
/***************************************************************************** /*****************************************************************************
...@@ -163,13 +163,13 @@ static void TSHandle( uint8_t *p_ts ) ...@@ -163,13 +163,13 @@ static void TSHandle( uint8_t *p_ts )
if ( i_pid == 0 && !i_nb_programs ) if ( i_pid == 0 && !i_nb_programs )
{ {
dvbpsi_PushPacket( p_pat_dvbpsi_fd, p_ts ); dvbpsi_packet_push( p_pat_dvbpsi_fd, p_ts );
} }
for ( i = 0; i < i_nb_programs; i++ ) for ( i = 0; i < i_nb_programs; i++ )
{ {
if ( pi_pmt_pids[i] == i_pid ) if ( pi_pmt_pids[i] == i_pid )
dvbpsi_PushPacket( p_pmt_dvbpsi_fds[i], p_ts ); dvbpsi_packet_push( p_pmt_dvbpsi_fds[i], p_ts );
} }
} }
...@@ -197,11 +197,11 @@ int main( int i_argc, char **pp_argv ) ...@@ -197,11 +197,11 @@ int main( int i_argc, char **pp_argv )
if ( i_argc == 3 ) if ( i_argc == 3 )
i_program = strtol( pp_argv[2], NULL, 0 ); i_program = strtol( pp_argv[2], NULL, 0 );
p_pat_dvbpsi_fd = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); p_pat_dvbpsi_fd = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_pat_dvbpsi_fd == NULL) if (p_pat_dvbpsi_fd == NULL)
goto out; goto out;
if (!dvbpsi_AttachPAT(p_pat_dvbpsi_fd, PATCallback, NULL )) if (!dvbpsi_pat_attach(p_pat_dvbpsi_fd, PATCallback, NULL ))
goto out; goto out;
p_buffer = malloc( TS_SIZE * READ_ONCE ); p_buffer = malloc( TS_SIZE * READ_ONCE );
...@@ -236,8 +236,8 @@ int main( int i_argc, char **pp_argv ) ...@@ -236,8 +236,8 @@ int main( int i_argc, char **pp_argv )
{ {
if (p_pmt_dvbpsi_fds[i]) if (p_pmt_dvbpsi_fds[i])
{ {
dvbpsi_DetachPMT(p_pmt_dvbpsi_fds[i]); dvbpsi_pmt_detach(p_pmt_dvbpsi_fds[i]);
dvbpsi_DeleteHandle(p_pmt_dvbpsi_fds[i]); dvbpsi_delete(p_pmt_dvbpsi_fds[i]);
} }
p_pmt_dvbpsi_fds[i] = NULL; p_pmt_dvbpsi_fds[i] = NULL;
} }
...@@ -246,8 +246,8 @@ int main( int i_argc, char **pp_argv ) ...@@ -246,8 +246,8 @@ int main( int i_argc, char **pp_argv )
out: out:
if (p_pat_dvbpsi_fd) if (p_pat_dvbpsi_fd)
{ {
dvbpsi_DetachPAT(p_pat_dvbpsi_fd); dvbpsi_pat_detach(p_pat_dvbpsi_fd);
dvbpsi_DeleteHandle(p_pat_dvbpsi_fd); dvbpsi_delete(p_pat_dvbpsi_fd);
} }
close( i_fd ); close( i_fd );
......
...@@ -120,36 +120,36 @@ int main(int i_argc, char* pa_argv[]) ...@@ -120,36 +120,36 @@ int main(int i_argc, char* pa_argv[])
dvbpsi_psi_section_t* p_section5, * p_section6; dvbpsi_psi_section_t* p_section5, * p_section6;
int i; int i;
dvbpsi_t *p_dvbpsi = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); dvbpsi_t *p_dvbpsi = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_dvbpsi == NULL) if (p_dvbpsi == NULL)
return 1; return 1;
/* PAT generation */ /* PAT generation */
dvbpsi_InitPAT(&pat, 1, 0, 0); dvbpsi_pat_init(&pat, 1, 0, 0);
dvbpsi_PATAddProgram(&pat, 0, 0x12); dvbpsi_pat_program_add(&pat, 0, 0x12);
dvbpsi_PATAddProgram(&pat, 1, 0x42); dvbpsi_pat_program_add(&pat, 1, 0x42);
dvbpsi_PATAddProgram(&pat, 2, 0x21); dvbpsi_pat_program_add(&pat, 2, 0x21);
dvbpsi_PATAddProgram(&pat, 3, 0x24); dvbpsi_pat_program_add(&pat, 3, 0x24);
for(i = 4; i < 43; i++) for(i = 4; i < 43; i++)
dvbpsi_PATAddProgram(&pat, i, i); dvbpsi_pat_program_add(&pat, i, i);
p_section1 = dvbpsi_GenPATSections(p_dvbpsi, &pat, 4); p_section1 = dvbpsi_pat_sections_generate(p_dvbpsi, &pat, 4);
pat.b_current_next = 1; pat.b_current_next = 1;
p_section2 = dvbpsi_GenPATSections(p_dvbpsi, &pat, 8); p_section2 = dvbpsi_pat_sections_generate(p_dvbpsi, &pat, 8);
pat.i_version = 1; pat.i_version = 1;
pat.b_current_next = 0; pat.b_current_next = 0;
p_section3 = dvbpsi_GenPATSections(p_dvbpsi, &pat, 16); p_section3 = dvbpsi_pat_sections_generate(p_dvbpsi, &pat, 16);
pat.b_current_next = 1; pat.b_current_next = 1;
p_section4 = dvbpsi_GenPATSections(p_dvbpsi, &pat, 300); p_section4 = dvbpsi_pat_sections_generate(p_dvbpsi, &pat, 300);
pat.i_version = 2; pat.i_version = 2;
pat.b_current_next = 0; pat.b_current_next = 0;
p_section5 = dvbpsi_GenPATSections(p_dvbpsi, &pat, 16); p_section5 = dvbpsi_pat_sections_generate(p_dvbpsi, &pat, 16);
pat.b_current_next = 1; pat.b_current_next = 1;
p_section6 = dvbpsi_GenPATSections(p_dvbpsi, &pat, 16); p_section6 = dvbpsi_pat_sections_generate(p_dvbpsi, &pat, 16);
/* TS packets generation */ /* TS packets generation */
packet[0] = 0x47; packet[0] = 0x47;
...@@ -170,9 +170,9 @@ int main(int i_argc, char* pa_argv[]) ...@@ -170,9 +170,9 @@ int main(int i_argc, char* pa_argv[])
dvbpsi_DeletePSISections(p_section5); dvbpsi_DeletePSISections(p_section5);
dvbpsi_DeletePSISections(p_section6); dvbpsi_DeletePSISections(p_section6);
dvbpsi_EmptyPAT(&pat); dvbpsi_pat_empty(&pat);
dvbpsi_DeleteHandle(p_dvbpsi); dvbpsi_delete(p_dvbpsi);
return 0; return 0;
} }
...@@ -124,39 +124,39 @@ int main(int i_argc, char* pa_argv[]) ...@@ -124,39 +124,39 @@ int main(int i_argc, char* pa_argv[])
dvbpsi_psi_section_t* p_section3, * p_section4; dvbpsi_psi_section_t* p_section3, * p_section4;
dvbpsi_psi_section_t* p_section5, * p_section6; dvbpsi_psi_section_t* p_section5, * p_section6;
dvbpsi_t *p_dvbpsi = dvbpsi_NewHandle(&message, DVBPSI_MSG_DEBUG); dvbpsi_t *p_dvbpsi = dvbpsi_new(&message, DVBPSI_MSG_DEBUG);
if (p_dvbpsi == NULL) if (p_dvbpsi == NULL)
return 1; return 1;
/* PMT generation */ /* PMT generation */
dvbpsi_InitPMT(&pmt, 12, 0, 0, 42); dvbpsi_pmt_init(&pmt, 12, 0, 0, 42);
dvbpsi_PMTAddDescriptor(&pmt, 12, 26, data); dvbpsi_pmt_descriptor_add(&pmt, 12, 26, data);
dvbpsi_PMTAddDescriptor(&pmt, 42, 12, data + 12); dvbpsi_pmt_descriptor_add(&pmt, 42, 12, data + 12);
dvbpsi_PMTAddDescriptor(&pmt, 2, 1, data + 4); dvbpsi_pmt_descriptor_add(&pmt, 2, 1, data + 4);
dvbpsi_PMTAddDescriptor(&pmt, 0, 4, data + 7); dvbpsi_pmt_descriptor_add(&pmt, 0, 4, data + 7);
p_es = dvbpsi_PMTAddES(&pmt, 12, 42); p_es = dvbpsi_pmt_es_add(&pmt, 12, 42);
dvbpsi_PMTESAddDescriptor(p_es, 12, 26, data); dvbpsi_pmt_es_descriptor_add(p_es, 12, 26, data);
dvbpsi_PMTESAddDescriptor(p_es, 42, 12, data + 12); dvbpsi_pmt_es_descriptor_add(p_es, 42, 12, data + 12);
dvbpsi_PMTESAddDescriptor(p_es, 2, 1, data + 4); dvbpsi_pmt_es_descriptor_add(p_es, 2, 1, data + 4);
dvbpsi_PMTESAddDescriptor(p_es, 0, 4, data + 7); dvbpsi_pmt_es_descriptor_add(p_es, 0, 4, data + 7);
p_section1 = dvbpsi_GenPMTSections(p_dvbpsi, &pmt); p_section1 = dvbpsi_pmt_sections_generate(p_dvbpsi, &pmt);
pmt.b_current_next = 1; pmt.b_current_next = 1;
p_section2 = dvbpsi_GenPMTSections(p_dvbpsi, &pmt); p_section2 = dvbpsi_pmt_sections_generate(p_dvbpsi, &pmt);
pmt.i_version = 1; pmt.i_version = 1;
pmt.b_current_next = 0; pmt.b_current_next = 0;
p_section3 = dvbpsi_GenPMTSections(p_dvbpsi, &pmt); p_section3 = dvbpsi_pmt_sections_generate(p_dvbpsi, &pmt);
pmt.b_current_next = 1; pmt.b_current_next = 1;
p_section4 = dvbpsi_GenPMTSections(p_dvbpsi, &pmt); p_section4 = dvbpsi_pmt_sections_generate(p_dvbpsi, &pmt);
pmt.i_version = 2; pmt.i_version = 2;
pmt.b_current_next = 0; pmt.b_current_next = 0;
p_section5 = dvbpsi_GenPMTSections(p_dvbpsi, &pmt); p_section5 = dvbpsi_pmt_sections_generate(p_dvbpsi, &pmt);
pmt.b_current_next = 1; pmt.b_current_next = 1;
p_section6 = dvbpsi_GenPMTSections(p_dvbpsi, &pmt); p_section6 = dvbpsi_pmt_sections_generate(p_dvbpsi, &pmt);
/* TS packets generation */ /* TS packets generation */
packet[0] = 0x47; packet[0] = 0x47;
...@@ -179,8 +179,8 @@ int main(int i_argc, char* pa_argv[]) ...@@ -179,8 +179,8 @@ int main(int i_argc, char* pa_argv[])
dvbpsi_DeletePSISections(p_section5); dvbpsi_DeletePSISections(p_section5);
dvbpsi_DeletePSISections(p_section6); dvbpsi_DeletePSISections(p_section6);
dvbpsi_EmptyPMT(&pmt); dvbpsi_pmt_empty(&pmt);
dvbpsi_DeleteHandle(p_dvbpsi); dvbpsi_delete(p_dvbpsi);
return 0; return 0;
} }
...@@ -57,8 +57,8 @@ bool dvbpsi_AttachDemux(dvbpsi_t * p_dvbpsi, ...@@ -57,8 +57,8 @@ bool dvbpsi_AttachDemux(dvbpsi_t * p_dvbpsi,
assert(p_dvbpsi->p_decoder == NULL); assert(p_dvbpsi->p_decoder == NULL);
dvbpsi_demux_t *p_demux; dvbpsi_demux_t *p_demux;
p_demux = (dvbpsi_demux_t*) dvbpsi_NewDecoder(&dvbpsi_Demux, 4096, true, p_demux = (dvbpsi_demux_t*) dvbpsi_decoder_new(&dvbpsi_Demux, 4096, true,
sizeof(dvbpsi_demux_t)); sizeof(dvbpsi_demux_t));
if (p_demux == NULL) if (p_demux == NULL)
return false; return false;
...@@ -149,7 +149,7 @@ void dvbpsi_DetachDemux(dvbpsi_t *p_dvbpsi) ...@@ -149,7 +149,7 @@ void dvbpsi_DetachDemux(dvbpsi_t *p_dvbpsi)
else free(p_subdec_temp); else free(p_subdec_temp);
} }
dvbpsi_DeleteDecoder(p_dvbpsi->p_decoder); dvbpsi_decoder_delete(p_dvbpsi->p_decoder);
p_dvbpsi->p_decoder = NULL; p_dvbpsi->p_decoder = NULL;
} }
...@@ -194,7 +194,7 @@ void dvbpsi_DeleteDemuxSubDecoder(dvbpsi_demux_subdec_t *p_subdec) ...@@ -194,7 +194,7 @@ void dvbpsi_DeleteDemuxSubDecoder(dvbpsi_demux_subdec_t *p_subdec)
if (!p_subdec) if (!p_subdec)
return; return;
/* FIXME: find a saner way to release private decoder resources */ /* FIXME: find a saner way to release private decoder resources */
dvbpsi_DeleteDecoder(p_subdec->p_decoder); dvbpsi_decoder_delete(p_subdec->p_decoder);
free(p_subdec); free(p_subdec);
p_subdec = NULL; p_subdec = NULL;
} }
......
...@@ -241,6 +241,23 @@ void dvbpsi_AttachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t ...@@ -241,6 +241,23 @@ void dvbpsi_AttachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t
*/ */
void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t *p_subdec); void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t *p_subdec);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
#if 0
__attribute__((deprecated))
dvbpsi_handle dvbpsi_AttachDemux(dvbpsi_demux_new_cb_t pf_new_cb,
void * p_new_cb_data);
__attribute__((deprecated))
void dvbpsi_DetachDemux(dvbpsi_handle h_dvbpsi);
__attribute__((deprecated))
dvbpsi_demux_subdec_t * dvbpsi_demuxGetSubDec(dvbpsi_demux_t * p_demux,
uint8_t i_table_id,
uint16_t i_extension);
__attribute__((deprecated))
void dvbpsi_Demux(dvbpsi_handle h_dvbpsi, dvbpsi_psi_section_t * p_section);
#endif
#ifdef __cplusplus #ifdef __cplusplus
}; };
#endif #endif
...@@ -248,4 +265,3 @@ void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t ...@@ -248,4 +265,3 @@ void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t
#else #else
#error "Multiple inclusions of demux.h" #error "Multiple inclusions of demux.h"
#endif #endif
/*****************************************************************************
* deprecated.h
* Copyright (C) 2012 VideoLAN
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef _DVBPSI_DEPRECATED_H_
#define _DVBPSI_DEPRECATED_H_
/*!
* \file <deprecated.h>
* \author Jean-Paul Saman <jpsaman@videolan.org>
* \brief Deprecated Application interface for all DVB/PSI decoders.
*
* The application interface for DVBPSI version < 1.0.0 has changed.
* The affected functions are mentioned in this headerfile. Developers
* are urged to use the current application interface instead. It offers
* the same functionality and a bit more.
*/
#ifdef __cplusplus
extern "C" {
#endif
/* dvbpsi_private.h */
/* descriptor.h */
/* psi.h */
/* demux.h */
/*****************************************************************************
* Decoders
*****************************************************************************/
/*****************************************************************************
* Descriptors
*****************************************************************************/
#ifdef __cplusplus
};
#endif
#else
#error "Multiple inclusions of deprecated.h"
#endif
/***************************************************************************** /*****************************************************************************
* dvbpsi.c: conversion from TS packets to PSI sections * dvbpsi.c: conversion from TS packets to PSI sections
*---------------------------------------------------------------------------- *----------------------------------------------------------------------------
* Copyright (C) 2001-2011 VideoLAN * Copyright (C) 2001-2012 VideoLAN
* $Id$ * $Id$
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
...@@ -142,35 +142,36 @@ uint32_t dvbpsi_crc32_table[256] = ...@@ -142,35 +142,36 @@ uint32_t dvbpsi_crc32_table[256] =
}; };
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewHandle * dvbpsi_new
*****************************************************************************/ *****************************************************************************/
dvbpsi_t *dvbpsi_NewHandle(dvbpsi_message_cb callback, enum dvbpsi_msg_level level) dvbpsi_t *dvbpsi_new(dvbpsi_message_cb callback, enum dvbpsi_msg_level level)
{ {
dvbpsi_t *p_dvbpsi = calloc(1, sizeof(dvbpsi_t)); dvbpsi_t *p_dvbpsi = calloc(1, sizeof(dvbpsi_t));
if (p_dvbpsi != NULL) if (p_dvbpsi == NULL)
{ return NULL;
p_dvbpsi->p_decoder = NULL;
p_dvbpsi->pf_message = callback; p_dvbpsi->p_decoder = NULL;
p_dvbpsi->i_msg_level = level; p_dvbpsi->pf_message = callback;
} p_dvbpsi->i_msg_level = level;
return p_dvbpsi; return p_dvbpsi;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteHandle * dvbpsi_delete
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteHandle(dvbpsi_t *p_dvbpsi) void dvbpsi_delete(dvbpsi_t *p_dvbpsi)
{ {
assert(p_dvbpsi->p_decoder == NULL); assert(p_dvbpsi->p_decoder == NULL);
p_dvbpsi->pf_message = NULL; if (p_dvbpsi)
p_dvbpsi->pf_message = NULL;
free(p_dvbpsi); free(p_dvbpsi);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewDecoder * dvbpsi_decoder_new
*****************************************************************************/ *****************************************************************************/
#define DVBPSI_INVALID_CC (0xFF) #define DVBPSI_INVALID_CC (0xFF)
dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather, dvbpsi_decoder_t *dvbpsi_decoder_new(dvbpsi_callback_gather_t pf_gather,
const int i_section_max_size, const bool b_discontinuity, const size_t psi_size) const int i_section_max_size, const bool b_discontinuity, const size_t psi_size)
{ {
assert(psi_size >= sizeof(dvbpsi_decoder_t)); assert(psi_size >= sizeof(dvbpsi_decoder_t));
...@@ -197,9 +198,9 @@ dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather, ...@@ -197,9 +198,9 @@ dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_ReinitDecoder * dvbpsi_decoder_reset
*****************************************************************************/ *****************************************************************************/
void dvbpsi_ReInitDecoder(dvbpsi_decoder_t* p_decoder, const bool b_force) void dvbpsi_decoder_reset(dvbpsi_decoder_t* p_decoder, const bool b_force)
{ {
assert(p_decoder); assert(p_decoder);
...@@ -219,9 +220,9 @@ void dvbpsi_ReInitDecoder(dvbpsi_decoder_t* p_decoder, const bool b_force) ...@@ -219,9 +220,9 @@ void dvbpsi_ReInitDecoder(dvbpsi_decoder_t* p_decoder, const bool b_force)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_SectionsCompleteDecoder * dvbpsi_decoder_sections_completed
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_SectionsCompleteDecoder(dvbpsi_decoder_t* p_decoder) bool dvbpsi_decoder_sections_completed(dvbpsi_decoder_t* p_decoder)
{ {
assert(p_decoder); assert(p_decoder);
assert(p_decoder->i_last_section_number <= 255); assert(p_decoder->i_last_section_number <= 255);
...@@ -241,9 +242,9 @@ bool dvbpsi_SectionsCompleteDecoder(dvbpsi_decoder_t* p_decoder) ...@@ -241,9 +242,9 @@ bool dvbpsi_SectionsCompleteDecoder(dvbpsi_decoder_t* p_decoder)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_ChainSectionsDecoder * dvbpsi_decoder_sections_chain
*****************************************************************************/ *****************************************************************************/
void dvbpsi_ChainSectionsDecoder(dvbpsi_decoder_t *p_decoder) void dvbpsi_decoder_sections_chain(dvbpsi_decoder_t *p_decoder)
{ {
assert(p_decoder); assert(p_decoder);
assert(p_decoder->i_last_section_number <= 255); assert(p_decoder->i_last_section_number <= 255);
...@@ -257,9 +258,9 @@ void dvbpsi_ChainSectionsDecoder(dvbpsi_decoder_t *p_decoder) ...@@ -257,9 +258,9 @@ void dvbpsi_ChainSectionsDecoder(dvbpsi_decoder_t *p_decoder)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_AddSectionDecoder * dvbpsi_decoder_section_add
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AddSectionDecoder(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section) bool dvbpsi_decoder_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section)
{ {
assert(p_decoder); assert(p_decoder);
assert(p_section); assert(p_section);
...@@ -277,9 +278,9 @@ bool dvbpsi_AddSectionDecoder(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t ...@@ -277,9 +278,9 @@ bool dvbpsi_AddSectionDecoder(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteDecoder * dvbpsi_decoder_delete
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteDecoder(dvbpsi_decoder_t *p_decoder) void dvbpsi_decoder_delete(dvbpsi_decoder_t *p_decoder)
{ {
assert(p_decoder); assert(p_decoder);
...@@ -295,9 +296,9 @@ void dvbpsi_DeleteDecoder(dvbpsi_decoder_t *p_decoder) ...@@ -295,9 +296,9 @@ void dvbpsi_DeleteDecoder(dvbpsi_decoder_t *p_decoder)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_HasDecoder * dvbpsi_decoder_present
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_HasDecoder(dvbpsi_t *p_dvbpsi) bool dvbpsi_decoder_present(dvbpsi_t *p_dvbpsi)
{ {
if (p_dvbpsi && p_dvbpsi->p_decoder) if (p_dvbpsi && p_dvbpsi->p_decoder)
return true; return true;
...@@ -306,11 +307,11 @@ bool dvbpsi_HasDecoder(dvbpsi_t *p_dvbpsi) ...@@ -306,11 +307,11 @@ bool dvbpsi_HasDecoder(dvbpsi_t *p_dvbpsi)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_PushPacket * dvbpsi_packet_push
***************************************************************************** *****************************************************************************
* Injection of a TS packet into a PSI decoder. * Injection of a TS packet into a PSI decoder.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data) bool dvbpsi_packet_push(dvbpsi_t *p_dvbpsi, uint8_t* p_data)
{ {
uint8_t i_expected_counter; /* Expected continuity counter */ uint8_t i_expected_counter; /* Expected continuity counter */
dvbpsi_psi_section_t* p_section; /* Current section */ dvbpsi_psi_section_t* p_section; /* Current section */
...@@ -431,7 +432,7 @@ bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data) ...@@ -431,7 +432,7 @@ bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data)
p_decoder->b_complete_header = true; p_decoder->b_complete_header = true;
/* Compute p_section->i_length and update p_decoder->i_need */ /* Compute p_section->i_length and update p_decoder->i_need */
p_decoder->i_need = p_section->i_length p_decoder->i_need = p_section->i_length
= ((uint16_t)(p_section->p_data[1] & 0xf)) << 8 = ((uint16_t)(p_section->p_data[1] & 0xf)) << 8
| p_section->p_data[2]; | p_section->p_data[2];
/* Check that the section isn't too long */ /* Check that the section isn't too long */
if (p_decoder->i_need > p_decoder->i_section_max_size - 3) if (p_decoder->i_need > p_decoder->i_section_max_size - 3)
...@@ -476,7 +477,7 @@ bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data) ...@@ -476,7 +477,7 @@ bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data)
p_section->i_table_id = p_section->p_data[0]; p_section->i_table_id = p_section->p_data[0];
if (p_section->b_syntax_indicator) if (p_section->b_syntax_indicator)
{ {
p_section->i_extension = (p_section->p_data[3] << 8) p_section->i_extension = (p_section->p_data[3] << 8)
| p_section->p_data[4]; | p_section->p_data[4];
p_section->i_version = (p_section->p_data[5] & 0x3e) >> 1; p_section->i_version = (p_section->p_data[5] & 0x3e) >> 1;
p_section->b_current_next = p_section->p_data[5] & 0x1; p_section->b_current_next = p_section->p_data[5] & 0x1;
...@@ -565,7 +566,7 @@ bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data) ...@@ -565,7 +566,7 @@ bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data)
#define DVBPSI_MSG_FORMAT "libdvbpsi (%s): %s" #define DVBPSI_MSG_FORMAT "libdvbpsi (%s): %s"
#ifdef HAVE_VARIADIC_MACROS #ifdef HAVE_VARIADIC_MACROS
void message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char *fmt, ...) void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char *fmt, ...)
{ {
if ((dvbpsi->i_msg_level > DVBPSI_MSG_NONE) && if ((dvbpsi->i_msg_level > DVBPSI_MSG_NONE) &&
(level <= dvbpsi->i_msg_level)) (level <= dvbpsi->i_msg_level))
......
/***************************************************************************** /*****************************************************************************
* dvbpsi.h * dvbpsi.h
* Copyright (C) 2001-2011 VideoLAN * Copyright (C) 2001-2012 VideoLAN
* $Id$ * $Id$
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
/*! /*!
* \file <dvbpsi.h> * \file <dvbpsi.h>
* \author Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * \author Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* \brief Application interface for all DVB/PSI decoders. * \brief Application interface for all DVB/PSI decoders.
* *
* Application interface for all DVB/PSI decoders. The generic decoder * Application interface for all DVB/PSI decoders. The generic decoder
...@@ -76,12 +77,21 @@ typedef void (* dvbpsi_message_cb)(dvbpsi_t *handle, ...@@ -76,12 +77,21 @@ typedef void (* dvbpsi_message_cb)(dvbpsi_t *handle,
const dvbpsi_msg_level_t level, const dvbpsi_msg_level_t level,
const char* msg); const char* msg);
/*****************************************************************************
* dvbpsi_decoder_t
*****************************************************************************/
/*! /*!
* \typedef struct dvbpsi_decoder_s dvbpsi_decoder_t * \typedef struct dvbpsi_decoder_s dvbpsi_decoder_t
* \brief dvbpsi_decoder_t type definition. * \brief dvbpsi_decoder_t type definition.
*/ */
typedef struct dvbpsi_decoder_s dvbpsi_decoder_t; typedef struct dvbpsi_decoder_s dvbpsi_decoder_t;
/*!
* \def DVBPSI_DECODER(x)
* \brief Helper macro for casting a private decoder into a dvbpsi_decoder_t
*/
#define DVBPSI_DECODER(x) ((dvbpsi_decoder_t *)(x))
/***************************************************************************** /*****************************************************************************
* dvbpsi_t * dvbpsi_t
*****************************************************************************/ *****************************************************************************/
...@@ -112,10 +122,10 @@ struct dvbpsi_s ...@@ -112,10 +122,10 @@ struct dvbpsi_s
}; };
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewHandle * dvbpsi_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_t *dvbpsi_NewHandle(dvbpsi_message_cb callback, enum dvbpsi_msg_level level) * \fn dvbpsi_t *dvbpsi_new(dvbpsi_message_cb callback, enum dvbpsi_msg_level level)
* \brief Create a new dvbpsi_t handle to be used by PSI decoders or encoders * \brief Create a new dvbpsi_t handle to be used by PSI decoders or encoders
* \param callback message callback handler, if NULL then no errors, warnings * \param callback message callback handler, if NULL then no errors, warnings
* or debug messages will be sent to the caller application * or debug messages will be sent to the caller application
...@@ -123,29 +133,29 @@ struct dvbpsi_s ...@@ -123,29 +133,29 @@ struct dvbpsi_s
* \return pointer to dvbpsi_t malloced data * \return pointer to dvbpsi_t malloced data
* *
* Creates a handle to use with PSI decoder and encoder API functions. The * Creates a handle to use with PSI decoder and encoder API functions. The
* handle must be freed with dvbpsi_DeleteHandle(). * handle must be freed with dvbpsi_delete().
*/ */
dvbpsi_t *dvbpsi_NewHandle(dvbpsi_message_cb callback, enum dvbpsi_msg_level level); dvbpsi_t *dvbpsi_new(dvbpsi_message_cb callback, enum dvbpsi_msg_level level);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteHandle * dvbpsi_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DeleteHandle(dvbpsi_t *handle) * \fn void dvbpsi_delete(dvbpsi_t *p_dvbpsi)
* \brief Deletes a dvbpsi_t handle created with dvbpsi_NewHandle * \brief Deletes a dvbpsi_t handle created with dvbpsi_new
* \param handle pointer to dvbpsi_t malloced data * \param p_dvbpsi pointer to dvbpsi_t malloced data
* \return nothing * \return nothing
* *
* Delets a dvbpsi_t handle by calling free(handle). Make sure to detach any * Delets a dvbpsi_t handle by calling free(handle). Make sure to detach any
* decoder of encoder before deleting the dvbpsi handle. * decoder of encoder before deleting the dvbpsi handle.
*/ */
void dvbpsi_DeleteHandle(dvbpsi_t *handle); void dvbpsi_delete(dvbpsi_t *p_dvbpsi);
/***************************************************************************** /*****************************************************************************
* dvbpsi_PushPacket * dvbpsi_packet_push
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data) * \fn bool dvbpsi_packet_push(dvbpsi_t *p_dvbpsi, uint8_t* p_data)
* \brief Injection of a TS packet into a PSI decoder. * \brief Injection of a TS packet into a PSI decoder.
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
* \param p_data pointer to a 188 bytes playload of a TS packet * \param p_data pointer to a 188 bytes playload of a TS packet
...@@ -153,11 +163,10 @@ void dvbpsi_DeleteHandle(dvbpsi_t *handle); ...@@ -153,11 +163,10 @@ void dvbpsi_DeleteHandle(dvbpsi_t *handle);
* *
* Injection of a TS packet into a PSI decoder. * Injection of a TS packet into a PSI decoder.
*/ */
bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data); bool dvbpsi_packet_push(dvbpsi_t *p_dvbpsi, uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* The following definitions are just here to allow external decoders but * dvbpsi_psi_section_t
* shouldn't be used for any other purpose.
*****************************************************************************/ *****************************************************************************/
/*! /*!
...@@ -166,12 +175,6 @@ bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data); ...@@ -166,12 +175,6 @@ bool dvbpsi_PushPacket(dvbpsi_t *p_dvbpsi, uint8_t* p_data);
*/ */
typedef struct dvbpsi_psi_section_s dvbpsi_psi_section_t; typedef struct dvbpsi_psi_section_s dvbpsi_psi_section_t;
/*!
* \def DVBPSI_DECODER(x)
* \brief Helper macro for casting a private decoder into a dvbpsi_decoder_t
*/
#define DVBPSI_DECODER(x) ((dvbpsi_decoder_t *)(x))
/***************************************************************************** /*****************************************************************************
* dvbpsi_callback_gather_t * dvbpsi_callback_gather_t
*****************************************************************************/ *****************************************************************************/
...@@ -184,7 +187,7 @@ typedef void (* dvbpsi_callback_gather_t)(dvbpsi_t *p_dvbpsi, /*!< pointer to d ...@@ -184,7 +187,7 @@ typedef void (* dvbpsi_callback_gather_t)(dvbpsi_t *p_dvbpsi, /*!< pointer to d
dvbpsi_psi_section_t* p_section); /*!< pointer to psi section */ dvbpsi_psi_section_t* p_section); /*!< pointer to psi section */
/***************************************************************************** /*****************************************************************************
* dvbpsi_decoder_t * struct dvbpsi_decoder_s
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \struct dvbpsi_decoder_s * \struct dvbpsi_decoder_s
...@@ -211,10 +214,10 @@ struct dvbpsi_decoder_s ...@@ -211,10 +214,10 @@ struct dvbpsi_decoder_s
}; };
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewDecoder * dvbpsi_decoder_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather, * \fn dvbpsi_decoder_t *dvbpsi_decoder_new(dvbpsi_callback_gather_t pf_gather,
* const int i_section_max_size, const bool b_discontinuity, const size_t psi_size); * const int i_section_max_size, const bool b_discontinuity, const size_t psi_size);
* \brief Create a new dvbpsi_decoder_t. * \brief Create a new dvbpsi_decoder_t.
* \param pf_gather pointer to gather function for PSI decoder. * \param pf_gather pointer to gather function for PSI decoder.
...@@ -224,18 +227,18 @@ struct dvbpsi_decoder_s ...@@ -224,18 +227,18 @@ struct dvbpsi_decoder_s
* \return pointer to dvbpsi_decoder_t * \return pointer to dvbpsi_decoder_t
* *
* Creates a dvbpsi_decoder_t pointer to struct dvbpsi_decoder_s. It should be * Creates a dvbpsi_decoder_t pointer to struct dvbpsi_decoder_s. It should be
* delete with @see dvbpsi_DeleteDecoder() function. * delete with @see dvbpsi_decoder_delete() function.
*/ */
dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather, dvbpsi_decoder_t *dvbpsi_decoder_new(dvbpsi_callback_gather_t pf_gather,
const int i_section_max_size, const int i_section_max_size,
const bool b_discontinuity, const bool b_discontinuity,
const size_t psi_size); const size_t psi_size);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteDecoder * dvbpsi_decoder_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DeleteDecoder(dvbpsi_decoder_t *p_decoder); * \fn void dvbpsi_decoder_delete(dvbpsi_decoder_t *p_decoder);
* \brief Deletes decoder struct and frees its memory * \brief Deletes decoder struct and frees its memory
* \param p_decoder pointer to dvbpsi_decoder_t with decoder * \param p_decoder pointer to dvbpsi_decoder_t with decoder
* \return nothing * \return nothing
...@@ -243,60 +246,60 @@ dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather, ...@@ -243,60 +246,60 @@ dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather,
* Delets a dvbpsi_t handle by calling free(handle). Make sure to detach any * Delets a dvbpsi_t handle by calling free(handle). Make sure to detach any
* decoder of encoder before deleting the dvbpsi handle. * decoder of encoder before deleting the dvbpsi handle.
*/ */
void dvbpsi_DeleteDecoder(dvbpsi_decoder_t *p_decoder); void dvbpsi_decoder_delete(dvbpsi_decoder_t *p_decoder);
/***************************************************************************** /*****************************************************************************
* dvbpsi_ReinitDecoder * dvbpsi_decoder_reset
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_ReInitDecoder(dvbpsi_decoder_t* p_decoder, const bool b_force); * \fn void dvbpsi_decoder_reset(dvbpsi_decoder_t* p_decoder, const bool b_force);
* \brief Reinit a decoder. * \brief Resets a decoder internal state.
* \param p_decoder pointer to dvbpsi_decoder_t with decoder * \param p_decoder pointer to dvbpsi_decoder_t with decoder
* \param b_force If 'b_force' is true then dvbpsi_decoder_t::b_current_valid * \param b_force If 'b_force' is true then dvbpsi_decoder_t::b_current_valid
* is set to false, invalidating the current section. * is set to false, invalidating the current section.
* \return nothing * \return nothing
*/ */
void dvbpsi_ReInitDecoder(dvbpsi_decoder_t* p_decoder, const bool b_force); void dvbpsi_decoder_reset(dvbpsi_decoder_t* p_decoder, const bool b_force);
/***************************************************************************** /*****************************************************************************
* dvbpsi_SectionsCompleteDecoder * dvbpsi_decoder_sections_completed
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_SectionsCompleteDecoder(dvbpsi_decoder_t* p_decoder); * \fn bool dvbpsi_decoder_sections_completed(dvbpsi_decoder_t* p_decoder);
* \brief Have all sections for this decoder been received. * \brief Have all sections for this decoder been received?
* \param p_decoder pointer to dvbpsi_decoder_t with decoder * \param p_decoder pointer to dvbpsi_decoder_t with decoder
* \return true when all PSI sections have been received, false otherwise * \return true when all PSI sections have been received, false otherwise
*/ */
bool dvbpsi_SectionsCompleteDecoder(dvbpsi_decoder_t* p_decoder); bool dvbpsi_decoder_sections_completed(dvbpsi_decoder_t* p_decoder);
/***************************************************************************** /*****************************************************************************
* dvbpsi_ChainSectionsDecoder * dvbpsi_decoder_sections_chain
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_ChainSectionsDecoder(dvbpsi_decoder_t *p_decoder); * \fn void dvbpsi_decoder_sections_chain(dvbpsi_decoder_t *p_decoder);
* \brief Chain the sections if the last has been received. * \brief Chain the sections if the last has been received.
* \param p_decoder pointer to dvbpsi_decoder_t with decoder * \param p_decoder pointer to dvbpsi_decoder_t with decoder
* \return nothing * \return nothing
*/ */
void dvbpsi_ChainSectionsDecoder(dvbpsi_decoder_t *p_decoder); void dvbpsi_decoder_sections_chain(dvbpsi_decoder_t *p_decoder);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AddSectionDecoder * dvbpsi_decoder_section_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AddSectionDecoder(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section); * \fn bool dvbpsi_decoder_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section);
* \brief Add a section to the dvbpsi_decoder_t::ap_sections[] array. * \brief Add a section to the dvbpsi_decoder_t::ap_sections[] array.
* \param p_decoder pointer to dvbpsi_decoder_t with decoder * \param p_decoder pointer to dvbpsi_decoder_t with decoder
* \param p_section PSI section to add to dvbpsi_decoder_t::ap_sections[] array * \param p_section PSI section to add to dvbpsi_decoder_t::ap_sections[] array
* \return true if it overwrites a earlier section, false otherwise * \return true if it overwrites a earlier section, false otherwise
*/ */
bool dvbpsi_AddSectionDecoder(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section); bool dvbpsi_decoder_section_add(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t *p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_HasDecoder * dvbpsi_decoder_present
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_HasDecoder(dvbpsi_t *p_dvbpsi); * \fn bool dvbpsi_decoder_present(dvbpsi_t *p_dvbpsi);
* \brief Determines if a decoder has been attached to dvbpsi_t handle * \brief Determines if a decoder has been attached to dvbpsi_t handle
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
* \return true when decoder is attached, else it will return false. * \return true when decoder is attached, else it will return false.
...@@ -304,8 +307,17 @@ bool dvbpsi_AddSectionDecoder(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t ...@@ -304,8 +307,17 @@ bool dvbpsi_AddSectionDecoder(dvbpsi_decoder_t *p_decoder, dvbpsi_psi_section_t
* Determines if a decoder is attached to this dvbpsi_t handle. When the dvbpsi * Determines if a decoder is attached to this dvbpsi_t handle. When the dvbpsi
* handle is invalid the fuction will return false. * handle is invalid the fuction will return false.
*/ */
bool dvbpsi_HasDecoder(dvbpsi_t *p_dvbpsi); bool dvbpsi_decoder_present(dvbpsi_t *p_dvbpsi);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
typedef struct dvbpsi_decoder_s * dvbpsi_handle;// __attribute__((deprecated));
/* dvbpsi.h */
__attribute__((deprecated))
void dvbpsi_PushPacket(dvbpsi_handle h_dvbpsi, uint8_t* p_data);
#define dvbpsi_PushPacket(h,p) dvbpsi_packet_push(h,p)dvbpsi_handle
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
/***************************************************************************** /*****************************************************************************
* dvbpsi_private.h: main private header * dvbpsi_private.h: main private header
*---------------------------------------------------------------------------- *----------------------------------------------------------------------------
* Copyright (C) 2001-2010 VideoLAN * Copyright (C) 2001-2012 VideoLAN
* $Id$ * $Id$
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
...@@ -42,7 +42,7 @@ extern uint32_t dvbpsi_crc32_table[]; ...@@ -42,7 +42,7 @@ extern uint32_t dvbpsi_crc32_table[];
*****************************************************************************/ *****************************************************************************/
#ifdef HAVE_VARIADIC_MACROS #ifdef HAVE_VARIADIC_MACROS
void message(dvbpsi_t *dvbpsi, const int level, const char *fmt, ...); void dvbpsi_message(dvbpsi_t *dvbpsi, const int level, const char *fmt, ...);
# define dvbpsi_error(hnd, src, str, x...) \ # define dvbpsi_error(hnd, src, str, x...) \
message(hnd, DVBPSI_MSG_ERROR, "libdvbpsi error ("src"): " str, ##x) message(hnd, DVBPSI_MSG_ERROR, "libdvbpsi error ("src"): " str, ##x)
......
...@@ -97,7 +97,7 @@ bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -97,7 +97,7 @@ bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
} }
dvbpsi_atsc_eit_decoder_t* p_eit_decoder; dvbpsi_atsc_eit_decoder_t* p_eit_decoder;
p_eit_decoder = (dvbpsi_atsc_eit_decoder_t*) dvbpsi_NewDecoder(NULL, p_eit_decoder = (dvbpsi_atsc_eit_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_atsc_eit_decoder_t)); 0, true, sizeof(dvbpsi_atsc_eit_decoder_t));
if (p_eit_decoder == NULL) if (p_eit_decoder == NULL)
return false; return false;
...@@ -107,7 +107,7 @@ bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -107,7 +107,7 @@ bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
dvbpsi_atsc_GatherEITSections, DVBPSI_DECODER(p_eit_decoder)); dvbpsi_atsc_GatherEITSections, DVBPSI_DECODER(p_eit_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_eit_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_eit_decoder));
return false; return false;
} }
...@@ -290,7 +290,7 @@ static void dvbpsi_ReInitEIT(dvbpsi_atsc_eit_decoder_t *p_decoder, const bool b_ ...@@ -290,7 +290,7 @@ static void dvbpsi_ReInitEIT(dvbpsi_atsc_eit_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
...@@ -359,7 +359,7 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_eit_decoder_t * ...@@ -359,7 +359,7 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_eit_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC EIT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC EIT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -458,7 +458,7 @@ static void dvbpsi_atsc_GatherEITSections(dvbpsi_t * p_dvbpsi, ...@@ -458,7 +458,7 @@ static void dvbpsi_atsc_GatherEITSections(dvbpsi_t * p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_eit_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_eit_decoder)))
{ {
assert(p_eit_decoder->pf_eit_callback); assert(p_eit_decoder->pf_eit_callback);
...@@ -466,7 +466,7 @@ static void dvbpsi_atsc_GatherEITSections(dvbpsi_t * p_dvbpsi, ...@@ -466,7 +466,7 @@ static void dvbpsi_atsc_GatherEITSections(dvbpsi_t * p_dvbpsi,
p_eit_decoder->current_eit = *p_eit_decoder->p_building_eit; p_eit_decoder->current_eit = *p_eit_decoder->p_building_eit;
p_eit_decoder->b_current_valid = true; p_eit_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_eit_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_eit_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_atsc_DecodeEITSections(p_eit_decoder->p_building_eit, dvbpsi_atsc_DecodeEITSections(p_eit_decoder->p_building_eit,
p_eit_decoder->ap_sections[0]); p_eit_decoder->ap_sections[0]);
......
...@@ -109,7 +109,7 @@ bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -109,7 +109,7 @@ bool dvbpsi_atsc_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_atsc_eit_callback pf_callback, void* p_cb_data); uint16_t i_extension, dvbpsi_atsc_eit_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachEIT * dvbpsi_eit_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_atsc_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn void dvbpsi_atsc_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
......
...@@ -100,7 +100,7 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e ...@@ -100,7 +100,7 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
} }
dvbpsi_atsc_ett_decoder_t* p_ett_decoder; dvbpsi_atsc_ett_decoder_t* p_ett_decoder;
p_ett_decoder = (dvbpsi_atsc_ett_decoder_t*) dvbpsi_NewDecoder(NULL, p_ett_decoder = (dvbpsi_atsc_ett_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_atsc_ett_decoder_t)); 0, true, sizeof(dvbpsi_atsc_ett_decoder_t));
if (p_ett_decoder == NULL) if (p_ett_decoder == NULL)
return false; return false;
...@@ -111,7 +111,7 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e ...@@ -111,7 +111,7 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
dvbpsi_atsc_GatherETTSections, DVBPSI_DECODER(p_ett_decoder)); dvbpsi_atsc_GatherETTSections, DVBPSI_DECODER(p_ett_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_ett_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_ett_decoder));
return false; return false;
} }
...@@ -228,7 +228,7 @@ static void dvbpsi_ReInitETT(dvbpsi_atsc_ett_decoder_t *p_decoder, const bool b_ ...@@ -228,7 +228,7 @@ static void dvbpsi_ReInitETT(dvbpsi_atsc_ett_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
...@@ -303,7 +303,7 @@ static bool dvbpsi_AddSectionETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t * ...@@ -303,7 +303,7 @@ static bool dvbpsi_AddSectionETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC ETT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC ETT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -380,7 +380,7 @@ static void dvbpsi_atsc_GatherETTSections(dvbpsi_t* p_dvbpsi, ...@@ -380,7 +380,7 @@ static void dvbpsi_atsc_GatherETTSections(dvbpsi_t* p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_ett_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_ett_decoder)))
{ {
assert(p_ett_decoder->pf_ett_callback); assert(p_ett_decoder->pf_ett_callback);
...@@ -388,7 +388,7 @@ static void dvbpsi_atsc_GatherETTSections(dvbpsi_t* p_dvbpsi, ...@@ -388,7 +388,7 @@ static void dvbpsi_atsc_GatherETTSections(dvbpsi_t* p_dvbpsi,
p_ett_decoder->current_ett = *p_ett_decoder->p_building_ett; p_ett_decoder->current_ett = *p_ett_decoder->p_building_ett;
p_ett_decoder->b_current_valid = true; p_ett_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_ett_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_ett_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_atsc_DecodeETTSections(p_ett_decoder->p_building_ett, dvbpsi_atsc_DecodeETTSections(p_ett_decoder->p_building_ett,
p_ett_decoder->ap_sections[0]); p_ett_decoder->ap_sections[0]);
......
...@@ -101,7 +101,7 @@ bool dvbpsi_atsc_AttachMGT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -101,7 +101,7 @@ bool dvbpsi_atsc_AttachMGT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
} }
dvbpsi_atsc_mgt_decoder_t* p_mgt_decoder; dvbpsi_atsc_mgt_decoder_t* p_mgt_decoder;
p_mgt_decoder = (dvbpsi_atsc_mgt_decoder_t*) dvbpsi_NewDecoder(NULL, p_mgt_decoder = (dvbpsi_atsc_mgt_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_atsc_mgt_decoder_t)); 0, true, sizeof(dvbpsi_atsc_mgt_decoder_t));
if(p_mgt_decoder == NULL) if(p_mgt_decoder == NULL)
return false; return false;
...@@ -111,7 +111,7 @@ bool dvbpsi_atsc_AttachMGT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -111,7 +111,7 @@ bool dvbpsi_atsc_AttachMGT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
dvbpsi_atsc_GatherMGTSections, DVBPSI_DECODER(p_mgt_decoder)); dvbpsi_atsc_GatherMGTSections, DVBPSI_DECODER(p_mgt_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_mgt_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_mgt_decoder));
return false; return false;
} }
...@@ -320,7 +320,7 @@ static void dvbpsi_ReInitMGT(dvbpsi_atsc_mgt_decoder_t *p_decoder, const bool b_ ...@@ -320,7 +320,7 @@ static void dvbpsi_ReInitMGT(dvbpsi_atsc_mgt_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
...@@ -389,7 +389,7 @@ static bool dvbpsi_AddSectionMGT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_mgt_decoder_t * ...@@ -389,7 +389,7 @@ static bool dvbpsi_AddSectionMGT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_mgt_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC MGT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC MGT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
return true; return true;
...@@ -487,7 +487,7 @@ static void dvbpsi_atsc_GatherMGTSections(dvbpsi_t * p_dvbpsi, ...@@ -487,7 +487,7 @@ static void dvbpsi_atsc_GatherMGTSections(dvbpsi_t * p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_mgt_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_mgt_decoder)))
{ {
assert(p_mgt_decoder->pf_mgt_callback); assert(p_mgt_decoder->pf_mgt_callback);
...@@ -495,7 +495,7 @@ static void dvbpsi_atsc_GatherMGTSections(dvbpsi_t * p_dvbpsi, ...@@ -495,7 +495,7 @@ static void dvbpsi_atsc_GatherMGTSections(dvbpsi_t * p_dvbpsi,
p_mgt_decoder->current_mgt = *p_mgt_decoder->p_building_mgt; p_mgt_decoder->current_mgt = *p_mgt_decoder->p_building_mgt;
p_mgt_decoder->b_current_valid = true; p_mgt_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_mgt_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_mgt_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_atsc_DecodeMGTSections(p_mgt_decoder->p_building_mgt, dvbpsi_atsc_DecodeMGTSections(p_mgt_decoder->p_building_mgt,
p_mgt_decoder->ap_sections[0]); p_mgt_decoder->ap_sections[0]);
......
...@@ -86,7 +86,7 @@ bool dvbpsi_atsc_AttachSTT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -86,7 +86,7 @@ bool dvbpsi_atsc_AttachSTT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
} }
dvbpsi_atsc_stt_decoder_t* p_stt_decoder; dvbpsi_atsc_stt_decoder_t* p_stt_decoder;
p_stt_decoder = (dvbpsi_atsc_stt_decoder_t*) dvbpsi_NewDecoder(NULL, p_stt_decoder = (dvbpsi_atsc_stt_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_atsc_stt_decoder_t)); 0, true, sizeof(dvbpsi_atsc_stt_decoder_t));
if (p_stt_decoder == NULL) if (p_stt_decoder == NULL)
return false; return false;
...@@ -97,7 +97,7 @@ bool dvbpsi_atsc_AttachSTT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -97,7 +97,7 @@ bool dvbpsi_atsc_AttachSTT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
dvbpsi_atsc_GatherSTTSections, DVBPSI_DECODER(p_stt_decoder)); dvbpsi_atsc_GatherSTTSections, DVBPSI_DECODER(p_stt_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_stt_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_stt_decoder));
return false; return false;
} }
...@@ -229,7 +229,7 @@ static void dvbpsi_ReInitSTT(dvbpsi_atsc_stt_decoder_t *p_decoder, const bool b_ ...@@ -229,7 +229,7 @@ static void dvbpsi_ReInitSTT(dvbpsi_atsc_stt_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
...@@ -288,7 +288,7 @@ static bool dvbpsi_AddSectionSTT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_stt_decoder_t * ...@@ -288,7 +288,7 @@ static bool dvbpsi_AddSectionSTT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_stt_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC STT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC STT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -387,7 +387,7 @@ static void dvbpsi_atsc_GatherSTTSections(dvbpsi_t *p_dvbpsi, ...@@ -387,7 +387,7 @@ static void dvbpsi_atsc_GatherSTTSections(dvbpsi_t *p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_stt_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_stt_decoder)))
{ {
assert(p_stt_decoder->pf_stt_callback); assert(p_stt_decoder->pf_stt_callback);
...@@ -396,7 +396,7 @@ static void dvbpsi_atsc_GatherSTTSections(dvbpsi_t *p_dvbpsi, ...@@ -396,7 +396,7 @@ static void dvbpsi_atsc_GatherSTTSections(dvbpsi_t *p_dvbpsi,
p_stt_decoder->b_current_valid = true; p_stt_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_stt_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_stt_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_atsc_DecodeSTTSections(p_stt_decoder->p_building_stt, dvbpsi_atsc_DecodeSTTSections(p_stt_decoder->p_building_stt,
p_stt_decoder->ap_sections[0]); p_stt_decoder->ap_sections[0]);
......
...@@ -110,7 +110,7 @@ bool dvbpsi_atsc_AttachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -110,7 +110,7 @@ bool dvbpsi_atsc_AttachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
} }
dvbpsi_atsc_vct_decoder_t* p_vct_decoder; dvbpsi_atsc_vct_decoder_t* p_vct_decoder;
p_vct_decoder = (dvbpsi_atsc_vct_decoder_t*) dvbpsi_NewDecoder(NULL, p_vct_decoder = (dvbpsi_atsc_vct_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_atsc_vct_decoder_t)); 0, true, sizeof(dvbpsi_atsc_vct_decoder_t));
if (p_vct_decoder == NULL) if (p_vct_decoder == NULL)
return false; return false;
...@@ -121,7 +121,7 @@ bool dvbpsi_atsc_AttachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex ...@@ -121,7 +121,7 @@ bool dvbpsi_atsc_AttachVCT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
dvbpsi_atsc_GatherVCTSections, DVBPSI_DECODER(p_vct_decoder)); dvbpsi_atsc_GatherVCTSections, DVBPSI_DECODER(p_vct_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_vct_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_vct_decoder));
return false; return false;
} }
...@@ -359,7 +359,7 @@ static void dvbpsi_ReInitVCT(dvbpsi_atsc_vct_decoder_t *p_decoder, const bool b_ ...@@ -359,7 +359,7 @@ static void dvbpsi_ReInitVCT(dvbpsi_atsc_vct_decoder_t *p_decoder, const bool b_
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
...@@ -427,7 +427,7 @@ static bool dvbpsi_AddSectionVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t * ...@@ -427,7 +427,7 @@ static bool dvbpsi_AddSectionVCT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_vct_decoder_t *
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_vct_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_vct_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "ATSC VCT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "ATSC VCT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -524,7 +524,7 @@ static void dvbpsi_atsc_GatherVCTSections(dvbpsi_t *p_dvbpsi, ...@@ -524,7 +524,7 @@ static void dvbpsi_atsc_GatherVCTSections(dvbpsi_t *p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_vct_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_vct_decoder)))
{ {
assert(p_vct_decoder->pf_vct_callback); assert(p_vct_decoder->pf_vct_callback);
...@@ -533,7 +533,7 @@ static void dvbpsi_atsc_GatherVCTSections(dvbpsi_t *p_dvbpsi, ...@@ -533,7 +533,7 @@ static void dvbpsi_atsc_GatherVCTSections(dvbpsi_t *p_dvbpsi,
p_vct_decoder->b_current_valid = true; p_vct_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_vct_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_vct_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_atsc_DecodeVCTSections(p_vct_decoder->p_building_vct, dvbpsi_atsc_DecodeVCTSections(p_vct_decoder->p_building_vct,
p_vct_decoder->ap_sections[0]); p_vct_decoder->ap_sections[0]);
......
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
#include "bat_private.h" #include "bat_private.h"
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachBAT * dvbpsi_bat_attach
***************************************************************************** *****************************************************************************
* Initialize a BAT subtable decoder. * Initialize a BAT subtable decoder.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_bat_callback pf_callback, void* p_cb_data) uint16_t i_extension, dvbpsi_bat_callback pf_callback, void* p_cb_data)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -72,18 +72,18 @@ bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -72,18 +72,18 @@ bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
} }
dvbpsi_bat_decoder_t* p_bat_decoder; dvbpsi_bat_decoder_t* p_bat_decoder;
p_bat_decoder = (dvbpsi_bat_decoder_t*) dvbpsi_NewDecoder(NULL, p_bat_decoder = (dvbpsi_bat_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_bat_decoder_t)); 0, true, sizeof(dvbpsi_bat_decoder_t));
if (p_bat_decoder == NULL) if (p_bat_decoder == NULL)
return false; return false;
/* subtable decoder configuration */ /* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachBAT, p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_bat_detach,
dvbpsi_GatherBATSections, DVBPSI_DECODER(p_bat_decoder)); dvbpsi_bat_sections_gather, DVBPSI_DECODER(p_bat_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_bat_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_bat_decoder));
return false; return false;
} }
...@@ -99,11 +99,11 @@ bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -99,11 +99,11 @@ bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachBAT * dvbpsi_bat_detach
***************************************************************************** *****************************************************************************
* Close a BAT decoder. * Close a BAT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension) void dvbpsi_bat_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -124,7 +124,7 @@ void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -124,7 +124,7 @@ void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
dvbpsi_bat_decoder_t* p_bat_decoder; dvbpsi_bat_decoder_t* p_bat_decoder;
p_bat_decoder = (dvbpsi_bat_decoder_t*)p_subdec->p_decoder; p_bat_decoder = (dvbpsi_bat_decoder_t*)p_subdec->p_decoder;
if (p_bat_decoder->p_building_bat) if (p_bat_decoder->p_building_bat)
dvbpsi_DeleteBAT(p_bat_decoder->p_building_bat); dvbpsi_bat_delete(p_bat_decoder->p_building_bat);
p_bat_decoder->p_building_bat = NULL; p_bat_decoder->p_building_bat = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec); dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
...@@ -132,11 +132,11 @@ void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -132,11 +132,11 @@ void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitBAT * dvbpsi_bat_init
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_bat_t structure. * Initialize a pre-allocated dvbpsi_bat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitBAT(dvbpsi_bat_t* p_bat, uint16_t i_bouquet_id, uint8_t i_version, void dvbpsi_bat_init(dvbpsi_bat_t* p_bat, uint16_t i_bouquet_id, uint8_t i_version,
bool b_current_next) bool b_current_next)
{ {
assert(p_bat); assert(p_bat);
...@@ -148,25 +148,25 @@ void dvbpsi_InitBAT(dvbpsi_bat_t* p_bat, uint16_t i_bouquet_id, uint8_t i_versio ...@@ -148,25 +148,25 @@ void dvbpsi_InitBAT(dvbpsi_bat_t* p_bat, uint16_t i_bouquet_id, uint8_t i_versio
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewBAT * dvbpsi_bat_new
***************************************************************************** *****************************************************************************
* Allocate and initialize a dvbpsi_bat_t structure. * Allocate and initialize a dvbpsi_bat_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_bat_t *dvbpsi_NewBAT(uint16_t i_bouquet_id, uint8_t i_version, dvbpsi_bat_t *dvbpsi_bat_new(uint16_t i_bouquet_id, uint8_t i_version,
bool b_current_next) bool b_current_next)
{ {
dvbpsi_bat_t *p_bat = (dvbpsi_bat_t*)malloc(sizeof(dvbpsi_bat_t)); dvbpsi_bat_t *p_bat = (dvbpsi_bat_t*)malloc(sizeof(dvbpsi_bat_t));
if(p_bat != NULL) if(p_bat != NULL)
dvbpsi_InitBAT(p_bat, i_bouquet_id, i_version, b_current_next); dvbpsi_bat_init(p_bat, i_bouquet_id, i_version, b_current_next);
return p_bat; return p_bat;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyBAT * dvbpsi_bat_empty
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_bat_t structure. * Clean a dvbpsi_bat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_EmptyBAT(dvbpsi_bat_t* p_bat) void dvbpsi_bat_empty(dvbpsi_bat_t* p_bat)
{ {
dvbpsi_bat_ts_t* p_ts = p_bat->p_first_ts; dvbpsi_bat_ts_t* p_ts = p_bat->p_first_ts;
...@@ -184,23 +184,23 @@ void dvbpsi_EmptyBAT(dvbpsi_bat_t* p_bat) ...@@ -184,23 +184,23 @@ void dvbpsi_EmptyBAT(dvbpsi_bat_t* p_bat)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteBAT * dvbpsi_bat_delete
***************************************************************************** *****************************************************************************
* Empty and Delere a dvbpsi_bat_t structure. * Empty and Delere a dvbpsi_bat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteBAT(dvbpsi_bat_t *p_bat) void dvbpsi_bat_delete(dvbpsi_bat_t *p_bat)
{ {
if (p_bat) if (p_bat)
dvbpsi_EmptyBAT(p_bat); dvbpsi_bat_empty(p_bat);
free(p_bat); free(p_bat);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_BATAddTS * dvbpsi_bat_ts_add
***************************************************************************** *****************************************************************************
* Add a TS description at the end of the BAT. * Add a TS description at the end of the BAT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_bat_ts_t *dvbpsi_BATAddTS(dvbpsi_bat_t* p_bat, dvbpsi_bat_ts_t *dvbpsi_bat_ts_add(dvbpsi_bat_t* p_bat,
uint16_t i_ts_id, uint16_t i_orig_network_id) uint16_t i_ts_id, uint16_t i_orig_network_id)
{ {
dvbpsi_bat_ts_t * p_ts dvbpsi_bat_ts_t * p_ts
...@@ -227,12 +227,12 @@ dvbpsi_bat_ts_t *dvbpsi_BATAddTS(dvbpsi_bat_t* p_bat, ...@@ -227,12 +227,12 @@ dvbpsi_bat_ts_t *dvbpsi_BATAddTS(dvbpsi_bat_t* p_bat,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_BATBouquetAddDescriptor * dvbpsi_bat_bouquet_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the BAT Bouquet descriptors (the first loop description), * Add a descriptor in the BAT Bouquet descriptors (the first loop description),
* which is in the first loop of BAT. * which is in the first loop of BAT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t *dvbpsi_BATBouquetAddDescriptor( dvbpsi_descriptor_t *dvbpsi_bat_bouquet_descriptor_add(
dvbpsi_bat_t *p_bat, dvbpsi_bat_t *p_bat,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data) uint8_t *p_data)
...@@ -252,12 +252,11 @@ dvbpsi_descriptor_t *dvbpsi_BATBouquetAddDescriptor( ...@@ -252,12 +252,11 @@ dvbpsi_descriptor_t *dvbpsi_BATBouquetAddDescriptor(
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_BATTSAddDescriptor * dvbpsi_bat_ts_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the BAT TS descriptors, which is in the second loop of BAT. * Add a descriptor in the BAT TS descriptors, which is in the second loop of BAT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t *dvbpsi_BATTSAddDescriptor( dvbpsi_descriptor_t *dvbpsi_bat_ts_descriptor_add(dvbpsi_bat_ts_t *p_ts,
dvbpsi_bat_ts_t *p_ts,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data) uint8_t *p_data)
{ {
...@@ -283,14 +282,14 @@ static void dvbpsi_ReInitBAT(dvbpsi_bat_decoder_t* p_decoder, const bool b_force ...@@ -283,14 +282,14 @@ static void dvbpsi_ReInitBAT(dvbpsi_bat_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
/* Free structures */ /* Free structures */
if (p_decoder->p_building_bat) if (p_decoder->p_building_bat)
dvbpsi_DeleteBAT(p_decoder->p_building_bat); dvbpsi_bat_delete(p_decoder->p_building_bat);
} }
p_decoder->p_building_bat = NULL; p_decoder->p_building_bat = NULL;
} }
...@@ -339,7 +338,7 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat ...@@ -339,7 +338,7 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_bat_decoder->p_building_bat) if (!p_bat_decoder->p_building_bat)
{ {
p_bat_decoder->p_building_bat = dvbpsi_NewBAT(p_section->i_extension, p_bat_decoder->p_building_bat = dvbpsi_bat_new(p_section->i_extension,
p_section->i_version, p_section->b_current_next); p_section->i_version, p_section->b_current_next);
if (p_bat_decoder->p_building_bat) if (p_bat_decoder->p_building_bat)
return false; return false;
...@@ -348,7 +347,7 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat ...@@ -348,7 +347,7 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_bat_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_bat_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "BAT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "BAT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -356,11 +355,11 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat ...@@ -356,11 +355,11 @@ static bool dvbpsi_AddSectionBAT(dvbpsi_t *p_dvbpsi, dvbpsi_bat_decoder_t *p_bat
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherBATSections * dvbpsi_bat_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the subtable demultiplexor. * Callback for the subtable demultiplexor.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherBATSections(dvbpsi_t *p_dvbpsi, void dvbpsi_bat_sections_gather(dvbpsi_t *p_dvbpsi,
dvbpsi_decoder_t *p_decoder, dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t * p_section) dvbpsi_psi_section_t * p_section)
{ {
...@@ -436,7 +435,7 @@ void dvbpsi_GatherBATSections(dvbpsi_t *p_dvbpsi, ...@@ -436,7 +435,7 @@ void dvbpsi_GatherBATSections(dvbpsi_t *p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_bat_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_bat_decoder)))
{ {
assert(p_bat_decoder->pf_bat_callback); assert(p_bat_decoder->pf_bat_callback);
...@@ -444,9 +443,9 @@ void dvbpsi_GatherBATSections(dvbpsi_t *p_dvbpsi, ...@@ -444,9 +443,9 @@ void dvbpsi_GatherBATSections(dvbpsi_t *p_dvbpsi,
p_bat_decoder->current_bat = *p_bat_decoder->p_building_bat; p_bat_decoder->current_bat = *p_bat_decoder->p_building_bat;
p_bat_decoder->b_current_valid = true; p_bat_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_bat_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_bat_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodeBATSections(p_bat_decoder->p_building_bat, dvbpsi_bat_sections_decode(p_bat_decoder->p_building_bat,
p_bat_decoder->ap_sections[0]); p_bat_decoder->ap_sections[0]);
/* Delete the sections */ /* Delete the sections */
dvbpsi_DeletePSISections(p_bat_decoder->ap_sections[0]); dvbpsi_DeletePSISections(p_bat_decoder->ap_sections[0]);
...@@ -467,7 +466,7 @@ void dvbpsi_GatherBATSections(dvbpsi_t *p_dvbpsi, ...@@ -467,7 +466,7 @@ void dvbpsi_GatherBATSections(dvbpsi_t *p_dvbpsi,
* p_section as the input parameter * p_section as the input parameter
* similar to dvbpsi_DecodeNITSection * similar to dvbpsi_DecodeNITSection
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat, void dvbpsi_bat_sections_decode(dvbpsi_bat_t* p_bat,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
uint8_t* p_byte, * p_end, * p_end2; uint8_t* p_byte, * p_end, * p_end2;
...@@ -484,7 +483,7 @@ void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat, ...@@ -484,7 +483,7 @@ void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if(i_length + 2 <= p_end - p_byte) if(i_length + 2 <= p_end - p_byte)
dvbpsi_BATBouquetAddDescriptor(p_bat, i_tag, i_length, p_byte + 2); dvbpsi_bat_bouquet_descriptor_add(p_bat, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
...@@ -502,7 +501,7 @@ void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat, ...@@ -502,7 +501,7 @@ void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat,
uint16_t i_ts_id = ((uint16_t)p_byte[0] << 8) | p_byte[1]; uint16_t i_ts_id = ((uint16_t)p_byte[0] << 8) | p_byte[1];
uint16_t i_orig_network_id = ((uint16_t)p_byte[2] << 8) | p_byte[3]; uint16_t i_orig_network_id = ((uint16_t)p_byte[2] << 8) | p_byte[3];
uint16_t i_transport_descriptors_length = ((uint16_t)(p_byte[4] & 0x0f) << 8) | p_byte[5]; uint16_t i_transport_descriptors_length = ((uint16_t)(p_byte[4] & 0x0f) << 8) | p_byte[5];
dvbpsi_bat_ts_t* p_ts = dvbpsi_BATAddTS(p_bat, i_ts_id, i_orig_network_id); dvbpsi_bat_ts_t* p_ts = dvbpsi_bat_ts_add(p_bat, i_ts_id, i_orig_network_id);
/* - TS descriptors */ /* - TS descriptors */
p_byte += 6; p_byte += 6;
p_end2 = p_byte + i_transport_descriptors_length; p_end2 = p_byte + i_transport_descriptors_length;
...@@ -515,7 +514,7 @@ void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat, ...@@ -515,7 +514,7 @@ void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if(i_length + 2 <= p_end2 - p_byte) if(i_length + 2 <= p_end2 - p_byte)
dvbpsi_BATTSAddDescriptor(p_ts, i_tag, i_length, p_byte + 2); dvbpsi_bat_ts_descriptor_add(p_ts, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
} }
...@@ -525,12 +524,12 @@ void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat, ...@@ -525,12 +524,12 @@ void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenBATSections * dvbpsi_bat_sections_generate
***************************************************************************** *****************************************************************************
* Generate BAT sections based on the dvbpsi_bat_t structure. * Generate BAT sections based on the dvbpsi_bat_t structure.
* similar to dvbpsi_GenNITSections * similar to dvbpsi_nit_sections_generate
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t* dvbpsi_GenBATSections(dvbpsi_t *p_dvbpsi, dvbpsi_bat_t* p_bat) dvbpsi_psi_section_t* dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_bat_t* p_bat)
{ {
dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024); dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024);
dvbpsi_psi_section_t* p_current = p_result; dvbpsi_psi_section_t* p_current = p_result;
......
...@@ -112,10 +112,10 @@ typedef struct dvbpsi_bat_s ...@@ -112,10 +112,10 @@ typedef struct dvbpsi_bat_s
typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat); typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachBAT * dvbpsi_bat_attach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_bat_callback pf_callback, uint16_t i_extension, dvbpsi_bat_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a BAT decoder. It will be attached to p_dvbpsi. * \brief Creation and initialization of a BAT decoder. It will be attached to p_dvbpsi.
...@@ -126,15 +126,15 @@ typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat); ...@@ -126,15 +126,15 @@ typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat);
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_bat_callback pf_callback, uint16_t i_extension, dvbpsi_bat_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachBAT * dvbpsi_bat_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn void dvbpsi_bat_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a BAT decoder. * \brief Destroy a BAT decoder.
* \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached.
...@@ -142,14 +142,14 @@ bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -142,14 +142,14 @@ bool dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
* \param i_extension Table ID extension, here bouquet ID. * \param i_extension Table ID extension, here bouquet ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, void dvbpsi_bat_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension); uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitBAT/dvbpsi_NewBAT * dvbpsi_bat_init/dvbpsi_bat_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_InitBAT(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_version, * \fn void dvbpsi_bat_init(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_version,
bool b_current_next) bool b_current_next)
* \brief Initialize a user-allocated dvbpsi_bat_t structure. * \brief Initialize a user-allocated dvbpsi_bat_t structure.
* \param p_bat pointer to the BAT structure * \param p_bat pointer to the BAT structure
...@@ -158,11 +158,11 @@ void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -158,11 +158,11 @@ void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_InitBAT(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_version, void dvbpsi_bat_init(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_version,
bool b_current_next); bool b_current_next);
/*! /*!
* \fn dvbpsi_bat_t *dvbpsi_NewBAT(uint16_t i_bouquet_id, uint8_t i_version, * \fn dvbpsi_bat_t *dvbpsi_bat_new(uint16_t i_bouquet_id, uint8_t i_version,
* bool b_current_next) * bool b_current_next)
* \brief Allocate and initialize a new dvbpsi_bat_t structure. * \brief Allocate and initialize a new dvbpsi_bat_t structure.
* \param i_bouquet_id bouquet ID * \param i_bouquet_id bouquet ID
...@@ -170,19 +170,19 @@ void dvbpsi_InitBAT(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_versio ...@@ -170,19 +170,19 @@ void dvbpsi_InitBAT(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_versio
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return p_bat pointer to the BAT structure * \return p_bat pointer to the BAT structure
*/ */
dvbpsi_bat_t *dvbpsi_NewBAT(uint16_t i_bouquet_id, uint8_t i_version, dvbpsi_bat_t *dvbpsi_bat_new(uint16_t i_bouquet_id, uint8_t i_version,
bool b_current_next); bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyBAT/dvbpsi_DeleteBAT * dvbpsi_bat_empty/dvbpsi_bat_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_EmptyBAT(dvbpsi_bat_t* p_bat) * \fn void dvbpsi_bat_empty(dvbpsi_bat_t* p_bat)
* \brief Clean a dvbpsi_bat_t structure. * \brief Clean a dvbpsi_bat_t structure.
* \param p_bat pointer to the BAT structure * \param p_bat pointer to the BAT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_EmptyBAT(dvbpsi_bat_t *p_bat); void dvbpsi_bat_empty(dvbpsi_bat_t *p_bat);
/*! /*!
* \fn dvbpsi_DeleteBAT(dvbpsi_bat_t *p_bat) * \fn dvbpsi_DeleteBAT(dvbpsi_bat_t *p_bat)
...@@ -190,13 +190,13 @@ void dvbpsi_EmptyBAT(dvbpsi_bat_t *p_bat); ...@@ -190,13 +190,13 @@ void dvbpsi_EmptyBAT(dvbpsi_bat_t *p_bat);
* \param p_bat pointer to the BAT structure * \param p_bat pointer to the BAT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeleteBAT(dvbpsi_bat_t *p_bat); void dvbpsi_bat_delete(dvbpsi_bat_t *p_bat);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenBATSections * dvbpsi_bat_sections_generate
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenBATSections(dvbpsi_t *p_dvbpsi, dvbpsi_bat_t* p_bat) * \fn dvbpsi_psi_section_t* dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_bat_t* p_bat)
* \brief BAT generator * \brief BAT generator
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
* \param p_bat BAT structure * \param p_bat BAT structure
...@@ -204,7 +204,25 @@ void dvbpsi_DeleteBAT(dvbpsi_bat_t *p_bat); ...@@ -204,7 +204,25 @@ void dvbpsi_DeleteBAT(dvbpsi_bat_t *p_bat);
* *
* Generate BAT sections based on the dvbpsi_bat_t structure. * Generate BAT sections based on the dvbpsi_bat_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t *dvbpsi_GenBATSections(dvbpsi_t *p_dvbpsi, dvbpsi_bat_t * p_bat); dvbpsi_psi_section_t *dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_bat_t * p_bat);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
__attribute__((deprecated))
int dvbpsi_AttachBAT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_bat_callback pf_callback,
void* p_cb_data);
__attribute__((deprecated))
void dvbpsi_DetachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension);
__attribute__((deprecated))
void dvbpsi_InitBAT(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_version,
int b_current_next);
__attribute__((deprecated))
void dvbpsi_EmptyBAT(dvbpsi_bat_t *p_bat);
__attribute__((deprecated))
dvbpsi_psi_section_t *dvbpsi_GenBATSections(dvbpsi_bat_t *p_bat);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -47,50 +47,70 @@ typedef struct dvbpsi_bat_decoder_s ...@@ -47,50 +47,70 @@ typedef struct dvbpsi_bat_decoder_s
} dvbpsi_bat_decoder_t; } dvbpsi_bat_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherBATSections * dvbpsi_bat_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherBATSections(dvbpsi_t* p_dvbpsi, dvbpsi_decoder_t* p_decoder, void dvbpsi_bat_sections_gather(dvbpsi_t* p_dvbpsi, dvbpsi_decoder_t* p_decoder,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeBATSections * dvbpsi_bat_sections_decode
***************************************************************************** *****************************************************************************
* BAT decoder. * BAT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat, void dvbpsi_bat_sections_decode(dvbpsi_bat_t* p_bat,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_BATAddTS * dvbpsi_bat_ts_add
***************************************************************************** *****************************************************************************
* Add a TS description at the end of the BAT. * Add a TS description at the end of the BAT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_bat_ts_t *dvbpsi_BATAddTS(dvbpsi_bat_t* p_bat, dvbpsi_bat_ts_t *dvbpsi_bat_ts_add(dvbpsi_bat_t* p_bat,
uint16_t i_ts_id, uint16_t i_orig_network_id); uint16_t i_ts_id, uint16_t i_orig_network_id);
/***************************************************************************** /*****************************************************************************
* dvbpsi_BATBouquetAddDescriptor * dvbpsi_bat_bouquet_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the BAT Bouquet descriptors (the first loop description), * Add a descriptor in the BAT Bouquet descriptors (the first loop description),
* which is in the first loop of BAT. * which is in the first loop of BAT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t *dvbpsi_BATBouquetAddDescriptor( dvbpsi_descriptor_t *dvbpsi_bat_bouquet_descriptor_add(dvbpsi_bat_t *p_bat,
dvbpsi_bat_t *p_bat,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data); uint8_t *p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_BATTSAddDescriptor * dvbpsi_bat_ts_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the BAT TS descriptors, which is in the second loop of BAT. * Add a descriptor in the BAT TS descriptors, which is in the second loop of BAT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t *dvbpsi_bat_ts_descriptor_add(dvbpsi_bat_ts_t *p_ts,
uint8_t i_tag, uint8_t i_length,
uint8_t *p_data);
/*****************************************************************************
* Deprecated API's
*****************************************************************************/
__attribute__((deprecated))
void dvbpsi_GatherBATSections(dvbpsi_t* p_dvbpsi, dvbpsi_decoder_t* p_decoder,
dvbpsi_psi_section_t* p_section);
__attribute__((deprecated))
void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat,
dvbpsi_psi_section_t* p_section);
__attribute__((deprecated))
dvbpsi_bat_ts_t *dvbpsi_BATAddTS(dvbpsi_bat_t* p_bat,
uint16_t i_ts_id, uint16_t i_orig_network_id);
__attribute__((deprecated))
dvbpsi_descriptor_t *dvbpsi_BATBouquetAddDescriptor(
dvbpsi_bat_t *p_bat,
uint8_t i_tag, uint8_t i_length,
uint8_t *p_data);
__attribute__((deprecated))
dvbpsi_descriptor_t *dvbpsi_BATTSAddDescriptor( dvbpsi_descriptor_t *dvbpsi_BATTSAddDescriptor(
dvbpsi_bat_ts_t *p_ts, dvbpsi_bat_ts_t *p_ts,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data); uint8_t *p_data);
#else #else
#error "Multiple inclusions of bat_private.h" #error "Multiple inclusions of bat_private.h"
#endif #endif
...@@ -50,18 +50,18 @@ ...@@ -50,18 +50,18 @@
#include "cat_private.h" #include "cat_private.h"
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachCAT * dvbpsi_cat_attach
***************************************************************************** *****************************************************************************
* Initialize a CAT decoder and return a handle on it. * Initialize a CAT decoder and return a handle on it.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AttachCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_callback pf_callback, bool dvbpsi_cat_attach(dvbpsi_t *p_dvbpsi, dvbpsi_cat_callback pf_callback,
void* p_cb_data) void* p_cb_data)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder == NULL); assert(p_dvbpsi->p_decoder == NULL);
dvbpsi_cat_decoder_t* p_cat_decoder; dvbpsi_cat_decoder_t* p_cat_decoder;
p_cat_decoder = (dvbpsi_cat_decoder_t*) dvbpsi_NewDecoder(&dvbpsi_GatherCATSections, p_cat_decoder = (dvbpsi_cat_decoder_t*) dvbpsi_decoder_new(&dvbpsi_cat_sections_gather,
1024, true, sizeof(dvbpsi_cat_decoder_t)); 1024, true, sizeof(dvbpsi_cat_decoder_t));
if (p_cat_decoder == NULL) if (p_cat_decoder == NULL)
return false; return false;
...@@ -76,11 +76,11 @@ bool dvbpsi_AttachCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_callback pf_callback, ...@@ -76,11 +76,11 @@ bool dvbpsi_AttachCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_callback pf_callback,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachCAT * dvbpsi_cat_detach
***************************************************************************** *****************************************************************************
* Close a CAT decoder. The handle isn't valid any more. * Close a CAT decoder. The handle isn't valid any more.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachCAT(dvbpsi_t *p_dvbpsi) void dvbpsi_cat_detach(dvbpsi_t *p_dvbpsi)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -88,19 +88,19 @@ void dvbpsi_DetachCAT(dvbpsi_t *p_dvbpsi) ...@@ -88,19 +88,19 @@ void dvbpsi_DetachCAT(dvbpsi_t *p_dvbpsi)
dvbpsi_cat_decoder_t* p_cat_decoder dvbpsi_cat_decoder_t* p_cat_decoder
= (dvbpsi_cat_decoder_t*)p_dvbpsi->p_decoder; = (dvbpsi_cat_decoder_t*)p_dvbpsi->p_decoder;
if (p_cat_decoder->p_building_cat) if (p_cat_decoder->p_building_cat)
dvbpsi_DeleteCAT(p_cat_decoder->p_building_cat); dvbpsi_cat_delete(p_cat_decoder->p_building_cat);
p_cat_decoder->p_building_cat = NULL; p_cat_decoder->p_building_cat = NULL;
dvbpsi_DeleteDecoder(p_dvbpsi->p_decoder); dvbpsi_decoder_delete(p_dvbpsi->p_decoder);
p_dvbpsi->p_decoder = NULL; p_dvbpsi->p_decoder = NULL;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitCAT * dvbpsi_cat_init
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_cat_t structure. * Initialize a pre-allocated dvbpsi_cat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitCAT(dvbpsi_cat_t* p_cat, uint8_t i_version, bool b_current_next) void dvbpsi_cat_init(dvbpsi_cat_t* p_cat, uint8_t i_version, bool b_current_next)
{ {
assert(p_cat); assert(p_cat);
...@@ -110,47 +110,47 @@ void dvbpsi_InitCAT(dvbpsi_cat_t* p_cat, uint8_t i_version, bool b_current_next) ...@@ -110,47 +110,47 @@ void dvbpsi_InitCAT(dvbpsi_cat_t* p_cat, uint8_t i_version, bool b_current_next)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewCAT * dvbpsi_cat_new
***************************************************************************** *****************************************************************************
* Allocate and Initialize a dvbpsi_cat_t structure. * Allocate and Initialize a dvbpsi_cat_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_cat_t *dvbpsi_NewCAT(uint8_t i_version, bool b_current_next) dvbpsi_cat_t *dvbpsi_cat_new(uint8_t i_version, bool b_current_next)
{ {
dvbpsi_cat_t *p_cat = (dvbpsi_cat_t*)malloc(sizeof(dvbpsi_cat_t)); dvbpsi_cat_t *p_cat = (dvbpsi_cat_t*)malloc(sizeof(dvbpsi_cat_t));
if (p_cat != NULL) if (p_cat != NULL)
dvbpsi_InitCAT(p_cat, i_version, b_current_next); dvbpsi_cat_init(p_cat, i_version, b_current_next);
return p_cat; return p_cat;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyCAT * dvbpsi_cat_empty
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_cat_t structure. * Clean a dvbpsi_cat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_EmptyCAT(dvbpsi_cat_t* p_cat) void dvbpsi_cat_empty(dvbpsi_cat_t* p_cat)
{ {
dvbpsi_DeleteDescriptors(p_cat->p_first_descriptor); dvbpsi_DeleteDescriptors(p_cat->p_first_descriptor);
p_cat->p_first_descriptor = NULL; p_cat->p_first_descriptor = NULL;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteCAT * dvbpsi_cat_delete
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_cat_t structure. * Clean a dvbpsi_cat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteCAT(dvbpsi_cat_t *p_cat) void dvbpsi_cat_delete(dvbpsi_cat_t *p_cat)
{ {
if (p_cat) if (p_cat)
dvbpsi_EmptyCAT(p_cat); dvbpsi_cat_empty(p_cat);
free(p_cat); free(p_cat);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_CATAddDescriptor * dvbpsi_cat_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the CAT. * Add a descriptor in the CAT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat, dvbpsi_descriptor_t* dvbpsi_cat_descriptor_add(dvbpsi_cat_t* p_cat,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
{ {
...@@ -173,14 +173,14 @@ static void dvbpsi_ReInitCAT(dvbpsi_cat_decoder_t* p_decoder, const bool b_force ...@@ -173,14 +173,14 @@ static void dvbpsi_ReInitCAT(dvbpsi_cat_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
/* Free structures */ /* Free structures */
if (p_decoder->p_building_cat) if (p_decoder->p_building_cat)
dvbpsi_DeleteCAT(p_decoder->p_building_cat); dvbpsi_cat_delete(p_decoder->p_building_cat);
} }
p_decoder->p_building_cat = NULL; p_decoder->p_building_cat = NULL;
} }
...@@ -235,8 +235,8 @@ static bool dvbpsi_AddSectionCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_decoder_t *p_dec ...@@ -235,8 +235,8 @@ static bool dvbpsi_AddSectionCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_decoder_t *p_dec
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (p_decoder->p_building_cat == NULL) if (p_decoder->p_building_cat == NULL)
{ {
p_decoder->p_building_cat = dvbpsi_NewCAT(p_section->i_version, p_decoder->p_building_cat = dvbpsi_cat_new(p_section->i_version,
p_section->b_current_next); p_section->b_current_next);
if (p_decoder->p_building_cat == NULL) if (p_decoder->p_building_cat == NULL)
return false; return false;
...@@ -244,7 +244,7 @@ static bool dvbpsi_AddSectionCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_decoder_t *p_dec ...@@ -244,7 +244,7 @@ static bool dvbpsi_AddSectionCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_decoder_t *p_dec
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "CAT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "CAT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -252,11 +252,11 @@ static bool dvbpsi_AddSectionCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_decoder_t *p_dec ...@@ -252,11 +252,11 @@ static bool dvbpsi_AddSectionCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_decoder_t *p_dec
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherCATSections * dvbpsi_cat_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherCATSections(dvbpsi_t *p_dvbpsi, void dvbpsi_cat_sections_gather(dvbpsi_t *p_dvbpsi,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -313,7 +313,7 @@ void dvbpsi_GatherCATSections(dvbpsi_t *p_dvbpsi, ...@@ -313,7 +313,7 @@ void dvbpsi_GatherCATSections(dvbpsi_t *p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_cat_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_cat_decoder)))
{ {
assert(p_cat_decoder->pf_cat_callback); assert(p_cat_decoder->pf_cat_callback);
...@@ -321,10 +321,10 @@ void dvbpsi_GatherCATSections(dvbpsi_t *p_dvbpsi, ...@@ -321,10 +321,10 @@ void dvbpsi_GatherCATSections(dvbpsi_t *p_dvbpsi,
p_cat_decoder->current_cat = *p_cat_decoder->p_building_cat; p_cat_decoder->current_cat = *p_cat_decoder->p_building_cat;
p_cat_decoder->b_current_valid = true; p_cat_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_cat_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_cat_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodeCATSections(p_cat_decoder->p_building_cat, dvbpsi_cat_sections_decode(p_cat_decoder->p_building_cat,
p_cat_decoder->ap_sections[0]); p_cat_decoder->ap_sections[0]);
/* Delete the sections */ /* Delete the sections */
dvbpsi_DeletePSISections(p_cat_decoder->ap_sections[0]); dvbpsi_DeletePSISections(p_cat_decoder->ap_sections[0]);
p_cat_decoder->ap_sections[0] = NULL; p_cat_decoder->ap_sections[0] = NULL;
...@@ -337,12 +337,11 @@ void dvbpsi_GatherCATSections(dvbpsi_t *p_dvbpsi, ...@@ -337,12 +337,11 @@ void dvbpsi_GatherCATSections(dvbpsi_t *p_dvbpsi,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeCATSections * dvbpsi_cat_sections_decode
***************************************************************************** *****************************************************************************
* CAT decoder. * CAT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeCATSections(dvbpsi_cat_t* p_cat, void dvbpsi_cat_sections_decode(dvbpsi_cat_t* p_cat, dvbpsi_psi_section_t* p_section)
dvbpsi_psi_section_t* p_section)
{ {
uint8_t* p_byte; uint8_t* p_byte;
...@@ -355,7 +354,7 @@ void dvbpsi_DecodeCATSections(dvbpsi_cat_t* p_cat, ...@@ -355,7 +354,7 @@ void dvbpsi_DecodeCATSections(dvbpsi_cat_t* p_cat,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if (i_length + 2 <= p_section->p_payload_end - p_byte) if (i_length + 2 <= p_section->p_payload_end - p_byte)
dvbpsi_CATAddDescriptor(p_cat, i_tag, i_length, p_byte + 2); dvbpsi_cat_descriptor_add(p_cat, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
p_section = p_section->p_next; p_section = p_section->p_next;
...@@ -363,11 +362,11 @@ void dvbpsi_DecodeCATSections(dvbpsi_cat_t* p_cat, ...@@ -363,11 +362,11 @@ void dvbpsi_DecodeCATSections(dvbpsi_cat_t* p_cat,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenCATSections * dvbpsi_cat_sections_generate
***************************************************************************** *****************************************************************************
* Generate CAT sections based on the dvbpsi_cat_t structure. * Generate CAT sections based on the dvbpsi_cat_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_t* p_dvbpsi, dvbpsi_cat_t* p_cat) dvbpsi_psi_section_t* dvbpsi_cat_sections_generate(dvbpsi_t* p_dvbpsi, dvbpsi_cat_t* p_cat)
{ {
dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024); dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024);
dvbpsi_psi_section_t* p_current = p_result; dvbpsi_psi_section_t* p_current = p_result;
......
...@@ -74,10 +74,10 @@ typedef struct dvbpsi_cat_s ...@@ -74,10 +74,10 @@ typedef struct dvbpsi_cat_s
typedef void (* dvbpsi_cat_callback)(void* p_cb_data, dvbpsi_cat_t* p_new_cat); typedef void (* dvbpsi_cat_callback)(void* p_cb_data, dvbpsi_cat_t* p_new_cat);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachCAT * dvbpsi_cat_attach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AttachCAT(dvbpsi_t *p_dvbpsi, * \fn bool dvbpsi_cat_attach(dvbpsi_t *p_dvbpsi,
dvbpsi_cat_callback pf_callback, void* p_cb_data) dvbpsi_cat_callback pf_callback, void* p_cb_data)
* \brief Creation and initialization of a CAT decoder. It will be attached to p_dvbpsi * \brief Creation and initialization of a CAT decoder. It will be attached to p_dvbpsi
* \param p_dvbpsi is a pointer to dvbpsi_t which holds a pointer to the decoder * \param p_dvbpsi is a pointer to dvbpsi_t which holds a pointer to the decoder
...@@ -85,14 +85,14 @@ typedef void (* dvbpsi_cat_callback)(void* p_cb_data, dvbpsi_cat_t* p_new_cat); ...@@ -85,14 +85,14 @@ typedef void (* dvbpsi_cat_callback)(void* p_cb_data, dvbpsi_cat_t* p_new_cat);
* \param p_cb_data private data given in argument to the callback * \param p_cb_data private data given in argument to the callback
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_AttachCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_callback pf_callback, bool dvbpsi_cat_attach(dvbpsi_t *p_dvbpsi, dvbpsi_cat_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachCAT * dvbpsi_cat_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachCAT(dvbpsi_t *p_dvbpsi) * \fn void dvbpsi_cat_detach(dvbpsi_t *p_dvbpsi)
* \brief Destroy a CAT decoder. * \brief Destroy a CAT decoder.
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
* \param p_dvbpsi handle holds the decoder pointer * \param p_dvbpsi handle holds the decoder pointer
...@@ -100,13 +100,13 @@ bool dvbpsi_AttachCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_callback pf_callback, ...@@ -100,13 +100,13 @@ bool dvbpsi_AttachCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_callback pf_callback,
* *
* The handle isn't valid any more. * The handle isn't valid any more.
*/ */
void dvbpsi_DetachCAT(dvbpsi_t *p_dvbpsi); void dvbpsi_cat_detach(dvbpsi_t *p_dvbpsi);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitCAT/dvbpsi_NewCAT * dvbpsi_cat_init/dvbpsi_cat_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_InitCAT(dvbpsi_cat_t* p_cat, * \fn void dvbpsi_cat_init(dvbpsi_cat_t* p_cat,
uint8_t i_version, bool b_current_next) uint8_t i_version, bool b_current_next)
* \brief Initialize a user-allocated dvbpsi_cat_t structure. * \brief Initialize a user-allocated dvbpsi_cat_t structure.
* \param p_cat pointer to the CAT structure * \param p_cat pointer to the CAT structure
...@@ -114,46 +114,46 @@ void dvbpsi_DetachCAT(dvbpsi_t *p_dvbpsi); ...@@ -114,46 +114,46 @@ void dvbpsi_DetachCAT(dvbpsi_t *p_dvbpsi);
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_InitCAT(dvbpsi_cat_t* p_cat, void dvbpsi_cat_init(dvbpsi_cat_t* p_cat,
uint8_t i_version, bool b_current_next); uint8_t i_version, bool b_current_next);
/*! /*!
* \fn dvbpsi_cat_t *dvbpsi_NewCAT(uint8_t i_version, * \fn dvbpsi_cat_t *dvbpsi_cat_new(uint8_t i_version,
* bool b_current_next) * bool b_current_next)
* \brief Allocate and initialize a new dvbpsi_cat_t structure. * \brief Allocate and initialize a new dvbpsi_cat_t structure.
* \param i_version CAT version * \param i_version CAT version
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return p_cat pointer to the CAT structure * \return p_cat pointer to the CAT structure
*/ */
dvbpsi_cat_t *dvbpsi_NewCAT(uint8_t i_version, bool b_current_next); dvbpsi_cat_t *dvbpsi_cat_new(uint8_t i_version, bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyCAT/dvbpsi_DeleteCAT * dvbpsi_cat_empty/dvbpsi_cat_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_EmptyCAT(dvbpsi_cat_t* p_cat) * \fn void dvbpsi_cat_empty(dvbpsi_cat_t* p_cat)
* \brief Clean a dvbpsi_cat_t structure. * \brief Clean a dvbpsi_cat_t structure.
* \param p_cat pointer to the CAT structure * \param p_cat pointer to the CAT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_EmptyCAT(dvbpsi_cat_t* p_cat); void dvbpsi_cat_empty(dvbpsi_cat_t* p_cat);
/*! /*!
* \fn void dvbpsi_DeleteCAT(dvbpsi_cat_t *p_cat) * \fn void dvbpsi_cat_delete(dvbpsi_cat_t *p_cat)
* \brief Clean and free a dvbpsi_cat_t structure. * \brief Clean and free a dvbpsi_cat_t structure.
* \param p_cat pointer to the CAT structure * \param p_cat pointer to the CAT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeleteCAT(dvbpsi_cat_t *p_cat); void dvbpsi_cat_delete(dvbpsi_cat_t *p_cat);
/***************************************************************************** /*****************************************************************************
* dvbpsi_CATAddDescriptor * dvbpsi_cat_descriptor_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat, * \fn dvbpsi_descriptor_t* dvbpsi_cat_descriptor_add(dvbpsi_cat_t* p_cat,
uint8_t i_tag, uint8_t i_tag,
uint8_t i_length, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
* \brief Add a descriptor in the CAT. * \brief Add a descriptor in the CAT.
* \param p_cat pointer to the CAT structure * \param p_cat pointer to the CAT structure
* \param i_tag descriptor's tag * \param i_tag descriptor's tag
...@@ -161,15 +161,15 @@ void dvbpsi_DeleteCAT(dvbpsi_cat_t *p_cat); ...@@ -161,15 +161,15 @@ void dvbpsi_DeleteCAT(dvbpsi_cat_t *p_cat);
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat, dvbpsi_descriptor_t* dvbpsi_cat_descriptor_add(dvbpsi_cat_t* p_cat,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenCATSections * dvbpsi_cat_sections_generate
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_t *p_dvbpsi, dvbpsi_cat_t* p_cat) * \fn dvbpsi_psi_section_t* dvbpsi_cat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_cat_t* p_cat)
* \brief CAT generator * \brief CAT generator
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
* \param p_cat CAT structure * \param p_cat CAT structure
...@@ -177,7 +177,28 @@ dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat, ...@@ -177,7 +177,28 @@ dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat,
* *
* Generate CAT sections based on the dvbpsi_cat_t structure. * Generate CAT sections based on the dvbpsi_cat_t structure.
*/ */
dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_t *p_dvbpsi, dvbpsi_cat_t* p_cat); dvbpsi_psi_section_t* dvbpsi_cat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_cat_t* p_cat);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
__attribute__((deprecated))
dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback,
void* p_cb_data);
__attribute__((deprecated))
void dvbpsi_DetachCAT(dvbpsi_handle h_dvbpsi);
__attribute__((deprecated))
void dvbpsi_InitCAT(dvbpsi_cat_t* p_cat,
uint8_t i_version, int b_current_next);
__attribute__((deprecated))
void dvbpsi_EmptyCAT(dvbpsi_cat_t* p_cat);
__attribute__((deprecated))
dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat,
uint8_t i_tag, uint8_t i_length,
uint8_t* p_data);
__attribute__((deprecated))
dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_cat_t* p_cat);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -48,17 +48,26 @@ typedef struct dvbpsi_cat_decoder_s ...@@ -48,17 +48,26 @@ typedef struct dvbpsi_cat_decoder_s
} dvbpsi_cat_decoder_t; } dvbpsi_cat_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherCATSections * dvbpsi_cat_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherCATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section); void dvbpsi_cat_sections_gather(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeCATSections * dvbpsi_cat_sections_decode
***************************************************************************** *****************************************************************************
* CAT decoder. * CAT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_cat_sections_decode(dvbpsi_cat_t* p_cat,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* Deprecated API's
*****************************************************************************/
__attribute__((deprecated))
void dvbpsi_GatherCATSections(dvbpsi_handle* p_dvbpsi, dvbpsi_psi_section_t* p_section);
__attribute__((deprecated))
void dvbpsi_DecodeCATSections(dvbpsi_cat_t* p_cat, void dvbpsi_DecodeCATSections(dvbpsi_cat_t* p_cat,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
......
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
#include "eit_private.h" #include "eit_private.h"
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachEIT * dvbpsi_eit_attach
***************************************************************************** *****************************************************************************
* Initialize a EIT subtable decoder. * Initialize a EIT subtable decoder.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, bool dvbpsi_eit_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_eit_callback pf_callback, void* p_cb_data) dvbpsi_eit_callback pf_callback, void* p_cb_data)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -72,18 +72,18 @@ bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -72,18 +72,18 @@ bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
dvbpsi_eit_decoder_t* p_eit_decoder; dvbpsi_eit_decoder_t* p_eit_decoder;
p_eit_decoder = (dvbpsi_eit_decoder_t*) dvbpsi_NewDecoder(NULL, p_eit_decoder = (dvbpsi_eit_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_eit_decoder_t)); 0, true, sizeof(dvbpsi_eit_decoder_t));
if (p_eit_decoder == NULL) if (p_eit_decoder == NULL)
return false; return false;
/* subtable decoder configuration */ /* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachEIT, p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_eit_detach,
dvbpsi_GatherEITSections, DVBPSI_DECODER(p_eit_decoder)); dvbpsi_eit_sections_gather, DVBPSI_DECODER(p_eit_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_eit_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_eit_decoder));
return false; return false;
} }
...@@ -99,11 +99,11 @@ bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -99,11 +99,11 @@ bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachEIT * dvbpsi_eit_detach
***************************************************************************** *****************************************************************************
* Close a EIT decoder. * Close a EIT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, void dvbpsi_eit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -125,7 +125,7 @@ void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -125,7 +125,7 @@ void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
dvbpsi_eit_decoder_t* p_eit_decoder; dvbpsi_eit_decoder_t* p_eit_decoder;
p_eit_decoder = (dvbpsi_eit_decoder_t*)p_subdec->p_decoder; p_eit_decoder = (dvbpsi_eit_decoder_t*)p_subdec->p_decoder;
if (p_eit_decoder->p_building_eit) if (p_eit_decoder->p_building_eit)
dvbpsi_DeleteEIT(p_eit_decoder->p_building_eit); dvbpsi_eit_delete(p_eit_decoder->p_building_eit);
p_eit_decoder->p_building_eit = NULL; p_eit_decoder->p_building_eit = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec); dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
...@@ -133,11 +133,11 @@ void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -133,11 +133,11 @@ void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitEIT * dvbpsi_eit_init
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_eit_t structure. * Initialize a pre-allocated dvbpsi_eit_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitEIT(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_version, void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_version,
bool b_current_next, uint16_t i_ts_id, uint16_t i_network_id, bool b_current_next, uint16_t i_ts_id, uint16_t i_network_id,
uint8_t i_segment_last_section_number, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id) uint8_t i_last_table_id)
...@@ -153,28 +153,28 @@ void dvbpsi_InitEIT(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_versio ...@@ -153,28 +153,28 @@ void dvbpsi_InitEIT(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_versio
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewEIT * dvbpsi_eit_new
***************************************************************************** *****************************************************************************
* Allocate and Initialize a new dvbpsi_eit_t structure. * Allocate and Initialize a new dvbpsi_eit_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_eit_t* dvbpsi_NewEIT(uint16_t i_service_id, uint8_t i_version, dvbpsi_eit_t* dvbpsi_eit_new(uint16_t i_service_id, uint8_t i_version,
bool b_current_next, uint16_t i_ts_id, bool b_current_next, uint16_t i_ts_id,
uint16_t i_network_id, uint8_t i_segment_last_section_number, uint16_t i_network_id, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id) uint8_t i_last_table_id)
{ {
dvbpsi_eit_t *p_eit = (dvbpsi_eit_t*)malloc(sizeof(dvbpsi_eit_t)); dvbpsi_eit_t *p_eit = (dvbpsi_eit_t*)malloc(sizeof(dvbpsi_eit_t));
if (p_eit != NULL) if (p_eit != NULL)
dvbpsi_InitEIT(p_eit, i_service_id, i_version, b_current_next, i_ts_id, dvbpsi_eit_init(p_eit, i_service_id, i_version, b_current_next, i_ts_id,
i_network_id, i_segment_last_section_number, i_last_table_id); i_network_id, i_segment_last_section_number, i_last_table_id);
return p_eit; return p_eit;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyEIT * dvbpsi_eit_empty
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_eit_t structure. * Clean a dvbpsi_eit_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_EmptyEIT(dvbpsi_eit_t* p_eit) void dvbpsi_eit_empty(dvbpsi_eit_t* p_eit)
{ {
dvbpsi_eit_event_t* p_event = p_eit->p_first_event; dvbpsi_eit_event_t* p_event = p_eit->p_first_event;
...@@ -189,23 +189,23 @@ void dvbpsi_EmptyEIT(dvbpsi_eit_t* p_eit) ...@@ -189,23 +189,23 @@ void dvbpsi_EmptyEIT(dvbpsi_eit_t* p_eit)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteEIT * dvbpsi_eit_delete
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_eit_t structure. * Clean a dvbpsi_eit_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteEIT(dvbpsi_eit_t* p_eit) void dvbpsi_eit_delete(dvbpsi_eit_t* p_eit)
{ {
if (p_eit) if (p_eit)
dvbpsi_EmptyEIT(p_eit); dvbpsi_eit_empty(p_eit);
free(p_eit); free(p_eit);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EITAddEvent * dvbpsi_eit_event_add
***************************************************************************** *****************************************************************************
* Add an event description at the end of the EIT. * Add an event description at the end of the EIT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_eit_event_t* dvbpsi_EITAddEvent(dvbpsi_eit_t* p_eit, dvbpsi_eit_event_t* dvbpsi_eit_event_add(dvbpsi_eit_t* p_eit,
uint16_t i_event_id, uint64_t i_start_time, uint32_t i_duration, uint16_t i_event_id, uint64_t i_start_time, uint32_t i_duration,
uint8_t i_running_status, bool b_free_ca) uint8_t i_running_status, bool b_free_ca)
{ {
...@@ -235,11 +235,11 @@ dvbpsi_eit_event_t* dvbpsi_EITAddEvent(dvbpsi_eit_t* p_eit, ...@@ -235,11 +235,11 @@ dvbpsi_eit_event_t* dvbpsi_EITAddEvent(dvbpsi_eit_t* p_eit,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EITEventAddDescriptor * dvbpsi_eit_event_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the EIT event description. * Add a descriptor in the EIT event description.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t* dvbpsi_EITEventAddDescriptor(dvbpsi_eit_event_t* p_event, dvbpsi_descriptor_t* dvbpsi_eit_event_descriptor_add(dvbpsi_eit_event_t* p_event,
uint8_t i_tag, uint8_t i_length, uint8_t* p_data) uint8_t i_tag, uint8_t i_length, uint8_t* p_data)
{ {
dvbpsi_descriptor_t* p_descriptor; dvbpsi_descriptor_t* p_descriptor;
...@@ -261,13 +261,13 @@ static void dvbpsi_ReInitEIT(dvbpsi_eit_decoder_t* p_decoder, const bool b_force ...@@ -261,13 +261,13 @@ static void dvbpsi_ReInitEIT(dvbpsi_eit_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
if (b_force) if (b_force)
{ {
/* Free structures */ /* Free structures */
if (p_decoder->p_building_eit) if (p_decoder->p_building_eit)
dvbpsi_DeleteEIT(p_decoder->p_building_eit); dvbpsi_eit_delete(p_decoder->p_building_eit);
} }
p_decoder->p_building_eit = NULL; p_decoder->p_building_eit = NULL;
} }
...@@ -369,7 +369,7 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit ...@@ -369,7 +369,7 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_eit_decoder->p_building_eit) if (!p_eit_decoder->p_building_eit)
{ {
p_eit_decoder->p_building_eit = dvbpsi_NewEIT(p_section->i_extension, p_eit_decoder->p_building_eit = dvbpsi_eit_new(p_section->i_extension,
p_section->i_version, p_section->i_version,
p_section->b_current_next, p_section->b_current_next,
((uint16_t)(p_section->p_payload_start[0]) << 8) ((uint16_t)(p_section->p_payload_start[0]) << 8)
...@@ -388,7 +388,7 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit ...@@ -388,7 +388,7 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_eit_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_eit_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "EIT decoder", dvbpsi_debug(p_dvbpsi, "EIT decoder",
"overwrite section number %d", p_section->i_number); "overwrite section number %d", p_section->i_number);
...@@ -396,12 +396,12 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit ...@@ -396,12 +396,12 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherEITSections * dvbpsi_eit_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the subtable demultiplexor. * Callback for the subtable demultiplexor.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherEITSections(dvbpsi_t *p_dvbpsi, dvbpsi_decoder_t *p_private_decoder, void dvbpsi_eit_sections_gather(dvbpsi_t *p_dvbpsi, dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section) dvbpsi_psi_section_t *p_section)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -474,10 +474,10 @@ void dvbpsi_GatherEITSections(dvbpsi_t *p_dvbpsi, dvbpsi_decoder_t *p_private_de ...@@ -474,10 +474,10 @@ void dvbpsi_GatherEITSections(dvbpsi_t *p_dvbpsi, dvbpsi_decoder_t *p_private_de
p_eit_decoder->b_current_valid = true; p_eit_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_eit_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_eit_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodeEITSections(p_eit_decoder->p_building_eit, p_eit_decoder->ap_sections[0]); dvbpsi_eit_sections_decode(p_eit_decoder->p_building_eit, p_eit_decoder->ap_sections[0]);
/* Delete the sections */ /* Delete the sections */
dvbpsi_DeletePSISections(p_eit_decoder->ap_sections[0]); dvbpsi_DeletePSISections(p_eit_decoder->ap_sections[0]);
...@@ -494,12 +494,12 @@ void dvbpsi_GatherEITSections(dvbpsi_t *p_dvbpsi, dvbpsi_decoder_t *p_private_de ...@@ -494,12 +494,12 @@ void dvbpsi_GatherEITSections(dvbpsi_t *p_dvbpsi, dvbpsi_decoder_t *p_private_de
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeEITSections * dvbpsi_eit_sections_decode
***************************************************************************** *****************************************************************************
* EIT decoder. * EIT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeEITSections(dvbpsi_eit_t* p_eit, void dvbpsi_eit_sections_decode(dvbpsi_eit_t* p_eit,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
uint8_t* p_byte, * p_end; uint8_t* p_byte, * p_end;
...@@ -518,7 +518,7 @@ void dvbpsi_DecodeEITSections(dvbpsi_eit_t* p_eit, ...@@ -518,7 +518,7 @@ void dvbpsi_DecodeEITSections(dvbpsi_eit_t* p_eit,
uint8_t i_running_status = (uint8_t)(p_byte[10]) >> 5; uint8_t i_running_status = (uint8_t)(p_byte[10]) >> 5;
bool b_free_ca = (int)(p_byte[10] & 0x10) >> 4; bool b_free_ca = (int)(p_byte[10] & 0x10) >> 4;
uint16_t i_ev_length = ((uint16_t)(p_byte[10] & 0xf) << 8) | p_byte[11]; uint16_t i_ev_length = ((uint16_t)(p_byte[10] & 0xf) << 8) | p_byte[11];
dvbpsi_eit_event_t* p_event = dvbpsi_EITAddEvent(p_eit, dvbpsi_eit_event_t* p_event = dvbpsi_eit_event_add(p_eit,
i_event_id, i_start_time, i_duration, i_event_id, i_start_time, i_duration,
i_running_status, b_free_ca); i_running_status, b_free_ca);
/* Event descriptors */ /* Event descriptors */
...@@ -529,7 +529,7 @@ void dvbpsi_DecodeEITSections(dvbpsi_eit_t* p_eit, ...@@ -529,7 +529,7 @@ void dvbpsi_DecodeEITSections(dvbpsi_eit_t* p_eit,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if (i_length + 2 <= p_end - p_byte) if (i_length + 2 <= p_end - p_byte)
dvbpsi_EITEventAddDescriptor(p_event, i_tag, i_length, p_byte + 2); dvbpsi_eit_event_descriptor_add(p_event, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
} }
...@@ -609,11 +609,11 @@ static inline void EncodeEventHeaders(dvbpsi_eit_event_t *p_event, uint8_t *buf) ...@@ -609,11 +609,11 @@ static inline void EncodeEventHeaders(dvbpsi_eit_event_t *p_event, uint8_t *buf)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenEITSections * dvbpsi_eit_sections_generate
***************************************************************************** *****************************************************************************
* Generate EIT sections based on the dvbpsi_eit_t structure. * Generate EIT sections based on the dvbpsi_eit_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t* dvbpsi_GenEITSections(dvbpsi_t *p_dvbpsi, dvbpsi_eit_t *p_eit, dvbpsi_psi_section_t* dvbpsi_eit_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_eit_t *p_eit,
uint8_t i_table_id) uint8_t i_table_id)
{ {
dvbpsi_psi_section_t *p_result = NewEITSection (p_eit, i_table_id, 0); dvbpsi_psi_section_t *p_result = NewEITSection (p_eit, i_table_id, 0);
......
...@@ -111,7 +111,7 @@ typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit); ...@@ -111,7 +111,7 @@ typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit);
* dvbpsi_AttachEIT * dvbpsi_AttachEIT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn bool dvbpsi_eit_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_eit_callback pf_callback, uint16_t i_extension, dvbpsi_eit_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a EIT decoder. * \brief Creation and initialization of a EIT decoder.
...@@ -122,14 +122,14 @@ typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit); ...@@ -122,14 +122,14 @@ typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit);
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, bool dvbpsi_eit_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_eit_callback pf_callback, void* p_cb_data); uint16_t i_extension, dvbpsi_eit_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachEIT * dvbpsi_eit_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn void dvbpsi_eit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a EIT decoder. * \brief Destroy a EIT decoder.
* \param p_dvbpsi dvbpsi handle pointing to Subtable demultiplexor to which the * \param p_dvbpsi dvbpsi handle pointing to Subtable demultiplexor to which the
...@@ -138,13 +138,13 @@ bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -138,13 +138,13 @@ bool dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
* \param i_extension Table ID extension, here service ID. * \param i_extension Table ID extension, here service ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension); void dvbpsi_eit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitEIT/dvbpsi_NewEIT * dvbpsi_eit_init/dvbpsi_eit_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_InitEIT(dvbpsi_eit_t* p_eit, uint16_t i_service_id, * \fn void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id,
uint8_t i_version, bool b_current_next, uint16_t i_ts_id, uint8_t i_version, bool b_current_next, uint16_t i_ts_id,
uint16_t i_network_id, uint8_t i_segment_last_section_number, uint16_t i_network_id, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id) uint8_t i_last_table_id)
...@@ -159,13 +159,13 @@ void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -159,13 +159,13 @@ void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
* \param i_last_table_id i_last_table_id * \param i_last_table_id i_last_table_id
* \return nothing. * \return nothing.
*/ */
void dvbpsi_InitEIT(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_version, void dvbpsi_eit_init(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_version,
bool b_current_next, uint16_t i_ts_id, uint16_t i_network_id, bool b_current_next, uint16_t i_ts_id, uint16_t i_network_id,
uint8_t i_segment_last_section_number, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id); uint8_t i_last_table_id);
/*! /*!
* \fn dvbpsi_eit_t* dvbpsi_NewEIT(uint16_t i_service_id, * \fn dvbpsi_eit_t* dvbpsi_eit_new(uint16_t i_service_id,
uint8_t i_version, bool b_current_next, uint16_t i_ts_id, uint8_t i_version, bool b_current_next, uint16_t i_ts_id,
uint16_t i_network_id, uint8_t i_segment_last_section_number, uint16_t i_network_id, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id) uint8_t i_last_table_id)
...@@ -179,35 +179,35 @@ void dvbpsi_InitEIT(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_versio ...@@ -179,35 +179,35 @@ void dvbpsi_InitEIT(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_versio
* \param i_last_table_id i_last_table_id * \param i_last_table_id i_last_table_id
* \return p_eit pointer to the EIT structure * \return p_eit pointer to the EIT structure
*/ */
dvbpsi_eit_t* dvbpsi_NewEIT(uint16_t i_service_id, dvbpsi_eit_t* dvbpsi_eit_new(uint16_t i_service_id,
uint8_t i_version, bool b_current_next, uint16_t i_ts_id, uint8_t i_version, bool b_current_next, uint16_t i_ts_id,
uint16_t i_network_id, uint8_t i_segment_last_section_number, uint16_t i_network_id, uint8_t i_segment_last_section_number,
uint8_t i_last_table_id); uint8_t i_last_table_id);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyEIT/dvbpsi_DeleteEIT * dvbpsi_eit_empty/dvbpsi_eit_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_EmptyEIT(dvbpsi_eit_t* p_eit) * \fn void dvbpsi_eit_empty(dvbpsi_eit_t* p_eit)
* \brief Clean a dvbpsi_eit_t structure. * \brief Clean a dvbpsi_eit_t structure.
* \param p_eit pointer to the EIT structure * \param p_eit pointer to the EIT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_EmptyEIT(dvbpsi_eit_t* p_eit); void dvbpsi_eit_empty(dvbpsi_eit_t* p_eit);
/*! /*!
* \fn void dvbpsi_DeleteEIT(dvbpsi_eit_t *p_eit) * \fn void dvbpsi_eit_delete(dvbpsi_eit_t *p_eit)
* \brief Clean and free a dvbpsi_eit_t structure. * \brief Clean and free a dvbpsi_eit_t structure.
* \param p_eit pointer to the EIT structure * \param p_eit pointer to the EIT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeleteEIT(dvbpsi_eit_t* p_eit); void dvbpsi_eit_delete(dvbpsi_eit_t* p_eit);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EITAddEvent * dvbpsi_eit_event_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_eit_event_t* dvbpsi_EITAddEvent(dvbpsi_eit_t* p_eit, * \fn dvbpsi_eit_event_t* dvbpsi_eit_event_add(dvbpsi_eit_t* p_eit,
uint16_t i_event_id, uint16_t i_event_id,
uint64_t i_start_time, uint64_t i_start_time,
uint32_t i_duration, uint32_t i_duration,
...@@ -222,15 +222,15 @@ void dvbpsi_DeleteEIT(dvbpsi_eit_t* p_eit); ...@@ -222,15 +222,15 @@ void dvbpsi_DeleteEIT(dvbpsi_eit_t* p_eit);
* \param b_free_ca Free CA flag * \param b_free_ca Free CA flag
* \return a pointer to the added service description. * \return a pointer to the added service description.
*/ */
dvbpsi_eit_event_t* dvbpsi_EITAddEvent(dvbpsi_eit_t* p_eit, dvbpsi_eit_event_t* dvbpsi_eit_event_add(dvbpsi_eit_t* p_eit,
uint16_t i_event_id, uint64_t i_start_time, uint32_t i_duration, uint16_t i_event_id, uint64_t i_start_time, uint32_t i_duration,
uint8_t i_running_status, bool b_free_ca); uint8_t i_running_status, bool b_free_ca);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EITEventAddDescriptor * dvbpsi_eit_event_descriptor_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_descriptor_t* dvbpsi_EITEventAddDescriptor( * \fn dvbpsi_descriptor_t* dvbpsi_eit_event_descriptor_add(
dvbpsi_eit_event_t* p_event, dvbpsi_eit_event_t* p_event,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
...@@ -241,18 +241,18 @@ dvbpsi_eit_event_t* dvbpsi_EITAddEvent(dvbpsi_eit_t* p_eit, ...@@ -241,18 +241,18 @@ dvbpsi_eit_event_t* dvbpsi_EITAddEvent(dvbpsi_eit_t* p_eit,
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t* dvbpsi_EITEventAddDescriptor( dvbpsi_descriptor_t* dvbpsi_eit_event_descriptor_add(
dvbpsi_eit_event_t* p_event, dvbpsi_eit_event_t* p_event,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenEITSections * dvbpsi_eit_sections_generate
***************************************************************************** *****************************************************************************
* Generate EIT sections based on the dvbpsi_eit_t structure. * Generate EIT sections based on the dvbpsi_eit_t structure.
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t *dvbpsi_GenEITSections(dvbpsi_t *p_dvbpsi, dvbpsi_eit_t *p_eit, * \fn dvbpsi_psi_section_t *dvbpsi_eit_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_eit_t *p_eit,
* uint8_t i_table_id); * uint8_t i_table_id);
* \brief Generate a EIT section based on the information provided in p_eit. * \brief Generate a EIT section based on the information provided in p_eit.
* \param p_dvbpsi pointer to Subtable demultiplexor to which the EIT decoder is attached. * \param p_dvbpsi pointer to Subtable demultiplexor to which the EIT decoder is attached.
...@@ -260,9 +260,34 @@ dvbpsi_descriptor_t* dvbpsi_EITEventAddDescriptor( ...@@ -260,9 +260,34 @@ dvbpsi_descriptor_t* dvbpsi_EITEventAddDescriptor(
* \param i_table_id the EIT table id to use * \param i_table_id the EIT table id to use
* \return a pointer to a new PSI section * \return a pointer to a new PSI section
*/ */
dvbpsi_psi_section_t *dvbpsi_GenEITSections(dvbpsi_t *p_dvbpsi, dvbpsi_eit_t *p_eit, dvbpsi_psi_section_t *dvbpsi_eit_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_eit_t *p_eit,
uint8_t i_table_id); uint8_t i_table_id);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
__attribute__((deprecated))
int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_eit_callback pf_callback,
void* p_cb_data);
__attribute__((deprecated))
void dvbpsi_DetachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension);
__attribute__((deprecated))
void dvbpsi_InitEIT(dvbpsi_eit_t* p_eit, uint16_t i_service_id, uint8_t i_version,
int b_current_next, uint16_t i_ts_id, uint16_t i_network_id,
uint8_t i_segment_last_section_number,
uint8_t i_last_table_id);
__attribute__((deprecated)) void dvbpsi_EmptyEIT(dvbpsi_eit_t* p_eit);
__attribute__((deprecated))
dvbpsi_descriptor_t* dvbpsi_EITEventAddDescriptor(dvbpsi_eit_event_t* p_event,
uint8_t i_tag, uint8_t i_length,
uint8_t* p_data);
__attribute__((deprecated))
dvbpsi_eit_event_t* dvbpsi_EITAddEvent(dvbpsi_eit_t* p_eit,
uint16_t i_event_id, uint64_t i_start_time, uint32_t i_duration,
uint8_t i_running_status, int b_free_ca);
#ifdef __cplusplus #ifdef __cplusplus
}; };
#endif #endif
......
...@@ -48,19 +48,30 @@ typedef struct dvbpsi_eit_decoder_s ...@@ -48,19 +48,30 @@ typedef struct dvbpsi_eit_decoder_s
} dvbpsi_eit_decoder_t; } dvbpsi_eit_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherEITSections * dvbpsi_eit_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherEITSections(dvbpsi_t *p_dvbpsi, void dvbpsi_eit_sections_gather(dvbpsi_t *p_dvbpsi,
dvbpsi_decoder_t *p_private_decoder, dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section); dvbpsi_psi_section_t *p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeEITSection * dvbpsi_eit_sections_decode
***************************************************************************** *****************************************************************************
* EIT decoder. * EIT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_eit_sections_decode(dvbpsi_eit_t* p_eit,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* Deprecated API's
*****************************************************************************/
__attribute__((deprecated))
void dvbpsi_GatherEITSections(dvbpsi_handle *p_dvbpsi,
dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section);
__attribute__((deprecated))
void dvbpsi_DecodeEITSections(dvbpsi_eit_t* p_eit, void dvbpsi_DecodeEITSections(dvbpsi_eit_t* p_eit,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
......
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
#include "nit_private.h" #include "nit_private.h"
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachNIT * dvbpsi_nit_attach
***************************************************************************** *****************************************************************************
* Initialize a NIT subtable decoder. * Initialize a NIT subtable decoder.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_nit_callback pf_callback, uint16_t i_extension, dvbpsi_nit_callback pf_callback,
void* p_cb_data) void* p_cb_data)
{ {
...@@ -74,18 +74,18 @@ bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -74,18 +74,18 @@ bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
} }
dvbpsi_nit_decoder_t* p_nit_decoder; dvbpsi_nit_decoder_t* p_nit_decoder;
p_nit_decoder = (dvbpsi_nit_decoder_t*) dvbpsi_NewDecoder(NULL, p_nit_decoder = (dvbpsi_nit_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_nit_decoder_t)); 0, true, sizeof(dvbpsi_nit_decoder_t));
if (p_nit_decoder == NULL) if (p_nit_decoder == NULL)
return false; return false;
/* subtable decoder configuration */ /* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachNIT, p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_nit_detach,
dvbpsi_GatherNITSections, DVBPSI_DECODER(p_nit_decoder)); dvbpsi_nit_sections_gather, DVBPSI_DECODER(p_nit_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_nit_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_nit_decoder));
return false; return false;
} }
...@@ -102,11 +102,11 @@ bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -102,11 +102,11 @@ bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachNIT * dvbpsi_nit_detach
***************************************************************************** *****************************************************************************
* Close a NIT decoder. * Close a NIT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachNIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, void dvbpsi_nit_detach(dvbpsi_t * p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
{ {
dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_decoder; dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *) p_dvbpsi->p_decoder;
...@@ -125,7 +125,7 @@ void dvbpsi_DetachNIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, ...@@ -125,7 +125,7 @@ void dvbpsi_DetachNIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id,
dvbpsi_nit_decoder_t* p_nit_decoder; dvbpsi_nit_decoder_t* p_nit_decoder;
p_nit_decoder = (dvbpsi_nit_decoder_t*)p_subdec->p_decoder; p_nit_decoder = (dvbpsi_nit_decoder_t*)p_subdec->p_decoder;
if (p_nit_decoder->p_building_nit) if (p_nit_decoder->p_building_nit)
dvbpsi_DeleteNIT(p_nit_decoder->p_building_nit); dvbpsi_nit_delete(p_nit_decoder->p_building_nit);
p_nit_decoder->p_building_nit = NULL; p_nit_decoder->p_building_nit = NULL;
/* Free demux sub table decoder */ /* Free demux sub table decoder */
...@@ -134,11 +134,11 @@ void dvbpsi_DetachNIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, ...@@ -134,11 +134,11 @@ void dvbpsi_DetachNIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id,
} }
/**************************************************************************** /****************************************************************************
* dvbpsi_InitNIT * dvbpsi_nit_init
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_nit_t structure. * Initialize a pre-allocated dvbpsi_nit_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id, void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint16_t i_network_id,
uint8_t i_version, bool b_current_next) uint8_t i_version, bool b_current_next)
{ {
p_nit->i_network_id = i_network_id; p_nit->i_network_id = i_network_id;
...@@ -149,25 +149,25 @@ void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id, ...@@ -149,25 +149,25 @@ void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id,
} }
/**************************************************************************** /****************************************************************************
* dvbpsi_NewNIT * dvbpsi_nit_new
***************************************************************************** *****************************************************************************
* Allocate and initialize a dvbpsi_nit_t structure. * Allocate and initialize a dvbpsi_nit_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_nit_t *dvbpsi_NewNIT(uint16_t i_network_id, uint8_t i_version, dvbpsi_nit_t *dvbpsi_nit_new(uint16_t i_network_id, uint8_t i_version,
bool b_current_next) bool b_current_next)
{ {
dvbpsi_nit_t*p_nit = (dvbpsi_nit_t*)malloc(sizeof(dvbpsi_nit_t)); dvbpsi_nit_t*p_nit = (dvbpsi_nit_t*)malloc(sizeof(dvbpsi_nit_t));
if (p_nit != NULL) if (p_nit != NULL)
dvbpsi_InitNIT(p_nit, i_network_id, i_version, b_current_next); dvbpsi_nit_init(p_nit, i_network_id, i_version, b_current_next);
return p_nit; return p_nit;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyNIT * dvbpsi_nit_empty
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_nit_t structure. * Clean a dvbpsi_nit_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_EmptyNIT(dvbpsi_nit_t* p_nit) void dvbpsi_nit_empty(dvbpsi_nit_t* p_nit)
{ {
dvbpsi_nit_ts_t* p_ts = p_nit->p_first_ts; dvbpsi_nit_ts_t* p_ts = p_nit->p_first_ts;
...@@ -186,25 +186,25 @@ void dvbpsi_EmptyNIT(dvbpsi_nit_t* p_nit) ...@@ -186,25 +186,25 @@ void dvbpsi_EmptyNIT(dvbpsi_nit_t* p_nit)
} }
/**************************************************************************** /****************************************************************************
* dvbpsi_DeleteNIT * dvbpsi_nit_delete
***************************************************************************** *****************************************************************************
* Clean and delete a dvbpsi_nit_t structure. * Clean and delete a dvbpsi_nit_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteNIT(dvbpsi_nit_t *p_nit) void dvbpsi_nit_delete(dvbpsi_nit_t *p_nit)
{ {
if (p_nit) if (p_nit)
dvbpsi_EmptyNIT(p_nit); dvbpsi_nit_empty(p_nit);
free(p_nit); free(p_nit);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NITAddDescriptor * dvbpsi_nit_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the NIT. * Add a descriptor in the NIT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit, dvbpsi_descriptor_t* dvbpsi_nit_descriptor_add(dvbpsi_nit_t* p_nit,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
{ {
dvbpsi_descriptor_t* p_descriptor dvbpsi_descriptor_t* p_descriptor
= dvbpsi_NewDescriptor(i_tag, i_length, p_data); = dvbpsi_NewDescriptor(i_tag, i_length, p_data);
...@@ -224,12 +224,12 @@ dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit, ...@@ -224,12 +224,12 @@ dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NITAddTS * dvbpsi_nit_ts_add
***************************************************************************** *****************************************************************************
* Add an TS in the NIT. * Add an TS in the NIT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit, dvbpsi_nit_ts_t* dvbpsi_nit_ts_add(dvbpsi_nit_t* p_nit,
uint16_t i_ts_id, uint16_t i_orig_network_id) uint16_t i_ts_id, uint16_t i_orig_network_id)
{ {
dvbpsi_nit_ts_t* p_ts = (dvbpsi_nit_ts_t*)malloc(sizeof(dvbpsi_nit_ts_t)); dvbpsi_nit_ts_t* p_ts = (dvbpsi_nit_ts_t*)malloc(sizeof(dvbpsi_nit_ts_t));
if (p_ts == NULL) if (p_ts == NULL)
...@@ -253,13 +253,13 @@ dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit, ...@@ -253,13 +253,13 @@ dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NITTSAddDescriptor * dvbpsi_nit_ts_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the NIT TS. * Add a descriptor in the NIT TS.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts, dvbpsi_descriptor_t* dvbpsi_nit_ts_descriptor_add(dvbpsi_nit_ts_t* p_ts,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
{ {
dvbpsi_descriptor_t* p_descriptor dvbpsi_descriptor_t* p_descriptor
= dvbpsi_NewDescriptor(i_tag, i_length, p_data); = dvbpsi_NewDescriptor(i_tag, i_length, p_data);
...@@ -280,14 +280,14 @@ static void dvbpsi_ReInitNIT(dvbpsi_nit_decoder_t* p_decoder, const bool b_force ...@@ -280,14 +280,14 @@ static void dvbpsi_ReInitNIT(dvbpsi_nit_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
/* Free structures */ /* Free structures */
if (p_decoder->p_building_nit) if (p_decoder->p_building_nit)
dvbpsi_DeleteNIT(p_decoder->p_building_nit); dvbpsi_nit_delete(p_decoder->p_building_nit);
} }
p_decoder->p_building_nit = NULL; p_decoder->p_building_nit = NULL;
} }
...@@ -331,7 +331,7 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit ...@@ -331,7 +331,7 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (p_nit_decoder->p_building_nit == NULL) if (p_nit_decoder->p_building_nit == NULL)
{ {
p_nit_decoder->p_building_nit = dvbpsi_NewNIT(p_nit_decoder->i_network_id, p_nit_decoder->p_building_nit = dvbpsi_nit_new(p_nit_decoder->i_network_id,
p_section->i_version, p_section->b_current_next); p_section->i_version, p_section->b_current_next);
if (p_nit_decoder->p_building_nit == NULL) if (p_nit_decoder->p_building_nit == NULL)
return false; return false;
...@@ -339,7 +339,7 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit ...@@ -339,7 +339,7 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_nit_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_nit_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "NIT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "NIT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -347,13 +347,13 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit ...@@ -347,13 +347,13 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherNITSections * dvbpsi_nit_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi, void dvbpsi_nit_sections_gather(dvbpsi_t *p_dvbpsi,
dvbpsi_decoder_t *p_private_decoder, dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section) dvbpsi_psi_section_t *p_section)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -420,7 +420,7 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi, ...@@ -420,7 +420,7 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_nit_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_nit_decoder)))
{ {
assert(p_nit_decoder->pf_nit_callback); assert(p_nit_decoder->pf_nit_callback);
...@@ -429,11 +429,11 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi, ...@@ -429,11 +429,11 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
p_nit_decoder->b_current_valid = true; p_nit_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_nit_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_nit_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodeNITSections(p_nit_decoder->p_building_nit, dvbpsi_nit_sections_decode(p_nit_decoder->p_building_nit,
p_nit_decoder->ap_sections[0]); p_nit_decoder->ap_sections[0]);
/* Delete the sections */ /* Delete the sections */
dvbpsi_DeletePSISections(p_nit_decoder->ap_sections[0]); dvbpsi_DeletePSISections(p_nit_decoder->ap_sections[0]);
p_nit_decoder->ap_sections[0] = NULL; p_nit_decoder->ap_sections[0] = NULL;
...@@ -446,12 +446,12 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi, ...@@ -446,12 +446,12 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeNITSections * dvbpsi_nit_sections_decode
***************************************************************************** *****************************************************************************
* NIT decoder. * NIT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit, void dvbpsi_nit_sections_decode(dvbpsi_nit_t* p_nit,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
uint8_t* p_byte, * p_end, * p_end2; uint8_t* p_byte, * p_end, * p_end2;
...@@ -467,7 +467,7 @@ void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit, ...@@ -467,7 +467,7 @@ void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if (i_length + 2 <= p_end - p_byte) if (i_length + 2 <= p_end - p_byte)
dvbpsi_NITAddDescriptor(p_nit, i_tag, i_length, p_byte + 2); dvbpsi_nit_descriptor_add(p_nit, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
...@@ -485,7 +485,7 @@ void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit, ...@@ -485,7 +485,7 @@ void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit,
uint16_t i_ts_id = ((uint16_t)p_byte[0] << 8) | p_byte[1]; uint16_t i_ts_id = ((uint16_t)p_byte[0] << 8) | p_byte[1];
uint16_t i_orig_network_id = ((uint16_t)p_byte[2] << 8) | p_byte[3]; uint16_t i_orig_network_id = ((uint16_t)p_byte[2] << 8) | p_byte[3];
uint16_t i_ts_length = ((uint16_t)(p_byte[4] & 0x0f) << 8) | p_byte[5]; uint16_t i_ts_length = ((uint16_t)(p_byte[4] & 0x0f) << 8) | p_byte[5];
dvbpsi_nit_ts_t* p_ts = dvbpsi_NITAddTS(p_nit, i_ts_id, i_orig_network_id); dvbpsi_nit_ts_t* p_ts = dvbpsi_nit_ts_add(p_nit, i_ts_id, i_orig_network_id);
/* - TS descriptors */ /* - TS descriptors */
p_byte += 6; p_byte += 6;
p_end2 = p_byte + i_ts_length; p_end2 = p_byte + i_ts_length;
...@@ -498,7 +498,7 @@ void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit, ...@@ -498,7 +498,7 @@ void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if (i_length + 2 <= p_end2 - p_byte) if (i_length + 2 <= p_end2 - p_byte)
dvbpsi_NITTSAddDescriptor(p_ts, i_tag, i_length, p_byte + 2); dvbpsi_nit_ts_descriptor_add(p_ts, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
} }
...@@ -507,11 +507,11 @@ void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit, ...@@ -507,11 +507,11 @@ void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenNITSections * dvbpsi_nit_sections_generate
***************************************************************************** *****************************************************************************
* Generate NIT sections based on the dvbpsi_nit_t structure. * Generate NIT sections based on the dvbpsi_nit_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* dvbpsi_nit_sections_generate(dvbpsi_t *p_dvbpsi,
dvbpsi_nit_t* p_nit, uint8_t i_table_id) dvbpsi_nit_t* p_nit, uint8_t i_table_id)
{ {
dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024); dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024);
......
...@@ -103,10 +103,10 @@ typedef struct dvbpsi_nit_s ...@@ -103,10 +103,10 @@ typedef struct dvbpsi_nit_s
typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit); typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachNIT * dvbpsi_nit_attach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, * \fn bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_nit_callback pf_callback, uint16_t i_extension, dvbpsi_nit_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a NIT decoder. It is attached to p_dvbpsi. * \brief Creation and initialization of a NIT decoder. It is attached to p_dvbpsi.
...@@ -117,15 +117,15 @@ typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit); ...@@ -117,15 +117,15 @@ typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit);
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_nit_callback pf_callback, uint16_t i_extension, dvbpsi_nit_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachNIT * dvbpsi_nit_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachNIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn void dvbpsi_nit_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a NIT decoder. * \brief Destroy a NIT decoder.
* \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached.
...@@ -133,14 +133,14 @@ bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -133,14 +133,14 @@ bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
* \param i_extension Table ID extension, here service ID. * \param i_extension Table ID extension, here service ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, void dvbpsi_nit_detach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension); uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitNIT/dvbpsi_NewNIT * dvbpsi_nit_init/dvbpsi_nit_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id, * \fn void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint16_t i_network_id,
uint8_t i_version, bool b_current_next) uint8_t i_version, bool b_current_next)
* \brief Initialize a user-allocated dvbpsi_nit_t structure. * \brief Initialize a user-allocated dvbpsi_nit_t structure.
* \param p_nit pointer to the NIT structure * \param p_nit pointer to the NIT structure
...@@ -149,11 +149,11 @@ void dvbpsi_DetachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -149,11 +149,11 @@ void dvbpsi_DetachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id, void dvbpsi_nit_init(dvbpsi_nit_t* p_nit, uint16_t i_network_id,
uint8_t i_version, bool b_current_next); uint8_t i_version, bool b_current_next);
/*! /*!
* \fn dvbpsi_nit_t *dvbpsi_NewNIT(uint16_t i_network_id, uint8_t i_version, * \fn dvbpsi_nit_t *dvbpsi_nit_new(uint16_t i_network_id, uint8_t i_version,
* bool b_current_next); * bool b_current_next);
* \brief Allocate and initialize a new dvbpsi_nit_t structure. * \brief Allocate and initialize a new dvbpsi_nit_t structure.
* \param i_network_id network id * \param i_network_id network id
...@@ -161,36 +161,36 @@ void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id, ...@@ -161,36 +161,36 @@ void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id,
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return p_nit pointer to the NIT structure * \return p_nit pointer to the NIT structure
*/ */
dvbpsi_nit_t *dvbpsi_NewNIT(uint16_t i_network_id, uint8_t i_version, dvbpsi_nit_t *dvbpsi_nit_new(uint16_t i_network_id, uint8_t i_version,
bool b_current_next); bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyNIT/dvbpsi_DeleteNIT * dvbpsi_nit_empty/dvbpsi_nit_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_EmptyNIT(dvbpsi_nit_t* p_nit) * \fn void dvbpsi_nit_empty(dvbpsi_nit_t* p_nit)
* \brief Clean a dvbpsi_nit_t structure. * \brief Clean a dvbpsi_nit_t structure.
* \param p_nit pointer to the NIT structure * \param p_nit pointer to the NIT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_EmptyNIT(dvbpsi_nit_t* p_nit); void dvbpsi_nit_empty(dvbpsi_nit_t* p_nit);
/*! /*!
* \fn dvbpsi_DeleteNIT(dvbpsi_nit_t *p_nit) * \fn dvbpsi_nit_delete(dvbpsi_nit_t *p_nit)
* \brief Clean and free a dvbpsi_nit_t structure. * \brief Clean and free a dvbpsi_nit_t structure.
* \param p_nit pointer to the NIT structure * \param p_nit pointer to the NIT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeleteNIT(dvbpsi_nit_t *p_nit); void dvbpsi_nit_delete(dvbpsi_nit_t *p_nit);
/***************************************************************************** /*****************************************************************************
* dvbpsi_NITAddDescriptor * dvbpsi_nit_descriptor_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit, * \fn dvbpsi_descriptor_t* dvbpsi_nit_descriptor_add(dvbpsi_nit_t* p_nit,
uint8_t i_tag, uint8_t i_tag,
uint8_t i_length, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
* \brief Add a descriptor in the NIT. * \brief Add a descriptor in the NIT.
* \param p_nit pointer to the NIT structure * \param p_nit pointer to the NIT structure
* \param i_tag descriptor's tag * \param i_tag descriptor's tag
...@@ -198,33 +198,33 @@ void dvbpsi_DeleteNIT(dvbpsi_nit_t *p_nit); ...@@ -198,33 +198,33 @@ void dvbpsi_DeleteNIT(dvbpsi_nit_t *p_nit);
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t *p_nit, dvbpsi_descriptor_t* dvbpsi_nit_descriptor_add(dvbpsi_nit_t *p_nit,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data); uint8_t *p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_NITAddTS * dvbpsi_nit_ts_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit, * \fn dvbpsi_nit_ts_t* dvbpsi_nit_ts_add(dvbpsi_nit_t* p_nit,
uint16_t i_ts_id, uint16_t i_orig_network_id) uint16_t i_ts_id, uint16_t i_orig_network_id)
* \brief Add an TS in the NIT. * \brief Add an TS in the NIT.
* \param p_nit pointer to the NIT structure * \param p_nit pointer to the NIT structure
* \param i_ts_id type of TS * \param i_ts_id type of TS
* \param i_orig_network_id PID of the TS * \param i_orig_network_id PID of the TS
* \return a pointer to the added TS. * \return a pointer to the added TS.
*/ */
dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit, dvbpsi_nit_ts_t* dvbpsi_nit_ts_add(dvbpsi_nit_t* p_nit,
uint16_t i_ts_id, uint16_t i_orig_network_id); uint16_t i_ts_id, uint16_t i_orig_network_id);
/***************************************************************************** /*****************************************************************************
* dvbpsi_NITTSAddDescriptor * dvbpsi_nit_ts_descriptor_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts, * \fn dvbpsi_descriptor_t* dvbpsi_nit_ts_descriptor_add(dvbpsi_nit_ts_t* p_ts,
uint8_t i_tag, uint8_t i_tag,
uint8_t i_length, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
* \brief Add a descriptor in the NIT TS. * \brief Add a descriptor in the NIT TS.
* \param p_ts pointer to the TS structure * \param p_ts pointer to the TS structure
* \param i_tag descriptor's tag * \param i_tag descriptor's tag
...@@ -232,15 +232,15 @@ dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit, ...@@ -232,15 +232,15 @@ dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit,
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts, dvbpsi_descriptor_t* dvbpsi_nit_ts_descriptor_add(dvbpsi_nit_ts_t* p_ts,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenNITSections * dvbpsi_nit_sections_generate
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_t *p_dvbpsi, dvbpsi_nit_t* p_nit, * \fn dvbpsi_psi_section_t* dvbpsi_nit_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_nit_t* p_nit,
uint8_t i_table_id) uint8_t i_table_id)
* \brief NIT generator * \brief NIT generator
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
...@@ -250,7 +250,36 @@ dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts, ...@@ -250,7 +250,36 @@ dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts,
* *
* Generate NIT sections based on the dvbpsi_nit_t structure. * Generate NIT sections based on the dvbpsi_nit_t structure.
*/ */
dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_t* p_dvbpsi, dvbpsi_nit_t* p_nit, dvbpsi_psi_section_t* dvbpsi_nit_sections_generate(dvbpsi_t* p_dvbpsi, dvbpsi_nit_t* p_nit,
uint8_t i_table_id);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
__attribute__((deprecated))
int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_nit_callback pf_callback,
void* p_cb_data);
__attribute__((deprecated))
void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension);
__attribute__((deprecated))
void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id,
uint8_t i_version, int b_current_next);
__attribute__((deprecated)) void dvbpsi_EmptyNIT(dvbpsi_nit_t* p_nit);
__attribute__((deprecated))
dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit,
uint8_t i_tag, uint8_t i_length,
uint8_t* p_data);
__attribute__((deprecated))
dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit,
uint16_t i_ts_id, uint16_t i_orig_network_id);
__attribute__((deprecated))
dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts,
uint8_t i_tag, uint8_t i_length,
uint8_t* p_data);
__attribute__((deprecated))
dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_nit_t* p_nit,
uint8_t i_table_id); uint8_t i_table_id);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -50,22 +50,31 @@ typedef struct dvbpsi_nit_decoder_s ...@@ -50,22 +50,31 @@ typedef struct dvbpsi_nit_decoder_s
} dvbpsi_nit_decoder_t; } dvbpsi_nit_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherNITSections * dvbpsi_nit_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherNITSections(dvbpsi_t* p_dvbpsi, void dvbpsi_nit_sections_gather(dvbpsi_t* p_dvbpsi,
dvbpsi_decoder_t* p_private_decoder, dvbpsi_decoder_t* p_private_decoder,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeNITSections * dvbpsi_nit_sections_decode
***************************************************************************** *****************************************************************************
* NIT decoder. * NIT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_nit_sections_decode(dvbpsi_nit_t* p_nit,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* Deprecated API's
*****************************************************************************/
__attribute__((deprecated))
void dvbpsi_GatherNITSections(dvbpsi_handle* p_dvbpsi,
dvbpsi_decoder_t* p_private_decoder,
dvbpsi_psi_section_t* p_section);
void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit, void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
#else #else
#error "Multiple inclusions of nit_private.h" #error "Multiple inclusions of nit_private.h"
#endif #endif
......
/***************************************************************************** /*****************************************************************************
* pat.c: PAT decoder/generator * pat.c: PAT decoder/generator
*---------------------------------------------------------------------------- *----------------------------------------------------------------------------
* Copyright (C) 2001-2011 VideoLAN * Copyright (C) 2001-2012 VideoLAN
* $Id$ * $Id$
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
#include "pat_private.h" #include "pat_private.h"
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachPAT * dvbpsi_pat_attach
***************************************************************************** *****************************************************************************
* Initialize a PAT decoder and return a handle on it. * Initialize a PAT decoder and return a handle on it.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AttachPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback, bool dvbpsi_pat_attach(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback,
void* p_cb_data) void* p_cb_data)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -58,7 +58,7 @@ bool dvbpsi_AttachPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback, ...@@ -58,7 +58,7 @@ bool dvbpsi_AttachPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback,
/* PSI decoder configuration and initial state */ /* PSI decoder configuration and initial state */
dvbpsi_pat_decoder_t *p_pat_decoder; dvbpsi_pat_decoder_t *p_pat_decoder;
p_pat_decoder = (dvbpsi_pat_decoder_t*) dvbpsi_NewDecoder(&dvbpsi_GatherPATSections, p_pat_decoder = (dvbpsi_pat_decoder_t*) dvbpsi_decoder_new(&dvbpsi_pat_sections_gather,
1024, true, sizeof(dvbpsi_pat_decoder_t)); 1024, true, sizeof(dvbpsi_pat_decoder_t));
if (p_pat_decoder == NULL) if (p_pat_decoder == NULL)
return false; return false;
...@@ -73,30 +73,30 @@ bool dvbpsi_AttachPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback, ...@@ -73,30 +73,30 @@ bool dvbpsi_AttachPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachPAT * dvbpsi_pat_detach
***************************************************************************** *****************************************************************************
* Close a PAT decoder. The handle isn't valid any more. * Close a PAT decoder. The handle isn't valid any more.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachPAT(dvbpsi_t *p_dvbpsi) void dvbpsi_pat_detach(dvbpsi_t *p_dvbpsi)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
dvbpsi_pat_decoder_t* p_pat_decoder = (dvbpsi_pat_decoder_t*)p_dvbpsi->p_decoder; dvbpsi_pat_decoder_t* p_pat_decoder = (dvbpsi_pat_decoder_t*)p_dvbpsi->p_decoder;
if (p_pat_decoder->p_building_pat) if (p_pat_decoder->p_building_pat)
dvbpsi_DeletePAT(p_pat_decoder->p_building_pat); dvbpsi_pat_delete(p_pat_decoder->p_building_pat);
p_pat_decoder->p_building_pat = NULL; p_pat_decoder->p_building_pat = NULL;
dvbpsi_DeleteDecoder(p_dvbpsi->p_decoder); dvbpsi_decoder_delete(p_dvbpsi->p_decoder);
p_dvbpsi->p_decoder = NULL; p_dvbpsi->p_decoder = NULL;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitPAT * dvbpsi_pat_init
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_pat_t structure. * Initialize a pre-allocated dvbpsi_pat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_pat_init(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version,
bool b_current_next) bool b_current_next)
{ {
assert(p_pat); assert(p_pat);
...@@ -108,25 +108,25 @@ void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version, ...@@ -108,25 +108,25 @@ void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewPAT * dvbpsi_pat_new
***************************************************************************** *****************************************************************************
* Allocate and Initialize a newly allocated dvbpsi_pat_t structure. * Allocate and Initialize a newly allocated dvbpsi_pat_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_pat_t *dvbpsi_NewPAT(uint16_t i_ts_id, uint8_t i_version, dvbpsi_pat_t *dvbpsi_pat_new(uint16_t i_ts_id, uint8_t i_version,
bool b_current_next) bool b_current_next)
{ {
dvbpsi_pat_t *p_pat = (dvbpsi_pat_t*)malloc(sizeof(dvbpsi_pat_t)); dvbpsi_pat_t *p_pat = (dvbpsi_pat_t*)malloc(sizeof(dvbpsi_pat_t));
if (p_pat) if (p_pat)
dvbpsi_InitPAT(p_pat, i_ts_id, i_version, b_current_next); dvbpsi_pat_init(p_pat, i_ts_id, i_version, b_current_next);
return p_pat; return p_pat;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyPAT * dvbpsi_pat_empty
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_pat_t structure. * Clean a dvbpsi_pat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_EmptyPAT(dvbpsi_pat_t* p_pat) void dvbpsi_pat_empty(dvbpsi_pat_t* p_pat)
{ {
dvbpsi_pat_program_t* p_program = p_pat->p_first_program; dvbpsi_pat_program_t* p_program = p_pat->p_first_program;
...@@ -140,24 +140,24 @@ void dvbpsi_EmptyPAT(dvbpsi_pat_t* p_pat) ...@@ -140,24 +140,24 @@ void dvbpsi_EmptyPAT(dvbpsi_pat_t* p_pat)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeletePAT * dvbpsi_pat_delete
***************************************************************************** *****************************************************************************
* Clean and Delete dvbpsi_pat_t structure. * Clean and Delete dvbpsi_pat_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeletePAT(dvbpsi_pat_t *p_pat) void dvbpsi_pat_delete(dvbpsi_pat_t *p_pat)
{ {
if (p_pat) if (p_pat)
dvbpsi_EmptyPAT(p_pat); dvbpsi_pat_empty(p_pat);
free(p_pat); free(p_pat);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_PATAddProgram * dvbpsi_pat_program_add
***************************************************************************** *****************************************************************************
* Add a program at the end of the PAT. * Add a program at the end of the PAT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat, dvbpsi_pat_program_t* dvbpsi_pat_program_add(dvbpsi_pat_t* p_pat,
uint16_t i_number, uint16_t i_pid) uint16_t i_number, uint16_t i_pid)
{ {
dvbpsi_pat_program_t* p_program; dvbpsi_pat_program_t* p_program;
...@@ -187,14 +187,14 @@ static void dvbpsi_ReInitPAT(dvbpsi_pat_decoder_t* p_decoder, const bool b_force ...@@ -187,14 +187,14 @@ static void dvbpsi_ReInitPAT(dvbpsi_pat_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
/* Free structures */ /* Free structures */
if (p_decoder->p_building_pat) if (p_decoder->p_building_pat)
dvbpsi_DeletePAT(p_decoder->p_building_pat); dvbpsi_pat_delete(p_decoder->p_building_pat);
} }
p_decoder->p_building_pat = NULL; p_decoder->p_building_pat = NULL;
} }
...@@ -246,7 +246,7 @@ static bool dvbpsi_AddSectionPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_decoder_t *p_pat ...@@ -246,7 +246,7 @@ static bool dvbpsi_AddSectionPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_decoder_t *p_pat
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (p_pat_decoder->p_building_pat == NULL) if (p_pat_decoder->p_building_pat == NULL)
{ {
p_pat_decoder->p_building_pat = dvbpsi_NewPAT(p_section->i_extension, p_pat_decoder->p_building_pat = dvbpsi_pat_new(p_section->i_extension,
p_section->i_version, p_section->b_current_next); p_section->i_version, p_section->b_current_next);
if (p_pat_decoder->p_building_pat == NULL) if (p_pat_decoder->p_building_pat == NULL)
return false; return false;
...@@ -255,18 +255,18 @@ static bool dvbpsi_AddSectionPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_decoder_t *p_pat ...@@ -255,18 +255,18 @@ static bool dvbpsi_AddSectionPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_decoder_t *p_pat
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_pat_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_pat_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "PAT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "PAT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
return true; return true;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherPATSections * dvbpsi_pat_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section) void dvbpsi_pat_sections_gather(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section)
{ {
dvbpsi_pat_decoder_t* p_pat_decoder; dvbpsi_pat_decoder_t* p_pat_decoder;
...@@ -322,7 +322,7 @@ void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_sectio ...@@ -322,7 +322,7 @@ void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_sectio
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_pat_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_pat_decoder)))
{ {
assert(p_pat_decoder->pf_pat_callback); assert(p_pat_decoder->pf_pat_callback);
...@@ -331,11 +331,11 @@ void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_sectio ...@@ -331,11 +331,11 @@ void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_sectio
p_pat_decoder->b_current_valid = true; p_pat_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_pat_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_pat_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodePATSections(p_pat_decoder->p_building_pat, dvbpsi_pat_sections_decode(p_pat_decoder->p_building_pat,
p_pat_decoder->ap_sections[0]); p_pat_decoder->ap_sections[0]);
/* Delete the sections */ /* Delete the sections */
dvbpsi_DeletePSISections(p_pat_decoder->ap_sections[0]); dvbpsi_DeletePSISections(p_pat_decoder->ap_sections[0]);
...@@ -355,8 +355,7 @@ void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_sectio ...@@ -355,8 +355,7 @@ void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_sectio
***************************************************************************** *****************************************************************************
* PAT decoder. * PAT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat, void dvbpsi_pat_sections_decode(dvbpsi_pat_t* p_pat, dvbpsi_psi_section_t* p_section)
dvbpsi_psi_section_t* p_section)
{ {
while (p_section) while (p_section)
{ {
...@@ -366,7 +365,7 @@ void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat, ...@@ -366,7 +365,7 @@ void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat,
{ {
uint16_t i_program_number = ((uint16_t)(p_byte[0]) << 8) | p_byte[1]; uint16_t i_program_number = ((uint16_t)(p_byte[0]) << 8) | p_byte[1];
uint16_t i_pid = ((uint16_t)(p_byte[2] & 0x1f) << 8) | p_byte[3]; uint16_t i_pid = ((uint16_t)(p_byte[2] & 0x1f) << 8) | p_byte[3];
dvbpsi_PATAddProgram(p_pat, i_program_number, i_pid); dvbpsi_pat_program_add(p_pat, i_program_number, i_pid);
} }
p_section = p_section->p_next; p_section = p_section->p_next;
...@@ -374,12 +373,12 @@ void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat, ...@@ -374,12 +373,12 @@ void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenPATSections * dvbpsi_pat_sections_generate
***************************************************************************** *****************************************************************************
* Generate PAT sections based on the dvbpsi_pat_t structure. The third * Generate PAT sections based on the dvbpsi_pat_t structure. The third
* argument is used to limit the number of program in each section (max: 253). * argument is used to limit the number of program in each section (max: 253).
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* dvbpsi_pat_sections_generate(dvbpsi_t *p_dvbpsi,
dvbpsi_pat_t* p_pat, int i_max_pps) dvbpsi_pat_t* p_pat, int i_max_pps)
{ {
dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024); dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024);
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
extern "C" { extern "C" {
#endif #endif
/***************************************************************************** /*****************************************************************************
* dvbpsi_pat_program_t * dvbpsi_pat_program_t
*****************************************************************************/ *****************************************************************************/
...@@ -99,37 +98,37 @@ typedef struct dvbpsi_pat_s ...@@ -99,37 +98,37 @@ typedef struct dvbpsi_pat_s
typedef void (* dvbpsi_pat_callback)(void* p_cb_data, dvbpsi_pat_t* p_new_pat); typedef void (* dvbpsi_pat_callback)(void* p_cb_data, dvbpsi_pat_t* p_new_pat);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachPAT * dvbpsi_pat_attach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AttachPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback, void* p_cb_data) * \fn bool dvbpsi_pat_attach(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback, void* p_cb_data)
* \brief Creation and initialization of a PAT decoder. The decoder will be attached to 'p_dvbpsi' argument. * \brief Creation and initialization of a PAT decoder. The decoder will be attached to 'p_dvbpsi' argument.
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
* \param pf_callback function to call back on new PAT * \param pf_callback function to call back on new PAT
* \param p_cb_data private data given in argument to the callback * \param p_cb_data private data given in argument to the callback
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_AttachPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback, bool dvbpsi_pat_attach(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachPAT * dvbpsi_pat_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachPAT(dvbpsi_t *p_dvbpsi) * \fn void dvbpsi_pat_detach(dvbpsi_t *p_dvbpsi)
* \brief Destroy a PAT decoder. * \brief Destroy a PAT decoder.
* \param p_dvbpsi pointer to dvbpsi_t handle * \param p_dvbpsi pointer to dvbpsi_t handle
* \return nothing. * \return nothing.
* *
* The handle isn't valid any more. * The handle isn't valid any more.
*/ */
void dvbpsi_DetachPAT(dvbpsi_t *p_dvbpsi); void dvbpsi_pat_detach(dvbpsi_t *p_dvbpsi);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitPAT/dvbpsi_NewPAT * dvbpsi_pat_init/dvbpsi_pat_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, * \fn void dvbpsi_pat_init(dvbpsi_pat_t* p_pat, uint16_t i_ts_id,
uint8_t i_version, bool b_current_next) uint8_t i_version, bool b_current_next)
* \brief Initialize a user-allocated dvbpsi_pat_t structure. * \brief Initialize a user-allocated dvbpsi_pat_t structure.
* \param p_pat pointer to the PAT structure * \param p_pat pointer to the PAT structure
...@@ -138,11 +137,11 @@ void dvbpsi_DetachPAT(dvbpsi_t *p_dvbpsi); ...@@ -138,11 +137,11 @@ void dvbpsi_DetachPAT(dvbpsi_t *p_dvbpsi);
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return nothing. * \return nothing.
*/ */
void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_pat_init(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version,
bool b_current_next); bool b_current_next);
/*! /*!
* \fn dvbpsi_pat_t *dvbpsi_NewPAT(uint16_t i_ts_id, uint8_t i_version, * \fn dvbpsi_pat_t *dvbpsi_pat_new(uint16_t i_ts_id, uint8_t i_version,
* bool b_current_next); * bool b_current_next);
* \brief Allocate and initialize a new dvbpsi_pat_t structure. * \brief Allocate and initialize a new dvbpsi_pat_t structure.
* \param i_ts_id transport stream ID * \param i_ts_id transport stream ID
...@@ -150,48 +149,48 @@ void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version, ...@@ -150,48 +149,48 @@ void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version,
* \param b_current_next current next indicator * \param b_current_next current next indicator
* \return p_pat pointer to the PAT structure * \return p_pat pointer to the PAT structure
*/ */
dvbpsi_pat_t *dvbpsi_NewPAT(uint16_t i_ts_id, uint8_t i_version, bool b_current_next); dvbpsi_pat_t *dvbpsi_pat_new(uint16_t i_ts_id, uint8_t i_version, bool b_current_next);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyPAT/dvbpsi_DeletePAT * dvbpsi_pat_empty/dvbpsi_pat_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_EmptyPAT(dvbpsi_pat_t* p_pat) * \fn void dvbpsi_pat_empty(dvbpsi_pat_t* p_pat)
* \brief Clean a dvbpsi_pat_t structure. * \brief Clean a dvbpsi_pat_t structure.
* \param p_pat pointer to the PAT structure * \param p_pat pointer to the PAT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_EmptyPAT(dvbpsi_pat_t* p_pat); void dvbpsi_pat_empty(dvbpsi_pat_t* p_pat);
/*! /*!
* \fn void dvbpsi_DeletePAT(dvbpsi_pat_t *p_pat) * \fn void dvbpsi_pat_delete(dvbpsi_pat_t *p_pat)
* \brief Clean and free a dvbpsi_pat_t structure. * \brief Clean and free a dvbpsi_pat_t structure.
* \param p_pat pointer to the PAT structure * \param p_pat pointer to the PAT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeletePAT(dvbpsi_pat_t *p_pat); void dvbpsi_pat_delete(dvbpsi_pat_t *p_pat);
/***************************************************************************** /*****************************************************************************
* dvbpsi_PATAddProgram * dvbpsi_pat_program_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat, * \fn dvbpsi_pat_program_t* dvbpsi_pat_program_add(dvbpsi_pat_t* p_pat,
uint16_t i_number, uint16_t i_number,
uint16_t i_pid) uint16_t i_pid)
* \brief Add a program at the end of the PAT. * \brief Add a program at the end of the PAT.
* \param p_pat pointer to the PAT structure * \param p_pat pointer to the PAT structure
* \param i_number program number * \param i_number program number
* \param i_pid PID of the NIT/PMT * \param i_pid PID of the NIT/PMT
* \return a pointer to the added program. * \return a pointer to the added program.
*/ */
dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat, dvbpsi_pat_program_t* dvbpsi_pat_program_add(dvbpsi_pat_t* p_pat,
uint16_t i_number, uint16_t i_pid); uint16_t i_number, uint16_t i_pid);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenPATSections * dvbpsi_pat_sections_generate
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_t *p_dvbpsi, dvbpsi_pat_t* p_pat, * \fn dvbpsi_psi_section_t* dvbpsi_pat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_pat_t* p_pat,
int i_max_pps); int i_max_pps);
* \brief PAT generator. * \brief PAT generator.
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
...@@ -202,9 +201,26 @@ dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat, ...@@ -202,9 +201,26 @@ dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat,
* *
* Generate PAT sections based on the dvbpsi_pat_t structure. * Generate PAT sections based on the dvbpsi_pat_t structure.
*/ */
dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* dvbpsi_pat_sections_generate(dvbpsi_t *p_dvbpsi,
dvbpsi_pat_t* p_pat, int i_max_pps); dvbpsi_pat_t* p_pat, int i_max_pps);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
__attribute__((deprecated))
dvbpsi_handle dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback,
void* p_cb_data);
__attribute__((deprecated)) void dvbpsi_DetachPAT(dvbpsi_handle h_dvbpsi);
__attribute__((deprecated))
void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version,
int b_current_next);
__attribute__((deprecated)) void dvbpsi_EmptyPAT(dvbpsi_pat_t* p_pat);
__attribute__((deprecated))
dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat,
uint16_t i_number, uint16_t i_pid);
__attribute__((deprecated))
dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_pat_t* p_pat, int i_max_pps);
#ifdef __cplusplus #ifdef __cplusplus
}; };
#endif #endif
...@@ -212,4 +228,3 @@ dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_t *p_dvbpsi, ...@@ -212,4 +228,3 @@ dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_t *p_dvbpsi,
#else #else
#error "Multiple inclusions of pat.h" #error "Multiple inclusions of pat.h"
#endif #endif
...@@ -45,21 +45,29 @@ typedef struct dvbpsi_pat_decoder_s ...@@ -45,21 +45,29 @@ typedef struct dvbpsi_pat_decoder_s
} dvbpsi_pat_decoder_t; } dvbpsi_pat_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherPATSections * dvbpsi_pat_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section); void dvbpsi_pat_sections_gather(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodePATSection * dvbpsi_DecodePATSection
***************************************************************************** *****************************************************************************
* PAT decoder. * PAT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat, void dvbpsi_pat_sections_decode(dvbpsi_pat_t* p_pat,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* Deprecated API's
*****************************************************************************/
__attribute__((deprecated))
void dvbpsi_DecodePATSection(dvbpsi_pat_t* p_pat,
dvbpsi_psi_section_t* p_section);
__attribute__((deprecated))
void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section);
#else #else
#error "Multiple inclusions of pat_private.h" #error "Multiple inclusions of pat_private.h"
......
...@@ -48,18 +48,18 @@ ...@@ -48,18 +48,18 @@
#include "pmt_private.h" #include "pmt_private.h"
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachPMT * dvbpsi_pmt_attach
***************************************************************************** *****************************************************************************
* Initialize a PMT decoder and return a handle on it. * Initialize a PMT decoder and return a handle on it.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, uint16_t i_program_number, bool dvbpsi_pmt_attach(dvbpsi_t *p_dvbpsi, uint16_t i_program_number,
dvbpsi_pmt_callback pf_callback, void* p_cb_data) dvbpsi_pmt_callback pf_callback, void* p_cb_data)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder == NULL); assert(p_dvbpsi->p_decoder == NULL);
dvbpsi_pmt_decoder_t* p_pmt_decoder; dvbpsi_pmt_decoder_t* p_pmt_decoder;
p_pmt_decoder = (dvbpsi_pmt_decoder_t*) dvbpsi_NewDecoder(&dvbpsi_GatherPMTSections, p_pmt_decoder = (dvbpsi_pmt_decoder_t*) dvbpsi_decoder_new(&dvbpsi_pmt_sections_gather,
1024, true, sizeof(dvbpsi_pmt_decoder_t)); 1024, true, sizeof(dvbpsi_pmt_decoder_t));
if (p_pmt_decoder == NULL) if (p_pmt_decoder == NULL)
return false; return false;
...@@ -76,11 +76,11 @@ bool dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, uint16_t i_program_number, ...@@ -76,11 +76,11 @@ bool dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, uint16_t i_program_number,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachPMT * dvbpsi_pmt_detach
***************************************************************************** *****************************************************************************
* Close a PMT decoder. The handle isn't valid any more. * Close a PMT decoder. The handle isn't valid any more.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi) void dvbpsi_pmt_detach(dvbpsi_t *p_dvbpsi)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -88,19 +88,19 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi) ...@@ -88,19 +88,19 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi)
dvbpsi_pmt_decoder_t* p_pmt_decoder; dvbpsi_pmt_decoder_t* p_pmt_decoder;
p_pmt_decoder = (dvbpsi_pmt_decoder_t*)p_dvbpsi->p_decoder; p_pmt_decoder = (dvbpsi_pmt_decoder_t*)p_dvbpsi->p_decoder;
if (p_pmt_decoder->p_building_pmt) if (p_pmt_decoder->p_building_pmt)
dvbpsi_DeletePMT(p_pmt_decoder->p_building_pmt); dvbpsi_pmt_delete(p_pmt_decoder->p_building_pmt);
p_pmt_decoder->p_building_pmt = NULL; p_pmt_decoder->p_building_pmt = NULL;
dvbpsi_DeleteDecoder(p_dvbpsi->p_decoder); dvbpsi_decoder_delete(p_dvbpsi->p_decoder);
p_dvbpsi->p_decoder = NULL; p_dvbpsi->p_decoder = NULL;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitPMT * dvbpsi_pmt_init
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_pmt_t structure. * Initialize a pre-allocated dvbpsi_pmt_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number, void dvbpsi_pmt_init(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number,
uint8_t i_version, bool b_current_next, uint16_t i_pcr_pid) uint8_t i_version, bool b_current_next, uint16_t i_pcr_pid)
{ {
assert(p_pmt); assert(p_pmt);
...@@ -114,26 +114,26 @@ void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number, ...@@ -114,26 +114,26 @@ void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewPMT * dvbpsi_pmt_new
***************************************************************************** *****************************************************************************
* Allocate and Initialize a new dvbpsi_pmt_t structure. * Allocate and Initialize a new dvbpsi_pmt_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_pmt_t* dvbpsi_NewPMT(uint16_t i_program_number, uint8_t i_version, dvbpsi_pmt_t* dvbpsi_pmt_new(uint16_t i_program_number, uint8_t i_version,
bool b_current_next, uint16_t i_pcr_pid) bool b_current_next, uint16_t i_pcr_pid)
{ {
dvbpsi_pmt_t *p_pmt = (dvbpsi_pmt_t*)malloc(sizeof(dvbpsi_pmt_t)); dvbpsi_pmt_t *p_pmt = (dvbpsi_pmt_t*)malloc(sizeof(dvbpsi_pmt_t));
if(p_pmt != NULL) if(p_pmt != NULL)
dvbpsi_InitPMT(p_pmt, i_program_number, i_version, dvbpsi_pmt_init(p_pmt, i_program_number, i_version,
b_current_next, i_pcr_pid); b_current_next, i_pcr_pid);
return p_pmt; return p_pmt;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyPMT * dvbpsi_pmt_empty
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_pmt_t structure. * Clean a dvbpsi_pmt_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt) void dvbpsi_pmt_empty(dvbpsi_pmt_t* p_pmt)
{ {
dvbpsi_pmt_es_t* p_es = p_pmt->p_first_es; dvbpsi_pmt_es_t* p_es = p_pmt->p_first_es;
...@@ -152,25 +152,25 @@ void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt) ...@@ -152,25 +152,25 @@ void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeletePMT * dvbpsi_pmt_delete
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_pmt_t structure. * Clean a dvbpsi_pmt_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeletePMT(dvbpsi_pmt_t* p_pmt) void dvbpsi_pmt_delete(dvbpsi_pmt_t* p_pmt)
{ {
if (p_pmt) if (p_pmt)
dvbpsi_EmptyPMT(p_pmt); dvbpsi_pmt_empty(p_pmt);
free(p_pmt); free(p_pmt);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_PMTAddDescriptor * dvbpsi_pmt_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the PMT. * Add a descriptor in the PMT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt, dvbpsi_descriptor_t* dvbpsi_pmt_descriptor_add(dvbpsi_pmt_t* p_pmt,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
{ {
dvbpsi_descriptor_t* p_descriptor; dvbpsi_descriptor_t* p_descriptor;
p_descriptor = dvbpsi_NewDescriptor(i_tag, i_length, p_data); p_descriptor = dvbpsi_NewDescriptor(i_tag, i_length, p_data);
...@@ -187,12 +187,12 @@ dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt, ...@@ -187,12 +187,12 @@ dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_PMTAddES * dvbpsi_pmt_es_add
***************************************************************************** *****************************************************************************
* Add an ES in the PMT. * Add an ES in the PMT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt, dvbpsi_pmt_es_t* dvbpsi_pmt_es_add(dvbpsi_pmt_t* p_pmt,
uint8_t i_type, uint16_t i_pid) uint8_t i_type, uint16_t i_pid)
{ {
dvbpsi_pmt_es_t* p_es = (dvbpsi_pmt_es_t*)malloc(sizeof(dvbpsi_pmt_es_t)); dvbpsi_pmt_es_t* p_es = (dvbpsi_pmt_es_t*)malloc(sizeof(dvbpsi_pmt_es_t));
if (p_es == NULL) if (p_es == NULL)
...@@ -216,11 +216,11 @@ dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt, ...@@ -216,11 +216,11 @@ dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_PMTESAddDescriptor * dvbpsi_pmt_es_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the PMT ES. * Add a descriptor in the PMT ES.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es, dvbpsi_descriptor_t* dvbpsi_pmt_es_descriptor_add(dvbpsi_pmt_es_t* p_es,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
{ {
...@@ -246,14 +246,14 @@ static void dvbpsi_ReInitPMT(dvbpsi_pmt_decoder_t* p_decoder, const bool b_force ...@@ -246,14 +246,14 @@ static void dvbpsi_ReInitPMT(dvbpsi_pmt_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
/* Free structures */ /* Free structures */
if (p_decoder->p_building_pmt) if (p_decoder->p_building_pmt)
dvbpsi_DeletePMT(p_decoder->p_building_pmt); dvbpsi_pmt_delete(p_decoder->p_building_pmt);
} }
p_decoder->p_building_pmt = NULL; p_decoder->p_building_pmt = NULL;
} }
...@@ -296,7 +296,7 @@ static bool dvbpsi_AddSectionPMT(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_decoder_t *p_pmt ...@@ -296,7 +296,7 @@ static bool dvbpsi_AddSectionPMT(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_decoder_t *p_pmt
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (p_pmt_decoder->p_building_pmt == NULL) if (p_pmt_decoder->p_building_pmt == NULL)
{ {
p_pmt_decoder->p_building_pmt = dvbpsi_NewPMT(p_pmt_decoder->i_program_number, p_pmt_decoder->p_building_pmt = dvbpsi_pmt_new(p_pmt_decoder->i_program_number,
p_section->i_version, p_section->b_current_next, p_section->i_version, p_section->b_current_next,
((uint16_t)(p_section->p_payload_start[0] & 0x1f) << 8) ((uint16_t)(p_section->p_payload_start[0] & 0x1f) << 8)
| p_section->p_payload_start[1]); | p_section->p_payload_start[1]);
...@@ -307,7 +307,7 @@ static bool dvbpsi_AddSectionPMT(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_decoder_t *p_pmt ...@@ -307,7 +307,7 @@ static bool dvbpsi_AddSectionPMT(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_decoder_t *p_pmt
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_pmt_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_pmt_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "PMT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "PMT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -319,7 +319,7 @@ static bool dvbpsi_AddSectionPMT(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_decoder_t *p_pmt ...@@ -319,7 +319,7 @@ static bool dvbpsi_AddSectionPMT(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_decoder_t *p_pmt
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section) void dvbpsi_pmt_sections_gather(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -383,7 +383,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio ...@@ -383,7 +383,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
return; return;
} }
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_pmt_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_pmt_decoder)))
{ {
assert(p_pmt_decoder->pf_pmt_callback); assert(p_pmt_decoder->pf_pmt_callback);
...@@ -391,10 +391,10 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio ...@@ -391,10 +391,10 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
p_pmt_decoder->current_pmt = *p_pmt_decoder->p_building_pmt; p_pmt_decoder->current_pmt = *p_pmt_decoder->p_building_pmt;
p_pmt_decoder->b_current_valid = true; p_pmt_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_pmt_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_pmt_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodePMTSections(p_pmt_decoder->p_building_pmt, dvbpsi_pmt_sections_decode(p_pmt_decoder->p_building_pmt,
p_pmt_decoder->ap_sections[0]); p_pmt_decoder->ap_sections[0]);
/* Delete the sections */ /* Delete the sections */
dvbpsi_DeletePSISections(p_pmt_decoder->ap_sections[0]); dvbpsi_DeletePSISections(p_pmt_decoder->ap_sections[0]);
p_pmt_decoder->ap_sections[0] = NULL; p_pmt_decoder->ap_sections[0] = NULL;
...@@ -407,12 +407,12 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio ...@@ -407,12 +407,12 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodePMTSections * dvbpsi_pmt_sections_decode
***************************************************************************** *****************************************************************************
* PMT decoder. * PMT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt, void dvbpsi_pmt_sections_decode(dvbpsi_pmt_t* p_pmt,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
uint8_t* p_byte, * p_end; uint8_t* p_byte, * p_end;
...@@ -427,7 +427,7 @@ void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt, ...@@ -427,7 +427,7 @@ void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if (i_length + 2 <= p_end - p_byte) if (i_length + 2 <= p_end - p_byte)
dvbpsi_PMTAddDescriptor(p_pmt, i_tag, i_length, p_byte + 2); dvbpsi_pmt_descriptor_add(p_pmt, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
...@@ -437,7 +437,7 @@ void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt, ...@@ -437,7 +437,7 @@ void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt,
uint8_t i_type = p_byte[0]; uint8_t i_type = p_byte[0];
uint16_t i_pid = ((uint16_t)(p_byte[1] & 0x1f) << 8) | p_byte[2]; uint16_t i_pid = ((uint16_t)(p_byte[1] & 0x1f) << 8) | p_byte[2];
uint16_t i_es_length = ((uint16_t)(p_byte[3] & 0x0f) << 8) | p_byte[4]; uint16_t i_es_length = ((uint16_t)(p_byte[3] & 0x0f) << 8) | p_byte[4];
dvbpsi_pmt_es_t* p_es = dvbpsi_PMTAddES(p_pmt, i_type, i_pid); dvbpsi_pmt_es_t* p_es = dvbpsi_pmt_es_add(p_pmt, i_type, i_pid);
/* - ES descriptors */ /* - ES descriptors */
p_byte += 5; p_byte += 5;
p_end = p_byte + i_es_length; p_end = p_byte + i_es_length;
...@@ -450,7 +450,7 @@ void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt, ...@@ -450,7 +450,7 @@ void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if (i_length + 2 <= p_end - p_byte) if (i_length + 2 <= p_end - p_byte)
dvbpsi_PMTESAddDescriptor(p_es, i_tag, i_length, p_byte + 2); dvbpsi_pmt_es_descriptor_add(p_es, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
} }
...@@ -458,13 +458,12 @@ void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt, ...@@ -458,13 +458,12 @@ void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt,
} }
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenPMTSections * dvbpsi_pmt_sections_generate
***************************************************************************** *****************************************************************************
* Generate PMT sections based on the dvbpsi_pmt_t structure. * Generate PMT sections based on the dvbpsi_pmt_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_t* p_pmt) dvbpsi_psi_section_t* dvbpsi_pmt_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_t* p_pmt)
{ {
dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024); dvbpsi_psi_section_t* p_result = dvbpsi_NewPSISection(1024);
dvbpsi_psi_section_t* p_current = p_result; dvbpsi_psi_section_t* p_current = p_result;
......
...@@ -103,10 +103,10 @@ typedef struct dvbpsi_pmt_s ...@@ -103,10 +103,10 @@ typedef struct dvbpsi_pmt_s
typedef void (* dvbpsi_pmt_callback)(void* p_cb_data, dvbpsi_pmt_t* p_new_pmt); typedef void (* dvbpsi_pmt_callback)(void* p_cb_data, dvbpsi_pmt_t* p_new_pmt);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachPMT * dvbpsi_pmt_attach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, * \fn bool dvbpsi_pmt_attach(dvbpsi_t *p_dvbpsi,
uint16_t i_program_number, uint16_t i_program_number,
dvbpsi_pmt_callback pf_callback, dvbpsi_pmt_callback pf_callback,
void* p_cb_data) void* p_cb_data)
...@@ -118,27 +118,27 @@ typedef void (* dvbpsi_pmt_callback)(void* p_cb_data, dvbpsi_pmt_t* p_new_pmt); ...@@ -118,27 +118,27 @@ typedef void (* dvbpsi_pmt_callback)(void* p_cb_data, dvbpsi_pmt_t* p_new_pmt);
* \param p_cb_data private data given in argument to the callback * \param p_cb_data private data given in argument to the callback
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, uint16_t i_program_number, bool dvbpsi_pmt_attach(dvbpsi_t *p_dvbpsi, uint16_t i_program_number,
dvbpsi_pmt_callback pf_callback, void* p_cb_data); dvbpsi_pmt_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachPMT * dvbpsi_pmt_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi) * \fn void dvbpsi_pmt_detach(dvbpsi_t *p_dvbpsi)
* \brief Destroy a PMT decoder. * \brief Destroy a PMT decoder.
* \param p_dvbpsi handle * \param p_dvbpsi handle
* \return nothing. * \return nothing.
* *
* The handle isn't valid any more. * The handle isn't valid any more.
*/ */
void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi); void dvbpsi_pmt_detach(dvbpsi_t *p_dvbpsi);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitPMT/dvbpsi_NewPMT * dvbpsi_pmt_init/dvbpsi_pmt_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number, * \fn void dvbpsi_pmt_init(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number,
uint8_t i_version, bool b_current_next, uint8_t i_version, bool b_current_next,
uint16_t i_pcr_pid) uint16_t i_pcr_pid)
* \brief Initialize a user-allocated dvbpsi_pmt_t structure. * \brief Initialize a user-allocated dvbpsi_pmt_t structure.
...@@ -149,11 +149,11 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi); ...@@ -149,11 +149,11 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi);
* \param i_pcr_pid PCR_PID * \param i_pcr_pid PCR_PID
* \return nothing. * \return nothing.
*/ */
void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number, void dvbpsi_pmt_init(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number,
uint8_t i_version, bool b_current_next, uint16_t i_pcr_pid); uint8_t i_version, bool b_current_next, uint16_t i_pcr_pid);
/*! /*!
* \fn dvbpsi_pmt_t* dvbpsi_NewPMT(uint16_t i_program_number, * \fn dvbpsi_pmt_t* dvbpsi_pmt_new(uint16_t i_program_number,
uint8_t i_version, bool b_current_next, uint8_t i_version, bool b_current_next,
uint16_t i_pcr_pid) uint16_t i_pcr_pid)
* \brief Allocate and initialize a new dvbpsi_pmt_t structure. * \brief Allocate and initialize a new dvbpsi_pmt_t structure.
...@@ -163,19 +163,19 @@ void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number, ...@@ -163,19 +163,19 @@ void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number,
* \param i_pcr_pid PCR_PID * \param i_pcr_pid PCR_PID
* \return p_pmt pointer to the PMT structure * \return p_pmt pointer to the PMT structure
*/ */
dvbpsi_pmt_t* dvbpsi_NewPMT(uint16_t i_program_number, uint8_t i_version, dvbpsi_pmt_t* dvbpsi_pmt_new(uint16_t i_program_number, uint8_t i_version,
bool b_current_next, uint16_t i_pcr_pid); bool b_current_next, uint16_t i_pcr_pid);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyPMT/dvbpsi_DeletePMT * dvbpsi_pmt_empty/dvbpsi_pmt_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt) * \fn void dvbpsi_pmt_empty(dvbpsi_pmt_t* p_pmt)
* \brief Clean a dvbpsi_pmt_t structure. * \brief Clean a dvbpsi_pmt_t structure.
* \param p_pmt pointer to the PMT structure * \param p_pmt pointer to the PMT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt); void dvbpsi_pmt_empty(dvbpsi_pmt_t* p_pmt);
/*! /*!
* \fn void dvbpsi_DeletePMT(dvbpsi_pmt_t* p_pmt) * \fn void dvbpsi_DeletePMT(dvbpsi_pmt_t* p_pmt)
...@@ -183,13 +183,13 @@ void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt); ...@@ -183,13 +183,13 @@ void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt);
* \param p_pmt pointer to the PMT structure * \param p_pmt pointer to the PMT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeletePMT(dvbpsi_pmt_t* p_pmt); void dvbpsi_pmt_delete(dvbpsi_pmt_t* p_pmt);
/***************************************************************************** /*****************************************************************************
* dvbpsi_PMTAddDescriptor * dvbpsi_pmt_descriptor_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt, * \fn dvbpsi_descriptor_t* dvbpsi_pmt_descriptor_add(dvbpsi_pmt_t* p_pmt,
uint8_t i_tag, uint8_t i_tag,
uint8_t i_length, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
...@@ -200,15 +200,15 @@ void dvbpsi_DeletePMT(dvbpsi_pmt_t* p_pmt); ...@@ -200,15 +200,15 @@ void dvbpsi_DeletePMT(dvbpsi_pmt_t* p_pmt);
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt, dvbpsi_descriptor_t* dvbpsi_pmt_descriptor_add(dvbpsi_pmt_t* p_pmt,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_PMTAddES * dvbpsi_pmt_es_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt, * \fn dvbpsi_pmt_es_t* dvbpsi_pmt_es_add(dvbpsi_pmt_t* p_pmt,
uint8_t i_type, uint16_t i_pid) uint8_t i_type, uint16_t i_pid)
* \brief Add an ES in the PMT. * \brief Add an ES in the PMT.
* \param p_pmt pointer to the PMT structure * \param p_pmt pointer to the PMT structure
...@@ -216,14 +216,14 @@ dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt, ...@@ -216,14 +216,14 @@ dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt,
* \param i_pid PID of the ES * \param i_pid PID of the ES
* \return a pointer to the added ES. * \return a pointer to the added ES.
*/ */
dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt, dvbpsi_pmt_es_t* dvbpsi_pmt_es_add(dvbpsi_pmt_t* p_pmt,
uint8_t i_type, uint16_t i_pid); uint8_t i_type, uint16_t i_pid);
/***************************************************************************** /*****************************************************************************
* dvbpsi_PMTESAddDescriptor * dvbpsi_pmt_es_descriptor_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es, * \fn dvbpsi_descriptor_t* dvbpsi_pmt_es_descriptor_add(dvbpsi_pmt_es_t* p_es,
uint8_t i_tag, uint8_t i_tag,
uint8_t i_length, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
...@@ -234,15 +234,15 @@ dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt, ...@@ -234,15 +234,15 @@ dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt,
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es, dvbpsi_descriptor_t* dvbpsi_pmt_es_descriptor_add(dvbpsi_pmt_es_t* p_es,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenPMTSections * dvbpsi_pmt_sections_generate
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_t *p_dvbpsi, * \fn dvbpsi_psi_section_t* dvbpsi_pmt_sections_generate(dvbpsi_t *p_dvbpsi,
dvbpsi_pmt_t* p_pmt) dvbpsi_pmt_t* p_pmt)
* \brief PMT generator * \brief PMT generator
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
...@@ -251,7 +251,33 @@ dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es, ...@@ -251,7 +251,33 @@ dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es,
* *
* Generate PMT sections based on the dvbpsi_pmt_t structure. * Generate PMT sections based on the dvbpsi_pmt_t structure.
*/ */
dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_t* p_pmt); dvbpsi_psi_section_t* dvbpsi_pmt_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_t* p_pmt);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
__attribute__((deprecated))
dvbpsi_handle dvbpsi_AttachPMT(uint16_t i_program_number,
dvbpsi_pmt_callback pf_callback,
void* p_cb_data);
__attribute__((deprecated)) void dvbpsi_DetachPMT(dvbpsi_handle h_dvbpsi);
__attribute__((deprecated))
void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number,
uint8_t i_version, int b_current_next, uint16_t i_pcr_pid);
__attribute__((deprecated)) void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt);
__attribute__((deprecated))
dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt,
uint8_t i_tag, uint8_t i_length,
uint8_t* p_data);
__attribute__((deprecated))
dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt,
uint8_t i_type, uint16_t i_pid);
__attribute__((deprecated))
dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es,
uint8_t i_tag, uint8_t i_length,
uint8_t* p_data);
__attribute__((deprecated))
dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_pmt_t* p_pmt);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -48,18 +48,28 @@ typedef struct dvbpsi_pmt_decoder_s ...@@ -48,18 +48,28 @@ typedef struct dvbpsi_pmt_decoder_s
} dvbpsi_pmt_decoder_t; } dvbpsi_pmt_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherPMTSections * dvbpsi_pmt_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, void dvbpsi_pmt_sections_gather(dvbpsi_t *p_dvbpsi,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodePMTSections * dvbpsi_pmt_sections_decode
***************************************************************************** *****************************************************************************
* PMT decoder. * PMT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_pmt_sections_decode(dvbpsi_pmt_t* p_pmt,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* Deprecated API's
*****************************************************************************/
__attribute__((deprecated))
void dvbpsi_GatherPMTSections(dvbpsi_handle *handle,
dvbpsi_psi_section_t* p_section);
__attribute__((deprecated))
void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt, void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
......
...@@ -49,11 +49,11 @@ ...@@ -49,11 +49,11 @@
#include "sdt_private.h" #include "sdt_private.h"
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachSDT * dvbpsi_sdt_attach
***************************************************************************** *****************************************************************************
* Initialize a SDT subtable decoder. * Initialize a SDT subtable decoder.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, bool dvbpsi_sdt_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_sdt_callback pf_callback, void* p_cb_data) dvbpsi_sdt_callback pf_callback, void* p_cb_data)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -71,18 +71,18 @@ bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -71,18 +71,18 @@ bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
dvbpsi_sdt_decoder_t* p_sdt_decoder; dvbpsi_sdt_decoder_t* p_sdt_decoder;
p_sdt_decoder = (dvbpsi_sdt_decoder_t*) dvbpsi_NewDecoder(NULL, p_sdt_decoder = (dvbpsi_sdt_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_sdt_decoder_t)); 0, true, sizeof(dvbpsi_sdt_decoder_t));
if (p_sdt_decoder == NULL) if (p_sdt_decoder == NULL)
return false; return false;
/* subtable decoder configuration */ /* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachSDT, p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_sdt_detach,
dvbpsi_GatherSDTSections, DVBPSI_DECODER(p_sdt_decoder)); dvbpsi_sdt_sections_gather, DVBPSI_DECODER(p_sdt_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_sdt_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_sdt_decoder));
return false; return false;
} }
...@@ -98,11 +98,11 @@ bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -98,11 +98,11 @@ bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachSDT * dvbpsi_sdt_detach
***************************************************************************** *****************************************************************************
* Close a SDT decoder. * Close a SDT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension) void dvbpsi_sdt_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -125,7 +125,7 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -125,7 +125,7 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
dvbpsi_sdt_decoder_t* p_sdt_decoder; dvbpsi_sdt_decoder_t* p_sdt_decoder;
p_sdt_decoder = (dvbpsi_sdt_decoder_t*)p_subdec->p_decoder; p_sdt_decoder = (dvbpsi_sdt_decoder_t*)p_subdec->p_decoder;
if (p_sdt_decoder->p_building_sdt) if (p_sdt_decoder->p_building_sdt)
dvbpsi_DeleteSDT(p_sdt_decoder->p_building_sdt); dvbpsi_sdt_delete(p_sdt_decoder->p_building_sdt);
p_sdt_decoder->p_building_sdt = NULL; p_sdt_decoder->p_building_sdt = NULL;
/* Free sub table decoder */ /* Free sub table decoder */
...@@ -134,11 +134,11 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -134,11 +134,11 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitSDT * dvbpsi_sdt_init
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_sdt_t structure. * Initialize a pre-allocated dvbpsi_sdt_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitSDT(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_sdt_init(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint16_t i_network_id) bool b_current_next, uint16_t i_network_id)
{ {
assert(p_sdt); assert(p_sdt);
...@@ -151,25 +151,25 @@ void dvbpsi_InitSDT(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id, uint8_t i_version, ...@@ -151,25 +151,25 @@ void dvbpsi_InitSDT(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id, uint8_t i_version,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewSDT * dvbpsi_sdt_new
***************************************************************************** *****************************************************************************
* Allocate and Initialize a new dvbpsi_sdt_t structure. * Allocate and Initialize a new dvbpsi_sdt_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_sdt_t *dvbpsi_NewSDT(uint16_t i_ts_id, uint8_t i_version, dvbpsi_sdt_t *dvbpsi_sdt_new(uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint16_t i_network_id) bool b_current_next, uint16_t i_network_id)
{ {
dvbpsi_sdt_t *p_sdt = (dvbpsi_sdt_t*)malloc(sizeof(dvbpsi_sdt_t)); dvbpsi_sdt_t *p_sdt = (dvbpsi_sdt_t*)malloc(sizeof(dvbpsi_sdt_t));
if (p_sdt != NULL) if (p_sdt != NULL)
dvbpsi_InitSDT(p_sdt, i_ts_id, i_version, b_current_next, i_network_id); dvbpsi_sdt_init(p_sdt, i_ts_id, i_version, b_current_next, i_network_id);
return p_sdt; return p_sdt;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptySDT * dvbpsi_sdt_empty
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_sdt_t structure. * Clean a dvbpsi_sdt_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_EmptySDT(dvbpsi_sdt_t* p_sdt) void dvbpsi_sdt_empty(dvbpsi_sdt_t* p_sdt)
{ {
dvbpsi_sdt_service_t* p_service = p_sdt->p_first_service; dvbpsi_sdt_service_t* p_service = p_sdt->p_first_service;
...@@ -184,23 +184,23 @@ void dvbpsi_EmptySDT(dvbpsi_sdt_t* p_sdt) ...@@ -184,23 +184,23 @@ void dvbpsi_EmptySDT(dvbpsi_sdt_t* p_sdt)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteSDT * dvbpsi_sdt_delete
***************************************************************************** *****************************************************************************
* Clean and Delete dvbpsi_sdt_t structure. * Clean and Delete dvbpsi_sdt_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteSDT(dvbpsi_sdt_t *p_sdt) void dvbpsi_sdt_delete(dvbpsi_sdt_t *p_sdt)
{ {
if (p_sdt) if (p_sdt)
dvbpsi_EmptySDT(p_sdt); dvbpsi_sdt_empty(p_sdt);
free(p_sdt); free(p_sdt);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_SDTAddService * dvbpsi_sdt_service_add
***************************************************************************** *****************************************************************************
* Add a service description at the end of the SDT. * Add a service description at the end of the SDT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt, dvbpsi_sdt_service_t *dvbpsi_sdt_service_add(dvbpsi_sdt_t* p_sdt,
uint16_t i_service_id, uint16_t i_service_id,
bool b_eit_schedule, bool b_eit_schedule,
bool b_eit_present, bool b_eit_present,
...@@ -234,11 +234,11 @@ dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt, ...@@ -234,11 +234,11 @@ dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_SDTServiceAddDescriptor * dvbpsi_sdt_service_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the SDT service description. * Add a descriptor in the SDT service description.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor( dvbpsi_descriptor_t *dvbpsi_sdt_service_descriptor_add(
dvbpsi_sdt_service_t *p_service, dvbpsi_sdt_service_t *p_service,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data) uint8_t *p_data)
...@@ -262,14 +262,14 @@ static void dvbpsi_ReInitSDT(dvbpsi_sdt_decoder_t* p_decoder, const bool b_force ...@@ -262,14 +262,14 @@ static void dvbpsi_ReInitSDT(dvbpsi_sdt_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
/* Free structures */ /* Free structures */
if (p_decoder->p_building_sdt) if (p_decoder->p_building_sdt)
dvbpsi_DeleteSDT(p_decoder->p_building_sdt); dvbpsi_sdt_delete(p_decoder->p_building_sdt);
} }
p_decoder->p_building_sdt = NULL; p_decoder->p_building_sdt = NULL;
} }
...@@ -319,7 +319,7 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt ...@@ -319,7 +319,7 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_sdt_decoder->p_building_sdt) if (!p_sdt_decoder->p_building_sdt)
{ {
p_sdt_decoder->p_building_sdt = dvbpsi_NewSDT(p_section->i_extension, p_sdt_decoder->p_building_sdt = dvbpsi_sdt_new(p_section->i_extension,
p_section->i_version, p_section->b_current_next, p_section->i_version, p_section->b_current_next,
((uint16_t)(p_section->p_payload_start[0]) << 8) ((uint16_t)(p_section->p_payload_start[0]) << 8)
| p_section->p_payload_start[1]); | p_section->p_payload_start[1]);
...@@ -329,7 +329,7 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt ...@@ -329,7 +329,7 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_sdt_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_sdt_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -337,13 +337,13 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt ...@@ -337,13 +337,13 @@ static bool dvbpsi_AddSectionSDT(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_decoder_t *p_sdt
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherSDTSections * dvbpsi_sdt_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the subtable demultiplexor. * Callback for the subtable demultiplexor.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi, void dvbpsi_sdt_sections_gather(dvbpsi_t *p_dvbpsi,
dvbpsi_decoder_t *p_private_decoder, dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t * p_section) dvbpsi_psi_section_t * p_section)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -400,7 +400,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi, ...@@ -400,7 +400,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_sdt_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_sdt_decoder)))
{ {
assert(p_sdt_decoder->pf_sdt_callback); assert(p_sdt_decoder->pf_sdt_callback);
...@@ -408,10 +408,10 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi, ...@@ -408,10 +408,10 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
p_sdt_decoder->current_sdt = *p_sdt_decoder->p_building_sdt; p_sdt_decoder->current_sdt = *p_sdt_decoder->p_building_sdt;
p_sdt_decoder->b_current_valid = true; p_sdt_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_sdt_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_sdt_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodeSDTSections(p_sdt_decoder->p_building_sdt, dvbpsi_sdt_sections_decode(p_sdt_decoder->p_building_sdt,
p_sdt_decoder->ap_sections[0]); p_sdt_decoder->ap_sections[0]);
/* Delete the sections */ /* Delete the sections */
dvbpsi_DeletePSISections(p_sdt_decoder->ap_sections[0]); dvbpsi_DeletePSISections(p_sdt_decoder->ap_sections[0]);
p_sdt_decoder->ap_sections[0] = NULL; p_sdt_decoder->ap_sections[0] = NULL;
...@@ -424,12 +424,12 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi, ...@@ -424,12 +424,12 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeSDTSection * dvbpsi_sdt_sections_decode
***************************************************************************** *****************************************************************************
* SDT decoder. * SDT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt, void dvbpsi_sdt_sections_decode(dvbpsi_sdt_t* p_sdt,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
uint8_t *p_byte, *p_end; uint8_t *p_byte, *p_end;
...@@ -444,7 +444,7 @@ void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt, ...@@ -444,7 +444,7 @@ void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt,
uint8_t i_running_status = (uint8_t)(p_byte[3]) >> 5; uint8_t i_running_status = (uint8_t)(p_byte[3]) >> 5;
bool b_free_ca = ((p_byte[3] & 0x10) >> 4); bool b_free_ca = ((p_byte[3] & 0x10) >> 4);
uint16_t i_srv_length = ((uint16_t)(p_byte[3] & 0xf) <<8) | p_byte[4]; uint16_t i_srv_length = ((uint16_t)(p_byte[3] & 0xf) <<8) | p_byte[4];
dvbpsi_sdt_service_t* p_service = dvbpsi_SDTAddService(p_sdt, dvbpsi_sdt_service_t* p_service = dvbpsi_sdt_service_add(p_sdt,
i_service_id, b_eit_schedule, b_eit_present, i_service_id, b_eit_schedule, b_eit_present,
i_running_status, b_free_ca); i_running_status, b_free_ca);
...@@ -458,7 +458,7 @@ void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt, ...@@ -458,7 +458,7 @@ void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if (i_length + 2 <= p_end - p_byte) if (i_length + 2 <= p_end - p_byte)
dvbpsi_SDTServiceAddDescriptor(p_service, i_tag, i_length, p_byte + 2); dvbpsi_sdt_service_descriptor_add(p_service, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
} }
...@@ -467,11 +467,11 @@ void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt, ...@@ -467,11 +467,11 @@ void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenSDTSections * dvbpsi_sdt_sections_generate
***************************************************************************** *****************************************************************************
* Generate SDT sections based on the dvbpsi_sdt_t structure. * Generate SDT sections based on the dvbpsi_sdt_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_t* p_sdt) dvbpsi_psi_section_t *dvbpsi_sdt_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_t* p_sdt)
{ {
dvbpsi_psi_section_t *p_result = dvbpsi_NewPSISection(1024); dvbpsi_psi_section_t *p_result = dvbpsi_NewPSISection(1024);
dvbpsi_psi_section_t *p_current = p_result; dvbpsi_psi_section_t *p_current = p_result;
......
...@@ -107,10 +107,10 @@ typedef struct dvbpsi_sdt_s ...@@ -107,10 +107,10 @@ typedef struct dvbpsi_sdt_s
typedef void (* dvbpsi_sdt_callback)(void* p_cb_data, dvbpsi_sdt_t* p_new_sdt); typedef void (* dvbpsi_sdt_callback)(void* p_cb_data, dvbpsi_sdt_t* p_new_sdt);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachSDT * dvbpsi_sdt_attach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn bool dvbpsi_sdt_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_sdt_callback pf_callback, uint16_t i_extension, dvbpsi_sdt_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a SDT decoder. It is attached to p_dvbpsi. * \brief Creation and initialization of a SDT decoder. It is attached to p_dvbpsi.
...@@ -121,14 +121,14 @@ typedef void (* dvbpsi_sdt_callback)(void* p_cb_data, dvbpsi_sdt_t* p_new_sdt); ...@@ -121,14 +121,14 @@ typedef void (* dvbpsi_sdt_callback)(void* p_cb_data, dvbpsi_sdt_t* p_new_sdt);
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, bool dvbpsi_sdt_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_sdt_callback pf_callback, void* p_cb_data); dvbpsi_sdt_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachSDT * dvbpsi_sdt_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn void dvbpsi_sdt_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a SDT decoder. * \brief Destroy a SDT decoder.
* \param p_dvbpsi pointer holding decoder/demuxer structure * \param p_dvbpsi pointer holding decoder/demuxer structure
...@@ -136,13 +136,13 @@ bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -136,13 +136,13 @@ bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
* \param i_extension Table ID extension, here TS ID. * \param i_extension Table ID extension, here TS ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension); void dvbpsi_sdt_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitSDT/dvbpsi_NewSDT * dvbpsi_sdt_init/dvbpsi_NewSDT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_InitSDT(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id, * \fn void dvbpsi_sdt_init(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id,
uint8_t i_version, bool b_current_next, uint16_t i_network_id) uint8_t i_version, bool b_current_next, uint16_t i_network_id)
* \brief Initialize a user-allocated dvbpsi_sdt_t structure. * \brief Initialize a user-allocated dvbpsi_sdt_t structure.
* \param p_sdt pointer to the SDT structure * \param p_sdt pointer to the SDT structure
...@@ -152,11 +152,11 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -152,11 +152,11 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
* \param i_network_id original network id * \param i_network_id original network id
* \return nothing. * \return nothing.
*/ */
void dvbpsi_InitSDT(dvbpsi_sdt_t *p_sdt, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_sdt_init(dvbpsi_sdt_t *p_sdt, uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint16_t i_network_id); bool b_current_next, uint16_t i_network_id);
/*! /*!
* \fn dvbpsi_sdt_t *dvbpsi_NewSDT(uint16_t i_ts_id, uint8_t i_version, * \fn dvbpsi_sdt_t *dvbpsi_sdt_new(uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint16_t i_network_id) bool b_current_next, uint16_t i_network_id)
* \brief Allocate and initialize a new dvbpsi_sdt_t structure. * \brief Allocate and initialize a new dvbpsi_sdt_t structure.
* \param i_ts_id transport stream ID * \param i_ts_id transport stream ID
...@@ -165,33 +165,33 @@ void dvbpsi_InitSDT(dvbpsi_sdt_t *p_sdt, uint16_t i_ts_id, uint8_t i_version, ...@@ -165,33 +165,33 @@ void dvbpsi_InitSDT(dvbpsi_sdt_t *p_sdt, uint16_t i_ts_id, uint8_t i_version,
* \param i_network_id original network id * \param i_network_id original network id
* \return p_sdt pointer to the SDT structure * \return p_sdt pointer to the SDT structure
*/ */
dvbpsi_sdt_t *dvbpsi_NewSDT(uint16_t i_ts_id, uint8_t i_version, dvbpsi_sdt_t *dvbpsi_sdt_new(uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint16_t i_network_id); bool b_current_next, uint16_t i_network_id);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptySDT/dvbpsi_DeleteSDT * dvbpsi_sdt_empty/dvbpsi_sdt_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_EmptySDT(dvbpsi_sdt_t* p_sdt) * \fn void dvbpsi_sdt_empty(dvbpsi_sdt_t* p_sdt)
* \brief Clean a dvbpsi_sdt_t structure. * \brief Clean a dvbpsi_sdt_t structure.
* \param p_sdt pointer to the SDT structure * \param p_sdt pointer to the SDT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_EmptySDT(dvbpsi_sdt_t *p_sdt); void dvbpsi_sdt_empty(dvbpsi_sdt_t *p_sdt);
/*! /*!
* \fn void dvbpsi_DeleteSDT(dvbpsi_sdt_t *p_sdt) * \fn dvbpsi_sdt_delete(dvbpsi_sdt_t *p_sdt)
* \brief Clean and free a dvbpsi_sdt_t structure. * \brief Clean and free a dvbpsi_sdt_t structure.
* \param p_sdt pointer to the SDT structure * \param p_sdt pointer to the SDT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeleteSDT(dvbpsi_sdt_t *p_sdt); void dvbpsi_sdt_delete(dvbpsi_sdt_t *p_sdt);
/***************************************************************************** /*****************************************************************************
* dvbpsi_SDTAddService * dvbpsi_sdt_service_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_sdt_service_t* dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt, * \fn dvbpsi_sdt_service_t* dvbpsi_sdt_service_add(dvbpsi_sdt_t* p_sdt,
uint16_t i_service_id, uint16_t i_service_id,
bool b_eit_schedule, bool b_eit_schedule,
bool b_eit_present, bool b_eit_present,
...@@ -206,15 +206,15 @@ void dvbpsi_DeleteSDT(dvbpsi_sdt_t *p_sdt); ...@@ -206,15 +206,15 @@ void dvbpsi_DeleteSDT(dvbpsi_sdt_t *p_sdt);
* \param b_free_ca Free CA flag * \param b_free_ca Free CA flag
* \return a pointer to the added service description. * \return a pointer to the added service description.
*/ */
dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt, dvbpsi_sdt_service_t *dvbpsi_sdt_service_add(dvbpsi_sdt_t* p_sdt,
uint16_t i_service_id, bool b_eit_schedule, bool b_eit_present, uint16_t i_service_id, bool b_eit_schedule, bool b_eit_present,
uint8_t i_running_status, bool b_free_ca); uint8_t i_running_status, bool b_free_ca);
/***************************************************************************** /*****************************************************************************
* dvbpsi_SDTServiceAddDescriptor * dvbpsi_sdt_service_descriptor_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor( * \fn dvbpsi_descriptor_t *dvbpsi_sdt_service_descriptor_add(
dvbpsi_sdt_service_t *p_service, dvbpsi_sdt_service_t *p_service,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data) uint8_t *p_data)
...@@ -225,18 +225,18 @@ dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt, ...@@ -225,18 +225,18 @@ dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt,
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor( dvbpsi_descriptor_t *dvbpsi_sdt_service_descriptor_add(
dvbpsi_sdt_service_t *p_service, dvbpsi_sdt_service_t *p_service,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data); uint8_t *p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenSDTSections * dvbpsi_sdt_sections_generate
***************************************************************************** *****************************************************************************
* Generate SDT sections based on the dvbpsi_sdt_t structure. * Generate SDT sections based on the dvbpsi_sdt_t structure.
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenSDTSections(dvbpsi_t *p_dvbpsi, * \fn dvbpsi_psi_section_t* dvbpsi_sdt_sections_generate(dvbpsi_t *p_dvbpsi,
dvbpsi_sdt_t * p_sdt) dvbpsi_sdt_t * p_sdt)
* \brief SDT generator * \brief SDT generator
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
...@@ -245,7 +245,33 @@ dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor( ...@@ -245,7 +245,33 @@ dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor(
* *
* Generate SDT sections based on the dvbpsi_sdt_t structure. * Generate SDT sections based on the dvbpsi_sdt_t structure.
*/ */
dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_t * p_sdt); dvbpsi_psi_section_t *dvbpsi_sdt_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_t * p_sdt);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
__attribute__((deprecated))
int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_sdt_callback pf_callback,
void* p_cb_data);
__attribute__((deprecated))
void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension);
__attribute__((deprecated))
void dvbpsi_InitSDT(dvbpsi_sdt_t *p_sdt, uint16_t i_ts_id, uint8_t i_version,
int b_current_next, uint16_t i_network_id);
__attribute__((deprecated)) void dvbpsi_EmptySDT(dvbpsi_sdt_t *p_sdt);
__attribute__((deprecated))
dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt,
uint16_t i_service_id, int b_eit_schedule, int b_eit_present,
uint8_t i_running_status, int b_free_ca);
__attribute__((deprecated))
dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor(
dvbpsi_sdt_service_t *p_service,
uint8_t i_tag, uint8_t i_length,
uint8_t *p_data);
__attribute__((deprecated))
dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_sdt_t * p_sdt);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -46,19 +46,30 @@ typedef struct dvbpsi_sdt_decoder_s ...@@ -46,19 +46,30 @@ typedef struct dvbpsi_sdt_decoder_s
} dvbpsi_sdt_decoder_t; } dvbpsi_sdt_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherSDTSections * dvbpsi_sdt_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi, void dvbpsi_sdt_sections_gather(dvbpsi_t *p_dvbpsi,
dvbpsi_decoder_t *p_private_decoder, dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section); dvbpsi_psi_section_t *p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeSDTSection * dvbpsi_sdt_sections_decode
***************************************************************************** *****************************************************************************
* SDT decoder. * SDT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_sdt_sections_decode(dvbpsi_sdt_t* p_sdt,
dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* Deprecated API's
*****************************************************************************/
__attribute__((deprecated))
void dvbpsi_GatherSDTSections(dvbpsi_handle *p_dvbpsi,
dvbpsi_decoder_t *p_private_decoder,
dvbpsi_psi_section_t *p_section);
__attribute__((deprecated))
void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt, void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
......
...@@ -49,11 +49,11 @@ ...@@ -49,11 +49,11 @@
#include "sis_private.h" #include "sis_private.h"
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachSIS * dvbpsi_sis_attach
***************************************************************************** *****************************************************************************
* Initialize a SIS subtable decoder. * Initialize a SIS subtable decoder.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AttachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, bool dvbpsi_sis_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_sis_callback pf_callback, void* p_cb_data) dvbpsi_sis_callback pf_callback, void* p_cb_data)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -73,18 +73,18 @@ bool dvbpsi_AttachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -73,18 +73,18 @@ bool dvbpsi_AttachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
dvbpsi_sis_decoder_t* p_sis_decoder; dvbpsi_sis_decoder_t* p_sis_decoder;
p_sis_decoder = (dvbpsi_sis_decoder_t*) dvbpsi_NewDecoder(NULL, p_sis_decoder = (dvbpsi_sis_decoder_t*) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_sis_decoder_t)); 0, true, sizeof(dvbpsi_sis_decoder_t));
if (p_sis_decoder == NULL) if (p_sis_decoder == NULL)
return false; return false;
/* subtable decoder configuration */ /* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachSIS, p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_sis_detach,
dvbpsi_GatherSISSections, DVBPSI_DECODER(p_sis_decoder)); dvbpsi_sis_sections_gather, DVBPSI_DECODER(p_sis_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_sis_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_sis_decoder));
return false; return false;
} }
...@@ -100,11 +100,11 @@ bool dvbpsi_AttachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -100,11 +100,11 @@ bool dvbpsi_AttachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachSIS * dvbpsi_sis_detach
***************************************************************************** *****************************************************************************
* Close a SIS decoder. * Close a SIS decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, void dvbpsi_sis_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -129,7 +129,7 @@ void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -129,7 +129,7 @@ void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
dvbpsi_sis_decoder_t* p_sis_decoder; dvbpsi_sis_decoder_t* p_sis_decoder;
p_sis_decoder = (dvbpsi_sis_decoder_t*)p_subdec->p_decoder; p_sis_decoder = (dvbpsi_sis_decoder_t*)p_subdec->p_decoder;
if (p_sis_decoder->p_building_sis) if (p_sis_decoder->p_building_sis)
dvbpsi_DeleteSIS(p_sis_decoder->p_building_sis); dvbpsi_sis_delete(p_sis_decoder->p_building_sis);
p_sis_decoder->p_building_sis = NULL; p_sis_decoder->p_building_sis = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec); dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
...@@ -137,11 +137,11 @@ void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, ...@@ -137,11 +137,11 @@ void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitSIS * dvbpsi_sis_init
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_sis_t structure. * Initialize a pre-allocated dvbpsi_sis_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitSIS(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint8_t i_protocol_version) bool b_current_next, uint8_t i_protocol_version)
{ {
p_sis->i_ts_id = i_ts_id; p_sis->i_ts_id = i_ts_id;
...@@ -174,25 +174,25 @@ void dvbpsi_InitSIS(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version, ...@@ -174,25 +174,25 @@ void dvbpsi_InitSIS(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewSIS * dvbpsi_sis_new
***************************************************************************** *****************************************************************************
* Allocate and Initialize a new dvbpsi_sis_t structure. * Allocate and Initialize a new dvbpsi_sis_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_sis_t* dvbpsi_NewSIS(uint16_t i_ts_id, uint8_t i_version, dvbpsi_sis_t* dvbpsi_sis_new(uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint8_t i_protocol_version) bool b_current_next, uint8_t i_protocol_version)
{ {
dvbpsi_sis_t* p_sis = (dvbpsi_sis_t*)malloc(sizeof(dvbpsi_sis_t)); dvbpsi_sis_t* p_sis = (dvbpsi_sis_t*)malloc(sizeof(dvbpsi_sis_t));
if(p_sis != NULL) if (p_sis != NULL)
dvbpsi_InitSIS(p_sis, i_ts_id, i_version, b_current_next, i_protocol_version); dvbpsi_sis_init(p_sis, i_ts_id, i_version, b_current_next, i_protocol_version);
return p_sis; return p_sis;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptySIS * dvbpsi_sis_empty
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_sis_t structure. * Clean a dvbpsi_sis_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_EmptySIS(dvbpsi_sis_t* p_sis) void dvbpsi_sis_empty(dvbpsi_sis_t* p_sis)
{ {
/* FIXME: free splice_command_sections */ /* FIXME: free splice_command_sections */
...@@ -203,23 +203,23 @@ void dvbpsi_EmptySIS(dvbpsi_sis_t* p_sis) ...@@ -203,23 +203,23 @@ void dvbpsi_EmptySIS(dvbpsi_sis_t* p_sis)
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DeleteSIS * dvbpsi_sis_delete
***************************************************************************** *****************************************************************************
* Clean and Delete a dvbpsi_sis_t structure. * Clean and Delete a dvbpsi_sis_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteSIS(dvbpsi_sis_t *p_sis) void dvbpsi_sis_delete(dvbpsi_sis_t *p_sis)
{ {
if (p_sis) if (p_sis)
dvbpsi_EmptySIS(p_sis); dvbpsi_sis_empty(p_sis);
free(p_sis); free(p_sis);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_SISAddDescriptor * dvbpsi_sis_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the SIS service description. * Add a descriptor in the SIS service description.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t *dvbpsi_SISAddDescriptor(dvbpsi_sis_t *p_sis, dvbpsi_descriptor_t *dvbpsi_sis_descriptor_add(dvbpsi_sis_t *p_sis,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data) uint8_t *p_data)
{ {
...@@ -242,14 +242,14 @@ static void dvbpsi_ReInitSIS(dvbpsi_sis_decoder_t* p_decoder, const bool b_force ...@@ -242,14 +242,14 @@ static void dvbpsi_ReInitSIS(dvbpsi_sis_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
/* Free structures */ /* Free structures */
if (p_decoder->p_building_sis) if (p_decoder->p_building_sis)
dvbpsi_DeleteSIS(p_decoder->p_building_sis); dvbpsi_sis_delete(p_decoder->p_building_sis);
} }
p_decoder->p_building_sis = NULL; p_decoder->p_building_sis = NULL;
} }
...@@ -305,7 +305,7 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis ...@@ -305,7 +305,7 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_sis_decoder->p_building_sis) if (!p_sis_decoder->p_building_sis)
{ {
p_sis_decoder->p_building_sis = dvbpsi_NewSIS(p_section->i_extension, p_sis_decoder->p_building_sis = dvbpsi_sis_new(p_section->i_extension,
p_section->i_version, p_section->b_current_next, 0); p_section->i_version, p_section->b_current_next, 0);
if (p_sis_decoder->p_building_sis == NULL) if (p_sis_decoder->p_building_sis == NULL)
return false; return false;
...@@ -313,7 +313,7 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis ...@@ -313,7 +313,7 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_sis_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_sis_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "SDT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -321,11 +321,11 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis ...@@ -321,11 +321,11 @@ static bool dvbpsi_AddSectionSIS(dvbpsi_t *p_dvbpsi, dvbpsi_sis_decoder_t *p_sis
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherSISSections * dvbpsi_sis_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the subtable demultiplexor. * Callback for the subtable demultiplexor.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi, void dvbpsi_sis_sections_gather(dvbpsi_t *p_dvbpsi,
dvbpsi_decoder_t *p_decoder, dvbpsi_decoder_t *p_decoder,
dvbpsi_psi_section_t * p_section) dvbpsi_psi_section_t * p_section)
{ {
...@@ -392,7 +392,7 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi, ...@@ -392,7 +392,7 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_sis_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_sis_decoder)))
{ {
assert(p_sis_decoder->pf_sis_callback); assert(p_sis_decoder->pf_sis_callback);
...@@ -400,10 +400,10 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi, ...@@ -400,10 +400,10 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi,
p_sis_decoder->current_sis = *p_sis_decoder->p_building_sis; p_sis_decoder->current_sis = *p_sis_decoder->p_building_sis;
p_sis_decoder->b_current_valid = true; p_sis_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_sis_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_sis_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodeSISSections(p_dvbpsi, p_sis_decoder->p_building_sis, dvbpsi_sis_sections_decode(p_dvbpsi, p_sis_decoder->p_building_sis,
p_sis_decoder->ap_sections[0]); p_sis_decoder->ap_sections[0]);
/* Delete the sections */ /* Delete the sections */
dvbpsi_DeletePSISections(p_sis_decoder->ap_sections[0]); dvbpsi_DeletePSISections(p_sis_decoder->ap_sections[0]);
p_sis_decoder->ap_sections[0] = NULL; p_sis_decoder->ap_sections[0] = NULL;
...@@ -416,11 +416,11 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi, ...@@ -416,11 +416,11 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeSISSections * dvbpsi_sis_sections_decode
***************************************************************************** *****************************************************************************
* SIS decoder. * SIS decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeSISSections(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis, void dvbpsi_sis_sections_decode(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
uint8_t *p_byte, *p_end; uint8_t *p_byte, *p_end;
...@@ -479,7 +479,7 @@ void dvbpsi_DecodeSISSections(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis, ...@@ -479,7 +479,7 @@ void dvbpsi_DecodeSISSections(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis,
uint8_t i_length = p_desc[1]; uint8_t i_length = p_desc[1];
if ((i_length <= 254) && if ((i_length <= 254) &&
(i_length + 2 <= p_end - p_desc)) (i_length + 2 <= p_end - p_desc))
dvbpsi_SISAddDescriptor(p_sis, i_tag, i_length, p_desc + 2); dvbpsi_sis_descriptor_add(p_sis, i_tag, i_length, p_desc + 2);
p_desc += 2 + i_length; p_desc += 2 + i_length;
} }
...@@ -503,11 +503,11 @@ void dvbpsi_DecodeSISSections(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis, ...@@ -503,11 +503,11 @@ void dvbpsi_DecodeSISSections(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenSISSections * dvbpsi_sis_sections_generate
***************************************************************************** *****************************************************************************
* Generate SIS sections based on the dvbpsi_sis_t structure. * Generate SIS sections based on the dvbpsi_sis_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t *dvbpsi_GenSISSections(dvbpsi_t *p_dvbpsi, dvbpsi_sis_t* p_sis) dvbpsi_psi_section_t *dvbpsi_sis_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_sis_t* p_sis)
{ {
dvbpsi_psi_section_t * p_current = dvbpsi_NewPSISection(1024); dvbpsi_psi_section_t * p_current = dvbpsi_NewPSISection(1024);
......
...@@ -344,10 +344,10 @@ typedef struct dvbpsi_sis_cmd_bandwidth_reservation_s ...@@ -344,10 +344,10 @@ typedef struct dvbpsi_sis_cmd_bandwidth_reservation_s
typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis); typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachSIS * dvbpsi_sis_attach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AttachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn bool dvbpsi_sis_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_sis_callback pf_callback, uint16_t i_extension, dvbpsi_sis_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a SIS decoder. It is attached to p_dvbpsi. * \brief Creation and initialization of a SIS decoder. It is attached to p_dvbpsi.
...@@ -358,14 +358,14 @@ typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis); ...@@ -358,14 +358,14 @@ typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis);
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_AttachSIS(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, bool dvbpsi_sis_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_sis_callback pf_callback, void* p_cb_data); dvbpsi_sis_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachSIS * dvbpsi_sis_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, * \fn void dvbpsi_sis_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a SIS decoder. * \brief Destroy a SIS decoder.
* \param p_dvbpsi pointer to dvbpsi to hold decoder/demuxer structure * \param p_dvbpsi pointer to dvbpsi to hold decoder/demuxer structure
...@@ -373,13 +373,13 @@ bool dvbpsi_AttachSIS(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -373,13 +373,13 @@ bool dvbpsi_AttachSIS(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
* \param i_extension Table ID extension, here TS ID. * \param i_extension Table ID extension, here TS ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension); void dvbpsi_sis_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitSIS/dvbpsi_NewSIS * dvbpsi_sis_init/dvbpsi_sis_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_InitSIS(dvbpsi_sis_t* p_sis, uint8_t i_protocol_version) * \fn void dvbpsi_sis_init(dvbpsi_sis_t* p_sis, uint8_t i_protocol_version)
* \brief Initialize a user-allocated dvbpsi_sis_t structure. * \brief Initialize a user-allocated dvbpsi_sis_t structure.
* \param p_sis pointer to the SIS structure * \param p_sis pointer to the SIS structure
* \param i_ts_id transport stream ID * \param i_ts_id transport stream ID
...@@ -388,11 +388,11 @@ void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -388,11 +388,11 @@ void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
* \param i_protocol_version SIS protocol version (currently 0) * \param i_protocol_version SIS protocol version (currently 0)
* \return nothing. * \return nothing.
*/ */
void dvbpsi_InitSIS(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_sis_init(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint8_t i_protocol_version); bool b_current_next, uint8_t i_protocol_version);
/*! /*!
* \fn dvbpsi_sis_t* dvbpsi_NewSIS(uint8_t i_protocol_version) * \fn dvbpsi_sis_t* dvbpsi_sis_new(uint8_t i_protocol_version)
* \brief Allocate and initialize a new dvbpsi_sis_t structure. * \brief Allocate and initialize a new dvbpsi_sis_t structure.
* \param i_ts_id transport stream ID * \param i_ts_id transport stream ID
* \param i_version SIS version * \param i_version SIS version
...@@ -400,33 +400,33 @@ void dvbpsi_InitSIS(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version, ...@@ -400,33 +400,33 @@ void dvbpsi_InitSIS(dvbpsi_sis_t *p_sis, uint16_t i_ts_id, uint8_t i_version,
* \param i_protocol_version SIS protocol version (currently 0) * \param i_protocol_version SIS protocol version (currently 0)
* \return p_sis pointer to the SIS structure * \return p_sis pointer to the SIS structure
*/ */
dvbpsi_sis_t* dvbpsi_NewSIS(uint16_t i_ts_id, uint8_t i_version, dvbpsi_sis_t* dvbpsi_sis_new(uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint8_t i_protocol_version); bool b_current_next, uint8_t i_protocol_version);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptySIS/dvbpsi_DeleteSIS * dvbpsi_sis_empty/dvbpsi_sis_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_EmptySIS(dvbpsi_sis_t* p_sis) * \fn void dvbpsi_sis_empty(dvbpsi_sis_t* p_sis)
* \brief Clean a dvbpsi_sis_t structure. * \brief Clean a dvbpsi_sis_t structure.
* \param p_sis pointer to the SIS structure * \param p_sis pointer to the SIS structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_EmptySIS(dvbpsi_sis_t *p_sis); void dvbpsi_sis_empty(dvbpsi_sis_t *p_sis);
/*! /*!
* \fn void dvbpsi_DeleteSIS(dvbpsi_sis_t *p_sis) * \fn void dvbpsi_sis_delete(dvbpsi_sis_t *p_sis)
* \brief Clean and free a dvbpsi_sis_t structure. * \brief Clean and free a dvbpsi_sis_t structure.
* \param p_sis pointer to the SIS structure * \param p_sis pointer to the SIS structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeleteSIS(dvbpsi_sis_t *p_sis); void dvbpsi_sis_delete(dvbpsi_sis_t *p_sis);
/***************************************************************************** /*****************************************************************************
* dvbpsi_SISAddDescriptor * dvbpsi_sis_descriptor_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_descriptor_t *dvbpsi_SISAddDescriptor(dvbpsi_sis_t *p_sis, * \fn dvbpsi_descriptor_t *dvbpsi_sis_descriptor_add(dvbpsi_sis_t *p_sis,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data) uint8_t *p_data)
* \brief Add a descriptor in the SIS service. * \brief Add a descriptor in the SIS service.
...@@ -436,17 +436,17 @@ void dvbpsi_DeleteSIS(dvbpsi_sis_t *p_sis); ...@@ -436,17 +436,17 @@ void dvbpsi_DeleteSIS(dvbpsi_sis_t *p_sis);
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t *dvbpsi_SISAddDescriptor(dvbpsi_sis_t *p_sis, dvbpsi_descriptor_t *dvbpsi_sis_descriptor_add(dvbpsi_sis_t *p_sis,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data); uint8_t *p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenSISSections * dvbpsi_sis_sections_generate
***************************************************************************** *****************************************************************************
* Generate SIS sections based on the dvbpsi_sis_t structure. * Generate SIS sections based on the dvbpsi_sis_t structure.
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t *dvbpsi_GenSISSections(dvbpsi_t *p_dvbpsi, dvbpsi_sis_t * p_sis); * \fn dvbpsi_psi_section_t *dvbpsi_sis_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_sis_t * p_sis);
* \brief SIS generator * \brief SIS generator
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
* \param p_sis SIS structure * \param p_sis SIS structure
...@@ -454,7 +454,27 @@ dvbpsi_descriptor_t *dvbpsi_SISAddDescriptor(dvbpsi_sis_t *p_sis, ...@@ -454,7 +454,27 @@ dvbpsi_descriptor_t *dvbpsi_SISAddDescriptor(dvbpsi_sis_t *p_sis,
* *
* Generate SIS sections based on the dvbpsi_sis_t structure. * Generate SIS sections based on the dvbpsi_sis_t structure.
*/ */
dvbpsi_psi_section_t *dvbpsi_GenSISSections(dvbpsi_t *p_dvbpsi, dvbpsi_sis_t * p_sis); dvbpsi_psi_section_t *dvbpsi_sis_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_sis_t * p_sis);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
__attribute__((deprecated))
int dvbpsi_AttachSIS(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_sis_callback pf_callback,
void* p_cb_data);
__attribute__((deprecated))
void dvbpsi_DetachSIS(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension);
__attribute__((deprecated))
void dvbpsi_InitSIS(dvbpsi_sis_t *p_sis, uint8_t i_protocol_version);
__attribute__((deprecated)) void dvbpsi_EmptySIS(dvbpsi_sis_t *p_sis);
__attribute__((deprecated))
dvbpsi_descriptor_t *dvbpsi_SISAddDescriptor( dvbpsi_sis_t *p_sis,
uint8_t i_tag, uint8_t i_length,
uint8_t *p_data);
__attribute__((deprecated))
dvbpsi_psi_section_t *dvbpsi_GenSISSections(dvbpsi_sis_t * p_sis);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -46,23 +46,32 @@ typedef struct dvbpsi_sis_decoder_s ...@@ -46,23 +46,32 @@ typedef struct dvbpsi_sis_decoder_s
} dvbpsi_sis_decoder_t; } dvbpsi_sis_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherSISSections * dvbpsi_sis_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherSISSections(dvbpsi_t* p_dvbpsi, void dvbpsi_sis_sections_gather(dvbpsi_t* p_dvbpsi,
dvbpsi_decoder_t * p_decoder, dvbpsi_decoder_t * p_decoder,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeSISSection * dvbpsi_sis_sections_decode
***************************************************************************** *****************************************************************************
* SIS decoder. * SIS decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeSISSections(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis, void dvbpsi_sis_sections_decode(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* Deprecated API's
*****************************************************************************/
__attribute__((deprecated))
void dvbpsi_GatherSISSections(dvbpsi_handle* p_dvbpsi,
dvbpsi_decoder_t * p_decoder,
dvbpsi_psi_section_t* p_section);
__attribute__((deprecated))
void dvbpsi_DecodeSISSections(dvbpsi_sis_t* p_sis,
dvbpsi_psi_section_t* p_section);
#else #else
#error "Multiple inclusions of sis_private.h" #error "Multiple inclusions of sis_private.h"
#endif #endif
...@@ -51,12 +51,12 @@ ...@@ -51,12 +51,12 @@
#include "tot_private.h" #include "tot_private.h"
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachTOT * dvbpsi_tot_attach
***************************************************************************** *****************************************************************************
* Initialize a TDT/TOT subtable decoder. * Initialize a TDT/TOT subtable decoder.
*****************************************************************************/ *****************************************************************************/
bool dvbpsi_AttachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, bool dvbpsi_tot_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_tot_callback pf_callback, void* p_cb_data) dvbpsi_tot_callback pf_callback, void* p_cb_data)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -74,18 +74,18 @@ bool dvbpsi_AttachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -74,18 +74,18 @@ bool dvbpsi_AttachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
dvbpsi_tot_decoder_t *p_tot_decoder; dvbpsi_tot_decoder_t *p_tot_decoder;
p_tot_decoder = (dvbpsi_tot_decoder_t *) dvbpsi_NewDecoder(NULL, p_tot_decoder = (dvbpsi_tot_decoder_t *) dvbpsi_decoder_new(NULL,
0, true, sizeof(dvbpsi_tot_decoder_t)); 0, true, sizeof(dvbpsi_tot_decoder_t));
if (p_tot_decoder == NULL) if (p_tot_decoder == NULL)
return false; return false;
/* subtable decoder configuration */ /* subtable decoder configuration */
dvbpsi_demux_subdec_t* p_subdec; dvbpsi_demux_subdec_t* p_subdec;
p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_DetachTOT, p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_tot_detach,
dvbpsi_GatherTOTSections, DVBPSI_DECODER(p_tot_decoder)); dvbpsi_tot_sections_gather, DVBPSI_DECODER(p_tot_decoder));
if (p_subdec == NULL) if (p_subdec == NULL)
{ {
dvbpsi_DeleteDecoder(DVBPSI_DECODER(p_tot_decoder)); dvbpsi_decoder_delete(DVBPSI_DECODER(p_tot_decoder));
return false; return false;
} }
...@@ -101,11 +101,11 @@ bool dvbpsi_AttachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi ...@@ -101,11 +101,11 @@ bool dvbpsi_AttachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachTOT * dvbpsi_tot_detach
***************************************************************************** *****************************************************************************
* Close a TDT/TOT decoder. * Close a TDT/TOT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, void dvbpsi_tot_detach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
...@@ -130,7 +130,7 @@ void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -130,7 +130,7 @@ void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
dvbpsi_tot_decoder_t* p_tot_decoder; dvbpsi_tot_decoder_t* p_tot_decoder;
p_tot_decoder = (dvbpsi_tot_decoder_t*)p_subdec->p_decoder; p_tot_decoder = (dvbpsi_tot_decoder_t*)p_subdec->p_decoder;
if (p_tot_decoder->p_building_tot) if (p_tot_decoder->p_building_tot)
dvbpsi_DeleteTOT(p_tot_decoder->p_building_tot); dvbpsi_tot_delete(p_tot_decoder->p_building_tot);
p_tot_decoder->p_building_tot = NULL; p_tot_decoder->p_building_tot = NULL;
dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec); dvbpsi_DetachDemuxSubDecoder(p_demux, p_subdec);
...@@ -138,11 +138,11 @@ void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -138,11 +138,11 @@ void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitTOT * dvbpsi_tot_init
***************************************************************************** *****************************************************************************
* Initialize a pre-allocated dvbpsi_tot_t structure. * Initialize a pre-allocated dvbpsi_tot_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint64_t i_utc_time) bool b_current_next, uint64_t i_utc_time)
{ {
assert(p_tot); assert(p_tot);
...@@ -157,50 +157,50 @@ void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version, ...@@ -157,50 +157,50 @@ void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewTOT * dvbpsi_tot_new
***************************************************************************** *****************************************************************************
* Allocate and Initialize a new dvbpsi_tot_t structure. * Allocate and Initialize a new dvbpsi_tot_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_tot_t *dvbpsi_NewTOT(uint16_t i_ts_id, uint8_t i_version, dvbpsi_tot_t *dvbpsi_tot_new(uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint64_t i_utc_time) bool b_current_next, uint64_t i_utc_time)
{ {
dvbpsi_tot_t *p_tot = (dvbpsi_tot_t*)malloc(sizeof(dvbpsi_tot_t)); dvbpsi_tot_t *p_tot = (dvbpsi_tot_t*)malloc(sizeof(dvbpsi_tot_t));
if (p_tot != NULL) if (p_tot != NULL)
dvbpsi_InitTOT(p_tot, i_ts_id, i_version, b_current_next, i_utc_time); dvbpsi_tot_init(p_tot, i_ts_id, i_version, b_current_next, i_utc_time);
return p_tot; return p_tot;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyTOT * dvbpsi_tot_empty
***************************************************************************** *****************************************************************************
* Clean a dvbpsi_tot_t structure. * Clean a dvbpsi_tot_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_EmptyTOT(dvbpsi_tot_t* p_tot) void dvbpsi_tot_empty(dvbpsi_tot_t* p_tot)
{ {
dvbpsi_DeleteDescriptors(p_tot->p_first_descriptor); dvbpsi_DeleteDescriptors(p_tot->p_first_descriptor);
p_tot->p_first_descriptor = NULL; p_tot->p_first_descriptor = NULL;
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_NewTOT * dvbpsi_tot_delete
***************************************************************************** *****************************************************************************
* Clean and Delete dvbpsi_tot_t structure. * Clean and Delete dvbpsi_tot_t structure.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DeleteTOT(dvbpsi_tot_t* p_tot) void dvbpsi_tot_delete(dvbpsi_tot_t* p_tot)
{ {
if (p_tot) if (p_tot)
dvbpsi_EmptyTOT(p_tot); dvbpsi_tot_empty(p_tot);
free(p_tot); free(p_tot);
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_TOTAddDescriptor * dvbpsi_tot_descriptor_add
***************************************************************************** *****************************************************************************
* Add a descriptor in the TOT. * Add a descriptor in the TOT.
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t* dvbpsi_TOTAddDescriptor(dvbpsi_tot_t* p_tot, dvbpsi_descriptor_t* dvbpsi_tot_descriptor_add(dvbpsi_tot_t* p_tot,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
{ {
dvbpsi_descriptor_t* p_descriptor dvbpsi_descriptor_t* p_descriptor
= dvbpsi_NewDescriptor(i_tag, i_length, p_data); = dvbpsi_NewDescriptor(i_tag, i_length, p_data);
...@@ -221,14 +221,14 @@ static void dvbpsi_ReInitTOT(dvbpsi_tot_decoder_t* p_decoder, const bool b_force ...@@ -221,14 +221,14 @@ static void dvbpsi_ReInitTOT(dvbpsi_tot_decoder_t* p_decoder, const bool b_force
{ {
assert(p_decoder); assert(p_decoder);
dvbpsi_ReInitDecoder(DVBPSI_DECODER(p_decoder), b_force); dvbpsi_decoder_reset(DVBPSI_DECODER(p_decoder), b_force);
/* Force redecoding */ /* Force redecoding */
if (b_force) if (b_force)
{ {
/* Free structures */ /* Free structures */
if (p_decoder->p_building_tot) if (p_decoder->p_building_tot)
dvbpsi_DeleteTOT(p_decoder->p_building_tot); dvbpsi_tot_delete(p_decoder->p_building_tot);
} }
p_decoder->p_building_tot = NULL; p_decoder->p_building_tot = NULL;
} }
...@@ -278,7 +278,7 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot ...@@ -278,7 +278,7 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot
/* Initialize the structures if it's the first section received */ /* Initialize the structures if it's the first section received */
if (!p_tot_decoder->p_building_tot) if (!p_tot_decoder->p_building_tot)
{ {
p_tot_decoder->p_building_tot = dvbpsi_NewTOT(p_section->i_extension, p_tot_decoder->p_building_tot = dvbpsi_tot_new(p_section->i_extension,
p_section->i_version, p_section->b_current_next, p_section->i_version, p_section->b_current_next,
((uint64_t)p_section->p_payload_start[0] << 32) ((uint64_t)p_section->p_payload_start[0] << 32)
| ((uint64_t)p_section->p_payload_start[1] << 24) | ((uint64_t)p_section->p_payload_start[1] << 24)
...@@ -291,7 +291,7 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot ...@@ -291,7 +291,7 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot
} }
/* Fill the section array */ /* Fill the section array */
if (dvbpsi_AddSectionDecoder(DVBPSI_DECODER(p_tot_decoder), p_section)) if (dvbpsi_decoder_section_add(DVBPSI_DECODER(p_tot_decoder), p_section))
dvbpsi_debug(p_dvbpsi, "TOT decoder", "overwrite section number %d", dvbpsi_debug(p_dvbpsi, "TOT decoder", "overwrite section number %d",
p_section->i_number); p_section->i_number);
...@@ -299,13 +299,13 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot ...@@ -299,13 +299,13 @@ static bool dvbpsi_AddSectionTOT(dvbpsi_t *p_dvbpsi, dvbpsi_tot_decoder_t *p_tot
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherTOTSections * dvbpsi_tot_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi, void dvbpsi_tot_sections_gather(dvbpsi_t* p_dvbpsi,
dvbpsi_decoder_t* p_decoder, dvbpsi_decoder_t* p_decoder,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
assert(p_dvbpsi); assert(p_dvbpsi);
assert(p_dvbpsi->p_decoder); assert(p_dvbpsi->p_decoder);
...@@ -370,7 +370,7 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi, ...@@ -370,7 +370,7 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi,
} }
/* Check if we have all the sections */ /* Check if we have all the sections */
if (dvbpsi_SectionsCompleteDecoder(DVBPSI_DECODER(p_tot_decoder))) if (dvbpsi_decoder_sections_completed(DVBPSI_DECODER(p_tot_decoder)))
{ {
assert(p_tot_decoder->pf_tot_callback); assert(p_tot_decoder->pf_tot_callback);
...@@ -378,9 +378,9 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi, ...@@ -378,9 +378,9 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi,
p_tot_decoder->current_tot = *p_tot_decoder->p_building_tot; p_tot_decoder->current_tot = *p_tot_decoder->p_building_tot;
p_tot_decoder->b_current_valid = true; p_tot_decoder->b_current_valid = true;
/* Chain the sections */ /* Chain the sections */
dvbpsi_ChainSectionsDecoder(DVBPSI_DECODER(p_tot_decoder)); dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_tot_decoder));
/* Decode the sections */ /* Decode the sections */
dvbpsi_DecodeTOTSections(p_dvbpsi, p_tot_decoder->p_building_tot, dvbpsi_tot_sections_decode(p_dvbpsi, p_tot_decoder->p_building_tot,
p_tot_decoder->ap_sections[0]); p_tot_decoder->ap_sections[0]);
/* Delete the sections */ /* Delete the sections */
dvbpsi_DeletePSISections(p_tot_decoder->ap_sections[0]); dvbpsi_DeletePSISections(p_tot_decoder->ap_sections[0]);
...@@ -394,11 +394,11 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi, ...@@ -394,11 +394,11 @@ void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_ValidTOTSection * dvbpsi_tot_section_valid
***************************************************************************** *****************************************************************************
* Check the CRC_32 if the section has b_syntax_indicator set. * Check the CRC_32 if the section has b_syntax_indicator set.
*****************************************************************************/ *****************************************************************************/
static bool dvbpsi_ValidTOTSection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section) static bool dvbpsi_tot_section_valid(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section)
{ {
if (p_section->i_table_id == 0x70) if (p_section->i_table_id == 0x70)
{ {
...@@ -425,18 +425,18 @@ static bool dvbpsi_ValidTOTSection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_s ...@@ -425,18 +425,18 @@ static bool dvbpsi_ValidTOTSection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_s
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeTOTSections * dvbpsi_tot_sections_decode
***************************************************************************** *****************************************************************************
* TDT/TOT decoder. * TDT/TOT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeTOTSections(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot, void dvbpsi_tot_sections_decode(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
{ {
if (p_section) if (p_section)
{ {
uint8_t* p_byte; uint8_t* p_byte;
if (!dvbpsi_ValidTOTSection(p_dvbpsi, p_section)) if (!dvbpsi_tot_section_valid(p_dvbpsi, p_section))
return; return;
p_byte = p_section->p_payload_start; p_byte = p_section->p_payload_start;
...@@ -463,7 +463,7 @@ void dvbpsi_DecodeTOTSections(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot, ...@@ -463,7 +463,7 @@ void dvbpsi_DecodeTOTSections(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot,
uint8_t i_tag = p_byte[0]; uint8_t i_tag = p_byte[0];
uint8_t i_length = p_byte[1]; uint8_t i_length = p_byte[1];
if (i_length + 2 <= p_section->p_payload_end - p_byte) if (i_length + 2 <= p_section->p_payload_end - p_byte)
dvbpsi_TOTAddDescriptor(p_tot, i_tag, i_length, p_byte + 2); dvbpsi_tot_descriptor_add(p_tot, i_tag, i_length, p_byte + 2);
p_byte += 2 + i_length; p_byte += 2 + i_length;
} }
} }
...@@ -471,11 +471,11 @@ void dvbpsi_DecodeTOTSections(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot, ...@@ -471,11 +471,11 @@ void dvbpsi_DecodeTOTSections(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot,
} }
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenTOTSections * dvbpsi_tot_sections_generate
***************************************************************************** *****************************************************************************
* Generate TDT/TOT sections based on the dvbpsi_tot_t structure. * Generate TDT/TOT sections based on the dvbpsi_tot_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_t *p_dvbpsi, dvbpsi_tot_t* p_tot) dvbpsi_psi_section_t* dvbpsi_tot_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_tot_t* p_tot)
{ {
dvbpsi_psi_section_t* p_result; dvbpsi_psi_section_t* p_result;
dvbpsi_descriptor_t* p_descriptor = p_tot->p_first_descriptor; dvbpsi_descriptor_t* p_descriptor = p_tot->p_first_descriptor;
...@@ -562,7 +562,7 @@ dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_t *p_dvbpsi, dvbpsi_tot_t* p_ ...@@ -562,7 +562,7 @@ dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_t *p_dvbpsi, dvbpsi_tot_t* p_
p_byte[3] = p_tot->i_crc & 0xff; p_byte[3] = p_tot->i_crc & 0xff;
} }
if (!dvbpsi_ValidTOTSection(p_dvbpsi, p_result)) if (!dvbpsi_tot_section_valid(p_dvbpsi, p_result))
{ {
dvbpsi_error(p_dvbpsi, "TDT/TOT generator", "********************************************"); dvbpsi_error(p_dvbpsi, "TDT/TOT generator", "********************************************");
dvbpsi_error(p_dvbpsi, "TDT/TOT generator", "* Generated TDT/TOT section is invalid. *"); dvbpsi_error(p_dvbpsi, "TDT/TOT generator", "* Generated TDT/TOT section is invalid. *");
......
...@@ -80,10 +80,10 @@ typedef struct dvbpsi_tot_s ...@@ -80,10 +80,10 @@ typedef struct dvbpsi_tot_s
typedef void (* dvbpsi_tot_callback)(void* p_cb_data, dvbpsi_tot_t* p_new_tot); typedef void (* dvbpsi_tot_callback)(void* p_cb_data, dvbpsi_tot_t* p_new_tot);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachTOT * dvbpsi_tot_attach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn bool dvbpsi_AttachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, * \fn bool dvbpsi_tot_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_tot_callback pf_callback, void* p_cb_data) dvbpsi_tot_callback pf_callback, void* p_cb_data)
* \brief Creation and initialization of a TDT/TOT decoder. * \brief Creation and initialization of a TDT/TOT decoder.
* \param p_dvbpsi dvbpsi handle pointing to Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle pointing to Subtable demultiplexor to which the decoder is attached.
...@@ -93,28 +93,28 @@ typedef void (* dvbpsi_tot_callback)(void* p_cb_data, dvbpsi_tot_t* p_new_tot); ...@@ -93,28 +93,28 @@ typedef void (* dvbpsi_tot_callback)(void* p_cb_data, dvbpsi_tot_t* p_new_tot);
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool dvbpsi_AttachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, bool dvbpsi_tot_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
dvbpsi_tot_callback pf_callback, void* p_cb_data); dvbpsi_tot_callback pf_callback, void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachTOT * dvbpsi_tot_detach
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn int dvbpsi_DetachTOT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension) * \fn int dvbpsi_tot_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension)
* \brief Destroy a TDT/TOT decoder. * \brief Destroy a TDT/TOT decoder.
* \param p_dvbpsi Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi Subtable demultiplexor to which the decoder is attached.
* \param i_table_id Table ID, usually 0x70 * \param i_table_id Table ID, usually 0x70
* \param i_extension Table ID extension, unused in the TDT/TOT * \param i_extension Table ID extension, unused in the TDT/TOT
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, void dvbpsi_tot_detach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension); uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitTOT/dvbpsi_NewTOT * dvbpsi_tot_init/dvbpsi_tot_new
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint64_t i_utc_time) * \fn void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint64_t i_utc_time)
* \brief Initialize a user-allocated dvbpsi_tot_t structure. * \brief Initialize a user-allocated dvbpsi_tot_t structure.
* \param p_tot pointer to the TDT/TOT structure * \param p_tot pointer to the TDT/TOT structure
* \param i_ts_id transport stream ID * \param i_ts_id transport stream ID
...@@ -123,11 +123,11 @@ void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, ...@@ -123,11 +123,11 @@ void dvbpsi_DetachTOT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
* \param i_utc_time the time in UTC * \param i_utc_time the time in UTC
* \return nothing. * \return nothing.
*/ */
void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version, void dvbpsi_tot_init(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint64_t i_utc_time); bool b_current_next, uint64_t i_utc_time);
/*! /*!
* \fn dvbpsi_tot_t *dvbpsi_NewTOT(uint64_t i_utc_time) * \fn dvbpsi_tot_t *dvbpsi_tot_new(uint64_t i_utc_time)
* \brief Allocate and initialize a new dvbpsi_tot_t structure. * \brief Allocate and initialize a new dvbpsi_tot_t structure.
* \param i_ts_id transport stream ID * \param i_ts_id transport stream ID
* \param i_version SDT version * \param i_version SDT version
...@@ -135,36 +135,36 @@ void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version, ...@@ -135,36 +135,36 @@ void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint16_t i_ts_id, uint8_t i_version,
* \param i_utc_time the time in UTC * \param i_utc_time the time in UTC
* \return p_tot pointer to the TDT/TOT structure * \return p_tot pointer to the TDT/TOT structure
*/ */
dvbpsi_tot_t *dvbpsi_NewTOT(uint16_t i_ts_id, uint8_t i_version, dvbpsi_tot_t *dvbpsi_tot_new(uint16_t i_ts_id, uint8_t i_version,
bool b_current_next, uint64_t i_utc_time); bool b_current_next, uint64_t i_utc_time);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyTOT/dvbpsi_DeleteTOT * dvbpsi_tot_empty/dvbpsi_tot_delete
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_EmptyTOT(dvbpsi_tot_t* p_tot) * \fn void dvbpsi_tot_empty(dvbpsi_tot_t* p_tot)
* \brief Clean a dvbpsi_tot_t structure. * \brief Clean a dvbpsi_tot_t structure.
* \param p_tot pointer to the TDT/TOT structure * \param p_tot pointer to the TDT/TOT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_EmptyTOT(dvbpsi_tot_t* p_tot); void dvbpsi_tot_empty(dvbpsi_tot_t* p_tot);
/*! /*!
* \fn dvbpsi_DeleteTOT(dvbpsi_tot_t* p_tot) * \fn dvbpsi_tot_delete(dvbpsi_tot_t* p_tot)
* \brief Clean and free a dvbpsi_tot_t structure. * \brief Clean and free a dvbpsi_tot_t structure.
* \param p_tot pointer to the TDT/TOT structure * \param p_tot pointer to the TDT/TOT structure
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DeleteTOT(dvbpsi_tot_t* p_tot); void dvbpsi_tot_delete(dvbpsi_tot_t* p_tot);
/***************************************************************************** /*****************************************************************************
* dvbpsi_TOTAddDescriptor * dvbpsi_tot_descriptor_add
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_descriptor_t* dvbpsi_TOTAddDescriptor(dvbpsi_tot_t* p_tot, * \fn dvbpsi_descriptor_t* dvbpsi_tot_descriptor_add(dvbpsi_tot_t* p_tot,
uint8_t i_tag, uint8_t i_tag,
uint8_t i_length, uint8_t i_length,
uint8_t* p_data) uint8_t* p_data)
* \brief Add a descriptor in the TOT. * \brief Add a descriptor in the TOT.
* \param p_tot pointer to the TOT structure * \param p_tot pointer to the TOT structure
* \param i_tag descriptor's tag * \param i_tag descriptor's tag
...@@ -172,15 +172,15 @@ void dvbpsi_DeleteTOT(dvbpsi_tot_t* p_tot); ...@@ -172,15 +172,15 @@ void dvbpsi_DeleteTOT(dvbpsi_tot_t* p_tot);
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t* dvbpsi_TOTAddDescriptor(dvbpsi_tot_t* p_tot, dvbpsi_descriptor_t* dvbpsi_tot_descriptor_add(dvbpsi_tot_t* p_tot,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenTOTSections * dvbpsi_tot_sections_generate
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_t *p_dvbpsi, dvbpsi_tot_t* p_tot) * \fn dvbpsi_psi_section_t* dvbpsi_tot_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_tot_t* p_tot)
* \brief TDT/TOT generator * \brief TDT/TOT generator
* \param p_dvbpsi handle to dvbpsi with attached decoder * \param p_dvbpsi handle to dvbpsi with attached decoder
* \param p_tot TDT/TOT structure * \param p_tot TDT/TOT structure
...@@ -188,7 +188,27 @@ dvbpsi_descriptor_t* dvbpsi_TOTAddDescriptor(dvbpsi_tot_t* p_tot, ...@@ -188,7 +188,27 @@ dvbpsi_descriptor_t* dvbpsi_TOTAddDescriptor(dvbpsi_tot_t* p_tot,
* *
* Generate TDT/TOT sections based on the dvbpsi_tot_t structure. * Generate TDT/TOT sections based on the dvbpsi_tot_t structure.
*/ */
dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot); dvbpsi_psi_section_t* dvbpsi_tot_sections_generate(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot);
/*****************************************************************************
* deprecated API's
*****************************************************************************/
__attribute__((deprecated))
int dvbpsi_AttachTOT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
uint16_t i_extension,
dvbpsi_tot_callback pf_callback, void* p_cb_data);
__attribute__((deprecated))
void dvbpsi_DetachTOT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension);
__attribute__((deprecated))
void dvbpsi_NewTOT(dvbpsi_tot_t* p_tot, uint64_t i_utc_time);
__attribute__((deprecated)) void dvbpsi_DeleteTOT(dvbpsi_tot_t* p_tot);
__attribute__((deprecated))
dvbpsi_descriptor_t* dvbpsi_TOTAddDescriptor(dvbpsi_tot_t* p_tot,
uint8_t i_tag, uint8_t i_length,
uint8_t* p_data);
__attribute__((deprecated))
dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_tot_t* p_tot);
#ifdef __cplusplus #ifdef __cplusplus
}; };
...@@ -197,4 +217,3 @@ dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_ ...@@ -197,4 +217,3 @@ dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_
#else #else
#error "Multiple inclusions of tot.h" #error "Multiple inclusions of tot.h"
#endif #endif
...@@ -50,27 +50,31 @@ typedef struct dvbpsi_tot_decoder_s ...@@ -50,27 +50,31 @@ typedef struct dvbpsi_tot_decoder_s
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherTOTSections * dvbpsi_tot_sections_gather
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherTOTSections(dvbpsi_t* p_dvbpsi, void dvbpsi_tot_sections_gather(dvbpsi_t* p_dvbpsi,
dvbpsi_decoder_t* p_decoder, dvbpsi_decoder_t* p_decoder,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_ValidTOTSection * dvbpsi_tot_sections_decode
***************************************************************************** *****************************************************************************
* Check the CRC_32 if the section has b_syntax_indicator set. * TDT/TOT decoder.
*****************************************************************************/ *****************************************************************************/
static bool dvbpsi_ValidTOTSection(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section); void dvbpsi_tot_sections_decode(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot,
dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeTOTSections * Deprecated API's
*****************************************************************************
* TDT/TOT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeTOTSections(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot, __attribute__((deprecated))
void dvbpsi_GatherTOTSections(dvbpsi_handle* p_dvbpsi,
dvbpsi_decoder_t* p_decoder,
dvbpsi_psi_section_t* p_section);
__attribute__((deprecated))
void dvbpsi_DecodeTOTSections(dvbpsi_handle* p_dvbpsi, dvbpsi_tot_t* p_tot,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
#else #else
......
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