From c20f6876baae32c2ef18999def0245bf0c23000a Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Tue, 12 Feb 2008 16:39:57 +0000 Subject: Avoid possible excess linkage in the tvtime plugin. Its convenience lib needs $(XINE_LIB) but it gets that when it's linked into the shared lib. --- src/post/deinterlace/plugins/Makefile.am | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/post/deinterlace/plugins/Makefile.am b/src/post/deinterlace/plugins/Makefile.am index 2bc8abd58..1ff139d29 100644 --- a/src/post/deinterlace/plugins/Makefile.am +++ b/src/post/deinterlace/plugins/Makefile.am @@ -48,7 +48,6 @@ libdeinterlaceplugins_la_SOURCES = \ scalerbob.c \ kdetv_greedyh.c \ kdetv_tomsmocomp.c -libdeinterlaceplugins_la_LIBADD = $(XINE_LIB) libdeinterlaceplugins_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) libdeinterlaceplugins_la_LDFLAGS = -avoid-version -module -- cgit v1.2.3 From 07a99628d88294244393abc463ae193e2e97f08b Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Thu, 14 Feb 2008 21:16:43 +0100 Subject: Fixed mp3 sniff code. Fixed bug 4 sample playback (nilbymouthclapton.112.mp3). (transplanted from 4843103240d4fc85d31bd210194a98c1e1bdbd7a) --HG-- extra : transplant_source : HC%102%40%D4%FC%85%D3%1B%D2%10%19J%98%C1%E1%BD%BDz --- src/demuxers/demux_mpgaudio.c | 59 +++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 82a7dd7ab..56759dd4b 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -626,11 +626,12 @@ static int parse_frame_payload(demux_mpgaudio_t *this, * 32-bit MP3 frame header. * return 1 if found, 0 if not found */ -static int sniff_buffer_looks_like_mp3 (uint8_t *buf, int buflen) +static int sniff_buffer_looks_like_mp3 (uint8_t *buf, int buflen, int *version, int *layer) { int offset; mpg_audio_frame_t frame; + *version = *layer = 0; if (buf == NULL) return 0; @@ -639,20 +640,21 @@ static int sniff_buffer_looks_like_mp3 (uint8_t *buf, int buflen) if (parse_frame_header(&frame, buf + offset)) { size_t size = frame.size; - /* Since one frame is available, is there another frame - * just to be sure this is more likely to be a real MP3 - * buffer? */ - offset += size; - - if (offset + 4 >= buflen) { - return 0; - } + if (size > 0) { + /* Since one frame is available, is there another frame + * just to be sure this is more likely to be a real MP3 + * buffer? */ + if (offset + size + 4 >= buflen) { + return 0; + } - if (parse_frame_header(&frame, buf + offset)) { - lprintf("mpeg audio frame detected\n"); - return 1; + if (parse_frame_header(&frame, buf + offset + size)) { + *version = frame.version_idx + 1; + *layer = frame.layer; + lprintf("frame detected, mpeg %d layer %d\n", *version, *layer); + return 1; + } } - break; } } return 0; @@ -806,11 +808,13 @@ static int demux_mpgaudio_read_head(input_plugin_t *input, uint8_t *buf) { * mp3 stream detection * return 1 if detected, 0 otherwise */ -static int detect_mpgaudio_file(input_plugin_t *input) { +static int detect_mpgaudio_file(input_plugin_t *input, + int *version, int *layer) { uint8_t buf[MAX_PREVIEW_SIZE]; int preview_len; uint32_t head; + *version = *layer = 0; preview_len = demux_mpgaudio_read_head(input, buf); if (preview_len < 4) return 0; @@ -837,7 +841,7 @@ static int detect_mpgaudio_file(input_plugin_t *input) { lprintf("cannot read mp3 frame header\n"); return 0; } - if (!sniff_buffer_looks_like_mp3(&buf[10 + tag_size], preview_len - 10 - tag_size)) { + if (!sniff_buffer_looks_like_mp3(&buf[10 + tag_size], preview_len - 10 - tag_size, version, layer)) { lprintf ("sniff_buffer_looks_like_mp3 failed\n"); return 0; } else { @@ -845,7 +849,7 @@ static int detect_mpgaudio_file(input_plugin_t *input) { } } else if (head == MPEG_MARKER) { return 0; - } else if (!sniff_buffer_looks_like_mp3(buf, preview_len)) { + } else if (!sniff_buffer_looks_like_mp3(buf, preview_len, version, layer)) { lprintf ("sniff_buffer_looks_like_mp3 failed\n"); return 0; } @@ -1112,13 +1116,15 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str input_plugin_t *input) { demux_mpgaudio_t *this; + int version = 0; + int layer = 0; lprintf("trying to open %s...\n", input->get_mrl(input)); switch (stream->content_detection_method) { case METHOD_BY_CONTENT: { - if (!detect_mpgaudio_file(input)) + if (!detect_mpgaudio_file(input, &version, &layer)) return NULL; } break; @@ -1141,7 +1147,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str default: return NULL; } - + this = xine_xmalloc (sizeof (demux_mpgaudio_t)); this->demux_plugin.send_headers = demux_mpgaudio_send_headers; @@ -1153,12 +1159,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.get_capabilities = demux_mpgaudio_get_capabilities; this->demux_plugin.get_optional_data = demux_mpgaudio_get_optional_data; this->demux_plugin.demux_class = class_gen; - - this->input = input; - this->audio_fifo = stream->audio_fifo; - this->status = DEMUX_FINISHED; - this->stream = stream; - + + this->input = input; + this->audio_fifo = stream->audio_fifo; + this->status = DEMUX_FINISHED; + this->stream = stream; + + this->mpg_version = version; + this->mpg_layer = layer; + if (version || layer) { + this->valid_frames = NUM_VALID_FRAMES; + } return &this->demux_plugin; } -- cgit v1.2.3 From b0c97c912f4ee5bc34692d7d737979b390ac621b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 25 Jan 2008 23:02:29 +0100 Subject: Advertise audio/x-wavpack mime type for WavPack demuxer. --HG-- extra : transplant_source : iT%08m0%F6%E0%8B-%24%1F%BC%EB%24%25.%C0p%E2%14 --- src/combined/demux_wavpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index e8081bca9..a79f70627 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -391,7 +391,7 @@ static const char *get_extensions (demux_class_t *const this_gen) { } static const char *get_mimetypes (demux_class_t *const this_gen) { - return NULL; + return "audio/x-wavpack"; } static void class_dispose (demux_class_t *const this_gen) { -- cgit v1.2.3 From a53d75fb7fd3bbe4bc619658fe9ed7ed1b4f2879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 15 Feb 2008 13:21:09 +0100 Subject: Don't unlock unconditionally the mainloop on failure. --- src/audio_out/audio_pulse_out.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 26d121bf6..2811bbdbc 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -246,7 +246,7 @@ static int ao_pulse_open(ao_driver_t *this_gen, pa_threaded_mainloop_lock(this->pa_class->mainloop); ret = pa_context_connect(this->pa_class->context, this->host, 1, NULL); if ( ret < 0 ) - goto fail; + goto fail_unlock; pa_context_set_state_callback(this->pa_class->context, __xine_pa_context_status_callback, this); @@ -289,8 +289,9 @@ static int ao_pulse_open(ao_driver_t *this_gen, return this->sample_rate; -fail: + fail_unlock: pa_threaded_mainloop_unlock(this->pa_class->mainloop); + fail: this_gen->close(this_gen); return 0; } -- cgit v1.2.3 From ac63f46f26fa2bc9a0be9feacae52d55249685be Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Fri, 15 Feb 2008 09:33:51 +0100 Subject: Fixed endianess problem. This should allow big ID3v2 tag to be parsed (i mean tags with embedded pictures). (transplanted from ebb0d5507d3208f8e73af78f912230719d37830a) --HG-- extra : transplant_source : %EB%B0%D5P%7D2%08%F8%E7%3A%F7%8F%91%220q%9D7%83%0A --- src/demuxers/demux_mpgaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 56759dd4b..648f04410 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -725,8 +725,8 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s /* the stream is broken, don't keep info about previous frames */ this->free_bitrate_size = 0; - if ( id3v2_istag(header) ) { - if (!id3v2_parse_tag(this->input, this->stream, header)) { + if ( id3v2_istag(_X_ME_32(header)) ) { + if (!id3v2_parse_tag(this->input, this->stream, _X_ME_32(header))) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2 tag parsing error\n"); bytes = 1; /* resync */ -- cgit v1.2.3 From b69b862d5d47f3c17cee1dbbbe4743d51bbc9d3c Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Sat, 16 Feb 2008 00:12:08 +0100 Subject: Take in account the size of the extended header. --HG-- extra : transplant_source : %C0%D71D1%8CQ%889P%21%20%D7%F7%B5%F2T%FE%88%FA --- src/demuxers/id3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index cd72646ef..85b42efa8 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -559,6 +559,7 @@ int id3v23_parse_tag(input_plugin_t *input, if (!id3v23_parse_frame_ext_header(input, &tag_frame_ext_header)) { return 0; } + pos += tag_frame_ext_header.size; } /* frame parsing */ while ((pos + ID3V23_FRAME_HEADER_SIZE) <= tag_header.size) { @@ -579,7 +580,8 @@ int id3v23_parse_tag(input_plugin_t *input, pos += tag_frame_header.size; } else { /* end of frames, the rest is padding */ - input->seek (input, tag_header.size - pos, SEEK_CUR); + lprintf("skipping padding %d bytes\n", tag_header.size - pos); + input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; } } else { @@ -809,6 +811,7 @@ int id3v24_parse_tag(input_plugin_t *input, if (!id3v24_parse_ext_header(input, &tag_frame_ext_header)) { return 0; } + pos += tag_frame_ext_header.size; } /* frame parsing */ while ((pos + ID3V24_FRAME_HEADER_SIZE) <= tag_header.size) { -- cgit v1.2.3 From a03ad73663dc3342f3f6d2a084b55cb05229054d Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 17 Feb 2008 19:18:35 -0300 Subject: nvidia driver uses XV_SYNC_TO_VBLANK attribute, not XV_DOUBLE_BUFFER as xine expected. add code to set this attribute from xine and mention nvidia-settings, since the user may need to select a sync device as well. --- src/video_out/video_out_xcbxv.c | 33 +++++++++++++++++++++++++++++++++ src/video_out/video_out_xv.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) (limited to 'src') diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 18ab5c6fb..f83512bd0 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -1247,6 +1247,27 @@ static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) "video_out_xcbxv: double buffering mode = %d\n", xv_double_buffer); } +static void xv_update_XV_SYNC_TO_VBLANK(void *this_gen, xine_cfg_entry_t *entry) { + xv_driver_t *this = (xv_driver_t *) this_gen; + int xv_sync_to_vblank; + + xcb_intern_atom_cookie_t atom_cookie; + xcb_intern_atom_reply_t *atom_reply; + + xv_sync_to_vblank = entry->num_value; + + pthread_mutex_lock(&this->main_mutex); + atom_cookie = xcb_intern_atom(this->connection, 0, sizeof("XV_SYNC_TO_VBLANK"), "XV_SYNC_TO_VBLANK"); + atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); + xcb_xv_set_port_attribute(this->connection, this->xv_port, atom_reply->atom, xv_sync_to_vblank); + free(atom_reply); + pthread_mutex_unlock(&this->main_mutex); + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xcbxv: sync to vblank = %d\n", xv_sync_to_vblank); +} + + static void xv_update_xv_pitch_alignment(void *this_gen, xine_cfg_entry_t *entry) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -1480,6 +1501,18 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis "flickering and tearing artifacts, but will use more graphics memory."), 20, xv_update_XV_DOUBLE_BUFFER, this); config->update_num(config,"video.device.xv_double_buffer",xv_double_buffer); + } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_SYNC_TO_VBLANK")) { + int xv_sync_to_vblank; + xv_sync_to_vblank = + config->register_bool (config, "video.device.xv_sync_to_vblank", 1, + _("enable vblank sync"), + _("This option will synchronize the update of the video image to the " + "repainting of the entire screen (\"vertical retrace\"). This eliminates " + "flickering and tearing artifacts. On nvidia cards one may also " + "need to run \"nvidia-settings\" and choose which display device to " + "sync to under the XVideo Settings tab"), + 20, xv_update_XV_SYNC_TO_VBLANK, this); + config->update_num(config,"video.device.xv_sync_to_vblank",xv_sync_to_vblank); } } } diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 3bb0a93dc..f6bd1a429 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -1299,6 +1299,22 @@ static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) "video_out_xv: double buffering mode = %d\n", xv_double_buffer); } +static void xv_update_XV_SYNC_TO_VBLANK(void *this_gen, xine_cfg_entry_t *entry) { + xv_driver_t *this = (xv_driver_t *) this_gen; + Atom atom; + int xv_sync_to_vblank; + + xv_sync_to_vblank = entry->num_value; + + LOCK_DISPLAY(this); + atom = XInternAtom (this->display, "XV_SYNC_TO_VBLANK", False); + XvSetPortAttribute (this->display, this->xv_port, atom, xv_sync_to_vblank); + UNLOCK_DISPLAY(this); + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xv: sync to vblank = %d\n", xv_sync_to_vblank); +} + static void xv_update_xv_pitch_alignment(void *this_gen, xine_cfg_entry_t *entry) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -1538,6 +1554,18 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * "flickering and tearing artifacts, but will use more graphics memory."), 20, xv_update_XV_DOUBLE_BUFFER, this); config->update_num(config,"video.device.xv_double_buffer",xv_double_buffer); + } else if(!strcmp(attr[k].name, "XV_SYNC_TO_VBLANK")) { + int xv_sync_to_vblank; + xv_sync_to_vblank = + config->register_bool (config, "video.device.xv_sync_to_vblank", 1, + _("enable vblank sync"), + _("This option will synchronize the update of the video image to the " + "repainting of the entire screen (\"vertical retrace\"). This eliminates " + "flickering and tearing artifacts. On nvidia cards one may also " + "need to run \"nvidia-settings\" and choose which display device to " + "sync to under the XVideo Settings tab"), + 20, xv_update_XV_SYNC_TO_VBLANK, this); + config->update_num(config,"video.device.xv_sync_to_vblank",xv_sync_to_vblank); } } } -- cgit v1.2.3 From 0ac9aca92944c9a3243dabace9a928916010dd55 Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Mon, 18 Feb 2008 22:01:32 +0100 Subject: Backed out changeset 698d30889b29 id3v2_istag has not the same signature in 1.1 and 1.2. --- src/demuxers/demux_mpgaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 648f04410..56759dd4b 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -725,8 +725,8 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s /* the stream is broken, don't keep info about previous frames */ this->free_bitrate_size = 0; - if ( id3v2_istag(_X_ME_32(header)) ) { - if (!id3v2_parse_tag(this->input, this->stream, _X_ME_32(header))) { + if ( id3v2_istag(header) ) { + if (!id3v2_parse_tag(this->input, this->stream, header)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2 tag parsing error\n"); bytes = 1; /* resync */ -- cgit v1.2.3 From dfaac7bec1f45bbabb8e5cfbe1001dee13829496 Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Mon, 18 Feb 2008 23:51:40 +0100 Subject: Timecode diff is signed. Should fix bug 35. --HG-- extra : transplant_source : %DD%95%9F%A7%8D%01%BD%98%40%E4R%AAW%F2%ED%93%B2%DE%1A%E9 --- src/demuxers/demux_matroska.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 3c992ecca..63b6ea3c8 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1832,6 +1832,15 @@ static int read_block_data (demux_matroska_t *this, int len) { return 1; } +static int parse_int16(uint8_t *data) { + int value = (int)_X_BE_16(data); + if (value & 1<<15) + { + value -= 1<<16; + } + return value; +} + static int parse_block (demux_matroska_t *this, uint64_t block_size, uint64_t cluster_timecode, uint64_t block_duration, int normpos, int is_key) { @@ -1848,8 +1857,9 @@ static int parse_block (demux_matroska_t *this, uint64_t block_size, if (!(num_len = parse_ebml_uint(this, data, &track_num))) return 0; data += num_len; - - timecode_diff = (int)_X_BE_16(data); + + /* timecode_diff is signed */ + timecode_diff = parse_int16(data); data += 2; flags = *data; -- cgit v1.2.3 From a2f6c4214b7f7efecd0bfddcedfdf9a413d842f8 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 20 Feb 2008 23:19:15 +0000 Subject: Off-by-one in the FLAC security fix, breaking playback of some files. --- src/demuxers/demux_flac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index e5d1297a2..f6544bb67 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -202,7 +202,7 @@ static int open_flac_file(demux_flac_t *flac) { length = _X_LE_32(ptr); ptr += 4 + length; - if (length >= block_length - 8) + if (length > block_length - 8) return 0; /* bad length or too little left in the buffer */ user_comment_list_length = _X_LE_32(ptr); -- cgit v1.2.3