summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2013-04-19 09:52:02 +0000
committerLiong Sauw Ming <ming@teluu.com>2013-04-19 09:52:02 +0000
commit671f27d6164a392e7c501626e50afa464b9bdf0d (patch)
treecae6906e92d728479a79fe4837e17d6b272b6d0c /third_party
parentab044e2031d35fd0412e5b7e61b5404cf4dea2a0 (diff)
Re #1630: Fixed mp3 writer to work with PJSIP 2.x (thanks to Toni Rutar for the fix)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4483 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/mp3/mp3_writer.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/third_party/mp3/mp3_writer.c b/third_party/mp3/mp3_writer.c
index ca646170..61d2b8b5 100644
--- a/third_party/mp3/mp3_writer.c
+++ b/third_party/mp3/mp3_writer.c
@@ -37,7 +37,7 @@
#define THIS_FILE "mp3_writer.c"
-#define SIGNATURE PJMEDIA_PORT_SIGNATURE('F', 'W', 'M', '3')
+#define SIGNATURE PJMEDIA_SIG_CLASS_PORT_AUD('M','W')
#define BYTES_PER_SAMPLE 2
static struct BladeDLL
@@ -175,12 +175,12 @@ static pj_status_t init_mp3_encoder(struct mp3_file_port *fport,
LConfig.dwConfig = BE_CONFIG_LAME;
LConfig.format.LHV1.dwStructVersion = 1;
LConfig.format.LHV1.dwStructSize = sizeof(BE_CONFIG);
- LConfig.format.LHV1.dwSampleRate = fport->base.info.clock_rate;
+ LConfig.format.LHV1.dwSampleRate = PJMEDIA_PIA_SRATE(&fport->base.info);
LConfig.format.LHV1.dwReSampleRate = 0;
- if (fport->base.info.channel_count==1)
+ if (PJMEDIA_PIA_CCNT(&fport->base.info)==1)
LConfig.format.LHV1.nMode = BE_MP3_MODE_MONO;
- else if (fport->base.info.channel_count==2)
+ else if (PJMEDIA_PIA_CCNT(&fport->base.info)==2)
LConfig.format.LHV1.nMode = BE_MP3_MODE_STEREO;
else
return PJMEDIA_ENCCHANNEL;
@@ -322,7 +322,7 @@ pjmedia_mp3_writer_port_create( pj_pool_t *pool,
"bitrate=%dkbps%s, quality=%d",
(int)fport->base.info.name.slen,
fport->base.info.name.ptr,
- fport->base.info.clock_rate/1000,
+ PJMEDIA_PIA_SRATE(&fport->base.info),
fport->mp3_option.bit_rate/1000,
(fport->mp3_option.vbr ? " (VBR)" : ""),
fport->mp3_option.quality));
@@ -376,11 +376,11 @@ static pj_status_t file_put_frame(pjmedia_port *this_port,
/* Record silence if input is no-frame */
if (frame->type == PJMEDIA_FRAME_TYPE_NONE || frame->size == 0) {
- unsigned samples_left = fport->base.info.samples_per_frame;
+ unsigned samples_left = PJMEDIA_PIA_SPF(&fport->base.info);
unsigned samples_copied = 0;
/* Only want to record at most 1 second of silence */
- if (fport->silence_duration >= fport->base.info.clock_rate)
+ if (fport->silence_duration >= PJMEDIA_PIA_SRATE(&fport->base.info))
return PJ_SUCCESS;
while (samples_left) {
@@ -421,14 +421,14 @@ static pj_status_t file_put_frame(pjmedia_port *this_port,
}
}
- fport->silence_duration += fport->base.info.samples_per_frame;
+ fport->silence_duration += PJMEDIA_PIA_SPF(&fport->base.info);
}
/* If encoder is expecting different sample size, then we need to
* buffer the samples.
*/
else if (fport->mp3_samples_per_frame !=
- fport->base.info.samples_per_frame)
+ PJMEDIA_PIA_SPF(&fport->base.info))
{
unsigned samples_left = frame->size / 2;
unsigned samples_copied = 0;