Fixed some leftover fixes
Original commit message from CVS: Fixed some leftover fixes
This commit is contained in:
parent
44f23c67f9
commit
1aa3f4b65c
@ -423,133 +423,131 @@ dvdsrc_loop (GstElement *element)
|
|||||||
priv = dvdsrc->priv;
|
priv = dvdsrc->priv;
|
||||||
g_return_if_fail (GST_FLAG_IS_SET (dvdsrc, DVDSRC_OPEN));
|
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.
|
||||||
* Playback by cell in this pgc, starting at the cell for our chapter.
|
*/
|
||||||
*/
|
priv->next_cell = priv->start_cell;
|
||||||
priv->next_cell = priv->start_cell;
|
for( priv->cur_cell = priv->start_cell; priv->next_cell < priv->cur_pgc->nr_of_cells; ) {
|
||||||
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. */
|
/* Check if we're entering an angle block. */
|
||||||
if( priv->cur_pgc->cell_playback[ priv->cur_cell ].block_type
|
if( priv->cur_pgc->cell_playback[ priv->cur_cell ].block_type
|
||||||
== BLOCK_TYPE_ANGLE_BLOCK ) {
|
== BLOCK_TYPE_ANGLE_BLOCK ) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
priv->cur_cell += priv->angle;
|
priv->cur_cell += priv->angle;
|
||||||
for( i = 0;; ++i ) {
|
for( i = 0;; ++i ) {
|
||||||
if( priv->cur_pgc->cell_playback[ priv->cur_cell + i ].block_mode
|
if( priv->cur_pgc->cell_playback[ priv->cur_cell + i ].block_mode
|
||||||
== BLOCK_MODE_LAST_CELL ) {
|
== BLOCK_MODE_LAST_CELL ) {
|
||||||
priv->next_cell = priv->cur_cell + i + 1;
|
priv->next_cell = priv->cur_cell + i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
priv->next_cell = priv->cur_cell + 1;
|
priv->next_cell = priv->cur_cell + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We loop until we're out of this cell.
|
* We loop until we're out of this cell.
|
||||||
*/
|
*/
|
||||||
for( priv->cur_pack = priv->cur_pgc->cell_playback[ priv->cur_cell ].first_sector;
|
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; ) {
|
priv->cur_pack < priv->cur_pgc->cell_playback[ priv->cur_cell ].last_sector; ) {
|
||||||
|
|
||||||
dsi_t dsi_pack;
|
dsi_t dsi_pack;
|
||||||
unsigned int next_vobu, next_ilvu_start, cur_output_size;
|
unsigned int next_vobu, next_ilvu_start, cur_output_size;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* create the buffer */
|
/* create the buffer */
|
||||||
// FIXME: should eventually use a bufferpool for this
|
// FIXME: should eventually use a bufferpool for this
|
||||||
buf = gst_buffer_new ();
|
buf = gst_buffer_new ();
|
||||||
g_return_if_fail (buf);
|
g_return_if_fail (buf);
|
||||||
|
|
||||||
/* allocate the space for the buffer data */
|
/* allocate the space for the buffer data */
|
||||||
data = g_malloc (1024 * DVD_VIDEO_LB_LEN);
|
data = g_malloc (1024 * DVD_VIDEO_LB_LEN);
|
||||||
GST_BUFFER_DATA (buf) = data;
|
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) {
|
if (priv->new_seek) {
|
||||||
_seek(priv, priv->titleid, priv->chapid, priv->angle);
|
_seek(priv, priv->titleid, priv->chapid, priv->angle);
|
||||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
|
||||||
priv->new_seek = FALSE;
|
priv->new_seek = FALSE;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read NAV packet.
|
* Read NAV packet.
|
||||||
*/
|
*/
|
||||||
len = DVDReadBlocks( priv->dvd_title, priv->cur_pack, 1, data );
|
len = DVDReadBlocks( priv->dvd_title, priv->cur_pack, 1, data );
|
||||||
if( len == 0 ) {
|
if( len == 0 ) {
|
||||||
fprintf( stderr, "Read failed for block %d\n", priv->cur_pack );
|
fprintf( stderr, "Read failed for block %d\n", priv->cur_pack );
|
||||||
_close(priv);
|
_close(priv);
|
||||||
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
|
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert( is_nav_pack( data ) );
|
assert( is_nav_pack( data ) );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the contained dsi packet.
|
* Parse the contained dsi packet.
|
||||||
*/
|
*/
|
||||||
navRead_DSI( &dsi_pack, &(data[ DSI_START_BYTE ]) );
|
navRead_DSI( &dsi_pack, &(data[ DSI_START_BYTE ]) );
|
||||||
assert( priv->cur_pack == dsi_pack.dsi_gi.nv_pck_lbn );
|
assert( priv->cur_pack == dsi_pack.dsi_gi.nv_pck_lbn );
|
||||||
//navPrint_DSI(&dsi_pack);
|
//navPrint_DSI(&dsi_pack);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine where we go next. These values are the ones we mostly
|
* Determine where we go next. These values are the ones we mostly
|
||||||
* care about.
|
* care about.
|
||||||
*/
|
*/
|
||||||
next_ilvu_start = priv->cur_pack
|
next_ilvu_start = priv->cur_pack
|
||||||
+ dsi_pack.sml_agli.data[ priv->angle ].address;
|
+ dsi_pack.sml_agli.data[ priv->angle ].address;
|
||||||
cur_output_size = dsi_pack.dsi_gi.vobu_ea;
|
cur_output_size = dsi_pack.dsi_gi.vobu_ea;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we're not at the end of this cell, we can determine the next
|
* 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
|
* VOBU to display using the VOBU_SRI information section of the
|
||||||
* DSI. Using this value correctly follows the current angle,
|
* DSI. Using this value correctly follows the current angle,
|
||||||
* avoiding the doubled scenes in The Matrix, and makes our life
|
* avoiding the doubled scenes in The Matrix, and makes our life
|
||||||
* really happy.
|
* really happy.
|
||||||
*
|
*
|
||||||
* Otherwise, we set our next address past the end of this cell to
|
* 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.
|
* force the code above to go to the next cell in the program.
|
||||||
*/
|
*/
|
||||||
if( dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL ) {
|
if( dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL ) {
|
||||||
next_vobu = priv->cur_pack
|
next_vobu = priv->cur_pack
|
||||||
+ ( dsi_pack.vobu_sri.next_vobu & 0x7fffffff );
|
+ ( dsi_pack.vobu_sri.next_vobu & 0x7fffffff );
|
||||||
} else {
|
} else {
|
||||||
next_vobu = priv->cur_pack + cur_output_size + 1;
|
next_vobu = priv->cur_pack + cur_output_size + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert( cur_output_size < 1024 );
|
assert( cur_output_size < 1024 );
|
||||||
priv->cur_pack++;
|
priv->cur_pack++;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read in and output cursize packs.
|
* Read in and output cursize packs.
|
||||||
*/
|
*/
|
||||||
len = DVDReadBlocks( priv->dvd_title, priv->cur_pack,
|
len = DVDReadBlocks( priv->dvd_title, priv->cur_pack,
|
||||||
cur_output_size, data );
|
cur_output_size, data );
|
||||||
if( len != cur_output_size ) {
|
if( len != cur_output_size ) {
|
||||||
fprintf( stderr, "Read failed for %d blocks at %d\n",
|
fprintf( stderr, "Read failed for %d blocks at %d\n",
|
||||||
cur_output_size, priv->cur_pack );
|
cur_output_size, priv->cur_pack );
|
||||||
_close(priv);
|
_close(priv);
|
||||||
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
|
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_BUFFER_SIZE(buf) = cur_output_size * DVD_VIDEO_LB_LEN;
|
GST_BUFFER_SIZE(buf) = cur_output_size * DVD_VIDEO_LB_LEN;
|
||||||
gst_pad_push(priv->srcpad, buf);
|
gst_pad_push(priv->srcpad, buf);
|
||||||
priv->cur_pack = next_vobu;
|
priv->cur_pack = next_vobu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -346,36 +346,35 @@ gst_siddec_loop (GstElement *element)
|
|||||||
|
|
||||||
siddec = GST_SIDDEC (element);
|
siddec = GST_SIDDEC (element);
|
||||||
|
|
||||||
do {
|
if (siddec->state == SID_STATE_NEED_TUNE) {
|
||||||
if (siddec->state == SID_STATE_NEED_TUNE) {
|
GstBuffer *buf = gst_pad_pull (siddec->sinkpad);
|
||||||
GstBuffer *buf = gst_pad_pull (siddec->sinkpad);
|
g_assert (buf != NULL);
|
||||||
g_assert (buf != NULL);
|
|
||||||
|
|
||||||
if (GST_IS_EVENT (buf)) {
|
if (GST_IS_EVENT (buf)) {
|
||||||
switch (GST_EVENT_TYPE (buf)) {
|
switch (GST_EVENT_TYPE (buf)) {
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
siddec->state = SID_STATE_LOAD_TUNE;
|
siddec->state = SID_STATE_LOAD_TUNE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// bail out, we're not going to do anything
|
// bail out, we're not going to do anything
|
||||||
gst_element_set_state (element, GST_STATE_PAUSED);
|
gst_element_set_state (element, GST_STATE_PAUSED);
|
||||||
gst_pad_send_event (siddec->srcpad, gst_event_new (GST_EVENT_EOS));
|
gst_pad_send_event (siddec->srcpad, gst_event_new (GST_EVENT_EOS));
|
||||||
break;
|
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 (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)) {
|
gst_buffer_unref (buf);
|
||||||
if (sidEmuInitializeSong (*siddec->engine, *siddec->tune, siddec->tune_number)) {
|
}
|
||||||
|
}
|
||||||
|
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 (
|
GST_CAPS_NEW (
|
||||||
"siddec_src",
|
"siddec_src",
|
||||||
"audio/raw",
|
"audio/raw",
|
||||||
@ -388,28 +387,27 @@ gst_siddec_loop (GstElement *element)
|
|||||||
"rate", GST_PROPS_INT (siddec->config->frequency),
|
"rate", GST_PROPS_INT (siddec->config->frequency),
|
||||||
"channels", GST_PROPS_INT (siddec->config->channels)
|
"channels", GST_PROPS_INT (siddec->config->channels)
|
||||||
));
|
));
|
||||||
siddec->state = SID_STATE_PLAY_TUNE;
|
siddec->state = SID_STATE_PLAY_TUNE;
|
||||||
}
|
|
||||||
else {
|
|
||||||
g_warning ("siddec: could not initialize song\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g_warning ("siddec: could not load song\n");
|
g_warning ("siddec: could not initialize song\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (siddec->state == SID_STATE_PLAY_TUNE) {
|
else {
|
||||||
GstBuffer *out = gst_buffer_new ();
|
g_warning ("siddec: could not load song\n");
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
} 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
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user