|
|
|
|
/*****************************************************************************
|
|
|
|
|
* copy.c
|
|
|
|
|
*****************************************************************************
|
LGPL
Re-license almost all the playback modules to LGPLv2.1+ with
authorization from their respective contributors (230+)
This includes:
- access, codec, packetizers, demux
- audio filters, audio mixers, audio output
- video filters, video chroma, video output
- text renderers
- XML parser
- ARM NEON and SSE2 optimisations (mostly for chromas and filters)
Some modules are not concerned:
- BDA and DShow access modules because Manol Manolov is AWOL
- Real RTSP, because it is derived from Xine
- x264 and t140 because they are encoders only
- DLL Loader, because it is derived from MPlayer
- DTS packetizer, because Jon Lech Johansen is AWOL
- Shine and WMAfixed, because they are derived from Rockbox
- Real demuxer, as it is derived from MPlayer and Wang Bo is AWOL
- MPC demuxer, as Yavor Doganov is AWOL
- Tivo demuxer, because it is derived from an MPlayer fork
- Playlist demuxer, (WPL and ZPL parts missing), because suheaven is AWOL
- iOS audio output and video display, because author refuses the license change
- Equalizer and compressor, because Ronald Wright is AWOL
- Mono, Headphone and Dolby, because author refuses the license change
- hqdn3d and yadif, because they are from MPlayer/libavfilter
- remoteosd, because it derives from RealVNC code
- MMX optimisations, because Ollie Lho, from SiS, is AWOL
- Rotate, because it depends on GPL motion
Nota Bene:
- Some modules depend on GPL-only libraries, a LGPL module does not mean
that the resulting binary module will be LGPL.
Libraries affected would include liba52, libdvdcss, libdvdnav, libdvdread,
faad2, libdca, libmad, libmpeg2, libpostproc, SRC, sid, zvbi and probably others.
14 years ago
|
|
|
* Copyright (C) 2001, 2002, 2006 VLC authors and VideoLAN
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
|
|
|
|
* Eric Petit <titer@videolan.org>
|
|
|
|
|
*
|
LGPL
Re-license almost all the playback modules to LGPLv2.1+ with
authorization from their respective contributors (230+)
This includes:
- access, codec, packetizers, demux
- audio filters, audio mixers, audio output
- video filters, video chroma, video output
- text renderers
- XML parser
- ARM NEON and SSE2 optimisations (mostly for chromas and filters)
Some modules are not concerned:
- BDA and DShow access modules because Manol Manolov is AWOL
- Real RTSP, because it is derived from Xine
- x264 and t140 because they are encoders only
- DLL Loader, because it is derived from MPlayer
- DTS packetizer, because Jon Lech Johansen is AWOL
- Shine and WMAfixed, because they are derived from Rockbox
- Real demuxer, as it is derived from MPlayer and Wang Bo is AWOL
- MPC demuxer, as Yavor Doganov is AWOL
- Tivo demuxer, because it is derived from an MPlayer fork
- Playlist demuxer, (WPL and ZPL parts missing), because suheaven is AWOL
- iOS audio output and video display, because author refuses the license change
- Equalizer and compressor, because Ronald Wright is AWOL
- Mono, Headphone and Dolby, because author refuses the license change
- hqdn3d and yadif, because they are from MPlayer/libavfilter
- remoteosd, because it derives from RealVNC code
- MMX optimisations, because Ollie Lho, from SiS, is AWOL
- Rotate, because it depends on GPL motion
Nota Bene:
- Some modules depend on GPL-only libraries, a LGPL module does not mean
that the resulting binary module will be LGPL.
Libraries affected would include liba52, libdvdcss, libdvdnav, libdvdread,
faad2, libdca, libmad, libmpeg2, libpostproc, SRC, sid, zvbi and probably others.
14 years ago
|
|
|
* This program 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.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
LGPL
Re-license almost all the playback modules to LGPLv2.1+ with
authorization from their respective contributors (230+)
This includes:
- access, codec, packetizers, demux
- audio filters, audio mixers, audio output
- video filters, video chroma, video output
- text renderers
- XML parser
- ARM NEON and SSE2 optimisations (mostly for chromas and filters)
Some modules are not concerned:
- BDA and DShow access modules because Manol Manolov is AWOL
- Real RTSP, because it is derived from Xine
- x264 and t140 because they are encoders only
- DLL Loader, because it is derived from MPlayer
- DTS packetizer, because Jon Lech Johansen is AWOL
- Shine and WMAfixed, because they are derived from Rockbox
- Real demuxer, as it is derived from MPlayer and Wang Bo is AWOL
- MPC demuxer, as Yavor Doganov is AWOL
- Tivo demuxer, because it is derived from an MPlayer fork
- Playlist demuxer, (WPL and ZPL parts missing), because suheaven is AWOL
- iOS audio output and video display, because author refuses the license change
- Equalizer and compressor, because Ronald Wright is AWOL
- Mono, Headphone and Dolby, because author refuses the license change
- hqdn3d and yadif, because they are from MPlayer/libavfilter
- remoteosd, because it derives from RealVNC code
- MMX optimisations, because Ollie Lho, from SiS, is AWOL
- Rotate, because it depends on GPL motion
Nota Bene:
- Some modules depend on GPL-only libraries, a LGPL module does not mean
that the resulting binary module will be LGPL.
Libraries affected would include liba52, libdvdcss, libdvdnav, libdvdread,
faad2, libdca, libmad, libmpeg2, libpostproc, SRC, sid, zvbi and probably others.
14 years ago
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
|
*
|
LGPL
Re-license almost all the playback modules to LGPLv2.1+ with
authorization from their respective contributors (230+)
This includes:
- access, codec, packetizers, demux
- audio filters, audio mixers, audio output
- video filters, video chroma, video output
- text renderers
- XML parser
- ARM NEON and SSE2 optimisations (mostly for chromas and filters)
Some modules are not concerned:
- BDA and DShow access modules because Manol Manolov is AWOL
- Real RTSP, because it is derived from Xine
- x264 and t140 because they are encoders only
- DLL Loader, because it is derived from MPlayer
- DTS packetizer, because Jon Lech Johansen is AWOL
- Shine and WMAfixed, because they are derived from Rockbox
- Real demuxer, as it is derived from MPlayer and Wang Bo is AWOL
- MPC demuxer, as Yavor Doganov is AWOL
- Tivo demuxer, because it is derived from an MPlayer fork
- Playlist demuxer, (WPL and ZPL parts missing), because suheaven is AWOL
- iOS audio output and video display, because author refuses the license change
- Equalizer and compressor, because Ronald Wright is AWOL
- Mono, Headphone and Dolby, because author refuses the license change
- hqdn3d and yadif, because they are from MPlayer/libavfilter
- remoteosd, because it derives from RealVNC code
- MMX optimisations, because Ollie Lho, from SiS, is AWOL
- Rotate, because it depends on GPL motion
Nota Bene:
- Some modules depend on GPL-only libraries, a LGPL module does not mean
that the resulting binary module will be LGPL.
Libraries affected would include liba52, libdvdcss, libdvdnav, libdvdread,
faad2, libdca, libmad, libmpeg2, libpostproc, SRC, sid, zvbi and probably others.
14 years ago
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* Preamble
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
# include "config.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <vlc_common.h>
|
|
|
|
|
#include <vlc_plugin.h>
|
|
|
|
|
#include <vlc_codec.h>
|
|
|
|
|
#include <vlc_block.h>
|
|
|
|
|
#include <vlc_bits.h>
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* Module descriptor
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static int Open ( vlc_object_t * );
|
|
|
|
|
static void Close( vlc_object_t * );
|
|
|
|
|
|
|
|
|
|
vlc_module_begin ()
|
|
|
|
|
set_category( CAT_SOUT )
|
|
|
|
|
set_subcategory( SUBCAT_SOUT_PACKETIZER )
|
|
|
|
|
set_description( N_("Copy packetizer") )
|
|
|
|
|
set_capability( "packetizer", 1 )
|
|
|
|
|
set_callbacks( Open, Close )
|
|
|
|
|
vlc_module_end ()
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* Local prototypes
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
struct decoder_sys_t
|
|
|
|
|
{
|
|
|
|
|
block_t *p_block;
|
|
|
|
|
void (*pf_parse)( decoder_t *, block_t * );
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static block_t *Packetize ( decoder_t *, block_t ** );
|
|
|
|
|
static block_t *PacketizeSub( decoder_t *, block_t ** );
|
|
|
|
|
static void Flush( decoder_t * );
|
|
|
|
|
|
|
|
|
|
static void ParseWMV3( decoder_t *, block_t * );
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* Open: probe the packetizer and return score
|
|
|
|
|
*****************************************************************************
|
|
|
|
|
* Tries to launch a decoder and return score so that the interface is able
|
|
|
|
|
* to choose.
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static int Open( vlc_object_t *p_this )
|
|
|
|
|
{
|
|
|
|
|
decoder_t *p_dec = (decoder_t*)p_this;
|
|
|
|
|
decoder_sys_t *p_sys;
|
|
|
|
|
|
|
|
|
|
if( p_dec->fmt_in.i_cat != AUDIO_ES &&
|
|
|
|
|
p_dec->fmt_in.i_cat != VIDEO_ES &&
|
|
|
|
|
p_dec->fmt_in.i_cat != SPU_ES )
|
|
|
|
|
{
|
|
|
|
|
msg_Err( p_dec, "invalid ES type" );
|
|
|
|
|
return VLC_EGENERIC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( p_dec->fmt_in.i_cat == SPU_ES )
|
|
|
|
|
p_dec->pf_packetize = PacketizeSub;
|
|
|
|
|
else
|
|
|
|
|
p_dec->pf_packetize = Packetize;
|
|
|
|
|
p_dec->pf_flush = Flush;
|
|
|
|
|
|
|
|
|
|
p_dec->p_sys = p_sys = malloc( sizeof(*p_sys) );
|
|
|
|
|
if (unlikely(p_sys == NULL))
|
|
|
|
|
return VLC_ENOMEM;
|
|
|
|
|
|
|
|
|
|
p_sys->p_block = NULL;
|
|
|
|
|
switch( p_dec->fmt_in.i_codec )
|
|
|
|
|
{
|
|
|
|
|
case VLC_CODEC_WMV3:
|
|
|
|
|
p_sys->pf_parse = ParseWMV3;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
p_sys->pf_parse = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
* all: new sout scheme. Now a chain of module are created that can
modify/apply on all streams, --sout has the same behavour expect when
starting with a '#'.
With a starting '#' you can specify a chain of modules, it's still
unstable but a lot more powerfull.
You have access to duplicate(that duplicate all stream), transcode
(using only ffmpeg), standard/std and es (that apply muxers and access),
and display. You could chain them with ':' and specify options with
{option1=value,option2=value[,...]}.
ex: * to stream and see the stream to udp/ts:ip
--sout '#duplicate{dst=display,dst=std{access=udp,mux=ts,url=ip}}'
* to transcode,see and stream
--sout '#transcode{acodec=mpga}:duplicate{dst=display,dst=std{access=udp,mux=ts,url=ip}}'
Without a starting '#', the url is converted into '#std{acces=,mux=,url}'
Test and report bugs :)
24 years ago
|
|
|
|
|
|
|
|
vlc_fourcc_t fcc = p_dec->fmt_in.i_codec;
|
|
|
|
|
/* Fix the value of the fourcc for audio */
|
|
|
|
|
if( p_dec->fmt_in.i_cat == AUDIO_ES )
|
|
|
|
|
{
|
|
|
|
|
fcc = vlc_fourcc_GetCodecAudio( p_dec->fmt_in.i_codec,
|
|
|
|
|
p_dec->fmt_in.audio.i_bitspersample );
|
|
|
|
|
if( !fcc )
|
|
|
|
|
{
|
|
|
|
|
msg_Err( p_dec, "unknown raw audio sample size" );
|
|
|
|
|
free( p_sys );
|
|
|
|
|
return VLC_EGENERIC;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create the output format */
|
|
|
|
|
es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
|
|
|
|
|
p_dec->fmt_out.i_codec = fcc;
|
|
|
|
|
|
|
|
|
|
return VLC_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* Close:
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static void Close( vlc_object_t *p_this )
|
|
|
|
|
{
|
|
|
|
|
decoder_t *p_dec = (decoder_t*)p_this;
|
|
|
|
|
|
|
|
|
|
if( p_dec->p_sys->p_block )
|
|
|
|
|
{
|
|
|
|
|
block_ChainRelease( p_dec->p_sys->p_block );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free( p_dec->p_sys );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Flush( decoder_t *p_dec )
|
|
|
|
|
{
|
|
|
|
|
block_t *p_ret = p_dec->p_sys->p_block;
|
|
|
|
|
if ( p_ret )
|
|
|
|
|
{
|
|
|
|
|
block_Release( p_ret );
|
|
|
|
|
p_dec->p_sys->p_block = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* Packetize: packetize an unit (here copy a complete block )
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
|
|
|
|
|
{
|
|
|
|
|
block_t *p_block;
|
|
|
|
|
block_t *p_ret = p_dec->p_sys->p_block;
|
|
|
|
|
|
|
|
|
|
if( pp_block == NULL || *pp_block == NULL )
|
|
|
|
|
return NULL;
|
|
|
|
|
if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
|
|
|
|
|
{
|
|
|
|
|
block_Release( *pp_block );
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p_block = *pp_block;
|
|
|
|
|
*pp_block = NULL;
|
|
|
|
|
|
|
|
|
|
if( p_block->i_dts <= VLC_TS_INVALID )
|
|
|
|
|
{
|
|
|
|
|
p_block->i_dts = p_block->i_pts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( p_block->i_dts <= VLC_TS_INVALID )
|
|
|
|
|
{
|
|
|
|
|
msg_Dbg( p_dec, "need valid dts" );
|
|
|
|
|
block_Release( p_block );
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
* v4l: updated, now it should grab (and compress if you want) the video.
Audio grabbing part is commented out and untested.
The syntax is like that:
v4l:<device>[:option=value:...]
options: channel,norm (pal, ntsc,secam), frequency (not really there is
a factor), audio, size (WxH or subqcif,qsif,qcif,sif,cif,vga),
codec (optional, mpeg1 or mpeg4 and need to have compiled the
encoders modules)
ex: v4l:/dev/video:channel=0:frequency=8052:norm=secam:size=vga
Please test.
* rawvideo.c: a pseudo decoder for raw video (I420).
* packetizer/*, mux/*, stream_output.c: fixed (I hope) audio/video
synchro problems.
24 years ago
|
|
|
|
|
|
|
|
if( p_ret != NULL && p_block->i_pts > p_ret->i_pts )
|
|
|
|
|
{
|
|
|
|
|
if (p_dec->fmt_in.i_codec != VLC_CODEC_OPUS)
|
|
|
|
|
p_ret->i_length = p_block->i_pts - p_ret->i_pts;
|
|
|
|
|
}
|
|
|
|
|
p_dec->p_sys->p_block = p_block;
|
|
|
|
|
|
|
|
|
|
if( p_ret && p_dec->p_sys->pf_parse )
|
|
|
|
|
p_dec->p_sys->pf_parse( p_dec, p_ret );
|
|
|
|
|
return p_ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
* PacketizeSub: packetize an unit (here copy a complete block )
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
static block_t *PacketizeSub( decoder_t *p_dec, block_t **pp_block )
|
|
|
|
|
{
|
|
|
|
|
block_t *p_block;
|
|
|
|
|
|
|
|
|
|
if( pp_block == NULL || *pp_block == NULL )
|
|
|
|
|
return NULL;
|
|
|
|
|
if( (*pp_block)->i_flags&(BLOCK_FLAG_CORRUPTED) )
|
|
|
|
|
{
|
|
|
|
|
block_Release( *pp_block );
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p_block = *pp_block;
|
|
|
|
|
*pp_block = NULL;
|
|
|
|
|
|
|
|
|
|
if( p_block->i_dts <= VLC_TS_INVALID )
|
|
|
|
|
{
|
|
|
|
|
p_block->i_dts = p_block->i_pts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( p_block->i_dts <= VLC_TS_INVALID )
|
|
|
|
|
{
|
|
|
|
|
msg_Dbg( p_dec, "need valid dts" );
|
|
|
|
|
block_Release( p_block );
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return p_block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Parse WMV3 packet and extract frame type information */
|
|
|
|
|
static void ParseWMV3( decoder_t *p_dec, block_t *p_block )
|
|
|
|
|
{
|
|
|
|
|
bs_t s;
|
|
|
|
|
|
|
|
|
|
/* Parse Sequence header */
|
|
|
|
|
bs_init( &s, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
|
|
|
|
|
if( bs_read( &s, 2 ) == 3 )
|
|
|
|
|
return;
|
|
|
|
|
bs_skip( &s, 22 );
|
|
|
|
|
const bool b_range_reduction = bs_read( &s, 1 );
|
|
|
|
|
const bool b_has_frames = bs_read( &s, 3 ) > 0;
|
|
|
|
|
bs_skip( &s, 2 );
|
|
|
|
|
const bool b_frame_interpolation = bs_read( &s, 1 );
|
|
|
|
|
if( bs_eof( &s ) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Parse frame type */
|
|
|
|
|
bs_init( &s, p_block->p_buffer, p_block->i_buffer );
|
|
|
|
|
bs_skip( &s, b_frame_interpolation +
|
|
|
|
|
2 +
|
|
|
|
|
b_range_reduction );
|
|
|
|
|
|
|
|
|
|
p_block->i_flags &= ~BLOCK_FLAG_TYPE_MASK;
|
|
|
|
|
if( bs_read( &s, 1 ) )
|
|
|
|
|
p_block->i_flags |= BLOCK_FLAG_TYPE_P;
|
|
|
|
|
else if( !b_has_frames || bs_read( &s, 1 ) )
|
|
|
|
|
p_block->i_flags |= BLOCK_FLAG_TYPE_I;
|
|
|
|
|
else
|
|
|
|
|
p_block->i_flags |= BLOCK_FLAG_TYPE_B;
|
|
|
|
|
}
|
|
|
|
|
|