diff options
Diffstat (limited to 'src/combined')
-rw-r--r-- | src/combined/Makefile.am | 2 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_audio_decoder.c | 82 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_mpeg_parser.c | 32 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_mpeg_parser.h | 2 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_video_decoder.c | 286 | ||||
-rw-r--r-- | src/combined/ffmpeg/ffmpeg_decoder.c | 10 | ||||
-rw-r--r-- | src/combined/ffmpeg/ffmpeg_decoder.h | 10 | ||||
-rw-r--r-- | src/combined/flac_decoder.c | 76 | ||||
-rw-r--r-- | src/combined/flac_demuxer.c | 98 | ||||
-rw-r--r-- | src/combined/nsf_combined.c | 2 | ||||
-rw-r--r-- | src/combined/nsf_decoder.c | 2 | ||||
-rw-r--r-- | src/combined/nsf_demuxer.c | 4 | ||||
-rw-r--r-- | src/combined/wavpack_combined.c | 2 | ||||
-rw-r--r-- | src/combined/wavpack_decoder.c | 18 | ||||
-rw-r--r-- | src/combined/wavpack_demuxer.c | 14 | ||||
-rw-r--r-- | src/combined/xine_ogg_demuxer.c | 70 | ||||
-rw-r--r-- | src/combined/xine_speex_decoder.c | 42 | ||||
-rw-r--r-- | src/combined/xine_theora_decoder.c | 32 | ||||
-rw-r--r-- | src/combined/xine_vorbis_decoder.c | 96 |
19 files changed, 440 insertions, 440 deletions
diff --git a/src/combined/Makefile.am b/src/combined/Makefile.am index 3b133c412..233009105 100644 --- a/src/combined/Makefile.am +++ b/src/combined/Makefile.am @@ -42,7 +42,7 @@ xineplug_nsf_la_CPPFLAGS = $(AM_CPPFLAGS) -DNSF_PLAYER -I$(top_srcdir)/contrib/n xineplug_xiph_la_SOURCES = xine_ogg_demuxer.c xineplug_xiph_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) -xineplug_xiph_la_CFLAGS = $(AM_CFLAGS) +xineplug_xiph_la_CFLAGS = $(AM_CFLAGS) xineplug_xiph_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/demuxers if ENABLE_VORBIS diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c index bae0f92a4..f58fcfb46 100644 --- a/src/combined/ffmpeg/ff_audio_decoder.c +++ b/src/combined/ffmpeg/ff_audio_decoder.c @@ -1,25 +1,25 @@ /* * Copyright (C) 2001-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * xine audio decoder plugin using ffmpeg */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -65,7 +65,7 @@ typedef struct ff_audio_decoder_s { AVCodecContext *context; AVCodec *codec; - + char *decode_buffer; int decoder_ok; @@ -78,7 +78,7 @@ typedef struct ff_audio_decoder_s { if (size > this->bufsize) { this->bufsize = size + size / 2; xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("ffmpeg_audio_dec: increasing buffer to %d to avoid overflow.\n"), + _("ffmpeg_audio_dec: increasing buffer to %d to avoid overflow.\n"), this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } @@ -101,15 +101,15 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) ff_audio_ensure_buffer_size(this, this->size + buf->size); memcpy(this->buf + this->size, buf->content, buf->size); this->size += buf->size; - + if (buf->decoder_flags & BUF_FLAG_FRAME_END) { size_t i; unsigned int codec_type; xine_waveformatex *audio_header; - + codec_type = buf->type & 0xFFFF0000; this->codec = NULL; - + for(i = 0; i < sizeof(ff_audio_lookup)/sizeof(ff_codec_t); i++) if(ff_audio_lookup[i].type == codec_type) { pthread_mutex_lock (&ffmpeg_lock); @@ -119,57 +119,57 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) ff_audio_lookup[i].name); break; } - + if (!this->codec) { - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_audio_dec: couldn't find ffmpeg decoder for buf type 0x%X\n"), codec_type); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } - + this->context = avcodec_alloc_context(); - + if(buf->decoder_flags & BUF_FLAG_STDHEADER) { this->audio_sample_rate = buf->decoder_info[1]; this->audio_channels = buf->decoder_info[3]; - + if(this->size) { audio_header = (xine_waveformatex *)this->buf; - + this->context->block_align = audio_header->nBlockAlign; this->context->bit_rate = audio_header->nAvgBytesPerSec * 8; - + if(audio_header->cbSize > 0) { this->context->extradata = malloc(audio_header->cbSize); this->context->extradata_size = audio_header->cbSize; - memcpy( this->context->extradata, + memcpy( this->context->extradata, (uint8_t *)audio_header + sizeof(xine_waveformatex), - audio_header->cbSize ); + audio_header->cbSize ); } } } else { short *ptr; - + switch(codec_type) { case BUF_AUDIO_14_4: this->audio_sample_rate = 8000; this->audio_channels = 1; - + this->context->block_align = 240; break; case BUF_AUDIO_28_8: this->audio_sample_rate = _X_BE_16(&this->buf[0x30]); this->audio_channels = this->buf[0x37]; /* this->audio_bits = buf->content[0x35] */ - + this->context->block_align = _X_BE_32(&this->buf[0x18]); this->context->extradata_size = 5*sizeof(short); this->context->extradata = malloc(this->context->extradata_size); - + ptr = (short *) this->context->extradata; - + ptr[0] = _X_BE_16(&this->buf[0x2C]); /* subpacket size */ ptr[1] = _X_BE_16(&this->buf[0x28]); /* subpacket height */ ptr[2] = _X_BE_16(&this->buf[0x16]); /* subpacket flavour */ @@ -226,23 +226,23 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) break; } } - - /* Current ffmpeg audio decoders always use 16 bits/sample + + /* Current ffmpeg audio decoders always use 16 bits/sample * buf->decoder_info[2] can't be used as it doesn't refer to the output * bits/sample for some codecs (e.g. MS ADPCM) */ - this->audio_bits = 16; - + this->audio_bits = 16; + this->context->bits_per_sample = this->audio_bits; this->context->sample_rate = this->audio_sample_rate; this->context->channels = this->audio_channels; this->context->codec_id = this->codec->id; this->context->codec_type = this->codec->type; this->context->codec_tag = _x_stream_info_get(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC); - + this->size = 0; - + this->decode_buffer = calloc(1, AVCODEC_MAX_AUDIO_FRAME_SIZE); - + return; } } else if ((buf->decoder_flags & BUF_FLAG_SPECIAL) && @@ -267,12 +267,12 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) pthread_mutex_lock (&ffmpeg_lock); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock (&ffmpeg_lock); - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_audio_dec: couldn't open decoder\n")); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } - pthread_mutex_unlock (&ffmpeg_lock); + pthread_mutex_unlock (&ffmpeg_lock); this->decoder_ok = 1; } @@ -310,14 +310,14 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) offset = 0; while (this->size>0) { decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; - bytes_consumed = avcodec_decode_audio2 (this->context, + bytes_consumed = avcodec_decode_audio2 (this->context, (int16_t *)this->decode_buffer, - &decode_buffer_size, + &decode_buffer_size, &this->buf[offset], this->size); if (bytes_consumed<0) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_audio_dec: error decompressing audio frame\n"); this->size=0; return; @@ -337,10 +337,10 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) return; } - audio_buffer = + audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_audio_dec: Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -376,7 +376,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) static void ff_audio_reset (audio_decoder_t *this_gen) { ff_audio_decoder_t *this = (ff_audio_decoder_t *) this_gen; - + this->size = 0; /* try to reset the wma decoder */ @@ -395,7 +395,7 @@ static void ff_audio_discontinuity (audio_decoder_t *this_gen) { static void ff_audio_dispose (audio_decoder_t *this_gen) { ff_audio_decoder_t *this = (ff_audio_decoder_t *) this_gen; - + if( this->context && this->decoder_ok ) { pthread_mutex_lock (&ffmpeg_lock); avcodec_close (this->context); @@ -436,7 +436,7 @@ static audio_decoder_t *ff_audio_open_plugin (audio_decoder_class_t *class_gen, this->size = 0; this->bufsize = 0; this->decoder_ok = 0; - + ff_audio_ensure_buffer_size(this, AUDIOBUFSIZE); return &this->audio_decoder; diff --git a/src/combined/ffmpeg/ff_mpeg_parser.c b/src/combined/ffmpeg/ff_mpeg_parser.c index 3c2c2cf48..54f7d6c94 100644 --- a/src/combined/ffmpeg/ff_mpeg_parser.c +++ b/src/combined/ffmpeg/ff_mpeg_parser.c @@ -57,7 +57,7 @@ void mpeg_parser_init (mpeg_parser_t *parser) void mpeg_parser_dispose (mpeg_parser_t *parser) { if ( parser == NULL ) return; - + free(parser->chunk_buffer); } @@ -124,7 +124,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le { int is_frame_done; int next_code = parser->code; - + /* wait for sequence_header_code */ if (parser->is_sequence_needed) { if (code != 0xb3) { @@ -133,7 +133,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le return 0; } } - + is_frame_done = parser->in_slice && ((!next_code) || (next_code == 0xb7)); if (is_frame_done) @@ -141,7 +141,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le switch (code) { case 0x00: /* picture_start_code */ - + parse_header_picture (parser, buffer); parser->in_slice = 1; @@ -150,11 +150,11 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le case B_TYPE: lprintf ("B-Frame\n"); break; - + case P_TYPE: lprintf ("P-Frame\n"); break; - + case I_TYPE: lprintf ("I-Frame\n"); break; @@ -169,11 +169,11 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le { int value; uint16_t width, height; - + if (parser->is_sequence_needed) { parser->is_sequence_needed = 0; } - + if ((buffer[6] & 0x20) != 0x20) { lprintf("Invalid sequence: missing marker_bit\n"); parser->has_sequence = 0; @@ -185,7 +185,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le buffer[2]; width = ((value >> 12) + 15) & ~15; height = ((value & 0xfff) + 15) & ~15; - + if ((width > 1920) || (height > 1152)) { lprintf("Invalid sequence: width=%d, height=%d\n", width, height); parser->has_sequence = 0; @@ -196,7 +196,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le parser->height = height; parser->rate_code = buffer[3] & 15; parser->aspect_ratio_info = buffer[3] >> 4; - + if (parser->rate_code < (sizeof(frame_rate_tab)/sizeof(*frame_rate_tab))) { parser->frame_duration = 90000; parser->frame_duration *= frame_rate_tab[parser->rate_code][1]; @@ -211,7 +211,7 @@ static int parse_chunk (mpeg_parser_t *parser, int code, uint8_t *buffer, int le parser->is_mpeg1 = 1; } break; - + case 0xb5: /* extension_start_code */ switch (buffer[0] & 0xf0) { case 0x10: /* sequence extension */ @@ -282,7 +282,7 @@ uint8_t *mpeg_parser_decode_data (mpeg_parser_t *parser, ret = 0; *flush = 0; - + while (current != end) { if (parser->chunk_ptr == parser->chunk_buffer) { /* write the beginning of the chunk */ @@ -294,9 +294,9 @@ uint8_t *mpeg_parser_decode_data (mpeg_parser_t *parser, parser->chunk_start = parser->chunk_ptr; parser->has_sequence = 0; } - + code = parser->code; - + current = copy_chunk (parser, current, end); if (current == NULL) return NULL; @@ -309,10 +309,10 @@ uint8_t *mpeg_parser_decode_data (mpeg_parser_t *parser, } parser->buffer_size = parser->chunk_ptr - parser->chunk_buffer - 4; parser->chunk_ptr = parser->chunk_buffer; - + if (parser->code == 0xb7) /* sequence end, maybe a still menu */ *flush = 1; - + return current; } } diff --git a/src/combined/ffmpeg/ff_mpeg_parser.h b/src/combined/ffmpeg/ff_mpeg_parser.h index 504e746f9..c1ebc326f 100644 --- a/src/combined/ffmpeg/ff_mpeg_parser.h +++ b/src/combined/ffmpeg/ff_mpeg_parser.h @@ -49,7 +49,7 @@ typedef struct mpeg_parser_s { uint8_t in_slice:1; uint8_t rate_code:4; - + int aspect_ratio_info; /* public properties */ diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index f317b86e8..726945acd 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -1,25 +1,25 @@ /* * Copyright (C) 2001-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * xine video decoder plugin using ffmpeg */ - + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -66,7 +66,7 @@ typedef struct ff_video_class_s { int thread_count; int8_t skip_loop_filter_enum; int8_t choose_speed_over_accuracy; - + xine_t *xine; } ff_video_class_t; @@ -98,13 +98,13 @@ struct ff_video_decoder_s { int bufsize; int size; int skipframes; - + int slice_offset_size; AVFrame *av_frame; AVCodecContext *context; AVCodec *codec; - + int pp_quality; int pp_flags; pp_context_t *pp_context; @@ -117,7 +117,7 @@ struct ff_video_decoder_s { int aspect_ratio_prio; int frame_flags; int crop_right, crop_bottom; - + int output_format; xine_list_t *dr1_frames; @@ -145,7 +145,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ vo_frame_t *img; int width = context->width; int height = context->height; - + if (!this->bih.biWidth || !this->bih.biHeight) { this->bih.biWidth = width; this->bih.biHeight = height; @@ -157,12 +157,12 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ set_stream_info(this); } } - + avcodec_align_dimensions(context, &width, &height); if( this->context->pix_fmt != PIX_FMT_YUV420P && this->context->pix_fmt != PIX_FMT_YUVJ420P ) { if (!this->is_direct_rendering_disabled) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: unsupported frame format, DR1 disabled.\n")); this->is_direct_rendering_disabled = 1; } @@ -173,14 +173,14 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ av_frame->data[2]= NULL; return avcodec_default_get_buffer(context, av_frame); } - + if((width != this->bih.biWidth) || (height != this->bih.biHeight)) { if(this->stream->video_out->get_capabilities(this->stream->video_out) & VO_CAP_CROP) { this->crop_right = width - this->bih.biWidth; this->crop_bottom = height - this->bih.biHeight; } else { if (!this->is_direct_rendering_disabled) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: unsupported frame dimensions, DR1 disabled.\n")); this->is_direct_rendering_disabled = 1; } @@ -195,7 +195,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ img = this->stream->video_out->get_frame (this->stream->video_out, width, height, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); @@ -235,7 +235,7 @@ static void release_buffer(struct AVCodecContext *context, AVFrame *av_frame){ } xine_list_iterator_t it; - + it = xine_list_find(this->dr1_frames, av_frame); assert(it); if( it != NULL ) @@ -289,7 +289,7 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) } if (!this->codec) { - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: couldn't find ffmpeg decoder for buf type 0x%X\n"), codec_type); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0); @@ -298,14 +298,14 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) lprintf("lavc decoder found\n"); - /* force (width % 8 == 0), otherwise there will be - * display problems with Xv. - */ + /* force (width % 8 == 0), otherwise there will be + * display problems with Xv. + */ this->bih.biWidth = (this->bih.biWidth + 1) & (~1); this->context->width = this->bih.biWidth; this->context->height = this->bih.biHeight; - this->context->stream_codec_tag = this->context->codec_tag = + this->context->stream_codec_tag = this->context->codec_tag = _x_stream_info_get(this->stream, XINE_STREAM_INFO_VIDEO_FOURCC); @@ -314,14 +314,14 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) if(this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264) { this->context->flags |= CODEC_FLAG_EMU_EDGE; } - + if (this->class->choose_speed_over_accuracy) this->context->flags2 |= CODEC_FLAG2_FAST; pthread_mutex_lock(&ffmpeg_lock); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock(&ffmpeg_lock); - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: couldn't open decoder\n")); free(this->context); this->context = NULL; @@ -329,14 +329,14 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) return; } - if (this->codec->id == CODEC_ID_VC1 && + if (this->codec->id == CODEC_ID_VC1 && (!this->bih.biWidth || !this->bih.biHeight)) { /* VC1 codec must be re-opened with correct width and height. */ avcodec_close(this->context); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock(&ffmpeg_lock); - xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: couldn't open decoder (pass 2)\n")); free(this->context); this->context = NULL; @@ -373,14 +373,14 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) (this->stream->video_out->open) (this->stream->video_out, this->stream); this->skipframes = 0; - + /* enable direct rendering by default */ this->output_format = XINE_IMGFMT_YV12; #ifdef ENABLE_DIRECT_RENDERING if( this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264 ) { this->context->get_buffer = get_buffer; this->context->release_buffer = release_buffer; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: direct rendering enabled\n")); } #endif @@ -411,25 +411,25 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) static void choose_speed_over_accuracy_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; - + class->choose_speed_over_accuracy = entry->num_value; } static void skip_loop_filter_enum_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; - + class->skip_loop_filter_enum = entry->num_value; } static void thread_count_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; - + class->thread_count = entry->num_value; } static void pp_quality_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; - + class->pp_quality = entry->num_value; } @@ -442,15 +442,15 @@ static void pp_change_quality (ff_video_decoder_t *this) { this->pp_flags); if(this->pp_mode) pp_free_mode(this->pp_mode); - - this->pp_mode = pp_get_mode_by_name_and_quality("hb:a,vb:a,dr:a", + + this->pp_mode = pp_get_mode_by_name_and_quality("hb:a,vb:a,dr:a", this->pp_quality); } else { if(this->pp_mode) { pp_free_mode(this->pp_mode); this->pp_mode = NULL; } - + if(this->pp_context) { pp_free_context(this->pp_context); this->pp_context = NULL; @@ -475,22 +475,22 @@ static void init_postprocess (ff_video_decoder_t *this) { this->pp_available = 0; break; } - + /* Detect what cpu accel we have */ cpu_caps = xine_mm_accel(); this->pp_flags = PP_FORMAT_420; - + if(cpu_caps & MM_ACCEL_X86_MMX) this->pp_flags |= PP_CPU_CAPS_MMX; - + if(cpu_caps & MM_ACCEL_X86_MMXEXT) this->pp_flags |= PP_CPU_CAPS_MMX2; - - if(cpu_caps & MM_ACCEL_X86_3DNOW) + + if(cpu_caps & MM_ACCEL_X86_3DNOW) this->pp_flags |= PP_CPU_CAPS_3DNOW; - + /* Set level */ - pp_change_quality(this); + pp_change_quality(this); } static int ff_handle_mpeg_sequence(ff_video_decoder_t *this, mpeg_parser_t *parser) { @@ -499,13 +499,13 @@ static int ff_handle_mpeg_sequence(ff_video_decoder_t *this, mpeg_parser_t *pars * init codec */ if (this->decoder_init_mode) { - _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, + _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "mpeg-1 (ffmpeg)"); init_video_codec (this, BUF_VIDEO_MPEG); this->decoder_init_mode = 0; } - + /* frame format change */ if ((parser->width != this->bih.biWidth) || (parser->height != this->bih.biHeight) || @@ -531,7 +531,7 @@ static int ff_handle_mpeg_sequence(ff_video_decoder_t *this, mpeg_parser_t *pars xine_event_send(this->stream, &event); } this->video_step = this->mpeg_parser->frame_duration; - + return 1; } @@ -600,7 +600,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { this->bih.biHeight); } else if (this->context->pix_fmt == PIX_FMT_RGB32) { - + int x, plane_ptr = 0; uint32_t *argb_pixels; uint32_t argb; @@ -609,7 +609,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { argb_pixels = (uint32_t *)sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + /* this is endian-safe as the ARGB pixels are stored in * machine order */ argb = *argb_pixels++; @@ -624,9 +624,9 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_RGB565) { int x, plane_ptr = 0; @@ -637,7 +637,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + /* a 16-bit RGB565 pixel is supposed to be stored in native-endian * byte order; the following should be endian-safe */ pixel16 = *((uint16_t *)src); @@ -653,20 +653,20 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_RGB555) { - + int x, plane_ptr = 0; uint8_t *src; uint16_t pixel16; - + for(y = 0; y < this->bih.biHeight; y++) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + /* a 16-bit RGB555 pixel is supposed to be stored in native-endian * byte order; the following should be endian-safe */ pixel16 = *((uint16_t *)src); @@ -682,9 +682,9 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_BGR24) { int x, plane_ptr = 0; @@ -694,7 +694,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + b = *src++; g = *src++; r = *src++; @@ -706,9 +706,9 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_RGB24) { int x, plane_ptr = 0; @@ -718,7 +718,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { src = sy; for(x = 0; x < img->width; x++) { uint8_t r, g, b; - + r = *src++; g = *src++; b = *src++; @@ -730,11 +730,11 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else if (this->context->pix_fmt == PIX_FMT_PAL8) { - + int x, plane_ptr = 0; uint8_t *src; uint8_t pixel; @@ -769,34 +769,34 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } sy += this->av_frame->linesize[0]; } - + yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]); - + } else { - + for (y = 0; y < this->bih.biHeight; y++) { xine_fast_memcpy (dy, sy, img->width); - + dy += img->pitches[0]; - + sy += this->av_frame->linesize[0]; } for (y = 0; y < this->bih.biHeight / 2; y++) { - + if (this->context->pix_fmt != PIX_FMT_YUV444P) { - + xine_fast_memcpy (du, su, img->width/2); xine_fast_memcpy (dv, sv, img->width/2); - + } else { - + int x; uint8_t *src; uint8_t *dst; - + /* subsample */ - + src = su; dst = du; for (x=0; x<(img->width/2); x++) { *dst = *src; @@ -811,7 +811,7 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { } } - + du += img->pitches[1]; dv += img->pitches[2]; @@ -829,8 +829,8 @@ static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { static void ff_check_bufsize (ff_video_decoder_t *this, int size) { if (size > this->bufsize) { this->bufsize = size + size / 2; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("ffmpeg_video_dec: increasing buffer to %d to avoid overflow.\n"), + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("ffmpeg_video_dec: increasing buffer to %d to avoid overflow.\n"), this->bufsize); this->buf = realloc(this->buf, this->bufsize + FF_INPUT_BUFFER_PADDING_SIZE ); } @@ -876,28 +876,28 @@ static void ff_handle_header_buffer (ff_video_decoder_t *this, buf_element_t *bu if (buf->decoder_flags & BUF_FLAG_STDHEADER) { lprintf("standard header\n"); - + /* init package containing bih */ memcpy ( &this->bih, this->buf, sizeof(xine_bmiheader) ); if (this->bih.biSize > sizeof(xine_bmiheader)) { this->context->extradata_size = this->bih.biSize - sizeof(xine_bmiheader); - this->context->extradata = malloc(this->context->extradata_size + + this->context->extradata = malloc(this->context->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(this->context->extradata, this->buf + sizeof(xine_bmiheader), this->context->extradata_size); } - + this->context->bits_per_sample = this->bih.biBitCount; - + } else { - + switch (codec_type) { case BUF_VIDEO_RV10: case BUF_VIDEO_RV20: this->bih.biWidth = _X_BE_16(&this->buf[12]); this->bih.biHeight = _X_BE_16(&this->buf[14]); - + this->context->sub_id = _X_BE_32(&this->buf[30]); this->context->slice_offset = calloc(SLICE_OFFSET_SIZE, sizeof(int)); @@ -939,7 +939,7 @@ static void ff_handle_header_buffer (ff_video_decoder_t *this, buf_element_t *bu } static void ff_handle_special_buffer (ff_video_decoder_t *this, buf_element_t *buf) { - /* take care of all the various types of special buffers + /* take care of all the various types of special buffers * note that order is important here */ lprintf("special buffer\n"); @@ -948,34 +948,34 @@ static void ff_handle_special_buffer (ff_video_decoder_t *this, buf_element_t *b lprintf("BUF_SPECIAL_STSD_ATOM\n"); this->context->extradata_size = buf->decoder_info[2]; - this->context->extradata = malloc(buf->decoder_info[2] + + this->context->extradata = malloc(buf->decoder_info[2] + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(this->context->extradata, buf->decoder_info_ptr[2], buf->decoder_info[2]); } else if (buf->decoder_info[1] == BUF_SPECIAL_DECODER_CONFIG && !this->context->extradata_size) { - + lprintf("BUF_SPECIAL_DECODER_CONFIG\n"); this->context->extradata_size = buf->decoder_info[2]; this->context->extradata = malloc(buf->decoder_info[2] + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(this->context->extradata, buf->decoder_info_ptr[2], buf->decoder_info[2]); - + } else if (buf->decoder_info[1] == BUF_SPECIAL_PALETTE) { unsigned int i; palette_entry_t *demuxer_palette; AVPaletteControl *decoder_palette; - + lprintf("BUF_SPECIAL_PALETTE\n"); this->context->palctrl = &this->palette_control; decoder_palette = (AVPaletteControl *)this->context->palctrl; demuxer_palette = (palette_entry_t *)buf->decoder_info_ptr[2]; for (i = 0; i < buf->decoder_info[2]; i++) { - decoder_palette->palette[i] = + decoder_palette->palette[i] = (demuxer_palette[i].r << 16) | (demuxer_palette[i].g << 8) | (demuxer_palette[i].b << 0); @@ -984,20 +984,20 @@ static void ff_handle_special_buffer (ff_video_decoder_t *this, buf_element_t *b } else if (buf->decoder_info[1] == BUF_SPECIAL_RV_CHUNK_TABLE) { int i; - + lprintf("BUF_SPECIAL_RV_CHUNK_TABLE\n"); this->context->slice_count = buf->decoder_info[2]+1; lprintf("slice_count=%d\n", this->context->slice_count); - + if(this->context->slice_count > this->slice_offset_size) { this->context->slice_offset = realloc(this->context->slice_offset, sizeof(int)*this->context->slice_count); this->slice_offset_size = this->context->slice_count; } - + for(i = 0; i < this->context->slice_count; i++) { - this->context->slice_offset[i] = + this->context->slice_offset[i] = ((uint32_t *) buf->decoder_info_ptr[2])[(2*i)+1]; lprintf("slice_offset[%d]=%d\n", i, this->context->slice_offset[i]); } @@ -1040,7 +1040,7 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu if (!this->decoder_ok) return; - + if (flush) { lprintf("flush lavc buffers\n"); /* hack: ffmpeg outputs the last frame if size=0 */ @@ -1058,11 +1058,11 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu len, got_picture); len = current - buf->content - offset; lprintf("avcodec_decode_video: consumed_size=%d\n", len); - + flush = next_flush; if ((len < 0) || (len > buf->size)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_video_dec: error decompressing frame\n"); size = 0; /* draw a bad frame and exit */ } else { @@ -1077,7 +1077,7 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu img = this->stream->video_out->get_frame (this->stream->video_out, this->bih.biWidth, this->bih.biHeight, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); free_img = 1; @@ -1097,7 +1097,7 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu img->crop_right = this->crop_right; img->crop_bottom = this->crop_bottom; - + this->skipframes = img->draw(img, this->stream); if(free_img) @@ -1110,7 +1110,7 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu img = this->stream->video_out->get_frame (this->stream->video_out, this->bih.biWidth, this->bih.biHeight, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); img->pts = 0; @@ -1250,7 +1250,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { /* data accumulation */ if (buf->size > 0) { if ((this->size == 0) && - ((buf->size + FF_INPUT_BUFFER_PADDING_SIZE) < buf->max_size) && + ((buf->size + FF_INPUT_BUFFER_PADDING_SIZE) < buf->max_size) && (buf->decoder_flags & BUF_FLAG_FRAME_END)) { /* buf contains a complete frame */ /* no memcpy needed */ @@ -1263,7 +1263,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { chunk_buf = this->buf; /* ff_check_bufsize might realloc this->buf */ xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); - + this->size += buf->size; lprintf("accumulate data into this->buf\n"); } @@ -1286,7 +1286,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { memset(&chunk_buf[this->size], 0, FF_INPUT_BUFFER_PADDING_SIZE); while (this->size > 0) { - + /* DV frames can be completely skipped */ if( codec_type == BUF_VIDEO_DV && this->skipframes ) { this->size = 0; @@ -1305,7 +1305,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { lprintf("consumed size: %d, got_picture: %d\n", len, got_picture); if ((len <= 0) || (len > this->size)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_video_dec: error decompressing frame\n"); this->size = 0; @@ -1343,7 +1343,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { this->bih.biHeight = this->context->height; } - this->aspect_ratio = av_q2d(this->context->sample_aspect_ratio) * + this->aspect_ratio = av_q2d(this->context->sample_aspect_ratio) * (double)this->bih.biWidth / (double)this->bih.biHeight; this->aspect_ratio_prio = 2; lprintf("ffmpeg aspect ratio: %f\n", this->aspect_ratio); @@ -1382,7 +1382,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, (this->bih.biWidth + 15) & ~15, (this->bih.biHeight + 15) & ~15, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); free_img = 1; @@ -1403,17 +1403,17 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, (img->width + 15) & ~15, (img->height + 15) & ~15, - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); free_img = 1; } - pp_postprocess(this->av_frame->data, this->av_frame->linesize, - img->base, img->pitches, + pp_postprocess(this->av_frame->data, this->av_frame->linesize, + img->base, img->pitches, img->width, img->height, this->av_frame->qscale_table, this->av_frame->qstride, - this->pp_mode, this->pp_context, + this->pp_mode, this->pp_context, this->av_frame->pict_type); } else if (!this->av_frame->opaque) { @@ -1448,7 +1448,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img->top_field_first = this->av_frame->top_field_first; this->skipframes = img->draw(img, this->stream); - + if(free_img) img->free(img); } @@ -1462,7 +1462,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img = this->stream->video_out->get_frame (this->stream->video_out, (this->bih.biWidth <= 0) ? 16 : ((this->bih.biWidth + 15) & ~15), (this->bih.biHeight <= 0) ? 16 : ((this->bih.biHeight + 15) & ~15), - this->aspect_ratio, + this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); /* set PTS to allow early syncing */ @@ -1487,7 +1487,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; - lprintf ("processing packet type = %08x, len = %d, decoder_flags=%08x\n", + lprintf ("processing packet type = %08x, len = %d, decoder_flags=%08x\n", buf->type, buf->size, buf->decoder_flags); if (buf->decoder_flags & BUF_FLAG_FRAMERATE) { @@ -1496,7 +1496,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } if (buf->decoder_flags & BUF_FLAG_PREVIEW) { - + ff_handle_preview_buffer(this, buf); } else { @@ -1504,7 +1504,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (buf->decoder_flags & BUF_FLAG_SPECIAL) { ff_handle_special_buffer(this, buf); - + } if (buf->decoder_flags & BUF_FLAG_HEADER) { @@ -1518,7 +1518,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { lprintf("aspect ratio: %f\n", this->aspect_ratio); set_stream_info(this); } - } + } } else { @@ -1549,7 +1549,7 @@ static void ff_reset (video_decoder_t *this_gen) { if(this->context && this->decoder_ok) avcodec_flush_buffers(this->context); - + if (this->is_mpeg12) mpeg_parser_reset(this->mpeg_parser); @@ -1561,13 +1561,13 @@ static void ff_reset (video_decoder_t *this_gen) { static void ff_discontinuity (video_decoder_t *this_gen) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; - + lprintf ("ff_discontinuity\n"); this->pts = 0; /* * there is currently no way to reset all the pts which are stored in the decoder. - * therefore, we add a unique tag (generated from pts_tag_counter) to pts (see + * therefore, we add a unique tag (generated from pts_tag_counter) to pts (see * ff_tag_pts()) and wait for it to appear on returned frames. * until then, any retrieved pts value will be reset to 0 (see ff_untag_pts()). * when we see the tag returned, pts_tag will be reset to 0. from now on, any @@ -1603,15 +1603,15 @@ static void ff_dispose (video_decoder_t *this_gen) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; lprintf ("ff_dispose\n"); - + if (this->decoder_ok) { xine_list_iterator_t it; AVFrame *av_frame; - + pthread_mutex_lock(&ffmpeg_lock); avcodec_close (this->context); pthread_mutex_unlock(&ffmpeg_lock); - + /* frame garbage collector here - workaround for buggy ffmpeg codecs that * don't release their DR1 frames */ while( (it = xine_list_front(this->dr1_frames)) != NULL ) @@ -1619,7 +1619,7 @@ static void ff_dispose (video_decoder_t *this_gen) { av_frame = (AVFrame *)xine_list_get_value(this->dr1_frames, it); release_buffer(this->context, av_frame); } - + this->stream->video_out->close(this->stream->video_out, this->stream); this->decoder_ok = 0; } @@ -1632,27 +1632,27 @@ static void ff_dispose (video_decoder_t *this_gen) { if(this->yuv_init) free_yuv_planes(&this->yuv); - + if( this->context ) av_free( this->context ); if( this->av_frame ) av_free( this->av_frame ); - + if (this->buf) free(this->buf); this->buf = NULL; - + if(this->pp_context) pp_free_context(this->pp_context); - + if(this->pp_mode) pp_free_mode(this->pp_mode); mpeg_parser_dispose(this->mpeg_parser); - + xine_list_delete(this->dr1_frames); - + free (this_gen); } @@ -1678,7 +1678,7 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, this->context = avcodec_alloc_context(); this->context->opaque = this; this->context->palctrl = NULL; - + this->decoder_ok = 0; this->decoder_init_mode = 1; this->buf = calloc(1, VIDEOBUFSIZE + FF_INPUT_BUFFER_PADDING_SIZE); @@ -1690,9 +1690,9 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, this->pp_quality = 0; this->pp_context = NULL; this->pp_mode = NULL; - + this->mpeg_parser = NULL; - + this->dr1_frames = xine_list_new(); #ifdef LOG @@ -1706,7 +1706,7 @@ void *init_video_plugin (xine_t *xine, void *data) { ff_video_class_t *this; config_values_t *config; - + this = calloc(1, sizeof (ff_video_class_t)); this->decoder_class.open_plugin = ff_video_open_plugin; @@ -1716,12 +1716,12 @@ void *init_video_plugin (xine_t *xine, void *data) { this->xine = xine; pthread_once( &once_control, init_once_routine ); - + /* Configuration for post processing quality - default to mid (3) for the * moment */ config = xine->config; - - this->pp_quality = xine->config->register_range(config, "video.processing.ffmpeg_pp_quality", 3, + + this->pp_quality = xine->config->register_range(config, "video.processing.ffmpeg_pp_quality", 3, 0, PP_QUALITY_MAX, _("MPEG-4 postprocessing quality"), _("You can adjust the amount of post processing applied to MPEG-4 video.\n" @@ -1730,8 +1730,8 @@ void *init_video_plugin (xine_t *xine, void *data) { "too heavy post processing can actually make the image worse by blurring it " "too much."), 10, pp_quality_cb, this); - - this->thread_count = xine->config->register_num(config, "video.processing.ffmpeg_thread_count", 1, + + this->thread_count = xine->config->register_num(config, "video.processing.ffmpeg_thread_count", 1, _("FFmpeg video decoding thread count"), _("You can adjust the number of video decoding threads which FFmpeg may use.\n" "Higher values should speed up decoding but it depends on the codec used " @@ -1740,7 +1740,7 @@ void *init_video_plugin (xine_t *xine, void *data) { "A change of this setting will take effect with playing the next stream."), 10, thread_count_cb, this); - this->skip_loop_filter_enum = xine->config->register_enum(config, "video.processing.ffmpeg_skip_loop_filter", 0, + this->skip_loop_filter_enum = xine->config->register_enum(config, "video.processing.ffmpeg_skip_loop_filter", 0, (char **)skip_loop_filter_enum_names, _("Skip loop filter"), _("You can control for which frames the loop filter shall be skipped after " @@ -1751,7 +1751,7 @@ void *init_video_plugin (xine_t *xine, void *data) { "A change of this setting will take effect with playing the next stream."), 10, skip_loop_filter_enum_cb, this); - this->choose_speed_over_accuracy = xine->config->register_bool(config, "video.processing.ffmpeg_choose_speed_over_accuracy", 0, + this->choose_speed_over_accuracy = xine->config->register_bool(config, "video.processing.ffmpeg_choose_speed_over_accuracy", 0, _("Choose speed over specification compliance"), _("You may want to allow speed cheats which violate codec specification.\n" "Cheating may speed up decoding but can also lead to decoding artefacts.\n" @@ -1761,14 +1761,14 @@ void *init_video_plugin (xine_t *xine, void *data) { return this; } -static const uint32_t wmv8_video_types[] = { +static const uint32_t wmv8_video_types[] = { BUF_VIDEO_WMV8, - 0 + 0 }; -static const uint32_t wmv9_video_types[] = { +static const uint32_t wmv9_video_types[] = { BUF_VIDEO_WMV9, - 0 + 0 }; decoder_info_t dec_info_ffmpeg_video = { diff --git a/src/combined/ffmpeg/ffmpeg_decoder.c b/src/combined/ffmpeg/ffmpeg_decoder.c index 8a8a79270..4f9a0f7a4 100644 --- a/src/combined/ffmpeg/ffmpeg_decoder.c +++ b/src/combined/ffmpeg/ffmpeg_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2001-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -46,7 +46,7 @@ void init_once_routine(void) { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_DECODER | PLUGIN_MUST_PRELOAD, 19, "ffmpegvideo", XINE_VERSION_CODE, &dec_info_ffmpeg_video, init_video_plugin }, { PLUGIN_VIDEO_DECODER, 19, "ffmpeg-wmv8", XINE_VERSION_CODE, &dec_info_ffmpeg_wmv8, init_video_plugin }, { PLUGIN_VIDEO_DECODER, 19, "ffmpeg-wmv9", XINE_VERSION_CODE, &dec_info_ffmpeg_wmv9, init_video_plugin }, diff --git a/src/combined/ffmpeg/ffmpeg_decoder.h b/src/combined/ffmpeg/ffmpeg_decoder.h index 3eb86f4bf..f679a5ce9 100644 --- a/src/combined/ffmpeg/ffmpeg_decoder.h +++ b/src/combined/ffmpeg/ffmpeg_decoder.h @@ -1,23 +1,23 @@ /* * Copyright (C) 2001-2005 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ - + #ifndef HAVE_XINE_DECODER_H #define HAVE_XINE_DECODER_H diff --git a/src/combined/flac_decoder.c b/src/combined/flac_decoder.c index 4982a6a6c..94c0d30f2 100644 --- a/src/combined/flac_decoder.c +++ b/src/combined/flac_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -74,8 +74,8 @@ typedef struct flac_decoder_s { * FLAC callback functions */ -static FLAC__StreamDecoderReadStatus -flac_read_callback (const FLAC__StreamDecoder *decoder, +static FLAC__StreamDecoderReadStatus +flac_read_callback (const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) @@ -123,36 +123,36 @@ flac_write_callback (const FLAC__StreamDecoder *decoder, lprintf("flac_write_callback\n"); while( samples_left ) { - + audio_buffer = this->stream->audio_out->get_buffer(this->stream->audio_out); if( audio_buffer->mem_size < samples_left * frame->header.channels * bytes_per_sample ) buf_samples = audio_buffer->mem_size / (frame->header.channels * bytes_per_sample); else buf_samples = samples_left; - - + + if( frame->header.bits_per_sample == 8 ) { data8 = (int8_t *)audio_buffer->mem; - + for( j=0; j < buf_samples; j++ ) for( i=0; i < frame->header.channels; i++ ) *data8++ = buffer[i][j]; - + } else { - + data16 = (int16_t *)audio_buffer->mem; - + for( j=0; j < buf_samples; j++ ) for( i=0; i < frame->header.channels; i++ ) *data16++ = buffer[i][j]; - } + } audio_buffer->num_frames = buf_samples; audio_buffer->vpts = this->pts; this->pts = 0; this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - + samples_left -= buf_samples; } return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; @@ -165,9 +165,9 @@ flac_metadata_callback (const FLAC__StreamDecoder *decoder, void *client_data) { /* flac_decoder_t *this = (flac_decoder_t *)client_data; */ - + lprintf("Metadata callback called!\n"); - + #ifdef LOG if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { printf("libflac: min_blocksize = %d\n", metadata->data.stream_info.min_blocksize); @@ -201,7 +201,7 @@ flac_error_callback (const FLAC__StreamDecoder *decoder, else printf("libflac: unknown error.\n"); #endif - + return; } @@ -210,34 +210,34 @@ flac_error_callback (const FLAC__StreamDecoder *decoder, * FLAC plugin decoder */ -static void +static void flac_reset (audio_decoder_t *this_gen) { flac_decoder_t *this = (flac_decoder_t *) this_gen; this->buf_pos = 0; - - if( FLAC__stream_decoder_get_state(this->flac_decoder) != - FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ) + + if( FLAC__stream_decoder_get_state(this->flac_decoder) != + FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ) FLAC__stream_decoder_flush (this->flac_decoder); } -static void -flac_discontinuity (audio_decoder_t *this_gen) +static void +flac_discontinuity (audio_decoder_t *this_gen) { flac_decoder_t *this = (flac_decoder_t *) this_gen; this->pts = 0; - + lprintf("Discontinuity!\n"); } -static void +static void flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { flac_decoder_t *this = (flac_decoder_t *) this_gen; int ret = 1; - + /* We are getting the stream header, open up the audio * device, and collect information about the stream */ @@ -277,15 +277,15 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) xine_fast_memcpy (&this->buf[this->buf_pos], buf->content, buf->size); this->buf_pos += buf->size; - + if (buf->pts) this->pts = buf->pts; /* We have enough to decode a frame */ while( ret && this->buf_pos > this->min_size ) { - + FLAC__StreamDecoderState state = FLAC__stream_decoder_get_state(this->flac_decoder); - + if( state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ) { lprintf("process_until_end_of_metadata\n"); ret = FLAC__stream_decoder_process_until_end_of_metadata (this->flac_decoder); @@ -301,24 +301,24 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) } } else return; - + } static void flac_dispose (audio_decoder_t *this_gen) { - flac_decoder_t *this = (flac_decoder_t *) this_gen; + flac_decoder_t *this = (flac_decoder_t *) this_gen; FLAC__stream_decoder_finish (this->flac_decoder); FLAC__stream_decoder_delete (this->flac_decoder); - if (this->output_open) + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); if (this->buf) free(this->buf); - + free (this_gen); } @@ -384,7 +384,7 @@ open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { static void * init_plugin (xine_t *xine, void *data) { flac_class_t *this; - + this = calloc(1, sizeof (flac_class_t)); this->decoder_class.open_plugin = open_plugin; @@ -398,7 +398,7 @@ init_plugin (xine_t *xine, void *data) { void *demux_flac_init_class (xine_t *xine, void *data); -static const uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_FLAC, 0 }; @@ -408,7 +408,7 @@ static const decoder_info_t dec_info_audio = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 27, "flac", XINE_VERSION_CODE, NULL, demux_flac_init_class }, { PLUGIN_AUDIO_DECODER, 16, "flacdec", XINE_VERSION_CODE, &dec_info_audio, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/combined/flac_demuxer.c b/src/combined/flac_demuxer.c index 1105e353a..0685631c7 100644 --- a/src/combined/flac_demuxer.c +++ b/src/combined/flac_demuxer.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -64,7 +64,7 @@ typedef struct demux_flac_s { demux_plugin_t demux_plugin; xine_stream_t *stream; - + fifo_buffer_t *audio_fifo; fifo_buffer_t *video_fifo; @@ -110,15 +110,15 @@ flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, void *client_data) { demux_flac_t *this = (demux_flac_t *)client_data; - input_plugin_t *input = this->input; + input_plugin_t *input = this->input; off_t offset = *bytes; lprintf("flac_read_callback\n"); - + /* This should only be called when flac is reading the metadata * of the flac stream. */ - + offset = input->read (input, buffer, offset); lprintf("Read %lld / %u bytes into buffer\n", offset, *bytes); @@ -128,7 +128,7 @@ flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, { *bytes = offset; lprintf("Marking EOF\n"); - + this->status = DEMUX_FINISHED; #ifdef LEGACY_FLAC return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; @@ -140,7 +140,7 @@ flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, { *bytes = offset; lprintf("Read was perfect\n"); - + #ifdef LEGACY_FLAC return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; #else @@ -231,7 +231,7 @@ flac_length_callback (const FLAC__SeekableStreamDecoder *decoder, #endif } -static FLAC__bool +static FLAC__bool flac_eof_callback (const FLAC__SeekableStreamDecoder *decoder, void *client_data) { @@ -253,28 +253,28 @@ flac_eof_callback (const FLAC__SeekableStreamDecoder *decoder, } } -static FLAC__StreamDecoderWriteStatus -flac_write_callback (const FLAC__SeekableStreamDecoder *decoder, +static FLAC__StreamDecoderWriteStatus +flac_write_callback (const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], - void *client_data) + void *client_data) { /* This should never be called, all we use flac for in this demuxer * is seeking. We do the decoding in the decoder */ - + lprintf("Error: Write callback was called!\n"); return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; } -static void -flac_metadata_callback (const FLAC__SeekableStreamDecoder *decoder, - const FLAC__StreamMetadata *metadata, +static void +flac_metadata_callback (const FLAC__SeekableStreamDecoder *decoder, + const FLAC__StreamMetadata *metadata, void *client_data) { demux_flac_t *this = (demux_flac_t *)client_data; - + lprintf("IN: Metadata callback\n"); /* This should be called when we first look at a flac stream, @@ -293,8 +293,8 @@ flac_metadata_callback (const FLAC__SeekableStreamDecoder *decoder, return; } -static void -flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, +static void +flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) { @@ -306,24 +306,24 @@ flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: flac_error_callback\n"); if (status == FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: Decoder lost synchronization.\n"); else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER) xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: Decoder encounted a corrupted frame header.\n"); else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: Frame's data did not match the CRC in the footer.\n"); else xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_flac: unknown error.\n"); - + this->status = DEMUX_FINISHED; - + return; } /* FLAC Demuxer plugin */ -static int +static int demux_flac_send_chunk (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; buf_element_t *buf = NULL; @@ -333,7 +333,7 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) { remaining_sample_bytes = 2048; - current_file_pos = this->input->get_current_pos (this->input) + current_file_pos = this->input->get_current_pos (this->input) - this->data_start; if( (this->data_size - this->data_start) > 0 ) file_size = (this->data_size - this->data_start); @@ -398,7 +398,7 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) { return this->status; } -static void +static void demux_flac_send_headers (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; @@ -432,7 +432,7 @@ demux_flac_send_headers (demux_plugin_t *this_gen) { } } -static void +static void demux_flac_dispose (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; @@ -449,7 +449,7 @@ demux_flac_dispose (demux_plugin_t *this_gen) { return; } -static int +static int demux_flac_get_status (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; @@ -459,7 +459,7 @@ demux_flac_get_status (demux_plugin_t *this_gen) { } -static int +static int demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_flac_t *this = (demux_flac_t *) this_gen; @@ -477,15 +477,15 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int } start_pos = (uint64_t)(distance * (this->data_size - this->data_start)); } - + if (start_pos || !start_time) { - + start_pos += this->data_start; this->input->seek (this->input, start_pos, SEEK_SET); lprintf ("Seek to position: %lld\n", start_pos); - + } else { - + double distance = (double)start_time; uint64_t target_sample; FLAC__bool s = false; @@ -516,9 +516,9 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int return this->status; } -static int +static int demux_flac_get_stream_length (demux_plugin_t *this_gen) { - demux_flac_t *this = (demux_flac_t *) this_gen; + demux_flac_t *this = (demux_flac_t *) this_gen; lprintf("demux_flac_get_stream_length\n"); @@ -528,14 +528,14 @@ demux_flac_get_stream_length (demux_plugin_t *this_gen) { return 0; } -static uint32_t +static uint32_t demux_flac_get_capabilities (demux_plugin_t *this_gen) { lprintf("demux_flac_get_capabilities\n"); return DEMUX_CAP_NOCAP; } -static int +static int demux_flac_get_optional_data (demux_plugin_t *this_gen, void *data, int dtype) { lprintf("demux_flac_get_optional_data\n"); @@ -543,8 +543,8 @@ demux_flac_get_optional_data (demux_plugin_t *this_gen, void *data, int dtype) { } static demux_plugin_t * -open_plugin (demux_class_t *class_gen, - xine_stream_t *stream, +open_plugin (demux_class_t *class_gen, + xine_stream_t *stream, input_plugin_t *input) { demux_flac_t *this; @@ -556,22 +556,22 @@ open_plugin (demux_class_t *class_gen, uint8_t buf[MAX_PREVIEW_SIZE]; int len; - /* + /* * try to get a preview of the data */ len = input->get_optional_data (input, buf, INPUT_OPTIONAL_DATA_PREVIEW); if (len == INPUT_OPTIONAL_UNSUPPORTED) { - + if (input->get_capabilities (input) & INPUT_CAP_SEEKABLE) { - + input->seek (input, 0, SEEK_SET); if ( (len=input->read (input, buf, 1024)) <= 0) return NULL; input->seek (input, 0, SEEK_SET); - + } else return NULL; - } + } /* FIXME: Skip id3v2 tag */ /* Look for fLaC tag at the beginning of file */ @@ -607,7 +607,7 @@ open_plugin (demux_class_t *class_gen, this->demux_plugin.demux_class = class_gen; this->seek_flag = 0; - + /* Get a new FLAC decoder and hook up callbacks */ #ifdef LEGACY_FLAC @@ -703,7 +703,7 @@ void * demux_flac_init_class (xine_t *xine, void *data) { demux_flac_class_t *this; - + lprintf("demux_flac_init_class\n"); this = calloc(1, sizeof (demux_flac_class_t)); diff --git a/src/combined/nsf_combined.c b/src/combined/nsf_combined.c index 0364e2db2..c4c19f48a 100644 --- a/src/combined/nsf_combined.c +++ b/src/combined/nsf_combined.c @@ -25,7 +25,7 @@ static const demuxer_info_t demux_info_nsf = { 10 /* priority */ }; -static const uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_NSF, 0 }; diff --git a/src/combined/nsf_decoder.c b/src/combined/nsf_decoder.c index babeffae0..36f7f2990 100644 --- a/src/combined/nsf_decoder.c +++ b/src/combined/nsf_decoder.c @@ -234,7 +234,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre return &this->audio_decoder; } -/* This function allocates a private audio decoder class and initializes +/* This function allocates a private audio decoder class and initializes * the class's member functions. */ void *decoder_nsf_init_plugin (xine_t *xine, void *data) { diff --git a/src/combined/nsf_demuxer.c b/src/combined/nsf_demuxer.c index 059a91ff4..2081d13b8 100644 --- a/src/combined/nsf_demuxer.c +++ b/src/combined/nsf_demuxer.c @@ -22,7 +22,7 @@ * NSF File "Demuxer" by Mike Melanson (melanson@pcisys.net) * This is really just a loader for NES Music File Format (extension NSF) * which loads an entire NSF file and passes it over to the NSF audio - * decoder. + * decoder. * * After the file is sent over, the demuxer controls the playback by * sending empty buffers with incrementing pts values. @@ -167,7 +167,7 @@ static int demux_nsf_send_chunk(demux_plugin_t *this_gen) { buf->decoder_info[1] = 0; buf->type = BUF_AUDIO_NSF; - if(this->total_songs) + if(this->total_songs) buf->extra_info->input_normpos = (this->current_song - 1) * 65535 / this->total_songs; buf->extra_info->input_time = this->current_pts / 90; buf->pts = this->current_pts; diff --git a/src/combined/wavpack_combined.c b/src/combined/wavpack_combined.c index ca54635e7..8fe241d27 100644 --- a/src/combined/wavpack_combined.c +++ b/src/combined/wavpack_combined.c @@ -27,7 +27,7 @@ static const demuxer_info_t demux_info_wv = { 0 /* priority */ }; -static const uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_WAVPACK, 0 }; diff --git a/src/combined/wavpack_decoder.c b/src/combined/wavpack_decoder.c index fdf6a5514..49c700087 100644 --- a/src/combined/wavpack_decoder.c +++ b/src/combined/wavpack_decoder.c @@ -140,7 +140,7 @@ static void wavpack_reset (audio_decoder_t *const this_gen) this->buf_pos = 0; } -static void wavpack_discontinuity (audio_decoder_t *const this_gen) +static void wavpack_discontinuity (audio_decoder_t *const this_gen) { /* wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; */ @@ -150,7 +150,7 @@ static void wavpack_discontinuity (audio_decoder_t *const this_gen) static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t *const buf) { wavpack_decoder_t *const this = (wavpack_decoder_t *) this_gen; - + /* We are getting the stream header, open up the audio * device, and collect information about the stream */ @@ -194,7 +194,7 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t xine_fast_memcpy (&this->buf[this->buf_pos], buf->content, buf->size); this->buf_pos += buf->size; - + if ( buf->decoder_flags & BUF_FLAG_FRAME_END ) { static WavpackStreamReader wavpack_buffer_reader = { .read_bytes = xine_buffer_read_bytes, @@ -216,7 +216,7 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t this->buf_pos = 0; if ( le2me_32(header->samples_count) == 0 ) return; - + ctx = WavpackOpenFileInputEx(&wavpack_buffer_reader, this, NULL, error, OPEN_STREAMING, 0); if ( ! ctx ) { lprintf("unable to open the stream: %s\n", error); @@ -250,14 +250,14 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t } lprintf("Decoded %d samples\n", buf_samples); - + samples_left -= decoded_count; audio_buffer->num_frames = decoded_count; audio_buffer->vpts = 0; /* TODO: Fix the pts calculation */ // audio_buffer->vpts = (buf->pts * (samples_total-samples_left)) / samples_total; lprintf("Audio buffer with pts %"PRId64"\n", audio_buffer->vpts); - + switch(this->bits_per_sample) { case 8: { int8_t *data8 = (int8_t*)audio_buffer->mem; @@ -282,13 +282,13 @@ static void wavpack_decode_data (audio_decoder_t *const this_gen, buf_element_t } static void wavpack_dispose (audio_decoder_t *this_gen) { - wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; + wavpack_decoder_t *this = (wavpack_decoder_t *) this_gen; if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); free(this->buf); - + free (this_gen); } @@ -313,7 +313,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre void *decoder_wavpack_init_plugin (xine_t *xine, void *data) { wavpack_class_t *this; - + this = calloc(1, sizeof (wavpack_class_t)); this->decoder_class.open_plugin = open_plugin; diff --git a/src/combined/wavpack_demuxer.c b/src/combined/wavpack_demuxer.c index 51b2c7af9..a4cec9e56 100644 --- a/src/combined/wavpack_demuxer.c +++ b/src/combined/wavpack_demuxer.c @@ -39,7 +39,7 @@ typedef struct { demux_plugin_t demux_plugin; - + xine_stream_t *stream; fifo_buffer_t *audio_fifo; input_plugin_t *input; @@ -188,7 +188,7 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { this->status = DEMUX_FINISHED; return this->status; } - + lprintf("current sample: %u\n", this->current_sample); do { @@ -229,7 +229,7 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { input_time_guess *= buf->extra_info->input_normpos; input_time_guess /= 65535; buf->extra_info->input_time = input_time_guess; - + if ( ! header_sent ) offset = sizeof(wvheader_t); @@ -247,7 +247,7 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { if ( bytes_to_read <= 0 && (le2me_32(header.flags) & FINAL_BLOCK) == FINAL_BLOCK) buf->decoder_flags |= BUF_FLAG_FRAME_END; - + this->audio_fifo->put(this->audio_fifo, buf); } } while ( (le2me_32(header.flags) & FINAL_BLOCK) != FINAL_BLOCK ); @@ -271,7 +271,7 @@ static void demux_wv_send_headers(demux_plugin_t *const this_gen) { /* Send header to decoder */ if (this->audio_fifo) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - + buf->type = BUF_AUDIO_WAVPACK; buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; buf->decoder_info[0] = this->input->get_length(this->input); @@ -346,12 +346,12 @@ static demux_plugin_t *open_plugin (demux_class_t *const class_gen, case METHOD_BY_MRL: case METHOD_BY_CONTENT: case METHOD_EXPLICIT: - + if (!open_wv_file(this)) { free (this); return NULL; } - + break; default: diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index 5ec30c00d..4671c12bd 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -332,7 +332,7 @@ static void send_ogg_packet (demux_ogg_t *this, buf->pts = pts; if( this->input->get_length (this->input) ) - buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); buf->extra_info->input_time = buf->pts / 90 ; buf->type = this->si[stream_num]->buf_types; @@ -585,10 +585,10 @@ static void send_ogg_buf (demux_ogg_t *this, int normpos = 0; if( this->input->get_length (this->input) ) - normpos = (int)( (double) this->input->get_current_pos (this->input) * + normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); - + hdrlen = (*op->packet & PACKET_LEN_BITS01) >> 6; hdrlen |= (*op->packet & PACKET_LEN_BITS2) << 1; @@ -693,7 +693,7 @@ static void send_ogg_buf (demux_ogg_t *this, check_newpts( this, pts, PTS_VIDEO, decoder_flags ); } else pts = 0; - + llprintf(DEBUG_VIDEO_PACKETS, "videostream %d op-gpos %" PRId64 " hdr-gpos %" PRId64 " pts %" PRId64 " \n", stream_num, @@ -1344,7 +1344,7 @@ static void decode_anxdata_header (demux_ogg_t *this, const int stream_num, ogg_ } else { this->si[stream_num]->buf_types = BUF_CONTROL_NOP; } - + } static void decode_cmml_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) { @@ -1619,10 +1619,10 @@ static int demux_ogg_send_chunk (demux_plugin_t *this_gen) { if (ogg_page_eos(&this->og)) { int i; int finished_streams = 0; - + lprintf("end of stream, serialnumber %d\n", cur_serno); this->si[stream_num]->delivered_eos = 1; - + /* check if all logical streams are finished */ for (i = 0; i < this->num_streams; i++) { finished_streams += this->si[i]->delivered_eos; @@ -1644,12 +1644,12 @@ static int demux_ogg_send_chunk (demux_plugin_t *this_gen) { this->unhandled_video_streams = 0; this->num_spu_streams = 0; this->avg_bitrate = 1; - + /* try to read a chained stream */ this->send_newpts = 1; this->last_pts[0] = 0; this->last_pts[1] = 0; - + /* send control buffer to avoid buffer leak */ _x_demux_control_end(this->stream, 0); _x_demux_control_start(this->stream); @@ -1778,7 +1778,7 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, hasn` changed its length, otherwise no seek to "new" data is possible*/ lprintf ("seek to time %d called\n",start_time); - lprintf ("current time is %d\n",current_time); + lprintf ("current time is %d\n",current_time); if (current_time > start_time) { /*seek between beginning and current_pos*/ @@ -1798,7 +1798,7 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, } lprintf ("current_pos is %" PRId64 "\n",current_pos); - lprintf ("new_pos is %" PRId64 "\n",start_pos); + lprintf ("new_pos is %" PRId64 "\n",start_pos); } else { /*seek using avg_bitrate*/ @@ -1817,9 +1817,9 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, ogg_stream_reset(&this->si[i]->oss); } - /*some strange streams have no syncpoint flag set at the beginning*/ - if (start_pos == 0) - this->keyframe_needed = 0; + /*some strange streams have no syncpoint flag set at the beginning*/ + if (start_pos == 0) + this->keyframe_needed = 0; lprintf ("seek to %" PRId64 " called\n",start_pos); @@ -1830,7 +1830,7 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, /* fixme - this would be a nice position to do the following tasks 1. adjust an ogg videostream to a keyframe 2. compare the keyframe_pts with start_time. if the difference is to - high (e.g. larger than max keyframe_intervall, do a new seek or + high (e.g. larger than max keyframe_intervall, do a new seek or continue reading 3. adjust the audiostreams in such a way, that the difference is not to high. @@ -1838,12 +1838,12 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, In short words, do all the cleanups necessary to continue playback without further actions */ - + this->send_newpts = 1; this->status = DEMUX_OK; - + if( !playing ) { - + this->buf_flag_seek = 0; } else { @@ -1860,13 +1860,13 @@ static int demux_ogg_seek (demux_plugin_t *this_gen, _x_demux_flush_engine(this->stream); } - + return this->status; } static int demux_ogg_get_stream_length (demux_plugin_t *this_gen) { - demux_ogg_t *this = (demux_ogg_t *) this_gen; + demux_ogg_t *this = (demux_ogg_t *) this_gen; if (this->time_length==-1){ if (this->avg_bitrate) { @@ -1881,7 +1881,7 @@ static int demux_ogg_get_stream_length (demux_plugin_t *this_gen) { } static uint32_t demux_ogg_get_capabilities(demux_plugin_t *this_gen) { - demux_ogg_t *this = (demux_ogg_t *) this_gen; + demux_ogg_t *this = (demux_ogg_t *) this_gen; int cap_chapter = 0; if (this->chapter_info) @@ -1911,8 +1911,8 @@ static int format_lang_string (demux_ogg_t * this, uint32_t buf_mask, uint32_t b static int demux_ogg_get_optional_data(demux_plugin_t *this_gen, void *data, int data_type) { - - demux_ogg_t *this = (demux_ogg_t *) this_gen; + + demux_ogg_t *this = (demux_ogg_t *) this_gen; char *str=(char *) data; int channel = *((int *)data); @@ -1997,7 +1997,7 @@ static int detect_anx_content (int detection_method, demux_class_t *class_gen, } static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen, - xine_stream_t *stream, + xine_stream_t *stream, input_plugin_t *input) { demux_ogg_t *this; @@ -2026,13 +2026,13 @@ static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen, this->demux_plugin.get_capabilities = demux_ogg_get_capabilities; this->demux_plugin.get_optional_data = demux_ogg_get_optional_data; this->demux_plugin.demux_class = class_gen; - + this->status = DEMUX_FINISHED; #ifdef HAVE_THEORA theora_info_init (&this->t_info); theora_comment_init (&this->t_comment); -#endif +#endif this->chapter_info = 0; this->title = 0; @@ -2042,7 +2042,7 @@ static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen, } static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen, - xine_stream_t *stream, + xine_stream_t *stream, input_plugin_t *input) { demux_ogg_t *this; @@ -2067,13 +2067,13 @@ static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen, this->demux_plugin.get_capabilities = demux_ogg_get_capabilities; this->demux_plugin.get_optional_data = demux_ogg_get_optional_data; this->demux_plugin.demux_class = class_gen; - + this->status = DEMUX_FINISHED; #ifdef HAVE_THEORA theora_info_init (&this->t_info); theora_comment_init (&this->t_comment); -#endif +#endif this->chapter_info = 0; this->title = 0; @@ -2093,7 +2093,7 @@ static void *anx_init_class (xine_t *xine, void *data) { this->demux_class.open_plugin = anx_open_plugin; this->demux_class.description = N_("Annodex demux plugin"); this->demux_class.identifier = "Annodex"; - this->demux_class.mimetypes = + this->demux_class.mimetypes = "application/annodex: anx: Annodex media;" "application/x-annodex: anx: Annodex media;" "audio/annodex: axa: Annodex audio;" @@ -2152,7 +2152,7 @@ extern const demuxer_info_t dec_info_theora; void *theora_init_plugin (xine_t *xine, void *data); const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 27, "ogg", XINE_VERSION_CODE, &demux_info_ogg, ogg_init_class }, { PLUGIN_DEMUX, 27, "anx", XINE_VERSION_CODE, &demux_info_anx, anx_init_class }, #ifdef HAVE_VORBIS diff --git a/src/combined/xine_speex_decoder.c b/src/combined/xine_speex_decoder.c index 386010929..acdf5e394 100644 --- a/src/combined/xine_speex_decoder.c +++ b/src/combined/xine_speex_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -174,10 +174,10 @@ void read_metadata (speex_decoder_t *this, char * comments, int length) if ( !strncasecmp (speex_comment_keys[i].key, c, keylen) ) { char meta_info[(len - keylen) + 1]; - + lprintf ("known metadata %d %d\n", i, speex_comment_keys[i].xine_metainfo_index); - + strncpy(meta_info, &c[keylen], len-keylen); _x_meta_info_set_utf8(this->stream, speex_comment_keys[i].xine_metainfo_index, meta_info); } @@ -221,7 +221,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": invalid mode ID %u\n", modeID); return; } - + spx_mode = (SpeexMode *) speex_mode_list[modeID]; if (spx_mode->bitstream_version != spx_header->mode_bitstream_version) { @@ -243,7 +243,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->channels = spx_header->nb_channels; if (this->channels == 2) { SpeexCallback callback; - + callback.callback_id = SPEEX_INBAND_STEREO; callback.func = speex_std_stereo_request_handler; callback.data = &this->stereo; @@ -252,7 +252,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->nframes = spx_header->frames_per_packet; if (!this->nframes) this->nframes = 1; - + speex_decoder_ctl (this->st, SPEEX_GET_FRAME_SIZE, &this->frame_size); speex_decoder_ctl (this->st, SPEEX_GET_BITRATE, &bitrate); @@ -271,10 +271,10 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (!this->header_count) { int mode = _x_ao_channels2mode(this->channels); - + if (!this->output_open) { this->output_open = - (this->stream->audio_out->open) (this->stream->audio_out, + (this->stream->audio_out->open) (this->stream->audio_out, this->stream, 16, this->rate, @@ -283,7 +283,7 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } } } - + } else if (this->output_open) { int j; @@ -322,9 +322,9 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { audio_buffer->vpts = this->pts; this->pts=0; audio_buffer->num_frames = this->frame_size; - + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - + buf->pts=0; } @@ -336,20 +336,20 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { static void speex_dispose (audio_decoder_t *this_gen) { - speex_decoder_t *this = (speex_decoder_t *) this_gen; - + speex_decoder_t *this = (speex_decoder_t *) this_gen; + if (this->st) { speex_decoder_destroy (this->st); } speex_bits_destroy (&this->bits); - if (this->output_open) + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); free (this_gen); } -static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, +static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { speex_decoder_t *this ; @@ -383,7 +383,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, void *speex_init_plugin (xine_t *xine, void *data) { speex_class_t *this; - + this = (speex_class_t *) calloc(1, sizeof(speex_class_t)); this->decoder_class.open_plugin = open_plugin; @@ -394,7 +394,7 @@ void *speex_init_plugin (xine_t *xine, void *data) { return this; } -static const uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_SPEEX, 0 }; diff --git a/src/combined/xine_theora_decoder.c b/src/combined/xine_theora_decoder.c index 84cf8fb58..fbea502ca 100644 --- a/src/combined/xine_theora_decoder.c +++ b/src/combined/xine_theora_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2001-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -101,17 +101,17 @@ static void yuv2frame(yuv_buffer *yuv, vo_frame_t *frame, int offset_x, int offs crop_offset=offset_x+yuv->y_stride*offset_y; for(i=0;i<frame->height;i++) - xine_fast_memcpy(frame->base[0]+frame->pitches[0]*i, - yuv->y+crop_offset+yuv->y_stride*i, + xine_fast_memcpy(frame->base[0]+frame->pitches[0]*i, + yuv->y+crop_offset+yuv->y_stride*i, frame->width); crop_offset=(offset_x/2)+(yuv->uv_stride)*(offset_y/2); for(i=0;i<frame->height/2;i++){ - xine_fast_memcpy(frame->base[1]+frame->pitches[1]*i, - yuv->u+crop_offset+yuv->uv_stride*i, + xine_fast_memcpy(frame->base[1]+frame->pitches[1]*i, + yuv->u+crop_offset+yuv->uv_stride*i, frame->width/2); - xine_fast_memcpy(frame->base[2]+frame->pitches[2]*i, - yuv->v+crop_offset+yuv->uv_stride*i, + xine_fast_memcpy(frame->base[2]+frame->pitches[2]*i, + yuv->v+crop_offset+yuv->uv_stride*i, frame->width/2); } @@ -123,7 +123,7 @@ static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { if (buf->decoder_flags & BUF_FLAG_FRAME_START) { this->done=0; /*start from the beginnig*/ - this->reject=0;/*new packet - new try*/ + this->reject=0;/*new packet - new try*/ /*copy the ogg_packet struct and the sum, correct the adress of the packet*/ xine_fast_memcpy (&this->op, buf->content, sizeof(ogg_packet)); @@ -142,7 +142,7 @@ static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { } readin_op (this, buf->content, buf->size ); } - + if ((buf->decoder_flags & BUF_FLAG_FRAME_END) && !this->reject) { if ( this->done != this->op.bytes ) { printf ("libtheora: A packet changed its size during transfer - rejected\n"); @@ -156,8 +156,8 @@ static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { static void theora_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { /* - * decode data from buf and feed decoded frames to - * video output + * decode data from buf and feed decoded frames to + * video output */ theora_decoder_t *this = (theora_decoder_t *) this_gen; vo_frame_t *frame; @@ -195,7 +195,7 @@ static void theora_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } /*headers are now decoded. initialize the decoder*/ theora_decode_init (&this->t_state, &this->t_info); - + lprintf("theora stream is Theora %dx%d %.02f fps video.\n" " frame content is %dx%d with offset (%d,%d).\n" " pixel aspect is %d:%d.\n", @@ -346,7 +346,7 @@ static video_decoder_t *theora_open_plugin (video_decoder_class_t *class_gen, xi void *theora_init_plugin (xine_t *xine, void *data) { /*initialize our plugin*/ theora_class_t *this; - + this = (theora_class_t *) calloc(1, sizeof(theora_class_t)); this->decoder_class.open_plugin = theora_open_plugin; diff --git a/src/combined/xine_vorbis_decoder.c b/src/combined/xine_vorbis_decoder.c index cc157eb3f..9864177d6 100644 --- a/src/combined/xine_vorbis_decoder.c +++ b/src/combined/xine_vorbis_decoder.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -88,7 +88,7 @@ static void vorbis_reset (audio_decoder_t *this_gen) { /* clear block first, as it might contain allocated data */ vorbis_block_clear(&this->vb); - vorbis_block_init(&this->vd,&this->vb); + vorbis_block_init(&this->vd,&this->vb); } static void vorbis_discontinuity (audio_decoder_t *this_gen) { @@ -146,8 +146,8 @@ static void get_metadata (vorbis_decoder_t *this) { static void vorbis_check_bufsize (vorbis_decoder_t *this, int size) { if (size > this->bufsize) { this->bufsize = size + size / 2; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("vorbis: increasing buffer to %d to avoid overflow.\n"), + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("vorbis: increasing buffer to %d to avoid overflow.\n"), this->bufsize); this->buf = realloc(this->buf, this->bufsize); } @@ -170,87 +170,87 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* reset accumultaion buffer */ this->size = 0; - + if ( (buf->decoder_flags & BUF_FLAG_HEADER) && !(buf->decoder_flags & BUF_FLAG_STDHEADER) ) { - + lprintf ("%d headers to go\n", this->header_count); - + if (this->header_count) { int res = 0; - + if (this->header_count == 3) this->op.b_o_s = 1; - + if ( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ) { /* error case; not a vorbis header */ xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res); xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64); return; } - + this->header_count--; - + if (!this->header_count) { - + int mode = AO_CAP_MODE_MONO; - + get_metadata (this); - + mode = _x_ao_channels2mode(this->vi.channels); - + this->convsize=MAX_NUM_SAMPLES/this->vi.channels; - + if (!this->output_open) { - this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, + this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, this->stream, 16, this->vi.rate, mode) ; - - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, + + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, this->vi.bitrate_nominal); - + } - + /* OK, got and parsed all three headers. Initialize the Vorbis * packet->PCM decoder. */ lprintf("all three headers parsed. initializing decoder.\n"); - /* initialize central decode state */ - vorbis_synthesis_init(&this->vd,&this->vi); + /* initialize central decode state */ + vorbis_synthesis_init(&this->vd,&this->vi); /* initialize local state for most of the decode so multiple - * block decodes can proceed in parallel. We could init + * block decodes can proceed in parallel. We could init * multiple vorbis_block structures for vd here */ - vorbis_block_init(&this->vd,&this->vb); + vorbis_block_init(&this->vd,&this->vb); } } - + } else if (this->output_open) { - + float **pcm; int samples; - - if(vorbis_synthesis(&this->vb,&this->op)==0) + + if(vorbis_synthesis(&this->vb,&this->op)==0) vorbis_synthesis_blockin(&this->vd,&this->vb); - + if (buf->pts!=0) this->pts=buf->pts; - + while ((samples=vorbis_synthesis_pcmout(&this->vd,&pcm))>0){ - + /* **pcm is a multichannel float vector. In stereo, for * example, pcm[0][...] is left, and pcm[1][...] is right. * samples is the size of each channel. Convert the float * values (-1.<=range<=1.) to whatever PCM format and write * it out */ - + int i,j; int bout=(samples<this->convsize?samples:this->convsize); audio_buffer_t *audio_buffer; - + audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); - + /* convert floats to 16 bit signed ints (host order) and interleave */ for(i=0;i<this->vi.channels;i++){ @@ -269,15 +269,15 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { ptr+=this->vi.channels; } } - + audio_buffer->vpts = this->pts; this->pts=0; audio_buffer->num_frames = bout; - + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - + buf->pts=0; - + /* tell libvorbis how many samples we actually consumed */ vorbis_synthesis_read(&this->vd,bout); } @@ -289,7 +289,7 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { static void vorbis_dispose (audio_decoder_t *this_gen) { - vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen; + vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen; if( !this->header_count ) { lprintf("deinitializing decoder\n"); @@ -302,7 +302,7 @@ static void vorbis_dispose (audio_decoder_t *this_gen) { vorbis_info_clear(&this->vi); /* must be called last */ - if (this->output_open) + if (this->output_open) this->stream->audio_out->close (this->stream->audio_out, this->stream); lprintf("libvorbis instance destroyed\n"); @@ -310,7 +310,7 @@ static void vorbis_dispose (audio_decoder_t *this_gen) { free (this_gen); } -static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, +static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { vorbis_decoder_t *this ; @@ -345,7 +345,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, void *vorbis_init_plugin (xine_t *xine, void *data) { vorbis_class_t *this; - + this = (vorbis_class_t *) calloc(1, sizeof(vorbis_class_t)); this->decoder_class.open_plugin = open_plugin; @@ -356,7 +356,7 @@ void *vorbis_init_plugin (xine_t *xine, void *data) { return this; } -static const uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_VORBIS, 0 }; |