diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/audio_out/audio_alsa_out.c | 28 | ||||
-rw-r--r-- | src/demuxers/demux_flac.c | 3 | ||||
-rw-r--r-- | src/demuxers/demux_matroska.c | 26 | ||||
-rw-r--r-- | src/demuxers/demux_ts.c | 44 | ||||
-rw-r--r-- | src/demuxers/demux_tta.c | 44 | ||||
-rw-r--r-- | src/demuxers/matroska.h | 1 | ||||
-rw-r--r-- | src/input/input_file.c | 2 | ||||
-rw-r--r-- | src/input/net_buf_ctrl.c | 28 | ||||
-rw-r--r-- | src/libreal/real_common.c | 2 | ||||
-rw-r--r-- | src/xine-utils/xmlparser.c | 8 |
10 files changed, 127 insertions, 59 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 8bc0c241d..3e3564a3b 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -668,6 +668,34 @@ static int ao_alsa_delay (ao_driver_t *this_gen) { printf("audio_alsa_out:delay:FINISHED\n"); #endif + /* + * try to recover from errors and recalculate delay + */ + if(err) { +#ifdef LOG_DEBUG + printf("gap audio_alsa_out:delay: recovery\n"); +#endif + err = snd_pcm_recover( this->audio_fd, err, 1 ); + err = snd_pcm_delay( this->audio_fd, &delay ); + } + + /* + * if we have a negative delay try to forward within the buffer + */ + if(!err && (delay < 0)) { +#ifdef LOG_DEBUG + printf("gap audio_alsa_out:delay: forwarding frames: %d\n", (int)-delay); +#endif + err = snd_pcm_forward( this->audio_fd, -delay ); + if(err >= 0) { + err = snd_pcm_delay( this->audio_fd, &delay ); + } + } + + /* + * on error or (still) negative delays ensure delay + * is not negative + */ if (err || (delay < 0)) delay = 0; diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index ffb49e74e..2135f8d60 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -351,6 +351,7 @@ static void demux_flac_send_headers(demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; buf_element_t *buf; xine_waveformatex wave; + int bits; this->audio_fifo = this->stream->audio_fifo; @@ -364,7 +365,7 @@ static void demux_flac_send_headers(demux_plugin_t *this_gen) { } /* lie about 24bps */ - int bits = this->bits_per_sample > 16 ? 16 : this->bits_per_sample; + bits = this->bits_per_sample > 16 ? 16 : this->bits_per_sample; buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_FLAC; diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 032917ad9..9deaca161 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -810,6 +810,17 @@ static void init_codec_vobsub(demux_matroska_t *this, } } +static void init_codec_spu(demux_matroska_t *this, matroska_track_t *track) { + buf_element_t *buf; + + buf = track->fifo->buffer_pool_alloc (track->fifo); + + buf->size = 0; + buf->type = track->buf_type; + + track->fifo->put (track->fifo, buf); +} + static void handle_realvideo (demux_plugin_t *this_gen, matroska_track_t *track, int decoder_flags, uint8_t *data, size_t data_len, @@ -1433,6 +1444,10 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { if (track->compress_algo == MATROSKA_COMPRESS_NONE) { track->compress_algo = MATROSKA_COMPRESS_UNKNOWN; } + } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_S_HDMV_PGS)) { + lprintf("MATROSKA_CODEC_ID_S_HDMV_PGS\n"); + track->buf_type = BUF_SPU_HDMV; + init_codec = init_codec_spu; } else { lprintf("unknown codec\n"); } @@ -2956,7 +2971,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str goto error; if (ebml->max_size_len > 8) goto error; - if (strcmp(ebml->doctype, "matroska")) + /* handle both Matroska and WebM here; we don't (presently) differentiate */ + if (strcmp(ebml->doctype, "matroska") && strcmp(ebml->doctype, "webm")) goto error; this->event_queue = xine_event_new_queue(this->stream); @@ -2986,11 +3002,13 @@ static void *init_class (xine_t *xine, void *data) { this->xine = xine; this->demux_class.open_plugin = open_plugin; - this->demux_class.description = N_("matroska demux plugin"); + this->demux_class.description = N_("matroska & webm demux plugin"); this->demux_class.identifier = "matroska"; this->demux_class.mimetypes = "video/mkv: mkv: matroska;" - "video/x-matroska: mkv: matroska;"; - this->demux_class.extensions = "mkv"; + "video/x-matroska: mkv: matroska;" + "video/webm: wbm,webm: WebM;"; + + this->demux_class.extensions = "mkv wbm webm"; this->demux_class.dispose = default_demux_class_dispose; return this; diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 39b273abf..b038e52ef 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -790,7 +790,13 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, * these "raw" streams may begin with a byte that looks like a stream type. * For audio streams, m->type already contains the stream no. */ - if((m->descriptor_tag == STREAM_AUDIO_AC3) || /* ac3 - raw */ + if(m->descriptor_tag == HDMV_AUDIO_84_EAC3) { + m->content = p; + m->size = packet_len; + m->type |= BUF_AUDIO_EAC3; + return 1; + + } else if((m->descriptor_tag == STREAM_AUDIO_AC3) || /* ac3 - raw */ (p[0] == 0x0B && p[1] == 0x77)) { /* ac3 - syncword */ m->content = p; m->size = packet_len; @@ -1415,28 +1421,32 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num break; case ISO_13818_PES_PRIVATE: for (i = 5; i < coded_length; i += stream[i+1] + 2) { - if ((stream[i] == 0x6a) && (this->audio_tracks_count < MAX_AUDIO_TRACKS)) { - int i, found = 0; - for(i = 0; i < this->audio_tracks_count; i++) { + if (((stream[i] == 0x6a) || (stream[i] == 0x7a)) && (this->audio_tracks_count < MAX_AUDIO_TRACKS)) { + int j, found = 0; + for(j = 0; j < this->audio_tracks_count; j++) { if(this->audio_tracks[i].pid == pid) { found = 1; break; - } + } } - if(!found) { + if (!found) { #ifdef TS_PMT_LOG printf ("demux_ts: PMT AC3 audio pid 0x%.4x type %2.2x\n", pid, stream[0]); #endif - demux_ts_pes_new(this, this->media_num, pid, - this->audio_fifo, STREAM_AUDIO_AC3); - - this->audio_tracks[this->audio_tracks_count].pid = pid; - this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; - this->media[this->media_num].type = this->audio_tracks_count; - demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang, - stream + 5, stream_info_length); - this->audio_tracks_count++; - break; + if (stream[i] == 0x6a) + demux_ts_pes_new(this, this->media_num, pid, + this->audio_fifo, STREAM_AUDIO_AC3); + else + demux_ts_pes_new(this, this->media_num, pid, + this->audio_fifo, HDMV_AUDIO_84_EAC3); + + this->audio_tracks[this->audio_tracks_count].pid = pid; + this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; + this->media[this->media_num].type = this->audio_tracks_count; + demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang, + stream + 5, stream_info_length); + this->audio_tracks_count++; + break; } } /* Teletext */ @@ -1449,7 +1459,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num printf ("%.2x ", stream[i]); printf ("\n"); #endif - break; + break; } /* DVBSUB */ diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 3df30daef..1cd9d55de 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -121,39 +121,17 @@ static int demux_tta_send_chunk(demux_plugin_t *this_gen) { 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 = (int64_t)(FRAME_TIME * this->currentframe * 90000); - 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, + (int64_t)(FRAME_TIME * this->currentframe * 90000), + 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++; diff --git a/src/demuxers/matroska.h b/src/demuxers/matroska.h index 6109ad278..23e115edc 100644 --- a/src/demuxers/matroska.h +++ b/src/demuxers/matroska.h @@ -340,6 +340,7 @@ struct matroska_track_s { #define MATROSKA_CODEC_ID_S_SSA "S_SSA" /* deprecated */ #define MATROSKA_CODEC_ID_S_ASS "S_ASS" /* deprecated */ #define MATROSKA_CODEC_ID_S_VOBSUB "S_VOBSUB" +#define MATROSKA_CODEC_ID_S_HDMV_PGS "S_HDMV/PGS" /* block lacing */ #define MATROSKA_NO_LACING 0x0 diff --git a/src/input/input_file.c b/src/input/input_file.c index 2fcd87d73..ee8957894 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -292,7 +292,7 @@ static uint32_t file_plugin_get_blocksize (input_plugin_t *this_gen) { } /* - * Return 1 is filepathname is a directory, otherwise 0 + * Return 1 if filepathname is a directory, otherwise 0 */ static int is_a_dir(char *filepathname) { struct stat pstat; diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index c0345f652..d777a0cc9 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -96,7 +96,6 @@ static void report_progress (xine_stream_t *stream, int p) { xine_event_send (stream, &event); } - static void nbc_set_speed_pause (nbc_t *this) { xine_stream_t *stream = this->stream; @@ -134,6 +133,29 @@ static void display_stats (nbc_t *this) { fflush(stdout); } +static void report_stats (nbc_t *this, int type) { + xine_event_t event; + xine_nbc_stats_data_t bs; + + bs.v_percent = this->video_fifo_fill; + bs.v_remaining = this->video_fifo_length; + bs.v_bitrate = this->video_br; + bs.v_in_disc = this->video_in_disc; + bs.a_percent = this->audio_fifo_fill; + bs.a_remaining = this->audio_fifo_length; + bs.a_bitrate = this->audio_br; + bs.a_in_disc = this->audio_in_disc; + bs.buffering = this->buffering; + bs.enabled = this->enabled; + bs.type = type; + + event.type = XINE_EVENT_NBC_STATS; + event.data = &bs; + event.data_length = sizeof (xine_nbc_stats_data_t); + + xine_event_send (this->stream, &event); +} + /* Try to compute the length of the fifo in 1/1000 s * 2 methods : * if the bitrate is known @@ -343,6 +365,8 @@ static void nbc_put_cb (fifo_buffer_t *fifo, } if(this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) display_stats(this); + + report_stats(this, 0); } } else { @@ -462,6 +486,8 @@ static void nbc_get_cb (fifo_buffer_t *fifo, if(this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) display_stats(this); + + report_stats(this, 1); } } else { /* discontinuity management */ diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 8f2fcab6b..61c620559 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -94,7 +94,7 @@ void _x_real_codecs_init(xine_t *const xine) { const char *path; } paths[] = { { O | UL, "win32" }, - { O | UL, "codecs" }, + { O | UL | UL64, "codecs" }, { O | UL | UL64, "real" }, { O, "real/RealPlayer/codecs" }, { OL | OL64 | UL | UL64, "RealPlayer10GOLD/codecs" }, diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c index 9d29ca8e8..320733ebf 100644 --- a/src/xine-utils/xmlparser.c +++ b/src/xine-utils/xmlparser.c @@ -34,6 +34,11 @@ #include <stdarg.h> #include <ctype.h> +#ifdef _MSC_VER +#define snprintf sprintf_s +#define strcasecmp stricmp +#endif + #define LOG_MODULE "xmlparser" #define LOG_VERBOSE /* @@ -831,13 +836,14 @@ char *xml_escape_string (const char *s, xml_escape_quote_t quote_type) } static void xml_parser_dump_node (const xml_node_t *node, int indent) { + size_t l; xml_property_t *p; xml_node_t *n; printf ("%*s<%s ", indent, "", node->name); - size_t l = strlen (node->name); + l = strlen (node->name); p = node->props; while (p) { |