mirror of
https://github.com/mpv-player/mpv
synced 2025-01-09 01:36:25 +01:00
Remove support for libdv
This removes the libdv demuxer and audio/video decoders. FFmpeg has support for it, and it's even preferred over the internal decoders.
This commit is contained in:
parent
e181547db1
commit
6f7ba66817
3
Makefile
3
Makefile
@ -54,9 +54,6 @@ SRCS_COMMON-$(LIBASS) += libmpcodecs/vf_ass.c \
|
||||
SRCS_COMMON-$(LIBBLURAY) += stream/stream_bluray.c
|
||||
SRCS_COMMON-$(LIBBS2B) += libaf/af_bs2b.c
|
||||
SRCS_COMMON-$(LIBDCA) += libmpcodecs/ad_libdca.c
|
||||
SRCS_COMMON-$(LIBDV) += libmpcodecs/ad_libdv.c \
|
||||
libmpcodecs/vd_libdv.c \
|
||||
libmpdemux/demux_rawdv.c
|
||||
|
||||
SRCS_COMMON-$(LIBMAD) += libmpcodecs/ad_libmad.c
|
||||
|
||||
|
22
configure
vendored
22
configure
vendored
@ -350,7 +350,6 @@ Codecs:
|
||||
--enable-faad enable FAAD2 (AAC) [autodetect]
|
||||
--disable-ladspa disable LADSPA plugin support [autodetect]
|
||||
--disable-libbs2b disable libbs2b audio filter support [autodetect]
|
||||
--disable-libdv disable libdv 0.9.5 en/decoding support [autodetect]
|
||||
--disable-mpg123 disable libmpg123 MP3 decoding support [autodetect]
|
||||
--disable-mad disable libmad (MPEG audio) support [autodetect]
|
||||
--enable-libdca enable libdca support [autodetect]
|
||||
@ -500,7 +499,6 @@ _termios=auto
|
||||
#language=en
|
||||
_shm=auto
|
||||
_translation=no
|
||||
_libdv=auto
|
||||
_cdda=auto
|
||||
_cddb=auto
|
||||
_coreaudio=auto
|
||||
@ -654,8 +652,6 @@ for ac_option do
|
||||
--disable-dvb) _dvb=no ;;
|
||||
--enable-iconv) _iconv=yes ;;
|
||||
--disable-iconv) _iconv=no ;;
|
||||
--enable-libdv) _libdv=yes ;;
|
||||
--disable-libdv) _libdv=no ;;
|
||||
--enable-ossaudio) _ossaudio=yes ;;
|
||||
--disable-ossaudio) _ossaudio=no ;;
|
||||
--enable-rsound) _rsound=yes ;;
|
||||
@ -3042,22 +3038,6 @@ fi
|
||||
echores "$libpostproc"
|
||||
|
||||
|
||||
echocheck "libdv-0.9.5+"
|
||||
if test "$_libdv" = auto ; then
|
||||
_libdv=no
|
||||
statement_check libdv/dv.h 'dv_encoder_new(1, 1, 1)' -ldv $_ld_pthread $_ld_lm && _libdv=yes
|
||||
fi
|
||||
if test "$_libdv" = yes ; then
|
||||
def_libdv='#define CONFIG_LIBDV095 1'
|
||||
extra_ldflags="$extra_ldflags -ldv"
|
||||
codecmodules="libdv $codecmodules"
|
||||
else
|
||||
def_libdv='#undef CONFIG_LIBDV095'
|
||||
nocodecmodules="libdv $nocodecmodules"
|
||||
fi
|
||||
echores "$_libdv"
|
||||
|
||||
|
||||
echocheck "TV interface"
|
||||
if test "$_tv" = yes ; then
|
||||
def_tv='#define CONFIG_TV 1'
|
||||
@ -3466,7 +3446,6 @@ DUMMY_OSD = $_dummy_osd
|
||||
LIBBLURAY = $_bluray
|
||||
LIBBS2B = $_libbs2b
|
||||
LIBDCA = $_libdca
|
||||
LIBDV = $_libdv
|
||||
LIBMAD = $_mad
|
||||
LCMS2 = $_lcms2
|
||||
LIBPOSTPROC = $libpostproc
|
||||
@ -3640,7 +3619,6 @@ $def_vcd
|
||||
$def_faad
|
||||
$def_liba52
|
||||
$def_libdca
|
||||
$def_libdv
|
||||
$def_mad
|
||||
$def_mpg123
|
||||
$def_zlib
|
||||
|
@ -1723,24 +1723,6 @@ videocodec qdv
|
||||
out UYVY
|
||||
out BGR24,BGR16,BGR15 ; BGR32 is buggy, at least with one sample
|
||||
|
||||
videocodec libdv
|
||||
info "Raw DV (libdv)"
|
||||
status working
|
||||
fourcc DVSD,dvsd ; PAL
|
||||
fourcc DVCS,dvcs ; NTSC ?
|
||||
fourcc "dvcp" ; PAL DV in .mov
|
||||
fourcc "dvc " ; NTSC DV in .mov
|
||||
fourcc dvpp ; DVCPRO - PAL
|
||||
fourcc dv50 ; DVCPRO 50
|
||||
fourcc dv5n ; DVCPRO 50 NTSC in .mov
|
||||
fourcc dv5p ; DVCPRO 50 PAL in .mov
|
||||
fourcc AVdv,AVd1 ; AVID DV
|
||||
fourcc dvhq,dvhp
|
||||
fourcc dvh5,dvh6,dvh3
|
||||
driver libdv
|
||||
dll libdv.so.2
|
||||
out YUY2
|
||||
|
||||
; note: it crashes with pond.dv :(
|
||||
videocodec mcdv
|
||||
info "MainConcept DV Codec"
|
||||
@ -3917,13 +3899,6 @@ audiocodec ffadpcmthp
|
||||
driver ffmpeg
|
||||
dll adpcm_thp
|
||||
|
||||
audiocodec libdv
|
||||
info "raw DV audio (libdv)"
|
||||
status working
|
||||
fourcc RADV
|
||||
driver libdv
|
||||
dll libdv.so.2
|
||||
|
||||
audiocodec ffdv
|
||||
info "FFmpeg DV audio"
|
||||
status working
|
||||
|
@ -42,7 +42,6 @@ extern const ad_functions_t mpcodecs_ad_alaw;
|
||||
extern const ad_functions_t mpcodecs_ad_imaadpcm;
|
||||
extern const ad_functions_t mpcodecs_ad_faad;
|
||||
extern const ad_functions_t mpcodecs_ad_libmad;
|
||||
extern const ad_functions_t mpcodecs_ad_libdv;
|
||||
extern const ad_functions_t mpcodecs_ad_spdif;
|
||||
extern const ad_functions_t mpcodecs_ad_libdca;
|
||||
|
||||
@ -68,9 +67,6 @@ const ad_functions_t * const mpcodecs_ad_drivers[] =
|
||||
#ifdef CONFIG_LIBMAD
|
||||
&mpcodecs_ad_libmad,
|
||||
#endif
|
||||
#ifdef CONFIG_LIBDV095
|
||||
&mpcodecs_ad_libdv,
|
||||
#endif
|
||||
#ifdef CONFIG_LIBDCA
|
||||
&mpcodecs_ad_libdca,
|
||||
#endif
|
||||
|
@ -1,126 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "img_format.h"
|
||||
|
||||
#include <libdv/dv.h>
|
||||
#include <libdv/dv_types.h>
|
||||
|
||||
#include "stream/stream.h"
|
||||
#include "libmpdemux/demuxer.h"
|
||||
#include "libmpdemux/stheader.h"
|
||||
|
||||
#include "ad_internal.h"
|
||||
#include "vd_libdv.h"
|
||||
|
||||
static const ad_info_t info =
|
||||
{
|
||||
"Raw DV Audio Decoder",
|
||||
"libdv",
|
||||
"Alexander Neundorf <neundorf@kde.org>",
|
||||
"http://libdv.sf.net",
|
||||
""
|
||||
};
|
||||
|
||||
LIBAD_EXTERN(libdv)
|
||||
|
||||
static int preinit(sh_audio_t *sh_audio)
|
||||
{
|
||||
sh_audio->audio_out_minsize=4*DV_AUDIO_MAX_SAMPLES*2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int16_t *audioBuffers[4]={NULL,NULL,NULL,NULL};
|
||||
|
||||
static int init(sh_audio_t *sh)
|
||||
{
|
||||
int i;
|
||||
WAVEFORMATEX *h=sh->wf;
|
||||
|
||||
if(!h) return 0;
|
||||
|
||||
sh->i_bps=h->nAvgBytesPerSec;
|
||||
sh->channels=h->nChannels;
|
||||
sh->samplerate=h->nSamplesPerSec;
|
||||
sh->samplesize=(h->wBitsPerSample+7)/8;
|
||||
|
||||
sh->context=init_global_rawdv_decoder();
|
||||
|
||||
for (i=0; i < 4; i++)
|
||||
audioBuffers[i] = malloc(2*DV_AUDIO_MAX_SAMPLES);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void uninit(sh_audio_t *sh_audio)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 4; i++)
|
||||
free(audioBuffers[i]);
|
||||
}
|
||||
|
||||
static int control(sh_audio_t *sh,int cmd,void* arg, ...)
|
||||
{
|
||||
// TODO!!!
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
static int decode_audio(sh_audio_t *audio, unsigned char *buf, int minlen, int maxlen)
|
||||
{
|
||||
int len=0;
|
||||
dv_decoder_t* decoder=audio->context; //global_rawdv_decoder;
|
||||
unsigned char* dv_audio_frame=NULL;
|
||||
int xx=ds_get_packet(audio->ds,&dv_audio_frame);
|
||||
if(xx<=0 || !dv_audio_frame) return 0; // EOF?
|
||||
|
||||
dv_parse_header(decoder, dv_audio_frame);
|
||||
|
||||
if(xx!=decoder->frame_size)
|
||||
mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[AD_LIBDV] Warning! Audio framesize differs! read=%d hdr=%d.\n",
|
||||
xx, decoder->frame_size);
|
||||
|
||||
if (dv_decode_full_audio(decoder, dv_audio_frame,(int16_t**) audioBuffers))
|
||||
{
|
||||
/* Interleave the audio into a single buffer */
|
||||
int i=0;
|
||||
int16_t *bufP=(int16_t*)buf;
|
||||
|
||||
// printf("samples=%d/%d chans=%d mem=%d \n",decoder->audio->samples_this_frame,DV_AUDIO_MAX_SAMPLES,
|
||||
// decoder->audio->num_channels, decoder->audio->samples_this_frame*decoder->audio->num_channels*2);
|
||||
|
||||
// return (44100/30)*4;
|
||||
|
||||
for (i=0; i < decoder->audio->samples_this_frame; i++)
|
||||
{
|
||||
int ch;
|
||||
for (ch=0; ch < decoder->audio->num_channels; ch++)
|
||||
bufP[len++] = audioBuffers[ch][i];
|
||||
}
|
||||
}
|
||||
return len*2;
|
||||
}
|
@ -45,7 +45,6 @@ extern const vd_functions_t mpcodecs_vd_mpng;
|
||||
extern const vd_functions_t mpcodecs_vd_ijpg;
|
||||
extern const vd_functions_t mpcodecs_vd_mtga;
|
||||
extern const vd_functions_t mpcodecs_vd_realvid;
|
||||
extern const vd_functions_t mpcodecs_vd_libdv;
|
||||
extern const vd_functions_t mpcodecs_vd_lzo;
|
||||
extern const vd_functions_t mpcodecs_vd_qtvideo;
|
||||
|
||||
@ -66,9 +65,6 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = {
|
||||
&mpcodecs_vd_ijpg,
|
||||
#endif
|
||||
&mpcodecs_vd_mtga,
|
||||
#ifdef CONFIG_LIBDV095
|
||||
&mpcodecs_vd_libdv,
|
||||
#endif
|
||||
/* Please do not add any new decoders here. If you want to implement a new
|
||||
* decoder, add it to libavcodec, except for wrappers around external
|
||||
* libraries and decoders requiring binary support. */
|
||||
|
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "img_format.h"
|
||||
|
||||
#include <libdv/dv.h>
|
||||
#include <libdv/dv_types.h>
|
||||
|
||||
#include "stream/stream.h"
|
||||
#include "libmpdemux/demuxer.h"
|
||||
#include "libmpdemux/stheader.h"
|
||||
|
||||
#include "vd_internal.h"
|
||||
#include "vd_libdv.h"
|
||||
|
||||
static const vd_info_t info =
|
||||
{
|
||||
"Raw DV Video Decoder",
|
||||
"libdv",
|
||||
"Alexander Neundorf <neundorf@kde.org>",
|
||||
"http://libdv.sf.net",
|
||||
"native codec"
|
||||
};
|
||||
|
||||
LIBVD_EXTERN(libdv)
|
||||
|
||||
// to set/get/query special features/parameters
|
||||
static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
static dv_decoder_t* global_rawdv_decoder=NULL;
|
||||
|
||||
dv_decoder_t* init_global_rawdv_decoder(void)
|
||||
{
|
||||
if(!global_rawdv_decoder){
|
||||
global_rawdv_decoder=dv_decoder_new(TRUE,TRUE,FALSE);
|
||||
global_rawdv_decoder->quality=DV_QUALITY_BEST;
|
||||
global_rawdv_decoder->prev_frame_decoded = 0;
|
||||
}
|
||||
return global_rawdv_decoder;
|
||||
}
|
||||
|
||||
// init driver
|
||||
static int init(sh_video_t *sh)
|
||||
{
|
||||
sh->context = (void *)init_global_rawdv_decoder();
|
||||
return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2);
|
||||
}
|
||||
|
||||
// uninit driver
|
||||
static void uninit(sh_video_t *sh){
|
||||
}
|
||||
|
||||
// decode a frame
|
||||
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags)
|
||||
{
|
||||
mp_image_t* mpi;
|
||||
dv_decoder_t *decoder=sh->context;
|
||||
|
||||
if(len<=0 || (flags&3)){
|
||||
// fprintf(stderr,"decode() (rawdv) SKIPPED\n");
|
||||
return NULL; // skipped frame
|
||||
}
|
||||
|
||||
dv_parse_header(decoder, data);
|
||||
|
||||
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, sh->disp_w, sh->disp_h);
|
||||
|
||||
if(!mpi){ // temporary!
|
||||
fprintf(stderr,"couldn't allocate image for stderr codec\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dv_decode_full_frame(decoder, data, e_dv_color_yuv, mpi->planes, mpi->stride);
|
||||
|
||||
return mpi;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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_VD_LIBDV_H
|
||||
#define MPLAYER_VD_LIBDV_H
|
||||
|
||||
#include <libdv/dv_types.h>
|
||||
|
||||
dv_decoder_t* init_global_rawdv_decoder(void);
|
||||
|
||||
#endif /* MPLAYER_VD_LIBDV_H */
|
@ -1,276 +0,0 @@
|
||||
/*
|
||||
* raw DV file parser
|
||||
* copyright (c) 2002 Alexander Neundorf <neundorf@kde.org>
|
||||
* based on the fli demuxer
|
||||
*
|
||||
* This file is part of MPlayer.
|
||||
*
|
||||
* MPlayer is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "stream/stream.h"
|
||||
#include "demuxer.h"
|
||||
#include "stheader.h"
|
||||
|
||||
#include <libdv/dv.h>
|
||||
#include <libdv/dv_types.h>
|
||||
|
||||
#define DV_PAL_FRAME_SIZE 144000
|
||||
#define DV_NTSC_FRAME_SIZE 122000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int current_frame;
|
||||
int frame_size;
|
||||
off_t current_filepos;
|
||||
int frame_number;
|
||||
dv_decoder_t *decoder;
|
||||
} rawdv_frames_t;
|
||||
|
||||
static void demux_seek_rawdv(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags)
|
||||
{
|
||||
rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
|
||||
sh_video_t *sh_video = demuxer->video->sh;
|
||||
off_t newpos=(flags&SEEK_ABSOLUTE)?0:frames->current_frame;
|
||||
if(flags&SEEK_FACTOR)
|
||||
{
|
||||
// float 0..1
|
||||
newpos+=rel_seek_secs*frames->frame_number;
|
||||
}
|
||||
else
|
||||
{
|
||||
// secs
|
||||
newpos+=rel_seek_secs*sh_video->fps;
|
||||
}
|
||||
if(newpos<0)
|
||||
newpos=0;
|
||||
else if(newpos>frames->frame_number)
|
||||
newpos=frames->frame_number;
|
||||
frames->current_frame=newpos;
|
||||
frames->current_filepos=newpos*frames->frame_size;
|
||||
}
|
||||
|
||||
static int rawdv_check_file(demuxer_t *demuxer)
|
||||
{
|
||||
unsigned char tmp_buffer[DV_PAL_FRAME_SIZE];
|
||||
int bytes_read=0;
|
||||
int result=0;
|
||||
dv_decoder_t *td;
|
||||
|
||||
mp_msg(MSGT_DEMUX,MSGL_V,"Checking for DV\n");
|
||||
|
||||
bytes_read=stream_read(demuxer->stream,tmp_buffer,DV_PAL_FRAME_SIZE);
|
||||
if ((bytes_read!=DV_PAL_FRAME_SIZE) && (bytes_read!=DV_NTSC_FRAME_SIZE))
|
||||
return 0;
|
||||
|
||||
td=dv_decoder_new(TRUE,TRUE,FALSE);
|
||||
if (!td)
|
||||
return 0;
|
||||
|
||||
td->quality=DV_QUALITY_BEST;
|
||||
result=dv_parse_header(td, tmp_buffer);
|
||||
if (result<0)
|
||||
return 0;
|
||||
|
||||
if ((( td->num_dif_seqs==10) || (td->num_dif_seqs==12))
|
||||
&& (td->width==720)
|
||||
&& ((td->height==576) || (td->height==480)))
|
||||
result=1;
|
||||
dv_decoder_free(td);
|
||||
if (result)
|
||||
return DEMUXER_TYPE_RAWDV;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
// return value:
|
||||
// 0 = EOF or no stream found
|
||||
// 1 = successfully read a packet
|
||||
static int demux_rawdv_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
|
||||
{
|
||||
rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
|
||||
demux_packet_t* dp_video=NULL;
|
||||
sh_video_t *sh_video = demuxer->video->sh;
|
||||
int bytes_read=0;
|
||||
// fprintf(stderr,"demux_rawdv_fill_buffer() seek to %llu, size: %d\n",frames->current_filepos,frames->frame_size);
|
||||
// fetch the frame from the file
|
||||
// first, position the file properly since ds_read_packet() doesn't
|
||||
// seem to do it, even though it takes a file offset as a parameter
|
||||
stream_seek(demuxer->stream, frames->current_filepos);
|
||||
|
||||
dp_video=new_demux_packet(frames->frame_size);
|
||||
bytes_read=stream_read(demuxer->stream,dp_video->buffer,frames->frame_size);
|
||||
if (bytes_read<frames->frame_size)
|
||||
return 0;
|
||||
dp_video->pts=frames->current_frame/sh_video->fps;
|
||||
dp_video->pos=frames->current_filepos;
|
||||
|
||||
if (demuxer->audio && demuxer->audio->id>=-1)
|
||||
{
|
||||
demux_packet_t* dp_audio=clone_demux_packet(dp_video);
|
||||
ds_add_packet(demuxer->audio,dp_audio);
|
||||
}
|
||||
ds_add_packet(demuxer->video,dp_video);
|
||||
// get the next frame ready
|
||||
frames->current_filepos+=frames->frame_size;
|
||||
frames->current_frame++;
|
||||
// fprintf(stderr," audio->packs: %d , video->packs: %d \n",demuxer->audio->packs, demuxer->video->packs);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static demuxer_t* demux_open_rawdv(demuxer_t* demuxer)
|
||||
{
|
||||
unsigned char dv_frame[DV_PAL_FRAME_SIZE];
|
||||
sh_video_t *sh_video = NULL;
|
||||
rawdv_frames_t *frames = malloc(sizeof(rawdv_frames_t));
|
||||
dv_decoder_t *dv_decoder=NULL;
|
||||
|
||||
mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() end_pos %"PRId64"\n",(int64_t)demuxer->stream->end_pos);
|
||||
|
||||
// go back to the beginning
|
||||
stream_reset(demuxer->stream);
|
||||
stream_seek(demuxer->stream, 0);
|
||||
|
||||
//get the first frame
|
||||
stream_read(demuxer->stream, dv_frame, DV_PAL_FRAME_SIZE);
|
||||
|
||||
//read params from this frame
|
||||
dv_decoder=dv_decoder_new(TRUE,TRUE,FALSE);
|
||||
dv_decoder->quality=DV_QUALITY_BEST;
|
||||
|
||||
if (dv_parse_header(dv_decoder, dv_frame) == -1)
|
||||
return NULL;
|
||||
|
||||
// create a new video stream header
|
||||
sh_video = new_sh_video(demuxer, 0);
|
||||
if (!sh_video)
|
||||
return NULL;
|
||||
|
||||
// make sure the demuxer knows about the new video stream header
|
||||
// (even though new_sh_video() ought to take care of it)
|
||||
demuxer->seekable = 1;
|
||||
demuxer->video->sh = sh_video;
|
||||
|
||||
// make sure that the video demuxer stream header knows about its
|
||||
// parent video demuxer stream (this is getting wacky), or else
|
||||
// video_read_properties() will choke
|
||||
sh_video->ds = demuxer->video;
|
||||
|
||||
// custom fourcc for internal MPlayer use
|
||||
// sh_video->format = mmioFOURCC('R', 'A', 'D', 'V');
|
||||
sh_video->format = mmioFOURCC('D', 'V', 'S', 'D');
|
||||
|
||||
sh_video->disp_w = dv_decoder->width;
|
||||
sh_video->disp_h = dv_decoder->height;
|
||||
mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() frame_size: %d w: %d h: %d dif_seq: %d system: %d\n",dv_decoder->frame_size,dv_decoder->width, dv_decoder->height,dv_decoder->num_dif_seqs,dv_decoder->system);
|
||||
|
||||
sh_video->fps= (dv_decoder->system==e_dv_system_525_60?29.97:25);
|
||||
sh_video->frametime = 1.0/sh_video->fps;
|
||||
|
||||
// emulate BITMAPINFOHEADER for win32 decoders:
|
||||
sh_video->bih=calloc(1, sizeof(*sh_video->bih));
|
||||
sh_video->bih->biSize=40;
|
||||
sh_video->bih->biWidth = dv_decoder->width;
|
||||
sh_video->bih->biHeight = dv_decoder->height;
|
||||
sh_video->bih->biPlanes=1;
|
||||
sh_video->bih->biBitCount=24;
|
||||
sh_video->bih->biCompression=sh_video->format; // "DVSD"
|
||||
sh_video->bih->biSizeImage=sh_video->bih->biWidth*sh_video->bih->biHeight*3;
|
||||
|
||||
|
||||
frames->current_filepos=0;
|
||||
frames->current_frame=0;
|
||||
frames->frame_size=dv_decoder->frame_size;
|
||||
frames->frame_number=demuxer->stream->end_pos/frames->frame_size;
|
||||
|
||||
mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() seek to %llu, size: %d, dv_dec->frame_size: %d\n",frames->current_filepos,frames->frame_size, dv_decoder->frame_size);
|
||||
if (dv_decoder->audio != NULL && demuxer->audio->id>=-1){
|
||||
sh_audio_t *sh_audio = new_sh_audio(demuxer, 0);
|
||||
demuxer->audio->id = 0;
|
||||
demuxer->audio->sh = sh_audio;
|
||||
sh_audio->ds = demuxer->audio;
|
||||
mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() chan: %d samplerate: %d\n",dv_decoder->audio->num_channels,dv_decoder->audio->frequency );
|
||||
// custom fourcc for internal MPlayer use
|
||||
sh_audio->format = mmioFOURCC('R', 'A', 'D', 'V');
|
||||
|
||||
sh_audio->wf = calloc(1, sizeof(*sh_audio->wf));
|
||||
sh_audio->wf->wFormatTag = sh_audio->format;
|
||||
sh_audio->wf->nChannels = dv_decoder->audio->num_channels;
|
||||
sh_audio->wf->wBitsPerSample = 16;
|
||||
sh_audio->wf->nSamplesPerSec = dv_decoder->audio->frequency;
|
||||
// info about the input stream:
|
||||
sh_audio->wf->nAvgBytesPerSec = sh_video->fps*dv_decoder->frame_size;
|
||||
sh_audio->wf->nBlockAlign = dv_decoder->frame_size;
|
||||
|
||||
// sh_audio->context=(void*)dv_decoder;
|
||||
}
|
||||
stream_reset(demuxer->stream);
|
||||
stream_seek(demuxer->stream, 0);
|
||||
dv_decoder_free(dv_decoder); //we keep this in the context of both stream headers
|
||||
demuxer->priv=frames;
|
||||
return demuxer;
|
||||
}
|
||||
|
||||
static void demux_close_rawdv(demuxer_t* demuxer)
|
||||
{
|
||||
rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
|
||||
|
||||
if(frames==0)
|
||||
return;
|
||||
free(frames);
|
||||
}
|
||||
|
||||
static int demux_rawdv_control(demuxer_t *demuxer,int cmd, void *arg) {
|
||||
rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
|
||||
sh_video_t *sh_video=demuxer->video->sh;
|
||||
|
||||
switch(cmd) {
|
||||
case DEMUXER_CTRL_GET_TIME_LENGTH:
|
||||
*((double *)arg)=(double)frames->frame_number / sh_video->fps;
|
||||
return DEMUXER_CTRL_OK;
|
||||
|
||||
case DEMUXER_CTRL_GET_PERCENT_POS:
|
||||
*((int *)arg)=(int)(frames->current_frame * 100. / frames->frame_number);
|
||||
return DEMUXER_CTRL_OK;
|
||||
|
||||
default:
|
||||
return DEMUXER_CTRL_NOTIMPL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const demuxer_desc_t demuxer_desc_rawdv = {
|
||||
"Raw DV demuxer",
|
||||
"rawdv",
|
||||
"RAWDV",
|
||||
"Alexander Neundorf",
|
||||
"",
|
||||
DEMUXER_TYPE_RAWDV,
|
||||
0, // unsafe autodetect
|
||||
rawdv_check_file,
|
||||
demux_rawdv_fill_buffer,
|
||||
demux_open_rawdv,
|
||||
demux_close_rawdv,
|
||||
demux_seek_rawdv,
|
||||
demux_rawdv_control
|
||||
};
|
@ -60,7 +60,6 @@ extern const demuxer_desc_t demuxer_desc_avi;
|
||||
extern const demuxer_desc_t demuxer_desc_asf;
|
||||
extern const demuxer_desc_t demuxer_desc_matroska;
|
||||
extern const demuxer_desc_t demuxer_desc_gif;
|
||||
extern const demuxer_desc_t demuxer_desc_rawdv;
|
||||
extern const demuxer_desc_t demuxer_desc_lavf;
|
||||
extern const demuxer_desc_t demuxer_desc_lavf_preferred;
|
||||
extern const demuxer_desc_t demuxer_desc_mng;
|
||||
@ -86,9 +85,6 @@ const demuxer_desc_t *const demuxer_list[] = {
|
||||
&demuxer_desc_gif,
|
||||
#endif
|
||||
&demuxer_desc_lavf,
|
||||
#ifdef CONFIG_LIBDV095
|
||||
&demuxer_desc_rawdv,
|
||||
#endif
|
||||
#ifdef CONFIG_MNG
|
||||
&demuxer_desc_mng,
|
||||
#endif
|
||||
|
@ -53,7 +53,6 @@ enum demuxer_type {
|
||||
DEMUXER_TYPE_Y4M,
|
||||
DEMUXER_TYPE_MF,
|
||||
DEMUXER_TYPE_RAWAUDIO,
|
||||
DEMUXER_TYPE_RAWDV,
|
||||
DEMUXER_TYPE_RAWVIDEO,
|
||||
DEMUXER_TYPE_GIF,
|
||||
DEMUXER_TYPE_MPEG_TS,
|
||||
|
Loading…
Reference in New Issue
Block a user