diff options
-rw-r--r-- | asxparser.c | 47 | ||||
-rw-r--r-- | cpuinfo.c | 6 | ||||
-rw-r--r-- | input/input.c | 2 | ||||
-rw-r--r-- | input/lirc.c | 1 | ||||
-rw-r--r-- | libmpcodecs/ae_toolame.c | 2 | ||||
-rw-r--r-- | libmpcodecs/ae_twolame.c | 2 | ||||
-rw-r--r-- | libmpcodecs/ve_x264.c | 7 | ||||
-rw-r--r-- | libmpcodecs/vf_remove_logo.c | 109 | ||||
-rw-r--r-- | libmpdemux/demux_rtp.h | 6 | ||||
-rw-r--r-- | libmpdemux/demux_rtp_internal.h | 5 | ||||
-rw-r--r-- | libmpdemux/demuxer.h | 8 | ||||
-rw-r--r-- | libmpdemux/mp3_hdr.c | 12 | ||||
-rw-r--r-- | libvo/video_out.c | 6 | ||||
-rw-r--r-- | libvo/vo_gl.c | 60 | ||||
-rw-r--r-- | libvo/vo_gl2.c | 21 | ||||
-rw-r--r-- | libvo/x11_common.c | 1 | ||||
-rw-r--r-- | mencoder.c | 6 | ||||
-rw-r--r-- | osdep/getch2-win.c | 37 | ||||
-rw-r--r-- | osdep/osdep.h | 33 | ||||
-rw-r--r-- | playtree.c | 14 | ||||
-rw-r--r-- | playtreeparser.c | 23 | ||||
-rw-r--r-- | stream/cache2.c | 20 | ||||
-rw-r--r-- | stream/cdd.h | 2 | ||||
-rw-r--r-- | stream/freesdp/parser.c | 60 | ||||
-rw-r--r-- | stream/network.c | 7 | ||||
-rw-r--r-- | stream/stream.c | 26 | ||||
-rw-r--r-- | stream/stream.h | 25 | ||||
-rw-r--r-- | stream/stream_cddb.c | 74 | ||||
-rw-r--r-- | stream/stream_tv.c | 2 | ||||
-rw-r--r-- | stream/stream_vcd.c | 2 | ||||
-rw-r--r-- | subreader.c | 6 | ||||
-rw-r--r-- | vidix/vidix.c | 5 |
32 files changed, 345 insertions, 292 deletions
diff --git a/asxparser.c b/asxparser.c index 1cb576b713..2d4677629d 100644 --- a/asxparser.c +++ b/asxparser.c @@ -34,53 +34,6 @@ ////// List utils -static void -asx_list_add(void* list_ptr,void* entry){ - void** list = *(void***)list_ptr; - int c = 0; - - if(list != NULL) - for( ; list[c] != NULL; c++) ; - - list = realloc(list, sizeof(void*) * (c + 2)); - - list[c] = entry; - list[c+1] = NULL; - - *(void***)list_ptr = list; -} - - -static void -asx_list_remove(void* list_ptr,void* entry,ASX_FreeFunc free_func) { - void** list = *(void***)list_ptr; - int c,e = -1; - - if(list == NULL) return; - - for(c = 0 ; list[c] != NULL; c++){ - if(list[c] == entry) e = c; - } - - if(e == -1) return; // Not found - - if(free_func != NULL) free_func(list[e]); - - if(c == 1) { // Only one entry, we drop all - free(list); - *(void**)list_ptr = NULL; - return; - } - - if(c > e) // If c==e the memmove is not needed - memmove(list+e,list+e+1,(c-e)*sizeof(void*)); - - list = realloc(list, (c - 1) * sizeof(void*)); - list[c-1] = NULL; - - *(void***)list_ptr = list; -} - void asx_list_free(void* list_ptr,ASX_FreeFunc free_func) { void** ptr = *(void***)list_ptr; @@ -77,10 +77,10 @@ cpuid(int func) { static int64_t rdtsc(void) { - uint64_t i; + uint32_t hi, lo; #define RDTSC ".byte 0x0f, 0x31; " - __asm__ volatile (RDTSC : "=A"(i) : ); - return i; + __asm__ volatile (RDTSC : "=a"(lo), "=d"(hi) : ); + return (uint64_t) hi << 32 | lo; } static const char* diff --git a/input/input.c b/input/input.c index c5d93a5f17..6c5fef8b63 100644 --- a/input/input.c +++ b/input/input.c @@ -918,6 +918,8 @@ static int read_cmd(mp_input_fd_t* mp_fd, char** ret) int l = 0; // Find the cmd end mp_fd->buffer[mp_fd->pos] = '\0'; + end = strchr(mp_fd->buffer,'\r'); + if (end) *end = '\n'; end = strchr(mp_fd->buffer,'\n'); // No cmd end ? if(!end) { diff --git a/input/lirc.c b/input/lirc.c index 1e3708a3f4..7409ab698e 100644 --- a/input/lirc.c +++ b/input/lirc.c @@ -29,6 +29,7 @@ #include "mp_msg.h" #include "help_mp.h" #include "input.h" +#include "lirc.h" static struct lirc_config *lirc_config; char *lirc_configfile; diff --git a/libmpcodecs/ae_toolame.c b/libmpcodecs/ae_toolame.c index 2a0e9f7941..851fa845f9 100644 --- a/libmpcodecs/ae_toolame.c +++ b/libmpcodecs/ae_toolame.c @@ -121,7 +121,7 @@ static int encode_toolame(audio_encoder_t *encoder, uint8_t *dest, void *src, in return ret_size; } -int close_toolame(audio_encoder_t *encoder) +static int close_toolame(audio_encoder_t *encoder) { free(encoder->priv); return 1; diff --git a/libmpcodecs/ae_twolame.c b/libmpcodecs/ae_twolame.c index 7aa0398586..e15206dee6 100644 --- a/libmpcodecs/ae_twolame.c +++ b/libmpcodecs/ae_twolame.c @@ -113,7 +113,7 @@ static int encode_twolame(audio_encoder_t *encoder, uint8_t *dest, void *src, in return ret_size; } -int close_twolame(audio_encoder_t *encoder) +static int close_twolame(audio_encoder_t *encoder) { free(encoder->priv); return 1; diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c index 303acdb6fe..fc7ac6c1ff 100644 --- a/libmpcodecs/ve_x264.c +++ b/libmpcodecs/ve_x264.c @@ -258,12 +258,9 @@ static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in) return -1; } if(i_size>0) { - int keyframe = (pic_out.i_type == X264_TYPE_IDR) || - (pic_out.i_type == X264_TYPE_I - && param.i_frame_reference == 1 - && !param.i_bframe); + int keyframe = pic_out.b_keyframe; memcpy(mod->mux->buffer, nal->p_payload, i_size); - muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); + muxer_write_chunk(mod->mux, i_size, keyframe?AVIIF_KEYFRAME:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); } else ++mod->mux->encoder_delay; diff --git a/libmpcodecs/vf_remove_logo.c b/libmpcodecs/vf_remove_logo.c index 711606f922..07a05941ea 100644 --- a/libmpcodecs/vf_remove_logo.c +++ b/libmpcodecs/vf_remove_logo.c @@ -141,7 +141,7 @@ typedef struct * Variables stored here are kept from frame to frame, and separate instances of * the filter will get their own separate copies. */ -typedef struct +struct vf_priv_s { unsigned int fmt; /* Not exactly sure of the use for this. It came with the example filter I used as a basis for this, and it looks like a lot of stuff will break if I remove it. */ int max_mask_size; /* The largest possible mask size that will be needed with the given filter and corresponding half_size_filter. The half_size_filter can have a larger requirment in some rare (but not degenerate) cases. */ @@ -264,8 +264,8 @@ static void destroy_masks(vf_instance_t * vf) int a, b; /* Load values from the vf->priv struct for faster dereferencing. */ - int * * * mask = ((vf_priv_s *)vf->priv)->mask; - int max_mask_size = ((vf_priv_s *)vf->priv)->max_mask_size; + int * * * mask = vf->priv->mask; + int max_mask_size = vf->priv->max_mask_size; if (mask == NULL) return; /* Nothing allocated, so return before we segfault. */ @@ -282,7 +282,7 @@ static void destroy_masks(vf_instance_t * vf) free(mask); /* Free the array of pointers pointing to the masks. */ /* Set the pointer to NULL, so that any duplicate calls to this function will not cause a crash. */ - ((vf_priv_s *)vf->priv)->mask = NULL; + vf->priv->mask = NULL; return; } @@ -301,8 +301,8 @@ static void initialize_masks(vf_instance_t * vf) int a, b, c; /* Load values from the vf->priv struct for faster dereferencing. */ - int * * * mask = ((vf_priv_s *)vf->priv)->mask; - int max_mask_size = ((vf_priv_s *)vf->priv)->max_mask_size; /* This tells us how many masks we'll need to generate. */ + int * * * mask = vf->priv->mask; + int max_mask_size = vf->priv->max_mask_size; /* This tells us how many masks we'll need to generate. */ /* Create a circular mask for each size up to max_mask_size. When the filter is applied, the mask size is determined on a pixel by pixel basis, with pixels nearer the edge of the logo getting smaller mask sizes. */ @@ -324,7 +324,7 @@ static void initialize_masks(vf_instance_t * vf) } /* Store values back to vf->priv so they aren't lost after the function returns. */ - ((vf_priv_s *)vf->priv)->mask = mask; + vf->priv->mask = mask; return; } @@ -404,7 +404,7 @@ static void convert_mask_to_strength_mask(vf_instance_t * vf, pgm_structure * ma max_mask_size = current_pass + 1; /* As a side-effect, we now know the maximum mask size, which we'll use to generate our masks. */ max_mask_size = apply_mask_fudge_factor(max_mask_size); /* Apply the fudge factor to this number too, since we must ensure that enough masks are generated. */ - ((vf_priv_s *)vf->priv)->max_mask_size = max_mask_size; /* Commit the newly calculated max_mask_size to the vf->priv struct. */ + vf->priv->max_mask_size = max_mask_size; /* Commit the newly calculated max_mask_size to the vf->priv struct. */ return; } @@ -430,7 +430,7 @@ static void get_blur(const vf_instance_t * const vf, unsigned int * const value_ { int mask_size; /* Mask size tells how large a circle to use. The radius is about (slightly larger than) mask size. */ /* Get values from vf->priv for faster dereferencing. */ - int * * * mask = ((vf_priv_s *)vf->priv)->mask; + int * * * mask = vf->priv->mask; int start_posx, start_posy, end_posx, end_posy; int i, j; @@ -662,7 +662,7 @@ static pgm_structure * generate_half_size_image(vf_instance_t * vf, pgm_structur max_mask_size = current_pass + 1; /* As a side-effect, we now know the maximum mask size, which we'll use to generate our masks. */ max_mask_size = apply_mask_fudge_factor(max_mask_size); /* Commit the newly calculated max_mask_size to the vf->priv struct. */ - ((vf_priv_s *)vf->priv)->max_mask_size = max(max_mask_size, ((vf_priv_s *)vf->priv)->max_mask_size); + vf->priv->max_mask_size = max(max_mask_size, vf->priv->max_mask_size); return new_pgm; } @@ -685,10 +685,10 @@ static unsigned int find_best(struct vf_instance* vf){ */ static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) { - if(!(((vf_priv_s *)vf->priv)->fmt=find_best(vf))) + if(!(vf->priv->fmt=find_best(vf))) return 0; else - return vf_next_config(vf,width,height,d_width,d_height,flags,((vf_priv_s *)vf->priv)->fmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt); } /** @@ -767,15 +767,15 @@ static void convert_yv12(const vf_instance_t * const vf, const char * const sour static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; - dmpi=vf_get_image(vf->next,((vf_priv_s *)vf->priv)->fmt, + dmpi=vf_get_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h); /* Check to make sure that the filter image and the video stream are the same size. */ - if ((((vf_priv_s *)vf->priv)->filter->width != mpi->w) || (((vf_priv_s *)vf->priv)->filter->height != mpi->h)) + if (vf->priv->filter->width != mpi->w || vf->priv->filter->height != mpi->h) { mp_msg(MSGT_VFILTER,MSGL_ERR, "Filter image and video stream are not of the same size. (Filter: %d x %d, Stream: %d x %d)\n", - ((vf_priv_s *)vf->priv)->filter->width, ((vf_priv_s *)vf->priv)->filter->height, mpi->w, mpi->h); + vf->priv->filter->width, vf->priv->filter->height, mpi->w, mpi->h); return 0; } @@ -783,19 +783,19 @@ static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){ case IMGFMT_YV12: convert_yv12(vf, mpi->planes[0], mpi->stride[0], mpi, mpi->w, mpi->h, dmpi->planes[0], dmpi->stride[0], - mpi->flags & MP_IMGFLAG_DIRECT, ((vf_priv_s *)vf->priv)->filter, 0, - ((vf_priv_s *)vf->priv)->bounding_rectangle_posx1, ((vf_priv_s *)vf->priv)->bounding_rectangle_posy1, - ((vf_priv_s *)vf->priv)->bounding_rectangle_posx2, ((vf_priv_s *)vf->priv)->bounding_rectangle_posy2); + mpi->flags & MP_IMGFLAG_DIRECT, vf->priv->filter, 0, + vf->priv->bounding_rectangle_posx1, vf->priv->bounding_rectangle_posy1, + vf->priv->bounding_rectangle_posx2, vf->priv->bounding_rectangle_posy2); convert_yv12(vf, mpi->planes[1], mpi->stride[1], mpi, mpi->w / 2, mpi->h / 2, dmpi->planes[1], dmpi->stride[1], - mpi->flags & MP_IMGFLAG_DIRECT, ((vf_priv_s *)vf->priv)->half_size_filter, 1, - ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx1, ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy1, - ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx2, ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy2); + mpi->flags & MP_IMGFLAG_DIRECT, vf->priv->half_size_filter, 1, + vf->priv->bounding_rectangle_half_size_posx1, vf->priv->bounding_rectangle_half_size_posy1, + vf->priv->bounding_rectangle_half_size_posx2, vf->priv->bounding_rectangle_half_size_posy2); convert_yv12(vf, mpi->planes[2], mpi->stride[2], mpi, mpi->w / 2, mpi->h / 2, dmpi->planes[2], dmpi->stride[2], - mpi->flags & MP_IMGFLAG_DIRECT, ((vf_priv_s *)vf->priv)->half_size_filter, 2, - ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx1, ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy1, - ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx2, ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy2); + mpi->flags & MP_IMGFLAG_DIRECT, vf->priv->half_size_filter, 2, + vf->priv->bounding_rectangle_half_size_posx1, vf->priv->bounding_rectangle_half_size_posy1, + vf->priv->bounding_rectangle_half_size_posx2, vf->priv->bounding_rectangle_half_size_posy2); break; default: @@ -820,6 +820,24 @@ static int query_format(struct vf_instance * vf, unsigned int fmt) } /** + * \brief Frees memory that our filter allocated. + * + * This is called at exit-time. + */ +static void uninit(vf_instance_t *vf) +{ + /* Destroy our masks and images. */ + destroy_pgm(vf->priv->filter); + destroy_pgm(vf->priv->half_size_filter); + destroy_masks(vf); + + /* Destroy our private structure that had been used to store those masks and images. */ + free(vf->priv); + + return; +} + +/** * \brief Initializes our filter. * * \param args The arguments passed in from the command line go here. This @@ -831,10 +849,11 @@ static int query_format(struct vf_instance * vf, unsigned int fmt) static int vf_open(vf_instance_t *vf, char *args) { vf->priv = safe_malloc(sizeof(vf_priv_s)); + vf->uninit = uninit; /* Load our filter image. */ if (args) - ((vf_priv_s *)vf->priv)->filter = load_pgm(args); + vf->priv->filter = load_pgm(args); else { mp_msg(MSGT_VFILTER, MSGL_ERR, "[vf]remove_logo usage: remove_logo=/path/to/filter_image_file.pgm\n"); @@ -842,7 +861,7 @@ static int vf_open(vf_instance_t *vf, char *args) return 0; } - if (((vf_priv_s *)vf->priv)->filter == NULL) + if (vf->priv->filter == NULL) { /* Error message was displayed by load_pgm(). */ free(vf->priv); @@ -850,21 +869,21 @@ static int vf_open(vf_instance_t *vf, char *args) } /* Create the scaled down filter image for the chroma planes. */ - convert_mask_to_strength_mask(vf, ((vf_priv_s *)vf->priv)->filter); - ((vf_priv_s *)vf->priv)->half_size_filter = generate_half_size_image(vf, ((vf_priv_s *)vf->priv)->filter); + convert_mask_to_strength_mask(vf, vf->priv->filter); + vf->priv->half_size_filter = generate_half_size_image(vf, vf->priv->filter); /* Now that we know how many masks we need (the info is in vf), we can generate the masks. */ initialize_masks(vf); /* Calculate our bounding rectangles, which determine in what region the logo resides for faster processing. */ - calculate_bounding_rectangle(&((vf_priv_s *)vf->priv)->bounding_rectangle_posx1, &((vf_priv_s *)vf->priv)->bounding_rectangle_posy1, - &((vf_priv_s *)vf->priv)->bounding_rectangle_posx2, &((vf_priv_s *)vf->priv)->bounding_rectangle_posy2, - ((vf_priv_s *)vf->priv)->filter); - calculate_bounding_rectangle(&((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx1, - &((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy1, - &((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx2, - &((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy2, - ((vf_priv_s *)vf->priv)->half_size_filter); + calculate_bounding_rectangle(&vf->priv->bounding_rectangle_posx1, &vf->priv->bounding_rectangle_posy1, + &vf->priv->bounding_rectangle_posx2, &vf->priv->bounding_rectangle_posy2, + vf->priv->filter); + calculate_bounding_rectangle(&vf->priv->bounding_rectangle_half_size_posx1, + &vf->priv->bounding_rectangle_half_size_posy1, + &vf->priv->bounding_rectangle_half_size_posx2, + &vf->priv->bounding_rectangle_half_size_posy2, + vf->priv->half_size_filter); vf->config=config; vf->put_image=put_image; @@ -873,24 +892,6 @@ static int vf_open(vf_instance_t *vf, char *args) } /** - * \brief Frees memory that our filter allocated. - * - * This is called at exit-time. - */ -static void uninit(vf_instance_t * vf) -{ - /* Destroy our masks and images. */ - destroy_pgm(((vf_priv_s *)vf->priv)->filter); - destroy_pgm(((vf_priv_s *)vf->priv)->half_size_filter); - destroy_masks(vf); - - /* Destroy our private structure that had been used to store those masks and images. */ - free(vf->priv); - - return; -} - -/** * \brief Meta data about our filter. */ const vf_info_t vf_info_remove_logo = { diff --git a/libmpdemux/demux_rtp.h b/libmpdemux/demux_rtp.h index 0e2c665ae8..6d3462d856 100644 --- a/libmpdemux/demux_rtp.h +++ b/libmpdemux/demux_rtp.h @@ -21,13 +21,7 @@ #include <stdlib.h> #include <stdio.h> - -#ifndef STREAM_H -#include "stream/stream.h" -#endif -#ifndef DEMUXER_H #include "demuxer.h" -#endif // Open a RTP demuxer (which was initiated either from a SDP file, // or from a RTSP URL): diff --git a/libmpdemux/demux_rtp_internal.h b/libmpdemux/demux_rtp_internal.h index 77f0364918..fb8f582b53 100644 --- a/libmpdemux/demux_rtp_internal.h +++ b/libmpdemux/demux_rtp_internal.h @@ -22,12 +22,7 @@ #include <stdlib.h> extern "C" { -#ifndef STREAM_H -#include "stream/stream.h" -#endif -#ifndef DEMUXER_H #include "demuxer.h" -#endif #ifdef CONFIG_LIBAVCODEC #include "libavcodec/avcodec.h" #endif diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index e529c2535b..1f16ea4eda 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -279,7 +279,7 @@ typedef struct { } demux_program_t; static inline demux_packet_t* new_demux_packet(int len){ - demux_packet_t* dp = malloc(sizeof(demux_packet_t)); + demux_packet_t* dp=(demux_packet_t*)malloc(sizeof(demux_packet_t)); dp->len=len; dp->next=NULL; dp->pts=MP_NOPTS_VALUE; @@ -290,7 +290,7 @@ static inline demux_packet_t* new_demux_packet(int len){ dp->refcount=1; dp->master=NULL; dp->buffer=NULL; - if (len > 0 && (dp->buffer = malloc(len + MP_INPUT_BUFFER_PADDING_SIZE))) + if (len > 0 && (dp->buffer = (unsigned char *)malloc(len + MP_INPUT_BUFFER_PADDING_SIZE))) memset(dp->buffer + len, 0, 8); else dp->len = 0; @@ -301,7 +301,7 @@ static inline void resize_demux_packet(demux_packet_t* dp, int len) { if(len > 0) { - dp->buffer = realloc(dp->buffer, len + 8); + dp->buffer=(unsigned char *)realloc(dp->buffer,len+8); } else { @@ -316,7 +316,7 @@ static inline void resize_demux_packet(demux_packet_t* dp, int len) } static inline demux_packet_t* clone_demux_packet(demux_packet_t* pack){ - demux_packet_t* dp = malloc(sizeof(demux_packet_t)); + demux_packet_t* dp=(demux_packet_t*)malloc(sizeof(demux_packet_t)); while(pack->master) pack=pack->master; // find the master memcpy(dp,pack,sizeof(demux_packet_t)); dp->next=NULL; diff --git a/libmpdemux/mp3_hdr.c b/libmpdemux/mp3_hdr.c index 6177030316..a4834f4f81 100644 --- a/libmpdemux/mp3_hdr.c +++ b/libmpdemux/mp3_hdr.c @@ -38,18 +38,6 @@ static long freqs[9] = { 44100, 48000, 32000, // MPEG 1.0 22050, 24000, 16000, // MPEG 2.0 11025, 12000, 8000}; // MPEG 2.5 -static int mp_mp3_get_lsf(unsigned char* hbuf){ - unsigned long newhead = - hbuf[0] << 24 | - hbuf[1] << 16 | - hbuf[2] << 8 | - hbuf[3]; - if( newhead & ((long)1<<20) ) { - return (newhead & ((long)1<<19)) ? 0x0 : 0x1; - } - return 1; -} - /* * return frame size or -1 (bad frame) */ diff --git a/libvo/video_out.c b/libvo/video_out.c index 31f7ea3dec..08e59fcb0c 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -85,6 +85,7 @@ extern struct vo_driver video_out_xover; extern struct vo_driver video_out_xvmc; extern struct vo_driver video_out_vdpau; extern struct vo_driver video_out_xv; +extern struct vo_driver video_out_gl_nosw; extern struct vo_driver video_out_gl; extern struct vo_driver video_out_gl2; extern struct vo_driver video_out_matrixview; @@ -177,14 +178,15 @@ const struct vo_driver *video_out_drivers[] = #ifdef CONFIG_XV &video_out_xv, #endif +#ifdef CONFIG_X11 #ifdef CONFIG_GL - &video_out_gl, + &video_out_gl_nosw, #endif -#ifdef CONFIG_X11 &video_out_x11, &video_out_xover, #endif #ifdef CONFIG_GL + &video_out_gl, &video_out_gl2, #endif #ifdef CONFIG_DGA diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 8611496a53..cf5cbcbbb2 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -36,14 +36,48 @@ static const vo_info_t info = { - "X11 (OpenGL)", + "OpenGL", "gl", - "Arpad Gereoffy <arpi@esp-team.scene.hu>", + "Reimar Doeffinger <Reimar.Doeffinger@gmx.de>", "" }; const LIBVO_EXTERN(gl) + +static const vo_info_t info_nosw = +{ + "OpenGL no software rendering", + "gl_nosw", + "Reimar Doeffinger <Reimar.Doeffinger@gmx.de>", + "" +}; +static int preinit_nosw(const char *arg); +const struct vo_driver video_out_gl_nosw = +{ + .is_new = 0, + .info = &info_nosw, + .preinit = old_vo_preinit, + .config = old_vo_config, + .control = old_vo_control, + .draw_slice = old_vo_draw_slice, + .draw_osd = old_vo_draw_osd, + .flip_page = old_vo_flip_page, + .check_events = old_vo_check_events, + .uninit = old_vo_uninit, + .old_functions = &(struct vo_old_functions){ + preinit_nosw, + config, + control, + draw_frame, + draw_slice, + draw_osd, + flip_page, + check_events, + uninit, + } +}; + #ifdef CONFIG_GL_X11 static int wsGLXAttrib[] = { GLX_RGBA, GLX_RED_SIZE,1, @@ -441,6 +475,12 @@ static void uninitGl(void) { err_shown = 0; } +static int isSoftwareGl(void) +{ + const char *renderer = GetString(GL_RENDERER); + return strcmp(renderer, "Software Rasterizer") == 0; +} + static void autodetectGlExtensions(void) { const char *extensions = GetString(GL_EXTENSIONS); const char *vendor = GetString(GL_VENDOR); @@ -1041,7 +1081,7 @@ static const opt_t subopts[] = { {NULL} }; -static int preinit(const char *arg) +static int preinit_internal(const char *arg, int allow_sw) { enum MPGLType gltype = GLTYPE_X11; // set defaults @@ -1150,11 +1190,13 @@ static int preinit(const char *arg) } if (!init_mpglcontext(&glctx, gltype)) goto err_out; - if (use_yuv == -1) { + if (use_yuv == -1 || !allow_sw) { if (create_window(320, 200, VOFLAG_HIDDEN, NULL) < 0) goto err_out; if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED) goto err_out; + if (!allow_sw && isSoftwareGl()) + goto err_out; autodetectGlExtensions(); } if (many_fmts) @@ -1170,6 +1212,16 @@ err_out: return -1; } +static int preinit(const char *arg) +{ + return preinit_internal(arg, 1); +} + +static int preinit_nosw(const char *arg) +{ + return preinit_internal(arg, 0); +} + static const struct { const char *name; int *value; diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index ae04cf4139..743289840e 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -844,7 +844,7 @@ static int preinit(const char *arg) #ifdef CONFIG_GL_WIN32 gltype = GLTYPE_W32; #endif - use_yuv = 0; + use_yuv = -1; use_glFinish = 1; if (subopt_parse(arg, subopts) != 0) { mp_msg(MSGT_VO, MSGL_FATAL, @@ -863,8 +863,25 @@ static int preinit(const char *arg) "\n" ); return -1; } - if(!init_mpglcontext(&glctx, gltype)) return -1; + if(!init_mpglcontext(&glctx, gltype)) goto err_out; + if (use_yuv == -1) { + const char *extensions; +#ifdef CONFIG_GL_WIN32 + if (config_w32(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1) +#else + if (config_glx(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1) +#endif + goto err_out; + if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED) + goto err_out; + extensions = GetString(GL_EXTENSIONS); + use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0; + } return 0; + +err_out: + uninit(); + return -1; } static int control(uint32_t request, void *data) diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 91431207a3..a7ac744af8 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -746,6 +746,7 @@ void vo_x11_uninit(struct vo *vo) XEvent xev; XUnmapWindow(x11->display, x11->window); + XSelectInput(x11->display, x11->window, StructureNotifyMask); XDestroyWindow(x11->display, x11->window); do { diff --git a/mencoder.c b/mencoder.c index af1b015d90..4b2bea30fa 100644 --- a/mencoder.c +++ b/mencoder.c @@ -1234,7 +1234,7 @@ if(sh_audio){ } } if(len<=0) break; // EOF? - muxer_write_chunk(mux_a,len,0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE); + muxer_write_chunk(mux_a,len,AVIIF_KEYFRAME, MP_NOPTS_VALUE, MP_NOPTS_VALUE); if(!mux_a->h.dwSampleSize && mux_a->timer>0) mux_a->wf->nAvgBytesPerSec=0.5f+(double)mux_a->size/mux_a->timer; // avg bps (VBR) if(mux_a->buffer_len>=len){ @@ -1320,11 +1320,11 @@ ptimer_start = GetTimerMS(); switch(mux_v->codec){ case VCODEC_COPY: mux_v->buffer=frame_data.start; - if(skip_flag<=0) muxer_write_chunk(mux_v,frame_data.in_size,(sh_video->ds->flags& |