From c435302dda136ead359f618ff61e4bd7af014403 Mon Sep 17 00:00:00 2001 From: Jose Alberto Reguero Date: Fri, 9 Apr 2010 21:58:01 +0200 Subject: Add eac3 support to demux_ts --- src/demuxers/demux_ts.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index b55877c83..1afa2d323 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -804,7 +804,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; @@ -1429,9 +1435,9 @@ 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; @@ -1441,8 +1447,12 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num #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); + 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; -- cgit v1.2.3 From d5199bac5da727023cab4bbcd7e850643b8d0c83 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 9 Apr 2010 22:09:21 +0100 Subject: Minor indentation cleanup. --- src/demuxers/demux_ts.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 1afa2d323..86e216304 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1441,26 +1441,26 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num 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 - 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; + 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 */ @@ -1473,7 +1473,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 */ -- cgit v1.2.3 From 0db9edf88fd4ebce5581c7bb22402dc312bffc69 Mon Sep 17 00:00:00 2001 From: Frank Enderle Date: Sun, 11 Apr 2010 15:57:38 +0100 Subject: Fix a flaw on recovering from ALSA-reported errors in ao_alsa_delay() I noticed some alsa dropouts (losing audio) while hunting a bug which has been related to a broken streaming server. This resulted in buffers running empty and therefore showed some issues in the ALSA driver not correctly applying some recovery procedures provided by ALSA itself (snd_pcm_recover() and friends). --- src/audio_out/audio_alsa_out.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index b18637a7b..3d5393f63 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; -- cgit v1.2.3 From 2bdbfec226e39c0875f9771ffb6a33732f9ed7af Mon Sep 17 00:00:00 2001 From: Kelvie Wong Date: Wed, 16 Dec 2009 00:27:52 -0800 Subject: TTA demux: use _x_demux_send_data To reduce code duplication. --- src/demuxers/demux_tta.c | 44 +++++++++++--------------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 10229ed64..57d2c8357 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -122,39 +122,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++; -- cgit v1.2.3 From 289b5e385d114d002654ee3188bcfb43deb26aee Mon Sep 17 00:00:00 2001 From: Frank Enderle Date: Sun, 11 Apr 2010 13:03:25 +0200 Subject: Report NBC buffer stats to the application using new event XINE_EVENT_NBC_STATS This event reports the buffer status for network streams (NBC) back to the application, providing a way to measure if the stream delivers data fast enough. This enables the application to slow down the stream playback to get the buffers filling more quickly. (This is only a sample application of the event.) The event reports all vital data like fill percentage, remaining buffer in seconds and discontinuity, separately for audio and video, whether the nbc layer is actually buffering, the operation type (put or get) and also if the buffering is enabled at all. In essence, it's the output you get from nbc if you run xine-lib in verbose mode on the console, but in raw data. --- src/input/net_buf_ctrl.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index e8af1ae3f..ba17423fb 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; @@ -138,6 +137,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 @@ -347,6 +369,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 { @@ -466,6 +490,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 */ -- cgit v1.2.3 From ece1767d8d45fce77eb82a09b34c196079af5955 Mon Sep 17 00:00:00 2001 From: Shixin Zeng Date: Mon, 12 Apr 2010 13:20:37 +0100 Subject: C89 fix --- src/xine-utils/xmlparser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c index add985512..6e29ed421 100644 --- a/src/xine-utils/xmlparser.c +++ b/src/xine-utils/xmlparser.c @@ -618,13 +618,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) { -- cgit v1.2.3 From de76f40172acb5a3e843612e90dd87b5a32037c6 Mon Sep 17 00:00:00 2001 From: Ulrich Eckhardt Date: Sun, 21 Feb 2010 20:12:01 +0100 Subject: Typo fix --- src/input/input_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/input_file.c b/src/input/input_file.c index b0da2565d..4a1937390 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; -- cgit v1.2.3 From c8699f1bcc7854036071a06e923333d30dd07ed1 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 29 Apr 2010 17:49:31 +0100 Subject: Minor C99ism. --- src/demuxers/demux_flac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index 11bbda061..672eafdbb 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -352,6 +352,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; @@ -365,7 +366,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; -- cgit v1.2.3 From 0c0dacd8b10892c2ed3b7aa6f3be617d3cec4911 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Thu, 29 Apr 2010 02:22:25 +0300 Subject: add /usr/lib64/codecs as real binary codec location Mplayer now only supports single location for all binary codecs, and therefore on Mandriva packaging /usr/lib(64)/codecs was selected as the directory where mplayer will try to load them from. The 64-bit variant is missing from xine-lib (/usr/lib/codecs is there). Attached patch adds it. --- src/libreal/real_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 6eedb009a..10e4b61b9 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" }, -- cgit v1.2.3 From 45183af9feca481f03d2c2df811f39799e212df3 Mon Sep 17 00:00:00 2001 From: Shixin Zeng Date: Tue, 20 Apr 2010 10:19:37 +0100 Subject: remove the unneeded unistd.h and fix compatibility for msvc --- src/xine-utils/xmlparser.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c index 6e29ed421..e32d38460 100644 --- a/src/xine-utils/xmlparser.c +++ b/src/xine-utils/xmlparser.c @@ -22,14 +22,17 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - -#include #include #include #include #include #include +#ifdef _MSC_VER +#define snprintf sprintf_s +#define strcasecmp stricmp +#endif + #define LOG_MODULE "xmlparser" #define LOG_VERBOSE /* -- cgit v1.2.3 From ee88b6b53e875ed25073afa5ef77ef2b7f09707f Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Sat, 30 Jan 2010 11:00:22 +0200 Subject: BluRay subtitles in matroska --- src/demuxers/demux_matroska.c | 15 +++++++++++++++ src/demuxers/matroska.h | 1 + 2 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index dd1f15fa6..ea1c84eea 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, @@ -1429,6 +1440,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"); } diff --git a/src/demuxers/matroska.h b/src/demuxers/matroska.h index 3cafc6441..53fee5358 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 -- cgit v1.2.3 From dc5f21667ff8329464c76a9bdbf016d309a712f6 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 22 May 2010 01:59:07 +0100 Subject: Recognise and handle the WebM container format. Currently, just treat it exactly as if it were Matroska. --- src/demuxers/demux_matroska.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index ea1c84eea..edce2039d 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -2992,7 +2992,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); @@ -3016,7 +3017,7 @@ error: */ static const char *get_description (demux_class_t *this_gen) { - return "matroska demux plugin"; + return "matroska & webm demux plugin"; } @@ -3026,13 +3027,14 @@ static const char *get_identifier (demux_class_t *this_gen) { static const char *get_extensions (demux_class_t *this_gen) { - return "mkv"; + return "mkv wbm webm"; } static const char *get_mimetypes (demux_class_t *this_gen) { return "video/mkv: mkv: matroska;" - "video/x-matroska: mkv: matroska;"; + "video/x-matroska: mkv: matroska;" + "video/webm: wbm,webm: WebM;"; } -- cgit v1.2.3