mirror of
https://github.com/mpv-player/mpv.git
synced 2026-06-06 20:10:30 +00:00
Merge svn changes up to r30798
This commit is contained in:
-47
@@ -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*
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
@@ -819,6 +819,24 @@ static int query_format(struct vf_instance * vf, unsigned int fmt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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.
|
||||
*
|
||||
@@ -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;
|
||||
@@ -872,24 +891,6 @@ static int vf_open(vf_instance_t *vf, char *args)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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.
|
||||
*/
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
*/
|
||||
|
||||
+5
-3
@@ -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_GL
|
||||
&video_out_gl,
|
||||
#endif
|
||||
#ifdef CONFIG_X11
|
||||
#ifdef CONFIG_GL
|
||||
&video_out_gl_nosw,
|
||||
#endif
|
||||
&video_out_x11,
|
||||
&video_out_xover,
|
||||
#endif
|
||||
#ifdef CONFIG_GL
|
||||
&video_out_gl,
|
||||
&video_out_gl2,
|
||||
#endif
|
||||
#ifdef CONFIG_DGA
|
||||
|
||||
+56
-4
@@ -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;
|
||||
|
||||
+19
-2
@@ -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)
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
+3
-3
@@ -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&1)?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
|
||||
if(skip_flag<=0) muxer_write_chunk(mux_v,frame_data.in_size,(sh_video->ds->flags&1)?AVIIF_KEYFRAME:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
|
||||
break;
|
||||
case VCODEC_FRAMENO:
|
||||
mux_v->buffer=(unsigned char *)&decoded_frameno; // tricky
|
||||
if(skip_flag<=0) muxer_write_chunk(mux_v,sizeof(int),0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
|
||||
if(skip_flag<=0) muxer_write_chunk(mux_v,sizeof(int),AVIIF_KEYFRAME, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
|
||||
break;
|
||||
default:
|
||||
// decode_video will callback down to ve_*.c encoders, through the video filters
|
||||
|
||||
+24
-13
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include "keycodes.h"
|
||||
@@ -32,17 +33,19 @@
|
||||
#include "mp_fifo.h"
|
||||
#include "getch2.h"
|
||||
|
||||
// HACK, stdin is used as something else below
|
||||
#undef stdin
|
||||
|
||||
int mp_input_slave_cmd_func(int fd,char* dest,int size){
|
||||
DWORD retval;
|
||||
HANDLE stdin = GetStdHandle(STD_INPUT_HANDLE);
|
||||
if(!PeekNamedPipe(stdin, NULL, size, &retval, NULL, NULL) || !retval){
|
||||
HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
|
||||
if(PeekNamedPipe(in, NULL, size, &retval, NULL, NULL)){
|
||||
if (size > retval) size = retval;
|
||||
} else {
|
||||
if (WaitForSingleObject(in, 0))
|
||||
size = 0;
|
||||
}
|
||||
if(!size){
|
||||
return MP_INPUT_NOTHING;
|
||||
}
|
||||
if(retval>size)retval=size;
|
||||
ReadFile(stdin, dest, retval, &retval, NULL);
|
||||
ReadFile(in, dest, size, &retval, NULL);
|
||||
if(retval)return retval;
|
||||
return MP_INPUT_NOTHING;
|
||||
}
|
||||
@@ -54,7 +57,7 @@ char * erase_to_end_of_line = NULL;
|
||||
void get_screen_size(void){
|
||||
}
|
||||
|
||||
static HANDLE stdin;
|
||||
static HANDLE in;
|
||||
static int getch2_status=0;
|
||||
|
||||
static int getch2_internal(void)
|
||||
@@ -62,9 +65,17 @@ static int getch2_internal(void)
|
||||
INPUT_RECORD eventbuffer[128];
|
||||
DWORD retval;
|
||||
int i=0;
|
||||
if(!getch2_status)return -1;
|
||||
if(!getch2_status){
|
||||
// supports e.g. MinGW xterm, unfortunately keys are only received after
|
||||
// enter was pressed.
|
||||
uint8_t c;
|
||||
if (!PeekNamedPipe(in, NULL, 1, &retval, NULL, NULL) || !retval)
|
||||
return -1;
|
||||
ReadFile(in, &c, 1, &retval, NULL);
|
||||
return retval == 1 ? c : -1;
|
||||
}
|
||||
/*check if there are input events*/
|
||||
if(!GetNumberOfConsoleInputEvents(stdin,&retval))
|
||||
if(!GetNumberOfConsoleInputEvents(in,&retval))
|
||||
{
|
||||
printf("getch2: can't get number of input events: %i\n",GetLastError());
|
||||
return -1;
|
||||
@@ -72,7 +83,7 @@ static int getch2_internal(void)
|
||||
if(retval<=0)return -1;
|
||||
|
||||
/*read all events*/
|
||||
if(!ReadConsoleInput(stdin,eventbuffer,128,&retval))
|
||||
if(!ReadConsoleInput(in,eventbuffer,128,&retval))
|
||||
{
|
||||
printf("getch: can't read input events\n");
|
||||
return -1;
|
||||
@@ -151,8 +162,8 @@ void getch2(struct mp_fifo *fifo)
|
||||
void getch2_enable(void)
|
||||
{
|
||||
DWORD retval;
|
||||
stdin = GetStdHandle(STD_INPUT_HANDLE);
|
||||
if(!GetNumberOfConsoleInputEvents(stdin,&retval))
|
||||
in = GetStdHandle(STD_INPUT_HANDLE);
|
||||
if(!GetNumberOfConsoleInputEvents(in,&retval))
|
||||
{
|
||||
printf("getch2: %i can't get number of input events [disabling console input]\n",GetLastError());
|
||||
getch2_status = 0;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Header in order to include OS-specific headers, macros, types and so on
|
||||
*
|
||||
* Copyright (c) 2010 by KO Myung-Hun (komh@chollian.net)
|
||||
*
|
||||
* This file is part of MPlayer.
|
||||
*
|
||||
* MPlayer is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MPlayer is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_OSDEP_H
|
||||
#define MPLAYER_OSDEP_H
|
||||
|
||||
#ifdef __OS2__
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSDEVIOCTL
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
#endif /* MPLAYER_OSDEP_H */
|
||||
|
||||
-14
@@ -414,20 +414,6 @@ play_tree_set_params_from(play_tree_t* dest,play_tree_t* src) {
|
||||
|
||||
}
|
||||
|
||||
// all children if deep < 0
|
||||
static void
|
||||
play_tree_set_flag(play_tree_t* pt, int flags , int deep) {
|
||||
play_tree_t* i;
|
||||
|
||||
pt->flags |= flags;
|
||||
|
||||
if(deep && pt->child) {
|
||||
if(deep > 0) deep--;
|
||||
for(i = pt->child ; i ; i = i->next)
|
||||
play_tree_set_flag(i,flags,deep);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
play_tree_unset_flag(play_tree_t* pt, int flags , int deep) {
|
||||
play_tree_t* i;
|
||||
|
||||
+19
-4
@@ -30,6 +30,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include "asxparser.h"
|
||||
#include "m_config.h"
|
||||
#include "playtree.h"
|
||||
@@ -80,8 +81,15 @@ play_tree_parser_get_line(play_tree_parser_t* p) {
|
||||
while(1) {
|
||||
|
||||
if(resize) {
|
||||
char *tmp;
|
||||
r = p->iter - p->buffer;
|
||||
p->buffer = realloc(p->buffer, p->buffer_size + BUF_STEP);
|
||||
end = p->buffer + p->buffer_end;
|
||||
if (p->buffer_size > INT_MAX - BUF_STEP)
|
||||
break;
|
||||
tmp = realloc(p->buffer, p->buffer_size + BUF_STEP);
|
||||
if (!tmp)
|
||||
break;
|
||||
p->buffer = tmp;
|
||||
p->iter = p->buffer + r;
|
||||
p->buffer_size += BUF_STEP;
|
||||
resize = 0;
|
||||
@@ -238,21 +246,28 @@ static int
|
||||
pls_read_entry(char* line,pls_entry_t** _e,int* _max_entry,char** val) {
|
||||
int num,max_entry = (*_max_entry);
|
||||
pls_entry_t* e = (*_e);
|
||||
int limit = INT_MAX / sizeof(*e);
|
||||
char* v;
|
||||
|
||||
v = pls_entry_get_value(line);
|
||||
if(!v) {
|
||||
mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
num = atoi(line);
|
||||
if(num < 0) {
|
||||
if(num <= 0 || num > limit) {
|
||||
if (max_entry >= limit) {
|
||||
mp_msg(MSGT_PLAYTREE, MSGL_WARN, "Too many index entries\n");
|
||||
return -1;
|
||||
}
|
||||
num = max_entry+1;
|
||||
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"No entry index in entry %s\nAssuming %d\n",line,num);
|
||||
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"No or invalid entry index in entry %s\nAssuming %d\n",line,num);
|
||||
}
|
||||
if(num > max_entry) {
|
||||
e = realloc(e, num * sizeof(pls_entry_t));
|
||||
if (!e)
|
||||
return -1;
|
||||
memset(&e[max_entry],0,(num-max_entry)*sizeof(pls_entry_t));
|
||||
max_entry = num;
|
||||
}
|
||||
|
||||
+9
-11
@@ -218,14 +218,14 @@ static int cache_fill(cache_vars_t* s){
|
||||
}
|
||||
|
||||
static int cache_execute_control(cache_vars_t *s) {
|
||||
int res = 1;
|
||||
static unsigned last;
|
||||
if (!s->stream->control) {
|
||||
int quit = s->control == -2;
|
||||
if (quit || !s->stream->control) {
|
||||
s->stream_time_length = 0;
|
||||
s->control_new_pos = 0;
|
||||
s->control_res = STREAM_UNSUPPORTED;
|
||||
s->control = -1;
|
||||
return res;
|
||||
return !quit;
|
||||
}
|
||||
if (GetTimerMS() - last > 99) {
|
||||
double len;
|
||||
@@ -235,7 +235,7 @@ static int cache_execute_control(cache_vars_t *s) {
|
||||
s->stream_time_length = 0;
|
||||
last = GetTimerMS();
|
||||
}
|
||||
if (s->control == -1) return res;
|
||||
if (s->control == -1) return 1;
|
||||
switch (s->control) {
|
||||
case STREAM_CTRL_GET_CURRENT_TIME:
|
||||
case STREAM_CTRL_SEEK_TO_TIME:
|
||||
@@ -250,15 +250,13 @@ static int cache_execute_control(cache_vars_t *s) {
|
||||
case STREAM_CTRL_SET_ANGLE:
|
||||
s->control_res = s->stream->control(s->stream, s->control, &s->control_uint_arg);
|
||||
break;
|
||||
case -2:
|
||||
res = 0;
|
||||
default:
|
||||
s->control_res = STREAM_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
s->control_new_pos = s->stream->pos;
|
||||
s->control = -1;
|
||||
return res;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cache_vars_t* cache_init(int size,int sector){
|
||||
@@ -310,9 +308,9 @@ void cache_uninit(stream_t *s) {
|
||||
}
|
||||
if(!c) return;
|
||||
#if defined(__MINGW32__) || defined(PTHREAD_CACHE) || defined(__OS2__)
|
||||
free(c->stream);
|
||||
free(c->buffer);
|
||||
c->buffer = NULL;
|
||||
c->stream = NULL;
|
||||
free(s->cache_data);
|
||||
#else
|
||||
shmem_free(c->buffer,c->buffer_size);
|
||||
@@ -423,12 +421,12 @@ static void ThreadProc( void *s ){
|
||||
} while (cache_execute_control(s));
|
||||
#if defined(__MINGW32__) || defined(__OS2__)
|
||||
_endthread();
|
||||
#endif
|
||||
#ifdef PTHREAD_CACHE
|
||||
#elif defined(PTHREAD_CACHE)
|
||||
return NULL;
|
||||
#endif
|
||||
#else
|
||||
// make sure forked code never leaves this function
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
int cache_stream_fill_buffer(stream_t *s){
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ typedef struct {
|
||||
cd_info_t *cd_info;
|
||||
} cdda_priv;
|
||||
|
||||
cd_info_t* cd_info_new();
|
||||
cd_info_t* cd_info_new(void);
|
||||
void cd_info_free(cd_info_t *cd_info);
|
||||
cd_track_t* cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length);
|
||||
cd_track_t* cd_info_get_track(cd_info_t *cd_info, unsigned int track_nb);
|
||||
|
||||
@@ -1440,50 +1440,6 @@ fsdp_get_encryption_content (const fsdp_description_t * dsc)
|
||||
return dsc->k_encryption_content;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
fsdp_get_rtpmap_count (const fsdp_description_t * dsc)
|
||||
{
|
||||
if (!dsc)
|
||||
return 0;
|
||||
return dsc->a_rtpmaps_count;
|
||||
}
|
||||
|
||||
const char *
|
||||
fsdp_get_rtpmap_payload_type (const fsdp_description_t * dsc,
|
||||
unsigned int index)
|
||||
{
|
||||
if ((!dsc) || (index >= dsc->a_rtpmaps_count))
|
||||
return NULL;
|
||||
return dsc->a_rtpmaps[index]->pt;
|
||||
}
|
||||
|
||||
const char *
|
||||
fsdp_get_rtpmap_encoding_name (const fsdp_description_t * dsc,
|
||||
unsigned int index)
|
||||
{
|
||||
if ((!dsc) || (index >= dsc->a_rtpmaps_count))
|
||||
return NULL;
|
||||
return dsc->a_rtpmaps[index]->encoding_name;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
fsdp_get_rtpmap_clock_rate (const fsdp_description_t * dsc,
|
||||
unsigned int index)
|
||||
{
|
||||
if ((!dsc) || (index >= dsc->a_rtpmaps_count))
|
||||
return 0;
|
||||
return dsc->a_rtpmaps[index]->clock_rate;
|
||||
}
|
||||
|
||||
const char *
|
||||
fsdp_get_rtpmap_encoding_parameters (const fsdp_description_t * dsc,
|
||||
unsigned int index)
|
||||
{
|
||||
if ((!dsc) || (index >= dsc->a_rtpmaps_count))
|
||||
return NULL;
|
||||
return dsc->a_rtpmaps[index]->parameters;
|
||||
}
|
||||
|
||||
const char *
|
||||
fsdp_get_str_att (const fsdp_description_t * dsc, fsdp_session_str_att_t att)
|
||||
{
|
||||
@@ -1530,22 +1486,6 @@ fsdp_get_sdplang (const fsdp_description_t * dsc, unsigned int index)
|
||||
return dsc->a_sdplangs[index];
|
||||
}
|
||||
|
||||
unsigned int
|
||||
fsdp_get_lang_count (const fsdp_description_t * dsc)
|
||||
{
|
||||
if (!dsc)
|
||||
return 0;
|
||||
return dsc->a_langs_count;
|
||||
}
|
||||
|
||||
const char *
|
||||
fsdp_get_lang (const fsdp_description_t * dsc, unsigned int index)
|
||||
{
|
||||
if ((!dsc) || (index >= dsc->a_langs_count))
|
||||
return NULL;
|
||||
return dsc->a_langs[index];
|
||||
}
|
||||
|
||||
unsigned int
|
||||
fsdp_get_control_count (const fsdp_description_t * dsc)
|
||||
{
|
||||
|
||||
@@ -475,10 +475,3 @@ void fixup_network_stream_cache(stream_t *stream) {
|
||||
mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Cache size set to %d KBytes\n", stream_cache_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
streaming_stop( stream_t *stream ) {
|
||||
stream->streaming_ctrl->status = streaming_stopped_e;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -492,3 +492,29 @@ int stream_check_interrupt(int time) {
|
||||
if(!stream_check_interrupt_cb) return 0;
|
||||
return stream_check_interrupt_cb(stream_check_interrupt_ctx, time);
|
||||
}
|
||||
|
||||
unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max) {
|
||||
int len;
|
||||
unsigned char* end,*ptr = mem;
|
||||
if (max < 1) return NULL;
|
||||
max--; // reserve one for 0-termination
|
||||
do {
|
||||
len = s->buf_len-s->buf_pos;
|
||||
// try to fill the buffer
|
||||
if(len <= 0 &&
|
||||
(!cache_stream_fill_buffer(s) ||
|
||||
(len = s->buf_len-s->buf_pos) <= 0)) break;
|
||||
end = (unsigned char*) memchr((void*)(s->buffer+s->buf_pos),'\n',len);
|
||||
if(end) len = end - (s->buffer+s->buf_pos) + 1;
|
||||
if(len > 0 && max > 0) {
|
||||
int l = len > max ? max : len;
|
||||
memcpy(ptr,s->buffer+s->buf_pos,l);
|
||||
max -= l;
|
||||
ptr += l;
|
||||
}
|
||||
s->buf_pos += len;
|
||||
} while(!end);
|
||||
if(s->eof && ptr == mem) return NULL;
|
||||
ptr[0] = 0;
|
||||
return mem;
|
||||
}
|
||||
|
||||
+1
-24
@@ -269,30 +269,7 @@ inline static int stream_read(stream_t *s,char* mem,int total){
|
||||
return total;
|
||||
}
|
||||
|
||||
inline static unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max) {
|
||||
int len;
|
||||
unsigned char* end,*ptr = mem;
|
||||
do {
|
||||
len = s->buf_len-s->buf_pos;
|
||||
// try to fill the buffer
|
||||
if(len <= 0 &&
|
||||
(!cache_stream_fill_buffer(s) ||
|
||||
(len = s->buf_len-s->buf_pos) <= 0)) break;
|
||||
end = (unsigned char*) memchr((void*)(s->buffer+s->buf_pos),'\n',len);
|
||||
if(end) len = end - (s->buffer+s->buf_pos) + 1;
|
||||
if(len > 0 && max > 1) {
|
||||
int l = len > max-1 ? max-1 : len;
|
||||
memcpy(ptr,s->buffer+s->buf_pos,l);
|
||||
max -= l;
|
||||
ptr += l;
|
||||
}
|
||||
s->buf_pos += len;
|
||||
} while(!end);
|
||||
if(s->eof && ptr == mem) return NULL;
|
||||
if(max > 0) ptr[0] = 0;
|
||||
return mem;
|
||||
}
|
||||
|
||||
unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max);
|
||||
|
||||
inline static int stream_eof(stream_t *s){
|
||||
return s->eof;
|
||||
|
||||
@@ -68,6 +68,8 @@
|
||||
#include "mpbswap.h"
|
||||
#endif
|
||||
|
||||
#include "osdep/osdep.h"
|
||||
|
||||
#include "cdd.h"
|
||||
#include "version.h"
|
||||
#include "stream.h"
|
||||
@@ -112,6 +114,78 @@ static int read_toc(const char *dev)
|
||||
}
|
||||
CloseHandle(drive);
|
||||
|
||||
#elif defined(__OS2__)
|
||||
UCHAR auchParamDisk[4] = {'C', 'D', '0', '1'};
|
||||
|
||||
struct {
|
||||
BYTE bFirstTrack;
|
||||
BYTE bLastTrack;
|
||||
BYTE bLeadOutF;
|
||||
BYTE bLeadOutS;
|
||||
BYTE bLeadOutM;
|
||||
BYTE bLeadOutReserved;
|
||||
} __attribute__((packed)) sDataDisk;
|
||||
|
||||
struct {
|
||||
UCHAR auchSign[4];
|
||||
BYTE bTrack;
|
||||
} __attribute__((packed)) sParamTrack = {{'C', 'D', '0', '1'},};
|
||||
|
||||
struct {
|
||||
BYTE bStartF;
|
||||
BYTE bStartS;
|
||||
BYTE bStartM;
|
||||
BYTE bStartReserved;
|
||||
BYTE bControlInfo;
|
||||
} __attribute__((packed)) sDataTrack;
|
||||
|
||||
HFILE hcd;
|
||||
ULONG ulAction;
|
||||
ULONG ulParamLen;
|
||||
ULONG ulDataLen;
|
||||
ULONG rc;
|
||||
|
||||
rc = DosOpen(dev, &hcd, &ulAction, 0, FILE_NORMAL,
|
||||
OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
|
||||
OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
|
||||
NULL);
|
||||
if (rc) {
|
||||
mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to read TOC.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = DosDevIOCtl(hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIODISK,
|
||||
auchParamDisk, sizeof(auchParamDisk), &ulParamLen,
|
||||
&sDataDisk, sizeof(sDataDisk), &ulDataLen);
|
||||
if (!rc) {
|
||||
first = sDataDisk.bFirstTrack - 1;
|
||||
last = sDataDisk.bLastTrack;
|
||||
for (i = first; i <= last; i++) {
|
||||
if (i == last) {
|
||||
sDataTrack.bStartM = sDataDisk.bLeadOutM;
|
||||
sDataTrack.bStartS = sDataDisk.bLeadOutS;
|
||||
sDataTrack.bStartF = sDataDisk.bLeadOutF;
|
||||
} else {
|
||||
sParamTrack.bTrack = i + 1;
|
||||
rc = DosDevIOCtl(hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK,
|
||||
&sParamTrack, sizeof(sParamTrack), &ulParamLen,
|
||||
&sDataTrack, sizeof(sDataTrack), &ulDataLen);
|
||||
if (rc)
|
||||
break;
|
||||
}
|
||||
|
||||
cdtoc[i].min = sDataTrack.bStartM;
|
||||
cdtoc[i].sec = sDataTrack.bStartS;
|
||||
cdtoc[i].frame = sDataTrack.bStartF;
|
||||
}
|
||||
}
|
||||
|
||||
DosClose(hcd);
|
||||
|
||||
if (rc) {
|
||||
mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to read TOC.\n");
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
int drive;
|
||||
drive = open(dev, O_RDONLY | O_NONBLOCK);
|
||||
|
||||
@@ -70,10 +70,12 @@ tv_param_t stream_tv_defaults = {
|
||||
0, //hue
|
||||
0, //saturation
|
||||
-1, //gain
|
||||
{
|
||||
NULL, //tdevice
|
||||
0, //tformat
|
||||
100, //tpage
|
||||
0, //tlang
|
||||
},
|
||||
0, //scan_autostart
|
||||
50, //scan_threshold
|
||||
0.5, //scan_period
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ static void close_s(stream_t *stream) {
|
||||
}
|
||||
|
||||
static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
||||
struct stream_priv_s* p = (struct stream_priv_s*)opts;
|
||||
struct stream_priv_s* p = opts;
|
||||
int ret,ret2,f,sect,tmp;
|
||||
mp_vcd_priv_t* vcd;
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
+3
-3
@@ -1355,7 +1355,7 @@ sub_data* sub_read_file (char *filename, float fps) {
|
||||
subtitle *first, *second, *sub, *return_sub, *alloced_sub = NULL;
|
||||
sub_data *subt_data;
|
||||
int uses_time = 0, sub_num = 0, sub_errs = 0;
|
||||
struct subreader sr[]=
|
||||
static const struct subreader sr[]=
|
||||
{
|
||||
{ sub_read_line_microdvd, NULL, "microdvd" },
|
||||
{ sub_read_line_subrip, NULL, "subrip" },
|
||||
@@ -1372,7 +1372,7 @@ sub_data* sub_read_file (char *filename, float fps) {
|
||||
{ sub_read_line_jacosub, NULL, "jacosub" },
|
||||
{ sub_read_line_mpl2, NULL, "mpl2" }
|
||||
};
|
||||
struct subreader *srp;
|
||||
const struct subreader *srp;
|
||||
|
||||
if(filename==NULL) return NULL; //qnx segfault
|
||||
i = 0;
|
||||
@@ -1433,7 +1433,7 @@ sub_data* sub_read_file (char *filename, float fps) {
|
||||
sub=srp->read(fd,sub);
|
||||
if(!sub) break; // EOF
|
||||
#ifdef CONFIG_ICONV
|
||||
if ((sub!=ERR) && (sub_utf8 & 2)) sub=subcp_recode(sub);
|
||||
if ((sub!=ERR) && sub_utf8 == 2) sub=subcp_recode(sub);
|
||||
#endif
|
||||
#ifdef CONFIG_FRIBIDI
|
||||
if (sub!=ERR) sub=sub_fribidi(sub,sub_utf8,0);
|
||||
|
||||
@@ -153,11 +153,6 @@ int vdlPlaybackSetEq (VDXContext *ctx, const vidix_video_eq_t *e)
|
||||
return ctx->drv->set_eq ? ctx->drv->set_eq (e) : ENOSYS;
|
||||
}
|
||||
|
||||
static int vdlPlaybackCopyFrame(VDXContext *ctx, const vidix_dma_t *f)
|
||||
{
|
||||
return ctx->drv->copy_frame ? ctx->drv->copy_frame (f) : ENOSYS;
|
||||
}
|
||||
|
||||
int vdlGetGrKeys (VDXContext *ctx, vidix_grkey_t *k)
|
||||
{
|
||||
return ctx->drv->get_gkey ? ctx->drv->get_gkey (k) : ENOSYS;
|
||||
|
||||
Reference in New Issue
Block a user