Migration of current video works from private repository to this repository. This closed #1176
git-svn-id: https://svn.pjsip.org/repos/pjproject/branches/projects/2.0-dev@3392 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/samples/playsine.c b/pjsip-apps/src/samples/playsine.c
index e03b0d5..c2fb646 100644
--- a/pjsip-apps/src/samples/playsine.c
+++ b/pjsip-apps/src/samples/playsine.c
@@ -86,7 +86,7 @@
unsigned i, count, left, right;
/* Get number of samples */
- count = frame->size / 2 / port->info.channel_count;
+ count = frame->size / 2 / PJMEDIA_PIA_CCNT(&port->info);
left = 0;
right = 0;
@@ -95,7 +95,7 @@
*samples++ = sine->samples[left];
++left;
- if (port->info.channel_count == 2) {
+ if (PJMEDIA_PIA_CCNT(&port->info) == 2) {
*samples++ = sine->samples[right];
right += 2; /* higher pitch so we can distinguish left and right. */
if (right >= count)
@@ -126,6 +126,7 @@
pjmedia_port *port;
unsigned i;
unsigned count;
+ pj_str_t name;
port_data *sine;
PJ_ASSERT_RETURN(pool && channel_count > 0 && channel_count <= 2,
@@ -135,17 +136,12 @@
PJ_ASSERT_RETURN(port != NULL, PJ_ENOMEM);
/* Fill in port info. */
- port->info.bits_per_sample = 16;
- port->info.channel_count = channel_count;
- port->info.encoding_name = pj_str("pcm");
- port->info.has_info = 1;
- port->info.name = pj_str("sine generator");
- port->info.need_info = 0;
- port->info.pt = 0xFF;
- port->info.clock_rate = sampling_rate;
- port->info.samples_per_frame = sampling_rate * 20 / 1000 * channel_count;
- port->info.bytes_per_frame = port->info.samples_per_frame * 2;
- port->info.type = PJMEDIA_TYPE_AUDIO;
+ name = pj_str("sine generator");
+ pjmedia_port_info_init(&port->info, &name,
+ PJMEDIA_PORT_SIGNATURE('s', 'i', 'n', 'e'),
+ sampling_rate,
+ channel_count,
+ 16, sampling_rate * 20 / 1000 * channel_count);
/* Set the function to feed frame */
port->get_frame = &sine_get_frame;
@@ -154,7 +150,7 @@
port->port_data.pdata = sine = pj_pool_zalloc(pool, sizeof(port_data));
/* Create samples */
- count = port->info.samples_per_frame / channel_count;
+ count = PJMEDIA_PIA_SPF(&port->info) / channel_count;
sine->samples = pj_pool_alloc(pool, count * sizeof(pj_int16_t));
PJ_ASSERT_RETURN(sine->samples != NULL, PJ_ENOMEM);
@@ -244,10 +240,10 @@
status = pjmedia_snd_port_create_player(
pool, /* pool */
-1, /* use default dev. */
- sine_port->info.clock_rate, /* clock rate. */
- sine_port->info.channel_count, /* # of channels. */
- sine_port->info.samples_per_frame, /* samples per frame. */
- sine_port->info.bits_per_sample, /* bits per sample. */
+ PJMEDIA_PIA_SRATE(&sine_port->info),/* clock rate. */
+ PJMEDIA_PIA_CCNT(&sine_port->info),/* # of channels. */
+ PJMEDIA_PIA_SPF(&sine_port->info), /* samples per frame. */
+ PJMEDIA_PIA_BITS(&sine_port->info),/* bits per sample. */
0, /* options */
&snd_port /* returned port */
);