On Mon, Apr 06, 2015 at 02:52:24PM -0700, Vignesh Venkatasubramanian wrote: > On Mon, Apr 6, 2015 at 2:25 PM, Michael Niedermayer <michae...@gmx.at> wrote: > > On Mon, Apr 06, 2015 at 11:19:36AM -0700, Vignesh Venkatasubramanian wrote: > >> On Sat, Apr 4, 2015 at 3:38 PM, Michael Niedermayer <michae...@gmx.at> > >> wrote: > >> > On Mon, Mar 30, 2015 at 02:46:10PM -0700, Vignesh Venkatasubramanian > >> > wrote: > >> >> This patch adds support for WebM Live Muxing by adding a new WebM > >> >> Chunk muxer. It writes out live WebM Chunks which can be used for > >> >> playback using Live DASH Clients. > >> >> > >> >> Please see muxers.texi for sample usage. > >> > > >> > [...] > >> > > >> >> diff --git a/libavformat/version.h b/libavformat/version.h > >> >> index a183d7f..ff85227 100644 > >> >> --- a/libavformat/version.h > >> >> +++ b/libavformat/version.h > >> >> @@ -30,7 +30,7 @@ > >> >> #include "libavutil/version.h" > >> >> > >> >> #define LIBAVFORMAT_VERSION_MAJOR 56 > >> >> -#define LIBAVFORMAT_VERSION_MINOR 26 > >> >> +#define LIBAVFORMAT_VERSION_MINOR 27 > >> >> #define LIBAVFORMAT_VERSION_MICRO 101 > >> >> > >> >> #define LIBAVFORMAT_VERSION_INT > >> >> AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ > >> >> diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c > >> >> new file mode 100644 > >> >> index 0000000..48ea6f0 > >> >> --- /dev/null > >> >> +++ b/libavformat/webm_chunk.c > >> >> @@ -0,0 +1,262 @@ > >> >> +/* > >> >> + * Copyright (c) 2015, Vignesh Venkatasubramanian > >> >> + * > >> >> + * This file is part of FFmpeg. > >> >> + * > >> >> + * 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. > >> >> + * > >> >> + * 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 FFmpeg; if not, write to the Free Software > >> >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > >> >> 02110-1301 USA > >> >> + */ > >> >> + > >> >> +/** > >> >> + * @file WebM Chunk Muxer > >> >> + * The chunk muxer enables writing WebM Live chunks where there is a > >> >> header > >> >> + * chunk, followed by data chunks where each Cluster is written out as > >> >> a Chunk. > >> >> + */ > >> >> + > >> >> +#include <float.h> > >> >> +#include <time.h> > >> >> + > >> >> +#include "avformat.h" > >> >> +#include "avio.h" > >> >> +#include "internal.h" > >> >> + > >> >> +#include "libavutil/avassert.h" > >> >> +#include "libavutil/log.h" > >> >> +#include "libavutil/opt.h" > >> >> +#include "libavutil/avstring.h" > >> >> +#include "libavutil/parseutils.h" > >> >> +#include "libavutil/mathematics.h" > >> >> +#include "libavutil/time.h" > >> >> +#include "libavutil/time_internal.h" > >> >> +#include "libavutil/timestamp.h" > >> >> + > >> >> +typedef struct WebMChunkContext { > >> >> + const AVClass *class; > >> >> + int chunk_start_index; > >> >> + char *header_filename; > >> >> + int chunk_duration; > >> >> + int chunk_count; > >> >> + int chunk_index; > >> >> + uint64_t duration_written; > >> >> + int prev_pts; > >> >> + AVOutputFormat *oformat; > >> >> + AVFormatContext *avf; > >> >> +} WebMChunkContext; > >> >> + > >> >> +static int chunk_mux_init(AVFormatContext *s) > >> >> +{ > >> >> + WebMChunkContext *wc = s->priv_data; > >> >> + AVFormatContext *oc; > >> >> + int ret; > >> >> + > >> >> + ret = avformat_alloc_output_context2(&wc->avf, wc->oformat, NULL, > >> >> NULL); > >> >> + if (ret < 0) > >> >> + return ret; > >> >> + oc = wc->avf; > >> >> + > >> >> + oc->interrupt_callback = s->interrupt_callback; > >> >> + oc->max_delay = s->max_delay; > >> >> + av_dict_copy(&oc->metadata, s->metadata, 0); > >> >> + > >> >> + oc->priv_data = av_mallocz(oc->oformat->priv_data_size); > >> >> + if (!oc->priv_data) { > >> >> + avio_close(oc->pb); > >> >> + return AVERROR(ENOMEM); > >> >> + } > >> >> + *(const AVClass**)oc->priv_data = oc->oformat->priv_class; > >> >> + av_opt_set_defaults(oc->priv_data); > >> >> + av_opt_set_int(oc->priv_data, "dash", 1, 0); > >> >> + av_opt_set_int(oc->priv_data, "cluster_time_limit", > >> >> wc->chunk_duration, 0); > >> >> + av_opt_set_int(oc->priv_data, "live", 1, 0); > >> >> + > >> > > >> >> + oc->streams = s->streams; > >> >> + oc->nb_streams = s->nb_streams; > >> > > >> > why doesnt the code use avformat_new_stream() and avcodec_copy_context() > >> > see hlsenc/segment muxers for examples > >> > > >> > or is there a reason why this would not work or be hard ? > >> > > >> > >> it seems unnecessary to make a copy of the stream and codec context > >> when it can be used safely within this file without duplication. is > >> there something wrong with that line of thought? > > > > well, it feels a bit odd but if you prefer it? ill push it that way > > yes, i think it's fine then. thanks!
applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel