From 2a0fe10e3e5dd6da617d9f7f675e0778be957314 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 18 Nov 2011 18:22:07 +0000 Subject: Use POSIX timers where available for determining which memcpy method to use. --- src/xine-utils/memcpy.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index 9056749e2..fa568c485 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -408,7 +408,18 @@ static struct { { NULL, NULL, 0, 0 } }; -#if (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(HAVE_SYS_TIMES_H) +#ifdef HAVE_POSIX_TIMERS +/* Prefer clock_gettime() where available. */ +static int64_t _x_gettime(void) +{ + struct timespec tm; + return (clock_gettime (CLOCK_THREAD_CPUTIME_ID, &tm) == -1) + ? times (NULL) + : (int64_t)tm.tv_sec * 1e9 + tm.tv_nsec; +} +# define rdtsc(x) _x_gettime() + +#elif (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(HAVE_SYS_TIMES_H) static int64_t rdtsc(int config_flags) { int64_t x; @@ -511,6 +522,12 @@ void xine_probe_fast_memcpy(xine_t *xine) memset(buf1,0,BUFSIZE); memset(buf2,0,BUFSIZE); + /* some initial activity to ensure that we're not running slowly :-) */ + for(j=0;j<50;j++) { + memcpy_method[i].function(buf2,buf1,BUFSIZE); + memcpy_method[i].function(buf1,buf2,BUFSIZE); + } + for(i=1; memcpy_method[i].name; i++) { if( (config_flags & memcpy_method[i].cpu_require) != -- cgit v1.2.3 From 453b60f0014d12c69a0a2fe307beb970ad17d2b9 Mon Sep 17 00:00:00 2001 From: Torsten Jager Date: Fri, 4 Nov 2011 14:27:53 +0200 Subject: demux_ts: Better support for dynamically changing PMTs --- src/demuxers/demux_ts.c | 268 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 195 insertions(+), 73 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index a5c715c62..b22f1ffaa 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -291,6 +291,7 @@ typedef struct { buf_element_t *buf; unsigned int counter; uint16_t descriptor_tag; /* +0x100 for PES stream IDs (no available TS descriptor tag?) */ + uint8_t keep; /* used by demux_ts_dynamic_pmt_*() */ int corrupted_pes; int input_normpos; @@ -408,6 +409,153 @@ typedef struct { config_values_t *config; } demux_ts_class_t; +/* TJ. dynamic PMT support. The idea is: + First, reuse unchanged pids and add new ones. + Then, comb out those who are no longer referenced. + For example, the Kaffeine dvb frontend preserves original pids but only + sends the currently user selected ones, plus matching generated pat/pmt */ + +static int demux_ts_dynamic_pmt_find (demux_ts_t *this, + int pid, int type, unsigned int descriptor_tag) { + unsigned int i; + demux_ts_media *m; + for (i = 0; i < this->media_num; i++) { + m = &this->media[i]; + if ((m->pid == pid) && ((m->type & BUF_MAJOR_MASK) == type)) { + /* mark this media decriptor for reuse */ + m->keep = 1; + return i; + } + } + if (i < MAX_PIDS) { + /* prepare new media descriptor */ +#ifdef LOG_DYNAMIC_PMT + char *name = ""; + if (type == BUF_VIDEO_BASE) name = "video"; + else if (type == BUF_AUDIO_BASE) name = "audio"; + else if (type == BUF_SPU_BASE) name = "subtitle"; + printf ("demux_ts: new %s pid %d\n", name, pid); +#endif + m = &this->media[i]; + if (type == BUF_AUDIO_BASE) { + /* allocate new audio track as well */ + if (this->audio_tracks_count >= MAX_AUDIO_TRACKS) { + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_ts: too many audio PIDs, ignoring pid %d\n", pid); + return -1; + } + m->type = type | this->audio_tracks_count; + this->audio_tracks[this->audio_tracks_count].pid = pid; + this->audio_tracks[this->audio_tracks_count].media_index = i; + this->audio_tracks_count++; + m->fifo = this->stream->audio_fifo; + } else { + m->type = type; + m->fifo = this->stream->video_fifo; + } + m->pid = pid; + + m->buf = 0; + m->counter = INVALID_CC; + m->corrupted_pes = 1; + + m->descriptor_tag = descriptor_tag; + + m->keep = 1; + this->media_num++; + return i; + } + /* table full */ + return -1; +} + +static void demux_ts_dynamic_pmt_clean (demux_ts_t *this) { + int i, count = 0, tracks = 0, spus = 0; + /* densify media table */ + for (i = 0; i < this->media_num; i++) { + demux_ts_media *m = &this->media[i]; + int type = m->type & BUF_MAJOR_MASK; + int chan = m->type & 0xff; + if (m->keep) { + m->keep = 0; + if (type == BUF_VIDEO_BASE) { + /* adjust single video link */ + this->videoMedia = count; + } else if (type == BUF_AUDIO_BASE) { + /* densify audio track table */ + this->audio_tracks[chan].media_index = count; + if (chan > tracks) { + m->type = (m->type & ~0xff) | tracks; + this->audio_tracks[tracks] = this->audio_tracks[chan]; + } + tracks++; + } else if (type == BUF_SPU_BASE) { + /* spu language table has already been rebuilt from scratch. + Adjust backlinks only */ + while ((spus < this->spu_langs_count) && (this->spu_langs[spus].pid == m->pid)) { + this->spu_langs[spus].media_index = count; + spus++; + } + } + if (i > count) this->media[count] = *m; + count++; + } else { + /* drop this no longer needed media descriptor */ +#ifdef LOG_DYNAMIC_PMT + char *name = ""; + if (type == BUF_VIDEO_BASE) name = "video"; + else if (type == BUF_AUDIO_BASE) name = "audio"; + else if (type == BUF_SPU_BASE) name = "subtitle"; + printf ("demux_ts: dropped %s pid %d\n", name, m->pid); +#endif + if (m->buf) { + m->buf->free_buffer (m->buf); + m->buf = NULL; + } + m->pid = INVALID_PID; + } + } + if ((tracks < this->audio_tracks_count) && this->audio_fifo) { + /* at least 1 audio track removed, tell audio decoder loop */ + buf_element_t *b = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); + b->type = BUF_CONTROL_RESET_TRACK_MAP; + b->decoder_info[1] = -1; + this->audio_fifo->put (this->audio_fifo, b); +#ifdef LOG_DYNAMIC_PMT + printf ("demux_ts: new audio track map\n"); +#endif + } +#ifdef LOG_DYNAMIC_PMT + printf ("demux_ts: using %d pids, %d audio %d subtitle channels\n", count, tracks, spus); +#endif + /* adjust table sizes */ + this->media_num = count; + this->audio_tracks_count = tracks; + /* should really have no effect */ + this->spu_langs_count = spus; +} + +static void demux_ts_dynamic_pmt_clear (demux_ts_t *this) { + unsigned int i; + for (i = 0; i < this->media_num; i++) { + if (this->media[i].buf) { + this->media[i].buf->free_buffer (this->media[i].buf); + this->media[i].buf = NULL; + } + } + this->media_num = 0; + + this->videoPid = INVALID_PID; + this->audio_tracks_count = 0; + this->spu_pid = INVALID_PID; + this->spu_langs_count = 0; + + this->pcr_pid = INVALID_PID; + + this->last_pmt_crc = 0; +} + + static void demux_ts_tbre_reset (demux_ts_t *this) { if (this->tbre_time <= TBRE_TIME) { this->tbre_pid = INVALID_PID; @@ -576,6 +724,9 @@ static void demux_ts_update_spu_channel(demux_ts_t *this) this->spu_pid = lang->pid; this->spu_media = lang->media_index; + /* multiple spu langs can share same media descriptor */ + this->media[lang->media_index].type = + (this->media[lang->media_index].type & ~0xff) | this->current_spu_channel; #ifdef TS_LOG printf("demux_ts: DVBSUB: selecting lang: %s page %ld %ld\n", lang->desc.lang, lang->desc.comp_page_id, lang->desc.aux_page_id); @@ -779,11 +930,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, /* force PMT reparsing when pmt_pid changes */ if (this->pmt_pid[program_count] != pmt_pid) { this->pmt_pid[program_count] = pmt_pid; - this->audio_tracks_count = 0; - this->last_pmt_crc = 0; - this->videoPid = INVALID_PID; - this->spu_pid = INVALID_PID; - this->pcr_pid = INVALID_PID; + demux_ts_dynamic_pmt_clear (this); if (this->pmt[program_count] != NULL) { free(this->pmt[program_count]); @@ -1147,29 +1294,6 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, } } -/* - * Create a buffer for a PES stream. - */ -static void demux_ts_pes_new(demux_ts_t*this, - unsigned int mediaIndex, - unsigned int pid, - fifo_buffer_t *fifo, - uint16_t descriptor) { - - demux_ts_media *m = &this->media[mediaIndex]; - - /* new PID seen - initialise stuff */ - m->pid = pid; - m->fifo = fifo; - - if (m->buf != NULL) m->buf->free_buffer(m->buf); - m->buf = NULL; - m->counter = INVALID_CC; - m->descriptor_tag = descriptor; - m->corrupted_pes = 1; -} - - /* Find the first ISO 639 language descriptor (tag 10) and * store the 3-char code in dest, nullterminated. If no * code is found, zero out dest. @@ -1279,6 +1403,7 @@ static void demux_ts_parse_pmt (demux_ts_t *this, char *ptr = NULL; unsigned char len; unsigned int offset=0; + int mi; /* * A new section should start with the payload unit start @@ -1425,7 +1550,6 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num * PMT has changed (e.g. an IPTV streamer that's just changed its source), * we'll get new PIDs that we should follow. */ - this->audio_tracks_count = 0; this->videoPid = INVALID_PID; this->spu_pid = INVALID_PID; @@ -1481,9 +1605,12 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num #ifdef TS_PMT_LOG printf ("demux_ts: PMT video pid 0x%.4x type %2.2x\n", pid, stream[0]); #endif - demux_ts_pes_new(this, this->media_num, pid, this->video_fifo,stream[0]); - this->videoMedia = this->media_num; - this->videoPid = pid; + + mi = demux_ts_dynamic_pmt_find (this, pid, BUF_VIDEO_BASE, stream[0]); + if (mi >= 0) { + this->videoMedia = mi; + this->videoPid = pid; + } } break; @@ -1492,18 +1619,17 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num case ISO_13818_PART7_AUDIO: case ISO_14496_PART3_AUDIO: if (this->audio_tracks_count < MAX_AUDIO_TRACKS) { - if (apid_check(this, pid) < 0) { + + mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]); + if (mi >= 0) { #ifdef TS_PMT_LOG - printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]); + printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]); #endif - demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo,stream[0]); - this->audio_tracks[this->audio_tracks_count].pid = pid; - this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; - this->media[this->media_num].type = this->audio_tracks_count; - demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang, - stream + 5, stream_info_length); - this->audio_tracks_count++; + demux_ts_get_lang_desc (this, + this->audio_tracks[this->media[mi].type & 0xff].lang, + stream + 5, stream_info_length); } + } break; case ISO_13818_PRIVATE: @@ -1522,28 +1648,21 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num break; case ISO_13818_PES_PRIVATE: for (i = 5; i < coded_length; i += stream[i+1] + 2) { - if (((stream[i] == DESCRIPTOR_AC3) || (stream[i] == DESCRIPTOR_EAC3)) && - (this->audio_tracks_count < MAX_AUDIO_TRACKS)) { - if (apid_check(this, pid) < 0) { + + if ((stream[i] == DESCRIPTOR_AC3) || (stream[i] == DESCRIPTOR_EAC3)) { + mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, + stream[i] == DESCRIPTOR_AC3 ? STREAM_AUDIO_AC3 : HDMV_AUDIO_84_EAC3); + if (mi >= 0) { #ifdef TS_PMT_LOG printf ("demux_ts: PMT AC3 audio pid 0x%.4x type %2.2x\n", pid, stream[0]); #endif - if (stream[i] == DESCRIPTOR_AC3) - demux_ts_pes_new(this, this->media_num, pid, - this->audio_fifo, STREAM_AUDIO_AC3); - else - demux_ts_pes_new(this, this->media_num, pid, - this->audio_fifo, HDMV_AUDIO_84_EAC3); - - this->audio_tracks[this->audio_tracks_count].pid = pid; - this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; - this->media[this->media_num].type = this->audio_tracks_count; - demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang, - stream + 5, stream_info_length); - this->audio_tracks_count++; + demux_ts_get_lang_desc (this, + this->audio_tracks[this->media[mi].type & 0xff].lang, + stream + 5, stream_info_length); break; } } + /* Teletext */ else if (stream[i] == DESCRIPTOR_TELETEXT) { @@ -1561,6 +1680,10 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num else if (stream[i] == DESCRIPTOR_DVBSUB) { int pos; + + mi = demux_ts_dynamic_pmt_find (this, pid, BUF_SPU_BASE, stream[0]); + if (mi < 0) break; + for (pos = i + 2; pos + 8 <= i + 2 + stream[i + 1] && this->spu_langs_count < MAX_SPU_LANGS; @@ -1578,9 +1701,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num lang->desc.aux_page_id = (stream[pos + 6] << 8) | stream[pos + 7]; lang->pid = pid; - lang->media_index = this->media_num; - this->media[this->media_num].type = no; - demux_ts_pes_new(this, this->media_num, pid, this->video_fifo, stream[0]); + lang->media_index = mi; demux_send_special_spu_buf( this, BUF_SPU_DVB, no ); #ifdef TS_LOG printf("demux_ts: DVBSUB: pid 0x%.4x: %s page %ld %ld type %2.2x\n", @@ -1615,15 +1736,17 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num break; } + mi = demux_ts_dynamic_pmt_find (this, pid, BUF_SPU_BASE, stream[0]); + if (mi < 0) break; + + demux_ts_spu_lang *lang = &this->spu_langs[this->spu_langs_count]; memset(lang->desc.lang, 0, sizeof(lang->desc.lang)); /*memcpy(lang->desc.lang, &stream[pos], 3);*/ /*lang->desc.lang[3] = 0;*/ lang->pid = pid; - lang->media_index = this->media_num; - this->media[this->media_num].type = this->spu_langs_count; - demux_ts_pes_new(this, this->media_num, pid, this->video_fifo, stream[0]); + lang->media_index = mi; demux_send_special_spu_buf( this, BUF_SPU_HDMV, this->spu_langs_count ); this->spu_langs_count++; #ifdef TS_PMT_LOG @@ -1642,8 +1765,10 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num * if is does, we tag this as an audio stream. * FIXME: This will need expanding if we ever see a DTS or other media format here. */ - if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) { - if (apid_check(this,pid) < 0) { + if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) { + + mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]); + if (mi >= 0) { uint32_t format_identifier=0; demux_ts_get_reg_desc(this, &format_identifier, stream + 5, stream_info_length); @@ -1652,13 +1777,9 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num ( format_identifier == 0) || ((format_identifier == 0x48444d56 || this->hdmv>0) && stream[0] == HDMV_AUDIO_80_PCM) /* BluRay PCM */) { - demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo, stream[0]); - this->audio_tracks[this->audio_tracks_count].pid = pid; - this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; - this->media[this->media_num].type = this->audio_tracks_count; - demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang, - stream + 5, stream_info_length); - this->audio_tracks_count++; + demux_ts_get_lang_desc (this, + this->audio_tracks[this->media[mi].type & 0xff].lang, + stream + 5, stream_info_length); break; } } @@ -1674,11 +1795,12 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num } break; } - this->media_num++; stream += coded_length; section_length -= coded_length; } + demux_ts_dynamic_pmt_clean (this); + /* * Get the current PCR PID. */ -- cgit v1.2.3 From 3f60113bfcb39e76106a79f9f092e21ad4c897ff Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 4 Nov 2011 23:37:20 +0200 Subject: demux_ts: Fixed incorrect usage of HDMV_AUDIO_84_EAC3 --- src/demuxers/demux_ts.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index b22f1ffaa..5d6da28ed 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -250,6 +250,9 @@ HDMV_SPU_INTERACTIVE = 0x91, HDMV_SPU_TEXT = 0x92, + /* pseudo tags */ + STREAM_AUDIO_EAC3 = (DESCRIPTOR_EAC3 << 8), + } streamType; #define WRAP_THRESHOLD 270000 @@ -1059,7 +1062,8 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, * these "raw" streams may begin with a byte that looks like a stream type. * For audio streams, m->type already contains the stream no. */ - if(m->descriptor_tag == HDMV_AUDIO_84_EAC3) { + if(m->descriptor_tag == HDMV_AUDIO_84_EAC3 || + m->descriptor_tag == STREAM_AUDIO_EAC3) { m->size = packet_len; m->type |= BUF_AUDIO_EAC3; return 1; @@ -1651,7 +1655,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num if ((stream[i] == DESCRIPTOR_AC3) || (stream[i] == DESCRIPTOR_EAC3)) { mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, - stream[i] == DESCRIPTOR_AC3 ? STREAM_AUDIO_AC3 : HDMV_AUDIO_84_EAC3); + stream[i] == DESCRIPTOR_AC3 ? STREAM_AUDIO_AC3 : STREAM_AUDIO_EAC3); if (mi >= 0) { #ifdef TS_PMT_LOG printf ("demux_ts: PMT AC3 audio pid 0x%.4x type %2.2x\n", pid, stream[0]); -- cgit v1.2.3 From 7a0c1812bdcf177ed5bfeff7ed71d80bc663701e Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 4 Nov 2011 23:43:21 +0200 Subject: demux_ts: Detect DTS in PS1 --- src/demuxers/demux_ts.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 5d6da28ed..0df7a47c2 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -252,6 +252,7 @@ /* pseudo tags */ STREAM_AUDIO_EAC3 = (DESCRIPTOR_EAC3 << 8), + STREAM_AUDIO_DTS = (DESCRIPTOR_DTS << 8), } streamType; @@ -1079,7 +1080,8 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->type |= BUF_AUDIO_A52; return 1; - } else if (m->descriptor_tag == HDMV_AUDIO_82_DTS || + } else if (m->descriptor_tag == STREAM_AUDIO_DTS || + m->descriptor_tag == HDMV_AUDIO_82_DTS || m->descriptor_tag == HDMV_AUDIO_86_DTS_HD_MA ) { m->size = packet_len; m->type |= BUF_AUDIO_DTS; @@ -1653,9 +1655,11 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num case ISO_13818_PES_PRIVATE: for (i = 5; i < coded_length; i += stream[i+1] + 2) { - if ((stream[i] == DESCRIPTOR_AC3) || (stream[i] == DESCRIPTOR_EAC3)) { + if ((stream[i] == DESCRIPTOR_AC3) || (stream[i] == DESCRIPTOR_EAC3) || (stream[i] == DESCRIPTOR_DTS)) { mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, - stream[i] == DESCRIPTOR_AC3 ? STREAM_AUDIO_AC3 : STREAM_AUDIO_EAC3); + stream[i] == DESCRIPTOR_AC3 ? STREAM_AUDIO_AC3 : + stream[i] == DESCRIPTOR_DTS ? STREAM_AUDIO_DTS : + STREAM_AUDIO_EAC3); if (mi >= 0) { #ifdef TS_PMT_LOG printf ("demux_ts: PMT AC3 audio pid 0x%.4x type %2.2x\n", pid, stream[0]); -- cgit v1.2.3 From c1d6ea9276a15a7df88169fd67d788a14ffede5e Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 4 Nov 2011 23:46:29 +0200 Subject: demux_ts: do not demux unknown streams (where id >= 0x80) --- src/demuxers/demux_ts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 0df7a47c2..3b1cc7cd1 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1775,8 +1775,6 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num */ if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) { - mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]); - if (mi >= 0) { uint32_t format_identifier=0; demux_ts_get_reg_desc(this, &format_identifier, stream + 5, stream_info_length); @@ -1785,6 +1783,8 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num ( format_identifier == 0) || ((format_identifier == 0x48444d56 || this->hdmv>0) && stream[0] == HDMV_AUDIO_80_PCM) /* BluRay PCM */) { + mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]); + if (mi >= 0) { demux_ts_get_lang_desc (this, this->audio_tracks[this->media[mi].type & 0xff].lang, stream + 5, stream_info_length); -- cgit v1.2.3 From 421f931234514296a9a549196a7da5510bf33c8e Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 4 Nov 2011 23:48:41 +0200 Subject: demux_ts: improved logging for streams >= 0x80 --- src/demuxers/demux_ts.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 3b1cc7cd1..1d7fff494 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1788,10 +1788,13 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num demux_ts_get_lang_desc (this, this->audio_tracks[this->media[mi].type & 0xff].lang, stream + 5, stream_info_length); +#ifdef TS_PMT_LOG + printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]); +#endif break; } } - } else { + } #ifdef TS_PMT_LOG printf ("demux_ts: PMT unknown stream_type: 0x%.2x pid: 0x%.4x\n", stream[0], pid); @@ -1800,7 +1803,6 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num printf ("%.2x ", stream[i]); printf ("\n"); #endif - } break; } stream += coded_length; -- cgit v1.2.3 From 0c0d8ab4e9aa7fa2195a41a7ef4961e2362fa7bd Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 4 Nov 2011 23:51:37 +0200 Subject: fixed indent --- src/demuxers/demux_ts.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 1d7fff494..cafa07e0b 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1775,33 +1775,32 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num */ if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) { - uint32_t format_identifier=0; - demux_ts_get_reg_desc(this, &format_identifier, - stream + 5, stream_info_length); - /* If no format identifier, assume A52 */ - if (( format_identifier == 0x41432d33) || - ( format_identifier == 0) || - ((format_identifier == 0x48444d56 || this->hdmv>0) && stream[0] == HDMV_AUDIO_80_PCM) /* BluRay PCM */) { - - mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]); - if (mi >= 0) { - demux_ts_get_lang_desc (this, - this->audio_tracks[this->media[mi].type & 0xff].lang, - stream + 5, stream_info_length); + uint32_t format_identifier=0; + demux_ts_get_reg_desc(this, &format_identifier, stream + 5, stream_info_length); + /* If no format identifier, assume A52 */ + if (( format_identifier == 0x41432d33) || + ( format_identifier == 0) || + ((format_identifier == 0x48444d56 || this->hdmv>0) && stream[0] == HDMV_AUDIO_80_PCM) /* BluRay PCM */) { + + mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]); + if (mi >= 0) { + demux_ts_get_lang_desc (this, + this->audio_tracks[this->media[mi].type & 0xff].lang, + stream + 5, stream_info_length); #ifdef TS_PMT_LOG - printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]); + printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]); #endif - break; - } + break; + } } } #ifdef TS_PMT_LOG - printf ("demux_ts: PMT unknown stream_type: 0x%.2x pid: 0x%.4x\n", - stream[0], pid); + printf ("demux_ts: PMT unknown stream_type: 0x%.2x pid: 0x%.4x\n", + stream[0], pid); - for (i = 5; i < coded_length; i++) - printf ("%.2x ", stream[i]); - printf ("\n"); + for (i = 5; i < coded_length; i++) + printf ("%.2x ", stream[i]); + printf ("\n"); #endif break; } -- cgit v1.2.3 From 35de4d1c31809b47059ec0bf038f803aae449d12 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 22 Nov 2011 21:12:14 +0200 Subject: Use current ImageMagick API --HG-- branch : point-release extra : transplant_source : %3F%D8u%A8%97%F1R%3FtU%27%CB%EA%F5%26%18%EC-%C6%9E --- src/libxinevdec/image.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/libxinevdec/image.c b/src/libxinevdec/image.c index d5a9cfff5..d8064d200 100644 --- a/src/libxinevdec/image.c +++ b/src/libxinevdec/image.c @@ -101,14 +101,23 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { /* * this->image -> rgb data */ +#if !defined(MagickLibVersion) || MagickLibVersion < 0x671 InitializeMagick(NULL); +#else + MagickWandGenesis(); +#endif wand = NewMagickWand(); status = MagickReadImageBlob(wand, this->image, this->index); + this->index = 0; if (!status) { DestroyMagickWand(wand); +#if !defined(MagickLibVersion) || MagickLibVersion < 0x671 DestroyMagick(); +#else + MagickWandTerminus(); +#endif lprintf("error loading image\n"); return; } @@ -116,9 +125,15 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { width = MagickGetImageWidth(wand) & ~1; /* must be even for init_yuv_planes */ height = MagickGetImageHeight(wand); img_buf = malloc(width * height * 3); +#if !defined(MagickLibVersion) || MagickLibVersion < 0x671 MagickGetImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, img_buf); DestroyMagickWand(wand); DestroyMagick(); +#else + MagickExportImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, img_buf); + DestroyMagickWand(wand); + MagickWandTerminus(); +#endif _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, width); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, height); -- cgit v1.2.3 From 720907d87e05be999f02096ef9220c2638defdc4 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 22 Nov 2011 21:12:14 +0200 Subject: Use current ImageMagick API --- src/libxinevdec/image.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/libxinevdec/image.c b/src/libxinevdec/image.c index d5a9cfff5..d8064d200 100644 --- a/src/libxinevdec/image.c +++ b/src/libxinevdec/image.c @@ -101,14 +101,23 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { /* * this->image -> rgb data */ +#if !defined(MagickLibVersion) || MagickLibVersion < 0x671 InitializeMagick(NULL); +#else + MagickWandGenesis(); +#endif wand = NewMagickWand(); status = MagickReadImageBlob(wand, this->image, this->index); + this->index = 0; if (!status) { DestroyMagickWand(wand); +#if !defined(MagickLibVersion) || MagickLibVersion < 0x671 DestroyMagick(); +#else + MagickWandTerminus(); +#endif lprintf("error loading image\n"); return; } @@ -116,9 +125,15 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { width = MagickGetImageWidth(wand) & ~1; /* must be even for init_yuv_planes */ height = MagickGetImageHeight(wand); img_buf = malloc(width * height * 3); +#if !defined(MagickLibVersion) || MagickLibVersion < 0x671 MagickGetImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, img_buf); DestroyMagickWand(wand); DestroyMagick(); +#else + MagickExportImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, img_buf); + DestroyMagickWand(wand); + MagickWandTerminus(); +#endif _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, width); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, height); -- cgit v1.2.3 From cb766fad28e81704d6408aab27beacd976cd1731 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Tue, 22 Nov 2011 22:10:01 +0000 Subject: Fix up ImageMagick API selection in the presence of GraphicsMagick; changelog. --HG-- branch : point-release --- src/libxinevdec/image.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libxinevdec/image.c b/src/libxinevdec/image.c index d8064d200..5e166382b 100644 --- a/src/libxinevdec/image.c +++ b/src/libxinevdec/image.c @@ -54,6 +54,17 @@ #include "xineutils.h" #include "bswap.h" +#ifdef HAVE_GRAPHICSMAGICK +# define MAGICK_VERSION 0x670 +#else +# if !defined(MagickLibVersion) || MagickLibVersion < 0x671 +# define MAGICK_VERSION 0x670 +#else +# define MAGICK_VERSION MagickLibVersion +# endif +#endif + + typedef struct { video_decoder_class_t decoder_class; @@ -101,7 +112,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { /* * this->image -> rgb data */ -#if !defined(MagickLibVersion) || MagickLibVersion < 0x671 +#if MAGICK_VERSION < 0x671 InitializeMagick(NULL); #else MagickWandGenesis(); @@ -113,7 +124,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (!status) { DestroyMagickWand(wand); -#if !defined(MagickLibVersion) || MagickLibVersion < 0x671 +#if MAGICK_VERSION < 0x671 DestroyMagick(); #else MagickWandTerminus(); @@ -125,7 +136,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { width = MagickGetImageWidth(wand) & ~1; /* must be even for init_yuv_planes */ height = MagickGetImageHeight(wand); img_buf = malloc(width * height * 3); -#if !defined(MagickLibVersion) || MagickLibVersion < 0x671 +#if MAGICK_VERSION < 0x671 MagickGetImagePixels(wand, 0, 0, width, height, "RGB", CharPixel, img_buf); DestroyMagickWand(wand); DestroyMagick(); -- cgit v1.2.3 From c6270c119022caab75c7a63bc99d46335a1b872a Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 23 Nov 2011 10:11:24 +0200 Subject: Fix libavcodec version checks for AAC LATM/MPEG parser code --HG-- branch : point-release --- src/combined/ffmpeg/ff_audio_decoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c index 4195b7b95..e4a9c16bf 100644 --- a/src/combined/ffmpeg/ff_audio_decoder.c +++ b/src/combined/ffmpeg/ff_audio_decoder.c @@ -173,7 +173,7 @@ static void ff_audio_init_codec(ff_audio_decoder_t *this, unsigned int codec_typ * - DVB streams where multiple AAC LATM frames are packed to single PES * - DVB streams where MPEG audio frames do not follow PES packet boundaries */ -#if LIBAVCODEC_VERSION_MAJOR >= 53 +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94) if (codec_type == BUF_AUDIO_AAC_LATM || codec_type == BUF_AUDIO_MPEG) { @@ -356,7 +356,7 @@ static int ff_audio_decode(xine_t *xine, int consumed; int parser_consumed = 0; -#if LIBAVCODEC_VERSION_MAJOR >= 53 +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94) if (parser_ctx) { uint8_t *outbuf; int outsize; @@ -383,7 +383,7 @@ static int ff_audio_decode(xine_t *xine, buf = outbuf; size = outsize; } -#endif /* LIBAVCODEC_VERSION_MAJOR >= 53 */ +#endif /* LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94) */ #if AVAUDIO > 2 AVPacket avpkt; -- cgit v1.2.3 From 25632f534d274fcee425ba63d298f9aa4ae76741 Mon Sep 17 00:00:00 2001 From: Torsten Jager Date: Wed, 23 Nov 2011 11:13:10 +0200 Subject: Use PTS timestamps with DVB subtitles --- src/libspudvb/xine_spudvb_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c index 339a6ad80..1a54bc8e5 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/libspudvb/xine_spudvb_decoder.c @@ -790,7 +790,7 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf) } /* completely ignore pts since it makes a lot of problems with various providers */ - this->vpts = 0; + /* this->vpts = 0; */ /* process the pes section */ -- cgit v1.2.3 From 4f03099a36e6c17826d4d08fc7caa6a79ca91baf Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 11:14:40 +0200 Subject: dvbspu: Make sure we don't use old PTS --- src/libspudvb/xine_spudvb_decoder.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c index 1a54bc8e5..f7bb20765 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/libspudvb/xine_spudvb_decoder.c @@ -761,6 +761,8 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf) xine_fast_memcpy (this->pes_pkt, buf->content, buf->size); this->pes_pkt_wrptr += buf->size; + + this->vpts = 0; } else { if (this->pes_pkt && (this->pes_pkt_wrptr != this->pes_pkt)) { -- cgit v1.2.3 From a019cd3b4bf94d6fb34a4017b8b974ceb921c68e Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 11:18:27 +0200 Subject: Added config option to ignore DVB SPU PTS timestamps --- src/libspudvb/xine_spudvb_decoder.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c index f7bb20765..f19ba09b1 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/libspudvb/xine_spudvb_decoder.c @@ -79,6 +79,8 @@ typedef struct { typedef struct dvb_spu_class_s { spu_decoder_class_t class; xine_t *xine; + + int ignore_pts; } dvb_spu_class_t; typedef struct dvb_spu_decoder_s { @@ -774,7 +776,7 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf) /* don't ask metronom for a vpts but rather do the calculation * because buf->pts could be too far in future and metronom won't accept * further backwards pts (see metronom_got_spu_packet) */ - if (buf->pts) { + if (!this->class->ignore_pts && buf->pts > 0) { metronom_t *const metronom = this->stream->metronom; const int64_t vpts_offset = metronom->get_option( metronom, METRONOM_VPTS_OFFSET ); const int64_t spu_offset = metronom->get_option( metronom, METRONOM_SPU_OFFSET ); @@ -927,8 +929,12 @@ static spu_decoder_t *dvb_spu_class_open_plugin (spu_decoder_class_t * class_gen return (spu_decoder_t *) this; } -static void dvb_spu_class_dispose (spu_decoder_class_t * this) +static void dvb_spu_class_dispose (spu_decoder_class_t * this_gen) { + dvb_spu_class_t *this = (dvb_spu_class_t *) this_gen; + + this->xine->config->unregister_callback(this->xine->config, "subtitles.dvb.ignore_pts"); + free (this); } @@ -942,6 +948,13 @@ static char *dvb_spu_class_get_description (spu_decoder_class_t * this) return "DVB subtitle decoder plugin"; } +static void spu_dvb_ignore_pts_change(void *this_gen, xine_cfg_entry_t *value) +{ + dvb_spu_class_t *this = (dvb_spu_class_t *) this_gen; + + this->ignore_pts = value->num_value; +} + static void *init_spu_decoder_plugin (xine_t * xine, void *data) { dvb_spu_class_t *this = calloc(1, sizeof (dvb_spu_class_t)); @@ -953,6 +966,12 @@ static void *init_spu_decoder_plugin (xine_t * xine, void *data) this->xine = xine; + this->ignore_pts = xine->config->register_bool(xine->config, + "subtitles.dvb.ignore_pts", 0, + _("Ignore DVB subtitle timing"), + _("Do not use PTS timestamps for DVB subtitle timing"), + 1, spu_dvb_ignore_pts_change, this); + return &this->class; } -- cgit v1.2.3 From 2dbf881b62ec7b32d3440205432c8c7cc11bd736 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 11:22:18 +0200 Subject: Removed write-only variable --- src/libspudvb/xine_spudvb_decoder.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c index f19ba09b1..88395d0ce 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/libspudvb/xine_spudvb_decoder.c @@ -99,7 +99,6 @@ typedef struct dvb_spu_decoder_s { char *pes_pkt_wrptr; unsigned int pes_pkt_size; - uint64_t pts; uint64_t vpts; uint64_t end_vpts; @@ -759,7 +758,6 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf) memset (this->pes_pkt, 0xff, 64*1024); this->pes_pkt_wrptr = this->pes_pkt; this->pes_pkt_size = buf->decoder_info[2]; - this->pts = buf->pts; xine_fast_memcpy (this->pes_pkt, buf->content, buf->size); this->pes_pkt_wrptr += buf->size; -- cgit v1.2.3 From f8f3dd176e80b0d58bdfcee3b7a08c3a7ff9735b Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 11:23:39 +0200 Subject: spudvb: use int64_t for pts. Fixed printf formats. --- src/libspudvb/xine_spudvb_decoder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c index 88395d0ce..f3ad9888c 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/libspudvb/xine_spudvb_decoder.c @@ -99,8 +99,8 @@ typedef struct dvb_spu_decoder_s { char *pes_pkt_wrptr; unsigned int pes_pkt_size; - uint64_t vpts; - uint64_t end_vpts; + int64_t vpts; + int64_t end_vpts; pthread_t dvbsub_timer_thread; struct timespec dvbsub_hide_timeout; @@ -696,7 +696,7 @@ static void draw_subtitles (dvb_spu_decoder_t * this) pthread_mutex_lock(&this->dvbsub_osd_mutex); #ifdef LOG - printf("SPUDVB: this->vpts=%llu\n",this->vpts); + printf("SPUDVB: this->vpts=%"PRId64"\n", this->vpts); #endif for ( r=0; rget_current_time( clock ); /* if buf->pts is unreliable, show page asap (better than nothing) */ #ifdef LOG - printf("SPUDVB: spu_vpts=%lld - current_vpts=%lld\n", vpts, curvpts); + printf("SPUDVB: spu_vpts=%"PRId64" - current_vpts=%"PRId64"\n", vpts, curvpts); #endif if ( vpts<=curvpts || (vpts-curvpts)>(5*90000) ) this->vpts = 0; -- cgit v1.2.3 From 20aa0d9e88c88276e121f7ef17e1d0721efa0999 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 11:36:53 +0200 Subject: Simplify --- src/libspudvb/xine_spudvb_decoder.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c index f3ad9888c..8d581a23e 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/libspudvb/xine_spudvb_decoder.c @@ -753,24 +753,25 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf) } return; } - else { - if (buf->decoder_info[2]) { - memset (this->pes_pkt, 0xff, 64*1024); - this->pes_pkt_wrptr = this->pes_pkt; - this->pes_pkt_size = buf->decoder_info[2]; - xine_fast_memcpy (this->pes_pkt, buf->content, buf->size); - this->pes_pkt_wrptr += buf->size; + /* accumulate data */ + if (buf->decoder_info[2]) { + memset (this->pes_pkt, 0xff, 64*1024); + this->pes_pkt_wrptr = this->pes_pkt; + this->pes_pkt_size = buf->decoder_info[2]; - this->vpts = 0; - } - else { - if (this->pes_pkt && (this->pes_pkt_wrptr != this->pes_pkt)) { - xine_fast_memcpy (this->pes_pkt_wrptr, buf->content, buf->size); - this->pes_pkt_wrptr += buf->size; - } + xine_fast_memcpy (this->pes_pkt, buf->content, buf->size); + this->pes_pkt_wrptr += buf->size; + + this->vpts = 0; + } + else { + if (this->pes_pkt && (this->pes_pkt_wrptr != this->pes_pkt)) { + xine_fast_memcpy (this->pes_pkt_wrptr, buf->content, buf->size); + this->pes_pkt_wrptr += buf->size; } } + /* don't ask metronom for a vpts but rather do the calculation * because buf->pts could be too far in future and metronom won't accept * further backwards pts (see metronom_got_spu_packet) */ -- cgit v1.2.3 From ef30770635d89001917d7d04182c561ff392091d Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 11:55:05 +0200 Subject: Fixed aliasing --- src/input/input_net.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/input/input_net.c b/src/input/input_net.c index 5c927a6d5..82ab28c1e 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -113,7 +113,10 @@ typedef struct { static int host_connect_attempt_ipv4(struct in_addr ia, int port, xine_t *xine) { int s; - struct sockaddr_in sin; + union { + struct sockaddr_in in; + struct sockaddr sa; + } sa; s = xine_socket_cloexec(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (s==-1) { @@ -122,14 +125,14 @@ static int host_connect_attempt_ipv4(struct in_addr ia, int port, xine_t *xine) return -1; } - sin.sin_family = AF_INET; - sin.sin_addr = ia; - sin.sin_port = htons(port); + sa.in.sin_family = AF_INET; + sa.in.sin_addr = ia; + sa.in.sin_port = htons(port); #ifndef WIN32 - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) + if (connect(s, &sa.sa, sizeof(sa.in))==-1 && errno != EINPROGRESS) #else - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError() != WSAEINPROGRESS) + if (connect(s, &sa.sa, sizeof(sa.in))==-1 && WSAGetLastError() != WSAEINPROGRESS) #endif { xine_log(xine, XINE_LOG_MSG, -- cgit v1.2.3 From cd575a4f9c41006ee116f5538fca93fee3df43eb Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 12:49:41 +0200 Subject: demux_ts: fixed possible double free_buffer. Make sure unused media entries have no pid. --- src/demuxers/demux_ts.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index cafa07e0b..c47fc7755 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -501,7 +501,11 @@ static void demux_ts_dynamic_pmt_clean (demux_ts_t *this) { spus++; } } - if (i > count) this->media[count] = *m; + if (i > count) { + this->media[count] = *m; + m->buf = NULL; + m->pid = INVALID_PID; + } count++; } else { /* drop this no longer needed media descriptor */ -- cgit v1.2.3 From 89e2a82da6cac38d13a22d2888dcc2ecf1a3f027 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 13:09:09 +0200 Subject: demux_ts: added reset_track_map() --- src/demuxers/demux_ts.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index c47fc7755..b05e16212 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -413,6 +413,16 @@ typedef struct { config_values_t *config; } demux_ts_class_t; +static void reset_track_map(fifo_buffer_t *fifo) +{ + buf_element_t *buf = fifo->buffer_pool_alloc (fifo); + + buf->type = BUF_CONTROL_RESET_TRACK_MAP; + buf->decoder_info[1] = -1; + + fifo->put (fifo, buf); +} + /* TJ. dynamic PMT support. The idea is: First, reuse unchanged pids and add new ones. Then, comb out those who are no longer referenced. @@ -525,10 +535,7 @@ static void demux_ts_dynamic_pmt_clean (demux_ts_t *this) { } if ((tracks < this->audio_tracks_count) && this->audio_fifo) { /* at least 1 audio track removed, tell audio decoder loop */ - buf_element_t *b = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - b->type = BUF_CONTROL_RESET_TRACK_MAP; - b->decoder_info[1] = -1; - this->audio_fifo->put (this->audio_fifo, b); + reset_track_map(this->audio_fifo); #ifdef LOG_DYNAMIC_PMT printf ("demux_ts: new audio track map\n"); #endif -- cgit v1.2.3 From 1d8951f026be191da39f37726ea186a0059214e9 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 13:10:54 +0200 Subject: demux_ts: reset spu track map before parsing new PMT --- src/demuxers/demux_ts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index b05e16212..2fd03c1be 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1570,6 +1570,9 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num this->videoPid = INVALID_PID; this->spu_pid = INVALID_PID; + this->spu_langs_count = 0; + reset_track_map(this->video_fifo); + /* * ES definitions start here...we are going to learn upto one video * PID and one audio PID. @@ -1595,7 +1598,6 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num /* * Extract the elementary streams. */ - this->spu_langs_count = 0; while (section_length > 0) { unsigned int stream_info_length; -- cgit v1.2.3 From d385be27a4329ddb066ea1964e327d1c6d8d7c42 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 15:24:22 +0200 Subject: demux_ts: when calculatingPES header len, count all bytes not just extension header --- src/demuxers/demux_ts.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 2fd03c1be..75edb5724 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -998,12 +998,12 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, /* packet_len = p[4] << 8 | p[5]; */ stream_id = p[3]; - header_len = p[8]; + header_len = p[8] + 9; /* sometimes corruption on header_len causes segfault in memcpy below */ - if (header_len + 9 > packet_len) { + if (header_len > packet_len) { xprintf (xine, XINE_VERBOSITY_DEBUG, - "demux_ts: illegal value for PES_header_data_length (0x%x)\n", header_len); + "demux_ts: illegal value for PES_header_data_length (0x%x)\n", header_len - 9); return 0; } @@ -1014,7 +1014,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, if (p[7] & 0x80) { /* pts avail */ - if (header_len < 5) { + if (header_len < 14) { return 0; } @@ -1042,8 +1042,8 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->pts = pts; - p += header_len + 9; - packet_len -= header_len + 9; + p += header_len; + packet_len -= header_len; if (m->descriptor_tag == STREAM_VIDEO_VC1) { m->size = packet_len; @@ -1052,7 +1052,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, } if (m->descriptor_tag == HDMV_SPU_BITMAP) { - long payload_len = ((buf[4] << 8) | buf[5]) - header_len - 3; + long payload_len = ((buf[4] << 8) | buf[5]) - header_len + 6; m->size = packet_len; m->type |= BUF_SPU_HDMV; @@ -1119,7 +1119,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, } else if (m->descriptor_tag == ISO_13818_PES_PRIVATE && p[0] == 0x20 && p[1] == 0x00) { /* DVBSUB */ - long payload_len = ((buf[4] << 8) | buf[5]) - header_len - 3; + long payload_len = ((buf[4] << 8) | buf[5]) - header_len + 6; m->size = packet_len; m->type |= BUF_SPU_DVB; -- cgit v1.2.3 From 3cbd1d53f8528030f55449d44c6125f14239eb9e Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 15:28:10 +0200 Subject: demux_ts: Changed parse_pes_header() to return header length. Removed MAX_PIDS uint32_t's that were used only as return value for parse_pes_header() --- src/demuxers/demux_ts.c | 57 ++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 75edb5724..3984fe412 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -289,7 +289,6 @@ typedef struct { unsigned int pid; fifo_buffer_t *fifo; - uint32_t size; uint32_t type; int64_t pts; buf_element_t *buf; @@ -1046,18 +1045,16 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, packet_len -= header_len; if (m->descriptor_tag == STREAM_VIDEO_VC1) { - m->size = packet_len; m->type = BUF_VIDEO_VC1; - return 1; + return header_len; } if (m->descriptor_tag == HDMV_SPU_BITMAP) { long payload_len = ((buf[4] << 8) | buf[5]) - header_len + 6; - m->size = packet_len; m->type |= BUF_SPU_HDMV; m->buf->decoder_info[2] = payload_len; - return 1; + return header_len; } else @@ -1076,27 +1073,23 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, */ if(m->descriptor_tag == HDMV_AUDIO_84_EAC3 || m->descriptor_tag == STREAM_AUDIO_EAC3) { - m->size = packet_len; m->type |= BUF_AUDIO_EAC3; - return 1; + return header_len; } else if(m->descriptor_tag == STREAM_AUDIO_AC3) { /* ac3 - raw */ - m->size = packet_len; m->type |= BUF_AUDIO_A52; - return 1; + return header_len; } else if (m->descriptor_tag == HDMV_AUDIO_83_TRUEHD) { /* TODO: separate AC3 and TrueHD streams ... */ - m->size = packet_len; m->type |= BUF_AUDIO_A52; - return 1; + return header_len; } else if (m->descriptor_tag == STREAM_AUDIO_DTS || m->descriptor_tag == HDMV_AUDIO_82_DTS || m->descriptor_tag == HDMV_AUDIO_86_DTS_HD_MA ) { - m->size = packet_len; m->type |= BUF_AUDIO_DTS; - return 1; + return header_len; } else if (packet_len < 2) { return 0; @@ -1107,45 +1100,41 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, return 0; } - m->size = packet_len - 4; m->type |= BUF_AUDIO_LPCM_BE; m->buf->decoder_flags |= BUF_FLAG_SPECIAL; m->buf->decoder_info[1] = BUF_SPECIAL_LPCM_CONFIG; m->buf->decoder_info[2] = (p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0]; - return 1; + return header_len + 4; } else if (m->descriptor_tag == ISO_13818_PES_PRIVATE && p[0] == 0x20 && p[1] == 0x00) { /* DVBSUB */ long payload_len = ((buf[4] << 8) | buf[5]) - header_len + 6; - m->size = packet_len; m->type |= BUF_SPU_DVB; m->buf->decoder_info[2] = payload_len; - return 1; + return header_len; } else if (p[0] == 0x0B && p[1] == 0x77) { /* ac3 - syncword */ - m->size = packet_len; m->type |= BUF_AUDIO_A52; - return 1; + return header_len; } else if ((p[0] & 0xE0) == 0x20) { spu_id = (p[0] & 0x1f); - m->size = packet_len-1; m->type = BUF_SPU_DVD + spu_id; - return 1; + return header_len + 1; + } else if ((p[0] & 0xF0) == 0x80) { if (packet_len < 4) { return 0; } - m->size = packet_len - 4; m->type |= BUF_AUDIO_A52; - return 1; + return header_len + 4; #if 0 /* commented out: does not set PCM type. Decoder can't handle raw PCM stream without configuration. */ @@ -1164,15 +1153,13 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, return 0; } - m->size = packet_len-pcm_offset; m->type |= BUF_AUDIO_LPCM_BE; - return 1; + return header_len + pcm_offset; #endif } } else if ((stream_id & 0xf0) == 0xe0) { - m->size = packet_len; switch (m->descriptor_tag) { case ISO_11172_VIDEO: case ISO_13818_VIDEO: @@ -1193,11 +1180,10 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->type = BUF_VIDEO_MPEG; break; } - return 1; + return header_len; } else if ((stream_id & 0xe0) == 0xc0) { - m->size = packet_len; switch (m->descriptor_tag) { case ISO_11172_AUDIO: case ISO_13818_AUDIO: @@ -1217,7 +1203,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->type |= BUF_AUDIO_MPEG; break; } - return 1; + return header_len; } else { #ifdef TS_LOG @@ -1278,7 +1264,9 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, /* allocate the buffer here, as pes_header needs a valid buf for dvbsubs */ m->buf = m->fifo->buffer_pool_alloc(m->fifo); - if (!demux_ts_parse_pes_header(this->stream->xine, m, ts, len)) { + int pes_header_len = demux_ts_parse_pes_header(this->stream->xine, m, ts, len); + + if (pes_header_len <= 0) { m->buf->free_buffer(m->buf); m->buf = NULL; @@ -1288,8 +1276,13 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, } else { m->corrupted_pes = 0; - memcpy(m->buf->mem, ts+len-m->size, m->size); - m->buf->size = m->size; + + /* skip PES header */ + ts += pes_header_len; + len -= pes_header_len; + + memcpy(m->buf->mem, ts, len); + m->buf->size = len; update_extra_info(this, m); -- cgit v1.2.3 From 705c67e259db0f0302850d1a999df07c71a35342 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 23 Nov 2011 15:44:36 +0200 Subject: demux_ts: simplify pes buffering --- src/demuxers/demux_ts.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 3984fe412..089d37619 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1281,9 +1281,6 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, ts += pes_header_len; len -= pes_header_len; - memcpy(m->buf->mem, ts, len); - m->buf->size = len; - update_extra_info(this, m); /* rate estimation */ @@ -1292,8 +1289,9 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (m->pid == this->tbre_pid) demux_ts_tbre_update (this, TBRE_MODE_AUDIO_PTS, m->pts); } + } - } else if (!m->corrupted_pes) { /* no pus -- PES packet continuation */ + if (!m->corrupted_pes) { if ((m->buf->size + len) > MAX_PES_BUF_SIZE) { demux_ts_send_buffer(m, 0); -- cgit v1.2.3 From 04e7bcbc08b29e2a1ec71c5fe088f6ce5e5f6004 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 23 Nov 2011 18:15:26 +0000 Subject: Have the PVR input plugin built if V4L2, not V4L1, is present. --HG-- branch : point-release extra : rebase_source : 182453d8d03dbac55d0264944566e8430ac7d601 --- src/input/Makefile.am | 2 +- src/input/input_pvr.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/Makefile.am b/src/input/Makefile.am index 2b75f7338..b817cd4c4 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -21,11 +21,11 @@ endif if HAVE_V4L in_v4l = xineplug_inp_v4l.la -in_pvr = xineplug_inp_pvr.la endif if HAVE_V4L2 in_v4l2 = xineplug_inp_v4l2.la +in_pvr = xineplug_inp_pvr.la endif if HAVE_GNOME_VFS diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 4aa55f440..9686feb45 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -98,7 +98,13 @@ #include #include #include -#include "videodev2.h" +#ifdef HAVE_SYS_VIDEOIO_H +# include +#elif defined(HAVE_SYS_VIDEODEV2_H) +# include +#else +# include +#endif #define XINE_ENABLE_EXPERIMENTAL_FEATURES -- cgit v1.2.3 From 5fc20910c977b6c5c535d4aca61ddf0326357e33 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 23 Nov 2011 18:21:01 +0000 Subject: Remove our internal videodev2.h - no longer needed. --HG-- branch : point-release --- src/input/Makefile.am | 2 +- src/input/videodev2.h | 1408 ------------------------------------------------- 2 files changed, 1 insertion(+), 1409 deletions(-) delete mode 100644 src/input/videodev2.h (limited to 'src') diff --git a/src/input/Makefile.am b/src/input/Makefile.am index b817cd4c4..10c4f15ec 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -164,5 +164,5 @@ xineplug_inp_pvr_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_pvr_la_LDFLAGS = $(xineplug_ldflags) xineinclude_HEADERS = input_plugin.h -noinst_HEADERS = net_buf_ctrl.h mms.h mmsh.h pnm.h media_helper.h videodev2.h http_helper.h +noinst_HEADERS = net_buf_ctrl.h mms.h mmsh.h pnm.h media_helper.h http_helper.h diff --git a/src/input/videodev2.h b/src/input/videodev2.h deleted file mode 100644 index 7863e454b..000000000 --- a/src/input/videodev2.h +++ /dev/null @@ -1,1408 +0,0 @@ -/* - * Video for Linux Two header file - * - * Copyright (C) 1999-2007 the contributors - * - * This program 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. - * - * This program 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. - * - * Alternatively you can redistribute this file under the terms of the - * BSD license as stated below: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Header file for v4l or V4L2 drivers and applications - * with public API. - * All kernel-specific stuff were moved to media/v4l2-dev.h, so - * no #if __KERNEL tests are allowed here - * - * See http://linuxtv.org for more info - * - * Author: Bill Dirks - * Justin Schoeman - * Hans Verkuil - * et al. - */ -#ifndef __LINUX_VIDEODEV2_H -#define __LINUX_VIDEODEV2_H -#define __user -#include -#include - -/* - * Common stuff for both V4L1 and V4L2 - * Moved from videodev.h - */ -#define VIDEO_MAX_FRAME 32 - -#define VID_TYPE_CAPTURE 1 /* Can capture */ -#define VID_TYPE_TUNER 2 /* Can tune */ -#define VID_TYPE_TELETEXT 4 /* Does teletext */ -#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ -#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ -#define VID_TYPE_CLIPPING 32 /* Can clip */ -#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ -#define VID_TYPE_SCALES 128 /* Scalable */ -#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ -#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ -#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ -#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ -#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ -#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ - -/* - * M I S C E L L A N E O U S - */ - -/* Four-character-code (FOURCC) */ -#define v4l2_fourcc(a,b,c,d)\ - (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) - -/* - * E N U M S - */ -enum v4l2_field { - V4L2_FIELD_ANY = 0, /* driver can choose from none, - top, bottom, interlaced - depending on whatever it thinks - is approximate ... */ - V4L2_FIELD_NONE = 1, /* this device has no fields ... */ - V4L2_FIELD_TOP = 2, /* top field only */ - V4L2_FIELD_BOTTOM = 3, /* bottom field only */ - V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ - V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one - buffer, top-bottom order */ - V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ - V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into - separate buffers */ - V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field - first and the top field is - transmitted first */ - V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field - first and the bottom field is - transmitted first */ -}; -#define V4L2_FIELD_HAS_TOP(field) \ - ((field) == V4L2_FIELD_TOP ||\ - (field) == V4L2_FIELD_INTERLACED ||\ - (field) == V4L2_FIELD_INTERLACED_TB ||\ - (field) == V4L2_FIELD_INTERLACED_BT ||\ - (field) == V4L2_FIELD_SEQ_TB ||\ - (field) == V4L2_FIELD_SEQ_BT) -#define V4L2_FIELD_HAS_BOTTOM(field) \ - ((field) == V4L2_FIELD_BOTTOM ||\ - (field) == V4L2_FIELD_INTERLACED ||\ - (field) == V4L2_FIELD_INTERLACED_TB ||\ - (field) == V4L2_FIELD_INTERLACED_BT ||\ - (field) == V4L2_FIELD_SEQ_TB ||\ - (field) == V4L2_FIELD_SEQ_BT) -#define V4L2_FIELD_HAS_BOTH(field) \ - ((field) == V4L2_FIELD_INTERLACED ||\ - (field) == V4L2_FIELD_INTERLACED_TB ||\ - (field) == V4L2_FIELD_INTERLACED_BT ||\ - (field) == V4L2_FIELD_SEQ_TB ||\ - (field) == V4L2_FIELD_SEQ_BT) - -enum v4l2_buf_type { - V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, - V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, - V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, - V4L2_BUF_TYPE_VBI_CAPTURE = 4, - V4L2_BUF_TYPE_VBI_OUTPUT = 5, - V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, - V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, -#if 1 - /* Experimental */ - V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, -#endif - V4L2_BUF_TYPE_PRIVATE = 0x80, -}; - -enum v4l2_ctrl_type { - V4L2_CTRL_TYPE_INTEGER = 1, - V4L2_CTRL_TYPE_BOOLEAN = 2, - V4L2_CTRL_TYPE_MENU = 3, - V4L2_CTRL_TYPE_BUTTON = 4, - V4L2_CTRL_TYPE_INTEGER64 = 5, - V4L2_CTRL_TYPE_CTRL_CLASS = 6, -}; - -enum v4l2_tuner_type { - V4L2_TUNER_RADIO = 1, - V4L2_TUNER_ANALOG_TV = 2, - V4L2_TUNER_DIGITAL_TV = 3, -}; - -enum v4l2_memory { - V4L2_MEMORY_MMAP = 1, - V4L2_MEMORY_USERPTR = 2, - V4L2_MEMORY_OVERLAY = 3, -}; - -/* see also http://vektor.theorem.ca/graphics/ycbcr/ */ -enum v4l2_colorspace { - /* ITU-R 601 -- broadcast NTSC/PAL */ - V4L2_COLORSPACE_SMPTE170M = 1, - - /* 1125-Line (US) HDTV */ - V4L2_COLORSPACE_SMPTE240M = 2, - - /* HD and modern captures. */ - V4L2_COLORSPACE_REC709 = 3, - - /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ - V4L2_COLORSPACE_BT878 = 4, - - /* These should be useful. Assume 601 extents. */ - V4L2_COLORSPACE_470_SYSTEM_M = 5, - V4L2_COLORSPACE_470_SYSTEM_BG = 6, - - /* I know there will be cameras that send this. So, this is - * unspecified chromaticities and full 0-255 on each of the - * Y'CbCr components - */ - V4L2_COLORSPACE_JPEG = 7, - - /* For RGB colourspaces, this is probably a good start. */ - V4L2_COLORSPACE_SRGB = 8, -}; - -enum v4l2_priority { - V4L2_PRIORITY_UNSET = 0, /* not initialized */ - V4L2_PRIORITY_BACKGROUND = 1, - V4L2_PRIORITY_INTERACTIVE = 2, - V4L2_PRIORITY_RECORD = 3, - V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, -}; - -struct v4l2_rect { - __s32 left; - __s32 top; - __s32 width; - __s32 height; -}; - -struct v4l2_fract { - __u32 numerator; - __u32 denominator; -}; - -/* - * D R I V E R C A P A B I L I T I E S - */ -struct v4l2_capability -{ - __u8 driver[16]; /* i.e. "bttv" */ - __u8 card[32]; /* i.e. "Hauppauge WinTV" */ - __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ - __u32 version; /* should use KERNEL_VERSION() */ - __u32 capabilities; /* Device capabilities */ - __u32 reserved[4]; -}; - -/* Values for 'capabilities' field */ -#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ -#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ -#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ -#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ -#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ -#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ -#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ -#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ -#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ - -#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ -#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ -#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ - -#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ -#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ -#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ - -/* - * V I D E O I M A G E F O R M A T - */ -struct v4l2_pix_format -{ - __u32 width; - __u32 height; - __u32 pixelformat; - enum v4l2_field field; - __u32 bytesperline; /* for padding, zero if unused */ - __u32 sizeimage; - enum v4l2_colorspace colorspace; - __u32 priv; /* private data, depends on pixelformat */ -}; - -/* Pixel format FOURCC depth Description */ -#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ -#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ -#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ -#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ -#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */ -#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B','G','R','3') /* 24 BGR-8-8-8 */ -#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R','G','B','3') /* 24 RGB-8-8-8 */ -#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ -#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ -#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ -#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ -#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ -#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U','Y','V','Y') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ -#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ -#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ - -/* two planes -- one Y, one Cr + Cb interleaved */ -#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ -#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N','V','2','1') /* 12 Y/CrCb 4:2:0 */ - -/* The following formats are not defined in the V4L2 specification */ -#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y','U','V','9') /* 9 YUV 4:1:0 */ -#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ -#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ -#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */ -#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */ - -/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ -#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ - -/* compressed formats */ -#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ -#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ -#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ -#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG-1/2/4 */ - -/* Vendor-specific formats */ -#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ -#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ -#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ -#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ -#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */ - -/* - * F O R M A T E N U M E R A T I O N - */ -struct v4l2_fmtdesc -{ - __u32 index; /* Format number */ - enum v4l2_buf_type type; /* buffer type */ - __u32 flags; - __u8 description[32]; /* Description string */ - __u32 pixelformat; /* Format fourcc */ - __u32 reserved[4]; -}; - -#define V4L2_FMT_FLAG_COMPRESSED 0x0001 - -#if 1 - /* Experimental Frame Size and frame rate enumeration */ -/* - * F R A M E S I Z E E N U M E R A T I O N - */ -enum v4l2_frmsizetypes -{ - V4L2_FRMSIZE_TYPE_DISCRETE = 1, - V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, - V4L2_FRMSIZE_TYPE_STEPWISE = 3, -}; - -struct v4l2_frmsize_discrete -{ - __u32 width; /* Frame width [pixel] */ - __u32 height; /* Frame height [pixel] */ -}; - -struct v4l2_frmsize_stepwise -{ - __u32 min_width; /* Minimum frame width [pixel] */ - __u32 max_width; /* Maximum frame width [pixel] */ - __u32 step_width; /* Frame width step size [pixel] */ - __u32 min_height; /* Minimum frame height [pixel] */ - __u32 max_height; /* Maximum frame height [pixel] */ - __u32 step_height; /* Frame height step size [pixel] */ -}; - -struct v4l2_frmsizeenum -{ - __u32 index; /* Frame size number */ - __u32 pixel_format; /* Pixel format */ - __u32 type; /* Frame size type the device supports. */ - - union { /* Frame size */ - struct v4l2_frmsize_discrete discrete; - struct v4l2_frmsize_stepwise stepwise; - }; - - __u32 reserved[2]; /* Reserved space for future use */ -}; - -/* - * F R A M E R A T E E N U M E R A T I O N - */ -enum v4l2_frmivaltypes -{ - V4L2_FRMIVAL_TYPE_DISCRETE = 1, - V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, - V4L2_FRMIVAL_TYPE_STEPWISE = 3, -}; - -struct v4l2_frmival_stepwise -{ - struct v4l2_fract min; /* Minimum frame interval [s] */ - struct v4l2_fract max; /* Maximum frame interval [s] */ - struct v4l2_fract step; /* Frame interval step size [s] */ -}; - -struct v4l2_frmivalenum -{ - __u32 index; /* Frame format index */ - __u32 pixel_format; /* Pixel format */ - __u32 width; /* Frame width */ - __u32 height; /* Frame height */ - __u32 type; /* Frame interval type the device supports. */ - - union { /* Frame interval */ - struct v4l2_fract discrete; - struct v4l2_frmival_stepwise stepwise; - }; - - __u32 reserved[2]; /* Reserved space for future use */ -}; -#endif - -/* - * T I M E C O D E - */ -struct v4l2_timecode -{ - __u32 type; - __u32 flags; - __u8 frames; - __u8 seconds; - __u8 minutes; - __u8 hours; - __u8 userbits[4]; -}; - -/* Type */ -#define V4L2_TC_TYPE_24FPS 1 -#define V4L2_TC_TYPE_25FPS 2 -#define V4L2_TC_TYPE_30FPS 3 -#define V4L2_TC_TYPE_50FPS 4 -#define V4L2_TC_TYPE_60FPS 5 - -/* Flags */ -#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ -#define V4L2_TC_FLAG_COLORFRAME 0x0002 -#define V4L2_TC_USERBITS_field 0x000C -#define V4L2_TC_USERBITS_USERDEFINED 0x0000 -#define V4L2_TC_USERBITS_8BITCHARS 0x0008 -/* The above is based on SMPTE timecodes */ - - -struct v4l2_jpegcompression -{ - int quality; - - int APPn; /* Number of APP segment to be written, - * must be 0..15 */ - int APP_len; /* Length of data in JPEG APPn segment */ - char APP_data[60]; /* Data in the JPEG APPn segment. */ - - int COM_len; /* Length of data in JPEG COM segment */ - char COM_data[60]; /* Data in JPEG COM segment */ - - __u32 jpeg_markers; /* Which markers should go into the JPEG - * output. Unless you exactly know what - * you do, leave them untouched. - * Inluding less markers will make the - * resulting code smaller, but there will - * be fewer aplications which can read it. - * The presence of the APP and COM marker - * is influenced by APP_len and COM_len - * ONLY, not by this property! */ - -#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ -#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ -#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ -#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ -#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will - * allways use APP0 */ -}; - -/* - * M E M O R Y - M A P P I N G B U F F E R S - */ -struct v4l2_requestbuffers -{ - __u32 count; - enum v4l2_buf_type type; - enum v4l2_memory memory; - __u32 reserved[2]; -}; - -struct v4l2_buffer -{ - __u32 index; - enum v4l2_buf_type type; - __u32 bytesused; - __u32 flags; - enum v4l2_field field; - struct timeval timestamp; - struct v4l2_timecode timecode; - __u32 sequence; - - /* memory location */ - enum v4l2_memory memory; - union { - __u32 offset; - unsigned long userptr; - } m; - __u32 length; - __u32 input; - __u32 reserved; -}; - -/* Flags for 'flags' field */ -#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */ -#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */ -#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */ -#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ -#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ -#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ -#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ -#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ - -/* - * O V E R L A Y P R E V I E W - */ -struct v4l2_framebuffer -{ - __u32 capability; - __u32 flags; -/* FIXME: in theory we should pass something like PCI device + memory - * region + offset instead of some physical address */ - void* base; - struct v4l2_pix_format fmt; -}; -/* Flags for the 'capability' field. Read only */ -#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 -#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 -#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 -#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 -#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 -#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 -#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 -/* Flags for the 'flags' field. */ -#define V4L2_FBUF_FLAG_PRIMARY 0x0001 -#define V4L2_FBUF_FLAG_OVERLAY 0x0002 -#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 -#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 -#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 -#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 - -struct v4l2_clip -{ - struct v4l2_rect c; - struct v4l2_clip *next; -}; - -struct v4l2_window -{ - struct v4l2_rect w; - enum v4l2_field field; - __u32 chromakey; - struct v4l2_clip *clips; - __u32 clipcount; - void *bitmap; - __u8 global_alpha; -}; - -/* - * C A P T U R E P A R A M E T E R S - */ -struct v4l2_captureparm -{ - __u32 capability; /* Supported modes */ - __u32 capturemode; /* Current mode */ - struct v4l2_fract timeperframe; /* Time per frame in .1us units */ - __u32 extendedmode; /* Driver-specific extensions */ - __u32 readbuffers; /* # of buffers for read */ - __u32 reserved[4]; -}; - -/* Flags for 'capability' and 'capturemode' fields */ -#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ -#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ - -struct v4l2_outputparm -{ - __u32 capability; /* Supported modes */ - __u32 outputmode; /* Current mode */ - struct v4l2_fract timeperframe; /* Time per frame in seconds */ - __u32 extendedmode; /* Driver-specific extensions */ - __u32 writebuffers; /* # of buffers for write */ - __u32 reserved[4]; -}; - -/* - * I N P U T I M A G E C R O P P I N G - */ -struct v4l2_cropcap { - enum v4l2_buf_type type; - struct v4l2_rect bounds; - struct v4l2_rect defrect; - struct v4l2_fract pixelaspect; -}; - -struct v4l2_crop { - enum v4l2_buf_type type; - struct v4l2_rect c; -}; - -/* - * A N A L O G V I D E O S T A N D A R D - */ - -typedef __u64 v4l2_std_id; - -/* one bit for each */ -#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) -#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) -#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) -#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) -#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) -#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) -#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) -#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) - -#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) -#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) -#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) -#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) - -#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) -#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) -#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) -#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) - -#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) -#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) -#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) -#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) -#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) -#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) -#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) -#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) - -/* ATSC/HDTV */ -#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) -#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) - -/* FIXME: - Although std_id is 64 bits, there is an issue on PPC32 architecture that - makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding - this value to 32 bits. - As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide), - it should work fine. However, if needed to add more than two standards, - v4l2-common.c should be fixed. - */ - -/* some merged standards */ -#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC) -#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B) -#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H) -#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK) - -/* some common needed stuff */ -#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ - V4L2_STD_PAL_B1 |\ - V4L2_STD_PAL_G) -#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ - V4L2_STD_PAL_D1 |\ - V4L2_STD_PAL_K) -#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ - V4L2_STD_PAL_DK |\ - V4L2_STD_PAL_H |\ - V4L2_STD_PAL_I) -#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ - V4L2_STD_NTSC_M_JP |\ - V4L2_STD_NTSC_M_KR) -#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ - V4L2_STD_SECAM_K |\ - V4L2_STD_SECAM_K1) -#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ - V4L2_STD_SECAM_G |\ - V4L2_STD_SECAM_H |\ - V4L2_STD_SECAM_DK |\ - V4L2_STD_SECAM_L |\ - V4L2_STD_SECAM_LC) - -#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ - V4L2_STD_PAL_60 |\ - V4L2_STD_NTSC |\ - V4L2_STD_NTSC_443) -#define V4L2_STD_625_50 (V4L2_STD_PAL |\ - V4L2_STD_PAL_N |\ - V4L2_STD_PAL_Nc |\ - V4L2_STD_SECAM) -#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ - V4L2_STD_ATSC_16_VSB) - -#define V4L2_STD_UNKNOWN 0 -#define V4L2_STD_ALL (V4L2_STD_525_60 |\ - V4L2_STD_625_50) - -struct v4l2_standard -{ - __u32 index; - v4l2_std_id id; - __u8 name[24]; - struct v4l2_fract frameperiod; /* Frames, not fields */ - __u32 framelines; - __u32 reserved[4]; -}; - -/* - * V I D E O I N P U T S - */ -struct v4l2_input -{ - __u32 index; /* Which input */ - __u8 name[32]; /* Label */ - __u32 type; /* Type of input */ - __u32 audioset; /* Associated audios (bitfield) */ - __u32 tuner; /* Associated tuner */ - v4l2_std_id std; - __u32 status; - __u32 reserved[4]; -}; - -/* Values for the 'type' field */ -#define V4L2_INPUT_TYPE_TUNER 1 -#define V4L2_INPUT_TYPE_CAMERA 2 - -/* field 'status' - general */ -#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ -#define V4L2_IN_ST_NO_SIGNAL 0x00000002 -#define V4L2_IN_ST_NO_COLOR 0x00000004 - -/* field 'status' - analog */ -#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ -#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ - -/* field 'status' - digital */ -#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ -#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ -#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ - -/* field 'status' - VCR and set-top box */ -#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ -#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ -#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ - -/* - * V I D E O O U T P U T S - */ -struct v4l2_output -{ - __u32 index; /* Which output */ - __u8 name[32]; /* Label */ - __u32 type; /* Type of output */ - __u32 audioset; /* Associated audios (bitfield) */ - __u32 modulator; /* Associated modulator */ - v4l2_std_id std; - __u32 reserved[4]; -}; -/* Values for the 'type' field */ -#define V4L2_OUTPUT_TYPE_MODULATOR 1 -#define V4L2_OUTPUT_TYPE_ANALOG 2 -#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 - -/* - * C O N T R O L S - */ -struct v4l2_control -{ - __u32 id; - __s32 value; -}; - -struct v4l2_ext_control -{ - __u32 id; - __u32 reserved2[2]; - union { - __s32 value; - __s64 value64; - void *reserved; - }; -} __attribute__ ((packed)); - -struct v4l2_ext_controls -{ - __u32 ctrl_class; - __u32 count; - __u32 error_idx; - __u32 reserved[2]; - struct v4l2_ext_control *controls; -}; - -/* Values for ctrl_class field */ -#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ -#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ - -#define V4L2_CTRL_ID_MASK (0x0fffffff) -#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) -#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) - -/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ -struct v4l2_queryctrl -{ - __u32 id; - enum v4l2_ctrl_type type; - __u8 name[32]; /* Whatever */ - __s32 minimum; /* Note signedness */ - __s32 maximum; - __s32 step; - __s32 default_value; - __u32 flags; - __u32 reserved[2]; -}; - -/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ -struct v4l2_querymenu -{ - __u32 id; - __u32 index; - __u8 name[32]; /* Whatever */ - __u32 reserved; -}; - -/* Control flags */ -#define V4L2_CTRL_FLAG_DISABLED 0x0001 -#define V4L2_CTRL_FLAG_GRABBED 0x0002 -#define V4L2_CTRL_FLAG_READ_ONLY 0x0004 -#define V4L2_CTRL_FLAG_UPDATE 0x0008 -#define V4L2_CTRL_FLAG_INACTIVE 0x0010 -#define V4L2_CTRL_FLAG_SLIDER 0x0020 - -/* Query flag, to be ORed with the control ID */ -#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 - -/* User-class control IDs defined by V4L2 */ -#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) -#define V4L2_CID_USER_BASE V4L2_CID_BASE -/* IDs reserved for driver specific controls */ -#define V4L2_CID_PRIVATE_BASE 0x08000000 - -#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) -#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) -#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) -#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) -#define V4L2_CID_HUE (V4L2_CID_BASE+3) -#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) -#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) -#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) -#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) -#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) -#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) -#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) -#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) -#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) -#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) -#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) -#define V4L2_CID_GAMMA (V4L2_CID_BASE+16) -#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* ? Not sure */ -#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) -#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) -#define V4L2_CID_GAIN (V4L2_CID_BASE+19) -#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) -#define V4L2_CID_VFLIP (V4L2_CID_BASE+21) -#define V4L2_CID_HCENTER (V4L2_CID_BASE+22) -#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) -#define V4L2_CID_LASTP1 (V4L2_CID_BASE+24) /* last CID + 1 */ - -/* MPEG-class control IDs defined by V4L2 */ -#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) -#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) - -/* MPEG streams */ -#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) -enum v4l2_mpeg_stream_type { - V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ - V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */ - V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */ - V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */ - V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */ - V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */ -}; -#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) -#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) -#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) -#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) -#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) -#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) -#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) -enum v4l2_mpeg_stream_vbi_fmt { - V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */ - V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ -}; - -/* MPEG audio */ -#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) -enum v4l2_mpeg_audio_sampling_freq { - V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, - V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, - V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, -}; -#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) -enum v4l2_mpeg_audio_encoding { - V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, - V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, - V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, -}; -#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) -enum v4l2_mpeg_audio_l1_bitrate { - V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, - V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2, - V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3, - V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4, - V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5, - V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6, - V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7, - V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8, - V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9, - V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10, - V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11, - V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, - V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, -}; -#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) -enum v4l2_mpeg_audio_l2_bitrate { - V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, - V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2, - V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3, - V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4, - V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5, - V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6, - V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7, - V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8, - V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9, - V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10, - V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11, - V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, - V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, -}; -#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) -enum v4l2_mpeg_audio_l3_bitrate { - V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, - V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2, - V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3, - V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4, - V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5, - V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6, - V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7, - V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8, - V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9, - V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10, - V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11, - V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, - V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, -}; -#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) -enum v4l2_mpeg_audio_mode { - V4L2_MPEG_AUDIO_MODE_STEREO = 0, - V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, - V4L2_MPEG_AUDIO_MODE_DUAL = 2, - V4L2_MPEG_AUDIO_MODE_MONO = 3, -}; -#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) -enum v4l2_mpeg_audio_mode_extension { - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, -}; -#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) -enum v4l2_mpeg_audio_emphasis { - V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, - V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, - V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, -}; -#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) -enum v4l2_mpeg_audio_crc { - V4L2_MPEG_AUDIO_CRC_NONE = 0, - V4L2_MPEG_AUDIO_CRC_CRC16 = 1, -}; -#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) - -/* MPEG video */ -#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) -enum v4l2_mpeg_video_encoding { - V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, - V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, -}; -#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) -enum v4l2_mpeg_video_aspect { - V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, - V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, - V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, - V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, -}; -#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) -#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) -#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) -#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) -#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) -enum v4l2_mpeg_video_bitrate_mode { - V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, - V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, -}; -#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) -#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) -#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) -#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) -#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) - -/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */ -#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) -#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) -enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) -enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) -enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) -enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) -#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) -enum v4l2_mpeg_cx2341x_video_median_filter_type { - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) -#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) - -/* - * T U N I N G - */ -struct v4l2_tuner -{ - __u32 index; - __u8 name[32]; - enum v4l2_tuner_type type; - __u32 capability; - __u32 rangelow; - __u32 rangehigh; - __u32 rxsubchans; - __u32 audmode; - __s32 signal; - __s32 afc; - __u32 reserved[4]; -}; - -struct v4l2_modulator -{ - __u32 index; - __u8 name[32]; - __u32 capability; - __u32 rangelow; - __u32 rangehigh; - __u32 txsubchans; - __u32 reserved[4]; -}; - -/* Flags for the 'capability' field */ -#define V4L2_TUNER_CAP_LOW 0x0001 -#define V4L2_TUNER_CAP_NORM 0x0002 -#define V4L2_TUNER_CAP_STEREO 0x0010 -#define V4L2_TUNER_CAP_LANG2 0x0020 -#define V4L2_TUNER_CAP_SAP 0x0020 -#define V4L2_TUNER_CAP_LANG1 0x0040 - -/* Flags for the 'rxsubchans' field */ -#define V4L2_TUNER_SUB_MONO 0x0001 -#define V4L2_TUNER_SUB_STEREO 0x0002 -#define V4L2_TUNER_SUB_LANG2 0x0004 -#define V4L2_TUNER_SUB_SAP 0x0004 -#define V4L2_TUNER_SUB_LANG1 0x0008 - -/* Values for the 'audmode' field */ -#define V4L2_TUNER_MODE_MONO 0x0000 -#define V4L2_TUNER_MODE_STEREO 0x0001 -#define V4L2_TUNER_MODE_LANG2 0x0002 -#define V4L2_TUNER_MODE_SAP 0x0002 -#define V4L2_TUNER_MODE_LANG1 0x0003 -#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 - -struct v4l2_frequency -{ - __u32 tuner; - enum v4l2_tuner_type type; - __u32 frequency; - __u32 reserved[8]; -}; - -/* - * A U D I O - */ -struct v4l2_audio -{ - __u32 index; - __u8 name[32]; - __u32 capability; - __u32 mode; - __u32 reserved[2]; -}; - -/* Flags for the 'capability' field */ -#define V4L2_AUDCAP_STEREO 0x00001 -#define V4L2_AUDCAP_AVL 0x00002 - -/* Flags for the 'mode' field */ -#define V4L2_AUDMODE_AVL 0x00001 - -struct v4l2_audioout -{ - __u32 index; - __u8 name[32]; - __u32 capability; - __u32 mode; - __u32 reserved[2]; -}; - -/* - * M P E G S E R V I C E S - * - * NOTE: EXPERIMENTAL API - */ -#if 1 -#define V4L2_ENC_IDX_FRAME_I (0) -#define V4L2_ENC_IDX_FRAME_P (1) -#define V4L2_ENC_IDX_FRAME_B (2) -#define V4L2_ENC_IDX_FRAME_MASK (0xf) - -struct v4l2_enc_idx_entry { - __u64 offset; - __u64 pts; - __u32 length; - __u32 flags; - __u32 reserved[2]; -}; - -#define V4L2_ENC_IDX_ENTRIES (64) -struct v4l2_enc_idx { - __u32 entries; - __u32 entries_cap; - __u32 reserved[4]; - struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; -}; - - -#define V4L2_ENC_CMD_START (0) -#define V4L2_ENC_CMD_STOP (1) -#define V4L2_ENC_CMD_PAUSE (2) -#define V4L2_ENC_CMD_RESUME (3) - -/* Flags for V4L2_ENC_CMD_STOP */ -#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) - -struct v4l2_encoder_cmd { - __u32 cmd; - __u32 flags; - union { - struct { - __u32 data[8]; - } raw; - }; -}; - -#endif - - -/* - * D A T A S E R V I C E S ( V B I ) - * - * Data services API by Michael Schimek - */ - -/* Raw VBI */ -struct v4l2_vbi_format -{ - __u32 sampling_rate; /* in 1 Hz */ - __u32 offset; - __u32 samples_per_line; - __u32 sample_format; /* V4L2_PIX_FMT_* */ - __s32 start[2]; - __u32 count[2]; - __u32 flags; /* V4L2_VBI_* */ - __u32 reserved[2]; /* must be zero */ -}; - -/* VBI flags */ -#define V4L2_VBI_UNSYNC (1<< 0) -#define V4L2_VBI_INTERLACED (1<< 1) - -/* Sliced VBI - * - * This implements is a proposal V4L2 API to allow SLICED VBI - * required for some hardware encoders. It should change without - * notice in the definitive implementation. - */ - -struct v4l2_sliced_vbi_format -{ - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - __u32 io_size; - __u32 reserved[2]; /* must be zero */ -}; - -/* Teletext World System Teletext - (WST), defined on ITU-R BT.653-2 */ -#define V4L2_SLICED_TELETEXT_B (0x0001) -/* Video Program System, defined on ETS 300 231*/ -#define V4L2_SLICED_VPS (0x0400) -/* Closed Caption, defined on EIA-608 */ -#define V4L2_SLICED_CAPTION_525 (0x1000) -/* Wide Screen System, defined on ITU-R BT1119.1 */ -#define V4L2_SLICED_WSS_625 (0x4000) - -#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) -#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) - -struct v4l2_sliced_vbi_cap -{ - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - enum v4l2_buf_type type; - __u32 reserved[3]; /* must be 0 */ -}; - -struct v4l2_sliced_vbi_data -{ - __u32 id; - __u32 field; /* 0: first field, 1: second field */ - __u32 line; /* 1-23 */ - __u32 reserved; /* must be 0 */ - __u8 data[48]; -}; - -/* - * A G G R E G A T E S T R U C T U R E S - */ - -/* Stream data format - */ -struct v4l2_format -{ - enum v4l2_buf_type type; - union - { - struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE - struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY - struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE - struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE - __u8 raw_data[200]; // user-defined - } fmt; -}; - - -/* Stream type-dependent parameters - */ -struct v4l2_streamparm -{ - enum v4l2_buf_type type; - union - { - struct v4l2_captureparm capture; - struct v4l2_outputparm output; - __u8 raw_data[200]; /* user-defined */ - } parm; -}; - -/* - * A D V A N C E D D E B U G G I N G - * - * NOTE: EXPERIMENTAL API - */ - -/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ - -#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ -#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver ID */ -#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ - -struct v4l2_register { - __u32 match_type; /* Match type */ - __u32 match_chip; /* Match this chip, meaning determined by match_type */ - __u64 reg; - __u64 val; -}; - -/* VIDIOC_G_CHIP_IDENT */ -struct v4l2_chip_ident { - __u32 match_type; /* Match type */ - __u32 match_chip; /* Match this chip, meaning determined by match_type */ - __u32 ident; /* chip identifier as specified in */ - __u32 revision; /* chip revision, chip specific */ -}; - -/* - * I O C T L C O D E S F O R V I D E O D E V I C E S - * - */ -#define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability) -#define VIDIOC_RESERVED _IO ('V', 1) -#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) -#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) -#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) -#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) -#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) -#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) -#define VIDIOC_S_FBUF _IOW ('V', 11, struct v4l2_framebuffer) -#define VIDIOC_OVERLAY _IOW ('V', 14, int) -#define VIDIOC_QBUF _IOWR ('V', 15, struct v4l2_buffer) -#define VIDIOC_DQBUF _IOWR ('V', 17, struct v4l2_buffer) -#define VIDIOC_STREAMON _IOW ('V', 18, int) -#define VIDIOC_STREAMOFF _IOW ('V', 19, int) -#define VIDIOC_G_PARM _IOWR ('V', 21, struct v4l2_streamparm) -#define VIDIOC_S_PARM _IOWR ('V', 22, struct v4l2_streamparm) -#define VIDIOC_G_STD _IOR ('V', 23, v4l2_std_id) -#define VIDIOC_S_STD _IOW ('V', 24, v4l2_std_id) -#define VIDIOC_ENUMSTD _IOWR ('V', 25, struct v4l2_standard) -#define VIDIOC_ENUMINPUT _IOWR ('V', 26, struct v4l2_input) -#define VIDIOC_G_CTRL _IOWR ('V', 27, struct v4l2_control) -#define VIDIOC_S_CTRL _IOWR ('V', 28, struct v4l2_control) -#define VIDIOC_G_TUNER _IOWR ('V', 29, struct v4l2_tuner) -#define VIDIOC_S_TUNER _IOW ('V', 30, struct v4l2_tuner) -#define VIDIOC_G_AUDIO _IOR ('V', 33, struct v4l2_audio) -#define VIDIOC_S_AUDIO _IOW ('V', 34, struct v4l2_audio) -#define VIDIOC_QUERYCTRL _IOWR ('V', 36, struct v4l2_queryctrl) -#define VIDIOC_QUERYMENU _IOWR ('V', 37, struct v4l2_querymenu) -#define VIDIOC_G_INPUT _IOR ('V', 38, int) -#define VIDIOC_S_INPUT _IOWR ('V', 39, int) -#define VIDIOC_G_OUTPUT _IOR ('V', 46, int) -#define VIDIOC_S_OUTPUT _IOWR ('V', 47, int) -#define VIDIOC_ENUMOUTPUT _IOWR ('V', 48, struct v4l2_output) -#define VIDIOC_G_AUDOUT _IOR ('V', 49, struct v4l2_audioout) -#define VIDIOC_S_AUDOUT _IOW ('V', 50, struct v4l2_audioout) -#define VIDIOC_G_MODULATOR _IOWR ('V', 54, struct v4l2_modulator) -#define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator) -#define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency) -#define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency) -#define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap) -#define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop) -#define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop) -#define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression) -#define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression) -#define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id) -#define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format) -#define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio) -#define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) -#define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) -#define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) -#define VIDIOC_G_SLICED_VBI_CAP _IOWR ('V', 69, struct v4l2_sliced_vbi_cap) -#define VIDIOC_LOG_STATUS _IO ('V', 70) -#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls) -#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) -#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls) -#if 1 -#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) -#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) -#define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx) -#define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd) -#define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd) - -/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ -#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) -#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) - -#define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident) -#endif - -#ifdef __OLD_VIDIOC_ -/* for compatibility, will go away some day */ -#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) -#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) -#define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) -#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) -#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) -#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) -#endif - -#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ - -#endif /* __LINUX_VIDEODEV2_H */ - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ -- cgit v1.2.3 From 82d5b54109a8409df48f0b9a02add1dcce01780b Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Thu, 24 Nov 2011 11:46:07 +0200 Subject: Fixed leaks in input plugins --HG-- branch : point-release --- src/input/input_cdda.c | 41 +++++++++++++++++++++++++++-------------- src/input/input_file.c | 11 ++++++++--- src/input/input_smb.c | 10 ++++++++-- 3 files changed, 43 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 22dfcac4c..4da456384 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -187,7 +187,7 @@ typedef struct { int mrls_allocated_entries; xine_mrl_t **mrls; - char *autoplaylist[MAX_TRACKS]; + char **autoplaylist; } cdda_input_class_t; @@ -2545,14 +2545,7 @@ static xine_mrl_t** cdda_class_get_dir(input_class_t *this_gen, } for (i = 0 ; i < num_tracks ; i++) { if (i < this->mrls_allocated_entries) { - if (this->mrls[i]->origin) - free(this->mrls[i]->origin); - if (this->mrls[i]->mrl) - free(this->mrls[i]->mrl); - if (this->mrls[i]->link) { - free(this->mrls[i]->link); - this->mrls[i]->link = NULL; - } + MRL_ZERO(this->mrls[i]); } else { this->mrls[i] = (xine_mrl_t *) xine_xmalloc(sizeof(xine_mrl_t)); @@ -2578,6 +2571,21 @@ static xine_mrl_t** cdda_class_get_dir(input_class_t *this_gen, return this->mrls; } +static void free_autoplay_list(cdda_input_class_t *this) +{ + /* free old playlist */ + if (this->autoplaylist) { + unsigned int i; + for( i = 0; this->autoplaylist[i]; i++ ) { + free( this->autoplaylist[i] ); + this->autoplaylist[i] = NULL; + } + + free(this->autoplaylist); + this->autoplaylist = NULL; + } +} + static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, int *num_files) { @@ -2589,11 +2597,7 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, lprintf("cdda_class_get_autoplay_list for >%s<\n", this->cdda_device); - /* free old playlist */ - for( i = 0; this->autoplaylist[i]; i++ ) { - free( this->autoplaylist[i] ); - this->autoplaylist[i] = NULL; - } + free_autoplay_list(this); /* get the CD TOC */ toc = init_cdrom_toc(); @@ -2651,6 +2655,8 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, num_tracks--; if (num_tracks >= MAX_TRACKS-1) num_tracks = MAX_TRACKS - 2; + + this->autoplaylist = calloc(num_tracks + 2, sizeof(char *)); for ( i = 0; i <= num_tracks; i++ ) this->autoplaylist[i] = _x_asprintf("cdda:/%d",i+toc->first_track); @@ -2779,7 +2785,14 @@ static void cdda_class_dispose (input_class_t *this_gen) { config->unregister_callback(config, "media.audio_cd.drive_slowdown"); #endif + free_autoplay_list(this); + + while (this->mrls_allocated_entries) { + MRL_ZERO(this->mrls[this->mrls_allocated_entries - 1]); + free(this->mrls[this->mrls_allocated_entries--]); + } free (this->mrls); + free (this); } diff --git a/src/input/input_file.c b/src/input/input_file.c index bb8afef92..2c56ae232 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -850,7 +850,7 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, this->mrls[num_files] = calloc(1, sizeof(xine_mrl_t)); } else - memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); + MRL_ZERO(this->mrls[num_files]); MRL_DUPLICATE(&dir_files[i], this->mrls[num_files]); @@ -868,7 +868,7 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, this->mrls[num_files] = calloc(1, sizeof(xine_mrl_t)); } else - memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); + MRL_ZERO(this->mrls[num_files]); MRL_DUPLICATE(&hide_files[i], this->mrls[num_files]); @@ -886,7 +886,7 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, this->mrls[num_files] = calloc(1, sizeof(xine_mrl_t)); } else - memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); + MRL_ZERO(this->mrls[num_files]); MRL_DUPLICATE(&norm_files[i], this->mrls[num_files]); @@ -954,7 +954,12 @@ static void file_class_dispose (input_class_t *this_gen) { config->unregister_callback(config, "media.files.origin_path"); + while(this->mrls_allocated_entries) { + MRL_ZERO(this->mrls[this->mrls_allocated_entries - 1]); + free(this->mrls[this->mrls_allocated_entries--]); + } free (this->mrls); + free (this); } diff --git a/src/input/input_smb.c b/src/input/input_smb.c index d82ab0aa7..e3ad51eb1 100644 --- a/src/input/input_smb.c +++ b/src/input/input_smb.c @@ -356,7 +356,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, (this->mrls_allocated_entries+1) * sizeof(xine_mrl_t*)); this->mrls[num_files] = calloc(1, sizeof(xine_mrl_t)); }else - memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); + MRL_ZERO(this->mrls[num_files]); MRL_DUPLICATE(&dir_files[i], this->mrls[num_files]); @@ -373,7 +373,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen, (this->mrls_allocated_entries+1) * sizeof(xine_mrl_t*)); this->mrls[num_files] = calloc(1, sizeof(xine_mrl_t)); }else - memset(this->mrls[num_files], 0, sizeof(xine_mrl_t)); + MRL_ZERO(this->mrls[num_files]); MRL_DUPLICATE(&norm_files[i], this->mrls[num_files]); @@ -456,6 +456,12 @@ smb_class_dispose (input_class_t *this_gen) { smb_input_class_t *this = (smb_input_class_t *) this_gen; + while(this->mrls_allocated_entries) { + MRL_ZERO(this->mrls[this->mrls_allocated_entries - 1]); + free(this->mrls[this->mrls_allocated_entries--]); + } + free(this->mrls); + free (this); } -- cgit v1.2.3 From 944ce1be60e6ade88fb41c1914eecaaf54bd2786 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Thu, 24 Nov 2011 12:40:33 +0200 Subject: Check fwrite return value --HG-- branch : point-release --- src/xine-engine/configfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index ca82c7b9e..cc53e646c 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -1021,7 +1021,9 @@ void xine_config_save (xine_t *xine, const char *filename) { buf = (char *) malloc(config_stat.st_size + 1); if((rlen = fread(buf, 1, config_stat.st_size, f_config)) && ((off_t)rlen == config_stat.st_size)) { - (void) fwrite(buf, 1, rlen, f_backup); + if (rlen != fwrite(buf, 1, rlen, f_backup)) { + lprintf("backing up configfile to %s failed\n", temp); + } } free(buf); -- cgit v1.2.3 From 0d1157df4bfbb7722473c5d0214c2024bb98f680 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Thu, 24 Nov 2011 12:44:04 +0200 Subject: Fixed aliasing --HG-- branch : point-release --- src/xine-engine/io_helper.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/xine-engine/io_helper.c b/src/xine-engine/io_helper.c index 22f34ffc2..eef843906 100644 --- a/src/xine-engine/io_helper.c +++ b/src/xine-engine/io_helper.c @@ -87,17 +87,19 @@ static int _x_io_tcp_connect_ipv4(xine_stream_t *stream, const char *host, int p for (i = 0; h->h_addr_list[i]; i++) { struct in_addr ia; - struct sockaddr_in sin; - + union { + struct sockaddr sa; + struct sockaddr_in in; + } saddr; memcpy (&ia, h->h_addr_list[i], 4); - sin.sin_family = AF_INET; - sin.sin_addr = ia; - sin.sin_port = htons(port); + saddr.in.sin_family = AF_INET; + saddr.in.sin_addr = ia; + saddr.in.sin_port = htons(port); #ifndef WIN32 - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) { + if (connect(s, &saddr.sa, sizeof(saddr.in))==-1 && errno != EINPROGRESS) { #else - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError() != WSAEWOULDBLOCK) { + if (connect(s, &saddr.sa, sizeof(saddr.in))==-1 && WSAGetLastError() != WSAEWOULDBLOCK) { if (stream) xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "io_helper: WSAGetLastError() = %d\n", WSAGetLastError()); #endif /* WIN32 */ -- cgit v1.2.3 From 0f1e27fa5225249eccbdc1aec4d462e94d7d2b66 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Thu, 24 Nov 2011 23:37:50 +0100 Subject: Don't check for and include a52_internal.h: it's not actually used. --HG-- branch : point-release extra : rebase_source : 3cc7f85e6e39b1af46b7da40edcdebda000ef8ff --- src/liba52/xine_a52_decoder.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/liba52/xine_a52_decoder.c b/src/liba52/xine_a52_decoder.c index 9e590f77d..b4b628c81 100644 --- a/src/liba52/xine_a52_decoder.c +++ b/src/liba52/xine_a52_decoder.c @@ -53,12 +53,6 @@ # include "a52.h" #endif -#ifdef HAVE_A52DEC_A52_INTERNAL_H -# include -#else -# include "a52_internal.h" -#endif - #include "buffer.h" #include "xineutils.h" -- cgit v1.2.3 From 5f4a4b5dcf03f3f05a82798d405a012f6ee19bba Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 25 Nov 2011 12:14:00 +0200 Subject: Added FOURCC codes for EAC3 --HG-- branch : point-release --- src/xine-engine/buffer_types.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index 913b29115..20b2d0754 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -1187,6 +1187,8 @@ static const audio_db_t audio_db[] = { }, { { + ME_FOURCC('E', 'A', 'C', '3'), + ME_FOURCC('e', 'c', '-', '3'), 0 }, BUF_AUDIO_EAC3, -- cgit v1.2.3 From cdd8e021f12258cc5a3275f30c07f21dd44ebed9 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 25 Nov 2011 12:16:36 +0200 Subject: demux_ts: Fixed incorrect check. Pointer to struct member is always non-NULL. --HG-- branch : point-release --- src/demuxers/demux_ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index a5c715c62..683a24532 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -2348,7 +2348,7 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, { case DEMUX_OPTIONAL_DATA_AUDIOLANG: if ((channel >= 0) && (channel < this->audio_tracks_count)) { - if(this->audio_tracks[channel].lang) + if (this->audio_tracks[channel].lang[0]) strcpy(str, this->audio_tracks[channel].lang); else sprintf(str, "%3i", _x_get_audio_channel(this->stream)); -- cgit v1.2.3 From 679f7ef6e859d0b36e941e5721651001f5e8846e Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 25 Nov 2011 12:19:50 +0200 Subject: demux_ts: fixed DEMUX_OPTIONAL_DATA_AUDIOLANG when language is unknown --HG-- branch : point-release --- src/demuxers/demux_ts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 683a24532..ed1f789ba 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -2351,10 +2351,10 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, if (this->audio_tracks[channel].lang[0]) strcpy(str, this->audio_tracks[channel].lang); else - sprintf(str, "%3i", _x_get_audio_channel(this->stream)); + sprintf(str, "%3i", channel); } else { - snprintf(str, XINE_LANG_MAX, "%3i", _x_get_audio_channel(this->stream)); + strcpy(str, "none"); } return DEMUX_OPTIONAL_SUCCESS; -- cgit v1.2.3 From 2b00fb6cedea5e6a72777210eb20bc34a7a3893b Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 25 Nov 2011 12:28:20 +0200 Subject: demux_ts: fixed DEMUX_OPTIONAL_DATA_SPULANG when language is unknown --HG-- branch : point-release --- src/demuxers/demux_ts.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index ed1f789ba..b6f11c91f 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -2360,10 +2360,14 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, case DEMUX_OPTIONAL_DATA_SPULANG: if (channel>=0 && channelspu_langs_count) { - memcpy(str, this->spu_langs[channel].desc.lang, 3); - str[3] = 0;} - else + if (this->spu_langs[channel].desc.lang[0]) { + strcpy(str, this->spu_langs[channel].desc.lang); + } else { + sprintf(str, "%3i", channel); + } + } else { strcpy(str, "none"); + } return DEMUX_OPTIONAL_SUCCESS; default: -- cgit v1.2.3 From 364abb8eb2ea8fecc6fbbe2fe2cdd6c3fc2cf204 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 25 Nov 2011 12:32:41 +0200 Subject: demux_ts: check if input plugin supports track languages when track language is unknown in demuxer --HG-- branch : point-release --- src/demuxers/demux_ts.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index b6f11c91f..084782f72 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -2348,10 +2348,14 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, { case DEMUX_OPTIONAL_DATA_AUDIOLANG: if ((channel >= 0) && (channel < this->audio_tracks_count)) { - if (this->audio_tracks[channel].lang[0]) + if (this->audio_tracks[channel].lang[0]) { strcpy(str, this->audio_tracks[channel].lang); - else + } else { + /* input plugin may know the language */ + if (this->input->get_capabilities(this->input) & INPUT_CAP_AUDIOLANG) + return DEMUX_OPTIONAL_UNSUPPORTED; sprintf(str, "%3i", channel); + } } else { strcpy(str, "none"); @@ -2363,6 +2367,9 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, if (this->spu_langs[channel].desc.lang[0]) { strcpy(str, this->spu_langs[channel].desc.lang); } else { + /* input plugin may know the language */ + if (this->input->get_capabilities(this->input) & INPUT_CAP_SPULANG) + return DEMUX_OPTIONAL_UNSUPPORTED; sprintf(str, "%3i", channel); } } else { -- cgit v1.2.3 From ba29cbe482d33b2cb5c26d16bad69f7b9c72b672 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 25 Nov 2011 14:58:33 +0200 Subject: Fixed using uninitialized variable (segfault in memcpy.c) --- src/xine-utils/memcpy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index fa568c485..df514b682 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -524,8 +524,8 @@ void xine_probe_fast_memcpy(xine_t *xine) /* some initial activity to ensure that we're not running slowly :-) */ for(j=0;j<50;j++) { - memcpy_method[i].function(buf2,buf1,BUFSIZE); - memcpy_method[i].function(buf1,buf2,BUFSIZE); + memcpy_method[1].function(buf2,buf1,BUFSIZE); + memcpy_method[1].function(buf1,buf2,BUFSIZE); } for(i=1; memcpy_method[i].name; i++) -- cgit v1.2.3 From 82ac6b0888808f0a95c44bad46dabb04f83a95af Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 25 Nov 2011 15:01:26 +0200 Subject: demux_ts: report only known audio/spu tracks to ui --HG-- branch : point-release --- src/demuxers/demux_ts.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 084782f72..ef71bdfa5 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -2356,11 +2356,12 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, return DEMUX_OPTIONAL_UNSUPPORTED; sprintf(str, "%3i", channel); } + return DEMUX_OPTIONAL_SUCCESS; } else { strcpy(str, "none"); } - return DEMUX_OPTIONAL_SUCCESS; + return DEMUX_OPTIONAL_UNSUPPORTED; case DEMUX_OPTIONAL_DATA_SPULANG: if (channel>=0 && channelspu_langs_count) { @@ -2372,10 +2373,11 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, return DEMUX_OPTIONAL_UNSUPPORTED; sprintf(str, "%3i", channel); } + return DEMUX_OPTIONAL_SUCCESS; } else { strcpy(str, "none"); } - return DEMUX_OPTIONAL_SUCCESS; + return DEMUX_OPTIONAL_UNSUPPORTED; default: return DEMUX_OPTIONAL_UNSUPPORTED; -- cgit v1.2.3 From 9aba010024ce1d10b78a44a19c433939c0cf201e Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 25 Nov 2011 15:05:07 +0200 Subject: demux_ts: flush known-sized PES payloads immediately. Fixes delayed subtitles and still images. --- src/demuxers/demux_ts.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index d1dfabbbb..b1b9fcde3 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -296,6 +296,7 @@ typedef struct { uint16_t descriptor_tag; /* +0x100 for PES stream IDs (no available TS descriptor tag?) */ uint8_t keep; /* used by demux_ts_dynamic_pmt_*() */ int corrupted_pes; + int pes_bytes_left; /* butes left if PES packet size is known */ int input_normpos; int input_time; @@ -995,7 +996,6 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, return 0 ; } - /* packet_len = p[4] << 8 | p[5]; */ stream_id = p[3]; header_len = p[8] + 9; @@ -1041,6 +1041,9 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->pts = pts; + m->pes_bytes_left = (int)(p[4] << 8 | p[5]) - header_len + 6; + lprintf("PES packet payload left: %d bytes\n", m->pes_bytes_left); + p += header_len; packet_len -= header_len; @@ -1050,10 +1053,8 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, } if (m->descriptor_tag == HDMV_SPU_BITMAP) { - long payload_len = ((buf[4] << 8) | buf[5]) - header_len + 6; - m->type |= BUF_SPU_HDMV; - m->buf->decoder_info[2] = payload_len; + m->buf->decoder_info[2] = m->pes_bytes_left; return header_len; } else @@ -1111,10 +1112,8 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, } else if (m->descriptor_tag == ISO_13818_PES_PRIVATE && p[0] == 0x20 && p[1] == 0x00) { /* DVBSUB */ - long payload_len = ((buf[4] << 8) | buf[5]) - header_len + 6; - m->type |= BUF_SPU_DVB; - m->buf->decoder_info[2] = payload_len; + m->buf->decoder_info[2] = m->pes_bytes_left; return header_len; } else if (p[0] == 0x0B && p[1] == 0x77) { /* ac3 - syncword */ @@ -1294,11 +1293,21 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (!m->corrupted_pes) { if ((m->buf->size + len) > MAX_PES_BUF_SIZE) { + m->pes_bytes_left -= m->buf->size; demux_ts_send_buffer(m, 0); m->buf = m->fifo->buffer_pool_alloc(m->fifo); } + memcpy(m->buf->mem + m->buf->size, ts, len); m->buf->size += len; + + if (m->pes_bytes_left > 0 && m->buf->size >= m->pes_bytes_left) { + /* PES payload complete */ + m->pes_bytes_left -= m->buf->size; + demux_ts_flush_media(m); + /* skip rest data - there shouldn't be any */ + m->corrupted_pes = 1; + } } } -- cgit v1.2.3 From 7df3729d54f06eaa2b0e55403405fe4a52e760a6 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Wed, 30 Nov 2011 12:29:03 +0200 Subject: demux_ts: fixed buffer leak --- src/demuxers/demux_ts.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index b1b9fcde3..b7611dcde 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -469,7 +469,10 @@ static int demux_ts_dynamic_pmt_find (demux_ts_t *this, } m->pid = pid; - m->buf = 0; + if (m->buf) { + m->buf->free_buffer(m->buf); + m->buf = NULL; + } m->counter = INVALID_CC; m->corrupted_pes = 1; -- cgit v1.2.3 From 508e9088eec8f00b5dea9571383480803d4ad45e Mon Sep 17 00:00:00 2001 From: Torsten Jager Date: Fri, 9 Dec 2011 14:21:07 +0200 Subject: demux_ts: Fill buffers up to buf->max_size. Saves lot of memory. --- src/demuxers/demux_ts.c | 4 +--- src/input/net_buf_ctrl.c | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index b7611dcde..9c0804fbe 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -182,8 +182,6 @@ #define BUF_SIZE (NPKT_PER_READ * (PKT_SIZE + 4)) -#define MAX_PES_BUF_SIZE 2048 - #define CORRUPT_PES_THRESHOLD 10 #define NULL_PID 0x1fff @@ -1295,7 +1293,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (!m->corrupted_pes) { - if ((m->buf->size + len) > MAX_PES_BUF_SIZE) { + if ((m->buf->size + len) > m->buf->max_size) { m->pes_bytes_left -= m->buf->size; demux_ts_send_buffer(m, 0); m->buf = m->fifo->buffer_pool_alloc(m->fifo); diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index d187b5c2b..ecea09dbf 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -162,8 +162,8 @@ static void dvbspeed_init (nbc_t *this) { #endif } if (xine_config_lookup_entry (xine, "engine.buffers.video_num_buffers", - &entry) && (entry.num_value < 1800)) { - config->update_num (config, "engine.buffers.video_num_buffers", 1800); + &entry) && (entry.num_value < 800)) { + config->update_num (config, "engine.buffers.video_num_buffers", 800); #ifdef LOG_DVBSPEED printf ("net_buf_ctrl: enlarged video fifo to 1800 buffers\n"); #endif -- cgit v1.2.3