Commit 5e22d74d authored by Sam Hocevar's avatar Sam Hocevar

- include des PES de type AC3 pour pr�parer une bidouille inf�me

 - reformatage des commentaires � 80 colonnes au lieu de 81 parce que
  �a a le don de m'�nerver prodigieusement.
parent ab03c05d
...@@ -164,6 +164,7 @@ typedef struct ...@@ -164,6 +164,7 @@ typedef struct
#define MPEG2_VIDEO_ES 0x02 #define MPEG2_VIDEO_ES 0x02
#define MPEG1_AUDIO_ES 0x03 #define MPEG1_AUDIO_ES 0x03
#define MPEG2_AUDIO_ES 0x04 #define MPEG2_AUDIO_ES 0x04
#define AC3_AUDIO_ES 0x05
/******************************************************************************* /*******************************************************************************
......
/******************************************************************************* /******************************************************************************
* generic_decoder.c : generic decoder thread * generic_decoder.c : generic decoder thread
* (c)1999 VideoLAN * (c)1999 VideoLAN
******************************************************************************* ******************************************************************************
* This decoder provides a way to parse packets which do not belong to any * This decoder provides a way to parse packets which do not belong to any
* known stream type, or to redirect packets to files. It can extract PES files * known stream type, or to redirect packets to files. It can extract PES files
* from a multiplexed stream, identify automatically ES in a stream missing * from a multiplexed stream, identify automatically ES in a stream missing
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
* mode. * mode.
* A single generic decoder is able to handle several ES, therefore it can be * A single generic decoder is able to handle several ES, therefore it can be
* used as a 'default' decoder by the input thread. * used as a 'default' decoder by the input thread.
*******************************************************************************/ ******************************************************************************/
/******************************************************************************* /******************************************************************************
* Preamble * Preamble
*******************************************************************************/ ******************************************************************************/
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -56,15 +56,15 @@ static void IdentifyPES ( gdec_thread_t *p_gdec, pes_packet_t *p_pes ...@@ -56,15 +56,15 @@ static void IdentifyPES ( gdec_thread_t *p_gdec, pes_packet_t *p_pes
int i_stream_id ); int i_stream_id );
static void PrintPES ( pes_packet_t *p_pes, int i_stream_id ); static void PrintPES ( pes_packet_t *p_pes, int i_stream_id );
/******************************************************************************* /******************************************************************************
* gdec_CreateThread: create a generic decoder thread * gdec_CreateThread: create a generic decoder thread
******************************************************************************* ******************************************************************************
* This function creates a new generic decoder thread, and returns a pointer * This function creates a new generic decoder thread, and returns a pointer
* to its description. On error, it returns NULL. * to its description. On error, it returns NULL.
* Following configuration properties are used: * Following configuration properties are used:
* GDEC_CFG_ACTIONS (required) * GDEC_CFG_ACTIONS (required)
* ?? * ??
*******************************************************************************/ ******************************************************************************/
gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input, gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
int *pi_status ) int *pi_status )
{ {
...@@ -127,13 +127,13 @@ gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input, ...@@ -127,13 +127,13 @@ gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
return( p_gdec ); return( p_gdec );
} }
/******************************************************************************* /******************************************************************************
* gdec_DestroyThread: destroy a generic decoder thread * gdec_DestroyThread: destroy a generic decoder thread
******************************************************************************* ******************************************************************************
* Destroy a terminated thread. This function will return 0 if the thread could * Destroy a terminated thread. This function will return 0 if the thread could
* be destroyed, and non 0 else. The last case probably means that the thread * be destroyed, and non 0 else. The last case probably means that the thread
* was still active, and another try may succeed. * was still active, and another try may succeed.
*******************************************************************************/ ******************************************************************************/
void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status ) void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status )
{ {
int i_status; /* thread status */ int i_status; /* thread status */
...@@ -164,12 +164,12 @@ void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status ) ...@@ -164,12 +164,12 @@ void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status )
/* following functions are local */ /* following functions are local */
/******************************************************************************* /******************************************************************************
* CheckConfiguration: check gdec_CreateThread() configuration * CheckConfiguration: check gdec_CreateThread() configuration
******************************************************************************* ******************************************************************************
* Set default parameters where required. In DEBUG mode, check if configuration * Set default parameters where required. In DEBUG mode, check if configuration
* is valid. * is valid.
*******************************************************************************/ ******************************************************************************/
static int CheckConfiguration( gdec_cfg_t *p_cfg ) static int CheckConfiguration( gdec_cfg_t *p_cfg )
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -183,13 +183,13 @@ static int CheckConfiguration( gdec_cfg_t *p_cfg ) ...@@ -183,13 +183,13 @@ static int CheckConfiguration( gdec_cfg_t *p_cfg )
return( 0 ); return( 0 );
} }
/******************************************************************************* /******************************************************************************
* InitThread: initialize gdec thread * InitThread: initialize gdec thread
******************************************************************************* ******************************************************************************
* This function is called from RunThread and performs the second step of the * This function is called from RunThread and performs the second step of the
* initialization. It returns 0 on success. Note that the thread's flag are not * initialization. It returns 0 on success. Note that the thread's flag are not
* modified inside this function. * modified inside this function.
*******************************************************************************/ ******************************************************************************/
static int InitThread( gdec_thread_t *p_gdec ) static int InitThread( gdec_thread_t *p_gdec )
{ {
/* ?? */ /* ?? */
...@@ -210,12 +210,12 @@ static int InitThread( gdec_thread_t *p_gdec ) ...@@ -210,12 +210,12 @@ static int InitThread( gdec_thread_t *p_gdec )
return(0); return(0);
} }
/******************************************************************************* /******************************************************************************
* RunThread: generic decoder thread * RunThread: generic decoder thread
******************************************************************************* ******************************************************************************
* Generic decoder thread. This function does only returns when the thread is * Generic decoder thread. This function does only returns when the thread is
* terminated. * terminated.
*******************************************************************************/ ******************************************************************************/
static void RunThread( gdec_thread_t *p_gdec ) static void RunThread( gdec_thread_t *p_gdec )
{ {
pes_packet_t * p_pes; /* current packet */ pes_packet_t * p_pes; /* current packet */
...@@ -299,13 +299,13 @@ static void RunThread( gdec_thread_t *p_gdec ) ...@@ -299,13 +299,13 @@ static void RunThread( gdec_thread_t *p_gdec )
EndThread( p_gdec ); EndThread( p_gdec );
} }
/******************************************************************************* /******************************************************************************
* ErrorThread: RunThread() error loop * ErrorThread: RunThread() error loop
******************************************************************************* ******************************************************************************
* This function is called when an error occured during thread main's loop. The * This function is called when an error occured during thread main's loop. The
* thread can still receive feed, but must be ready to terminate as soon as * thread can still receive feed, but must be ready to terminate as soon as
* possible. * possible.
*******************************************************************************/ ******************************************************************************/
static void ErrorThread( gdec_thread_t *p_gdec ) static void ErrorThread( gdec_thread_t *p_gdec )
{ {
pes_packet_t * p_pes; /* pes packet */ pes_packet_t * p_pes; /* pes packet */
...@@ -326,12 +326,12 @@ static void ErrorThread( gdec_thread_t *p_gdec ) ...@@ -326,12 +326,12 @@ static void ErrorThread( gdec_thread_t *p_gdec )
} }
} }
/******************************************************************************* /******************************************************************************
* EndThread: thread destruction * EndThread: thread destruction
******************************************************************************* ******************************************************************************
* This function is called when the thread ends after a sucessfull * This function is called when the thread ends after a sucessfull
* initialization. * initialization.
*******************************************************************************/ ******************************************************************************/
static void EndThread( gdec_thread_t *p_gdec ) static void EndThread( gdec_thread_t *p_gdec )
{ {
int * pi_status; /* thread status */ int * pi_status; /* thread status */
...@@ -352,12 +352,12 @@ static void EndThread( gdec_thread_t *p_gdec ) ...@@ -352,12 +352,12 @@ static void EndThread( gdec_thread_t *p_gdec )
intf_DbgMsg("%p\n", p_gdec); intf_DbgMsg("%p\n", p_gdec);
} }
/******************************************************************************* /******************************************************************************
* IdentifyPES: identify a PES packet * IdentifyPES: identify a PES packet
******************************************************************************* ******************************************************************************
* Update ES tables in the input thread according to the stream_id value. See * Update ES tables in the input thread according to the stream_id value. See
* ISO 13818-1, table 2-18. * ISO 13818-1, table 2-18.
*******************************************************************************/ ******************************************************************************/
static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_stream_id ) static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_stream_id )
{ {
int i_id; /* stream id in es table */ int i_id; /* stream id in es table */
...@@ -385,7 +385,13 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea ...@@ -385,7 +385,13 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea
} }
/* Try to identify PES stream_id - see ISO 13818-1 table 2-18 */ /* Try to identify PES stream_id - see ISO 13818-1 table 2-18 */
if( (i_stream_id & 0xe0) == 0xc0 ) if( i_stream_id == 0xbd )
{
/* Dolby AC-3 stream - might be specific to DVD PS streams */
i_type = AC3_AUDIO_ES;
intf_DbgMsg("PES %p identified as AC3\n", p_pes);
}
else if( (i_stream_id & 0xe0) == 0xc0 )
{ {
/* ISO/IEC 13818-3 or ISO/IEC 11172-3 audio stream - since there is no /* ISO/IEC 13818-3 or ISO/IEC 11172-3 audio stream - since there is no
* way to make the difference between the two possibilities, and since * way to make the difference between the two possibilities, and since
...@@ -414,14 +420,14 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea ...@@ -414,14 +420,14 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea
/* ?? */ /* ?? */
} }
/******************************************************************************* /******************************************************************************
* PrintPES: print informations about a PES packet * PrintPES: print informations about a PES packet
******************************************************************************* ******************************************************************************
* This function will print information about a received PES packet. It is * This function will print information about a received PES packet. It is
* probably usefull only for debugging purposes, or before demultiplexing a * probably usefull only for debugging purposes, or before demultiplexing a
* stream. It has two different formats, depending of the presence of the DEBUG * stream. It has two different formats, depending of the presence of the DEBUG
* symbol. * symbol.
*******************************************************************************/ ******************************************************************************/
static void PrintPES( pes_packet_t *p_pes, int i_stream_id ) static void PrintPES( pes_packet_t *p_pes, int i_stream_id )
{ {
char psz_pes[128]; /* descriptor buffer */ char psz_pes[128]; /* descriptor buffer */
......
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