[FFmpeg-devel] [PATCH] Make ffmpeg support generic data stream
Michael Niedermayer
michaelni
Wed Feb 16 20:37:15 CET 2011
On Wed, Feb 16, 2011 at 06:25:14PM +0100, Luca Barbato wrote:
> The patch is the first step to support -dcodec copy
> ---
> ffmpeg.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
> 1 files changed, 78 insertions(+), 7 deletions(-)
>
[...]
> @@ -3581,6 +3600,44 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx)
> audio_stream_copy = 0;
> }
>
> +static void new_data_stream(AVFormatContext *oc, int file_idx)
> +{
> + AVStream *st;
> + AVOutputStream *ost;
> + AVCodec *codec=NULL;
> + AVCodecContext *data_enc;
> +
> + st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
> + if (!st) {
> + fprintf(stderr, "Could not alloc stream\n");
> + ffmpeg_exit(1);
> + }
> + ost = new_output_stream(oc, file_idx);
> + data_enc = st->codec;
> + output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
> + if(!data_stream_copy){
> + ffmpeg_exit(1);
> + }
> + avcodec_get_context_defaults3(st->codec, codec);
> +
> + data_enc->codec_type = AVMEDIA_TYPE_DATA;
> +
> + if(data_codec_tag)
> + data_enc->codec_tag= data_codec_tag;
> +
> + if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
> + data_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
> + avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->flags |= CODEC_FLAG_GLOBAL_HEADER;
^^^^^^^^^^^^^^^^
copy and paste error
[...]
> @@ -3727,28 +3785,37 @@ static void opt_output_file(const char *filename)
> use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;
> use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;
> use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;
> + use_data = data_stream_copy || data_codec_name;
a file_oformat->data_codec field should be added at some pointg
[...]
> @@ -4306,6 +4375,8 @@ static const OptionDef options[] = {
> { "vpre", OPT_FUNC2 | HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_preset}, "set the video options to the indicated preset", "preset" },
> { "spre", OPT_FUNC2 | HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_preset}, "set the subtitle options to the indicated preset", "preset" },
> { "fpre", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_preset}, "set options from indicated preset file", "filename" },
> + /* data codec support */
> + { "dcodec", HAS_ARG | OPT_SUBTITLE, {(void*)opt_data_codec}, "force data codec ('copy' to copy stream)", "codec" },
^^^^^^^^^
another copy and paste error
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110216/beceebff/attachment.pgp>
More information about the ffmpeg-devel
mailing list