Browse Source

convert bitdepth magic number into global constant for CELT_MODE, no functional changes

tags/v1.9.4
Jörn Nettingsmeier Torben Hohn 16 years ago
parent
commit
2ac9617a97
3 changed files with 11 additions and 7 deletions
  1. +4
    -4
      common/netjack.c
  2. +5
    -3
      common/netjack_packet.c
  3. +2
    -0
      common/netjack_packet.h

+ 4
- 4
common/netjack.c View File

@@ -364,7 +364,7 @@ void netjack_attach( netjack_driver_state_t *netj )
netj->capture_ports =
jack_slist_append (netj->capture_ports, port);

if( netj->bitdepth == 1000 ) {
if( netj->bitdepth == CELT_MODE ) {
#if HAVE_CELT
celt_int32_t lookahead;
// XXX: memory leak
@@ -411,7 +411,7 @@ void netjack_attach( netjack_driver_state_t *netj )

netj->playback_ports =
jack_slist_append (netj->playback_ports, port);
if( netj->bitdepth == 1000 ) {
if( netj->bitdepth == CELT_MODE ) {
#if HAVE_CELT
// XXX: memory leak
CELTMode *celt_mode = celt_mode_create( netj->sample_rate, 1, netj->period_size, NULL );
@@ -517,7 +517,7 @@ netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj,
netj->client = client;


if ((bitdepth != 0) && (bitdepth != 8) && (bitdepth != 16) && (bitdepth != 1000))
if ((bitdepth != 0) && (bitdepth != 8) && (bitdepth != 16) && (bitdepth != CELT_MODE))
{
jack_info ("Invalid bitdepth: %d (8, 16 or 0 for float) !!!", bitdepth);
return NULL;
@@ -655,7 +655,7 @@ netjack_startup( netjack_driver_state_t *netj )
(jack_time_t) floor ((((float) netj->period_size) / (float)netj->sample_rate)
* 1000000.0f);

if( netj->bitdepth == 1000 ) {
if( netj->bitdepth == CELT_MODE ) {
// celt mode.
// TODO: this is a hack. But i dont want to change the packet header.
netj->net_period_down = netj->resample_factor;


+ 5
- 3
common/netjack_packet.c View File

@@ -132,7 +132,9 @@ int get_sample_size (int bitdepth)
return sizeof (int8_t);
if (bitdepth == 16)
return sizeof (int16_t);
if( bitdepth == 1000 )
//JN: why? is this for buffer sizes before or after encoding?
//JN: if the former, why not int16_t, if the latter, shouldn't it depend on -c N?
if( bitdepth == CELT_MODE )
return sizeof( unsigned char );
return sizeof (int32_t);
}
@@ -1504,7 +1506,7 @@ render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t
else if (bitdepth == 16)
render_payload_to_jack_ports_16bit (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
#if HAVE_CELT
else if (bitdepth == 1000)
else if (bitdepth == CELT_MODE)
render_payload_to_jack_ports_celt (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
#endif
else
@@ -1519,7 +1521,7 @@ render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *play
else if (bitdepth == 16)
render_jack_ports_to_payload_16bit (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
#if HAVE_CELT
else if (bitdepth == 1000)
else if (bitdepth == CELT_MODE)
render_jack_ports_to_payload_celt (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
#endif
else


+ 2
- 0
common/netjack_packet.h View File

@@ -42,6 +42,8 @@
//#include <netinet/in.h>
// The Packet Header.

#define CELT_MODE 1000 // Magic bitdepth value that indicates CELT compression

typedef struct _jacknet_packet_header jacknet_packet_header;

struct _jacknet_packet_header


Loading…
Cancel
Save