From 652a40e06b8cbdfb45d934cfa860f3b125c932e9 Mon Sep 17 00:00:00 2001 From: cigaes Date: Sat, 21 May 2011 18:46:39 +0000 Subject: stream dump: print progress information git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33478 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/mplayer.c b/mplayer.c index 09ff374275..44b6789603 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1338,6 +1338,50 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame) free(line); } +struct stream_dump_progress { + uint64_t count; + unsigned start_time; + unsigned last_print_time; +}; + +static void stream_dump_progress_start(struct stream_dump_progress *p) +{ + p->start_time = p->last_print_time = GetTimerMS(); + p->count = 0; +} + +static void stream_dump_progress(struct stream_dump_progress *p, + uint64_t len, stream_t *stream) +{ + p->count += len; + unsigned t = GetTimerMS(); + if (t - p->last_print_time < 1000) + return; + + uint64_t start = stream->start_pos; + uint64_t end = stream->end_pos; + uint64_t pos = stream->pos; + + p->last_print_time = t; + /* TODO: pretty print sizes; ETA */ + if (end > start && pos >= start && pos <= end) { + mp_tmsg(MSGT_STATUSLINE, MSGL_STATUS, + "dump: %"PRIu64" bytes written (~%.1f%%)", + p->count, 100.0 * (pos - start) / (end - start)); + mp_msg(MSGT_STATUSLINE, MSGL_STATUS, "\r"); + } else { + mp_tmsg(MSGT_STATUSLINE, MSGL_STATUS, + "dump: %"PRIu64" bytes written", p->count); + mp_msg(MSGT_STATUSLINE, MSGL_STATUS, "\r"); + } +} + +static void stream_dump_progress_end(struct stream_dump_progress *p, char *name) +{ + mp_msg(MSGT_CPLAYER, MSGL_INFO, "dump: %"PRIu64" bytes written to '%s'.\n", + p->count, name); +} + /** * \brief build a chain of audio filters that converts the input format * to the ao's format, taking into account the current playback_speed. @@ -4287,6 +4331,8 @@ if(stream_dump_type==5){ int chapter = opts->chapterrange[0] - 1; stream_control(mpctx->stream, STREAM_CTRL_SEEK_TO_CHAPTER, &chapter); } + struct stream_dump_progress info; + stream_dump_progress_start(&info); while(!mpctx->stream->eof && !async_quit_request){ len=stream_read(mpctx->stream,buf,4096); if(len>0) { @@ -4295,6 +4341,7 @@ if(stream_dump_type==5){ exit_player(mpctx, EXIT_ERROR); } } + stream_dump_progress(&info, len, mpctx->stream); if (opts->chapterrange[1] > 0) { int chapter = -1; if (stream_control(mpctx->stream, STREAM_CTRL_GET_CURRENT_CHAPTER, @@ -4307,6 +4354,7 @@ if(stream_dump_type==5){ mp_tmsg(MSGT_GLOBAL,MSGL_FATAL,"%s: Error writing file.\n",opts->stream_dump_name); exit_player(mpctx, EXIT_ERROR); } + stream_dump_progress_end(&info, opts->stream_dump_name); mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Stream dump complete.\n"); exit_player_with_rc(mpctx, EXIT_EOF, 0); } @@ -4512,12 +4560,17 @@ if((stream_dump_type)&&(stream_dump_type<4)){ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Cannot open dump file.\n"); exit_player(mpctx, EXIT_ERROR); } + struct stream_dump_progress info; + stream_dump_progress_start(&info); while(!ds->eof){ unsigned char* start; int in_size=ds_get_packet(ds,&start); if( (mpctx->demuxer->file_format==DEMUXER_TYPE_AVI || mpctx->demuxer->file_format==DEMUXER_TYPE_ASF || mpctx->demuxer->file_format==DEMUXER_TYPE_MOV) && stream_dump_type==2) fwrite(&in_size,1,4,f); - if(in_size>0) fwrite(start,in_size,1,f); + if(in_size>0) { + fwrite(start,in_size,1,f); + stream_dump_progress(&info, in_size, mpctx->stream); + } if (opts->chapterrange[1] > 0) { int cur_chapter = demuxer_get_current_chapter(mpctx->demuxer, 0); if(cur_chapter!=-1 && cur_chapter+1 > opts->chapterrange[1]) @@ -4525,6 +4578,7 @@ if((stream_dump_type)&&(stream_dump_type<4)){ } } fclose(f); + stream_dump_progress_end(&info, opts->stream_dump_name); mp_tmsg(MSGT_CPLAYER ,MSGL_INFO, "Stream dump complete.\n"); exit_player_with_rc(mpctx, EXIT_EOF, 0); } -- cgit v1.2.3 From 30d81cf7265fb0eed8531d49744fdd8952877029 Mon Sep 17 00:00:00 2001 From: ib Date: Sun, 22 May 2011 20:19:28 +0000 Subject: cosmetics: asf.h: Fix comment error According to the ASF documentation, MF_PD_ASF_FILEPROPERTIES_PREROLL (preroll) is UINT64. Fix type mentioned in comment. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33484 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/asf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpdemux/asf.h b/libmpdemux/asf.h index a3d2b01c17..a2bf546fd1 100644 --- a/libmpdemux/asf.h +++ b/libmpdemux/asf.h @@ -52,7 +52,7 @@ typedef struct __attribute__((packed)) { uint64_t num_packets; //Number of packets UINT64 8 uint64_t play_duration; //Timestamp of the end position UINT64 8 uint64_t send_duration; //Duration of the playback UINT64 8 - uint64_t preroll; //Time to bufferize before playing UINT32 4 + uint64_t preroll; //Time to bufferize before playing UINT64 8 uint32_t flags; //Unknown, maybe flags ( usually contains 2 ) UINT32 4 uint32_t min_packet_size; //Min size of the packet, in bytes UINT32 4 uint32_t max_packet_size; //Max size of the packet UINT32 4 -- cgit v1.2.3 From ecfffe6466c3a4df510f891a927de91a99944b37 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 6 Jul 2011 07:09:03 +0300 Subject: cosmetics: vf_delogo.c: remove tabs to allow direct merge Remove tab characters to make the file match MPlayer 1 and thus allow directly applying change from there. --- libmpcodecs/vf_delogo.c | 114 ++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/libmpcodecs/vf_delogo.c b/libmpcodecs/vf_delogo.c index 342c88ee59..fb85c553ab 100644 --- a/libmpcodecs/vf_delogo.c +++ b/libmpcodecs/vf_delogo.c @@ -50,7 +50,7 @@ static struct vf_priv_s { #define MAX(a,b) (((a) > (b)) ? (a) : (b)) static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int width, int height, - int logo_x, int logo_y, int logo_w, int logo_h, int band, int show, int direct) { + int logo_x, int logo_y, int logo_w, int logo_h, int band, int show, int direct) { int y, x; int interp, dist; uint8_t *xdst, *xsrc; @@ -80,46 +80,46 @@ static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int for(y = logo_y1+1; y < logo_y2-1; y++) { - for (x = logo_x1+1, xdst = dst+logo_x1+1, xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) { - interp = ((topleft[srcStride*(y-logo_y-yclipt)] - + topleft[srcStride*(y-logo_y-1-yclipt)] - + topleft[srcStride*(y-logo_y+1-yclipt)])*(logo_w-(x-logo_x))/logo_w - + (topright[srcStride*(y-logo_y-yclipt)] - + topright[srcStride*(y-logo_y-1-yclipt)] - + topright[srcStride*(y-logo_y+1-yclipt)])*(x-logo_x)/logo_w - + (topleft[x-logo_x-xclipl] - + topleft[x-logo_x-1-xclipl] - + topleft[x-logo_x+1-xclipl])*(logo_h-(y-logo_y))/logo_h - + (botleft[x-logo_x-xclipl] - + botleft[x-logo_x-1-xclipl] - + botleft[x-logo_x+1-xclipl])*(y-logo_y)/logo_h - )/6; -/* interp = (topleft[srcStride*(y-logo_y)]*(logo_w-(x-logo_x))/logo_w - + topright[srcStride*(y-logo_y)]*(x-logo_x)/logo_w - + topleft[x-logo_x]*(logo_h-(y-logo_y))/logo_h - + botleft[x-logo_x]*(y-logo_y)/logo_h - )/2;*/ - if (y >= logo_y+band && y < logo_y+logo_h-band && x >= logo_x+band && x < logo_x+logo_w-band) { - *xdst = interp; - } else { - dist = 0; - if (x < logo_x+band) dist = MAX(dist, logo_x-x+band); - else if (x >= logo_x+logo_w-band) dist = MAX(dist, x-(logo_x+logo_w-1-band)); - if (y < logo_y+band) dist = MAX(dist, logo_y-y+band); - else if (y >= logo_y+logo_h-band) dist = MAX(dist, y-(logo_y+logo_h-1-band)); - *xdst = (*xsrc*dist + interp*(band-dist))/band; - if (show && (dist == band-1)) *xdst = 0; - } - } - - dst+= dstStride; - src+= srcStride; + for (x = logo_x1+1, xdst = dst+logo_x1+1, xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) { + interp = ((topleft[srcStride*(y-logo_y-yclipt)] + + topleft[srcStride*(y-logo_y-1-yclipt)] + + topleft[srcStride*(y-logo_y+1-yclipt)])*(logo_w-(x-logo_x))/logo_w + + (topright[srcStride*(y-logo_y-yclipt)] + + topright[srcStride*(y-logo_y-1-yclipt)] + + topright[srcStride*(y-logo_y+1-yclipt)])*(x-logo_x)/logo_w + + (topleft[x-logo_x-xclipl] + + topleft[x-logo_x-1-xclipl] + + topleft[x-logo_x+1-xclipl])*(logo_h-(y-logo_y))/logo_h + + (botleft[x-logo_x-xclipl] + + botleft[x-logo_x-1-xclipl] + + botleft[x-logo_x+1-xclipl])*(y-logo_y)/logo_h + )/6; +/* interp = (topleft[srcStride*(y-logo_y)]*(logo_w-(x-logo_x))/logo_w + + topright[srcStride*(y-logo_y)]*(x-logo_x)/logo_w + + topleft[x-logo_x]*(logo_h-(y-logo_y))/logo_h + + botleft[x-logo_x]*(y-logo_y)/logo_h + )/2;*/ + if (y >= logo_y+band && y < logo_y+logo_h-band && x >= logo_x+band && x < logo_x+logo_w-band) { + *xdst = interp; + } else { + dist = 0; + if (x < logo_x+band) dist = MAX(dist, logo_x-x+band); + else if (x >= logo_x+logo_w-band) dist = MAX(dist, x-(logo_x+logo_w-1-band)); + if (y < logo_y+band) dist = MAX(dist, logo_y-y+band); + else if (y >= logo_y+logo_h-band) dist = MAX(dist, y-(logo_y+logo_h-1-band)); + *xdst = (*xsrc*dist + interp*(band-dist))/band; + if (show && (dist == band-1)) *xdst = 0; + } + } + + dst+= dstStride; + src+= srcStride; } } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt){ return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } @@ -130,15 +130,15 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){ if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ // ok, we can do pp in-place (or pp disabled): vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, - mpi->type, mpi->flags, mpi->w, mpi->h); + mpi->type, mpi->flags, mpi->w, mpi->h); mpi->planes[0]=vf->dmpi->planes[0]; mpi->stride[0]=vf->dmpi->stride[0]; mpi->width=vf->dmpi->width; if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[2]=vf->dmpi->planes[2]; - mpi->stride[1]=vf->dmpi->stride[1]; - mpi->stride[2]=vf->dmpi->stride[2]; + mpi->stride[1]=vf->dmpi->stride[1]; + mpi->stride[2]=vf->dmpi->stride[2]; } mpi->flags|=MP_IMGFLAG_DIRECT; } @@ -147,22 +147,22 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w,mpi->h); + // no DR, so get a new image! hope we'll get DR buffer: + vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w,mpi->h); } dmpi= vf->dmpi; delogo(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, - vf->priv->xoff, vf->priv->yoff, vf->priv->lw, vf->priv->lh, vf->priv->band, vf->priv->show, - mpi->flags&MP_IMGFLAG_DIRECT); + vf->priv->xoff, vf->priv->yoff, vf->priv->lw, vf->priv->lh, vf->priv->band, vf->priv->show, + mpi->flags&MP_IMGFLAG_DIRECT); delogo(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, - vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show, - mpi->flags&MP_IMGFLAG_DIRECT); + vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show, + mpi->flags&MP_IMGFLAG_DIRECT); delogo(dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2, - vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show, - mpi->flags&MP_IMGFLAG_DIRECT); + vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show, + mpi->flags&MP_IMGFLAG_DIRECT); vf_clone_mpi_attributes(dmpi, mpi); @@ -184,7 +184,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){ case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: - return vf_next_query_format(vf,vf->priv->outfmt); + return vf_next_query_format(vf,vf->priv->outfmt); } return 0; } @@ -204,15 +204,15 @@ static int vf_open(vf_instance_t *vf, char *args){ vf->uninit=uninit; mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n", - vf->priv->xoff, vf->priv->yoff, - vf->priv->lw, vf->priv->lh, - vf->priv->band); + vf->priv->xoff, vf->priv->yoff, + vf->priv->lw, vf->priv->lh, + vf->priv->band); vf->priv->show = 0; if (vf->priv->band < 0) { - vf->priv->band = 4; - vf->priv->show = 1; + vf->priv->band = 4; + vf->priv->show = 1; } @@ -225,7 +225,7 @@ static int vf_open(vf_instance_t *vf, char *args){ vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); if(!vf->priv->outfmt) { - uninit(vf); + uninit(vf); return 0; // no csp match :( } -- cgit v1.2.3 From 4f4fae851dd2239c0ddc2a3d9dc785fa38a3fd1f Mon Sep 17 00:00:00 2001 From: cigaes Date: Mon, 23 May 2011 16:32:14 +0000 Subject: vf_delogo: allow to change the rectangle based on the time NOTE: the memory for the "file" argument will be leaked; dynamic options are not automatically freed. Not fixing that now as I might implement more general handling later. -uau git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33488 b3059339-0415-0410-9bf9-f77b7e298cf2 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33498 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 4 ++ libmpcodecs/vf_delogo.c | 147 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 134 insertions(+), 17 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index afb12a8027..069eac270e 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -7236,6 +7236,10 @@ width and height of the cleared rectangle Thickness of the fuzzy edge of the rectangle (added to w and h). When set to \-1, a green rectangle is drawn on the screen to simplify finding the right x,y,w,h parameters. +.IPs file= +You can specify a text file to load the coordinates from. +Each line must have a timestamp (in seconds, and in ascending order) and the +"x:y:w:h:t" coordinates (t can be omitted). .RE .PD 1 . diff --git a/libmpcodecs/vf_delogo.c b/libmpcodecs/vf_delogo.c index fb85c553ab..8fcc869c91 100644 --- a/libmpcodecs/vf_delogo.c +++ b/libmpcodecs/vf_delogo.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include "mp_msg.h" @@ -41,14 +43,63 @@ static struct vf_priv_s { unsigned int outfmt; int xoff, yoff, lw, lh, band, show; + const char *file; + struct timed_rectangle { + int ts, x, y, w, h, b; + } *timed_rect; + int n_timed_rect; + int cur_timed_rect; } const vf_priv_dflt = { 0, - 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, + NULL, NULL, 0, 0, }; #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) +/** + * Adjust the coordinates to suit the band width + * Also print a notice in verbose mode + */ +static void fix_band(struct vf_priv_s *p) +{ + p->show = 0; + if (p->band < 0) { + p->band = 4; + p->show = 1; + } + p->lw += p->band*2; + p->lh += p->band*2; + p->xoff -= p->band; + p->yoff -= p->band; + mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n", + p->xoff, p->yoff, p->lw, p->lh, p->band); +} + +static void update_sub(struct vf_priv_s *p, double pts) +{ + int ipts = pts * 1000; + int tr = p->cur_timed_rect; + while (tr < p->n_timed_rect - 1 && ipts >= p->timed_rect[tr + 1].ts) + tr++; + while (tr >= 0 && ipts < p->timed_rect[tr].ts) + tr--; + if (tr == p->cur_timed_rect) + return; + p->cur_timed_rect = tr; + if (tr >= 0) { + p->xoff = p->timed_rect[tr].x; + p->yoff = p->timed_rect[tr].y; + p->lw = p->timed_rect[tr].w; + p->lh = p->timed_rect[tr].h; + p->band = p->timed_rect[tr].b; + } else { + p->xoff = p->yoff = p->lw = p->lh = p->band = 0; + } + fix_band(p); +} + static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int width, int height, int logo_x, int logo_y, int logo_w, int logo_h, int band, int show, int direct) { int y, x; @@ -154,6 +205,8 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ } dmpi= vf->dmpi; + if (vf->priv->timed_rect) + update_sub(vf->priv, pts); delogo(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, vf->priv->xoff, vf->priv->yoff, vf->priv->lw, vf->priv->lh, vf->priv->band, vf->priv->show, mpi->flags&MP_IMGFLAG_DIRECT); @@ -196,6 +249,74 @@ static const unsigned int fmt_list[]={ 0 }; +static int load_timed_rectangles(struct vf_priv_s *delogo) +{ + FILE *f; + char line[2048]; + int lineno = 0, p; + double ts, last_ts = 0; + struct timed_rectangle *rect = NULL, *nr; + int n_rect = 0, alloc_rect = 0; + + f = fopen(delogo->file, "r"); + if (!f) { + mp_msg(MSGT_VFILTER, MSGL_ERR, "delogo: unable to load %s: %s\n", + delogo->file, strerror(errno)); + return -1; + } + while (fgets(line, sizeof(line), f)) { + lineno++; + if (*line == '#' || *line == '\n') + continue; + if (n_rect == alloc_rect) { + if (alloc_rect > INT_MAX / 2 / (int)sizeof(*rect)) { + mp_msg(MSGT_VFILTER, MSGL_WARN, + "delogo: too many rectangles\n"); + goto load_error; + } + alloc_rect = alloc_rect ? 2 * alloc_rect : 256; + nr = realloc(rect, alloc_rect * sizeof(*rect)); + if (!nr) { + mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: out of memory\n"); + goto load_error; + } + rect = nr; + } + nr = rect + n_rect; + memset(nr, 0, sizeof(*nr)); + p = sscanf(line, "%lf %d:%d:%d:%d:%d", + &ts, &nr->x, &nr->y, &nr->w, &nr->h, &nr->b); + if ((p == 2 && !nr->x) || p == 5 || p == 6) { + if (ts <= last_ts) + mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: %s:%d: wrong time\n", + delogo->file, lineno); + nr->ts = 1000 * ts + 0.5; + n_rect++; + } else { + mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: %s:%d: syntax error\n", + delogo->file, lineno); + } + } + fclose(f); + if (!n_rect) { + mp_msg(MSGT_VFILTER, MSGL_ERR, "delogo: %s: no rectangles found\n", + delogo->file); + free(rect); + return -1; + } + nr = realloc(rect, n_rect * sizeof(*rect)); + if (nr) + rect = nr; + delogo->timed_rect = rect; + delogo->n_timed_rect = n_rect; + return 0; + +load_error: + free(rect); + fclose(f); + return -1; +} + static int vf_open(vf_instance_t *vf, char *args){ vf->config=config; vf->put_image=put_image; @@ -203,23 +324,14 @@ static int vf_open(vf_instance_t *vf, char *args){ vf->query_format=query_format; vf->uninit=uninit; - mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n", - vf->priv->xoff, vf->priv->yoff, - vf->priv->lw, vf->priv->lh, - vf->priv->band); - - vf->priv->show = 0; - - if (vf->priv->band < 0) { - vf->priv->band = 4; - vf->priv->show = 1; + if (vf->priv->file) { + if (load_timed_rectangles(vf->priv)) + return 0; + mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d from %s\n", + vf->priv->n_timed_rect, vf->priv->file); + vf->priv->cur_timed_rect = -1; } - - - vf->priv->lw += vf->priv->band*2; - vf->priv->lh += vf->priv->band*2; - vf->priv->xoff -= vf->priv->band; - vf->priv->yoff -= vf->priv->band; + fix_band(vf->priv); // check csp: vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); @@ -240,6 +352,7 @@ static const m_option_t vf_opts_fields[] = { { "h", ST_OFF(lh), CONF_TYPE_INT, 0, 0, 0, NULL }, { "t", ST_OFF(band), CONF_TYPE_INT, 0, 0, 0, NULL }, { "band", ST_OFF(band), CONF_TYPE_INT, 0, 0, 0, NULL }, // alias + { "file", ST_OFF(file), CONF_TYPE_STRING, 0, 0, 0, NULL }, { NULL, NULL, 0, 0, 0, 0, NULL } }; -- cgit v1.2.3 From f52b41600d32fb2f820a4387e79510a24aca7fe0 Mon Sep 17 00:00:00 2001 From: ib Date: Tue, 24 May 2011 13:35:26 +0000 Subject: demux_asf: Fix play duration calculation error Acording to the ASF documentation, the play duration is zero if the preroll value is greater than the play duration. The new way of determining it (suggested by reimar) prevents overflows as well. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33492 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/asfheader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c index 994c3e890d..857a899bef 100644 --- a/libmpdemux/asfheader.c +++ b/libmpdemux/asfheader.c @@ -542,7 +542,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ asf->packetsize=fileh->max_packet_size; asf->packet=malloc(asf->packetsize); // !!! asf->packetrate=fileh->max_bitrate/8.0/(double)asf->packetsize; - asf->movielength=(fileh->play_duration-10000*fileh->preroll)/10000000.0; + asf->movielength=FFMAX(0.0, (fileh->play_duration / 10000.0 - fileh->preroll) / 1000.0); } // find content header -- cgit v1.2.3 From 94d3e6a710c40806f44c1d39aaa0388c05487b8f Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 24 May 2011 19:47:07 +0000 Subject: cleanup: vo_direct3d: Mark a function static This fixes the warning: libvo/vo_direct3d.c:984:6: warning: no previous prototype for 'vo_draw_alpha_l8a8' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33499 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_direct3d.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index 65f5a6c2d1..2fb40d0398 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -979,8 +979,9 @@ static int draw_frame(uint8_t *src[]) * These values are then inverted again with the texture filter D3DBLEND_INVSRCALPHA */ -void vo_draw_alpha_l8a8(int w, int h, unsigned char* src, unsigned char *srca, - int srcstride, unsigned char* dstbase, int dststride) +static void vo_draw_alpha_l8a8(int w, int h, unsigned char* src, + unsigned char *srca, int srcstride, + unsigned char* dstbase, int dststride) { int y; for (y = 0; y < h; y++) { -- cgit v1.2.3 From 48fdd3d9268b55fe7e1743b43699b2650fb0db55 Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 24 May 2011 20:52:27 +0000 Subject: vo_gl: Support 9- and 10-bit YUV input for OpenGL VOs git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33502 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix clear/border color of chroma texture for 9- and 10-bit formats. Avoids pink borders for those formats. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33504 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/csputils.c | 6 ++++++ libvo/csputils.h | 1 + libvo/gl_common.h | 14 ++++++++++++++ libvo/vo_gl.c | 21 +++++++++++++-------- libvo/vo_gl2.c | 19 ++++++++++++------- 5 files changed, 46 insertions(+), 15 deletions(-) diff --git a/libvo/csputils.c b/libvo/csputils.c index 2978279398..0a58aa5a0e 100644 --- a/libvo/csputils.c +++ b/libvo/csputils.c @@ -62,6 +62,9 @@ void mp_gen_gamma_map(uint8_t *map, int size, float gamma) { * not with e.g. MP_CSP_XYZ */ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) { + float depth_multiplier = params->input_shift >= 0 ? + (1 << params->input_shift) : + (1.0 / (1 << -params->input_shift)); float uvcos = params->saturation * cos(params->hue); float uvsin = params->saturation * sin(params->hue); int format = params->format; @@ -128,6 +131,9 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) { // this "centers" contrast control so that e.g. a contrast of 0 // leads to a grey image, not a black one yuv2rgb[i][COL_C] += 0.5 - params->contrast / 2.0; + yuv2rgb[i][COL_Y] *= depth_multiplier; + yuv2rgb[i][COL_U] *= depth_multiplier; + yuv2rgb[i][COL_V] *= depth_multiplier; } } diff --git a/libvo/csputils.h b/libvo/csputils.h index acc8f59459..07d9932279 100644 --- a/libvo/csputils.h +++ b/libvo/csputils.h @@ -53,6 +53,7 @@ struct mp_csp_params { float rgamma; float ggamma; float bgamma; + int input_shift; }; void mp_gen_gamma_map(unsigned char *map, int size, float gamma); diff --git a/libvo/gl_common.h b/libvo/gl_common.h index fa0cffaf74..fca91d6f7d 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -353,6 +353,20 @@ int loadGPUProgram(GLenum target, char *prog); #define SET_YUV_CONVERSION(c) ((c) & YUV_CONVERSION_MASK) #define SET_YUV_LUM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_LUM_SCALER_SHIFT) #define SET_YUV_CHROM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_CHROM_SCALER_SHIFT) +//! returns whether the yuv conversion supports large brightness range etc. +static inline int glYUVLargeRange(int conv) +{ + switch (conv) + { + case YUV_CONVERSION_NONE: + case YUV_CONVERSION_COMBINERS: + case YUV_CONVERSION_COMBINERS_ATI: + case YUV_CONVERSION_FRAGMENT_LOOKUP3D: + case YUV_CONVERSION_TEXT_FRAGMENT: + return 0; + } + return 1; +} /** \} */ typedef struct { diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index bc50e245b3..f23d44ba64 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -247,7 +247,7 @@ static void texSize(int w, int h, int *texw, int *texh) { //! maximum size of custom fragment program #define MAX_CUSTOM_PROG_SIZE (1024 * 1024) static void update_yuvconv(void) { - int xs, ys; + int xs, ys, depth; float bri = eq_bri / 100.0; float cont = (eq_cont + 100) / 100.0; float hue = eq_hue / 100.0 * 3.1415927; @@ -256,11 +256,12 @@ static void update_yuvconv(void) { float ggamma = exp(log(8.0) * eq_ggamma / 100.0); float bgamma = exp(log(8.0) * eq_bgamma / 100.0); gl_conversion_params_t params = {gl_target, yuvconvtype, - {colorspace, levelconv, bri, cont, hue, sat, rgamma, ggamma, bgamma}, + {colorspace, levelconv, bri, cont, hue, sat, rgamma, ggamma, bgamma, 0}, texture_width, texture_height, 0, 0, filter_strength}; - mp_get_chroma_shift(image_format, &xs, &ys, NULL); + mp_get_chroma_shift(image_format, &xs, &ys, &depth); params.chrom_texw = params.texw >> xs; params.chrom_texh = params.texh >> ys; + params.csp_params.input_shift = -depth & 7; glSetupYUVConversion(¶ms); if (custom_prog) { FILE *f = fopen(custom_prog, "rb"); @@ -566,9 +567,11 @@ static int initGl(uint32_t d_width, uint32_t d_height) { if (is_yuv) { int i; - int xs, ys; + int xs, ys, depth; + int chroma_clear_val = 128; scale_type = get_scale_type(1); - mp_get_chroma_shift(image_format, &xs, &ys, NULL); + mp_get_chroma_shift(image_format, &xs, &ys, &depth); + chroma_clear_val >>= -depth & 7; mpglGenTextures(21, default_texs); default_texs[21] = 0; for (i = 0; i < 7; i++) { @@ -579,12 +582,14 @@ static int initGl(uint32_t d_width, uint32_t d_height) { } mpglActiveTexture(GL_TEXTURE1); glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type, - texture_width >> xs, texture_height >> ys, 128); + texture_width >> xs, texture_height >> ys, + chroma_clear_val); if (mipmap_gen) mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); mpglActiveTexture(GL_TEXTURE2); glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type, - texture_width >> xs, texture_height >> ys, 128); + texture_width >> xs, texture_height >> ys, + chroma_clear_val); if (mipmap_gen) mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); mpglActiveTexture(GL_TEXTURE0); @@ -1097,7 +1102,7 @@ query_format(uint32_t format) if (format == IMGFMT_RGB24 || format == IMGFMT_RGBA) return caps; if (use_yuv && mp_get_chroma_shift(format, NULL, NULL, &depth) && - (depth == 8 || depth == 16) && + (depth == 8 || depth == 16 || glYUVLargeRange(use_yuv)) && (IMGFMT_IS_YUVP16_NE(format) || !IMGFMT_IS_YUVP16(format))) return caps; // HACK, otherwise we get only b&w with some filters (e.g. -vf eq) diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index 21f779866c..ac1d957136 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -273,14 +273,18 @@ static int initTextures(void) glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); if (is_yuv) { - int xs, ys; - mp_get_chroma_shift(image_format, &xs, &ys, NULL); + int xs, ys, depth; + int chroma_clear_val = 128; + mp_get_chroma_shift(image_format, &xs, &ys, &depth); + chroma_clear_val >>= -depth & 7; mpglActiveTexture(GL_TEXTURE1); glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR, - texture_width >> xs, texture_height >> ys, 128); + texture_width >> xs, texture_height >> ys, + chroma_clear_val); mpglActiveTexture(GL_TEXTURE2); glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR, - texture_width >> xs, texture_height >> ys, 128); + texture_width >> xs, texture_height >> ys, + chroma_clear_val); mpglActiveTexture(GL_TEXTURE0); } @@ -559,7 +563,7 @@ static int initGl(uint32_t d_width, uint32_t d_height) glDisable(GL_CULL_FACE); glEnable (GL_TEXTURE_2D); if (is_yuv) { - int xs, ys; + int xs, ys, depth; gl_conversion_params_t params = {GL_TEXTURE_2D, use_yuv, {-1, -1, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0}, texture_width, texture_height, 0, 0, 0}; @@ -580,9 +584,10 @@ static int initGl(uint32_t d_width, uint32_t d_height) mpglBindProgram(GL_FRAGMENT_PROGRAM, fragprog); break; } - mp_get_chroma_shift(image_format, &xs, &ys, NULL); + mp_get_chroma_shift(image_format, &xs, &ys, &depth); params.chrom_texw = params.texw >> xs; params.chrom_texh = params.texh >> ys; + params.csp_params.input_shift = -depth & 7; glSetupYUVConversion(¶ms); } @@ -804,7 +809,7 @@ query_format(uint32_t format) { int depth; if (use_yuv && mp_get_chroma_shift(format, NULL, NULL, &depth) && - (depth == 8 || depth == 16) && + (depth == 8 || depth == 16 || glYUVLargeRange(use_yuv)) && (IMGFMT_IS_YUVP16_NE(format) || !IMGFMT_IS_YUVP16(format))) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE; -- cgit v1.2.3 From d26f11deaf0baa6882e2f599868b8d7cfbaa3ee4 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 29 May 2011 11:12:42 +0000 Subject: stream_cue: fix multiple bugs Spelling fix. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33510 b3059339-0415-0410-9bf9-f77b7e298cf2 Simplify: remove an unnecessary loop variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33511 b3059339-0415-0410-9bf9-f77b7e298cf2 Add some "const". git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33512 b3059339-0415-0410-9bf9-f77b7e298cf2 Simplify NULL check. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33513 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid crash if terminating " is missing. Part of patch by Ivan Kalvachev [ikalvachev gmail com]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33514 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix 0-termination being placed one byte too far. Part of patch by Ivan Kalvachev [ikalvachev gmail com]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33515 b3059339-0415-0410-9bf9-f77b7e298cf2 Ensure 0-termination even if line does not start with FILE " Part of patch by Ivan Kalvachev [ikalvachev gmail com]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33516 b3059339-0415-0410-9bf9-f77b7e298cf2 Only accept regular files as .bin files for .cue files. In particular avoids trying to use directories as .bin when e.g. we failed to extract a filename. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33517 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove a duplicated open() call that could lead to a file-descriptor leak in some cases. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33518 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid possible crash if cue filename is very short. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33519 b3059339-0415-0410-9bf9-f77b7e298cf2 Simplify by using av_strlcpy. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33520 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_cue.c | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/stream/stream_cue.c b/stream/stream_cue.c index 8851595c81..561529b03d 100644 --- a/stream/stream_cue.c +++ b/stream/stream_cue.c @@ -105,7 +105,7 @@ static struct cue_track_pos { /* number of tracks on the cd */ static int nTracks = 0; -static int digits2int(char s[2], int errval) { +static int digits2int(const char s[2], int errval) { uint8_t a = s[0] - '0'; uint8_t b = s[1] - '0'; if (a > 9 || b > 9) @@ -169,47 +169,47 @@ static int cue_getTrackinfo(FILE *fd_cue, char *Line, tTrack *track) * on the arrays to have the same size, thus we need to make * sure the sizes are in sync. */ -static int cue_find_bin (char *firstline) { +static int cue_find_bin (const char *firstline) { + struct stat filestat; const char *cur_name; - int i,j; char bin_filename[256]; char s[256]; char t[256]; int fd_bin; + int i = 0; /* get the filename out of that */ /* 12345 6 */ mp_msg (MSGT_OPEN,MSGL_INFO, "[bincue] cue_find_bin(%s)\n", firstline); if (strncmp(firstline, "FILE \"",6)==0) { - i = 0; - j = 0; - while ( firstline[6 + i] != '"') + firstline += 6; + while ( *firstline && *firstline != '"') { - bin_filename[j] = firstline[6 + i]; + bin_filename[i] = *firstline++; - /* if I found a path info, than delete all bevor it */ - switch (bin_filename[j]) + /* if I found a path info, then delete all before it */ + switch (bin_filename[i]) { case '\\': - j = 0; + i = 0; break; case '/': - j = 0; + i = 0; break; default: - j++; + i++; } - i++; } - bin_filename[j+1] = '\0'; - } + bin_filename[i] = '\0'; fd_bin = -1; for (i = 0; fd_bin == -1 && i < 6; i++) { + if (i > 1 && strlen(cue_filename) < 3) + break; switch (i) { case 0: /* now try to open that file, without path */ @@ -222,22 +222,19 @@ static int cue_find_bin (char *firstline) { break; case 2: /* now I would say the whole filename is shit, build our own */ - strncpy(s, cue_filename, strlen(cue_filename) - 3 ); - s[strlen(cue_filename) - 3] = '\0'; - strcat(s, "bin"); + av_strlcpy(s, cue_filename, strlen(cue_filename) - 3 ); + strcat(s, ".bin"); cur_name = s; break; case 3: /* ok try it with path */ snprintf(t, sizeof( t ), "%s/%s", bincue_path, s); - fd_bin = open (t, O_RDONLY); cur_name = t; break; case 4: /* now I would say the whole filename is shit, build our own */ - strncpy(s, cue_filename, strlen(cue_filename) - 3 ); - s[strlen(cue_filename) - 3] = '\0'; - strcat(s, "img"); + av_strlcpy(s, cue_filename, strlen(cue_filename) - 3 ); + strcat(s, ".img"); cur_name = s; break; case 5: @@ -247,6 +244,10 @@ static int cue_find_bin (char *firstline) { break; } fd_bin = open(cur_name, O_RDONLY); + if (fstat(fd_bin, &filestat) == -1 || !S_ISREG(filestat.st_mode)) { + close(fd_bin); + fd_bin = -1; + } if (fd_bin == -1) { mp_tmsg(MSGT_OPEN,MSGL_STATUS, "[bincue] bin filename tested: %s\n", cur_name); @@ -303,7 +304,7 @@ static inline int cue_mode_2_sector_size(int mode) } -static int cue_read_cue (char *in_cue_filename) +static int cue_read_cue (const char *in_cue_filename) { struct stat filestat; char sLine[256]; @@ -319,7 +320,7 @@ static int cue_read_cue (char *in_cue_filename) /* split the filename into a path and filename part */ s = strdup(in_cue_filename); t = strrchr(s, '/'); - if (t == (char *)NULL) + if (!t) t = "."; else { *t = '\0'; -- cgit v1.2.3 From e00b1d7f7fdab471461cfa2dfca602ac311b55fd Mon Sep 17 00:00:00 2001 From: iive Date: Sun, 29 May 2011 22:41:52 +0000 Subject: stream_cue: Avoid probing empty filename in cue_find_bin() git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33521 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_cue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stream/stream_cue.c b/stream/stream_cue.c index 561529b03d..ecc5e5b43a 100644 --- a/stream/stream_cue.c +++ b/stream/stream_cue.c @@ -208,8 +208,11 @@ static int cue_find_bin (const char *firstline) { fd_bin = -1; for (i = 0; fd_bin == -1 && i < 6; i++) { + if (i <=1 && bin_filename[0] == '\0') + continue; if (i > 1 && strlen(cue_filename) < 3) break; + switch (i) { case 0: /* now try to open that file, without path */ -- cgit v1.2.3 From 15513a77fb375acfbda6de36b806c0070472d04d Mon Sep 17 00:00:00 2001 From: iive Date: Sun, 29 May 2011 22:46:52 +0000 Subject: vo_xv: avoid setting background color due to resize flicker Set background color only when using ck-method=background. In the other cases clearing of the non-video image area should be done manually. Not drawing on the video image area prevents flickering (visible when resizing). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33522 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_xv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 6da354bd5a..cecbc68b7e 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -252,11 +252,12 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, depth = 24; XMatchVisualInfo(x11->display, x11->screen, depth, TrueColor, &vinfo); - xswa.background_pixel = 0; - if (x11->xv_ck_info.method == CK_METHOD_BACKGROUND) - xswa.background_pixel = x11->xv_colorkey; xswa.border_pixel = 0; - xswamask = CWBackPixel | CWBorderPixel; + xswamask = CWBorderPixel; + if (x11->xv_ck_info.method == CK_METHOD_BACKGROUND) { + xswa.background_pixel = x11->xv_colorkey; + xswamask |= CWBackPixel; + } vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, vo->dwidth, vo->dheight, flags, CopyFromParent, "xv", -- cgit v1.2.3 From ab1544b74d5d3f440dbcac801c3e3ebd676f9d7b Mon Sep 17 00:00:00 2001 From: iive Date: Sun, 29 May 2011 23:05:57 +0000 Subject: cleanup: x11_common: remove pointless GC operations Remove useless XSetBackground() call right before freeing the graphic context. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33524 b3059339-0415-0410-9bf9-f77b7e298cf2 Create empty vo_gc graphic context instead of one with undefined foreground color. The code that uses vo_gc already employs XSetForeground()/XSetBackground() to change the context accordingly. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33525 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/x11_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 12fc661dee..c576839ddb 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -732,7 +732,6 @@ void vo_x11_uninit(struct vo *vo) { if (x11->vo_gc != None) { - XSetBackground(vo->x11->display, x11->vo_gc, 0); XFreeGC(vo->x11->display, x11->vo_gc); x11->vo_gc = None; } @@ -1050,7 +1049,6 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, struct MPOpts *opts = vo->opts; struct vo_x11_state *x11 = vo->x11; Display *mDisplay = vo->x11->display; - XGCValues xgcv; if (WinID >= 0) { vo_fs = flags & VOFLAG_FULLSCREEN; x11->window = WinID ? (Window)WinID : x11->rootwin; @@ -1122,7 +1120,8 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, final: if (x11->vo_gc != None) XFreeGC(mDisplay, x11->vo_gc); - x11->vo_gc = XCreateGC(mDisplay, x11->window, GCForeground, &xgcv); + x11->vo_gc = XCreateGC(mDisplay, x11->window, 0, NULL); + XSync(mDisplay, False); x11->vo_mouse_autohide = 1; vo->event_fd = ConnectionNumber(x11->display); -- cgit v1.2.3 From be4d3d34914720c89c084a0532be178b5e0f12cb Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 30 May 2011 21:16:37 +0000 Subject: vf_dint, vf_divtc: fix code assuming "char" is signed Use int as type, there is no reason to use char which also causes issues since it may be either signed or unsigned. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33529 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix code assuming that "char" is signed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33530 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix code incorrectly assuming "char" is signed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33531 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_dint.c | 12 ++++++------ libmpcodecs/vf_divtc.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libmpcodecs/vf_dint.c b/libmpcodecs/vf_dint.c index f5fc88e328..b449f9292c 100644 --- a/libmpcodecs/vf_dint.c +++ b/libmpcodecs/vf_dint.c @@ -32,7 +32,7 @@ struct vf_priv_s { float sense; // first parameter float level; // second parameter unsigned int imgfmt; - char diff; + int diff; uint32_t max; // int dfr; // int rdfr; @@ -73,7 +73,7 @@ static int config (struct vf_instance *vf, vf->priv->diff = 31; mp_msg (MSGT_VFILTER, MSGL_INFO, "Drop-interlaced: %dx%d diff %d / level %u\n", vf->priv->pmpi->width, vf->priv->pmpi->height, - (int)vf->priv->diff, (unsigned int)vf->priv->max); + vf->priv->diff, (unsigned int)vf->priv->max); // vf->priv->rdfr = vf->priv->dfr = 0; vf->priv->was_dint = 0; return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); @@ -81,10 +81,10 @@ static int config (struct vf_instance *vf, static int put_image (struct vf_instance *vf, mp_image_t *mpi, double pts) { - char rrow0[MAXROWSIZE]; - char rrow1[MAXROWSIZE]; - char rrow2[MAXROWSIZE]; - char *row0 = rrow0, *row1 = rrow1, *row2 = rrow2/*, *row3 = rrow3*/; + int8_t rrow0[MAXROWSIZE]; + int8_t rrow1[MAXROWSIZE]; + int8_t rrow2[MAXROWSIZE]; + int8_t *row0 = rrow0, *row1 = rrow1, *row2 = rrow2/*, *row3 = rrow3*/; int rowsize = mpi->width; uint32_t nok = 0, max = vf->priv->max; int diff = vf->priv->diff; diff --git a/libmpcodecs/vf_divtc.c b/libmpcodecs/vf_divtc.c index 3a4f2169ab..e04e7c0b4e 100644 --- a/libmpcodecs/vf_divtc.c +++ b/libmpcodecs/vf_divtc.c @@ -42,7 +42,7 @@ struct vf_priv_s ocount, sum[5]; double threshold; FILE *file; - char *bdata; + int8_t *bdata; unsigned int *csdata; int *history; struct vf_detc_pts_buf ptsbuf; @@ -386,8 +386,8 @@ static int analyze(struct vf_priv_s *p) { int *buf=0, *bp, bufsize=0, n, b, f, i, j, m, s; unsigned int *cbuf=0, *cp; - char *pbuf; - char lbuf[256]; + int8_t *pbuf; + int8_t lbuf[256]; int sum[5]; double d; -- cgit v1.2.3 From b3f911f385378fcaeceb7b4f438363aa9ddde236 Mon Sep 17 00:00:00 2001 From: iive Date: Tue, 31 May 2011 21:15:14 +0000 Subject: configure: add an initial check to verify compiler works at all git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33533 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 6d54e95f78..f11d96f41f 100755 --- a/configure +++ b/configure @@ -1449,6 +1449,10 @@ else fi # icc test "$cc_fail" = yes && die "unsupported compiler version" +echocheck "working compiler" +cflag_check "" || die "Compiler is not functioning correctly. Check your installation and custom CFLAGS $CFLAGS ." +echo "yes" + if test -z "$_target" && x86 ; then cat > $TMPC << EOF int main(void) { -- cgit v1.2.3 From 3cbde4da84978565aadd387c93e8d53365a2f302 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 6 Jul 2011 09:23:53 +0300 Subject: cosmetics: vf_ilpack.c: tabs to 4 spaces --- libmpcodecs/vf_ilpack.c | 682 ++++++++++++++++++++++++------------------------ 1 file changed, 341 insertions(+), 341 deletions(-) diff --git a/libmpcodecs/vf_ilpack.c b/libmpcodecs/vf_ilpack.c index 73e7c57fbf..77555a7b41 100644 --- a/libmpcodecs/vf_ilpack.c +++ b/libmpcodecs/vf_ilpack.c @@ -30,301 +30,301 @@ #include "vf.h" typedef void (pack_func_t)(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs); + unsigned char *u, unsigned char *v, int w, int us, int vs); struct vf_priv_s { - int mode; - pack_func_t *pack[2]; + int mode; + pack_func_t *pack[2]; }; static void pack_nn_C(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w) + unsigned char *u, unsigned char *v, int w) { - int j; - for (j = w/2; j; j--) { - *dst++ = *y++; - *dst++ = *u++; - *dst++ = *y++; - *dst++ = *v++; - } + int j; + for (j = w/2; j; j--) { + *dst++ = *y++; + *dst++ = *u++; + *dst++ = *y++; + *dst++ = *v++; + } } static void pack_li_0_C(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs) + unsigned char *u, unsigned char *v, int w, int us, int vs) { - int j; - for (j = w/2; j; j--) { - *dst++ = *y++; - *dst++ = (u[us+us] + 7*u[0])>>3; - *dst++ = *y++; - *dst++ = (v[vs+vs] + 7*v[0])>>3; - u++; v++; - } + int j; + for (j = w/2; j; j--) { + *dst++ = *y++; + *dst++ = (u[us+us] + 7*u[0])>>3; + *dst++ = *y++; + *dst++ = (v[vs+vs] + 7*v[0])>>3; + u++; v++; + } } static void pack_li_1_C(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs) + unsigned char *u, unsigned char *v, int w, int us, int vs) { - int j; - for (j = w/2; j; j--) { - *dst++ = *y++; - *dst++ = (3*u[us+us] + 5*u[0])>>3; - *dst++ = *y++; - *dst++ = (3*v[vs+vs] + 5*v[0])>>3; - u++; v++; - } + int j; + for (j = w/2; j; j--) { + *dst++ = *y++; + *dst++ = (3*u[us+us] + 5*u[0])>>3; + *dst++ = *y++; + *dst++ = (3*v[vs+vs] + 5*v[0])>>3; + u++; v++; + } } #if HAVE_MMX static void pack_nn_MMX(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w) + unsigned char *u, unsigned char *v, int w) { - __asm__ volatile ("" - ASMALIGN(4) - "1: \n\t" - "movq (%0), %%mm1 \n\t" - "movq (%0), %%mm2 \n\t" - "movq (%1), %%mm4 \n\t" - "movq (%2), %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "add $8, %0 \n\t" - "add $4, %1 \n\t" - "add $4, %2 \n\t" - "movq %%mm1, (%3) \n\t" - "movq %%mm2, 8(%3) \n\t" - "add $16, %3 \n\t" - "decl %4 \n\t" - "jnz 1b \n\t" - "emms \n\t" - : - : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8) - : "memory" - ); - pack_nn_C(dst, y, u, v, (w&7)); + __asm__ volatile ("" + ASMALIGN(4) + "1: \n\t" + "movq (%0), %%mm1 \n\t" + "movq (%0), %%mm2 \n\t" + "movq (%1), %%mm4 \n\t" + "movq (%2), %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "add $8, %0 \n\t" + "add $4, %1 \n\t" + "add $4, %2 \n\t" + "movq %%mm1, (%3) \n\t" + "movq %%mm2, 8(%3) \n\t" + "add $16, %3 \n\t" + "decl %4 \n\t" + "jnz 1b \n\t" + "emms \n\t" + : + : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8) + : "memory" + ); + pack_nn_C(dst, y, u, v, (w&7)); } #if HAVE_EBX_AVAILABLE static void pack_li_0_MMX(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs) + unsigned char *u, unsigned char *v, int w, int us, int vs) { - __asm__ volatile ("" - "push %%"REG_BP" \n\t" + __asm__ volatile ("" + "push %%"REG_BP" \n\t" #if ARCH_X86_64 - "mov %6, %%"REG_BP" \n\t" + "mov %6, %%"REG_BP" \n\t" #else - "movl 4(%%"REG_d"), %%"REG_BP" \n\t" - "movl (%%"REG_d"), %%"REG_d" \n\t" + "movl 4(%%"REG_d"), %%"REG_BP" \n\t" + "movl (%%"REG_d"), %%"REG_d" \n\t" #endif - "pxor %%mm0, %%mm0 \n\t" - - ASMALIGN(4) - ".Lli0: \n\t" - "movq (%%"REG_S"), %%mm1 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - - "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" - "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" - "punpcklbw %%mm0, %%mm4 \n\t" - "punpcklbw %%mm0, %%mm6 \n\t" - "movq (%%"REG_a"), %%mm3 \n\t" - "movq (%%"REG_b"), %%mm5 \n\t" - "punpcklbw %%mm0, %%mm3 \n\t" - "punpcklbw %%mm0, %%mm5 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "psrlw $3, %%mm4 \n\t" - "psrlw $3, %%mm6 \n\t" - "packuswb %%mm4, %%mm4 \n\t" - "packuswb %%mm6, %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "movq %%mm1, (%%"REG_D") \n\t" - "movq %%mm2, 8(%%"REG_D") \n\t" - - "movq 8(%%"REG_S"), %%mm1 \n\t" - "movq 8(%%"REG_S"), %%mm2 \n\t" - - "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" - "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" - "punpckhbw %%mm0, %%mm4 \n\t" - "punpckhbw %%mm0, %%mm6 \n\t" - "movq (%%"REG_a"), %%mm3 \n\t" - "movq (%%"REG_b"), %%mm5 \n\t" - "punpckhbw %%mm0, %%mm3 \n\t" - "punpckhbw %%mm0, %%mm5 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "psrlw $3, %%mm4 \n\t" - "psrlw $3, %%mm6 \n\t" - "packuswb %%mm4, %%mm4 \n\t" - "packuswb %%mm6, %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "add $16, %%"REG_S" \n\t" - "add $8, %%"REG_a" \n\t" - "add $8, %%"REG_b" \n\t" - - "movq %%mm1, 16(%%"REG_D") \n\t" - "movq %%mm2, 24(%%"REG_D") \n\t" - "add $32, %%"REG_D" \n\t" - - "decl %%ecx \n\t" - "jnz .Lli0 \n\t" - "emms \n\t" - "pop %%"REG_BP" \n\t" - : - : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), + "pxor %%mm0, %%mm0 \n\t" + + ASMALIGN(4) + ".Lli0: \n\t" + "movq (%%"REG_S"), %%mm1 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" + "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" + "punpcklbw %%mm0, %%mm4 \n\t" + "punpcklbw %%mm0, %%mm6 \n\t" + "movq (%%"REG_a"), %%mm3 \n\t" + "movq (%%"REG_b"), %%mm5 \n\t" + "punpcklbw %%mm0, %%mm3 \n\t" + "punpcklbw %%mm0, %%mm5 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "psrlw $3, %%mm4 \n\t" + "psrlw $3, %%mm6 \n\t" + "packuswb %%mm4, %%mm4 \n\t" + "packuswb %%mm6, %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "movq %%mm1, (%%"REG_D") \n\t" + "movq %%mm2, 8(%%"REG_D") \n\t" + + "movq 8(%%"REG_S"), %%mm1 \n\t" + "movq 8(%%"REG_S"), %%mm2 \n\t" + + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" + "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" + "punpckhbw %%mm0, %%mm4 \n\t" + "punpckhbw %%mm0, %%mm6 \n\t" + "movq (%%"REG_a"), %%mm3 \n\t" + "movq (%%"REG_b"), %%mm5 \n\t" + "punpckhbw %%mm0, %%mm3 \n\t" + "punpckhbw %%mm0, %%mm5 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "psrlw $3, %%mm4 \n\t" + "psrlw $3, %%mm6 \n\t" + "packuswb %%mm4, %%mm4 \n\t" + "packuswb %%mm6, %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "add $16, %%"REG_S" \n\t" + "add $8, %%"REG_a" \n\t" + "add $8, %%"REG_b" \n\t" + + "movq %%mm1, 16(%%"REG_D") \n\t" + "movq %%mm2, 24(%%"REG_D") \n\t" + "add $32, %%"REG_D" \n\t" + + "decl %%ecx \n\t" + "jnz .Lli0 \n\t" + "emms \n\t" + "pop %%"REG_BP" \n\t" + : + : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), #if ARCH_X86_64 - "d" ((x86_reg)us), "r" ((x86_reg)vs) + "d" ((x86_reg)us), "r" ((x86_reg)vs) #else - "d" (&us) + "d" (&us) #endif - : "memory" - ); - pack_li_0_C(dst, y, u, v, (w&15), us, vs); + : "memory" + ); + pack_li_0_C(dst, y, u, v, (w&15), us, vs); } static void pack_li_1_MMX(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs) + unsigned char *u, unsigned char *v, int w, int us, int vs) { - __asm__ volatile ("" - "push %%"REG_BP" \n\t" + __asm__ volatile ("" + "push %%"REG_BP" \n\t" #if ARCH_X86_64 - "mov %6, %%"REG_BP" \n\t" + "mov %6, %%"REG_BP" \n\t" #else - "movl 4(%%"REG_d"), %%"REG_BP" \n\t" - "movl (%%"REG_d"), %%"REG_d" \n\t" + "movl 4(%%"REG_d"), %%"REG_BP" \n\t" + "movl (%%"REG_d"), %%"REG_d" \n\t" #endif - "pxor %%mm0, %%mm0 \n\t" - - ASMALIGN(4) - ".Lli1: \n\t" - "movq (%%"REG_S"), %%mm1 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - - "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" - "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" - "punpcklbw %%mm0, %%mm4 \n\t" - "punpcklbw %%mm0, %%mm6 \n\t" - "movq (%%"REG_a"), %%mm3 \n\t" - "movq (%%"REG_b"), %%mm5 \n\t" - "punpcklbw %%mm0, %%mm3 \n\t" - "punpcklbw %%mm0, %%mm5 \n\t" - "movq %%mm4, %%mm7 \n\t" - "paddw %%mm4, %%mm4 \n\t" - "paddw %%mm7, %%mm4 \n\t" - "movq %%mm6, %%mm7 \n\t" - "paddw %%mm6, %%mm6 \n\t" - "paddw %%mm7, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "psrlw $3, %%mm4 \n\t" - "psrlw $3, %%mm6 \n\t" - "packuswb %%mm4, %%mm4 \n\t" - "packuswb %%mm6, %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "movq %%mm1, (%%"REG_D") \n\t" - "movq %%mm2, 8(%%"REG_D") \n\t" - - "movq 8(%%"REG_S"), %%mm1 \n\t" - "movq 8(%%"REG_S"), %%mm2 \n\t" - - "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" - "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" - "punpckhbw %%mm0, %%mm4 \n\t" - "punpckhbw %%mm0, %%mm6 \n\t" - "movq (%%"REG_a"), %%mm3 \n\t" - "movq (%%"REG_b"), %%mm5 \n\t" - "punpckhbw %%mm0, %%mm3 \n\t" - "punpckhbw %%mm0, %%mm5 \n\t" - "movq %%mm4, %%mm7 \n\t" - "paddw %%mm4, %%mm4 \n\t" - "paddw %%mm7, %%mm4 \n\t" - "movq %%mm6, %%mm7 \n\t" - "paddw %%mm6, %%mm6 \n\t" - "paddw %%mm7, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "psrlw $3, %%mm4 \n\t" - "psrlw $3, %%mm6 \n\t" - "packuswb %%mm4, %%mm4 \n\t" - "packuswb %%mm6, %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "add $16, %%"REG_S" \n\t" - "add $8, %%"REG_a" \n\t" - "add $8, %%"REG_b" \n\t" - - "movq %%mm1, 16(%%"REG_D") \n\t" - "movq %%mm2, 24(%%"REG_D") \n\t" - "add $32, %%"REG_D" \n\t" - - "decl %%ecx \n\t" - "jnz .Lli1 \n\t" - "emms \n\t" - "pop %%"REG_BP" \n\t" - : - : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), + "pxor %%mm0, %%mm0 \n\t" + + ASMALIGN(4) + ".Lli1: \n\t" + "movq (%%"REG_S"), %%mm1 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" + "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" + "punpcklbw %%mm0, %%mm4 \n\t" + "punpcklbw %%mm0, %%mm6 \n\t" + "movq (%%"REG_a"), %%mm3 \n\t" + "movq (%%"REG_b"), %%mm5 \n\t" + "punpcklbw %%mm0, %%mm3 \n\t" + "punpcklbw %%mm0, %%mm5 \n\t" + "movq %%mm4, %%mm7 \n\t" + "paddw %%mm4, %%mm4 \n\t" + "paddw %%mm7, %%mm4 \n\t" + "movq %%mm6, %%mm7 \n\t" + "paddw %%mm6, %%mm6 \n\t" + "paddw %%mm7, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "psrlw $3, %%mm4 \n\t" + "psrlw $3, %%mm6 \n\t" + "packuswb %%mm4, %%mm4 \n\t" + "packuswb %%mm6, %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "movq %%mm1, (%%"REG_D") \n\t" + "movq %%mm2, 8(%%"REG_D") \n\t" + + "movq 8(%%"REG_S"), %%mm1 \n\t" + "movq 8(%%"REG_S"), %%mm2 \n\t" + + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" + "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" + "punpckhbw %%mm0, %%mm4 \n\t" + "punpckhbw %%mm0, %%mm6 \n\t" + "movq (%%"REG_a"), %%mm3 \n\t" + "movq (%%"REG_b"), %%mm5 \n\t" + "punpckhbw %%mm0, %%mm3 \n\t" + "punpckhbw %%mm0, %%mm5 \n\t" + "movq %%mm4, %%mm7 \n\t" + "paddw %%mm4, %%mm4 \n\t" + "paddw %%mm7, %%mm4 \n\t" + "movq %%mm6, %%mm7 \n\t" + "paddw %%mm6, %%mm6 \n\t" + "paddw %%mm7, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "psrlw $3, %%mm4 \n\t" + "psrlw $3, %%mm6 \n\t" + "packuswb %%mm4, %%mm4 \n\t" + "packuswb %%mm6, %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "add $16, %%"REG_S" \n\t" + "add $8, %%"REG_a" \n\t" + "add $8, %%"REG_b" \n\t" + + "movq %%mm1, 16(%%"REG_D") \n\t" + "movq %%mm2, 24(%%"REG_D") \n\t" + "add $32, %%"REG_D" \n\t" + + "decl %%ecx \n\t" + "jnz .Lli1 \n\t" + "emms \n\t" + "pop %%"REG_BP" \n\t" + : + : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), #if ARCH_X86_64 - "d" ((x86_reg)us), "r" ((x86_reg)vs) + "d" ((x86_reg)us), "r" ((x86_reg)vs) #else - "d" (&us) + "d" (&us) #endif - : "memory" - ); - pack_li_1_C(dst, y, u, v, (w&15), us, vs); + : "memory" + ); + pack_li_1_C(dst, y, u, v, (w&15), us, vs); } #endif /* HAVE_EBX_AVAILABLE */ #endif @@ -334,120 +334,120 @@ static pack_func_t *pack_li_0; static pack_func_t *pack_li_1; static void ilpack(unsigned char *dst, unsigned char *src[3], - int dststride, int srcstride[3], int w, int h, pack_func_t *pack[2]) + int dststride, int srcstride[3], int w, int h, pack_func_t *pack[2]) { - int i; - unsigned char *y, *u, *v; - int ys = srcstride[0], us = srcstride[1], vs = srcstride[2]; - int a, b; - - y = src[0]; - u = src[1]; - v = src[2]; - - pack_nn(dst, y, u, v, w, 0, 0); - y += ys; dst += dststride; - pack_nn(dst, y, u+us, v+vs, w, 0, 0); - y += ys; dst += dststride; - for (i=2; i>1); - pack[b](dst, y, u, v, w, us*a, vs*a); - y += ys; - if ((i&3) == 1) { - u -= us; - v -= vs; - } else { - u += us; - v += vs; - } - dst += dststride; - } - pack_nn(dst, y, u, v, w, 0, 0); - y += ys; dst += dststride; u += us; v += vs; - pack_nn(dst, y, u, v, w, 0, 0); + int i; + unsigned char *y, *u, *v; + int ys = srcstride[0], us = srcstride[1], vs = srcstride[2]; + int a, b; + + y = src[0]; + u = src[1]; + v = src[2]; + + pack_nn(dst, y, u, v, w, 0, 0); + y += ys; dst += dststride; + pack_nn(dst, y, u+us, v+vs, w, 0, 0); + y += ys; dst += dststride; + for (i=2; i>1); + pack[b](dst, y, u, v, w, us*a, vs*a); + y += ys; + if ((i&3) == 1) { + u -= us; + v -= vs; + } else { + u += us; + v += vs; + } + dst += dststride; + } + pack_nn(dst, y, u, v, w, 0, 0); + y += ys; dst += dststride; u += us; v += vs; + pack_nn(dst, y, u, v, w, 0, 0); } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; + mp_image_t *dmpi; - // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next, IMGFMT_YUY2, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w, mpi->h); + // hope we'll get DR buffer: + dmpi=vf_get_image(vf->next, IMGFMT_YUY2, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w, mpi->h); - ilpack(dmpi->planes[0], mpi->planes, dmpi->stride[0], mpi->stride, mpi->w, mpi->h, vf->priv->pack); + ilpack(dmpi->planes[0], mpi->planes, dmpi->stride[0], mpi->stride, mpi->w, mpi->h, vf->priv->pack); - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { - /* FIXME - also support UYVY output? */ - return vf_next_config(vf, width, height, d_width, d_height, flags, IMGFMT_YUY2); + /* FIXME - also support UYVY output? */ + return vf_next_config(vf, width, height, d_width, d_height, flags, IMGFMT_YUY2); } static int query_format(struct vf_instance *vf, unsigned int fmt) { - /* FIXME - really any YUV 4:2:0 input format should work */ - switch (fmt) { - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return vf_next_query_format(vf,IMGFMT_YUY2); - } - return 0; + /* FIXME - really any YUV 4:2:0 input format should work */ + switch (fmt) { + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: + return vf_next_query_format(vf,IMGFMT_YUY2); + } + return 0; } static int vf_open(vf_instance_t *vf, char *args) { - vf->config=config; - vf->query_format=query_format; - vf->put_image=put_image; - vf->priv = calloc(1, sizeof(struct vf_priv_s)); - vf->priv->mode = 1; - if (args) sscanf(args, "%d", &vf->priv->mode); - - pack_nn = (pack_func_t *)pack_nn_C; - pack_li_0 = pack_li_0_C; - pack_li_1 = pack_li_1_C; + vf->config=config; + vf->query_format=query_format; + vf->put_image=put_image; + vf->priv = calloc(1, sizeof(struct vf_priv_s)); + vf->priv->mode = 1; + if (args) sscanf(args, "%d", &vf->priv->mode); + + pack_nn = (pack_func_t *)pack_nn_C; + pack_li_0 = pack_li_0_C; + pack_li_1 = pack_li_1_C; #if HAVE_MMX - if(gCpuCaps.hasMMX) { - pack_nn = (pack_func_t *)pack_nn_MMX; + if(gCpuCaps.hasMMX) { + pack_nn = (pack_func_t *)pack_nn_MMX; #if HAVE_EBX_AVAILABLE - pack_li_0 = pack_li_0_MMX; - pack_li_1 = pack_li_1_MMX; + pack_li_0 = pack_li_0_MMX; + pack_li_1 = pack_li_1_MMX; #endif - } + } #endif - switch(vf->priv->mode) { - case 0: - vf->priv->pack[0] = vf->priv->pack[1] = pack_nn; - break; - default: - mp_msg(MSGT_VFILTER, MSGL_WARN, - "ilpack: unknown mode %d (fallback to linear)\n", - vf->priv->mode); - case 1: - vf->priv->pack[0] = pack_li_0; - vf->priv->pack[1] = pack_li_1; - break; - } - - return 1; + switch(vf->priv->mode) { + case 0: + vf->priv->pack[0] = vf->priv->pack[1] = pack_nn; + break; + default: + mp_msg(MSGT_VFILTER, MSGL_WARN, + "ilpack: unknown mode %d (fallback to linear)\n", + vf->priv->mode); + case 1: + vf->priv->pack[0] = pack_li_0; + vf->priv->pack[1] = pack_li_1; + break; + } + + return 1; } const vf_info_t vf_info_ilpack = { - "4:2:0 planar -> 4:2:2 packed reinterlacer", - "ilpack", - "Richard Felker", - "", - vf_open, - NULL + "4:2:0 planar -> 4:2:2 packed reinterlacer", + "ilpack", + "Richard Felker", + "", + vf_open, + NULL }; -- cgit v1.2.3 From 20ea5a1cfcfe26e62e3995b1fae9594cc7511016 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 1 Jun 2011 19:07:30 +0000 Subject: vf_ilpack: fix incompatible function types Do not call functions through a function pointer specifying more arguments. It is theoretically possible to have calling models where this would break horribly. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33536 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_ilpack.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libmpcodecs/vf_ilpack.c b/libmpcodecs/vf_ilpack.c index 77555a7b41..db4a849e1f 100644 --- a/libmpcodecs/vf_ilpack.c +++ b/libmpcodecs/vf_ilpack.c @@ -28,6 +28,7 @@ #include "img_format.h" #include "mp_image.h" #include "vf.h" +#include "libavutil/attributes.h" typedef void (pack_func_t)(unsigned char *dst, unsigned char *y, unsigned char *u, unsigned char *v, int w, int us, int vs); @@ -38,7 +39,8 @@ struct vf_priv_s { }; static void pack_nn_C(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w) + unsigned char *u, unsigned char *v, int w, + int av_unused us, int av_unused vs) { int j; for (j = w/2; j; j--) { @@ -77,7 +79,8 @@ static void pack_li_1_C(unsigned char *dst, unsigned char *y, #if HAVE_MMX static void pack_nn_MMX(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w) + unsigned char *u, unsigned char *v, int w, + int av_unused us, int av_unused vs) { __asm__ volatile ("" ASMALIGN(4) @@ -103,7 +106,7 @@ static void pack_nn_MMX(unsigned char *dst, unsigned char *y, : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8) : "memory" ); - pack_nn_C(dst, y, u, v, (w&7)); + pack_nn_C(dst, y, u, v, (w&7), 0, 0); } #if HAVE_EBX_AVAILABLE @@ -413,12 +416,12 @@ static int vf_open(vf_instance_t *vf, char *args) vf->priv->mode = 1; if (args) sscanf(args, "%d", &vf->priv->mode); - pack_nn = (pack_func_t *)pack_nn_C; + pack_nn = pack_nn_C; pack_li_0 = pack_li_0_C; pack_li_1 = pack_li_1_C; #if HAVE_MMX if(gCpuCaps.hasMMX) { - pack_nn = (pack_func_t *)pack_nn_MMX; + pack_nn = pack_nn_MMX; #if HAVE_EBX_AVAILABLE pack_li_0 = pack_li_0_MMX; pack_li_1 = pack_li_1_MMX; -- cgit v1.2.3 From ba160121ff7d3c7d2a7f45865a8d583108a5a999 Mon Sep 17 00:00:00 2001 From: ib Date: Fri, 3 Jun 2011 14:02:11 +0000 Subject: etc/mplayer.desktop: revise desktop file Revise desktop file. Split Name entry into Name and GenericName entries. This is according to the Desktop Entry Specification. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33540 b3059339-0415-0410-9bf9-f77b7e298cf2 Revise desktop file. Make slightly revised Catalan Name entry the GenericName entry. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33541 b3059339-0415-0410-9bf9-f77b7e298cf2 Add German GenericName entry to desktop file and revise German Comment entry. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33542 b3059339-0415-0410-9bf9-f77b7e298cf2 Make French and Italian Comment entries in desktop file GenericName entries. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33543 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove Spanish and Chinese Comment entries from desktop file. There are no GenericName entries for Spanish and Chinese and it's uncertain whether the Comment entries are OK. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33544 b3059339-0415-0410-9bf9-f77b7e298cf2 Add X-GNOME-FullName entries to desktop file. According to the Desktop Entry Specification, the "full name" should be built from Name and GenericName. While some desktop environments do this (like KDE), GNOME doesn't and uses its own key instead. This closes Bugzilla #1680. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33545 b3059339-0415-0410-9bf9-f77b7e298cf2 Add Japanese entries to desktop file. Translation by committer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33546 b3059339-0415-0410-9bf9-f77b7e298cf2 Add Italian Comment entry to desktop file. Translation by Giorgio Vazzana, mywing81 gmail com. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33547 b3059339-0415-0410-9bf9-f77b7e298cf2 Add French Comment entry to desktop file. Translation by Etienne Buira, etienne.buira free fr. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33548 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/mplayer.desktop | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/etc/mplayer.desktop b/etc/mplayer.desktop index 77b653e933..c7c9648524 100644 --- a/etc/mplayer.desktop +++ b/etc/mplayer.desktop @@ -1,15 +1,24 @@ [Desktop Entry] Type=Application -Name=MPlayer Media Player -Name[ca]=Reproductor multimèdia MPlayer -GenericName=Multimedia player +Name=MPlayer +GenericName=Media Player +GenericName[ca]=Reproductor multimèdia +GenericName[de]=Medienwiedergabe +GenericName[fr]=Lecteur multimédia +GenericName[it]=Lettore multimediale +GenericName[ja]=メディアプレーヤー +X-GNOME-FullName=MPlayer Media Player +X-GNOME-FullName[ca]=MPlayer Reproductor multimèdia +X-GNOME-FullName[de]=MPlayer Medienwiedergabe +X-GNOME-FullName[fr]=MPlayer Lecteur multimédia +X-GNOME-FullName[it]=MPlayer Lettore multimediale +X-GNOME-FullName[ja]=MPlayer メディアプレーヤー Comment=Play movies and songs Comment[ca]=Reproduïu vídeos i cançons -Comment[de]=Filme und Musik abspielen -Comment[es]=Reproduzca vídeos y canciones -Comment[fr]=Lecteur multimédia -Comment[it]=Lettore multimediale -Comment[zh]=多媒体播放器 +Comment[de]=Filme und Musik wiedergeben +Comment[fr]=Lit les films et musiques +Comment[it]=Riproduce filmati e musica +Comment[ja]=動画や音声のファイルを再生します Icon=mplayer TryExec=gmplayer Exec=gmplayer %F -- cgit v1.2.3 From 226a32c8568551a2bcfb86353cfcee4ac80ad65f Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 4 Jun 2011 09:10:04 +0000 Subject: configure: fix _libcdio variable staying on "auto" Fix _libcdio staying on "auto" if cdparanoia test succeeded before. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33555 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index f11d96f41f..5d45eaa9d4 100755 --- a/configure +++ b/configure @@ -5345,6 +5345,7 @@ if test "$_libcdio" = yes && test "$_cdparanoia" = no ; then def_libcdio='#define CONFIG_LIBCDIO 1' def_havelibcdio='yes' else + _libcdio=no if test "$_cdparanoia" = yes ; then res_comment="using cdparanoia" fi -- cgit v1.2.3 From 55def9cc1b8621c5f4e85cde9368b678e1f482a7 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 4 Jun 2011 09:30:42 +0000 Subject: stream: show negative seek position value in error message Make "Invalid seek to negative position" message more useful by printing the actual value. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33556 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stream/stream.h b/stream/stream.h index 77319871c0..828c364d40 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -299,7 +299,8 @@ inline static int stream_seek(stream_t *s,off_t pos){ mp_dbg(MSGT_DEMUX, MSGL_DBG3, "seek to 0x%qX\n",(long long)pos); if (pos < 0) { - mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid seek to negative position!\n"); + mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid seek to negative position %llx!\n", + (long long)pos); pos = 0; } if(pospos){ -- cgit v1.2.3 From c6e4eb9f4b7e8e588aebba07b055d81aea27c5fe Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 4 Jun 2011 10:27:45 +0000 Subject: stream_cdda: work around libcdparanoia caching issues Constrain libcdparanoia's caching which badly breaks playback with -nocache (libcdparanoia requests a huge chunk at once, then lets the disk spin down while that is being played, leading to a pause when the disk needs to spin back up after the big chunk is finished). Switching to libcdio by default which does not have this ssue might be a better long-term solution though. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33557 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_cdda.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c index e93c0465d8..53ac76cf25 100644 --- a/stream/stream_cdda.c +++ b/stream/stream_cdda.c @@ -420,6 +420,9 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) { if(p->no_skip) mode |= PARANOIA_MODE_NEVERSKIP; #ifndef CONFIG_LIBCDIO + // HACK against libcdparanoia's stupid caching model that + // queues up a huge number of requests leading to stuttering + paranoia_cachemodel_size(priv->cdp, 24); paranoia_modeset(cdd, mode); if(p->search_overlap >= 0) -- cgit v1.2.3 From 55d4f6528cf2df2c108ed6ddcfe0247025bde988 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Fri, 10 Jun 2011 08:31:00 +0000 Subject: cosmetics: Fix typos Patch by Mike Castle, dalgoda+mplayer gmail git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33575 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demuxer.h | 2 +- sub/vobsub.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index abb3dd62b1..ee664d83e2 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -377,7 +377,7 @@ struct demuxer *new_demuxers_demuxer(struct demuxer *vd, struct demuxer *ad, struct demuxer *sd); // AVI demuxer params: -extern int index_mode; // -1=untouched 0=don't use index 1=use (geneate) index +extern int index_mode; // -1=untouched 0=don't use index 1=use (generate) index extern char *index_file_save, *index_file_load; extern int force_ni; extern int pts_from_bps; diff --git a/sub/vobsub.c b/sub/vobsub.c index a2fc94fb17..2d64541d53 100644 --- a/sub/vobsub.c +++ b/sub/vobsub.c @@ -1341,7 +1341,7 @@ void vobsub_out_output(void *me, const unsigned char *packet, m = s / 60; s -= m * 60; ms = (s - (unsigned int) s) * 1000; - if (ms >= 1000) /* prevent overfolws or bad float stuff */ + if (ms >= 1000) /* prevent overflows or bad float stuff */ ms = 0; if (h != last_h || m != last_m || (unsigned int) s != last_s || ms != last_ms) { fprintf(vob->fidx, "timestamp: %02u:%02u:%02u:%03u, filepos: %09lx\n", @@ -1382,13 +1382,13 @@ void vobsub_out_output(void *me, const unsigned char *packet, datalen += 1; /* AID */ pad_len = 2048 - (p - buffer) - 4 /* MPEG ID */ - 2 /* payload len */ - datalen; /* XXX - Go figure what should go here! In any case the - packet has to be completly filled. If I can fill it + packet has to be completely filled. If I can fill it with padding (0x000001be) latter I'll do that. But if there is only room for 6 bytes then I can not write a padding packet. So I add some padding in the PTS field. This looks like a dirty kludge. Oh well... */ if (pad_len < 0) { - /* Packet is too big. Let's try ommiting the PTS field */ + /* Packet is too big. Let's try omitting the PTS field */ datalen -= pts_len; pts_len = 0; pad_len = 0; @@ -1439,7 +1439,7 @@ void vobsub_out_output(void *me, const unsigned char *packet, perror("ERROR: vobsub blank padding write failed"); } else if (remain < 0) fprintf(stderr, - "\nERROR: wrong thing happenned...\n" + "\nERROR: wrong thing happened...\n" " I wrote a %i data bytes spu packet and that's too long\n", len); } } -- cgit v1.2.3 From b7406244482b3239342601995d77716d57cd5d71 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 11 Jun 2011 14:54:59 +0000 Subject: configure: when cross-compiling default host_cc to "cc" Set host_cc after cross-compile check. This allows to set "cc" as a more sensible, almost always working default when cross-compiling instead of using the cross-compiler as host-cc which is just nonsense. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33580 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 5d45eaa9d4..fd890c1e34 100755 --- a/configure +++ b/configure @@ -1466,10 +1466,6 @@ fi echo "Detected operating system: $system_name" echo "Detected host architecture: $host_arch" -echocheck "host cc" -test "$_host_cc" || _host_cc=$_cc -echores $_host_cc - echocheck "cross compilation" if test $_cross_compile = auto ; then _cross_compile=yes @@ -1481,8 +1477,13 @@ if test $_cross_compile = yes; then tmp_run() { return 0 } + test "$_host_cc" || _host_cc=cc fi +echocheck "host cc" +test "$_host_cc" || _host_cc=$_cc +echores $_host_cc + # --- # now that we know what compiler should be used for compilation, try to find -- cgit v1.2.3 From 1054f89404cea0f0d2ae511dc87180a00c51c9de Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 11 Jun 2011 16:21:54 +0000 Subject: stream_pvr: Replace include by Replace sys/fcntl.h include by fcntl.h include used everywhere else. Also fixes compilation with the Android NDK. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33584 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_pvr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream/stream_pvr.c b/stream/stream_pvr.c index 4048168990..745686e2e3 100644 --- a/stream/stream_pvr.c +++ b/stream/stream_pvr.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include -- cgit v1.2.3 From 27a718d920e639ebbceea847fdbaf57d587a778a Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 11 Jun 2011 16:40:10 +0000 Subject: configure: only set NEED_GLOB on Windows Only set NEED_GLOB on Windows, as currently this has the effect of compiling win32-only code - and even if that compiled it would not be used anyway, since mf.c uses glob under "#if defined(HAVE_GLOB) || defined(__MINGW32__)". git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33587 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index fd890c1e34..65e997baf7 100755 --- a/configure +++ b/configure @@ -3504,12 +3504,15 @@ echores "$_gettimeofday" echocheck "glob()" _glob=no statement_check glob.h 'glob("filename", 0, 0, 0)' && _glob=yes +need_glob=no if test "$_glob" = yes ; then def_glob='#define HAVE_GLOB 1' - need_glob=no else def_glob='#undef HAVE_GLOB' - need_glob=yes + # HACK! need_glob currently enables compilation of a + # win32-specific glob()-replacement. + # Other OS neither need it nor can they use it (mf:// is disabled for them). + win32 && need_glob=yes fi echores "$_glob" -- cgit v1.2.3 From 58834653c01d95196d4efa012e49fd6a1c270851 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 12 Jun 2011 09:57:07 +0000 Subject: dvdnav: make mp_dvdnav_save_smpi() more robust Make mp_dvdnav_save_smpi more robust and ensure consistency of nav buffer. It seems that in_size could be negative sometimes, this would cause crashes if the malloc somehow succeeded. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33599 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mplayer.c b/mplayer.c index 44b6789603..80e7a8d20e 100644 --- a/mplayer.c +++ b/mplayer.c @@ -2272,7 +2272,7 @@ static mp_image_t *mp_dvdnav_restore_smpi(struct MPContext *mpctx, if (mpctx->stream->type != STREAMTYPE_DVDNAV) return decoded_frame; - /// a change occured in dvdnav stream + /// a change occurred in dvdnav stream if (mp_dvdnav_cell_has_changed(mpctx->stream,0)) { mp_dvdnav_read_wait(mpctx->stream, 1, 1); mp_dvdnav_context_free(mpctx); @@ -2317,12 +2317,16 @@ static void mp_dvdnav_save_smpi(struct MPContext *mpctx, int in_size, return; free(mpctx->nav_buffer); - - mpctx->nav_buffer = malloc(in_size); - mpctx->nav_start = start; - mpctx->nav_in_size = mpctx->nav_buffer ? in_size : -1; - if (mpctx->nav_buffer) + mpctx->nav_buffer = NULL; + mpctx->nav_start = NULL; + mpctx->nav_in_size = -1; + + if (in_size > 0) + mpctx->nav_buffer = malloc(in_size); + if (mpctx->nav_buffer) { + mpctx->nav_start = start; memcpy(mpctx->nav_buffer,start,in_size); + } if (decoded_frame && mpctx->nav_smpi != decoded_frame) mpctx->nav_smpi = mp_dvdnav_copy_mpi(mpctx->nav_smpi,decoded_frame); -- cgit v1.2.3 From 81c227d221b959329dc67121146a1c1960d2e602 Mon Sep 17 00:00:00 2001 From: cboesch Date: Sun, 12 Jun 2011 10:55:24 +0000 Subject: cleanup: vobsub.c: simplify parsing vobsub: simplify timestamp parsing. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33601 b3059339-0415-0410-9bf9-f77b7e298cf2 vobsub: simplify origin parsing. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33602 b3059339-0415-0410-9bf9-f77b7e298cf2 --- sub/vobsub.c | 67 +++++++++--------------------------------------------------- 1 file changed, 10 insertions(+), 57 deletions(-) diff --git a/sub/vobsub.c b/sub/vobsub.c index 2d64541d53..bfee3eb98f 100644 --- a/sub/vobsub.c +++ b/sub/vobsub.c @@ -694,72 +694,25 @@ static int vobsub_parse_id(vobsub_t *vob, const char *line) static int vobsub_parse_timestamp(vobsub_t *vob, const char *line) { - // timestamp: HH:MM:SS.mmm, filepos: 0nnnnnnnnn - const char *p; int h, m, s, ms; off_t filepos; - while (isspace(*line)) - ++line; - p = line; - while (isdigit(*p)) - ++p; - if (p - line != 2) - return -1; - h = atoi(line); - if (*p != ':') - return -1; - line = ++p; - while (isdigit(*p)) - ++p; - if (p - line != 2) - return -1; - m = atoi(line); - if (*p != ':') - return -1; - line = ++p; - while (isdigit(*p)) - ++p; - if (p - line != 2) - return -1; - s = atoi(line); - if (*p != ':') - return -1; - line = ++p; - while (isdigit(*p)) - ++p; - if (p - line != 3) + if (sscanf(line, " %02d:%02d:%02d:%03d, filepos: %09lx", + &h, &m, &s, &ms, &filepos) != 5) return -1; - ms = atoi(line); - if (*p != ',') - return -1; - line = p + 1; - while (isspace(*line)) - ++line; - if (strncmp("filepos:", line, 8)) - return -1; - line += 8; - while (isspace(*line)) - ++line; - if (! isxdigit(*line)) - return -1; - filepos = strtol(line, NULL, 16); return vobsub_add_timestamp(vob, filepos, vob->delay + ms + 1000 * (s + 60 * (m + 60 * h))); } static int vobsub_parse_origin(vobsub_t *vob, const char *line) { // org: X,Y - char *p; - while (isspace(*line)) - ++line; - if (!isdigit(*line)) - return -1; - vob->origin_x = strtoul(line, &p, 10); - if (*p != ',') - return -1; - ++p; - vob->origin_y = strtoul(p, NULL, 10); - return 0; + unsigned x, y; + + if (sscanf(line, " %u,%u", &x, &y) == 2) { + vob->origin_x = x; + vob->origin_y = y; + return 0; + } + return -1; } unsigned int vobsub_palette_to_yuv(unsigned int pal) -- cgit v1.2.3 From d84c42b09f710afd09fe5a0910d6352fc1c11207 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 12 Jun 2011 11:10:13 +0000 Subject: stream_dvd: fix dvd_get_current_time() Fix dvd_get_current_time so the cell argument actually has a purpose. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33603 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_dvd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index f257ab78bd..2121e78ccc 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -534,8 +534,8 @@ static double dvd_get_current_time(stream_t *stream, int cell) dvd_priv_t *d = stream->priv; tm=0; - if(!cell) cell=d->cur_cell; - for(i=0; icur_cell; i++) { + if(cell < 0) cell=d->cur_cell; + for(i=0; icur_pgc->cell_playback[i].block_type == BLOCK_TYPE_ANGLE_BLOCK && d->cur_pgc->cell_playback[i].block_mode != BLOCK_MODE_FIRST_CELL ) @@ -585,7 +585,7 @@ static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec stream_skip(stream, 2048); t = mp_dvdtimetomsec(&d->dsi_pack.dsi_gi.c_eltm); } while(!t); - tm = dvd_get_current_time(stream, 0); + tm = dvd_get_current_time(stream, -1); pos = ((off_t)tmap_sector)<<11; stream_seek(stream, pos); @@ -594,7 +594,7 @@ static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec while(tm <= sec) { if(!stream_skip(stream, 2048)) break; - tm = dvd_get_current_time(stream, 0); + tm = dvd_get_current_time(stream, -1); }; tmap_sector = stream->pos >> 11; @@ -645,7 +645,7 @@ static int control(stream_t *stream,int cmd,void* arg) case STREAM_CTRL_GET_CURRENT_TIME: { double tm; - tm = dvd_get_current_time(stream, 0); + tm = dvd_get_current_time(stream, -1); if(tm != -1) { *((double *)arg) = tm; return 1; -- cgit v1.2.3 From 63fd6789057f89907dd92a0b8d0bd26fd44aaaf3 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 12 Jun 2011 11:12:17 +0000 Subject: cosmetics: stream_dvdnav.c: Remove pointless () git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33604 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_dvdnav.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index d5b12dc9f6..6bdc59d8a4 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -410,7 +410,7 @@ static int control(stream_t *stream, int cmd, void* arg) { { case STREAM_CTRL_SEEK_TO_CHAPTER: { - int chap = *((unsigned int *)arg)+1; + int chap = *(unsigned int *)arg+1; if(chap < 1 || dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK) break; @@ -426,21 +426,21 @@ static int control(stream_t *stream, int cmd, void* arg) { break; if(!part) break; - *((unsigned int *)arg) = part; + *(unsigned int *)arg = part; return 1; } case STREAM_CTRL_GET_CURRENT_CHAPTER: { if(dvdnav_current_title_info(priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK) break; - *((unsigned int *)arg) = part - 1; + *(unsigned int *)arg = part - 1; return 1; } case STREAM_CTRL_GET_TIME_LENGTH: { if(priv->duration || priv->still_length) { - *((double *)arg) = (double)priv->duration / 1000.0; + *(double *)arg = (double)priv->duration / 1000.0; return 1; } break; @@ -448,7 +448,7 @@ static int control(stream_t *stream, int cmd, void* arg) { case STREAM_CTRL_GET_ASPECT_RATIO: { uint8_t ar = dvdnav_get_video_aspect(priv->dvdnav); - *((double *)arg) = !ar ? 4.0/3.0 : 16.0/9.0; + *(double *)arg = !ar ? 4.0/3.0 : 16.0/9.0; return 1; } case STREAM_CTRL_GET_CURRENT_TIME: @@ -457,7 +457,7 @@ static int control(stream_t *stream, int cmd, void* arg) { tm = dvdnav_get_current_time(priv->dvdnav)/90000.0f; if(tm != -1) { - *((double *)arg) = tm; + *(double *)arg = tm; return 1; } break; @@ -474,7 +474,7 @@ static int control(stream_t *stream, int cmd, void* arg) { uint32_t curr, angles; if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK) break; - *((int *)arg) = angles; + *(int *)arg = angles; return 1; } case STREAM_CTRL_GET_ANGLE: @@ -482,13 +482,13 @@ static int control(stream_t *stream, int cmd, void* arg) { uint32_t curr, angles; if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK) break; - *((int *)arg) = curr; + *(int *)arg = curr; return 1; } case STREAM_CTRL_SET_ANGLE: { uint32_t curr, angles; - int new_angle = *((int *)arg); + int new_angle = *(int *)arg; if(dvdnav_get_angle_info(priv->dvdnav, &curr, &angles) != DVDNAV_STATUS_OK) break; if(new_angle>angles || new_angle<1) -- cgit v1.2.3 From 9f6ba7a63d52270ea0c82ef7baf9c3694f2c1b45 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 12 Jun 2011 10:41:49 +0000 Subject: cosmetics: cache2.c: Fix comment git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33600 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stream/cache2.c b/stream/cache2.c index ee1cf47245..6a8b7c7a70 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -581,11 +581,11 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { s->control_uint_arg = *(unsigned *)arg; s->control = cmd; break; -// the core might call these every frame, they are too slow for this... case STREAM_CTRL_GET_TIME_LENGTH: -// case STREAM_CTRL_GET_CURRENT_TIME: *(double *)arg = s->stream_time_length; return s->stream_time_length ? STREAM_OK : STREAM_UNSUPPORTED; +// the core might call this every frame, but it is too slow for this... +// case STREAM_CTRL_GET_CURRENT_TIME: case STREAM_CTRL_GET_NUM_CHAPTERS: case STREAM_CTRL_GET_CURRENT_CHAPTER: case STREAM_CTRL_GET_ASPECT_RATIO: -- cgit v1.2.3 From cfe1af72af0ca2a92257ef542209be61709ac34f Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 12 Jun 2011 11:26:22 +0000 Subject: cache: allow STREAM_CTRL_GET_CURRENT_TIME with cache Change code to allow STREAM_CTRL_GET_CURRENT_TIME with cache enabled. Due to that time being from what is currently read into the cache it is unfortunately somewhat inaccurate and unsmooth, however for streams that do have stream timestamps it is till a lot better than going by the demuxer alone. In particular it fixes bug #1081, when starting a DVD with -chapter following seeks would be relative to the start of the DVD instead of the current position. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33605 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/stream/cache2.c b/stream/cache2.c index 6a8b7c7a70..b643ed8897 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -64,6 +64,7 @@ static void *ThreadProc(void *s); #include "stream.h" #include "cache2.h" +#include "mpcommon.h" typedef struct { // constats: @@ -91,6 +92,7 @@ typedef struct { volatile int control_res; volatile off_t control_new_pos; volatile double stream_time_length; + volatile double stream_time_pos; } cache_vars_t; static int min_fill=0; @@ -260,17 +262,22 @@ static int cache_execute_control(cache_vars_t *s) { int quit = s->control == -2; if (quit || !s->stream->control) { s->stream_time_length = 0; + s->stream_time_pos = MP_NOPTS_VALUE; s->control_new_pos = 0; s->control_res = STREAM_UNSUPPORTED; s->control = -1; return !quit; } if (GetTimerMS() - last > 99) { - double len; + double len, pos; if (s->stream->control(s->stream, STREAM_CTRL_GET_TIME_LENGTH, &len) == STREAM_OK) s->stream_time_length = len; else s->stream_time_length = 0; + if (s->stream->control(s->stream, STREAM_CTRL_GET_CURRENT_TIME, &pos) == STREAM_OK) + s->stream_time_pos = pos; + else + s->stream_time_pos = MP_NOPTS_VALUE; last = GetTimerMS(); } if (s->control == -1) return 1; @@ -581,11 +588,13 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { s->control_uint_arg = *(unsigned *)arg; s->control = cmd; break; + // the core might call these every frame, so cache them... case STREAM_CTRL_GET_TIME_LENGTH: *(double *)arg = s->stream_time_length; return s->stream_time_length ? STREAM_OK : STREAM_UNSUPPORTED; -// the core might call this every frame, but it is too slow for this... -// case STREAM_CTRL_GET_CURRENT_TIME: + case STREAM_CTRL_GET_CURRENT_TIME: + *(double *)arg = s->stream_time_pos; + return s->stream_time_pos != MP_NOPTS_VALUE ? STREAM_OK : STREAM_UNSUPPORTED; case STREAM_CTRL_GET_NUM_CHAPTERS: case STREAM_CTRL_GET_CURRENT_CHAPTER: case STREAM_CTRL_GET_ASPECT_RATIO: -- cgit v1.2.3 From 0cace1d72251d0a5be79e58c6e8001406cb1da4e Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 13 Jun 2011 19:33:17 +0000 Subject: playtree: make some char * function arguments const Remove a pointless "return". git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33607 b3059339-0415-0410-9bf9-f77b7e298cf2 Mark some char * arguments that are strdup'd const, makes the API slightly clearer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33608 b3059339-0415-0410-9bf9-f77b7e298cf2 --- playtree.c | 11 +++++------ playtree.h | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/playtree.c b/playtree.c index c9a4cbc69a..23859394b9 100644 --- a/playtree.c +++ b/playtree.c @@ -279,7 +279,7 @@ play_tree_set_parent(play_tree_t* pt, play_tree_t* parent) { void -play_tree_add_file(play_tree_t* pt,char* file) { +play_tree_add_file(play_tree_t* pt,const char* file) { int n = 0; #ifdef MP_DEBUG @@ -310,7 +310,7 @@ play_tree_add_file(play_tree_t* pt,char* file) { } int -play_tree_remove_file(play_tree_t* pt,char* file) { +play_tree_remove_file(play_tree_t* pt,const char* file) { int n,f = -1; #ifdef MP_DEBUG @@ -349,7 +349,7 @@ play_tree_remove_file(play_tree_t* pt,char* file) { } void -play_tree_set_param(play_tree_t* pt, char* name, char* val) { +play_tree_set_param(play_tree_t* pt, const char* name, const char* val) { int n = 0; #ifdef MP_DEBUG @@ -373,7 +373,7 @@ play_tree_set_param(play_tree_t* pt, char* name, char* val) { } int -play_tree_unset_param(play_tree_t* pt, char* name) { +play_tree_unset_param(play_tree_t* pt, const char* name) { int n,ni = -1; #ifdef MP_DEBUG @@ -473,7 +473,6 @@ play_tree_iter_push_params(play_tree_iter_t* iter) { if(!pt->child) iter->entry_pushed = 1; - return; } play_tree_iter_t* @@ -934,7 +933,7 @@ void pt_iter_replace_entry(play_tree_iter_t* iter, play_tree_t* entry) } //Add a new file as a new entry -void pt_add_file(play_tree_t** ppt, char* filename) +void pt_add_file(play_tree_t** ppt, const char* filename) { play_tree_t *pt = *ppt, *entry = play_tree_new(); #ifdef MP_DEBUG diff --git a/playtree.h b/playtree.h index c7bfaeb7f1..380f989133 100644 --- a/playtree.h +++ b/playtree.h @@ -179,20 +179,20 @@ play_tree_remove(play_tree_t* pt, int free_it,int with_children); /// Add a file to an item. void -play_tree_add_file(play_tree_t* pt,char* file); +play_tree_add_file(play_tree_t* pt,const char* file); /// Remove a file from an item. int -play_tree_remove_file(play_tree_t* pt,char* file); +play_tree_remove_file(play_tree_t* pt,const char* file); /// Add a config paramter to an item. void -play_tree_set_param(play_tree_t* pt, char* name, char* val); +play_tree_set_param(play_tree_t* pt, const char* name, const char* val); /// Remove a config parameter from an item. int -play_tree_unset_param(play_tree_t* pt, char* name); +play_tree_unset_param(play_tree_t* pt, const char* name); /// Copy the config parameters from one item to another. void @@ -285,7 +285,7 @@ void pt_iter_insert_entry(play_tree_iter_t* iter, play_tree_t* entry); void pt_iter_replace_entry(play_tree_iter_t* iter, play_tree_t* entry); /// Adds a new file to the playtree, if it is not valid it is created. -void pt_add_file(play_tree_t** ppt, char* filename); +void pt_add_file(play_tree_t** ppt, const char* filename); // A macro to use only the iter and not the other things. #define pt_iter_add_file(iter, filename) pt_add_file(&iter->tree, filename) -- cgit v1.2.3 From d6e34fe91a5bf8a7a65e1e9ee7837612241f8ce8 Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 14 Jun 2011 12:13:47 +0000 Subject: VO: support Pause/Break key in X11 input Allow Pause/Break key to be bound as MPlayer input key under X11. patch by Steaphan Greene, sgreene cs.binghamton edu git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33609 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/wskeys.h | 1 + libvo/x11_common.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libvo/wskeys.h b/libvo/wskeys.h index ef372e5c7f..10d9b8b4e4 100644 --- a/libvo/wskeys.h +++ b/libvo/wskeys.h @@ -19,6 +19,7 @@ #ifndef MPLAYER_WSKEYS_H #define MPLAYER_WSKEYS_H +#define wsPause 0x13 + 256 #define wsUp 0x52 + 256 #define wsDown 0x54 + 256 #define wsLeft 0x51 + 256 diff --git a/libvo/x11_common.c b/libvo/x11_common.c index c576839ddb..0a193fb0d3 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -550,7 +550,8 @@ static void vo_x11_putkey_ext(struct vo *vo, int keysym, int modifiers) static const struct mp_keymap keymap[] = { // special keys - {wsEscape, KEY_ESC}, {wsBackSpace, KEY_BS}, {wsTab, KEY_TAB}, {wsEnter, KEY_ENTER}, + {wsPause, KEY_PAUSE}, {wsEscape, KEY_ESC}, {wsBackSpace, KEY_BS}, + {wsTab, KEY_TAB}, {wsEnter, KEY_ENTER}, // cursor keys {wsLeft, KEY_LEFT}, {wsRight, KEY_RIGHT}, {wsUp, KEY_UP}, {wsDown, KEY_DOWN}, -- cgit v1.2.3 From dbff0e49baccb16929435bbf680e70cd628b21ac Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 15 Jun 2011 18:06:28 +0000 Subject: playlist: Support "Length" option in .pls playlist files git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33620 b3059339-0415-0410-9bf9-f77b7e298cf2 --- playtreeparser.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/playtreeparser.c b/playtreeparser.c index 5343539108..777af83634 100644 --- a/playtreeparser.c +++ b/playtreeparser.c @@ -334,8 +334,14 @@ parse_pls(play_tree_parser_t* p) { num = pls_read_entry(line+6,&entries,&max_entry,&v); if(num < 0) mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line); - else - entries[num-1].length = strdup(v); + else { + char *end; + long val = strtol(v, &end, 10); + if (*end || (val <= 0 && val != -1)) + mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Invalid length value in entry %s\n",line); + else if (val > 0) + entries[num-1].length = strdup(v); + } } else mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Unknown entry type %s\n",line); line = play_tree_parser_get_line(p); @@ -348,6 +354,8 @@ parse_pls(play_tree_parser_t* p) { mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding entry %s\n",entries[num].file); entry = play_tree_new(); play_tree_add_file(entry,entries[num].file); + if (entries[num].length) + play_tree_set_param(entry, "endpos", entries[num].length); free(entries[num].file); if(list) play_tree_append_entry(last_entry,entry); -- cgit v1.2.3 From b0a88d1362dd59fd02f27cca0a0683024266c36f Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Jun 2011 08:33:57 +0000 Subject: vf_stereo3d: Add support for converting to interleaved 3D Patch by Steaphan Greene [sgreene cs.binghamton.edu] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33648 b3059339-0415-0410-9bf9-f77b7e298cf2 Improve stereo3d interleaved man page description. Patch by Steaphan Greene [sgreene cs.binghamton.edu] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33689 b3059339-0415-0410-9bf9-f77b7e298cf2 Change memcpy_pic to force it to never write to image parts between width and stride if creating a row-interleaved format, otherwise the second memcpy_pic might overwrite what the first wrote. Changing the first should not be necessary but might result in better performance. Patch by Steaphan Greene [sgreene cs.binghamton.edu] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33690 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 15 +++++++++++++++ libmpcodecs/vf_stereo3d.c | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 069eac270e..bc56d6162a 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -7384,6 +7384,14 @@ right eye) anaglyph yellow/blue colored (yellow filter on left eye, blue filter on right eye) .RE +.B irl or interleave_rows_left_first +.RS +Interleaved rows (left eye has top row, right eye starts on next row) +.RE +.B irr or interleave_rows_right_first +.RS +Interleaved rows (right eye has top row, left eye starts on next row) +.RE .B ml or mono_left .RS mono output (left eye only) @@ -7393,6 +7401,13 @@ mono output (left eye only) mono output (right eye only) .RE .RE +.I NOTE: +To use either of the interleaved-rows output formats to display +full-screen on a row-interleaved 3D display, you will need to scale the +video to the correct height first using the "scale" filter, if it is not +already the right height. Typically, that is 1080 rows (so use e.g. +"-vf scale=1440:1080,stereo3d=sbsl:irl" for a 720p side-by-side encoded +movie). .RE .PD 1 . diff --git a/libmpcodecs/vf_stereo3d.c b/libmpcodecs/vf_stereo3d.c index 4e9c7713d9..2c6f289e5d 100644 --- a/libmpcodecs/vf_stereo3d.c +++ b/libmpcodecs/vf_stereo3d.c @@ -56,6 +56,8 @@ typedef enum stereo_code { ABOVE_BELOW_RL, //above-below (right eye above, left eye below) ABOVE_BELOW_2_LR, //above-below with half height resolution ABOVE_BELOW_2_RL, //above-below with half height resolution + INTERLEAVE_ROWS_LR, //row-interleave (left eye has top row) + INTERLEAVE_ROWS_RL, //row-interleave (right eye has top row) STEREO_CODE_COUNT //no value set - TODO: needs autodetection } stereo_code; @@ -109,6 +111,7 @@ struct vf_priv_s { int ana_matrix[3][6]; unsigned int width; unsigned int height; + unsigned int row_step; } const vf_priv_default = { {SIDE_BY_SIDE_LR}, {ANAGLYPH_RC_DUBOIS} @@ -137,6 +140,7 @@ static int config(struct vf_instance *vf, int width, int height, int d_width, //default input values vf->priv->width = width; vf->priv->height = height; + vf->priv->row_step = 1; vf->priv->in.width = width; vf->priv->in.height = height; vf->priv->in.off_left = 0; @@ -215,6 +219,18 @@ static int config(struct vf_instance *vf, int width, int height, int d_width, vf->priv->out.height = vf->priv->height * 2; vf->priv->out.row_left = vf->priv->height; break; + case INTERLEAVE_ROWS_LR: + vf->priv->row_step = 2; + vf->priv->height = vf->priv->height / 2; + vf->priv->out.off_right = vf->priv->width * 3; + vf->priv->in.off_right += vf->priv->in.width * 3; + break; + case INTERLEAVE_ROWS_RL: + vf->priv->row_step = 2; + vf->priv->height = vf->priv->height / 2; + vf->priv->out.off_left = vf->priv->width * 3; + vf->priv->in.off_left += vf->priv->in.width * 3; + break; case MONO_R: //same as MONO_L only needs switching of input offsets vf->priv->in.off_left = vf->priv->in.off_right; @@ -264,18 +280,22 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) case ABOVE_BELOW_RL: case ABOVE_BELOW_2_LR: case ABOVE_BELOW_2_RL: - memcpy_pic(dmpi->planes[0] + out_off_left, + case INTERLEAVE_ROWS_LR: + case INTERLEAVE_ROWS_RL: + memcpy_pic2(dmpi->planes[0] + out_off_left, mpi->planes[0] + in_off_left, 3 * vf->priv->width, vf->priv->height, - dmpi->stride[0], - mpi->stride[0]); - memcpy_pic(dmpi->planes[0] + out_off_right, + dmpi->stride[0] * vf->priv->row_step, + mpi->stride[0] * vf->priv->row_step, + vf->priv->row_step != 1); + memcpy_pic2(dmpi->planes[0] + out_off_right, mpi->planes[0] + in_off_right, 3 * vf->priv->width, vf->priv->height, - dmpi->stride[0], - mpi->stride[0]); + dmpi->stride[0] * vf->priv->row_step, + mpi->stride[0] * vf->priv->row_step, + vf->priv->row_step != 1); break; case MONO_L: case MONO_R: @@ -397,6 +417,10 @@ static const struct format_preset { {"above_below_half_height_left_first", ABOVE_BELOW_2_LR}, {"ab2r", ABOVE_BELOW_2_RL}, {"above_below_half_height_right_first",ABOVE_BELOW_2_RL}, + {"irl", INTERLEAVE_ROWS_LR}, + {"interleave_rows_left_first", INTERLEAVE_ROWS_LR}, + {"irr", INTERLEAVE_ROWS_RL}, + {"interleave_rows_right_first", INTERLEAVE_ROWS_RL}, { NULL, 0} }; -- cgit v1.2.3 From 1e544365bfd09e4649cb720716f86ec5b75d86ce Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Jun 2011 09:10:35 +0000 Subject: codec-cfg.c: avoid including aviheader.h Avoid including aviheader.h only for mmioFOURCC, it has too many dependencies, including even subreader.h and via that fribidi. This causes issues both when cross-compiling and for CODEC2HTML compilation, so instead use avutil.h/MKTAG. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33649 b3059339-0415-0410-9bf9-f77b7e298cf2 --- codec-cfg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codec-cfg.c b/codec-cfg.c index 98b3088516..5237d7fadd 100644 --- a/codec-cfg.c +++ b/codec-cfg.c @@ -54,6 +54,7 @@ #endif +#include #include "libmpcodecs/img_format.h" #include "codec-cfg.h" @@ -96,12 +97,12 @@ static int add_to_fourcc(char *s, char *alias, unsigned int *fourcc, goto err_out_too_many; do { - tmp = mmioFOURCC(s[0], s[1], s[2], s[3]); + tmp = MKTAG(s[0], s[1], s[2], s[3]); for (j = 0; j < i; j++) if (tmp == fourcc[j]) goto err_out_duplicated; fourcc[i] = tmp; - map[i] = alias ? mmioFOURCC(alias[0], alias[1], alias[2], alias[3]) : tmp; + map[i] = alias ? MKTAG(alias[0], alias[1], alias[2], alias[3]) : tmp; s += 4; i++; } while ((*(s++) == ',') && --freeslots); -- cgit v1.2.3 From 1b6ae1ff582405652f5543bfc7193eec57d983fc Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Jun 2011 10:36:15 +0000 Subject: VO: w32_common: also generate VO_EVENT_MOVE git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33650 b3059339-0415-0410-9bf9-f77b7e298cf2 Generate VO_EVENT_MOVE also with -wid. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33656 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/w32_common.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libvo/w32_common.c b/libvo/w32_common.c index 0c512f3d2d..a8a59d02c9 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -101,6 +101,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l event_flags |= VO_EVENT_EXPOSE; break; case WM_MOVE: + event_flags |= VO_EVENT_MOVE; p.x = 0; p.y = 0; ClientToScreen(vo_window, &p); @@ -219,11 +220,18 @@ int vo_w32_check_events(void) { if (WinID >= 0) { BOOL res; RECT r; + POINT p; res = GetClientRect(vo_window, &r); if (res && (r.right != vo_dwidth || r.bottom != vo_dheight)) { vo_dwidth = r.right; vo_dheight = r.bottom; event_flags |= VO_EVENT_RESIZE; } + p.x = 0; p.y = 0; + ClientToScreen(vo_window, &p); + if (p.x != vo_dx || p.y != vo_dy) { + vo_dx = p.x; vo_dy = p.y; + event_flags |= VO_EVENT_MOVE; + } res = GetClientRect(WinID, &r); if (res && (r.right != vo_dwidth || r.bottom != vo_dheight)) MoveWindow(vo_window, 0, 0, r.right, r.bottom, FALSE); -- cgit v1.2.3 From 070491f1029ca3d74322146e646d653f9f5dc153 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Jun 2011 12:51:36 +0000 Subject: vo_directx: Change vo_directx to use w32_common.c While I tested it quite thoroughly, with and without -wid, -vm, -fs, ... it is _very_ likely to break something, please report any regressions! In the worst case it can still be reverted, however since it has very little relevance nowadays it will rot all the faster if not at least some code is shared. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33657 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_directx.c | 413 ++++++----------------------------------------------- 1 file changed, 43 insertions(+), 370 deletions(-) diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c index 6df766cc4a..455752179e 100644 --- a/libvo/vo_directx.c +++ b/libvo/vo_directx.c @@ -37,6 +37,7 @@ #include "geometry.h" #include "mp_fifo.h" #include "sub/sub.h" +#include "w32_common.h" #ifndef WM_XBUTTONDOWN # define WM_XBUTTONDOWN 0x020B @@ -58,8 +59,6 @@ static DDSURFACEDESC2 ddsdsf; //surface descripiton needed for static HINSTANCE hddraw_dll; //handle to ddraw.dll static RECT rd; //rect of our stretched image static RECT rs; //rect of our source image -static HWND hWnd=NULL; //handle to the window -static HWND hWndFS=NULL; //fullscreen window static HBRUSH colorbrush = NULL; // Handle to colorkey brush static HBRUSH blackbrush = NULL; // Handle to black brush static HICON mplayericon = NULL; // Handle to mplayer icon @@ -348,19 +347,12 @@ static void uninit(void) if (g_lpddsPrimary != NULL) g_lpddsPrimary->lpVtbl->Release(g_lpddsPrimary); g_lpddsPrimary = NULL; mp_msg(MSGT_VO, MSGL_DBG3,"primary released\n"); - if(hWndFS)DestroyWindow(hWndFS); - hWndFS = NULL; - if((WinID == -1) && hWnd) DestroyWindow(hWnd); - hWnd = NULL; - mp_msg(MSGT_VO, MSGL_DBG3,"window destroyed\n"); UnregisterClass(WNDCLASSNAME_WINDOWED, GetModuleHandle(NULL)); UnregisterClass(WNDCLASSNAME_FULLSCREEN, GetModuleHandle(NULL)); if (mplayericon) DestroyIcon(mplayericon); mplayericon = NULL; if (mplayercursor) DestroyCursor(mplayercursor); mplayercursor = NULL; - if (blackbrush) DeleteObject(blackbrush); - blackbrush = NULL; if (colorbrush) DeleteObject(colorbrush); colorbrush = NULL; mp_msg(MSGT_VO, MSGL_DBG3,"GDI resources deleted\n"); @@ -373,6 +365,7 @@ static void uninit(void) hddraw_dll= NULL; mp_msg(MSGT_VO, MSGL_DBG3,"ddraw.dll freed\n"); mp_msg(MSGT_VO, MSGL_DBG3,"uninitialized\n"); + vo_w32_uninit(); } static BOOL WINAPI EnumCallbackEx(GUID FAR *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, LPVOID lpContext, HMONITOR hm) @@ -495,7 +488,7 @@ static uint32_t Directx_InitDirectDraw(void) else vm_bpp=ddsd.ddpfPixelFormat.dwRGBBitCount; if(vidmode){ - if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, hWnd, DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN) != DD_OK) + if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, vo_w32_window, DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN) != DD_OK) { mp_msg(MSGT_VO, MSGL_FATAL,"can't set cooperativelevel for exclusive mode\n"); return 1; @@ -509,7 +502,7 @@ static uint32_t Directx_InitDirectDraw(void) mp_msg(MSGT_VO, MSGL_V,"Initialized adapter %i for %i x %i @ %i \n",vo_adapter_num,vm_width,vm_height,vm_bpp); return 0; } - if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, hWnd, DDSCL_NORMAL) != DD_OK) // or DDSCL_SETFOCUSWINDOW + if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, vo_w32_window, DDSCL_NORMAL) != DD_OK) // or DDSCL_SETFOCUSWINDOW { mp_msg(MSGT_VO, MSGL_FATAL,"could not set cooperativelevel for hardwarecheck\n"); return 1; @@ -518,13 +511,19 @@ static uint32_t Directx_InitDirectDraw(void) return 0; } +static uint32_t Directx_ManageDisplay(void); + static void check_events(void) { - MSG msg; - while (PeekMessage(&msg, NULL, 0, 0,PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); + int evt = vo_w32_check_events(); + if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE)) + Directx_ManageDisplay(); + if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE | VO_EVENT_EXPOSE)) { + HDC dc = vo_w32_get_dc(vo_w32_window); + RECT r; + GetClientRect(vo_w32_window, &r); + FillRect(dc, &r, vo_fs || vidmode ? blackbrush : colorbrush); + vo_w32_release_dc(vo_w32_window, dc); } } @@ -536,66 +535,20 @@ static uint32_t Directx_ManageDisplay(void) DWORD dwUpdateFlags=0; int width,height; - if(!vidmode && !vo_fs && WinID!=-1) { - RECT current_rect = {0, 0, 0, 0}; - GetWindowRect(hWnd, ¤t_rect); - if ((current_rect.left == last_rect.left) - && (current_rect.top == last_rect.top) - && (current_rect.right == last_rect.right) - && (current_rect.bottom == last_rect.bottom)) - return 0; - last_rect = current_rect; - } + rd.left = vo_dx - xinerama_x; + rd.top = vo_dy - xinerama_y; + width = vo_dwidth; + height = vo_dheight; + + aspect(&width, &height, A_WINZOOM); + panscan_calc_windowed(); + width += vo_panscan_x; + height += vo_panscan_y; + width = FFMIN(width, vo_screenwidth); + height = FFMIN(height, vo_screenheight); + rd.left += (vo_dwidth - width ) / 2; + rd.top += (vo_dheight - height) / 2; - if(vo_fs || vidmode){ - aspect(&width,&height,A_ZOOM); - rd.left=(vo_screenwidth-width)/2; - rd.top=(vo_screenheight-height)/2; - if (WinID == -1) - if(ShowCursor(FALSE)>=0)while(ShowCursor(FALSE)>=0){} - } - else if (WinID != -1 && vo_geometry) { - POINT pt; - pt.x = vo_dx; - pt.y = vo_dy; - ClientToScreen(hWnd,&pt); - width=d_image_width; - height=d_image_height; - rd.left = pt.x; - rd.top = pt.y; - while(ShowCursor(TRUE)<=0){} - } - else { - POINT pt; - pt.x = 0; //overlayposition relative to the window - pt.y = 0; - ClientToScreen(hWnd,&pt); - GetClientRect(hWnd, &rd); - width=rd.right - rd.left; - height=rd.bottom - rd.top; - pt.x -= monitor_rect.left; /* move coordinates from global to local monitor space */ - pt.y -= monitor_rect.top; - rd.right -= monitor_rect.left; - rd.bottom -= monitor_rect.top; - rd.left = pt.x; - rd.top = pt.y; - if(!nooverlay && (!width || !height)){ - /*window is minimized*/ - ddrval = g_lpddsOverlay->lpVtbl->UpdateOverlay(g_lpddsOverlay,NULL, g_lpddsPrimary, NULL, DDOVER_HIDE, NULL); - return 0; - } - if(vo_keepaspect){ - int tmpheight=((float)width/window_aspect); - tmpheight+=tmpheight%2; - if(tmpheight > height){ - width=((float)height*window_aspect); - width+=width%2; - } - else height=tmpheight; - } - if (WinID == -1) - while(ShowCursor(TRUE)<=0){} - } rd.right=rd.left+width; rd.bottom=rd.top+height; @@ -680,23 +633,8 @@ static uint32_t Directx_ManageDisplay(void) } else { - g_lpddclipper->lpVtbl->SetHWnd(g_lpddclipper, 0,(vo_fs && !vidmode)?hWndFS: hWnd); - } - - if(!vidmode && !vo_fs){ - if(WinID == -1) { - RECT rdw=rd; - if (vo_border) - AdjustWindowRect(&rdw,WNDSTYLE,FALSE); -// printf("window: %i %i %ix%i\n",rdw.left,rdw.top,rdw.right - rdw.left,rdw.bottom - rdw.top); - rdw.left += monitor_rect.left; /* move to global coordinate space */ - rdw.top += monitor_rect.top; - rdw.right += monitor_rect.left; - rdw.bottom += monitor_rect.top; - SetWindowPos(hWnd,(vo_ontop)?HWND_TOPMOST:(vo_rootwin?HWND_BOTTOM:HWND_NOTOPMOST),rdw.left,rdw.top,rdw.right-rdw.left,rdw.bottom-rdw.top,SWP_NOOWNERZORDER); - } + g_lpddclipper->lpVtbl->SetHWnd(g_lpddclipper, 0, vo_w32_window); } - else SetWindowPos(vidmode?hWnd:hWndFS,vo_rootwin?HWND_BOTTOM:HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOOWNERZORDER|SWP_NOCOPYBITS); /*make sure the overlay is inside the screen*/ if(rd.left<0)rd.left=0; @@ -887,172 +825,10 @@ static uint32_t Directx_CheckPrimaryPixelformat(void) return 0; } -//function handles input -static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_MOUSEACTIVATE: - return MA_ACTIVATEANDEAT; - case WM_NCACTIVATE: - { - if(vidmode && adapter_count > 2) //only disable if more than one adapter. - return 0; - break; - } - case WM_DESTROY: - { - PostQuitMessage(0); - return 0; - } - case WM_CLOSE: - { - mplayer_put_key(KEY_CLOSE_WIN); - return 0; - } - case WM_WINDOWPOSCHANGED: - { - //printf("Windowposchange\n"); - if(g_lpddsBack != NULL) //or it will crash with -vm - { - Directx_ManageDisplay(); - } - break; - } - case WM_SYSCOMMAND: - { - switch (wParam) - { //kill screensaver etc. - //note: works only when the window is active - //you can workaround this by disabling the allow screensaver option in - //the link to the app - case SC_SCREENSAVE: - case SC_MONITORPOWER: - mp_msg(MSGT_VO, MSGL_V ,"killing screensaver\n" ); - return 0; - case SC_MAXIMIZE: - if (!vo_fs) control(VOCTRL_FULLSCREEN, NULL); - return 0; - } - break; - } - case WM_KEYDOWN: - { - switch (wParam) - { - case VK_LEFT: - {mplayer_put_key(KEY_LEFT);break;} - case VK_UP: - {mplayer_put_key(KEY_UP);break;} - case VK_RIGHT: - {mplayer_put_key(KEY_RIGHT);break;} - case VK_DOWN: - {mplayer_put_key(KEY_DOWN);break;} - case VK_TAB: - {mplayer_put_key(KEY_TAB);break;} - case VK_BACK: - {mplayer_put_key(KEY_BS);break;} - case VK_DELETE: - {mplayer_put_key(KEY_DELETE);break;} - case VK_INSERT: - {mplayer_put_key(KEY_INSERT);break;} - case VK_HOME: - {mplayer_put_key(KEY_HOME);break;} - case VK_END: - {mplayer_put_key(KEY_END);break;} - case VK_PRIOR: - {mplayer_put_key(KEY_PAGE_UP);break;} - case VK_NEXT: - {mplayer_put_key(KEY_PAGE_DOWN);break;} - case VK_ESCAPE: - {mplayer_put_key(KEY_ESC);break;} - } - break; - } - case WM_CHAR: - { - mplayer_put_key(wParam); - break; - } - case WM_LBUTTONDOWN: - { - if (!vo_nomouse_input) - mplayer_put_key(MOUSE_BTN0); - break; - } - case WM_MBUTTONDOWN: - { - if (!vo_nomouse_input) - mplayer_put_key(MOUSE_BTN1); - break; - } - case WM_RBUTTONDOWN: - { - if (!vo_nomouse_input) - mplayer_put_key(MOUSE_BTN2); - break; - } - case WM_LBUTTONDBLCLK: - { - if(!vo_nomouse_input) - mplayer_put_key(MOUSE_BTN0_DBL); - break; - } - case WM_MBUTTONDBLCLK: - { - if(!vo_nomouse_input) - mplayer_put_key(MOUSE_BTN1_DBL); - break; - } - case WM_RBUTTONDBLCLK: - { - if(!vo_nomouse_input) - mplayer_put_key(MOUSE_BTN2_DBL); - break; - } - case WM_MOUSEWHEEL: - { - int x; - if (vo_nomouse_input) - break; - x = GET_WHEEL_DELTA_WPARAM(wParam); - if (x > 0) - mplayer_put_key(MOUSE_BTN3); - else - mplayer_put_key(MOUSE_BTN4); - break; - } - case WM_XBUTTONDOWN: - { - if (vo_nomouse_input) - break; - if (HIWORD(wParam) == 1) - mplayer_put_key(MOUSE_BTN5); - else - mplayer_put_key(MOUSE_BTN6); - break; - } - case WM_XBUTTONDBLCLK: - { - if (vo_nomouse_input) - break; - if (HIWORD(wParam) == 1) - mplayer_put_key(MOUSE_BTN5_DBL); - else - mplayer_put_key(MOUSE_BTN6_DBL); - break; - } - - } - return DefWindowProc(hWnd, message, wParam, lParam); -} - - static int preinit(const char *arg) { HINSTANCE hInstance = GetModuleHandle(NULL); char exedir[MAX_PATH]; - WNDCLASS wc; if(arg) { if(strstr(arg,"noaccel")) @@ -1074,31 +850,13 @@ static int preinit(const char *arg) windowcolor = vo_colorkey; colorbrush = CreateSolidBrush(windowcolor); blackbrush = (HBRUSH)GetStockObject(BLACK_BRUSH); - wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; - wc.lpfnWndProc = WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInstance; - wc.hCursor = mplayercursor; - wc.hIcon = mplayericon; - wc.hbrBackground = vidmode ? blackbrush : colorbrush; - wc.lpszClassName = WNDCLASSNAME_WINDOWED; - wc.lpszMenuName = NULL; - RegisterClass(&wc); - if (WinID != -1) hWnd = WinID; - else - hWnd = CreateWindowEx(vidmode?WS_EX_TOPMOST:0, - WNDCLASSNAME_WINDOWED,"",(vidmode || !vo_border)?WS_POPUP:WNDSTYLE, - CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,NULL,NULL,hInstance,NULL); - wc.hbrBackground = blackbrush; - wc.lpszClassName = WNDCLASSNAME_FULLSCREEN; - RegisterClass(&wc); + if (!vo_w32_init()) + return 1; + if (!vo_w32_config(100, 100, VOFLAG_HIDDEN)) + return 1; if (Directx_InitDirectDraw()!= 0)return 1; //init DirectDraw - if(!vidmode)hWndFS = CreateWindow(WNDCLASSNAME_FULLSCREEN,"MPlayer Fullscreen",WS_POPUP,monitor_rect.left,monitor_rect.top,monitor_rect.right-monitor_rect.left,monitor_rect.bottom-monitor_rect.top,hWnd,NULL,hInstance,NULL); - mp_msg(MSGT_VO, MSGL_DBG3 ,"initial mplayer windows created\n"); - if (Directx_CheckPrimaryPixelformat()!=0)return 1; if (!nooverlay && Directx_CheckOverlayPixelformats() == 0) //check for supported hardware { @@ -1239,8 +997,6 @@ static uint32_t put_image(mp_image_t *mpi){ uint32_t w = mpi->w; uint32_t h = mpi->h; - if (WinID != -1) Directx_ManageDisplay(); - if((mpi->flags&MP_IMGFLAG_DIRECT)||(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) { mp_msg(MSGT_VO, MSGL_DBG3 ,"put_image: nothing to do: drawslices\n"); @@ -1278,8 +1034,6 @@ static uint32_t put_image(mp_image_t *mpi){ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t options, char *title, uint32_t format) { - RECT rd; - vo_fs = options & 0x01; image_format = format; image_width = width; image_height = height; @@ -1302,32 +1056,11 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin g_lpddsPrimary = NULL; mp_msg(MSGT_VO, MSGL_DBG3,"overlay surfaces released\n"); - if(!vidmode){ - if(!vo_geometry){ - GetWindowRect(hWnd,&rd); - vo_dx=rd.left; - vo_dy=rd.top; - } - vo_dx += monitor_rect.left; /* move position to global window space */ - vo_dy += monitor_rect.top; - rd.left = vo_dx; - rd.top = vo_dy; - rd.right = rd.left + d_image_width; - rd.bottom = rd.top + d_image_height; - if (WinID == -1) { - if (vo_border) - AdjustWindowRect(&rd,WNDSTYLE,FALSE); - SetWindowPos(hWnd,NULL, vo_dx, vo_dy,rd.right-rd.left,rd.bottom-rd.top,SWP_SHOWWINDOW|SWP_NOOWNERZORDER); - } - } - else ShowWindow(hWnd,SW_SHOW); + if (!vo_w32_config(d_width, d_height, options)) + return 1; - if(vo_fs && !vidmode)ShowWindow(hWndFS,SW_SHOW); if (WinID == -1) - SetWindowText(hWnd,title); - - - if(vidmode)vo_fs=0; + SetWindowText(vo_w32_window,title); /*create the surfaces*/ @@ -1369,7 +1102,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin vo_doublebuffering = 0; /*create clipper for nonoverlay mode*/ if(g_lpdd->lpVtbl->CreateClipper(g_lpdd, 0, &g_lpddclipper,NULL)!= DD_OK){mp_msg(MSGT_VO, MSGL_FATAL,"can't create clipper\n");return 1;} - if(g_lpddclipper->lpVtbl->SetHWnd (g_lpddclipper, 0, hWnd)!= DD_OK){mp_msg(MSGT_VO, MSGL_FATAL,"can't associate clipper with window\n");return 1;} + if(g_lpddclipper->lpVtbl->SetHWnd (g_lpddclipper, 0, vo_w32_window)!= DD_OK){mp_msg(MSGT_VO, MSGL_FATAL,"can't associate clipper with window\n");return 1;} if(g_lpddsPrimary->lpVtbl->SetClipper (g_lpddsPrimary,g_lpddclipper)!=DD_OK){mp_msg(MSGT_VO, MSGL_FATAL,"can't associate primary surface with clipper\n");return 1;} mp_msg(MSGT_VO, MSGL_DBG3,"clipper succesfully created\n"); }else{ @@ -1475,43 +1208,11 @@ static int control(uint32_t request, void *data) case VOCTRL_DRAW_IMAGE: return put_image(data); case VOCTRL_BORDER: - if(WinID != -1) return VO_TRUE; - if(vidmode) - { - mp_msg(MSGT_VO, MSGL_ERR,"border has no meaning in exclusive mode\n"); - } - else - { - if(vo_border) { - vo_border = 0; - SetWindowLong(hWnd, GWL_STYLE, WS_POPUP); - } else { - vo_border = 1; - SetWindowLong(hWnd, GWL_STYLE, WNDSTYLE); - } - // needed AFAICT to force the window to - // redisplay with the new style. --Joey - if (!vo_fs) { - ShowWindow(hWnd,SW_HIDE); - ShowWindow(hWnd,SW_SHOW); - } - last_rect.left = 0xDEADC0DE; // reset window position cache - Directx_ManageDisplay(); - } + vo_w32_border(); + Directx_ManageDisplay(); return VO_TRUE; case VOCTRL_ONTOP: - if(WinID != -1) return VO_TRUE; - if(vidmode) - { - mp_msg(MSGT_VO, MSGL_ERR,"ontop has no meaning in exclusive mode\n"); - } - else - { - if(vo_ontop) vo_ontop = 0; - else vo_ontop = 1; - last_rect.left = 0xDEADC0DE; // reset window position cache - Directx_ManageDisplay(); - } + vo_w32_ontop(); return VO_TRUE; case VOCTRL_ROOTWIN: if(WinID != -1) return VO_TRUE; @@ -1529,29 +1230,8 @@ static int control(uint32_t request, void *data) return VO_TRUE; case VOCTRL_FULLSCREEN: { - if(vidmode) - { - mp_msg(MSGT_VO, MSGL_ERR,"currently we do not allow to switch from exclusive to windowed mode\n"); - } - else - { - if(!vo_fs) - { - vo_fs=1; - ShowWindow(hWndFS,SW_SHOW); - ShowWindow(hWnd,SW_HIDE); - SetForegroundWindow(hWndFS); - } - else - { - vo_fs=0; - ShowWindow(hWndFS,SW_HIDE); - ShowWindow(hWnd,SW_SHOW); - } - last_rect.left = 0xDEADC0DE; // reset window position cache - Directx_ManageDisplay(); - break; - } + vo_w32_fullscreen(); + Directx_ManageDisplay(); return VO_TRUE; } case VOCTRL_SET_EQUALIZER: { @@ -1563,14 +1243,7 @@ static int control(uint32_t request, void *data) return color_ctrl_get(args->name, args->valueptr); } case VOCTRL_UPDATE_SCREENINFO: - if (vidmode) { - vo_screenwidth = vm_width; - vo_screenheight = vm_height; - } else { - vo_screenwidth = monitor_rect.right - monitor_rect.left; - vo_screenheight = monitor_rect.bottom - monitor_rect.top; - } - aspect_save_screenres(vo_screenwidth, vo_screenheight); + w32_update_xinerama_info(); return VO_TRUE; case VOCTRL_RESET: last_rect.left = 0xDEADC0DE; // reset window position cache -- cgit v1.2.3 From cb5c492aa7ed470e61a26e6e7f4451363d4ccd76 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Jun 2011 16:05:35 +0000 Subject: cleanup: mplayer.c: Factor out a bit of spudec code git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33662 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mplayer.c b/mplayer.c index 80e7a8d20e..a589fd3679 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1130,6 +1130,7 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr void init_vo_spudec(struct MPContext *mpctx) { + unsigned width, height; spudec_free(vo_spudec); mpctx->initialized_flags &= ~INITIALIZED_SPUDEC; vo_spudec = NULL; @@ -1139,17 +1140,20 @@ void init_vo_spudec(struct MPContext *mpctx) return; if (spudec_ifo) { - unsigned int palette[16], width, height; + unsigned int palette[16]; current_module="spudec_init_vobsub"; if (vobsub_parse_ifo(NULL,spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0) vo_spudec=spudec_new_scaled(palette, width, height, NULL, 0); } + width = mpctx->sh_video->disp_w; + height = mpctx->sh_video->disp_h; + #ifdef CONFIG_DVDREAD if (vo_spudec==NULL && mpctx->stream->type==STREAMTYPE_DVD) { current_module="spudec_init_dvdread"; vo_spudec=spudec_new_scaled(((dvd_priv_t *)(mpctx->stream->priv))->cur_pgc->palette, - mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, + width, height, NULL, 0); } #endif @@ -1158,14 +1162,14 @@ void init_vo_spudec(struct MPContext *mpctx) if (vo_spudec==NULL && mpctx->stream->type==STREAMTYPE_DVDNAV) { unsigned int *palette = mp_dvdnav_get_spu_clut(mpctx->stream); current_module="spudec_init_dvdnav"; - vo_spudec=spudec_new_scaled(palette, mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, NULL, 0); + vo_spudec=spudec_new_scaled(palette, width, height, NULL, 0); } #endif if (vo_spudec==NULL) { sh_sub_t *sh = mpctx->d_sub->sh; current_module="spudec_init_normal"; - vo_spudec=spudec_new_scaled(NULL, mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, sh->extradata, sh->extradata_len); + vo_spudec=spudec_new_scaled(NULL, width, height, sh->extradata, sh->extradata_len); spudec_set_font_factor(vo_spudec,font_factor); } -- cgit v1.2.3 From 681133d10d3492fe26959fdde03a16080ba41692 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Jun 2011 16:28:18 +0000 Subject: demux_lavf: fix code printing subtitle type Fix printing of subtitle type, the wrong index was used to look up the type. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33664 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_lavf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 73174437fb..82ca90f9fc 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -516,8 +516,8 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) if (stream_type) { AVCodec *avc = avcodec_find_decoder(codec->codec_id); const char *codec_name = avc ? avc->name : "unknown"; - if (!avc && *stream_type == 's' && demuxer->s_streams[stream_id]) - codec_name = sh_sub_type2str(((sh_sub_t *)demuxer->s_streams[stream_id])->type); + if (!avc && *stream_type == 's' && demuxer->s_streams[i]) + codec_name = sh_sub_type2str(((sh_sub_t *)demuxer->s_streams[i])->type); mp_msg(MSGT_DEMUX, MSGL_INFO, "[lavf] stream %d: %s (%s), -%cid %d", i, stream_type, codec_name, *stream_type, stream_id); if (lang && lang->value && *stream_type != 'v') -- cgit v1.2.3 From 9d8913dbf42201f3028369b23797be594a03fb70 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Jun 2011 18:31:45 +0000 Subject: cleanup: vo_directx: remove redundant code Simplify code for printing display adapter list. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33672 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove left-over code from icon/cursor handling that is now done by w32_common.c git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33673 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove more code and variables that have no purpose anymore. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33674 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove some #includes that are no longer needed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33675 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove more unnecessary code/defines. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33677 b3059339-0415-0410-9bf9-f77b7e298cf2 Move check_events function to avoid forward declaration. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33678 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove more unused variables. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33679 b3059339-0415-0410-9bf9-f77b7e298cf2 Add const to avoid compiler warning. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33680 b3059339-0415-0410-9bf9-f77b7e298cf2 Use the proper type for the palette, fixes compiler warning. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33681 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_directx.c | 117 +++++++++++------------------------------------------ 1 file changed, 23 insertions(+), 94 deletions(-) diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c index 455752179e..c9dfdde995 100644 --- a/libvo/vo_directx.c +++ b/libvo/vo_directx.c @@ -30,25 +30,11 @@ #include "video_out.h" #include "video_out_internal.h" #include "fastmemcpy.h" -#include "input/input.h" -#include "input/keycodes.h" #include "mp_msg.h" #include "aspect.h" -#include "geometry.h" -#include "mp_fifo.h" #include "sub/sub.h" #include "w32_common.h" -#ifndef WM_XBUTTONDOWN -# define WM_XBUTTONDOWN 0x020B -# define WM_XBUTTONUP 0x020C -# define WM_XBUTTONDBLCLK 0x020D -#endif - -#define WNDCLASSNAME_WINDOWED "MPlayer - The Movie Player" -#define WNDCLASSNAME_FULLSCREEN "MPlayer - Fullscreen" -#define WNDSTYLE WS_OVERLAPPEDWINDOW|WS_SIZEBOX - static LPDIRECTDRAWCOLORCONTROL g_cc = NULL; //color control interface static LPDIRECTDRAW7 g_lpdd = NULL; //DirectDraw Object static LPDIRECTDRAWSURFACE7 g_lpddsPrimary = NULL; //Primary Surface: viewport through the Desktop @@ -61,10 +47,7 @@ static RECT rd; //rect of our stretched imag static RECT rs; //rect of our source image static HBRUSH colorbrush = NULL; // Handle to colorkey brush static HBRUSH blackbrush = NULL; // Handle to black brush -static HICON mplayericon = NULL; // Handle to mplayer icon -static HCURSOR mplayercursor = NULL; // Handle to mplayer cursor static uint32_t image_width, image_height; //image width and height -static uint32_t d_image_width, d_image_height; //image width and height zoomed static uint8_t *image=NULL; //image data static void* tmp_image = NULL; static uint32_t image_format=0; //image format @@ -79,10 +62,6 @@ static COLORREF windowcolor = RGB(0,0,16); //windowcolor == colorkey static int adapter_count=0; static GUID selected_guid; static GUID *selected_guid_ptr = NULL; -static RECT monitor_rect; //monitor coordinates -static float window_aspect; -static BOOL (WINAPI* myGetMonitorInfo)(HMONITOR, LPMONITORINFO) = NULL; -static RECT last_rect = {0xDEADC0DE, 0xDEADC0DE, 0xDEADC0DE, 0xDEADC0DE}; /***************************************************************************** * DirectDraw GUIDs. @@ -347,12 +326,6 @@ static void uninit(void) if (g_lpddsPrimary != NULL) g_lpddsPrimary->lpVtbl->Release(g_lpddsPrimary); g_lpddsPrimary = NULL; mp_msg(MSGT_VO, MSGL_DBG3,"primary released\n"); - UnregisterClass(WNDCLASSNAME_WINDOWED, GetModuleHandle(NULL)); - UnregisterClass(WNDCLASSNAME_FULLSCREEN, GetModuleHandle(NULL)); - if (mplayericon) DestroyIcon(mplayericon); - mplayericon = NULL; - if (mplayercursor) DestroyCursor(mplayercursor); - mplayercursor = NULL; if (colorbrush) DeleteObject(colorbrush); colorbrush = NULL; mp_msg(MSGT_VO, MSGL_DBG3,"GDI resources deleted\n"); @@ -370,19 +343,11 @@ static void uninit(void) static BOOL WINAPI EnumCallbackEx(GUID FAR *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, LPVOID lpContext, HMONITOR hm) { - mp_msg(MSGT_VO, MSGL_INFO ," adapter %d: ", adapter_count); - if (!lpGUID) - { - mp_msg(MSGT_VO, MSGL_INFO ,"%s", "Primary Display Adapter"); - } - else - { - mp_msg(MSGT_VO, MSGL_INFO ,"%s", lpDriverDescription); - } + lpDriverDescription = "Primary Display Adapter"; + mp_msg(MSGT_VO, MSGL_INFO ," adapter %d: %s", adapter_count, lpDriverDescription); if(adapter_count == vo_adapter_num){ - MONITORINFO mi; if (!lpGUID) selected_guid_ptr = NULL; else @@ -390,11 +355,7 @@ static BOOL WINAPI EnumCallbackEx(GUID FAR *lpGUID, LPSTR lpDriverDescription, L selected_guid = *lpGUID; selected_guid_ptr = &selected_guid; } - mi.cbSize = sizeof(mi); - if (myGetMonitorInfo(hm, &mi)) { - monitor_rect = mi.rcMonitor; - } mp_msg(MSGT_VO, MSGL_INFO ,"\t\t<--"); } mp_msg(MSGT_VO, MSGL_INFO ,"\n"); @@ -409,16 +370,8 @@ static uint32_t Directx_InitDirectDraw(void) HRESULT (WINAPI *OurDirectDrawCreateEx)(GUID *,LPVOID *, REFIID,IUnknown FAR *); DDSURFACEDESC2 ddsd; LPDIRECTDRAWENUMERATEEX OurDirectDrawEnumerateEx; - HINSTANCE user32dll=LoadLibrary("user32.dll"); adapter_count = 0; - if(user32dll){ - myGetMonitorInfo=GetProcAddress(user32dll,"GetMonitorInfoA"); - if(!myGetMonitorInfo && vo_adapter_num){ - mp_msg(MSGT_VO, MSGL_ERR, " -adapter is not supported on Win95\n"); - vo_adapter_num = 0; - } - } mp_msg(MSGT_VO, MSGL_DBG3,"Initing DirectDraw\n" ); @@ -430,8 +383,6 @@ static uint32_t Directx_InitDirectDraw(void) return 1; } - last_rect.left = 0xDEADC0DE; // reset window position cache - if(vo_adapter_num){ //display other than default OurDirectDrawEnumerateEx = (LPDIRECTDRAWENUMERATEEX) GetProcAddress(hddraw_dll,"DirectDrawEnumerateExA"); if (!OurDirectDrawEnumerateEx){ @@ -448,7 +399,6 @@ static uint32_t Directx_InitDirectDraw(void) if(vo_adapter_num >= adapter_count) mp_msg(MSGT_VO, MSGL_ERR,"Selected adapter (%d) doesn't exist: Default Display Adapter selected\n",vo_adapter_num); } - FreeLibrary(user32dll); OurDirectDrawCreateEx = (void *)GetProcAddress(hddraw_dll, "DirectDrawCreateEx"); if ( OurDirectDrawCreateEx == NULL ) @@ -511,22 +461,6 @@ static uint32_t Directx_InitDirectDraw(void) return 0; } -static uint32_t Directx_ManageDisplay(void); - -static void check_events(void) -{ - int evt = vo_w32_check_events(); - if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE)) - Directx_ManageDisplay(); - if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE | VO_EVENT_EXPOSE)) { - HDC dc = vo_w32_get_dc(vo_w32_window); - RECT r; - GetClientRect(vo_w32_window, &r); - FillRect(dc, &r, vo_fs || vidmode ? blackbrush : colorbrush); - vo_w32_release_dc(vo_w32_window, dc); - } -} - static uint32_t Directx_ManageDisplay(void) { HRESULT ddrval; @@ -695,6 +629,20 @@ static uint32_t Directx_ManageDisplay(void) return 0; } +static void check_events(void) +{ + int evt = vo_w32_check_events(); + if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE)) + Directx_ManageDisplay(); + if (evt & (VO_EVENT_RESIZE | VO_EVENT_MOVE | VO_EVENT_EXPOSE)) { + HDC dc = vo_w32_get_dc(vo_w32_window); + RECT r; + GetClientRect(vo_w32_window, &r); + FillRect(dc, &r, vo_fs || vidmode ? blackbrush : colorbrush); + vo_w32_release_dc(vo_w32_window, dc); + } +} + //find out supported overlay pixelformats static uint32_t Directx_CheckOverlayPixelformats(void) { @@ -827,8 +775,6 @@ static uint32_t Directx_CheckPrimaryPixelformat(void) static int preinit(const char *arg) { - HINSTANCE hInstance = GetModuleHandle(NULL); - char exedir[MAX_PATH]; if(arg) { if(strstr(arg,"noaccel")) @@ -837,15 +783,6 @@ static int preinit(const char *arg) nooverlay = 1; } } - /*load icon from the main app*/ - if(GetModuleFileName(NULL,exedir,MAX_PATH)) - { - mplayericon = ExtractIcon( hInstance, exedir, 0 ); - } - if(!mplayericon)mplayericon=LoadIcon(NULL,IDI_APPLICATION); - mplayercursor = LoadCursor(NULL, IDC_ARROW); - monitor_rect.right=GetSystemMetrics(SM_CXSCREEN); - monitor_rect.bottom=GetSystemMetrics(SM_CYSCREEN); windowcolor = vo_colorkey; colorbrush = CreateSolidBrush(windowcolor); @@ -1037,10 +974,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin image_format = format; image_width = width; image_height = height; - d_image_width = d_width; - d_image_height = d_height; if(format != primary_image_format)nooverlay = 0; - window_aspect= (float)d_image_width / (float)d_image_height; /*release all directx objects*/ if (g_cc != NULL)g_cc->lpVtbl->Release(g_cc); @@ -1069,13 +1003,13 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin //create palette for 256 color mode if(image_format==IMGFMT_BGR8){ LPDIRECTDRAWPALETTE ddpalette=NULL; - char* palette=malloc(4*256); + LPPALETTEENTRY palette=calloc(256, sizeof(*palette)); int i; for(i=0; i<256; i++){ - palette[4*i+0] = ((i >> 5) & 0x07) * 255 / 7; - palette[4*i+1] = ((i >> 2) & 0x07) * 255 / 7; - palette[4*i+2] = ((i >> 0) & 0x03) * 255 / 3; - palette[4*i+3] = PC_NOCOLLAPSE; + palette[i].peRed = ((i >> 5) & 0x07) * 255 / 7; + palette[i].peGreen = ((i >> 2) & 0x07) * 255 / 7; + palette[i].peBlue = ((i >> 0) & 0x03) * 255 / 3; + palette[i].peFlags = PC_NOCOLLAPSE; } g_lpdd->lpVtbl->CreatePalette(g_lpdd,DDPCAPS_8BIT|DDPCAPS_INITIALIZE,palette,&ddpalette,NULL); g_lpddsPrimary->lpVtbl->SetPalette(g_lpddsPrimary,ddpalette); @@ -1126,7 +1060,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin // contrast [0, 20000] // hue [-180, 180] // saturation [0, 20000] -static uint32_t color_ctrl_set(char *what, int value) +static uint32_t color_ctrl_set(const char *what, int value) { uint32_t r = VO_NOTIMPL; DDCOLORCONTROL dcc; @@ -1163,7 +1097,7 @@ static uint32_t color_ctrl_set(char *what, int value) } //analoguous to color_ctrl_set -static uint32_t color_ctrl_get(char *what, int *value) +static uint32_t color_ctrl_get(const char *what, int *value) { uint32_t r = VO_NOTIMPL; DDCOLORCONTROL dcc; @@ -1203,7 +1137,6 @@ static int control(uint32_t request, void *data) case VOCTRL_GET_IMAGE: return get_image(data); case VOCTRL_QUERY_FORMAT: - last_rect.left = 0xDEADC0DE; // reset window position cache return query_format(*((uint32_t*)data)); case VOCTRL_DRAW_IMAGE: return put_image(data); @@ -1224,7 +1157,6 @@ static int control(uint32_t request, void *data) { if(vo_rootwin) vo_rootwin = 0; else vo_rootwin = 1; - last_rect.left = 0xDEADC0DE; // reset window position cache Directx_ManageDisplay(); } return VO_TRUE; @@ -1245,9 +1177,6 @@ static int control(uint32_t request, void *data) case VOCTRL_UPDATE_SCREENINFO: w32_update_xinerama_info(); return VO_TRUE; - case VOCTRL_RESET: - last_rect.left = 0xDEADC0DE; // reset window position cache - // fall-through intended }; return VO_NOTIMPL; } -- cgit v1.2.3 From 2d238417395c2e01bde5f090fa8e492fb08cc975 Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 21 Jun 2011 17:32:07 +0000 Subject: options: Allow a larger range for -aspect Based on patch by Steaphan Greene [sgreene cs.binghamton.edu] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33688 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cfg-mplayer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 0ada04916a..2bc9ccbf10 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -619,7 +619,7 @@ const m_option_t common_opts[] = { {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL}, {"ssf", (void *) scaler_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, OPT_MAKE_FLAGS("zoom", softzoom, 0), - OPT_FLOATRANGE("aspect", movie_aspect, 0, 0.2, 3.0), + OPT_FLOATRANGE("aspect", movie_aspect, 0, 0.1, 10.0), OPT_FLAG_CONSTANTS("noaspect", movie_aspect, 0, 0, 0), OPT_FLOATRANGE("xy", screen_size_xy, 0, 0.001, 4096), -- cgit v1.2.3 From f57282688396aba0e20a102ac2a67429e0d7e785 Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 21 Jun 2011 19:29:22 +0000 Subject: cosmetics: img_format.h: document some formats Document the meaning of some of the packed YUV formats. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33692 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/img_format.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h index 2fc9775ee1..60adc5c038 100644 --- a/libmpcodecs/img_format.h +++ b/libmpcodecs/img_format.h @@ -164,26 +164,26 @@ /* Packed YUV Formats */ -#define IMGFMT_IUYV 0x56595549 -#define IMGFMT_IY41 0x31435949 +#define IMGFMT_IUYV 0x56595549 // Interlaced UYVY +#define IMGFMT_IY41 0x31435949 // Interlaced Y41P #define IMGFMT_IYU1 0x31555949 #define IMGFMT_IYU2 0x32555949 #define IMGFMT_UYVY 0x59565955 -#define IMGFMT_UYNV 0x564E5955 -#define IMGFMT_cyuv 0x76757963 -#define IMGFMT_Y422 0x32323459 +#define IMGFMT_UYNV 0x564E5955 // Exactly same as UYVY +#define IMGFMT_cyuv 0x76757963 // upside-down UYVY +#define IMGFMT_Y422 0x32323459 // Exactly same as UYVY #define IMGFMT_YUY2 0x32595559 -#define IMGFMT_YUNV 0x564E5559 +#define IMGFMT_YUNV 0x564E5559 // Exactly same as YUY2 #define IMGFMT_YVYU 0x55595659 #define IMGFMT_Y41P 0x50313459 #define IMGFMT_Y211 0x31313259 -#define IMGFMT_Y41T 0x54313459 -#define IMGFMT_Y42T 0x54323459 -#define IMGFMT_V422 0x32323456 +#define IMGFMT_Y41T 0x54313459 // Y41P, Y lsb = transparency +#define IMGFMT_Y42T 0x54323459 // UYVY, Y lsb = transparency +#define IMGFMT_V422 0x32323456 // upside-down UYVY? #define IMGFMT_V655 0x35353656 #define IMGFMT_CLJR 0x524A4C43 -#define IMGFMT_YUVP 0x50565559 -#define IMGFMT_UYVP 0x50565955 +#define IMGFMT_YUVP 0x50565559 // 10-bit YUYV +#define IMGFMT_UYVP 0x50565955 // 10-bit UYVY /* Compressed Formats */ #define IMGFMT_MPEGPES (('M'<<24)|('P'<<16)|('E'<<8)|('S')) -- cgit v1.2.3 From cedee1dc725f74752b7acd8224b5a05a4f306992 Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 21 Jun 2011 19:34:00 +0000 Subject: options: allow colorspace options to recognize "yvyu" git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33693 b3059339-0415-0410-9bf9-f77b7e298cf2 --- m_option.c | 1 + 1 file changed, 1 insertion(+) diff --git a/m_option.c b/m_option.c index efdba636b1..18fe2f7bdb 100644 --- a/m_option.c +++ b/m_option.c @@ -1182,6 +1182,7 @@ static struct { {"411p", IMGFMT_411P}, {"440p", IMGFMT_440P}, {"yuy2", IMGFMT_YUY2}, + {"yvyu", IMGFMT_YVYU}, {"uyvy", IMGFMT_UYVY}, {"yvu9", IMGFMT_YVU9}, {"if09", IMGFMT_IF09}, -- cgit v1.2.3 From 950003b0c376a4e5444f0449f719a19125725296 Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 21 Jun 2011 19:44:24 +0000 Subject: vo_gl: fix YUY2/YVYU colorspace mixup Second GL_YCBCR_MESA format is YVYU, not YUY2. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33694 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 4 +++- libvo/vo_gl.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libvo/gl_common.c b/libvo/gl_common.c index cee413d3b3..eb12d79a74 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -297,7 +297,9 @@ int glFindFormat(uint32_t fmt, int *bpp, GLint *gl_texfmt, *gl_type = GL_UNSIGNED_BYTE; break; case IMGFMT_UYVY: - case IMGFMT_YUY2: + // IMGFMT_YUY2 would be more logical for the _REV format, + // but gives clearly swapped colors. + case IMGFMT_YVYU: *gl_texfmt = GL_YCBCR_MESA; *bpp = 16; *gl_format = GL_YCBCR_MESA; diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index f23d44ba64..24a10a9d94 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1109,7 +1109,7 @@ query_format(uint32_t format) // ideally MPlayer should be fixed instead not to use Y800 when it has the choice if (!use_yuv && (format == IMGFMT_Y8 || format == IMGFMT_Y800)) return 0; - if (!use_ycbcr && (format == IMGFMT_UYVY || format == IMGFMT_YUY2)) + if (!use_ycbcr && (format == IMGFMT_UYVY || format == IMGFMT_YVYU)) return 0; if (many_fmts && glFindFormat(format, NULL, NULL, NULL, NULL)) -- cgit v1.2.3 From b327f6fcb6fbadfc608111deeeeb44477c6eb68f Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 21 Jun 2011 20:28:53 +0000 Subject: demux_lavf: Do not set AVIOContext for AVFMT_NOFILE formats Setting AVIOContext for AVFMT_NOFILE formats now triggers a warning from libavformat (and triggered an error for a while), so add a check to avoid setting AVIOContext when not necessary. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33695 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_lavf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 82ca90f9fc..0be7679cd2 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -595,11 +595,13 @@ static demuxer_t *demux_open_lavf(demuxer_t *demuxer) } else av_strlcat(mp_filename, "foobar.dummy", sizeof(mp_filename)); - priv->pb = av_alloc_put_byte(priv->buffer, BIO_BUFFER_SIZE, 0, - demuxer, mp_read, NULL, mp_seek); - priv->pb->read_seek = mp_read_seek; - priv->pb->is_streamed = !demuxer->stream->end_pos || - (demuxer->stream->flags & MP_STREAM_SEEK) != MP_STREAM_SEEK; + if (!(priv->avif->flags & AVFMT_NOFILE)) { + priv->pb = av_alloc_put_byte(priv->buffer, BIO_BUFFER_SIZE, 0, + demuxer, mp_read, NULL, mp_seek); + priv->pb->read_seek = mp_read_seek; + priv->pb->is_streamed = !demuxer->stream->end_pos || + (demuxer->stream->flags & MP_STREAM_SEEK) != MP_STREAM_SEEK; + } if (av_open_input_stream(&avfc, priv->pb, mp_filename, priv->avif, &ap) < 0) { -- cgit v1.2.3 From d32bf98070e71e45060c45ba96418bf40e584674 Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 22 Jun 2011 13:48:31 +0000 Subject: cleanup: tvi_dshow: add "static", fix printf format tvi_dshow: Mark functions not used outside of the file as static. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33706 b3059339-0415-0410-9bf9-f77b7e298cf2 tvi_dshow: Adjust mp_msg printf conversion specifier to avoid warnings stream/tvi_dshow.c:2807: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int' stream/tvi_dshow.c:2821: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33710 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/tvi_dshow.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c index 3b4535ac8c..3e17d9cb99 100644 --- a/stream/tvi_dshow.c +++ b/stream/tvi_dshow.c @@ -505,7 +505,9 @@ static DEFINE_GUID(MEDIATYPE_VBI, 0xf72a76e1, 0xeb0a, 0x11d0, 0xac, 0xe4, 0x00 * Methods, called only from this file *---------------------------------------------------------------------------------------*/ -void set_buffer_preference(int nDiv,WAVEFORMATEX* pWF,IPin* pOutPin,IPin* pInPin){ +static void set_buffer_preference(int nDiv, WAVEFORMATEX *pWF, + IPin *pOutPin, IPin *pInPin) +{ ALLOCATOR_PROPERTIES prop; IAMBufferNegotiation* pBN; HRESULT hr; @@ -594,9 +596,10 @@ static long STDCALL CSampleGrabberCB_Release(ISampleGrabberCB * This) } -HRESULT STDCALL CSampleGrabberCB_BufferCB(ISampleGrabberCB * This, - double SampleTime, - BYTE * pBuffer, long lBufferLen) +static HRESULT STDCALL CSampleGrabberCB_BufferCB(ISampleGrabberCB *This, + double SampleTime, + BYTE *pBuffer, + long lBufferLen) { CSampleGrabberCB *this = (CSampleGrabberCB *) This; grabber_ringbuffer_t *rb = this->pbuf; @@ -628,9 +631,9 @@ HRESULT STDCALL CSampleGrabberCB_BufferCB(ISampleGrabberCB * This, } /// wrapper. directshow does the same when BufferCB callback is requested -HRESULT STDCALL CSampleGrabberCB_SampleCB(ISampleGrabberCB * This, - double SampleTime, - LPMEDIASAMPLE pSample) +static HRESULT STDCALL CSampleGrabberCB_SampleCB(ISampleGrabberCB *This, + double SampleTime, + LPMEDIASAMPLE pSample) { char* buf; long len; @@ -2800,7 +2803,9 @@ static int init(priv_t * priv) hr = init_chain_common(priv->pBuilder, priv->chains[1]); if(FAILED(hr)) { - mp_msg(MSGT_TV, MSGL_V, "tvi_dshow: Unable to initialize audio chain (Error:0x%x). Audio disabled\n", (unsigned long)hr); + mp_msg(MSGT_TV, MSGL_V, + "tvi_dshow: Unable to initialize audio chain (Error:0x%lx). Audio disabled\n", + (unsigned long)hr); priv->chains[1]->arpmt=calloc(1, sizeof(AM_MEDIA_TYPE*)); priv->chains[1]->arStreamCaps=calloc(1, sizeof(void*)); } @@ -2814,7 +2819,9 @@ static int init(priv_t * priv) hr = init_chain_common(priv->pBuilder, priv->chains[2]); if(FAILED(hr)) { - mp_msg(MSGT_TV, MSGL_V, "tvi_dshow: Unable to initialize VBI chain (Error:0x%x). Teletext disabled\n", (unsigned long)hr); + mp_msg(MSGT_TV, MSGL_V, + "tvi_dshow: Unable to initialize VBI chain (Error:0x%lx). Teletext disabled\n", + (unsigned long)hr); priv->chains[2]->arpmt=calloc(1, sizeof(AM_MEDIA_TYPE*)); priv->chains[2]->arStreamCaps=calloc(1, sizeof(void*)); } -- cgit v1.2.3 From 8efc898f7838fc9af355869d0a6557245799d4a2 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 22 Jun 2011 19:12:23 +0000 Subject: cpudetect.c: check OS SSE support only with runtime detection Run OS support for SSE check only for runtime CPU detection. It is pointless to run it otherwise and it causes issues on OSes where we have not implemented a way to check. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33713 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cpudetect.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cpudetect.c b/cpudetect.c index 343d2ac25b..160ec955ea 100644 --- a/cpudetect.c +++ b/cpudetect.c @@ -52,6 +52,7 @@ CpuCaps gCpuCaps; * team for SSE support detection and more cpu detect code. */ +#if CONFIG_RUNTIME_CPUDETECT /* I believe this code works. However, it has only been used on a PII and PIII */ #if defined(__linux__) && defined(_POSIX_SOURCE) && !ARCH_X86_64 @@ -221,6 +222,7 @@ static void check_os_katmai_support( void ) gCpuCaps.hasSSE=0; #endif /* __linux__ */ } +#endif // return TRUE if cpuid supported @@ -352,6 +354,7 @@ void GetCpuCaps( CpuCaps *caps) gCpuCaps.has3DNowExt); #endif +#if CONFIG_RUNTIME_CPUDETECT /* FIXME: Does SSE2 need more OS support, too? */ if (caps->hasSSE) check_os_katmai_support(); @@ -361,7 +364,7 @@ void GetCpuCaps( CpuCaps *caps) // caps->hasMMX2 = 0; // caps->hasMMX = 0; -#if !CONFIG_RUNTIME_CPUDETECT +#else #if !HAVE_MMX if(caps->hasMMX) mp_msg(MSGT_CPUDETECT,MSGL_WARN,"MMX supported but disabled\n"); caps->hasMMX=0; -- cgit v1.2.3 From bd4f430d6294f546dd7906671f44e1271bb058a1 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 23 Jun 2011 18:42:26 +0000 Subject: configure: fix mmxext detection with --disable-sse Fix "sse in cpuinfo implies mmxext" hack to still work when --disable-sse is used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33714 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 65e997baf7..5a096ccd20 100755 --- a/configure +++ b/configure @@ -1538,14 +1538,13 @@ if x86 ; then pparam=$(echo $exts | sed -e s/k6_mtrr/mtrr/ -e s/cyrix_arr/mtrr/ -e s/centaur_mcr/mtrr/ \ -e s/xmm/sse/ -e s/kni/sse/) + # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag. + pparam=$(echo $pparam | sed -e 's/sse/sse mmxext/') for ext in $pparam ; do eval test \"\$_$ext\" = auto 2>/dev/null && eval _$ext=kernel_check done - # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag. - test $_sse = kernel_check && _mmxext=kernel_check - echocheck "CPU vendor" echores "$pvendor ($pfamily:$pmodel:$pstepping)" -- cgit v1.2.3 From d67a3223b0b19e0648cb19f9fe1aceec518818d2 Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 25 Jun 2011 01:22:43 +0000 Subject: configure: fix check for clang compiler patch by Jeremy Huddleston, jeremyhu macports org git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33723 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure b/configure index 5a096ccd20..8d86901f2f 100755 --- a/configure +++ b/configure @@ -1427,8 +1427,7 @@ else echores "$cc_version" break fi - cc_name_tmp=$($_cc -v 2>&1 | head -n 1 | cut -d ' ' -f 1) - if test "$cc_name_tmp" = "clang"; then + if $_cc -v 2>&1 | grep -q "clang"; then echocheck "$_cc version" cc_vendor=clang cc_version=$($_cc -dumpversion 2>&1) -- cgit v1.2.3 From 01e441dddc3cb9677819513b9ef32f502c58c2fd Mon Sep 17 00:00:00 2001 From: compn Date: Sun, 26 Jun 2011 03:12:31 +0000 Subject: codecs.conf: add vfw csmcodec for fourcc CSM0, map YV24 fourcc to raw444P codec git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33727 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/etc/codecs.conf b/etc/codecs.conf index 528950723f..b8b5f71108 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -2445,6 +2445,15 @@ videocodec bwmpeg dll "bw10.dll" ;requires vtaccess.dll out YV12,YUY2,I420 +videocodec csmscreen + info "csmscreen AVI lossless video codec" + comment "requires Esdll.dll" + status working + fourcc CSM0 + driver vfw + dll "csmx.dll" ; b6cfb690fe5997da0f07506c8982334f *CSMX.dll + out BGR32,BGR24,BGR16 flip + videocodec matchware info "matchware screen capture codec" status working @@ -3278,6 +3287,7 @@ videocodec raw444P format 0x0 0x50343434 format 0x20776172 0x50343434 fourcc 444p,444P + fourcc YV24 444P out 444P videocodec raw422P @@ -3403,6 +3413,7 @@ videocodec ffraw444P format 0x0 format 0x20776172 fourcc 444p,444P + fourcc YV24 driver ffmpeg dll rawvideo -- cgit v1.2.3 From 860e66818b6f93d80f0e61763de21892c8596dc0 Mon Sep 17 00:00:00 2001 From: iive Date: Sun, 26 Jun 2011 14:42:35 +0000 Subject: stream/tvi_v4l[2]: fix calculation of free RAM for buffers Do a proper calculation of free RAM to be used as V4L buffers. The code uses sysinfo to query the available RAM, however it used ancient form available in some early development 2.3.x kernels. Newer form reports the size in memory units (usually same as page size), as result the code would fall back on 2 buffers even on multi GB system. The commit does: Improve the check in configure to ensure that we do use sysinfo struct with present mem_unit. Use free RAM instead of total RAM (to avoid swapping). Tweak memory constants and simplify code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33732 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 2 +- stream/tvi_v4l.c | 13 +++++-------- stream/tvi_v4l2.c | 13 +++++-------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 8d86901f2f..59b9f6d9e0 100755 --- a/configure +++ b/configure @@ -3551,7 +3551,7 @@ fi #if sunos echocheck "sys/sysinfo.h" _sys_sysinfo=no -statement_check sys/sysinfo.h 'struct sysinfo s_info; sysinfo(&s_info)' && _sys_sysinfo=yes +statement_check sys/sysinfo.h 'struct sysinfo s_info; s_info.mem_unit=0; sysinfo(&s_info)' && _sys_sysinfo=yes if test "$_sys_sysinfo" = yes ; then def_sys_sysinfo_h='#define HAVE_SYS_SYSINFO_H 1' else diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c index bbf290eeaf..31f767850b 100644 --- a/stream/tvi_v4l.c +++ b/stream/tvi_v4l.c @@ -760,7 +760,8 @@ static int uninit(priv_t *priv) static int get_capture_buffer_size(priv_t *priv) { - int bufsize, cnt; + uint64_t bufsize; + int cnt; if (priv->tv_param->buffer_size >= 0) { bufsize = priv->tv_param->buffer_size*1024*1024; @@ -769,14 +770,10 @@ static int get_capture_buffer_size(priv_t *priv) struct sysinfo si; sysinfo(&si); - if (si.totalram<2*1024*1024) { - bufsize = 1024*1024; - } else { - bufsize = si.totalram/2; - } -#else - bufsize = 16*1024*1024; + bufsize = (si.freeram/2)*si.mem_unit; + if (bufsize < 16*1024*1024) #endif + bufsize = 16*1024*1024; } cnt = bufsize/(priv->height*priv->bytesperline); diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c index 234a5ac019..a3be9e799a 100644 --- a/stream/tvi_v4l2.c +++ b/stream/tvi_v4l2.c @@ -1376,7 +1376,8 @@ static int init(priv_t *priv) static int get_capture_buffer_size(priv_t *priv) { - int bufsize, cnt; + uint64_t bufsize; + int cnt; if (priv->tv_param->buffer_size >= 0) { bufsize = priv->tv_param->buffer_size*1024*1024; @@ -1385,14 +1386,10 @@ static int get_capture_buffer_size(priv_t *priv) struct sysinfo si; sysinfo(&si); - if (si.totalram<2*1024*1024) { - bufsize = 1024*1024; - } else { - bufsize = si.totalram/2; - } -#else - bufsize = 16*1024*1024; + bufsize = (si.freeram/2)*si.mem_unit; + if ( bufsize < 16*1024*1024) #endif + bufsize = 16*1024*1024; } cnt = bufsize/priv->format.fmt.pix.sizeimage; -- cgit v1.2.3 From d68a606fd67de4b9342a72194de6440f998881ed Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 28 Jun 2011 17:01:24 +0000 Subject: loader/module.c: Fix compilation with --disable-qtx git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33756 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/module.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/loader/module.c b/loader/module.c index 6182d4b190..78d46d5c15 100644 --- a/loader/module.c +++ b/loader/module.c @@ -8,17 +8,17 @@ * */ -// define for quicktime calls debugging and/or MacOS-level emulation: -#ifndef __APPLE__ -#define EMU_QTX_API -#endif /* __APPLE__ */ - // define for quicktime debugging (verbose logging): //#define DEBUG_QTX_API #include "config.h" #include "debug.h" +// define for quicktime calls debugging and/or MacOS-level emulation: +#if !defined(__APPLE__) && defined(CONFIG_QTX_CODECS) +#define EMU_QTX_API +#endif /* __APPLE__ */ + #include #include #include -- cgit v1.2.3 From 4e89bae12c2ea4aef6016655eb06856138f284f4 Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 28 Jun 2011 23:44:58 +0000 Subject: cleanup: demux_vqf: typo/wording fixes git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33762 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_vqf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmpdemux/demux_vqf.c b/libmpdemux/demux_vqf.c index 94d7cf4096..8a3cff66b7 100644 --- a/libmpdemux/demux_vqf.c +++ b/libmpdemux/demux_vqf.c @@ -157,7 +157,7 @@ static demuxer_t* demux_open_vqf(demuxer_t* demuxer) { if(sid==mmioFOURCC('E','N','C','D')) demux_info_add(demuxer,"Encoder",sdata); else mp_msg(MSGT_DEMUX, MSGL_V, "Unhandled subchunk '%c%c%c%c'='%s'\n",((char *)&sid)[0],((char *)&sid)[1],((char *)&sid)[2],((char *)&sid)[3],sdata); - /* other stuff is unrecognized due untranslatable japan's idiomatics */ + /* rest not recognized due to untranslatable Japanese expressions */ } } else @@ -229,7 +229,7 @@ const demuxer_desc_t demuxer_desc_vqf = { "vqf", "VQF", "Nick Kurshev", - "ported frm MPlayerXP", + "ported from MPlayerXP", DEMUXER_TYPE_VQF, 1, // safe autodetect demux_probe_vqf, -- cgit v1.2.3 From a10af8d041a5305dc50fb91a2fdda2d14d5dc77f Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 30 Jun 2011 11:58:49 +0000 Subject: configure: Remove obsolete test for ARM pld instruction git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33786 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/configure b/configure index 59b9f6d9e0..c2fbb47fe5 100755 --- a/configure +++ b/configure @@ -2557,11 +2557,6 @@ echores "$xform_asm" fi if arm ; then - echocheck "ARM pld instruction" - pld=no - inline_asm_check '"pld [r0]"' && pld=yes - echores "$pld" - echocheck "ARMv5TE (Enhanced DSP Extensions)" if test $_armv5te = "auto" ; then _armv5te=no @@ -2607,7 +2602,7 @@ if arm ; then echores "$_iwmmxt" fi -cpuexts_all='ALTIVEC MMX MMX2 AMD3DNOW AMD3DNOWEXT SSE SSE2 SSSE3 FAST_CMOV CMOV FAST_CLZ PLD ARMV5TE ARMV6 ARMV6T2 ARMVFP NEON IWMMXT MMI VIS MVI' +cpuexts_all='ALTIVEC MMX MMX2 AMD3DNOW AMD3DNOWEXT SSE SSE2 SSSE3 FAST_CMOV CMOV FAST_CLZ ARMV5TE ARMV6 ARMV6T2 ARMVFP NEON IWMMXT MMI VIS MVI' test "$_altivec" = yes && cpuexts="ALTIVEC $cpuexts" test "$_mmx" = yes && cpuexts="MMX $cpuexts" test "$_mmxext" = yes && cpuexts="MMX2 $cpuexts" @@ -2619,7 +2614,6 @@ test "$_ssse3" = yes && cpuexts="SSSE3 $cpuexts" test "$_cmov" = yes && cpuexts="CMOV $cpuexts" test "$_fast_cmov" = yes && cpuexts="FAST_CMOV $cpuexts" test "$_fast_clz" = yes && cpuexts="FAST_CLZ $cpuexts" -test "$pld" = yes && cpuexts="PLD $cpuexts" test "$_armv5te" = yes && cpuexts="ARMV5TE $cpuexts" test "$_armv6" = yes && cpuexts="ARMV6 $cpuexts" test "$_armv6t2" = yes && cpuexts="ARMV6T2 $cpuexts" -- cgit v1.2.3 From 78f6ca1a2ce22fc0279d57749d893c63b08d4e49 Mon Sep 17 00:00:00 2001 From: compn Date: Fri, 1 Jul 2011 01:24:03 +0000 Subject: codecs.conf: add yv16 raw fourcc samples at https://ffmpeg.org/trac/ffmpeg/ticket/307 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33787 b3059339-0415-0410-9bf9-f77b7e298cf2 --- etc/codecs.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/codecs.conf b/etc/codecs.conf index b8b5f71108..e4c2e56bc6 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -3299,6 +3299,7 @@ videocodec raw422P fourcc 422p,422P fourcc P422 422P fourcc Y42B 422P + fourcc YV16 422P out 422P videocodec rawyv12 @@ -3425,6 +3426,7 @@ videocodec ffraw422P fourcc 422p,422P fourcc P422,p422 fourcc Y42B,y42b + fourcc YV16,yv16 driver ffmpeg dll rawvideo -- cgit v1.2.3 From ae31369a50169c43098070da6d652d095c460398 Mon Sep 17 00:00:00 2001 From: ptt Date: Fri, 1 Jul 2011 15:17:53 +0000 Subject: manpage: improve vo_gl "stereo" suboption description Correct suboption stereo descriptions, and reformat to be compliant with other sections. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33788 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index bc56d6162a..bbbea0e7c2 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3850,21 +3850,22 @@ Do not do any conversion. Select the scaling function to use for luminance scaling. Only valid for yuv modes 2, 3, 4 and 6. .RSss -0: Use simple linear filtering (default). -.br -1: Use bicubic B-spline filtering (better quality). +.IPs 0 +Use simple linear filtering (default). +.IPs 1 +Use bicubic B-spline filtering (better quality). Needs one additional texture unit. Older cards will not be able to handle this for chroma at least in fullscreen mode. -.br -2: Use cubic filtering in horizontal, linear filtering in vertical direction. +.IPs 2 +Use cubic filtering in horizontal, linear filtering in vertical direction. Works on a few more cards than method 1. -.br -3: Same as 1 but does not use a lookup texture. +.IPs 3 +Same as 1 but does not use a lookup texture. Might be faster on some cards. -.br -4: Use experimental unsharp masking with 3x3 support and a default strength of 0.5 (see filter-strength). -.br -5: Use experimental unsharp masking with 5x5 support and a default strength of 0.5 (see filter-strength). +.IPs 4 +Use experimental unsharp masking with 3x3 support and a default strength of 0.5 (see filter-strength). +.IPs 5 +Use experimental unsharp masking with 5x5 support and a default strength of 0.5 (see filter-strength). .RE .IPs cscale= Select the scaling function to use for chrominance scaling. @@ -3873,16 +3874,17 @@ For details see lscale. Set the effect strength for the lscale/cscale filters that support it. .IPs stereo= Select a method for stereo display. -You may have to use -aspect to fix the aspect value. +You may have to use \-aspect to fix the aspect value. Experimental, do not expect too much from it. .RSss -0: Normal 2D display -.br -1: left-right split input to full-color red-cyan stereo. -.br -2: left-right split input to full-color red-cyan stereo. -.br -3: left-right split input to quadbuffered stereo. +.IPs 0 +normal 2D display +.IPs 1 +Convert side by side input to full-color red-cyan stereo. +.IPs 2 +Convert side by side input to full-color green-magenta stereo. +.IPs 3 +Convert side by side input to quadbuffered stereo. Only supported by very few OpenGL cards. .RE .RE -- cgit v1.2.3 From 684e54587e78d09426fcd9680ca4eb5eb2672d69 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 1 Jul 2011 20:54:57 +0000 Subject: demux_rtp.cpp: Add a hack to receive audio while probing video FPS Otherwise newer live555 versions would just hang. Fixes http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1874 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33793 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_rtp.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/libmpdemux/demux_rtp.cpp b/libmpdemux/demux_rtp.cpp index e93616d07f..c9c950de8a 100644 --- a/libmpdemux/demux_rtp.cpp +++ b/libmpdemux/demux_rtp.cpp @@ -498,11 +498,32 @@ static demux_packet_t* getBuffer(demuxer_t* demuxer, demux_stream_t* ds, RTPState* rtpState = (RTPState*)(demuxer->priv); ReadBufferQueue* bufferQueue = NULL; int headersize = 0; - TaskToken task; + int waitboth = 0; + TaskToken task, task2; if (demuxer->stream->eof) return NULL; if (ds == demuxer->video) { + bufferQueue = rtpState->audioBufferQueue; + // HACK: for the latest versions we must also receive audio + // when probing for video FPS, otherwise the stream just hangs + // and times out + if (mustGetNewData && + bufferQueue && + bufferQueue->readSource() && + !bufferQueue->nextpacket) { + headersize = bufferQueue->readSource()->isAMRAudioSource() ? 1 : 0; + demux_packet_t *dp = new_demux_packet(MAX_RTP_FRAME_SIZE); + bufferQueue->dp = dp; + bufferQueue->blockingFlag = 0; + bufferQueue->readSource()->getNextFrame( + &dp->buffer[headersize], MAX_RTP_FRAME_SIZE - headersize, + afterReading, bufferQueue, + onSourceClosure, bufferQueue); + task2 = bufferQueue->readSource()->envir().taskScheduler(). + scheduleDelayedTask(10000000, onSourceClosure, bufferQueue); + waitboth = 1; + } bufferQueue = rtpState->videoBufferQueue; if (((sh_video_t*)ds->sh)->format == mmioFOURCC('H','2','6','4')) headersize = 3; @@ -560,6 +581,10 @@ static demux_packet_t* getBuffer(demuxer_t* demuxer, demux_stream_t* ds, task = scheduler.scheduleDelayedTask(delay, onSourceClosure, bufferQueue); scheduler.doEventLoop(&bufferQueue->blockingFlag); scheduler.unscheduleDelayedTask(task); + if (waitboth) { + scheduler.doEventLoop(&rtpState->audioBufferQueue->blockingFlag); + scheduler.unscheduleDelayedTask(task2); + } if (demuxer->stream->eof) { free_demux_packet(dp); return NULL; -- cgit v1.2.3 From 06d830687d5c57f7d5016ae4d0fccaa7b6780bad Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 2 Jul 2011 22:59:40 +0000 Subject: cleanup: silence some clang warnings Cosmetics: vo_mpegpes.c: Fix strange space placement Avoids clang warning that =- might have been intended as -=. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33797 b3059339-0415-0410-9bf9-f77b7e298cf2 vo_jpeg: Use "const char *" type for paths. Fixes a clang warning due to sign mismatch when calling open(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33799 b3059339-0415-0410-9bf9-f77b7e298cf2 mga_template.c: Remove pointless and in addition incorrect cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33800 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/mga_template.c | 2 +- libvo/vo_jpeg.c | 4 ++-- libvo/vo_mpegpes.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libvo/mga_template.c b/libvo/mga_template.c index bd71694326..6886ecd8f7 100644 --- a/libvo/mga_template.c +++ b/libvo/mga_template.c @@ -438,7 +438,7 @@ static int mga_init(int width,int height,unsigned int format){ mp_msg(MSGT_VO,MSGL_V,"[MGA] Using %d buffers.\n",mga_vid_config.num_frames); - frames[0] = (char*)mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,f,0); + frames[0] = mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,f,0); frames[1] = frames[0] + 1*mga_vid_config.frame_size; frames[2] = frames[0] + 2*mga_vid_config.frame_size; frames[3] = frames[0] + 3*mga_vid_config.frame_size; diff --git a/libvo/vo_jpeg.c b/libvo/vo_jpeg.c index cafaf1f2d4..15f29a293a 100644 --- a/libvo/vo_jpeg.c +++ b/libvo/vo_jpeg.c @@ -104,7 +104,7 @@ static int framenum = 0; * returns, everything went well. */ -static void jpeg_mkdir(char *buf, int verbose) { +static void jpeg_mkdir(const char *buf, int verbose) { struct stat stat_p; #ifndef __MINGW32__ @@ -176,7 +176,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, /* ------------------------------------------------------------------------- */ -static uint32_t jpeg_write(uint8_t * name, uint8_t * buffer) +static uint32_t jpeg_write(const char * name, uint8_t * buffer) { FILE *outfile; struct jpeg_compress_struct cinfo; diff --git a/libvo/vo_mpegpes.c b/libvo/vo_mpegpes.c index dc63579519..cae6278e8f 100644 --- a/libvo/vo_mpegpes.c +++ b/libvo/vo_mpegpes.c @@ -232,7 +232,7 @@ static void uninit(void) { if(ao_mpegpes_fd >= 0 && ao_mpegpes_fd != vo_mpegpes_fd) close(ao_mpegpes_fd); - ao_mpegpes_fd =- 1; + ao_mpegpes_fd = -1; if(vo_mpegpes_fd>=0){ close(vo_mpegpes_fd);vo_mpegpes_fd=-1;} } -- cgit v1.2.3 From 61fe3dcd6c87b96f02c5c0924b4124bc7a165d34 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 3 Jul 2011 09:45:29 +0000 Subject: cache: don't modify argument when stream control fails When handling STREAM_CTRL calls for the cached stream, do not modify the return parameter if the underlying stream returns an error for the operation. Avoids issues with some places that don't check the return value of stream_control. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33802 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove condition that is now always true. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33803 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stream/cache2.c b/stream/cache2.c index b643ed8897..6e8f398c37 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -615,6 +615,8 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { return STREAM_UNSUPPORTED; } } + if (s->control_res != STREAM_OK) + return s->control_res; switch (cmd) { case STREAM_CTRL_GET_TIME_LENGTH: case STREAM_CTRL_GET_CURRENT_TIME: @@ -630,8 +632,7 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { case STREAM_CTRL_SEEK_TO_CHAPTER: case STREAM_CTRL_SEEK_TO_TIME: case STREAM_CTRL_SET_ANGLE: - if (s->control_res != STREAM_UNSUPPORTED) - stream->pos = s->read_filepos = s->control_new_pos; + stream->pos = s->read_filepos = s->control_new_pos; break; } return s->control_res; -- cgit v1.2.3 From c89f72b561a83c11d1abb171b1a9d17bc51c3b42 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 4 Jul 2011 19:10:17 +0000 Subject: stream/network: distinguish EOF/error in streaming control API Signal EOF vs. error also via streaming control API (not yet evaluated). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33806 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/network.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stream/network.c b/stream/network.c index b722023061..f6956e46da 100644 --- a/stream/network.c +++ b/stream/network.c @@ -467,7 +467,8 @@ nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctr ret = recv( fd, buffer+len, size-len, 0 ); if( ret<0 ) { mp_msg(MSGT_NETWORK,MSGL_ERR,"nop_streaming_read error : %s\n",strerror(errno)); - } + } else if (ret == 0) + stream_ctrl->status = streaming_stopped_e; len += ret; //printf("read %d bytes from network\n", len ); } -- cgit v1.2.3 From 93e206e0626c1c5827ec738e7a0dbe0538b64545 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 4 Jul 2011 19:11:21 +0000 Subject: stream/network: don't clobber buffer byte counts on error Ensure we do not add strange values to amount of buffered bytes read on error. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33807 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/network.c | 1 + 1 file changed, 1 insertion(+) diff --git a/stream/network.c b/stream/network.c index f6956e46da..ce04444144 100644 --- a/stream/network.c +++ b/stream/network.c @@ -467,6 +467,7 @@ nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctr ret = recv( fd, buffer+len, size-len, 0 ); if( ret<0 ) { mp_msg(MSGT_NETWORK,MSGL_ERR,"nop_streaming_read error : %s\n",strerror(errno)); + ret = 0; } else if (ret == 0) stream_ctrl->status = streaming_stopped_e; len += ret; -- cgit v1.2.3 From 2e2f77e346962dd2384d505ad297c07ecaadc83b Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 4 Jul 2011 19:14:06 +0000 Subject: stream.c: Pass streaming_ctrl eof on to struct stream field Fixes a possible endless loop with HTTP files where seeking to the very end returns the full file again instead of e.g. an error. Apache/2.2.4 seems to show this behaviour. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33808 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stream/stream.c b/stream/stream.c index 4b55072561..a18739eb8c 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -287,6 +287,8 @@ int stream_read_internal(stream_t *s, void *buf, int len) #ifdef CONFIG_NETWORKING if( s->streaming_ctrl!=NULL && s->streaming_ctrl->streaming_read ) { len=s->streaming_ctrl->streaming_read(s->fd, buf, len, s->streaming_ctrl); + if (s->streaming_ctrl->status == streaming_stopped_e) + s->eof = 1; } else #endif if (s->fill_buffer) -- cgit v1.2.3 From a7b99687a7c8b59abb67f725c1cbc648ab439c74 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 4 Jul 2011 19:21:59 +0000 Subject: stream.c: make reconnect checks more robust Improve checks for when to try reconnecting to be more thorough and readable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33809 b3059339-0415-0410-9bf9-f77b7e298cf2 Reindent, add empty lines. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33810 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/stream/stream.c b/stream/stream.c index a18739eb8c..26bbb7a55a 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -305,22 +305,29 @@ int stream_read_internal(stream_t *s, void *buf, int len) len= s->fill_buffer ? s->fill_buffer(s, buf, len) : 0; } if(len<=0){ + off_t pos = s->pos; + // do not retry if this looks like proper eof + if (s->eof || (s->end_pos && pos == s->end_pos)) + goto eof_out; // dvdnav has some horrible hacks to "suspend" reads, // we need to skip this code or seeks will hang. - if (!s->eof && s->type != STREAMTYPE_DVDNAV) { - // just in case this is an error e.g. due to network - // timeout reset and retry - // Seeking is used as a hack to make network streams - // reopen the connection, ideally they would implement - // e.g. a STREAM_CTRL_RECONNECT to do this - off_t pos = s->pos; - s->eof=1; - stream_reset(s); - stream_seek_internal(s, pos); - // make sure EOF is set to ensure no endless loops - s->eof=1; - return stream_read_internal(s, buf, orig_len); - } + if (s->type == STREAMTYPE_DVDNAV) + goto eof_out; + + // just in case this is an error e.g. due to network + // timeout reset and retry + // Seeking is used as a hack to make network streams + // reopen the connection, ideally they would implement + // e.g. a STREAM_CTRL_RECONNECT to do this + s->eof=1; + stream_reset(s); + if (stream_seek_internal(s, pos) >= 0 || s->pos != pos) // seek failed + goto eof_out; + // make sure EOF is set to ensure no endless loops + s->eof=1; + return stream_read_internal(s, buf, orig_len); + +eof_out: s->eof=1; return 0; } -- cgit v1.2.3