/*
* FLV muxer
- * Copyright (c) 2003 The Libav Project
+ * Copyright (c) 2003 The FFmpeg Project
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg 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 Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
#include "flv.h"
AVCodecContext *audio_enc = NULL, *video_enc = NULL;
int i;
double framerate = 0.0;
- int metadata_size_pos, data_size;
+ int64_t metadata_size_pos, data_size;
AVDictionaryEntry *tag = NULL;
for(i=0; i<s->nb_streams; i++){
flags = enc->codec_tag;
if(flags == 0) {
- av_log(enc, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id);
+ av_log(enc, AV_LOG_ERROR, "video codec %s not compatible with flv\n", avcodec_get_name(enc->codec_id));
return -1;
}
}
if (!flv->delay && pkt->dts < 0)
flv->delay = -pkt->dts;
+ } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 &&
+ (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
+ av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");
+ return -1;
}
ts = pkt->dts + flv->delay; // add delay to force positive dts
}
AVOutputFormat ff_flv_muxer = {
- "flv",
- NULL_IF_CONFIG_SMALL("FLV format"),
- "video/x-flv",
- "flv",
- sizeof(FLVContext),
+ .name = "flv",
+ .long_name = NULL_IF_CONFIG_SMALL("FLV format"),
+ .mime_type = "video/x-flv",
+ .extensions = "flv",
+ .priv_data_size = sizeof(FLVContext),
#if CONFIG_LIBMP3LAME
- CODEC_ID_MP3,
+ .audio_codec = CODEC_ID_MP3,
#else // CONFIG_LIBMP3LAME
- CODEC_ID_ADPCM_SWF,
+ .audio_codec = CODEC_ID_ADPCM_SWF,
#endif // CONFIG_LIBMP3LAME
- CODEC_ID_FLV1,
- flv_write_header,
- flv_write_packet,
- flv_write_trailer,
+ .video_codec = CODEC_ID_FLV1,
+ .write_header = flv_write_header,
+ .write_packet = flv_write_packet,
+ .write_trailer = flv_write_trailer,
.codec_tag= (const AVCodecTag* const []){flv_video_codec_ids, flv_audio_codec_ids, 0},
.flags= AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
};