[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-devel
Subject:    [xine-devel] [PATCH] TTA demux: use _x_demux_send_data
From:       Kelvie Wong <kelvie () ieee ! org>
Date:       2009-12-17 1:31:07
Message-ID: 957e20fda62811984200.1261013467 () gargantua
[Download RAW message or body]

# HG changeset patch
# User Kelvie Wong <kelvie@ieee.org>
# Date 1260952072 28800
# Node ID 957e20fda6281198420048b162ee9542bde2d6fc
# Parent  08ca808df71c5b3cf7009daebdaf5f2a973ef75d
TTA demux: use _x_demux_send_data

To reduce code duplication.

diff -r 08ca808df71c -r 957e20fda628 src/demuxers/demux_tta.c
--- a/src/demuxers/demux_tta.c	Tue Dec 15 20:49:16 2009 -0800
+++ b/src/demuxers/demux_tta.c	Wed Dec 16 00:27:52 2009 -0800
@@ -122,39 +122,17 @@
 
   bytes_to_read = le2me_32(this->seektable[this->currentframe]);
 
-  while(bytes_to_read) {
-    off_t bytes_read = 0;
-    buf_element_t *buf = NULL;
-
-    /* Get a buffer */
-    buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo);
-    buf->type = BUF_AUDIO_TTA;
-    buf->pts = 0;
-    buf->extra_info->total_time = (int)(le2me_32(this->header.tta.data_length) * \
                1000.0 / le2me_32(this->header.tta.samplerate)); /* milliseconds */ 
-    buf->decoder_flags = 0;
-
-    /* Set normalised position */
-    buf->extra_info->input_normpos =
-      (int) ((double) this->currentframe * 65535 / this->totalframes);
-
-    /* Set time */
-    buf->extra_info->input_time = (int)(FRAME_TIME * this->currentframe)*1000;
-
-    bytes_read = this->input->read(this->input, buf->content, ( bytes_to_read > \
                buf->max_size ) ? buf->max_size : bytes_to_read);
-    if (bytes_read < 0) {
-      this->status = DEMUX_FINISHED;
-      break;
-    }
-
-    buf->size = bytes_read;
-
-    bytes_to_read -= bytes_read;
-
-    if ( bytes_to_read <= 0 )
-      buf->decoder_flags |= BUF_FLAG_FRAME_END;
-
-    this->audio_fifo->put(this->audio_fifo, buf);
-  }
+  _x_demux_read_send_data(this->audio_fifo,
+                          this->input,
+                          bytes_to_read,
+                          /*pts*/ 0,
+                          BUF_AUDIO_TTA,
+                          /*decoder_flags*/ 0,
+                          (int) ((double) this->currentframe * 65535.0 / \
this->totalframes), +                          (int)(FRAME_TIME * \
this->currentframe)*1000, +                          \
(int)(le2me_32(this->header.tta.data_length) * 1000.0 / +                             \
le2me_32(this->header.tta.samplerate)), +                          \
this->currentframe);  
   this->currentframe++;
 

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
xine-devel mailing list
xine-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic