Fixed some leftover fixes

Original commit message from CVS:
Fixed some leftover fixes
This commit is contained in:
Wim Taymans 2001-12-23 23:00:59 +00:00
parent 44f23c67f9
commit 1aa3f4b65c
2 changed files with 144 additions and 148 deletions

View file

@ -423,133 +423,131 @@ dvdsrc_loop (GstElement *element)
priv = dvdsrc->priv;
g_return_if_fail (GST_FLAG_IS_SET (dvdsrc, DVDSRC_OPEN));
do {
/**
* Playback by cell in this pgc, starting at the cell for our chapter.
*/
priv->next_cell = priv->start_cell;
for( priv->cur_cell = priv->start_cell; priv->next_cell < priv->cur_pgc->nr_of_cells; ) {
/**
* Playback by cell in this pgc, starting at the cell for our chapter.
*/
priv->next_cell = priv->start_cell;
for( priv->cur_cell = priv->start_cell; priv->next_cell < priv->cur_pgc->nr_of_cells; ) {
priv->cur_cell = priv->next_cell;
priv->cur_cell = priv->next_cell;
/* Check if we're entering an angle block. */
if( priv->cur_pgc->cell_playback[ priv->cur_cell ].block_type
/* Check if we're entering an angle block. */
if( priv->cur_pgc->cell_playback[ priv->cur_cell ].block_type
== BLOCK_TYPE_ANGLE_BLOCK ) {
int i;
int i;
priv->cur_cell += priv->angle;
for( i = 0;; ++i ) {
if( priv->cur_pgc->cell_playback[ priv->cur_cell + i ].block_mode
== BLOCK_MODE_LAST_CELL ) {
priv->next_cell = priv->cur_cell + i + 1;
break;
}
}
} else {
priv->next_cell = priv->cur_cell + 1;
}
priv->cur_cell += priv->angle;
for( i = 0;; ++i ) {
if( priv->cur_pgc->cell_playback[ priv->cur_cell + i ].block_mode
== BLOCK_MODE_LAST_CELL ) {
priv->next_cell = priv->cur_cell + i + 1;
break;
}
}
} else {
priv->next_cell = priv->cur_cell + 1;
}
/**
* We loop until we're out of this cell.
*/
for( priv->cur_pack = priv->cur_pgc->cell_playback[ priv->cur_cell ].first_sector;
priv->cur_pack < priv->cur_pgc->cell_playback[ priv->cur_cell ].last_sector; ) {
/**
* We loop until we're out of this cell.
*/
for( priv->cur_pack = priv->cur_pgc->cell_playback[ priv->cur_cell ].first_sector;
priv->cur_pack < priv->cur_pgc->cell_playback[ priv->cur_cell ].last_sector; ) {
dsi_t dsi_pack;
unsigned int next_vobu, next_ilvu_start, cur_output_size;
GstBuffer *buf;
unsigned char *data;
int len;
dsi_t dsi_pack;
unsigned int next_vobu, next_ilvu_start, cur_output_size;
GstBuffer *buf;
unsigned char *data;
int len;
/* create the buffer */
// FIXME: should eventually use a bufferpool for this
buf = gst_buffer_new ();
g_return_if_fail (buf);
/* create the buffer */
// FIXME: should eventually use a bufferpool for this
buf = gst_buffer_new ();
g_return_if_fail (buf);
/* allocate the space for the buffer data */
data = g_malloc (1024 * DVD_VIDEO_LB_LEN);
GST_BUFFER_DATA (buf) = data;
/* allocate the space for the buffer data */
data = g_malloc (1024 * DVD_VIDEO_LB_LEN);
GST_BUFFER_DATA (buf) = data;
g_return_if_fail (GST_BUFFER_DATA (buf) != NULL);
g_return_if_fail (GST_BUFFER_DATA (buf) != NULL);
/*
if (priv->new_seek) {
_seek(priv, priv->titleid, priv->chapid, priv->angle);
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
priv->new_seek = FALSE;
}
*/
/*
if (priv->new_seek) {
_seek(priv, priv->titleid, priv->chapid, priv->angle);
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
priv->new_seek = FALSE;
}
*/
/**
* Read NAV packet.
*/
len = DVDReadBlocks( priv->dvd_title, priv->cur_pack, 1, data );
if( len == 0 ) {
fprintf( stderr, "Read failed for block %d\n", priv->cur_pack );
_close(priv);
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
return;
}
assert( is_nav_pack( data ) );
/**
* Read NAV packet.
*/
len = DVDReadBlocks( priv->dvd_title, priv->cur_pack, 1, data );
if( len == 0 ) {
fprintf( stderr, "Read failed for block %d\n", priv->cur_pack );
_close(priv);
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
return;
}
assert( is_nav_pack( data ) );
/**
* Parse the contained dsi packet.
*/
navRead_DSI( &dsi_pack, &(data[ DSI_START_BYTE ]) );
assert( priv->cur_pack == dsi_pack.dsi_gi.nv_pck_lbn );
//navPrint_DSI(&dsi_pack);
/**
* Parse the contained dsi packet.
*/
navRead_DSI( &dsi_pack, &(data[ DSI_START_BYTE ]) );
assert( priv->cur_pack == dsi_pack.dsi_gi.nv_pck_lbn );
//navPrint_DSI(&dsi_pack);
/**
* Determine where we go next. These values are the ones we mostly
* care about.
*/
next_ilvu_start = priv->cur_pack
+ dsi_pack.sml_agli.data[ priv->angle ].address;
cur_output_size = dsi_pack.dsi_gi.vobu_ea;
/**
* Determine where we go next. These values are the ones we mostly
* care about.
*/
next_ilvu_start = priv->cur_pack
+ dsi_pack.sml_agli.data[ priv->angle ].address;
cur_output_size = dsi_pack.dsi_gi.vobu_ea;
/**
* If we're not at the end of this cell, we can determine the next
* VOBU to display using the VOBU_SRI information section of the
* DSI. Using this value correctly follows the current angle,
* avoiding the doubled scenes in The Matrix, and makes our life
* really happy.
*
* Otherwise, we set our next address past the end of this cell to
* force the code above to go to the next cell in the program.
*/
if( dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL ) {
next_vobu = priv->cur_pack
+ ( dsi_pack.vobu_sri.next_vobu & 0x7fffffff );
} else {
next_vobu = priv->cur_pack + cur_output_size + 1;
}
/**
* If we're not at the end of this cell, we can determine the next
* VOBU to display using the VOBU_SRI information section of the
* DSI. Using this value correctly follows the current angle,
* avoiding the doubled scenes in The Matrix, and makes our life
* really happy.
*
* Otherwise, we set our next address past the end of this cell to
* force the code above to go to the next cell in the program.
*/
if( dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL ) {
next_vobu = priv->cur_pack
+ ( dsi_pack.vobu_sri.next_vobu & 0x7fffffff );
} else {
next_vobu = priv->cur_pack + cur_output_size + 1;
}
assert( cur_output_size < 1024 );
priv->cur_pack++;
assert( cur_output_size < 1024 );
priv->cur_pack++;
/**
* Read in and output cursize packs.
*/
len = DVDReadBlocks( priv->dvd_title, priv->cur_pack,
cur_output_size, data );
if( len != cur_output_size ) {
fprintf( stderr, "Read failed for %d blocks at %d\n",
cur_output_size, priv->cur_pack );
_close(priv);
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
return;
}
/**
* Read in and output cursize packs.
*/
len = DVDReadBlocks( priv->dvd_title, priv->cur_pack,
cur_output_size, data );
if( len != cur_output_size ) {
fprintf( stderr, "Read failed for %d blocks at %d\n",
cur_output_size, priv->cur_pack );
_close(priv);
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
return;
}
GST_BUFFER_SIZE(buf) = cur_output_size * DVD_VIDEO_LB_LEN;
gst_pad_push(priv->srcpad, buf);
priv->cur_pack = next_vobu;
}
}
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element));
GST_BUFFER_SIZE(buf) = cur_output_size * DVD_VIDEO_LB_LEN;
gst_pad_push(priv->srcpad, buf);
priv->cur_pack = next_vobu;
}
}
}
#if 0

View file

@ -346,36 +346,35 @@ gst_siddec_loop (GstElement *element)
siddec = GST_SIDDEC (element);
do {
if (siddec->state == SID_STATE_NEED_TUNE) {
GstBuffer *buf = gst_pad_pull (siddec->sinkpad);
g_assert (buf != NULL);
if (siddec->state == SID_STATE_NEED_TUNE) {
GstBuffer *buf = gst_pad_pull (siddec->sinkpad);
g_assert (buf != NULL);
if (GST_IS_EVENT (buf)) {
switch (GST_EVENT_TYPE (buf)) {
case GST_EVENT_EOS:
siddec->state = SID_STATE_LOAD_TUNE;
break;
default:
// bail out, we're not going to do anything
gst_element_set_state (element, GST_STATE_PAUSED);
gst_pad_send_event (siddec->srcpad, gst_event_new (GST_EVENT_EOS));
break;
}
}
else {
memcpy (siddec->tune_buffer+siddec->tune_len, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
siddec->tune_len += GST_BUFFER_SIZE (buf);
gst_buffer_unref (buf);
if (GST_IS_EVENT (buf)) {
switch (GST_EVENT_TYPE (buf)) {
case GST_EVENT_EOS:
siddec->state = SID_STATE_LOAD_TUNE;
break;
default:
// bail out, we're not going to do anything
gst_element_set_state (element, GST_STATE_PAUSED);
gst_pad_send_event (siddec->srcpad, gst_event_new (GST_EVENT_EOS));
break;
}
}
if (siddec->state == SID_STATE_LOAD_TUNE) {
else {
memcpy (siddec->tune_buffer+siddec->tune_len, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
siddec->tune_len += GST_BUFFER_SIZE (buf);
if (siddec->tune->load (siddec->tune_buffer, siddec->tune_len)) {
if (sidEmuInitializeSong (*siddec->engine, *siddec->tune, siddec->tune_number)) {
gst_buffer_unref (buf);
}
}
if (siddec->state == SID_STATE_LOAD_TUNE) {
gst_pad_set_caps (siddec->srcpad,
if (siddec->tune->load (siddec->tune_buffer, siddec->tune_len)) {
if (sidEmuInitializeSong (*siddec->engine, *siddec->tune, siddec->tune_number)) {
gst_pad_set_caps (siddec->srcpad,
GST_CAPS_NEW (
"siddec_src",
"audio/raw",
@ -388,28 +387,27 @@ gst_siddec_loop (GstElement *element)
"rate", GST_PROPS_INT (siddec->config->frequency),
"channels", GST_PROPS_INT (siddec->config->channels)
));
siddec->state = SID_STATE_PLAY_TUNE;
}
else {
g_warning ("siddec: could not initialize song\n");
}
siddec->state = SID_STATE_PLAY_TUNE;
}
else {
g_warning ("siddec: could not load song\n");
g_warning ("siddec: could not initialize song\n");
}
}
if (siddec->state == SID_STATE_PLAY_TUNE) {
GstBuffer *out = gst_buffer_new ();
GST_BUFFER_SIZE (out) = 4096;
GST_BUFFER_DATA (out) = (guchar *)g_malloc (4096);
sidEmuFillBuffer (*siddec->engine, *siddec->tune,
GST_BUFFER_DATA (out), GST_BUFFER_SIZE (out));
gst_pad_push (siddec->srcpad, out);
else {
g_warning ("siddec: could not load song\n");
}
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element));
}
if (siddec->state == SID_STATE_PLAY_TUNE) {
GstBuffer *out = gst_buffer_new ();
GST_BUFFER_SIZE (out) = 4096;
GST_BUFFER_DATA (out) = (guchar *)g_malloc (4096);
sidEmuFillBuffer (*siddec->engine, *siddec->tune,
GST_BUFFER_DATA (out), GST_BUFFER_SIZE (out));
gst_pad_push (siddec->srcpad, out);
}
}
static void