diff options
author | Edward Hervey <bilboed@bilboed.com> | 2007-11-02 17:23:43 +0000 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2007-11-02 17:23:43 +0000 |
commit | 7eeeca8c27c2fc21bc332c201c630b0ac5dfdd65 (patch) | |
tree | 2e6fcc98a1c40562127c9b47e58677b337d26063 /gst/law/mulaw-decode.c | |
parent | ceb068d0e9d5fab22131f70be2cc3ab395c337f5 (diff) |
gst/law/mulaw-decode.*: Calculate outgoing buffer duration if incoming buffer didn't have a valid duration.
Original commit message from CVS:
* gst/law/mulaw-decode.c: (mulawdec_sink_setcaps),
(gst_mulawdec_chain):
* gst/law/mulaw-decode.h:
Calculate outgoing buffer duration if incoming buffer didn't have a
valid duration.
Diffstat (limited to 'gst/law/mulaw-decode.c')
-rw-r--r-- | gst/law/mulaw-decode.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c index 20ccb523..d7a858e4 100644 --- a/gst/law/mulaw-decode.c +++ b/gst/law/mulaw-decode.c @@ -73,6 +73,9 @@ mulawdec_sink_setcaps (GstPad * pad, GstCaps * caps) "signed", G_TYPE_BOOLEAN, TRUE, "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, channels, NULL); + mulawdec->rate = rate; + mulawdec->channels = channels; + return TRUE; } @@ -163,7 +166,11 @@ gst_mulawdec_chain (GstPad * pad, GstBuffer * buffer) GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT); GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buffer); - GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buffer); + if (GST_BUFFER_DURATION (outbuf) == GST_CLOCK_TIME_NONE) + GST_BUFFER_DURATION (outbuf) = gst_util_uint64_scale_int (GST_SECOND, + mulaw_size * 2, 2 * mulawdec->rate * mulawdec->channels); + else + GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buffer); gst_buffer_set_caps (outbuf, mulawdec->srccaps); mulaw_decode (mulaw_data, linear_data, mulaw_size); |