summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_mpeg_block.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_mpeg_block.c')
-rw-r--r--src/demuxers/demux_mpeg_block.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index 97480b5e9..1f9144505 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_mpeg_block.c,v 1.107 2002/07/14 22:27:25 miguelfreitas Exp $
+ * $Id: demux_mpeg_block.c,v 1.108 2002/07/17 18:17:48 miguelfreitas Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -90,6 +90,12 @@ typedef struct demux_mpeg_block_s {
int64_t last_pts[2];
int send_newpts;
int buf_flag_seek;
+
+
+ int pcm_bits;
+ int pcm_rate;
+ int pcm_channels;
+
} demux_mpeg_block_t ;
@@ -582,9 +588,25 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
}
dynamic_range = p[6];
- buf->decoder_info[1] = sample_rate;
- buf->decoder_info[2] = bits_per_sample;
- buf->decoder_info[3] = num_channels;
+ /* send header with audio parameters */
+ if( !preview_mode &&
+ (this->pcm_rate != sample_rate ||
+ this->pcm_bits != bits_per_sample ||
+ this->pcm_channels != num_channels) ) {
+
+ buf_element_t *buf2;
+
+ buf2 = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+
+ buf2->type = BUF_AUDIO_LPCM_BE + track;
+ buf2->decoder_flags = BUF_FLAG_HEADER;
+
+ buf2->decoder_info[1] = this->pcm_rate = sample_rate;
+ buf2->decoder_info[2] = this->pcm_bits = bits_per_sample;
+ buf2->decoder_info[3] = this->pcm_channels = num_channels;
+
+ this->video_fifo->put(this->video_fifo, buf2);
+ }
pcm_offset = 7;
@@ -912,6 +934,8 @@ static int demux_mpeg_block_start (demux_plugin_t *this_gen,
this->video_fifo = video_fifo;
this->audio_fifo = audio_fifo;
+ this->pcm_bits = this->pcm_rate = this->pcm_channels = 0;
+
if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) {
if (!this->blocksize)
this->blocksize = demux_mpeg_detect_blocksize( this, this->input );