diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2010-02-06 01:50:55 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2010-02-06 01:50:55 +0000 |
commit | 66f60ab3969928227bd0fa57df451e7bc58f2ff7 (patch) | |
tree | 7ca844a04f03d4f73f24202d7d92aa7aca018931 | |
parent | b261d83b69692cfa13aada3266f3c832861a48a8 (diff) | |
parent | fd6d1cc6ccda5ff8319ae0eb8417c5db5700938a (diff) | |
download | xine-lib-66f60ab3969928227bd0fa57df451e7bc58f2ff7.tar.gz xine-lib-66f60ab3969928227bd0fa57df451e7bc58f2ff7.tar.bz2 |
Merge from 1.1.
--HG--
rename : src/combined/decoder_wavpack.c => src/combined/wavpack_decoder.c
rename : src/demuxers/demux_ogg.c => src/combined/xine_ogg_demuxer.c
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_video_decoder.c | 5 | ||||
-rw-r--r-- | src/combined/wavpack_decoder.c | 3 | ||||
-rw-r--r-- | src/combined/xine_ogg_demuxer.c | 113 | ||||
-rw-r--r-- | src/input/libdvdnav/remap.c | 2 | ||||
-rw-r--r-- | src/input/net_buf_ctrl.c | 6 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 1 |
7 files changed, 108 insertions, 26 deletions
@@ -75,9 +75,11 @@ xine-lib (1.1.18) 20??-??-?? various problems with FLAC playback. * Build fix (undefined symbol) for when using older ffmpeg. * TTA demuxer fixes; allow seeking. - * More meta-information tags. (Nothing sets these yet, though.) + * More meta-information tags. + Only the Ogg demuxer knows about these at present. * Added basic support for .qtl (Quicktime media link). * "Fixed" playback of 24-bit FLAC. + * Work around an ffmpeg bug concerning Sorenson Video 3. xine-lib (1.1.17) 2009-12-01 * Add support for Matroska SIMPLEBLOCK. diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 726945acd..aaec97ccd 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -346,8 +346,9 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) } if (this->class->thread_count > 1) { - avcodec_thread_init(this->context, this->class->thread_count); - this->context->thread_count = this->class->thread_count; + if (this->codec->id != CODEC_ID_SVQ3 + && avcodec_thread_init(this->context, this->class->thread_count) != -1) + this->context->thread_count = this->class->thread_count; } this->context->skip_loop_filter = skip_loop_filter_enum_values[this->class->skip_loop_filter_enum]; diff --git a/src/combined/wavpack_decoder.c b/src/combined/wavpack_decoder.c index 49c700087..253180cf2 100644 --- a/src/combined/wavpack_decoder.c +++ b/src/combined/wavpack_decoder.c @@ -101,6 +101,9 @@ static int xine_buffer_set_pos_rel(void *const this_gen, const int32_t delta, this->buf_pos = this->buf_size - delta; return 0; + + default: + return -1; } return -1; diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index 4671c12bd..6aa89c142 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -151,7 +151,7 @@ typedef struct demux_ogg_s { off_t avg_bitrate; - char *title; + char *meta[XINE_STREAM_INFO_MAX]; chapter_info_t *chapter_info; xine_event_queue_t *event_queue; @@ -417,9 +417,79 @@ static void ogg_handle_event (demux_ogg_t *this) { return; } + +#define OGG_META(TAG,APPEND) { #TAG"=", XINE_META_INFO_##TAG, APPEND } +#define OGG_META_L(TAG,APPEND,META) { #TAG"=", XINE_META_INFO_##META, APPEND } +static const struct ogg_meta { + char tag[16]; + int meta; + int append; +} metadata[] = { + OGG_META (ALBUM, 0), + OGG_META (ARTIST, 0), + OGG_META (PUBLISHER, 0), + OGG_META (COPYRIGHT, 0), + OGG_META (LICENSE, 0), + OGG_META (TITLE, 0), + OGG_META_L (TRACKNUMBER, 0, TRACK_NUMBER), + OGG_META (COMPOSER, 1), + OGG_META (ARRANGER, 1), + OGG_META (LYRICIST, 1), + OGG_META (AUTHOR, 1), + OGG_META (CONDUCTOR, 1), + OGG_META (PERFORMER, 1), + OGG_META (ENSEMBLE, 1), + OGG_META (OPUS, 0), + OGG_META (PART, 0), + OGG_META (PARTNUMBER, 0), + OGG_META (GENRE, 1), + OGG_META_L (DATE, 1, YEAR), /* hmm... */ + OGG_META (LOCATION, 0), + OGG_META (COMMENT, 0), +}; + +/* ensure that those marked "append" are cleared */ +/* FIXME: is this useful? Should they be cleared on first write? */ +static void prepare_read_comments (demux_ogg_t *this) +{ + int i; + + for (i = 0; i < sizeof (metadata) / sizeof (struct ogg_meta); ++i) + if (metadata[i].append) { + free (this->meta[metadata[i].meta]); + this->meta[metadata[i].meta] = NULL; + } +} + +static int read_comments (demux_ogg_t *this, const char *comment) +{ + int i; + + for (i = 0; i < sizeof (metadata) / sizeof (struct ogg_meta); ++i) { + size_t ml = strlen (metadata[i].tag); + if (!strncasecmp (metadata[i].tag, comment, ml) && comment[ml]) { + if (metadata[i].append && this->meta[metadata[i].meta]) { + char *newstr; + asprintf (&newstr, "%s\n%s", this->meta[metadata[i].meta], comment + ml); + free (this->meta[metadata[i].meta]); + this->meta[metadata[i].meta] = newstr; + } + else { + free (this->meta[metadata[i].meta]); + this->meta[metadata[i].meta] = strdup (comment + ml); + } + _x_meta_info_set_utf8(this->stream, metadata[i].meta, this->meta[metadata[i].meta]); + return 1; + } + } + return 0; +} + /* * utility function to read a LANGUAGE= line from the user_comments, * to label audio and spu streams + * utility function to read CHAPTER*=, TITLE= etc. from the user_comments, + * to name (parts of) the stream */ static void read_language_comment (demux_ogg_t *this, ogg_packet *op, int stream_num) { #ifdef HAVE_VORBIS @@ -437,11 +507,12 @@ static void read_language_comment (demux_ogg_t *this, ogg_packet *op, int stream if ( vorbis_synthesis_headerin(&vi, &vc, op) >= 0) { ptr=vc.user_comments; while(*ptr) { - comment=*ptr; + comment=*ptr++; if ( !strncasecmp ("LANGUAGE=", comment, 9) ) { this->si[stream_num]->language = strdup (comment + strlen ("LANGUAGE=") ); } - ++ptr; + else + read_comments (this, comment); } } vorbis_comment_clear(&vc); @@ -450,8 +521,8 @@ static void read_language_comment (demux_ogg_t *this, ogg_packet *op, int stream } /* - * utility function to read CHAPTER*= and TITLE= from the user_comments, - * to name parts of the videostream + * utility function to read CHAPTER*= from the user_comments, + * to name parts of the stream */ static void read_chapter_comment (demux_ogg_t *this, ogg_packet *op) { #ifdef HAVE_VORBIS @@ -470,13 +541,14 @@ static void read_chapter_comment (demux_ogg_t *this, ogg_packet *op) { char *chapter_time = 0; char *chapter_name = 0; int chapter_no = 0; + ptr=vc.user_comments; + while(*ptr) { - comment=*ptr; - if ( !strncasecmp ("TITLE=", comment,6) ) { - this->title = strdup (comment + strlen ("TITLE=") ); - _x_meta_info_set(this->stream, XINE_META_INFO_TITLE, this->title); - } + comment=*ptr++; + if (read_comments (this, comment)) + continue; + if ( !chapter_time && strlen(comment) == 22 && !strncasecmp ("CHAPTER" , comment, 7) && isdigit(*(comment+7)) && isdigit(*(comment+8)) && @@ -516,7 +588,6 @@ static void read_chapter_comment (demux_ogg_t *this, ogg_packet *op) { chapter_no = 0; chapter_time = chapter_name = 0; } - ++ptr; } } vorbis_comment_clear(&vc); @@ -552,13 +623,13 @@ static void update_chapter_display (demux_ogg_t *this, int stream_num, ogg_packe this->chapter_info->current_chapter = chapter; if (chapter >= 0) { - if (this->title) { - data.str_len = snprintf(data.str, sizeof(data.str), "%s / %s", this->title, this->chapter_info->entries[chapter].name); + if (this->meta[XINE_META_INFO_TITLE]) { + data.str_len = snprintf(data.str, sizeof(data.str), "%s / %s", this->meta[XINE_META_INFO_TITLE], this->chapter_info->entries[chapter].name); } else { strncpy(data.str, this->chapter_info->entries[chapter].name, sizeof(data.str)-1); } } else { - strncpy(data.str, this->title, sizeof(data.str)); + strncpy(data.str, this->meta[XINE_META_INFO_TITLE], sizeof(data.str)); } if ( data.str_len == 0 ) data.str_len = strlen(data.str); @@ -1684,9 +1755,9 @@ static void demux_ogg_dispose (demux_plugin_t *this_gen) { free (this->chapter_info->entries); free (this->chapter_info); } - if (this->title){ - free (this->title); - } + for (i = 0; i < XINE_STREAM_INFO_MAX; ++i) + free (this->meta[i]); + if (this->event_queue) xine_event_dispose_queue (this->event_queue); @@ -2001,6 +2072,7 @@ static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen, input_plugin_t *input) { demux_ogg_t *this; + int i; if (detect_anx_content(stream->content_detection_method, class_gen, input) == 0) return NULL; @@ -2034,8 +2106,9 @@ static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen, theora_comment_init (&this->t_comment); #endif + for (i = 0; i < XINE_STREAM_INFO_MAX; ++i) + this->meta[i] = NULL; this->chapter_info = 0; - this->title = 0; this->event_queue = xine_event_new_queue (this->stream); return &this->demux_plugin; @@ -2046,6 +2119,7 @@ static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen, input_plugin_t *input) { demux_ogg_t *this; + int i; if (detect_ogg_content(stream->content_detection_method, class_gen, input) == 0) return NULL; @@ -2076,7 +2150,8 @@ static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen, #endif this->chapter_info = 0; - this->title = 0; + for (i = 0; i < XINE_STREAM_INFO_MAX; ++i) + this->meta[i] = NULL; this->event_queue = xine_event_new_queue (this->stream); return &this->demux_plugin; diff --git a/src/input/libdvdnav/remap.c b/src/input/libdvdnav/remap.c index df0be29ce..42bb8b3dd 100644 --- a/src/input/libdvdnav/remap.c +++ b/src/input/libdvdnav/remap.c @@ -216,7 +216,7 @@ remap_t* remap_loadmap( char *title) { remap_add_node( map, tmp); } } - close (fp); /* ignoring errors... */ + fclose (fp); /* ignoring errors... */ if (map->nblocks == 0 && map->debug == 0) return NULL; return map; diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index e14897699..b7a52eb2b 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -117,9 +117,8 @@ static void display_stats (nbc_t *this) { static const char buffering[2][4] = {" ", "buf"}; static const char enabled[2][4] = {"off", "on "}; - printf("bufing: %d, enb: %d\n", this->buffering, this->enabled); printf("net_buf_ctrl: vid %3d%% %4.1fs %4" PRId64 "kbps %1d, "\ - "aud %3d%% %4.1fs %4" PRId64 "kbps %1d, %s %s\r", + "aud %3d%% %4.1fs %4" PRId64 "kbps %1d, %s %s%c", this->video_fifo_fill, (float)(this->video_fifo_length / 1000), this->video_br / 1000, @@ -129,7 +128,8 @@ static void display_stats (nbc_t *this) { this->audio_br / 1000, this->audio_in_disc, buffering[this->buffering], - enabled[this->enabled] + enabled[this->enabled], + isatty (stdout) ? '\r' : '\n' ); fflush(stdout); } diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 5689337da..29b4b3543 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -335,6 +335,7 @@ static void ticket_dispose(xine_ticket_t *this) { pthread_cond_destroy(&this->issued); pthread_cond_destroy(&this->revoked); + free(this->holder_threads); free(this); } |