/*****************************************************************************
* asf.c: asf muxer module for vlc
*****************************************************************************
- * Copyright (C) 2003-2004 VideoLAN
+ * Copyright (C) 2003-2004, 2006 the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h>
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <vlc/vlc.h>
-#include <vlc/input.h>
-#include <vlc/sout.h>
+#include <vlc_sout.h>
+#include <vlc_block.h>
+#include <vlc_codecs.h>
-#include "codecs.h"
typedef GUID guid_t;
#define MAX_ASF_TRACKS 128
#define SOUT_CFG_PREFIX "sout-asf-"
#define TITLE_TEXT N_("Title")
-#define TITLE_LONGTEXT N_("Allows you to define the title that will be put " \
- "in ASF comments.")
+#define TITLE_LONGTEXT N_("Title to put in ASF comments." )
#define AUTHOR_TEXT N_("Author")
-#define AUTHOR_LONGTEXT N_("Allows you to define the author that will be put "\
- "in ASF comments.")
+#define AUTHOR_LONGTEXT N_("Author to put in ASF comments." )
#define COPYRIGHT_TEXT N_("Copyright")
-#define COPYRIGHT_LONGTEXT N_("Allows you to define the copyright string " \
- "that will be put in ASF comments.")
+#define COPYRIGHT_LONGTEXT N_("Copyright string to put in ASF comments." )
#define COMMENT_TEXT N_("Comment")
-#define COMMENT_LONGTEXT N_("Allows you to define the comment that will be " \
- "put in ASF comments.")
+#define COMMENT_LONGTEXT N_("Comment to put in ASF comments." )
#define RATING_TEXT N_("Rating")
-#define RATING_LONGTEXT N_("Allows you to define the \"rating\" that will " \
- "be put in ASF comments.")
+#define RATING_LONGTEXT N_("\"Rating\" to put in ASF comments." )
#define PACKETSIZE_TEXT N_("Packet Size")
-#define PACKETSIZE_LONGTEXT N_("The ASF packet size -- default is 4096 bytes")
+#define PACKETSIZE_LONGTEXT N_("ASF packet size -- default is 4096 bytes")
vlc_module_begin();
set_description( _("ASF muxer") );
/* codec information */
uint16_t i_tag; /* for audio */
vlc_fourcc_t i_fourcc; /* for video */
- char *psz_name; /* codec name */
+ const char *psz_name; /* codec name */
int i_blockalign; /* for audio only */
vlc_bool_t b_audio_correction;
static void bo_addle_u64( bo_t *, uint64_t );
static void bo_add_mem ( bo_t *, uint8_t *, int );
-static void bo_addle_str16( bo_t *, char * );
+static void bo_addle_str16( bo_t *, const char * );
/*****************************************************************************
* Open:
vlc_value_t val;
int i;
- msg_Dbg( p_mux, "Asf muxer opened" );
- sout_CfgParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
+ msg_Dbg( p_mux, "asf muxer opened" );
+ config_ChainParse( p_mux, SOUT_CFG_PREFIX, ppsz_sout_options, p_mux->p_cfg );
p_mux->pf_control = Control;
p_mux->pf_addstream = AddStream;
var_Get( p_mux, SOUT_CFG_PREFIX "rating", &val );
p_sys->psz_rating = val.psz_string;
- msg_Dbg( p_mux, "meta data: title='%s' author='%s' copyright='%s' "
- "comment='%s' rating='%s'",
+ msg_Dbg( p_mux, "meta data: title='%s', author='%s', copyright='%s', "
+ "comment='%s', rating='%s'",
p_sys->psz_title, p_sys->psz_author, p_sys->psz_copyright,
p_sys->psz_comment, p_sys->psz_rating );
}
/* rewrite header */
- if( !sout_AccessOutSeek( p_mux->p_access, 0 ) )
+ if( sout_AccessOutSeek( p_mux->p_access, 0 ) == VLC_SUCCESS )
{
out = asf_header_create( p_mux, VLC_FALSE );
sout_AccessOutWrite( p_mux->p_access, out );
msg_Dbg( p_mux, "adding input" );
if( p_sys->i_track >= MAX_ASF_TRACKS )
{
- msg_Dbg( p_mux, "cannot add this track (too much track)" );
+ msg_Dbg( p_mux, "cannot add this track (too much tracks)" );
return VLC_EGENERIC;
}
tk->psz_name = "A/52";
i_bitspersample = 0;
break;
+ case VLC_FOURCC( 'm', 'p', '4', 'a' ):
+ tk->i_tag = WAVE_FORMAT_AAC;
+ tk->psz_name = "MPEG-4 Audio";
+ i_bitspersample = 0;
+ break;
case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
#if 1
tk->psz_name = "MPEG Audio Layer 3";
}
else if( p_input->p_fmt->i_codec == VLC_FOURCC('W','M','V','1') )
{
- tk->psz_name = "Windows Media Video 1";
+ tk->psz_name = "Windows Media Video 7";
tk->i_fourcc = VLC_FOURCC( 'W', 'M', 'V', '1' );
}
else if( p_input->p_fmt->i_codec == VLC_FOURCC('W','M','V','2') )
{
- tk->psz_name = "Windows Media Video 2";
+ tk->psz_name = "Windows Media Video 8";
tk->i_fourcc = VLC_FOURCC( 'W', 'M', 'V', '2' );
}
else if( p_input->p_fmt->i_codec == VLC_FOURCC('W','M','V','3') )
{
- tk->psz_name = "Windows Media Video 3";
+ tk->psz_name = "Windows Media Video 9";
tk->i_fourcc = VLC_FOURCC( 'W', 'M', 'V', '3' );
}
+ else if( p_input->p_fmt->i_codec == VLC_FOURCC('h','2','6','4') )
+ {
+ tk->psz_name = "H.264/MPEG-4 AVC";
+ tk->i_fourcc = VLC_FOURCC('h','2','6','4');
+ }
else
{
tk->psz_name = _("Unknown Video");
*****************************************************************************/
static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
{
+ VLC_UNUSED(p_input);
msg_Dbg( p_mux, "removing input" );
return VLC_SUCCESS;
}
sout_input_t *p_input = p_mux->pp_inputs[i];
block_t *p_data;
- if( p_input->p_fifo->i_depth <= 0 )
+ if( block_FifoCount( p_input->p_fifo ) <= 0 )
{
if( p_input->p_fmt->i_cat == AUDIO_ES ||
p_input->p_fmt->i_cat == VIDEO_ES )
p_bo->i_buffer += i_size;
}
-static void bo_addle_str16( bo_t *bo, char *str )
+static void bo_addle_str16( bo_t *bo, const char *str )
{
bo_addle_u16( bo, strlen( str ) + 1 );
for( ;; )
}
}
-static void bo_addle_str16_nosize( bo_t *bo, char *str )
+static void bo_addle_str16_nosize( bo_t *bo, const char *str )
{
for( ;; )
{
{0x8cabdca1, 0xa947, 0x11cf, {0x8e, 0xe4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
static const guid_t asf_object_stream_properties_guid =
{0xB7DC0791, 0xA9B7, 0x11CF, {0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
-static const guid_t asf_object_header_extention_guid =
+static const guid_t asf_object_header_extension_guid =
{0x5FBF03B5, 0xA92E, 0x11CF, {0x8E, 0xE3, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
static const guid_t asf_object_stream_type_audio =
{0xF8699E40, 0x5B4D, 0x11CF, {0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B}};
bo_addle_u32( &bo, p_sys->i_packet_size ); /* packet size max */
bo_addle_u32( &bo, p_sys->i_bitrate ); /* maxbitrate */
- /* header extention */
+ /* header extension */
if( i_header_ext_size )
{
- bo_add_guid ( &bo, &asf_object_header_extention_guid );
+ bo_add_guid ( &bo, &asf_object_header_extension_guid );
bo_addle_u64( &bo, i_header_ext_size );
bo_add_guid ( &bo, &asf_guid_reserved_1 );
bo_addle_u16( &bo, 6 );
if( i_cm_size )
{
int64_t i_num, i_den;
- int i_dst_num, i_dst_den;
+ unsigned int i_dst_num, i_dst_den;
for( i = 0; i < p_sys->i_track; i++ )
if( p_sys->track[i].i_cat == VIDEO_ES ) break;
i_num = p_sys->track[i].fmt.video.i_aspect *
(int64_t)p_sys->track[i].fmt.video.i_height;
i_den = VOUT_ASPECT_FACTOR * p_sys->track[i].fmt.video.i_width;
- vlc_reduce( &i_dst_num, &i_dst_den, i_num, i_den, 0 );
+ vlc_ureduce( &i_dst_num, &i_dst_den, i_num, i_den, 0 );
msg_Dbg( p_mux, "pixel aspect-ratio: %i/%i", i_dst_num, i_dst_den );