[FFmpeg-cvslog] pthread_frame: minor simplification to error handling
ffmpeg | branch: master | wm4 | Mon Mar 27 14:25:53 2017 +0200| [4cf1f68903cebcf6a6bede970f1b8f1509edf710] | committer: wm4 pthread_frame: minor simplification to error handling Get rid of the "ret" variable, and always use err. Report the packet as consumed if err is unset. This should be equivalent to the old code, which obviously required err=0 for p->result>=0 (and otherwise, p->result must have had the value err was last set to). The code block added by commit 32a5b631267 is also not needed anymore, because the new code strictly returns err if it's >=0. Reviewed-by: "Ronald S. Bultje" > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4cf1f68903cebcf6a6bede970f1b8f1509edf710 --- libavcodec/pthread_frame.c | 19 +-- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 295763a..5b5f5fb 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -468,7 +468,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx, FrameThreadContext *fctx = avctx->internal->thread_ctx; int finished = fctx->next_finished; PerThreadContext *p; -int err, ret = 0; +int err; /* release the async lock, permitting blocked hwaccel threads to * go forward while we are in this function */ @@ -496,7 +496,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx, if (fctx->delaying) { *got_picture_ptr=0; if (avpkt->size) { -ret = avpkt->size; +err = avpkt->size; goto finish; } } @@ -542,21 +542,12 @@ int ff_thread_decode_frame(AVCodecContext *avctx, fctx->next_finished = finished; -/* - * When no frame was found while flushing, but an error occurred in - * any thread, return it instead of 0. - * Otherwise the error can get lost. - */ -if (!avpkt->size && !*got_picture_ptr) -goto finish; - /* return the size of the consumed packet if no error occurred */ -ret = (p->result >= 0) ? avpkt->size : p->result; +if (err >= 0) +err = avpkt->size; finish: async_lock(fctx); -if (err < 0) -return err; -return ret; +return err; } void ff_thread_report_progress(ThreadFrame *f, int n, int field) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/avcodec: split audio encoding into a separate example
ffmpeg | branch: master | Anton Khirnov | Wed Oct 19 21:05:22 2016 +0200| [40aaa8dadfd1c69ff4460d04750e1403b5535a6d] | committer: Anton Khirnov examples/avcodec: split audio encoding into a separate example The four examples (audio/video encoding/decoding) are completely independent so it makes little sense to have them all in one file. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=40aaa8dadfd1c69ff4460d04750e1403b5535a6d --- configure | 2 + doc/Makefile| 3 +- doc/examples/avcodec.c | 170 --- doc/examples/encode_audio.c | 211 4 files changed, 215 insertions(+), 171 deletions(-) diff --git a/configure b/configure index 8c2b4fd..28567bb 100755 --- a/configure +++ b/configure @@ -1210,6 +1210,7 @@ COMPONENT_LIST=" EXAMPLE_LIST=" avcodec_example +encode_audio_example filter_audio_example metadata_example output_example @@ -2435,6 +2436,7 @@ scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer" # examples avcodec_example_deps="avcodec avutil" +encode_audio_example_deps="avcodec avutil" filter_audio_example_deps="avfilter avutil" metadata_example_deps="avformat avutil" output_example_deps="avcodec avformat avutil swscale" diff --git a/doc/Makefile b/doc/Makefile index c464a48..738e601 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -17,12 +17,13 @@ DOCS-$(CONFIG_TEXI2HTML)+= $(HTMLPAGES) DOCS = $(DOCS-yes) DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE) += avcodec +DOC_EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata DOC_EXAMPLES-$(CONFIG_OUTPUT_EXAMPLE) += output DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE) += qsvdec DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE)+= transcode_aac -ALL_DOC_EXAMPLES = avcodec filter_audio metadata output transcode_aac +ALL_DOC_EXAMPLES = avcodec encode_audio filter_audio metadata output transcode_aac DOC_EXAMPLES := $(DOC_EXAMPLES-yes:%=doc/examples/%$(EXESUF)) ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES:%=doc/examples/%$(EXESUF)) diff --git a/doc/examples/avcodec.c b/doc/examples/avcodec.c index 8fee552..63812d9 100644 --- a/doc/examples/avcodec.c +++ b/doc/examples/avcodec.c @@ -47,175 +47,6 @@ #define AUDIO_INBUF_SIZE 20480 #define AUDIO_REFILL_THRESH 4096 -/* check that a given sample format is supported by the encoder */ -static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) -{ -const enum AVSampleFormat *p = codec->sample_fmts; - -while (*p != AV_SAMPLE_FMT_NONE) { -if (*p == sample_fmt) -return 1; -p++; -} -return 0; -} - -/* just pick the highest supported samplerate */ -static int select_sample_rate(AVCodec *codec) -{ -const int *p; -int best_samplerate = 0; - -if (!codec->supported_samplerates) -return 44100; - -p = codec->supported_samplerates; -while (*p) { -best_samplerate = FFMAX(*p, best_samplerate); -p++; -} -return best_samplerate; -} - -/* select layout with the highest channel count */ -static int select_channel_layout(AVCodec *codec) -{ -const uint64_t *p; -uint64_t best_ch_layout = 0; -int best_nb_channels = 0; - -if (!codec->channel_layouts) -return AV_CH_LAYOUT_STEREO; - -p = codec->channel_layouts; -while (*p) { -int nb_channels = av_get_channel_layout_nb_channels(*p); - -if (nb_channels > best_nb_channels) { -best_ch_layout= *p; -best_nb_channels = nb_channels; -} -p++; -} -return best_ch_layout; -} - -/* - * Audio encoding example - */ -static void audio_encode_example(const char *filename) -{ -AVCodec *codec; -AVCodecContext *c= NULL; -AVFrame *frame; -AVPacket pkt; -int i, j, k, ret, got_output; -int buffer_size; -FILE *f; -uint16_t *samples; -float t, tincr; - -printf("Audio encoding\n"); - -/* find the MP2 encoder */ -codec = avcodec_find_encoder(AV_CODEC_ID_MP2); -if (!codec) { -fprintf(stderr, "codec not found\n"); -exit(1); -} - -c = avcodec_alloc_context3(codec); - -/* put sample parameters */ -c->bit_rate = 64000; - -/* check that the encoder supports s16 pcm input */ -c->sample_fmt = AV_SAMPLE_FMT_S16; -if (!check_sample_fmt(codec, c->sample_fmt)) { -fprintf(stderr, "encoder does not support %s", -av_get_sample_fmt_name(c->sample_fmt)); -exit(1); -} - -/* select other audio parameters supported by the encoder */ -c->sample_rate= select_sample_rate(codec); -c->channel_layout = select_channel_layout(codec); -c->channels = av_get_channel_layout_nb_channels(c->channel_layout); - -/* open it */ -i
[FFmpeg-cvslog] Merge commit '40aaa8dadfd1c69ff4460d04750e1403b5535a6d'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 13:29:00 2017 +0200| [b785af48687fa839fbc25045d2201335753304b3] | committer: Clément Bœsch Merge commit '40aaa8dadfd1c69ff4460d04750e1403b5535a6d' * commit '40aaa8dadfd1c69ff4460d04750e1403b5535a6d': examples/avcodec: split audio encoding into a separate example Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b785af48687fa839fbc25045d2201335753304b3 --- configure| 2 + doc/Makefile | 1 + doc/examples/.gitignore | 1 + doc/examples/Makefile| 3 +- doc/examples/decoding_encoding.c | 192 doc/examples/encode_audio.c | 235 +++ 6 files changed, 241 insertions(+), 193 deletions(-) diff --git a/configure b/configure index a84b126..bf1d2fe 100755 --- a/configure +++ b/configure @@ -1463,6 +1463,7 @@ EXAMPLE_LIST=" avio_reading_example decoding_encoding_example demuxing_decoding_example +encode_audio_example extract_mvs_example filter_audio_example filtering_audio_example @@ -3169,6 +3170,7 @@ avio_dir_cmd_deps="avformat avutil" avio_reading_deps="avformat avcodec avutil" decoding_encoding_example_deps="avcodec avformat avutil" demuxing_decoding_example_deps="avcodec avformat avutil" +encode_audio_example_deps="avcodec avutil" extract_mvs_example_deps="avcodec avformat avutil" filter_audio_example_deps="avfilter avutil" filtering_audio_example_deps="avfilter avcodec avformat avutil" diff --git a/doc/Makefile b/doc/Makefile index a180fbe..396d9e0 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -40,6 +40,7 @@ DOC_EXAMPLES-$(CONFIG_AVIO_DIR_CMD_EXAMPLE) += avio_dir_cmd DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading DOC_EXAMPLES-$(CONFIG_DECODING_ENCODING_EXAMPLE) += decoding_encoding DOC_EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding +DOC_EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio DOC_EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio diff --git a/doc/examples/.gitignore b/doc/examples/.gitignore index 430d3bf..1a6209b 100644 --- a/doc/examples/.gitignore +++ b/doc/examples/.gitignore @@ -2,6 +2,7 @@ /avio_reading /decoding_encoding /demuxing_decoding +/encode_audio /extract_mvs /filter_audio /filtering_audio diff --git a/doc/examples/Makefile b/doc/examples/Makefile index af38159..f76e5a2 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -15,6 +15,7 @@ EXAMPLES= avio_dir_cmd \ avio_reading \ decoding_encoding \ demuxing_decoding \ +encode_audio \ extract_mvs\ filtering_video\ filtering_audio\ @@ -31,7 +32,7 @@ OBJS=$(addsuffix .o,$(EXAMPLES)) # the following examples make explicit use of the math library avcodec: LDLIBS += -lm -decoding_encoding: LDLIBS += -lm +encode_audio: LDLIBS += -lm muxing:LDLIBS += -lm resampling_audio: LDLIBS += -lm diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c index 1c5a78a..f863bdf 100644 --- a/doc/examples/decoding_encoding.c +++ b/doc/examples/decoding_encoding.c @@ -44,197 +44,6 @@ #define AUDIO_INBUF_SIZE 20480 #define AUDIO_REFILL_THRESH 4096 -/* check that a given sample format is supported by the encoder */ -static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) -{ -const enum AVSampleFormat *p = codec->sample_fmts; - -while (*p != AV_SAMPLE_FMT_NONE) { -if (*p == sample_fmt) -return 1; -p++; -} -return 0; -} - -/* just pick the highest supported samplerate */ -static int select_sample_rate(AVCodec *codec) -{ -const int *p; -int best_samplerate = 0; - -if (!codec->supported_samplerates) -return 44100; - -p = codec->supported_samplerates; -while (*p) { -best_samplerate = FFMAX(*p, best_samplerate); -p++; -} -return best_samplerate; -} - -/* select layout with the highest channel count */ -static int select_channel_layout(AVCodec *codec) -{ -const uint64_t *p; -uint64_t best_ch_layout = 0; -int best_nb_channels = 0; - -if (!codec->channel_layouts) -return AV_CH_LAYOUT_STEREO; - -p = codec->channel_layouts; -while (*p) { -int nb_channels = av_get_channel_layout_nb_channels(*p); - -if (nb_channels > best_nb_channels) { -best_ch_layout= *p; -best_nb_channels = nb_channels; -} -p++; -} -return best_ch_layo
[FFmpeg-cvslog] Merge commit 'c00a11ab383ff276a2ab2fdba577945e48d465be'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 13:30:16 2017 +0200| [f38e7566c69bc6da35eb22e29384d202c87c054a] | committer: Clément Bœsch Merge commit 'c00a11ab383ff276a2ab2fdba577945e48d465be' * commit 'c00a11ab383ff276a2ab2fdba577945e48d465be': examples/encode_audio: constify AVCodec instances Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f38e7566c69bc6da35eb22e29384d202c87c054a --- doc/examples/encode_audio.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/examples/encode_audio.c b/doc/examples/encode_audio.c index 5932521..b788775 100644 --- a/doc/examples/encode_audio.c +++ b/doc/examples/encode_audio.c @@ -39,7 +39,7 @@ #include "libavutil/samplefmt.h" /* check that a given sample format is supported by the encoder */ -static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) +static int check_sample_fmt(const AVCodec *codec, enum AVSampleFormat sample_fmt) { const enum AVSampleFormat *p = codec->sample_fmts; @@ -52,7 +52,7 @@ static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) } /* just pick the highest supported samplerate */ -static int select_sample_rate(AVCodec *codec) +static int select_sample_rate(const AVCodec *codec) { const int *p; int best_samplerate = 0; @@ -69,7 +69,7 @@ static int select_sample_rate(AVCodec *codec) } /* select layout with the highest channel count */ -static int select_channel_layout(AVCodec *codec) +static int select_channel_layout(const AVCodec *codec) { const uint64_t *p; uint64_t best_ch_layout = 0; @@ -94,7 +94,7 @@ static int select_channel_layout(AVCodec *codec) int main(int argc, char **argv) { const char *filename; -AVCodec *codec; +const AVCodec *codec; AVCodecContext *c= NULL; AVFrame *frame; AVPacket pkt; == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/encode_audio: constify AVCodec instances
ffmpeg | branch: master | Anton Khirnov | Wed Oct 19 21:07:43 2016 +0200| [c00a11ab383ff276a2ab2fdba577945e48d465be] | committer: Anton Khirnov examples/encode_audio: constify AVCodec instances > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c00a11ab383ff276a2ab2fdba577945e48d465be --- doc/examples/encode_audio.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/examples/encode_audio.c b/doc/examples/encode_audio.c index cabe589..a8e0cd0 100644 --- a/doc/examples/encode_audio.c +++ b/doc/examples/encode_audio.c @@ -37,7 +37,7 @@ #include "libavutil/samplefmt.h" /* check that a given sample format is supported by the encoder */ -static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) +static int check_sample_fmt(const AVCodec *codec, enum AVSampleFormat sample_fmt) { const enum AVSampleFormat *p = codec->sample_fmts; @@ -50,7 +50,7 @@ static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) } /* just pick the highest supported samplerate */ -static int select_sample_rate(AVCodec *codec) +static int select_sample_rate(const AVCodec *codec) { const int *p; int best_samplerate = 0; @@ -67,7 +67,7 @@ static int select_sample_rate(AVCodec *codec) } /* select layout with the highest channel count */ -static int select_channel_layout(AVCodec *codec) +static int select_channel_layout(const AVCodec *codec) { const uint64_t *p; uint64_t best_ch_layout = 0; @@ -92,7 +92,7 @@ static int select_channel_layout(AVCodec *codec) int main(int argc, char **argv) { const char *filename; -AVCodec *codec; +const AVCodec *codec; AVCodecContext *c= NULL; AVFrame *frame; AVPacket pkt; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/encode_audio: use the AVFrame API for allocating the data
ffmpeg | branch: master | Anton Khirnov | Wed Oct 19 21:21:08 2016 +0200| [f76698e759a08e8d3b629c06edb0439f474e7fee] | committer: Anton Khirnov examples/encode_audio: use the AVFrame API for allocating the data It is simpler and more efficient. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f76698e759a08e8d3b629c06edb0439f474e7fee --- doc/examples/encode_audio.c | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/doc/examples/encode_audio.c b/doc/examples/encode_audio.c index a8e0cd0..db2440f 100644 --- a/doc/examples/encode_audio.c +++ b/doc/examples/encode_audio.c @@ -97,7 +97,6 @@ int main(int argc, char **argv) AVFrame *frame; AVPacket pkt; int i, j, k, ret, got_output; -int buffer_size; FILE *f; uint16_t *samples; float t, tincr; @@ -159,21 +158,10 @@ int main(int argc, char **argv) frame->format = c->sample_fmt; frame->channel_layout = c->channel_layout; -/* the codec gives us the frame size, in samples, - * we calculate the size of the samples buffer in bytes */ -buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size, - c->sample_fmt, 0); -samples = av_malloc(buffer_size); -if (!samples) { -fprintf(stderr, "could not allocate %d bytes for samples buffer\n", -buffer_size); -exit(1); -} -/* setup the data pointers in the AVFrame */ -ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, - (const uint8_t*)samples, buffer_size, 0); +/* allocate the data buffers */ +ret = av_frame_get_buffer(frame, 0); if (ret < 0) { -fprintf(stderr, "could not setup audio frame\n"); +fprintf(stderr, "could not allocate audio data buffers\n"); exit(1); } @@ -185,6 +173,13 @@ int main(int argc, char **argv) pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; +/* make sure the frame is writable -- makes a copy if the encoder + * kept a reference internally */ +ret = av_frame_make_writable(frame); +if (ret < 0) +exit(1); +samples = (uint16_t*)frame->data[0]; + for (j = 0; j < c->frame_size; j++) { samples[2*j] = (int)(sin(t) * 1); @@ -205,7 +200,6 @@ int main(int argc, char **argv) } fclose(f); -av_freep(&samples); av_frame_free(&frame); avcodec_free_context(&c); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'f76698e759a08e8d3b629c06edb0439f474e7fee'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 13:31:44 2017 +0200| [780cc080d85656429ba97426f35c7bc1f7f201bb] | committer: Clément Bœsch Merge commit 'f76698e759a08e8d3b629c06edb0439f474e7fee' * commit 'f76698e759a08e8d3b629c06edb0439f474e7fee': examples/encode_audio: use the AVFrame API for allocating the data Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=780cc080d85656429ba97426f35c7bc1f7f201bb --- doc/examples/encode_audio.c | 30 ++ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/doc/examples/encode_audio.c b/doc/examples/encode_audio.c index b788775..f3bb102 100644 --- a/doc/examples/encode_audio.c +++ b/doc/examples/encode_audio.c @@ -99,7 +99,6 @@ int main(int argc, char **argv) AVFrame *frame; AVPacket pkt; int i, j, k, ret, got_output; -int buffer_size; FILE *f; uint16_t *samples; float t, tincr; @@ -165,25 +164,10 @@ int main(int argc, char **argv) frame->format = c->sample_fmt; frame->channel_layout = c->channel_layout; -/* the codec gives us the frame size, in samples, - * we calculate the size of the samples buffer in bytes */ -buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size, - c->sample_fmt, 0); -if (buffer_size < 0) { -fprintf(stderr, "Could not get sample buffer size\n"); -exit(1); -} -samples = av_malloc(buffer_size); -if (!samples) { -fprintf(stderr, "Could not allocate %d bytes for samples buffer\n", -buffer_size); -exit(1); -} -/* setup the data pointers in the AVFrame */ -ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, - (const uint8_t*)samples, buffer_size, 0); +/* allocate the data buffers */ +ret = av_frame_get_buffer(frame, 0); if (ret < 0) { -fprintf(stderr, "Could not setup audio frame\n"); +fprintf(stderr, "Could not allocate audio data buffers\n"); exit(1); } @@ -195,6 +179,13 @@ int main(int argc, char **argv) pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; +/* make sure the frame is writable -- makes a copy if the encoder + * kept a reference internally */ +ret = av_frame_make_writable(frame); +if (ret < 0) +exit(1); +samples = (uint16_t*)frame->data[0]; + for (j = 0; j < c->frame_size; j++) { samples[2*j] = (int)(sin(t) * 1); @@ -229,7 +220,6 @@ int main(int argc, char **argv) } fclose(f); -av_freep(&samples); av_frame_free(&frame); avcodec_free_context(&c); } == diff --cc doc/examples/encode_audio.c index b788775,db2440f..f3bb102 --- a/doc/examples/encode_audio.c +++ b/doc/examples/encode_audio.c @@@ -165,25 -158,10 +164,10 @@@ int main(int argc, char **argv frame->format = c->sample_fmt; frame->channel_layout = c->channel_layout; - /* the codec gives us the frame size, in samples, - * we calculate the size of the samples buffer in bytes */ - buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size, - c->sample_fmt, 0); - if (buffer_size < 0) { - fprintf(stderr, "Could not get sample buffer size\n"); - exit(1); - } - samples = av_malloc(buffer_size); - if (!samples) { - fprintf(stderr, "Could not allocate %d bytes for samples buffer\n", - buffer_size); - exit(1); - } - /* setup the data pointers in the AVFrame */ - ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, -(const uint8_t*)samples, buffer_size, 0); + /* allocate the data buffers */ + ret = av_frame_get_buffer(frame, 0); if (ret < 0) { - fprintf(stderr, "Could not setup audio frame\n"); -fprintf(stderr, "could not allocate audio data buffers\n"); ++fprintf(stderr, "Could not allocate audio data buffers\n"); exit(1); } @@@ -213,23 -198,8 +204,22 @@@ av_packet_unref(&pkt); } } + +/* get the delayed frames */ +for (got_output = 1; got_output; i++) { +ret = avcodec_encode_audio2(c, &pkt, NULL, &got_output); +if (ret < 0) { +fprintf(stderr, "Error encoding frame\n"); +exit(1); +} + +if (got_output) { +fwrite(pkt.data, 1, pkt.size, f); +av_packet_unref(&pkt); +} +} fclose(f); - av_freep(&samples); av_frame_free(&frame); avcodec_free_context(&c); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org ht
[FFmpeg-cvslog] examples/avcodec: split audio decoding into a separate example
ffmpeg | branch: master | Anton Khirnov | Wed Oct 19 21:05:22 2016 +0200| [f5df897c4b61985e3afc89ba1290649712ff438e] | committer: Anton Khirnov examples/avcodec: split audio decoding into a separate example The four examples (audio/video encoding/decoding) are completely independent so it makes little sense to have them all in one file. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f5df897c4b61985e3afc89ba1290649712ff438e --- configure | 2 + doc/Makefile| 4 +- doc/examples/avcodec.c | 97 --- doc/examples/decode_audio.c | 137 4 files changed, 142 insertions(+), 98 deletions(-) diff --git a/configure b/configure index 28567bb..b19e3e1 100755 --- a/configure +++ b/configure @@ -1210,6 +1210,7 @@ COMPONENT_LIST=" EXAMPLE_LIST=" avcodec_example +decode_audio_example encode_audio_example filter_audio_example metadata_example @@ -2436,6 +2437,7 @@ scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer" # examples avcodec_example_deps="avcodec avutil" +decode_audio_example_deps="avcodec avutil" encode_audio_example_deps="avcodec avutil" filter_audio_example_deps="avfilter avutil" metadata_example_deps="avformat avutil" diff --git a/doc/Makefile b/doc/Makefile index 738e601..326bb12 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -17,13 +17,15 @@ DOCS-$(CONFIG_TEXI2HTML)+= $(HTMLPAGES) DOCS = $(DOCS-yes) DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE) += avcodec +DOC_EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio DOC_EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata DOC_EXAMPLES-$(CONFIG_OUTPUT_EXAMPLE) += output DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE) += qsvdec DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE)+= transcode_aac -ALL_DOC_EXAMPLES = avcodec encode_audio filter_audio metadata output transcode_aac +ALL_DOC_EXAMPLES = avcodec decode_audio encode_audio filter_audio metadata \ + output transcode_aac DOC_EXAMPLES := $(DOC_EXAMPLES-yes:%=doc/examples/%$(EXESUF)) ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES:%=doc/examples/%$(EXESUF)) diff --git a/doc/examples/avcodec.c b/doc/examples/avcodec.c index 63812d9..4f7dc8b 100644 --- a/doc/examples/avcodec.c +++ b/doc/examples/avcodec.c @@ -44,100 +44,6 @@ #include "libavutil/samplefmt.h" #define INBUF_SIZE 4096 -#define AUDIO_INBUF_SIZE 20480 -#define AUDIO_REFILL_THRESH 4096 - -/* - * Audio decoding. - */ -static void audio_decode_example(const char *outfilename, const char *filename) -{ -AVCodec *codec; -AVCodecContext *c= NULL; -int len; -FILE *f, *outfile; -uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; -AVPacket avpkt; -AVFrame *decoded_frame = NULL; - -av_init_packet(&avpkt); - -printf("Audio decoding\n"); - -/* find the MPEG audio decoder */ -codec = avcodec_find_decoder(AV_CODEC_ID_MP2); -if (!codec) { -fprintf(stderr, "codec not found\n"); -exit(1); -} - -c = avcodec_alloc_context3(codec); - -/* open it */ -if (avcodec_open2(c, codec, NULL) < 0) { -fprintf(stderr, "could not open codec\n"); -exit(1); -} - -f = fopen(filename, "rb"); -if (!f) { -fprintf(stderr, "could not open %s\n", filename); -exit(1); -} -outfile = fopen(outfilename, "wb"); -if (!outfile) { -av_free(c); -exit(1); -} - -/* decode until eof */ -avpkt.data = inbuf; -avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f); - -while (avpkt.size > 0) { -int got_frame = 0; - -if (!decoded_frame) { -if (!(decoded_frame = av_frame_alloc())) { -fprintf(stderr, "out of memory\n"); -exit(1); -} -} - -len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); -if (len < 0) { -fprintf(stderr, "Error while decoding\n"); -exit(1); -} -if (got_frame) { -/* if a frame has been decoded, output it */ -int data_size = av_samples_get_buffer_size(NULL, c->channels, - decoded_frame->nb_samples, - c->sample_fmt, 1); -fwrite(decoded_frame->data[0], 1, data_size, outfile); -} -avpkt.size -= len; -avpkt.data += len; -if (avpkt.size < AUDIO_REFILL_THRESH) { -/* Refill the input buffer, to avoid trying to decode - * incomplete frames. Instead of this, one could also use - * a parser, or use a proper container format through - * libavformat. */ -memmove(inbuf, avp
[FFmpeg-cvslog] Merge commit 'f5df897c4b61985e3afc89ba1290649712ff438e'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 13:38:29 2017 +0200| [878070cc56065a6e0bc4aa2a73c6ac512bfa4d17] | committer: Clément Bœsch Merge commit 'f5df897c4b61985e3afc89ba1290649712ff438e' * commit 'f5df897c4b61985e3afc89ba1290649712ff438e': examples/avcodec: split audio decoding into a separate example Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=878070cc56065a6e0bc4aa2a73c6ac512bfa4d17 --- configure| 2 + doc/Makefile | 1 + doc/examples/.gitignore | 1 + doc/examples/Makefile| 1 + doc/examples/decode_audio.c | 151 +++ doc/examples/decoding_encoding.c | 108 6 files changed, 156 insertions(+), 108 deletions(-) diff --git a/configure b/configure index bf1d2fe..71a2734 100755 --- a/configure +++ b/configure @@ -1461,6 +1461,7 @@ COMPONENT_LIST=" EXAMPLE_LIST=" avio_dir_cmd_example avio_reading_example +decode_audio_example decoding_encoding_example demuxing_decoding_example encode_audio_example @@ -3168,6 +3169,7 @@ scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer" # examples avio_dir_cmd_deps="avformat avutil" avio_reading_deps="avformat avcodec avutil" +decode_audio_example_deps="avcodec avutil" decoding_encoding_example_deps="avcodec avformat avutil" demuxing_decoding_example_deps="avcodec avformat avutil" encode_audio_example_deps="avcodec avutil" diff --git a/doc/Makefile b/doc/Makefile index 396d9e0..d76139a 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -38,6 +38,7 @@ DOCS = $(DOCS-yes) DOC_EXAMPLES-$(CONFIG_AVIO_DIR_CMD_EXAMPLE) += avio_dir_cmd DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading +DOC_EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio DOC_EXAMPLES-$(CONFIG_DECODING_ENCODING_EXAMPLE) += decoding_encoding DOC_EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding DOC_EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio diff --git a/doc/examples/.gitignore b/doc/examples/.gitignore index 1a6209b..ee10e07 100644 --- a/doc/examples/.gitignore +++ b/doc/examples/.gitignore @@ -1,5 +1,6 @@ /avio_dir_cmd /avio_reading +/decode_audio /decoding_encoding /demuxing_decoding /encode_audio diff --git a/doc/examples/Makefile b/doc/examples/Makefile index f76e5a2..3f33c22 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -13,6 +13,7 @@ LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS) EXAMPLES= avio_dir_cmd \ avio_reading \ +decode_audio \ decoding_encoding \ demuxing_decoding \ encode_audio \ diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c new file mode 100644 index 000..738a188 --- /dev/null +++ b/doc/examples/decode_audio.c @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2001 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * @file + * audio decoding with libavcodec API example + * + * @example decode_audio.c + */ + +#include +#include +#include + +#include "libavcodec/avcodec.h" + +#include "libavutil/frame.h" + +#define AUDIO_INBUF_SIZE 20480 +#define AUDIO_REFILL_THRESH 4096 + +int main(int argc, char **argv) +{ +const char *outfilename, *filename; +AVCodec *codec; +AVCodecContext *c= NULL; +int len; +FILE *f, *outfile; +uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; +AVPacket avpkt; +AVFrame *decoded_frame = NULL; + +if (argc <= 2) { +fprintf(stderr, "Usage: %s \n", argv[0]); +exit(0); +} +filename= argv[1]; +outfilename = argv[2]; + +/* register all the codecs */ +avcodec
[FFmpeg-cvslog] doc/examples/encode_audio: add missing return
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 13:45:09 2017 +0200| [9bed10afb8b28f9aa8a90ab24b7103d9a35de3cc] | committer: Clément Bœsch doc/examples/encode_audio: add missing return > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9bed10afb8b28f9aa8a90ab24b7103d9a35de3cc --- doc/examples/encode_audio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/examples/encode_audio.c b/doc/examples/encode_audio.c index f3bb102..4f6371e 100644 --- a/doc/examples/encode_audio.c +++ b/doc/examples/encode_audio.c @@ -222,4 +222,6 @@ int main(int argc, char **argv) av_frame_free(&frame); avcodec_free_context(&c); + +return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '90265814f993098d79b0a0f40745ecdb403fbf56'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 13:45:51 2017 +0200| [dcdd52101f31f696dfe7a919d6fa6879c1b40945] | committer: Clément Bœsch Merge commit '90265814f993098d79b0a0f40745ecdb403fbf56' * commit '90265814f993098d79b0a0f40745ecdb403fbf56': examples/decode_audio: constify the AVCodec instance Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dcdd52101f31f696dfe7a919d6fa6879c1b40945 --- doc/examples/decode_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c index 738a188..a091cdc 100644 --- a/doc/examples/decode_audio.c +++ b/doc/examples/decode_audio.c @@ -41,7 +41,7 @@ int main(int argc, char **argv) { const char *outfilename, *filename; -AVCodec *codec; +const AVCodec *codec; AVCodecContext *c= NULL; int len; FILE *f, *outfile; == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/decode_audio: constify the AVCodec instance
ffmpeg | branch: master | Anton Khirnov | Wed Oct 19 21:56:22 2016 +0200| [90265814f993098d79b0a0f40745ecdb403fbf56] | committer: Anton Khirnov examples/decode_audio: constify the AVCodec instance > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90265814f993098d79b0a0f40745ecdb403fbf56 --- doc/examples/decode_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c index 4378281..647893c 100644 --- a/doc/examples/decode_audio.c +++ b/doc/examples/decode_audio.c @@ -39,7 +39,7 @@ int main(int argc, char **argv) { const char *outfilename, *filename; -AVCodec *codec; +const AVCodec *codec; AVCodecContext *c= NULL; int len; FILE *f, *outfile; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/avcodec: split the remaining two examples into separate files
ffmpeg | branch: master | Anton Khirnov | Wed Oct 19 21:05:22 2016 +0200| [7b1f03477f1a43d2261fbd83e50a4ad90c7f806d] | committer: Anton Khirnov examples/avcodec: split the remaining two examples into separate files > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b1f03477f1a43d2261fbd83e50a4ad90c7f806d --- configure | 6 +- doc/Makefile | 12 +- doc/examples/{avcodec.c => decode_video.c} | 176 +++-- doc/examples/encode_video.c| 164 +++ 4 files changed, 192 insertions(+), 166 deletions(-) diff --git a/configure b/configure index b19e3e1..9264bb5 100755 --- a/configure +++ b/configure @@ -1209,9 +1209,10 @@ COMPONENT_LIST=" " EXAMPLE_LIST=" -avcodec_example decode_audio_example +decode_video_example encode_audio_example +encode_video_example filter_audio_example metadata_example output_example @@ -2436,9 +2437,10 @@ scale_qsv_filter_deps="libmfx" scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer" # examples -avcodec_example_deps="avcodec avutil" decode_audio_example_deps="avcodec avutil" +decode_video_example_deps="avcodec avutil" encode_audio_example_deps="avcodec avutil" +encode_video_example_deps="avcodec avutil" filter_audio_example_deps="avfilter avutil" metadata_example_deps="avformat avutil" output_example_deps="avcodec avformat avutil swscale" diff --git a/doc/Makefile b/doc/Makefile index 326bb12..bda8153 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -16,16 +16,22 @@ DOCS-$(CONFIG_POD2MAN) += $(MANPAGES) $(PODPAGES) DOCS-$(CONFIG_TEXI2HTML)+= $(HTMLPAGES) DOCS = $(DOCS-yes) -DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE) += avcodec DOC_EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio +DOC_EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video DOC_EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio +DOC_EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata DOC_EXAMPLES-$(CONFIG_OUTPUT_EXAMPLE) += output DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE) += qsvdec DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE)+= transcode_aac -ALL_DOC_EXAMPLES = avcodec decode_audio encode_audio filter_audio metadata \ - output transcode_aac +ALL_DOC_EXAMPLES = decode_audio \ + decode_video \ + encode_audio \ + encode_video \ + filter_audio \ + metadata output \ + transcode_aac\ DOC_EXAMPLES := $(DOC_EXAMPLES-yes:%=doc/examples/%$(EXESUF)) ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES:%=doc/examples/%$(EXESUF)) diff --git a/doc/examples/avcodec.c b/doc/examples/decode_video.c similarity index 55% rename from doc/examples/avcodec.c rename to doc/examples/decode_video.c index 4f7dc8b..20d11da 100644 --- a/doc/examples/avcodec.c +++ b/doc/examples/decode_video.c @@ -20,159 +20,23 @@ /** * @file - * libavcodec API use example. + * video decoding with libavcodec API example * - * @example avcodec.c - * Note that this library only handles codecs (MPEG, MPEG-4, etc...), - * not file formats (AVI, VOB, etc...). See library 'libavformat' for the - * format handling. + * @example decode_video.c */ -#include #include +#include #include -#ifdef HAVE_AV_CONFIG_H -#undef HAVE_AV_CONFIG_H -#endif - #include "libavcodec/avcodec.h" -#include "libavutil/channel_layout.h" + #include "libavutil/common.h" #include "libavutil/imgutils.h" #include "libavutil/mathematics.h" -#include "libavutil/samplefmt.h" #define INBUF_SIZE 4096 -/* - * Video encoding example - */ -static void video_encode_example(const char *filename) -{ -AVCodec *codec; -AVCodecContext *c= NULL; -int i, ret, x, y, got_output; -FILE *f; -AVFrame *picture; -AVPacket pkt; -uint8_t endcode[] = { 0, 0, 1, 0xb7 }; - -printf("Video encoding\n"); - -/* find the mpeg1video encoder */ -codec = avcodec_find_encoder(AV_CODEC_ID_MPEG1VIDEO); -if (!codec) { -fprintf(stderr, "codec not found\n"); -exit(1); -} - -c = avcodec_alloc_context3(codec); -picture = av_frame_alloc(); - -/* put sample parameters */ -c->bit_rate = 40; -/* resolution must be a multiple of two */ -c->width = 352; -c->height = 288; -/* frames per second */ -c->time_base= (AVRational){1,25}; -c->gop_size = 10; /* emit one intra frame every ten frames */ -
[FFmpeg-cvslog] Merge commit '7b1f03477f1a43d2261fbd83e50a4ad90c7f806d'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:07:39 2017 +0200| [925ce244d873fb6a0cda0da6e1f8d34dc721ea53] | committer: Clément Bœsch Merge commit '7b1f03477f1a43d2261fbd83e50a4ad90c7f806d' * commit '7b1f03477f1a43d2261fbd83e50a4ad90c7f806d': examples/avcodec: split the remaining two examples into separate files Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=925ce244d873fb6a0cda0da6e1f8d34dc721ea53 --- configure| 6 +- doc/Makefile | 3 +- doc/examples/.gitignore | 3 +- doc/examples/Makefile| 3 +- doc/examples/decode_video.c | 182 doc/examples/decoding_encoding.c | 361 --- doc/examples/encode_video.c | 187 7 files changed, 379 insertions(+), 366 deletions(-) diff --git a/configure b/configure index 71a2734..a63169d 100755 --- a/configure +++ b/configure @@ -1462,9 +1462,10 @@ EXAMPLE_LIST=" avio_dir_cmd_example avio_reading_example decode_audio_example -decoding_encoding_example +decode_video_example demuxing_decoding_example encode_audio_example +encode_video_example extract_mvs_example filter_audio_example filtering_audio_example @@ -3170,9 +3171,10 @@ scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer" avio_dir_cmd_deps="avformat avutil" avio_reading_deps="avformat avcodec avutil" decode_audio_example_deps="avcodec avutil" -decoding_encoding_example_deps="avcodec avformat avutil" +decode_video_example_deps="avcodec avutil" demuxing_decoding_example_deps="avcodec avformat avutil" encode_audio_example_deps="avcodec avutil" +encode_video_example_deps="avcodec avutil" extract_mvs_example_deps="avcodec avformat avutil" filter_audio_example_deps="avfilter avutil" filtering_audio_example_deps="avfilter avcodec avformat avutil" diff --git a/doc/Makefile b/doc/Makefile index d76139a..c193fc3 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -39,9 +39,10 @@ DOCS = $(DOCS-yes) DOC_EXAMPLES-$(CONFIG_AVIO_DIR_CMD_EXAMPLE) += avio_dir_cmd DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading DOC_EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio -DOC_EXAMPLES-$(CONFIG_DECODING_ENCODING_EXAMPLE) += decoding_encoding +DOC_EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video DOC_EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding DOC_EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio +DOC_EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video DOC_EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio diff --git a/doc/examples/.gitignore b/doc/examples/.gitignore index ee10e07..6bd9dc1 100644 --- a/doc/examples/.gitignore +++ b/doc/examples/.gitignore @@ -1,9 +1,10 @@ /avio_dir_cmd /avio_reading /decode_audio -/decoding_encoding +/decode_video /demuxing_decoding /encode_audio +/encode_video /extract_mvs /filter_audio /filtering_audio diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 3f33c22..2d0a306 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -14,9 +14,10 @@ LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS) EXAMPLES= avio_dir_cmd \ avio_reading \ decode_audio \ -decoding_encoding \ +decode_video \ demuxing_decoding \ encode_audio \ +encode_video \ extract_mvs\ filtering_video\ filtering_audio\ diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c new file mode 100644 index 000..1597653 --- /dev/null +++ b/doc/examples/decode_video.c @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2001 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS F
[FFmpeg-cvslog] examples/encode_video: constify the AVCodec instance
ffmpeg | branch: master | Anton Khirnov | Thu Oct 20 11:03:20 2016 +0200| [e02524025bce2c8bf8b5bffd96479785c75a70d4] | committer: Anton Khirnov examples/encode_video: constify the AVCodec instance > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e02524025bce2c8bf8b5bffd96479785c75a70d4 --- doc/examples/encode_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c index ca93472..c5f3853f 100644 --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@ -37,7 +37,7 @@ int main(int argc, char **argv) { const char *filename; -AVCodec *codec; +const AVCodec *codec; AVCodecContext *c= NULL; int i, ret, x, y, got_output; FILE *f; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'e02524025bce2c8bf8b5bffd96479785c75a70d4'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:15:01 2017 +0200| [e9bd45746511ab3a5803bc1b3490f4d682144289] | committer: Clément Bœsch Merge commit 'e02524025bce2c8bf8b5bffd96479785c75a70d4' * commit 'e02524025bce2c8bf8b5bffd96479785c75a70d4': examples/encode_video: constify the AVCodec instance Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9bd45746511ab3a5803bc1b3490f4d682144289 --- doc/examples/encode_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c index 71c8c0b..265b529 100644 --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@ -39,7 +39,7 @@ int main(int argc, char **argv) { const char *filename, *codec_name; -AVCodec *codec; +const AVCodec *codec; AVCodecContext *c= NULL; int i, ret, x, y, got_output; FILE *f; == diff --cc doc/examples/encode_video.c index 71c8c0b,c5f3853f..265b529 --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@@ -38,8 -36,8 +38,8 @@@ int main(int argc, char **argv) { -const char *filename; +const char *filename, *codec_name; - AVCodec *codec; + const AVCodec *codec; AVCodecContext *c= NULL; int i, ret, x, y, got_output; FILE *f; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/encode_video: set the framerate
ffmpeg | branch: master | Anton Khirnov | Thu Oct 20 11:03:20 2016 +0200| [d0a603a534a0ee4b255e5e72742428a7f7f42b83] | committer: Anton Khirnov examples/encode_video: set the framerate > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d0a603a534a0ee4b255e5e72742428a7f7f42b83 --- doc/examples/encode_video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c index c5f3853f..b955cce 100644 --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@ -69,7 +69,9 @@ int main(int argc, char **argv) c->width = 352; c->height = 288; /* frames per second */ -c->time_base= (AVRational){1,25}; +c->time_base = (AVRational){1, 25}; +c->framerate = (AVRational){25, 1}; + c->gop_size = 10; /* emit one intra frame every ten frames */ c->max_b_frames=1; c->pix_fmt = AV_PIX_FMT_YUV420P; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'd0a603a534a0ee4b255e5e72742428a7f7f42b83'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:16:33 2017 +0200| [4726bbb471566f7d2a0c883210870871a17fe2e3] | committer: Clément Bœsch Merge commit 'd0a603a534a0ee4b255e5e72742428a7f7f42b83' * commit 'd0a603a534a0ee4b255e5e72742428a7f7f42b83': examples/encode_video: set the framerate Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4726bbb471566f7d2a0c883210870871a17fe2e3 --- doc/examples/encode_video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c index 265b529..ba6f2bf 100644 --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@ -75,7 +75,9 @@ int main(int argc, char **argv) c->width = 352; c->height = 288; /* frames per second */ -c->time_base = (AVRational){1,25}; +c->time_base = (AVRational){1, 25}; +c->framerate = (AVRational){25, 1}; + /* emit one intra frame every ten frames * check frame pict_type before passing frame * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I == diff --cc doc/examples/encode_video.c index 265b529,b955cce..ba6f2bf --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@@ -75,23 -69,16 +75,25 @@@ int main(int argc, char **argv c->width = 352; c->height = 288; /* frames per second */ - c->time_base = (AVRational){1,25}; + c->time_base = (AVRational){1, 25}; + c->framerate = (AVRational){25, 1}; + -c->gop_size = 10; /* emit one intra frame every ten frames */ -c->max_b_frames=1; +/* emit one intra frame every ten frames + * check frame pict_type before passing frame + * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I + * then gop_size is ignored and the output of encoder + * will always be I frame irrespective to gop_size + */ +c->gop_size = 10; +c->max_b_frames = 1; c->pix_fmt = AV_PIX_FMT_YUV420P; +if (codec->id == AV_CODEC_ID_H264) +av_opt_set(c->priv_data, "preset", "slow", 0); + /* open it */ if (avcodec_open2(c, codec, NULL) < 0) { -fprintf(stderr, "could not open codec\n"); +fprintf(stderr, "Could not open codec\n"); exit(1); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc/examples/{de,en}code_audio: fix includes
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:18:10 2017 +0200| [944e5ce3ec7d4d9cf36e3f5c628b4e71186fa93a] | committer: Clément Bœsch doc/examples/{de,en}code_audio: fix includes Consistent with other examples. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=944e5ce3ec7d4d9cf36e3f5c628b4e71186fa93a --- doc/examples/decode_audio.c | 4 ++-- doc/examples/encode_audio.c | 10 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/examples/decode_audio.c b/doc/examples/decode_audio.c index a091cdc..d9ee7e7 100644 --- a/doc/examples/decode_audio.c +++ b/doc/examples/decode_audio.c @@ -31,9 +31,9 @@ #include #include -#include "libavcodec/avcodec.h" +#include -#include "libavutil/frame.h" +#include #define AUDIO_INBUF_SIZE 20480 #define AUDIO_REFILL_THRESH 4096 diff --git a/doc/examples/encode_audio.c b/doc/examples/encode_audio.c index 4f6371e..88d0a6f 100644 --- a/doc/examples/encode_audio.c +++ b/doc/examples/encode_audio.c @@ -31,12 +31,12 @@ #include #include -#include "libavcodec/avcodec.h" +#include -#include "libavutil/channel_layout.h" -#include "libavutil/common.h" -#include "libavutil/frame.h" -#include "libavutil/samplefmt.h" +#include +#include +#include +#include /* check that a given sample format is supported by the encoder */ static int check_sample_fmt(const AVCodec *codec, enum AVSampleFormat sample_fmt) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '5b4d7ac7ae5d821cfa6ab89f8eab4d31851ef32c'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:20:25 2017 +0200| [58f24adc05b0ea47c3f7ed5cb9e8d5774e2fbaaf] | committer: Clément Bœsch Merge commit '5b4d7ac7ae5d821cfa6ab89f8eab4d31851ef32c' * commit '5b4d7ac7ae5d821cfa6ab89f8eab4d31851ef32c': examples/encode_video: use the AVFrame API for allocating the frame Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58f24adc05b0ea47c3f7ed5cb9e8d5774e2fbaaf --- doc/examples/encode_video.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c index ba6f2bf..fc576e0 100644 --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@ -112,12 +112,9 @@ int main(int argc, char **argv) frame->width = c->width; frame->height = c->height; -/* the image can be allocated by any means and av_image_alloc() is - * just the most convenient way if av_malloc() is to be used */ -ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height, - c->pix_fmt, 32); +ret = av_frame_get_buffer(frame, 32); if (ret < 0) { -fprintf(stderr, "Could not allocate raw picture buffer\n"); +fprintf(stderr, "Could not allocate the video frame data\n"); exit(1); } @@ -128,6 +125,12 @@ int main(int argc, char **argv) pkt.size = 0; fflush(stdout); + +/* make sure the frame data is writable */ +ret = av_frame_make_writable(frame); +if (ret < 0) +exit(1); + /* prepare a dummy image */ /* Y */ for (y = 0; y < c->height; y++) { @@ -182,7 +185,6 @@ int main(int argc, char **argv) fclose(f); avcodec_free_context(&c); -av_freep(&frame->data[0]); av_frame_free(&frame); return 0; == diff --cc doc/examples/encode_video.c index ba6f2bf,3fd2d56..fc576e0 --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@@ -103,21 -88,13 +103,18 @@@ int main(int argc, char **argv exit(1); } -picture->format = c->pix_fmt; -picture->width = c->width; -picture->height = c->height; +frame = av_frame_alloc(); +if (!frame) { +fprintf(stderr, "Could not allocate video frame\n"); +exit(1); +} +frame->format = c->pix_fmt; +frame->width = c->width; +frame->height = c->height; - /* the image can be allocated by any means and av_image_alloc() is - * just the most convenient way if av_malloc() is to be used */ - ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height, - c->pix_fmt, 32); -ret = av_frame_get_buffer(picture, 32); ++ret = av_frame_get_buffer(frame, 32); if (ret < 0) { - fprintf(stderr, "Could not allocate raw picture buffer\n"); -fprintf(stderr, "could not alloc the frame data\n"); ++fprintf(stderr, "Could not allocate the video frame data\n"); exit(1); } @@@ -128,11 -105,17 +125,17 @@@ pkt.size = 0; fflush(stdout); + + /* make sure the frame data is writable */ -ret = av_frame_make_writable(picture); ++ret = av_frame_make_writable(frame); + if (ret < 0) + exit(1); + /* prepare a dummy image */ /* Y */ -for(y=0;yheight;y++) { -for(x=0;xwidth;x++) { -picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3; +for (y = 0; y < c->height; y++) { +for (x = 0; x < c->width; x++) { +frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } @@@ -182,8 -165,7 +185,7 @@@ fclose(f); avcodec_free_context(&c); - av_freep(&frame->data[0]); -av_frame_free(&picture); +av_frame_free(&frame); return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/encode_video: use the AVFrame API for allocating the frame
ffmpeg | branch: master | Anton Khirnov | Thu Oct 20 11:03:20 2016 +0200| [5b4d7ac7ae5d821cfa6ab89f8eab4d31851ef32c] | committer: Anton Khirnov examples/encode_video: use the AVFrame API for allocating the frame It is more efficient and so preferred over allocating the buffers manually. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b4d7ac7ae5d821cfa6ab89f8eab4d31851ef32c --- doc/examples/encode_video.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c index b955cce..3fd2d56 100644 --- a/doc/examples/encode_video.c +++ b/doc/examples/encode_video.c @@ -88,16 +88,16 @@ int main(int argc, char **argv) exit(1); } -ret = av_image_alloc(picture->data, picture->linesize, c->width, c->height, - c->pix_fmt, 32); -if (ret < 0) { -fprintf(stderr, "could not alloc raw picture buffer\n"); -exit(1); -} picture->format = c->pix_fmt; picture->width = c->width; picture->height = c->height; +ret = av_frame_get_buffer(picture, 32); +if (ret < 0) { +fprintf(stderr, "could not alloc the frame data\n"); +exit(1); +} + /* encode 1 second of video */ for(i=0;i<25;i++) { av_init_packet(&pkt); @@ -105,6 +105,12 @@ int main(int argc, char **argv) pkt.size = 0; fflush(stdout); + +/* make sure the frame data is writable */ +ret = av_frame_make_writable(picture); +if (ret < 0) +exit(1); + /* prepare a dummy image */ /* Y */ for(y=0;yheight;y++) { @@ -159,7 +165,6 @@ int main(int argc, char **argv) fclose(f); avcodec_free_context(&c); -av_freep(&picture->data[0]); av_frame_free(&picture); return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/decode_video: constify the AVCodec instance
ffmpeg | branch: master | Anton Khirnov | Thu Oct 20 11:03:20 2016 +0200| [8191f960a669819db4de33a2439ded1630b8a73e] | committer: Anton Khirnov examples/decode_video: constify the AVCodec instance > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8191f960a669819db4de33a2439ded1630b8a73e --- doc/examples/decode_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c index 20d11da..4036dbe 100644 --- a/doc/examples/decode_video.c +++ b/doc/examples/decode_video.c @@ -53,7 +53,7 @@ static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, int main(int argc, char **argv) { const char *filename, *outfilename; -AVCodec *codec; +const AVCodec *codec; AVCodecContext *c= NULL; int frame, got_picture, len; FILE *f; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '8191f960a669819db4de33a2439ded1630b8a73e'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:22:32 2017 +0200| [fdbc29ca70a6f16c92a16cfcf3fdd639e0825b0d] | committer: Clément Bœsch Merge commit '8191f960a669819db4de33a2439ded1630b8a73e' * commit '8191f960a669819db4de33a2439ded1630b8a73e': examples/decode_video: constify the AVCodec instance Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fdbc29ca70a6f16c92a16cfcf3fdd639e0825b0d --- doc/examples/decode_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c index 1597653..dd1177b 100644 --- a/doc/examples/decode_video.c +++ b/doc/examples/decode_video.c @@ -79,7 +79,7 @@ static int decode_write_frame(const char *outfilename, AVCodecContext *avctx, int main(int argc, char **argv) { const char *filename, *outfilename; -AVCodec *codec; +const AVCodec *codec; AVCodecContext *c= NULL; int frame_count; FILE *f; == diff --cc doc/examples/decode_video.c index 1597653,4036dbe..dd1177b --- a/doc/examples/decode_video.c +++ b/doc/examples/decode_video.c @@@ -79,12 -53,13 +79,12 @@@ static int decode_write_frame(const cha int main(int argc, char **argv) { const char *filename, *outfilename; - AVCodec *codec; + const AVCodec *codec; AVCodecContext *c= NULL; -int frame, got_picture, len; +int frame_count; FILE *f; -AVFrame *picture; +AVFrame *frame; uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; -char buf[1024]; AVPacket avpkt; if (argc <= 2) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '636515c324facaa14ccd8ab0732740a240a31ba9'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:24:20 2017 +0200| [63c41c53f355d4a00d4601e6ee014e9c3ad3c289] | committer: Clément Bœsch Merge commit '636515c324facaa14ccd8ab0732740a240a31ba9' * commit '636515c324facaa14ccd8ab0732740a240a31ba9': examples/decode_video: remove a stray unrelated comment This commit is a noop, see 8c4753f7f5f1f65532e841cffa3b4fdb368c2fdf Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63c41c53f355d4a00d4601e6ee014e9c3ad3c289 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/decode_video: remove a stray unrelated comment
ffmpeg | branch: master | Anton Khirnov | Thu Oct 20 11:03:20 2016 +0200| [636515c324facaa14ccd8ab0732740a240a31ba9] | committer: Anton Khirnov examples/decode_video: remove a stray unrelated comment > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=636515c324facaa14ccd8ab0732740a240a31ba9 --- doc/examples/decode_video.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c index 4036dbe..43819ec 100644 --- a/doc/examples/decode_video.c +++ b/doc/examples/decode_video.c @@ -99,8 +99,6 @@ int main(int argc, char **argv) exit(1); } -/* the codec gives us the frame size, in samples */ - f = fopen(filename, "rb"); if (!f) { fprintf(stderr, "could not open %s\n", filename); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '85baef4ff1512bcc2544928bfa5f42072903a691'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:26:21 2017 +0200| [ca6f0f85bb783833f36db94fd912b96a0ef3899a] | committer: Clément Bœsch Merge commit '85baef4ff1512bcc2544928bfa5f42072903a691' * commit '85baef4ff1512bcc2544928bfa5f42072903a691': vf_drawtext: Move static keyword to beginning of variable declaration This commit is mostly a noop, see: d9e2aceb7f1c712a52672129ca7971872b030e1e 6d7aa437e1108dd8142ae5b850a00c109f95f07f Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca6f0f85bb783833f36db94fd912b96a0ef3899a --- libavfilter/vf_drawtext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index bcbe2d9..8b24f50 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -269,8 +269,7 @@ AVFILTER_DEFINE_CLASS(drawtext); #define FT_ERRORDEF(e, v, s) { (e), (s) }, #define FT_ERROR_END_LIST { 0, NULL } }; -static const struct ft_error -{ +static const struct ft_error { int err; const char *err_msg; } ft_errors[] = == diff --cc libavfilter/vf_drawtext.c index bcbe2d9,994eea3..8b24f50 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@@ -269,8 -219,7 +269,7 @@@ AVFILTER_DEFINE_CLASS(drawtext) #define FT_ERRORDEF(e, v, s) { (e), (s) }, #define FT_ERROR_END_LIST { 0, NULL } }; - static const struct ft_error - { -static struct ft_error { ++static const struct ft_error { int err; const char *err_msg; } ft_errors[] = ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] vf_drawtext: Move static keyword to beginning of variable declaration
ffmpeg | branch: master | Diego Biurrun | Fri Oct 30 15:02:04 2015 +0100| [85baef4ff1512bcc2544928bfa5f42072903a691] | committer: Diego Biurrun vf_drawtext: Move static keyword to beginning of variable declaration libavfilter/vf_drawtext.c:226:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=85baef4ff1512bcc2544928bfa5f42072903a691 --- libavfilter/vf_drawtext.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index e36cfa2..994eea3 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -219,11 +219,10 @@ static const AVClass drawtext_class = { #define FT_ERRORDEF(e, v, s) { (e), (s) }, #define FT_ERROR_END_LIST { 0, NULL } }; -struct ft_error -{ +static struct ft_error { int err; const char *err_msg; -} static ft_errors[] = +} ft_errors[] = #include FT_ERRORS_H #define FT_ERRMSG(e) ft_errors[e].err_msg ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aactab: Move extern keyword to the front of array declarations
ffmpeg | branch: master | Diego Biurrun | Mon Nov 9 13:25:55 2015 +0100| [39cea6570c11a49b64b2ec8d71e218db03b4c742] | committer: Diego Biurrun aactab: Move extern keyword to the front of array declarations libavcodec/aactab.h:49:1: warning: ‘extern’ is not at beginning of declaration [-Wold-style-declaration] > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39cea6570c11a49b64b2ec8d71e218db03b4c742 --- libavcodec/aactab.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h index fc26db8..b1e9510 100644 --- a/libavcodec/aactab.h +++ b/libavcodec/aactab.h @@ -46,8 +46,8 @@ */ DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_1024)[1024]; DECLARE_ALIGNED(32, extern float, ff_aac_kbd_short_128)[128]; -const DECLARE_ALIGNED(32, extern float, ff_aac_eld_window_512)[1920]; -const DECLARE_ALIGNED(32, extern float, ff_aac_eld_window_480)[1800]; +DECLARE_ALIGNED(32, extern const float, ff_aac_eld_window_512)[1920]; +DECLARE_ALIGNED(32, extern const float, ff_aac_eld_window_480)[1800]; // @} /* @name number of scalefactor window bands for long and short transform windows respectively ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '39cea6570c11a49b64b2ec8d71e218db03b4c742'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:34:58 2017 +0200| [35494441b5327d71e7a81896efd610408651c657] | committer: Clément Bœsch Merge commit '39cea6570c11a49b64b2ec8d71e218db03b4c742' * commit '39cea6570c11a49b64b2ec8d71e218db03b4c742': aactab: Move extern keyword to the front of array declarations Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35494441b5327d71e7a81896efd610408651c657 --- libavcodec/aactab.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h index a0d44a2..48ca0fd 100644 --- a/libavcodec/aactab.h +++ b/libavcodec/aactab.h @@ -139,10 +139,10 @@ DECLARE_ALIGNED(32, extern float, ff_aac_kbd_short_128)[128]; DECLARE_ALIGNED(32, extern int,ff_aac_kbd_long_1024_fixed)[1024]; DECLARE_ALIGNED(32, extern int,ff_aac_kbd_long_512_fixed)[512]; DECLARE_ALIGNED(32, extern int,ff_aac_kbd_short_128_fixed)[128]; -const DECLARE_ALIGNED(32, extern float, ff_aac_eld_window_512)[1920]; -const DECLARE_ALIGNED(32, extern int, ff_aac_eld_window_512_fixed)[1920]; -const DECLARE_ALIGNED(32, extern float, ff_aac_eld_window_480)[1800]; -const DECLARE_ALIGNED(32, extern int, ff_aac_eld_window_480_fixed)[1800]; +DECLARE_ALIGNED(32, extern const float, ff_aac_eld_window_512)[1920]; +DECLARE_ALIGNED(32, extern const int, ff_aac_eld_window_512_fixed)[1920]; +DECLARE_ALIGNED(32, extern const float, ff_aac_eld_window_480)[1800]; +DECLARE_ALIGNED(32, extern const int, ff_aac_eld_window_480_fixed)[1800]; // @} /* @name number of scalefactor window bands for long and short transform windows respectively == diff --cc libavcodec/aactab.h index a0d44a2,b1e9510..48ca0fd --- a/libavcodec/aactab.h +++ b/libavcodec/aactab.h @@@ -136,13 -46,8 +136,13 @@@ static const INTFLOAT * const tns_tmp2_ */ DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_1024)[1024]; DECLARE_ALIGNED(32, extern float, ff_aac_kbd_short_128)[128]; +DECLARE_ALIGNED(32, extern int,ff_aac_kbd_long_1024_fixed)[1024]; +DECLARE_ALIGNED(32, extern int,ff_aac_kbd_long_512_fixed)[512]; +DECLARE_ALIGNED(32, extern int,ff_aac_kbd_short_128_fixed)[128]; - const DECLARE_ALIGNED(32, extern float, ff_aac_eld_window_512)[1920]; - const DECLARE_ALIGNED(32, extern int, ff_aac_eld_window_512_fixed)[1920]; - const DECLARE_ALIGNED(32, extern float, ff_aac_eld_window_480)[1800]; - const DECLARE_ALIGNED(32, extern int, ff_aac_eld_window_480_fixed)[1800]; + DECLARE_ALIGNED(32, extern const float, ff_aac_eld_window_512)[1920]; ++DECLARE_ALIGNED(32, extern const int, ff_aac_eld_window_512_fixed)[1920]; + DECLARE_ALIGNED(32, extern const float, ff_aac_eld_window_480)[1800]; ++DECLARE_ALIGNED(32, extern const int, ff_aac_eld_window_480_fixed)[1800]; // @} /* @name number of scalefactor window bands for long and short transform windows respectively ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: deprecate av_get_codec_tag_string()
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 01:11:41 2017 +0200| [f156d35321bb600b2309b78185d600b2fa64d84a] | committer: Clément Bœsch lavc: deprecate av_get_codec_tag_string() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f156d35321bb600b2309b78185d600b2fa64d84a --- libavcodec/avcodec.h | 5 + libavcodec/version.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 4f33033..60f7ace 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -5667,6 +5667,7 @@ attribute_deprecated void avcodec_set_dimensions(AVCodecContext *s, int width, int height); #endif +#if FF_API_TAG_STRING /** * Put a string representing the codec tag codec_tag in buf. * @@ -5675,8 +5676,12 @@ void avcodec_set_dimensions(AVCodecContext *s, int width, int height); * @param codec_tag codec tag to assign * @return the length of the string that would have been generated if * enough space had been available, excluding the trailing null + * + * @deprecated see av_fourcc_make_string() and av_fourcc2str(). */ +attribute_deprecated size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); +#endif void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); diff --git a/libavcodec/version.h b/libavcodec/version.h index 37defbc..8dea5cb 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -235,6 +235,9 @@ #ifndef FF_API_MERGE_SD_API #define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_TAG_STRING +#define FF_API_TAG_STRING(LIBAVCODEC_VERSION_MAJOR < 59) +#endif #endif /* AVCODEC_VERSION_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: fix usages of av_get_codec_tag_string()
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 01:31:52 2017 +0200| [cd4d6cba122b2d79da8667fa787919b734fa8133] | committer: Clément Bœsch lavf: fix usages of av_get_codec_tag_string() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd4d6cba122b2d79da8667fa787919b734fa8133 --- libavformat/aiffdec.c | 8 +++- libavformat/apngdec.c | 8 ++-- libavformat/avidec.c | 8 ++-- libavformat/matroskadec.c | 7 ++- libavformat/movenc.c | 6 +- libavformat/mux.c | 7 +++ libavformat/rsd.c | 4 +--- libavformat/wavdec.c | 5 ++--- 8 files changed, 16 insertions(+), 37 deletions(-) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 7dcc85f..2ef9386 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -128,11 +128,9 @@ static int get_aiff_header(AVFormatContext *s, int size, } else if (version == AIFF_C_VERSION1) { par->codec_tag = avio_rl32(pb); par->codec_id = ff_codec_get_id(ff_codec_aiff_tags, par->codec_tag); -if (par->codec_id == AV_CODEC_ID_NONE) { -char tag[32]; -av_get_codec_tag_string(tag, sizeof(tag), par->codec_tag); -avpriv_request_sample(s, "unknown or unsupported codec tag: %s", tag); -} +if (par->codec_id == AV_CODEC_ID_NONE) +avpriv_request_sample(s, "unknown or unsupported codec tag: %s", + av_fourcc2str(par->codec_tag)); size -= 4; } diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c index 75dcf74..e1ea29b 100644 --- a/libavformat/apngdec.c +++ b/libavformat/apngdec.c @@ -404,13 +404,9 @@ static int apng_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; return 0; default: -{ -char tag_buf[32]; - -av_get_codec_tag_string(tag_buf, sizeof(tag_buf), tag); -avpriv_request_sample(s, "In-stream tag=%s (0x%08X) len=%"PRIu32, tag_buf, tag, len); +avpriv_request_sample(s, "In-stream tag=%s (0x%08X) len=%"PRIu32, + av_fourcc2str(tag), tag, len); avio_skip(pb, len + 4); -} } /* Handle the unsupported yet cases */ diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 788a3ab..31c33de 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -811,14 +811,12 @@ FF_ENABLE_DEPRECATION_WARNINGS tag1); /* If codec is not found yet, try with the mov tags. */ if (!st->codecpar->codec_id) { -char tag_buf[32]; -av_get_codec_tag_string(tag_buf, sizeof(tag_buf), tag1); st->codecpar->codec_id = ff_codec_get_id(ff_codec_movvideo_tags, tag1); if (st->codecpar->codec_id) av_log(s, AV_LOG_WARNING, "mov tag found in avi (fourcc %s)\n", - tag_buf); + av_fourcc2str(tag1)); } /* This is needed to get the pict type which is necessary * for generating correct pts. */ @@ -992,13 +990,11 @@ FF_ENABLE_DEPRECATION_WARNINGS } default: if (size > 100) { -char tag_buf[32]; -av_get_codec_tag_string(tag_buf, sizeof(tag_buf), tag); av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, " "tag %s has size %u, " "I will ignore it and try to continue anyway.\n", - tag_buf, size); + av_fourcc2str(tag), size); if (s->error_recognition & AV_EF_EXPLODE) goto fail; avi->movi_list = avio_tell(pb) - 4; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 2e3c9bf..2e2a814 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2212,12 +2212,9 @@ static int matroska_parse_tracks(AVFormatContext *s) fourcc = MKTAG('S','V','Q','3'); codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc); } -if (codec_id == AV_CODEC_ID_NONE) { -char buf[32]; -av_get_codec_tag_string(buf, sizeof(buf), fourcc); +if (codec_id == AV_CODEC_ID_NONE) av_log(matroska->ctx, AV_LOG_ERROR, - "mov FourCC not found %s.\n", buf); -} + "mov FourCC not found %s.\n", av_fourcc2str(fourcc)); if (track->codec_priv.size >= 86) { bit_depth = AV_RB16(track->codec_priv.data + 82); ffio_init_context(&b, track->codec_priv.data, diff --git a/libavf
[FFmpeg-cvslog] tools/fourcc2pixfmt: fix usages of av_get_codec_tag_string()
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 01:32:13 2017 +0200| [337c68d07142d1eeb540d73e2049896b9ab4f04e] | committer: Clément Bœsch tools/fourcc2pixfmt: fix usages of av_get_codec_tag_string() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=337c68d07142d1eeb540d73e2049896b9ab4f04e --- tools/fourcc2pixfmt.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tools/fourcc2pixfmt.c b/tools/fourcc2pixfmt.c index 625f531..75bb607 100644 --- a/tools/fourcc2pixfmt.c +++ b/tools/fourcc2pixfmt.c @@ -51,13 +51,9 @@ static void print_pix_fmt_fourccs(enum AVPixelFormat pix_fmt, const PixelFormatT { int i; -for (i = 0; pix_fmt_tags[i].pix_fmt != AV_PIX_FMT_NONE; i++) { -if (pix_fmt_tags[i].pix_fmt == pix_fmt) { -char buf[32]; -av_get_codec_tag_string(buf, sizeof(buf), pix_fmt_tags[i].fourcc); -printf("%s%c", buf, sep); -} -} +for (i = 0; pix_fmt_tags[i].pix_fmt != AV_PIX_FMT_NONE; i++) +if (pix_fmt_tags[i].pix_fmt == pix_fmt) +printf("%s%c", av_fourcc2str(pix_fmt_tags[i].fourcc), sep); } int main(int argc, char **argv) @@ -92,13 +88,10 @@ int main(int argc, char **argv) } } -if (list_fourcc_pix_fmt) { -for (i = 0; pix_fmt_tags[i].pix_fmt != AV_PIX_FMT_NONE; i++) { -char buf[32]; -av_get_codec_tag_string(buf, sizeof(buf), pix_fmt_tags[i].fourcc); -printf("%s: %s\n", buf, av_get_pix_fmt_name(pix_fmt_tags[i].pix_fmt)); -} -} +if (list_fourcc_pix_fmt) +for (i = 0; pix_fmt_tags[i].pix_fmt != AV_PIX_FMT_NONE; i++) +printf("%s: %s\n", av_fourcc2str(pix_fmt_tags[i].fourcc), + av_get_pix_fmt_name(pix_fmt_tags[i].pix_fmt)); if (list_pix_fmt_fourccs) { for (i = 0; av_pix_fmt_desc_get(i); i++) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/xbr: undef PI if defined
ffmpeg | branch: master | Clément Bœsch | Sun Mar 26 20:51:14 2017 +0200| [46068070314d56f66b681796635d38d497ef3bda] | committer: Clément Bœsch lavfi/xbr: undef PI if defined This conflict with the DJGPP libc math.h which includes a PI macro (to M_PI). We cannot make DJGPP POSIX only (using -D_POSIX_SOURCE) to avoid this kind of symbols conflicts due to the lack of both posix_memalign and memalign (DJGPP non standard function) in that POSIX mode. We currently rely on memalign for aligned heap allocation. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46068070314d56f66b681796635d38d497ef3bda --- libavfilter/vf_xbr.c | 4 1 file changed, 4 insertions(+) diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c index 9893e0c..d0d5104 100644 --- a/libavfilter/vf_xbr.c +++ b/libavfilter/vf_xbr.c @@ -37,6 +37,10 @@ #define RED_BLUE_MASK 0x00FF00FF #define GREEN_MASK0xFF00 +#ifdef PI +#undef PI +#endif + typedef int (*xbrfunc_t)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); typedef struct { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/pthread_slice: remove pointless condition
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 12:20:32 2017 +0200| [eaa67bb9c0595d2e2e7b555c38e864f5d6f851a7] | committer: Clément Bœsch lavc/pthread_slice: remove pointless condition > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eaa67bb9c0595d2e2e7b555c38e864f5d6f851a7 --- libavcodec/pthread_slice.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c index 96a7643..60f5b78 100644 --- a/libavcodec/pthread_slice.c +++ b/libavcodec/pthread_slice.c @@ -156,11 +156,7 @@ static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, i c->job_size = job_size; c->args = arg; c->func = func; -if (ret) { -c->rets = ret; -} else { -c->rets = NULL; -} +c->rets = ret; c->current_execute++; pthread_cond_broadcast(&c->current_job_cond); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/mem: clamp alignment to 16 for DJGPP
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 20:30:24 2017 +0200| [1473afac5d11a0a90810b6cd8107d63640c9fd38] | committer: Clément Bœsch lavu/mem: clamp alignment to 16 for DJGPP See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80208 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1473afac5d11a0a90810b6cd8107d63640c9fd38 --- libavutil/mem.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/mem.h b/libavutil/mem.h index 718a143..527cd03 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -97,6 +97,9 @@ #define DECLARE_ASM_CONST(n,t,v)\ AV_PRAGMA(DATA_ALIGN(v,n)) \ static const t __attribute__((aligned(n))) v +#elif defined(__DJGPP__) +#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16 v +#define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (FFMIN(n, 16 v #elif defined(__GNUC__) || defined(__clang__) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v #define DECLARE_ASM_CONST(n,t,v)static const t av_used __attribute__ ((aligned (n))) v ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: fix usages of av_get_codec_tag_string()
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 01:31:37 2017 +0200| [67e370ee527e9aa88d8754afd7345ffd9f6f6159] | committer: Clément Bœsch lavc: fix usages of av_get_codec_tag_string() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67e370ee527e9aa88d8754afd7345ffd9f6f6159 --- libavcodec/dds.c| 12 libavcodec/mjpegdec.c | 8 +++- libavcodec/mmaldec.c| 15 ++- libavcodec/sheervideo.c | 4 +--- libavcodec/utils.c | 9 +++-- 5 files changed, 17 insertions(+), 31 deletions(-) diff --git a/libavcodec/dds.c b/libavcodec/dds.c index fa0f34d..84b440f 100644 --- a/libavcodec/dds.c +++ b/libavcodec/dds.c @@ -117,7 +117,6 @@ static int parse_pixel_format(AVCodecContext *avctx) { DDSContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; -char buf[32]; uint32_t flags, fourcc, gimp_tag; enum DDSDXGIFormat dxgi; int size, bpp, r, g, b, a; @@ -161,13 +160,10 @@ static int parse_pixel_format(AVCodecContext *avctx) bytestream2_skip(gbc, 4); // caps4 bytestream2_skip(gbc, 4); // reserved2 -av_get_codec_tag_string(buf, sizeof(buf), fourcc); av_log(avctx, AV_LOG_VERBOSE, "fourcc %s bpp %d " - "r 0x%x g 0x%x b 0x%x a 0x%x\n", buf, bpp, r, g, b, a); -if (gimp_tag) { -av_get_codec_tag_string(buf, sizeof(buf), gimp_tag); -av_log(avctx, AV_LOG_VERBOSE, "and GIMP-DDS tag %s\n", buf); -} + "r 0x%x g 0x%x b 0x%x a 0x%x\n", av_fourcc2str(fourcc), bpp, r, g, b, a); +if (gimp_tag) +av_log(avctx, AV_LOG_VERBOSE, "and GIMP-DDS tag %s\n", av_fourcc2str(gimp_tag)); if (ctx->compressed) avctx->pix_fmt = AV_PIX_FMT_RGBA; @@ -344,7 +340,7 @@ static int parse_pixel_format(AVCodecContext *avctx) } break; default: -av_log(avctx, AV_LOG_ERROR, "Unsupported %s fourcc.\n", buf); +av_log(avctx, AV_LOG_ERROR, "Unsupported %s fourcc.\n", av_fourcc2str(fourcc)); return AVERROR_INVALIDDATA; } } else if (ctx->paletted) { diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index f26e8a3..1973132 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1649,11 +1649,9 @@ static int mjpeg_decode_app(MJpegDecodeContext *s) id = get_bits_long(&s->gb, 32); len -= 6; -if (s->avctx->debug & FF_DEBUG_STARTCODE) { -char id_str[32]; -av_get_codec_tag_string(id_str, sizeof(id_str), av_bswap32(id)); -av_log(s->avctx, AV_LOG_DEBUG, "APPx (%s / %8X) len=%d\n", id_str, id, len); -} +if (s->avctx->debug & FF_DEBUG_STARTCODE) +av_log(s->avctx, AV_LOG_DEBUG, "APPx (%s / %8X) len=%d\n", + av_fourcc2str(av_bswap32(id)), id, len); /* Buggy AVID, it puts EOI only at every 10th frame. */ /* Also, this fourcc is used by non-avid files too, it holds some diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index 284f26d..81fcebc 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -228,9 +228,8 @@ static void control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) status = *(uint32_t *)buffer->data; av_log(avctx, AV_LOG_ERROR, "MMAL error %d on control port\n", (int)status); } else { -char s[20]; -av_get_codec_tag_string(s, sizeof(s), buffer->cmd); -av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on control port\n", s); +av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on control port\n", + av_fourcc2str(buffer->cmd)); } mmal_buffer_header_release(buffer); @@ -352,7 +351,6 @@ static av_cold int ffmmal_init_decoder(AVCodecContext *avctx) MMAL_STATUS_T status; MMAL_ES_FORMAT_T *format_in; MMAL_COMPONENT_T *decoder; -char tmp[32]; int ret = 0; bcm_host_init(); @@ -399,8 +397,8 @@ static av_cold int ffmmal_init_decoder(AVCodecContext *avctx) format_in->es->video.par.den = avctx->sample_aspect_ratio.den; format_in->flags = MMAL_ES_FORMAT_FLAG_FRAMED; -av_get_codec_tag_string(tmp, sizeof(tmp), format_in->encoding); -av_log(avctx, AV_LOG_DEBUG, "Using MMAL %s encoding.\n", tmp); +av_log(avctx, AV_LOG_DEBUG, "Using MMAL %s encoding.\n", + av_fourcc2str(format_in->encoding)); #if HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS if (mmal_port_parameter_set_uint32(decoder->input[0], MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS, @@ -742,9 +740,8 @@ static int ffmmal_read_frame(AVCodecContext *avctx, AVFrame *frame, int *got_fra mmal_buffer_header_release(buffer); continue; } else if (buffer->cmd) { -char s[20]; -av_get_codec_tag_string(s, sizeof(s), buffer->cmd); -av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on output port\n", s); +av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on output port\n", + av
[FFmpeg-cvslog] idct: Have function pointer prototype match implementation
ffmpeg | branch: master | Diego Biurrun | Fri Mar 13 00:35:37 2015 +0100| [4cf2ffb7c45840b09bc49e34da88d4053dd442cb] | committer: Diego Biurrun idct: Have function pointer prototype match implementation libavcodec/idctdsp.c(175) : warning C4028: formal parameter 2 different from declaration > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4cf2ffb7c45840b09bc49e34da88d4053dd442cb --- libavcodec/idctdsp.h | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h index 51de9bc..c6b7aed 100644 --- a/libavcodec/idctdsp.h +++ b/libavcodec/idctdsp.h @@ -21,6 +21,8 @@ #include +#include "config.h" + #include "avcodec.h" /** @@ -51,13 +53,13 @@ int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, typedef struct IDCTDSPContext { /* pixel ops : interface with DCT */ void (*put_pixels_clamped)(const int16_t *block /* align 16 */, - uint8_t *pixels /* align 8 */, + uint8_t *restrict pixels /* align 8 */, ptrdiff_t line_size); void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */, - uint8_t *pixels /* align 8 */, + uint8_t *restrict pixels /* align 8 */, ptrdiff_t line_size); void (*add_pixels_clamped)(const int16_t *block /* align 16 */, - uint8_t *pixels /* align 8 */, + uint8_t *restrict pixels /* align 8 */, ptrdiff_t line_size); void (*idct)(int16_t *block /* align 16 */); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffprobe: fix usage of av_get_codec_tag_string()
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 01:36:53 2017 +0200| [fa0a8faaa4510c946901446e4d2651e3f5f41b60] | committer: Clément Bœsch ffprobe: fix usage of av_get_codec_tag_string() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa0a8faaa4510c946901446e4d2651e3f5f41b60 --- ffprobe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ffprobe.c b/ffprobe.c index 67c4ed4..4d5270f 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -2382,8 +2382,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id #endif /* print AVI/FourCC tag */ -av_get_codec_tag_string(val_str, sizeof(val_str), par->codec_tag); -print_str("codec_tag_string",val_str); +print_str("codec_tag_string",av_fourcc2str(par->codec_tag)); print_fmt("codec_tag", "0x%04x", par->codec_tag); switch (par->codec_type) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '4cf2ffb7c45840b09bc49e34da88d4053dd442cb'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 14:37:35 2017 +0200| [c1d822c554ac448b3a6d037ad507578f0793c847] | committer: Clément Bœsch Merge commit '4cf2ffb7c45840b09bc49e34da88d4053dd442cb' * commit '4cf2ffb7c45840b09bc49e34da88d4053dd442cb': idct: Have function pointer prototype match implementation Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c1d822c554ac448b3a6d037ad507578f0793c847 --- libavcodec/idctdsp.h | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h index abfa587..0b80aef 100644 --- a/libavcodec/idctdsp.h +++ b/libavcodec/idctdsp.h @@ -21,6 +21,8 @@ #include +#include "config.h" + #include "avcodec.h" /** @@ -51,13 +53,13 @@ int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, typedef struct IDCTDSPContext { /* pixel ops : interface with DCT */ void (*put_pixels_clamped)(const int16_t *block /* align 16 */, - uint8_t *pixels /* align 8 */, + uint8_t *restrict pixels /* align 8 */, ptrdiff_t line_size); void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */, - uint8_t *pixels /* align 8 */, + uint8_t *restrict pixels /* align 8 */, ptrdiff_t line_size); void (*add_pixels_clamped)(const int16_t *block /* align 16 */, - uint8_t *pixels /* align 8 */, + uint8_t *restrict pixels /* align 8 */, ptrdiff_t line_size); void (*idct)(int16_t *block /* align 16 */); == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Fix all -Wformat warnings raised by DJGPP
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 21:31:46 2017 +0200| [549045254c4614d5d61b5c36e340171a6914d57c] | committer: Clément Bœsch Fix all -Wformat warnings raised by DJGPP > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=549045254c4614d5d61b5c36e340171a6914d57c --- doc/libav-merge.txt| 1 - ffmpeg.c | 2 +- ffprobe.c | 2 +- libavcodec/alsdec.c| 4 ++-- libavcodec/apedec.c| 2 +- libavcodec/bitstream.c | 5 +++-- libavcodec/bmp.c | 3 ++- libavcodec/dnxhddec.c | 9 + libavcodec/dvdec.c | 4 ++-- libavcodec/dvdsubdec.c | 2 +- libavcodec/dvdsubenc.c | 2 +- libavcodec/dxv.c | 4 ++-- libavcodec/ffv1dec.c | 2 +- libavcodec/hevc_ps.c | 2 +- libavcodec/hqx.c | 2 +- libavcodec/iff.c | 4 ++-- libavcodec/microdvddec.c | 6 +++--- libavcodec/mpegaudiodec_template.c | 3 ++- libavcodec/parser.c| 4 ++-- libavcodec/pixlet.c| 5 +++-- libavcodec/shorten.c | 3 ++- libavcodec/tiff_common.c | 2 +- libavcodec/vorbisdec.c | 6 +++--- libavcodec/wmaprodec.c | 2 +- libavfilter/af_hdcd.c | 7 +-- libavfilter/f_perms.c | 2 +- libavfilter/vf_palettegen.c| 2 +- libavfilter/vf_paletteuse.c| 4 ++-- libavfilter/vsrc_cellauto.c| 2 +- libavfilter/vsrc_life.c| 2 +- libavformat/aadec.c| 3 ++- libavformat/apngdec.c | 2 +- libavformat/astdec.c | 2 +- libavformat/brstm.c| 2 +- libavformat/dashenc.c | 2 +- libavformat/dump.c | 3 ++- libavformat/framecrcenc.c | 2 +- libavformat/ircamdec.c | 2 +- libavformat/mov.c | 23 --- libavformat/mov_chan.c | 5 +++-- libavformat/movenc.c | 6 +++--- libavformat/mp3enc.c | 2 +- libavformat/mpegtsenc.c| 10 ++ libavformat/mux.c | 5 ++--- libavformat/nistspheredec.c| 8 libavformat/nsvdec.c | 4 ++-- libavformat/omaenc.c | 4 ++-- libavformat/rmdec.c| 3 ++- libavformat/rpl.c | 8 libavformat/rtpenc.c | 2 +- libavformat/srtdec.c | 2 +- libavformat/uncodedframecrcenc.c | 2 +- libavformat/westwood_vqa.c | 3 ++- libavformat/xwma.c | 5 +++-- libavutil/log.c| 6 +++--- libavutil/timecode.c | 3 ++- 56 files changed, 118 insertions(+), 101 deletions(-) diff --git a/doc/libav-merge.txt b/doc/libav-merge.txt index 847b620..44547c9 100644 --- a/doc/libav-merge.txt +++ b/doc/libav-merge.txt @@ -98,7 +98,6 @@ Stuff that didn't reach the codebase: - Removal of the custom atomic API (5cc0057f49, see http://ffmpeg.org/pipermail/ffmpeg-devel/2017-March/209003.html) - Use the new bitstream filter for extracting extradata (see 8e2ea69135 and 096a8effa3) - ADD_RES_MMX_4_8 in libavcodec/x86/hevc_add_res.asm probably needs updating (see 589880710) -- ISO printf warnings raised by DJGPP (c454dfcff9, currently under review: http://ffmpeg.org/pipermail/ffmpeg-devel/2017-March/209239.html) Collateral damage that needs work locally: -- diff --git a/ffmpeg.c b/ffmpeg.c index 3aa1e78..41c709d 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2509,7 +2509,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output, 1000, AV_TIME_BASE); if (end < ist->prev_sub.subtitle.end_display_time) { av_log(ist->dec_ctx, AV_LOG_DEBUG, - "Subtitle duration reduced from %d to %d%s\n", + "Subtitle duration reduced from %"PRId32" to %d%s\n", ist->prev_sub.subtitle.end_display_time, end, end <= 0 ? ", dropping it" : ""); ist->prev_sub.subtitle.end_display_time = end; diff --git a/ffprobe.c b/ffprobe.c index 4d5270f..77ea349 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -2383,7 +2383,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id /* print AVI/FourCC tag */ print_str("codec_tag_string",av_fourcc2str(par->codec_tag)); -print_fmt("codec_tag", "0x%04x", par->codec_tag); +print_fmt("codec_tag", "0x%04"PRIx32, par->codec_tag); switch (par->codec_type) { case AVMEDIA_TYPE_VIDEO: diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 3986347..d95e30d 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1500,7 +1500,7
[FFmpeg-cvslog] ffmpeg_videotoolbox: fix usage of av_get_codec_tag_string()
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 01:37:09 2017 +0200| [656823220cde2439bf5c636a104e9216227769a4] | committer: Clément Bœsch ffmpeg_videotoolbox: fix usage of av_get_codec_tag_string() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=656823220cde2439bf5c636a104e9216227769a4 --- ffmpeg_videotoolbox.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ffmpeg_videotoolbox.c b/ffmpeg_videotoolbox.c index 744a2a0..e903965 100644 --- a/ffmpeg_videotoolbox.c +++ b/ffmpeg_videotoolbox.c @@ -48,7 +48,6 @@ static int videotoolbox_retrieve_data(AVCodecContext *s, AVFrame *frame) uint8_t *data[4] = { 0 }; int linesize[4] = { 0 }; int planes, ret, i; -char codec_str[32]; av_frame_unref(vt->tmp_frame); @@ -60,9 +59,9 @@ static int videotoolbox_retrieve_data(AVCodecContext *s, AVFrame *frame) case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange: vt->tmp_frame->format = AV_PIX_FMT_NV12; break; #endif default: -av_get_codec_tag_string(codec_str, sizeof(codec_str), s->codec_tag); av_log(NULL, AV_LOG_ERROR, - "%s: Unsupported pixel format: %s\n", codec_str, videotoolbox_pixfmt); + "%s: Unsupported pixel format: %s\n", + av_fourcc2str(s->codec_tag), videotoolbox_pixfmt); return AVERROR(ENOSYS); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/psnr: rename pow2 to pow_2
ffmpeg | branch: master | Clément Bœsch | Sun Mar 26 20:43:11 2017 +0200| [4ea8f57548f36b0104bc372b2a6d3d4eaae0ce70] | committer: Clément Bœsch lavfi/psnr: rename pow2 to pow_2 This conflict with the DJGPP libc which includes a pow2 function¹ We cannot make DJGPP POSIX only (using -D_POSIX_SOURCE) to avoid this kind of symbols conflicts due to the lack of both posix_memalign and memalign (DJGPP non standard function) in that POSIX mode. We currently rely on memalign for aligned heap allocation. [1]: http://www.delorie.com/djgpp/doc/libc-2.02/libc_536.html > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ea8f57548f36b0104bc372b2a6d3d4eaae0ce70 --- libavfilter/vf_psnr.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index af93971..1201b2c 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -70,14 +70,14 @@ static const AVOption psnr_options[] = { AVFILTER_DEFINE_CLASS(psnr); -static inline unsigned pow2(unsigned base) +static inline unsigned pow_2(unsigned base) { return base*base; } static inline double get_psnr(double mse, uint64_t nb_frames, int max) { -return 10.0 * log10(pow2(max) / (mse / nb_frames)); +return 10.0 * log10(pow_2(max) / (mse / nb_frames)); } static uint64_t sse_line_8bit(const uint8_t *main_line, const uint8_t *ref_line, int outw) @@ -86,7 +86,7 @@ static uint64_t sse_line_8bit(const uint8_t *main_line, const uint8_t *ref_line unsigned m2 = 0; for (j = 0; j < outw; j++) -m2 += pow2(main_line[j] - ref_line[j]); +m2 += pow_2(main_line[j] - ref_line[j]); return m2; } @@ -99,7 +99,7 @@ static uint64_t sse_line_16bit(const uint8_t *_main_line, const uint8_t *_ref_li const uint16_t *ref_line = (const uint16_t *) _ref_line; for (j = 0; j < outw; j++) -m2 += pow2(main_line[j] - ref_line[j]); +m2 += pow_2(main_line[j] - ref_line[j]); return m2; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu: add av_fourcc_make_string() and av_fourcc2str()
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 01:05:18 2017 +0200| [bfdcdd6d829c13eb019c194e214db0ec7dcf76cd] | committer: Clément Bœsch lavu: add av_fourcc_make_string() and av_fourcc2str() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bfdcdd6d829c13eb019c194e214db0ec7dcf76cd --- doc/APIchanges | 4 libavutil/avutil.h | 14 ++ libavutil/utils.c | 23 +++ libavutil/version.h | 2 +- 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 2274543..819433b 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2015-08-28 API changes, most recent first: +2017-03-xx - xxx - lavu 55.52.100 - avutil.h + add av_fourcc_make_string() function and av_fourcc2str() macro to replace + av_get_codec_tag_string() from lavc. + 2017-03-xx - xxx - lavf 57.68.100 - avformat.h Deprecate that demuxers export the stream rotation angle in AVStream.metadata (via an entry named "rotate"). Use av_stream_get_side_data() with diff --git a/libavutil/avutil.h b/libavutil/avutil.h index e9aaa03..4d63315 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -343,6 +343,20 @@ FILE *av_fopen_utf8(const char *path, const char *mode); */ AVRational av_get_time_base_q(void); +#define AV_FOURCC_MAX_STRING_SIZE 32 + +#define av_fourcc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc) + +/** + * Fill the provided buffer with a string containing a FourCC (four-character + * code) representation. + * + * @param bufa buffer with size in bytes of at least AV_FOURCC_MAX_STRING_SIZE + * @param fourcc the fourcc to represent + * @return the buffer in input + */ +char *av_fourcc_make_string(char *buf, uint32_t fourcc); + /** * @} * @} diff --git a/libavutil/utils.c b/libavutil/utils.c index 36e4dd5..8cc7a95 100644 --- a/libavutil/utils.c +++ b/libavutil/utils.c @@ -121,6 +121,29 @@ unsigned av_int_list_length_for_size(unsigned elsize, return i; } +char *av_fourcc_make_string(char *buf, uint32_t fourcc) +{ +int i; +char *orig_buf = buf; +size_t buf_size = AV_FOURCC_MAX_STRING_SIZE; + +for (i = 0; i < 4; i++) { +const int c = fourcc & 0xff; +const int print_chr = (c >= '0' && c <= '9') || + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c && strchr(". -_", c)); +const int len = snprintf(buf, buf_size, print_chr ? "%c" : "[%d]", c); +if (len < 0) +break; +buf += len; +buf_size = buf_size > len ? buf_size - len : 0; +fourcc >>= 8; +} + +return orig_buf; +} + AVRational av_get_time_base_q(void) { return (AVRational){1, AV_TIME_BASE}; diff --git a/libavutil/version.h b/libavutil/version.h index 3c86c26..d6d78e7 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 51 +#define LIBAVUTIL_VERSION_MINOR 52 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/ape: remove unused magic field
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 09:41:34 2017 +0200| [d3cedc54cc872a376851828c88103c653fc8c395] | committer: Clément Bœsch lavf/ape: remove unused magic field > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3cedc54cc872a376851828c88103c653fc8c395 --- libavformat/ape.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/ape.c b/libavformat/ape.c index 50a1aa1..c06db78 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -57,7 +57,6 @@ typedef struct APEContext { APEFrame *frames; /* Info from Descriptor Block */ -char magic[4]; int16_t fileversion; int16_t padding1; uint32_t descriptorlength; @@ -102,7 +101,6 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx) int i; av_log(s, AV_LOG_DEBUG, "Descriptor Block:\n\n"); -av_log(s, AV_LOG_DEBUG, "magic= \"%c%c%c%c\"\n", ape_ctx->magic[0], ape_ctx->magic[1], ape_ctx->magic[2], ape_ctx->magic[3]); av_log(s, AV_LOG_DEBUG, "fileversion = %"PRId16"\n", ape_ctx->fileversion); av_log(s, AV_LOG_DEBUG, "descriptorlength = %"PRIu32"\n", ape_ctx->descriptorlength); av_log(s, AV_LOG_DEBUG, "headerlength = %"PRIu32"\n", ape_ctx->headerlength); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: use av_fourcc2str() where appropriate
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 09:45:11 2017 +0200| [2d12b910f71093b782726d00b94643f7f21ca27d] | committer: Clément Bœsch lavc: use av_fourcc2str() where appropriate > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2d12b910f71093b782726d00b94643f7f21ca27d --- libavcodec/pngdec.c | 7 ++- libavcodec/vqavideo.c | 8 ++-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index a4eb6cc..c08665b 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1143,11 +1143,8 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, } tag = bytestream2_get_le32(&s->gb); if (avctx->debug & FF_DEBUG_STARTCODE) -av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n", -(tag & 0xff), -((tag >> 8) & 0xff), -((tag >> 16) & 0xff), -((tag >> 24) & 0xff), length); +av_log(avctx, AV_LOG_DEBUG, "png: tag=%s length=%u\n", + av_fourcc2str(tag), length); if (avctx->codec_id == AV_CODEC_ID_PNG && avctx->skip_frame == AVDISCARD_ALL) { diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index 81d50bb..0e70be1 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -384,12 +384,8 @@ static int vqa_decode_chunk(VqaContext *s, AVFrame *frame) break; default: -av_log(s->avctx, AV_LOG_ERROR, "Found unknown chunk type: %c%c%c%c (%08X)\n", -(chunk_type >> 24) & 0xFF, -(chunk_type >> 16) & 0xFF, -(chunk_type >> 8) & 0xFF, -(chunk_type >> 0) & 0xFF, -chunk_type); +av_log(s->avctx, AV_LOG_ERROR, "Found unknown chunk type: %s (%08X)\n", + av_fourcc2str(av_bswap32(chunk_type)), chunk_type); break; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/dynaudnorm: rename pow2 to pow_2
ffmpeg | branch: master | Clément Bœsch | Sun Mar 26 20:41:41 2017 +0200| [8f9edf89d5d4a90eed4a798175e97e07a885ab79] | committer: Clément Bœsch lavfi/dynaudnorm: rename pow2 to pow_2 This conflict with the DJGPP libc which includes a pow2 function¹ We cannot make DJGPP POSIX only (using -D_POSIX_SOURCE) to avoid this kind of symbols conflicts due to the lack of both posix_memalign and memalign (DJGPP non standard function) in that POSIX mode. We currently rely on memalign for aligned heap allocation. [1]: http://www.delorie.com/djgpp/doc/libc-2.02/libc_536.html > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8f9edf89d5d4a90eed4a798175e97e07a885ab79 --- libavfilter/af_dynaudnorm.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c index ddbef26..aa5b28e 100644 --- a/libavfilter/af_dynaudnorm.c +++ b/libavfilter/af_dynaudnorm.c @@ -341,7 +341,7 @@ static inline double fade(double prev, double next, int pos, return fade_factors[0][pos] * prev + fade_factors[1][pos] * next; } -static inline double pow2(const double value) +static inline double pow_2(const double value) { return value * value; } @@ -384,7 +384,7 @@ static double compute_frame_rms(AVFrame *frame, int channel) const double *data_ptr = (double *)frame->extended_data[c]; for (i = 0; i < frame->nb_samples; i++) { -rms_value += pow2(data_ptr[i]); +rms_value += pow_2(data_ptr[i]); } } @@ -392,7 +392,7 @@ static double compute_frame_rms(AVFrame *frame, int channel) } else { const double *data_ptr = (double *)frame->extended_data[channel]; for (i = 0; i < frame->nb_samples; i++) { -rms_value += pow2(data_ptr[i]); +rms_value += pow_2(data_ptr[i]); } rms_value /= frame->nb_samples; @@ -545,7 +545,7 @@ static double compute_frame_std_dev(DynamicAudioNormalizerContext *s, const double *data_ptr = (double *)frame->extended_data[c]; for (i = 0; i < frame->nb_samples; i++) { -variance += pow2(data_ptr[i]); // Assume that MEAN is *zero* +variance += pow_2(data_ptr[i]); // Assume that MEAN is *zero* } } variance /= (s->channels * frame->nb_samples) - 1; @@ -553,7 +553,7 @@ static double compute_frame_std_dev(DynamicAudioNormalizerContext *s, const double *data_ptr = (double *)frame->extended_data[channel]; for (i = 0; i < frame->nb_samples; i++) { -variance += pow2(data_ptr[i]); // Assume that MEAN is *zero* +variance += pow_2(data_ptr[i]); // Assume that MEAN is *zero* } variance /= frame->nb_samples - 1; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: use av_fourcc2str() where appropriate
ffmpeg | branch: master | Clément Bœsch | Mon Mar 27 09:45:35 2017 +0200| [bec96a7286bc415dd737c8c8f430f0176999e720] | committer: Clément Bœsch lavf: use av_fourcc2str() where appropriate > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bec96a7286bc415dd737c8c8f430f0176999e720 --- libavformat/avidec.c | 10 +++--- libavformat/cafdec.c | 6 ++ libavformat/dxa.c | 6 -- libavformat/iff.c | 4 ++-- libavformat/mlvdec.c | 3 ++- libavformat/mov.c | 5 ++--- libavformat/rmdec.c| 9 ++--- libavformat/wc3movie.c | 10 -- libavformat/westwood_vqa.c | 5 ++--- 9 files changed, 23 insertions(+), 35 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 31c33de..4e694fe 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -117,13 +117,9 @@ static const AVMetadataConv avi_metadata_conv[] = { static int avi_load_index(AVFormatContext *s); static int guess_ni_flag(AVFormatContext *s); -#define print_tag(str, tag, size)\ -av_log(NULL, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%c%c%c%c size=0x%x\n", \ -avio_tell(pb), str, tag & 0xff, \ -(tag >> 8) & 0xff, \ -(tag >> 16) & 0xff, \ -(tag >> 24) & 0xff, \ -size) +#define print_tag(str, tag, size) \ +av_log(NULL, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%s size=0x%x\n", \ + avio_tell(pb), str, av_fourcc2str(tag), size) \ static inline int get_duration(AVIStream *ast, int len) { diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index fc85fd9..19939d3 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -298,11 +298,9 @@ static int read_header(AVFormatContext *s) break; default: -#define _(x) ((x) >= ' ' ? (x) : ' ') av_log(s, AV_LOG_WARNING, - "skipping CAF chunk: %08"PRIX32" (%c%c%c%c), size %"PRId64"\n", -tag, _(tag>>24), _((tag>>16)&0xFF), _((tag>>8)&0xFF), _(tag&0xFF), size); -#undef _ + "skipping CAF chunk: %08"PRIX32" (%s), size %"PRId64"\n", + tag, av_fourcc2str(av_bswap32(tag)), size); case MKBETAG('f','r','e','e'): if (size < 0) return AVERROR_INVALIDDATA; diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 162838c..5019390 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -171,11 +171,13 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) } avio_seek(s->pb, c->vidpos, SEEK_SET); while(!avio_feof(s->pb) && c->frames){ +uint32_t tag; if ((ret = avio_read(s->pb, buf, 4)) != 4) { av_log(s, AV_LOG_ERROR, "failed reading chunk type\n"); return ret < 0 ? ret : AVERROR_INVALIDDATA; } -switch(AV_RL32(buf)){ +tag = AV_RL32(buf); +switch (tag) { case MKTAG('N', 'U', 'L', 'L'): if(av_new_packet(pkt, 4 + pal_size) < 0) return AVERROR(ENOMEM); @@ -217,7 +219,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) c->readvid = 0; return 0; default: -av_log(s, AV_LOG_ERROR, "Unknown tag %c%c%c%c\n", buf[0], buf[1], buf[2], buf[3]); +av_log(s, AV_LOG_ERROR, "Unknown tag %s\n", av_fourcc2str(tag)); return AVERROR_INVALIDDATA; } } diff --git a/libavformat/iff.c b/libavformat/iff.c index 29fb7bf..6a09eb0 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -296,8 +296,8 @@ static int parse_dsd_prop(AVFormatContext *s, AVStream *st, uint64_t eof) st->codecpar->codec_tag = tag = avio_rl32(pb); st->codecpar->codec_id = ff_codec_get_id(dsd_codec_tags, tag); if (!st->codecpar->codec_id) { -av_log(s, AV_LOG_ERROR, "'%c%c%c%c' compression is not supported\n", -tag&0xFF, (tag>>8)&0xFF, (tag>>16)&0xFF, (tag>>24)&0xFF); +av_log(s, AV_LOG_ERROR, "'%s' compression is not supported\n", + av_fourcc2str(tag)); return AVERROR_PATCHWELCOME; } break; diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c index 90c3779..319cd26 100644 --- a/libavformat/mlvdec.c +++ b/libavformat/mlvdec.c @@ -242,7 +242,8 @@ static int scan_file(AVFormatContext *avctx, AVStream *vst, AVStream *ast, int f } else if (type == MKTAG('N','U','L','L')) { } else if (type == MKTAG('M','L','V','I')) { /* occurs when MLV and Mnn files are concatenated */ } else { -av_log(avctx, AV_LOG_INFO, "unsupported tag %c%c%c%c, size %u\n", type&0xFF, (type>>8)&0xFF, (type>>16)&0xFF, (type>>24)&0xFF, size); +av_log(avctx, AV_LOG_INFO, "unsu
[FFmpeg-cvslog] lavc/idctdsp: use prefix restrict with av_
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 15:07:29 2017 +0200| [d467740f45eb20e217de6bc6b9c91d57d6f8a88e] | committer: Clément Bœsch lavc/idctdsp: use prefix restrict with av_ > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d467740f45eb20e217de6bc6b9c91d57d6f8a88e --- libavcodec/idctdsp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h index 0b80aef..f9ba6c3 100644 --- a/libavcodec/idctdsp.h +++ b/libavcodec/idctdsp.h @@ -53,13 +53,13 @@ int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, typedef struct IDCTDSPContext { /* pixel ops : interface with DCT */ void (*put_pixels_clamped)(const int16_t *block /* align 16 */, - uint8_t *restrict pixels /* align 8 */, + uint8_t *av_restrict pixels /* align 8 */, ptrdiff_t line_size); void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */, - uint8_t *restrict pixels /* align 8 */, + uint8_t *av_restrict pixels /* align 8 */, ptrdiff_t line_size); void (*add_pixels_clamped)(const int16_t *block /* align 16 */, - uint8_t *restrict pixels /* align 8 */, + uint8_t *av_restrict pixels /* align 8 */, ptrdiff_t line_size); void (*idct)(int16_t *block /* align 16 */); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] bink: Have function pointer prototype match implementation
ffmpeg | branch: master | Diego Biurrun | Fri Mar 13 00:38:57 2015 +0100| [baab87c4f30e75ea309294b06adcd01ce678bdc5] | committer: Diego Biurrun bink: Have function pointer prototype match implementation libavcodec/binkdsp.c(156) : warning C4028: formal parameter 1 different from declaration > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=baab87c4f30e75ea309294b06adcd01ce678bdc5 --- libavcodec/binkdsp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/binkdsp.h b/libavcodec/binkdsp.h index 418afb9..9524fe2 100644 --- a/libavcodec/binkdsp.h +++ b/libavcodec/binkdsp.h @@ -29,11 +29,13 @@ #include +#include "config.h" + typedef struct BinkDSPContext { void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, int32_t *block/*align 16*/); void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, int32_t *block/*align 16*/); void (*scale_block)(const uint8_t src[64]/*align 8*/, uint8_t *dst/*align 8*/, int linesize); -void (*add_pixels8)(uint8_t *pixels, int16_t *block, int line_size); +void (*add_pixels8)(uint8_t *restrict pixels, int16_t *block, int line_size); } BinkDSPContext; void ff_binkdsp_init(BinkDSPContext *c); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'baab87c4f30e75ea309294b06adcd01ce678bdc5'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 15:09:19 2017 +0200| [a51867ee6bc717a54ea2436e31ee626f02fdf25d] | committer: Clément Bœsch Merge commit 'baab87c4f30e75ea309294b06adcd01ce678bdc5' * commit 'baab87c4f30e75ea309294b06adcd01ce678bdc5': bink: Have function pointer prototype match implementation Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a51867ee6bc717a54ea2436e31ee626f02fdf25d --- libavcodec/binkdsp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/binkdsp.h b/libavcodec/binkdsp.h index f319d1f..b089a98 100644 --- a/libavcodec/binkdsp.h +++ b/libavcodec/binkdsp.h @@ -29,11 +29,13 @@ #include +#include "config.h" + typedef struct BinkDSPContext { void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, int32_t *block/*align 16*/); void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, int32_t *block/*align 16*/); void (*scale_block)(const uint8_t src[64]/*align 8*/, uint8_t *dst/*align 8*/, int linesize); -void (*add_pixels8)(uint8_t *pixels, int16_t *block, int line_size); +void (*add_pixels8)(uint8_t *av_restrict pixels, int16_t *block, int line_size); } BinkDSPContext; void ff_binkdsp_init(BinkDSPContext *c); == diff --cc libavcodec/binkdsp.h index f319d1f,9524fe2..b089a98 --- a/libavcodec/binkdsp.h +++ b/libavcodec/binkdsp.h @@@ -33,7 -35,7 +35,7 @@@ typedef struct BinkDSPContext void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, int32_t *block/*align 16*/); void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, int32_t *block/*align 16*/); void (*scale_block)(const uint8_t src[64]/*align 8*/, uint8_t *dst/*align 8*/, int linesize); - void (*add_pixels8)(uint8_t *pixels, int16_t *block, int line_size); -void (*add_pixels8)(uint8_t *restrict pixels, int16_t *block, int line_size); ++void (*add_pixels8)(uint8_t *av_restrict pixels, int16_t *block, int line_size); } BinkDSPContext; void ff_binkdsp_init(BinkDSPContext *c); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] rtmpproto: Restructure zlib code to avoid unreachable code warning
ffmpeg | branch: master | Diego Biurrun | Thu Oct 29 13:39:49 2015 +0100| [f4ca8ea92a8b36fe723412aefafc1b2fa89f8dc6] | committer: Diego Biurrun rtmpproto: Restructure zlib code to avoid unreachable code warning libavformat\rtmpproto.c(1165) : warning C4702: unreachable code > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f4ca8ea92a8b36fe723412aefafc1b2fa89f8dc6 --- libavformat/rtmpproto.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 0097841..5298c18 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -,7 +,7 @@ static int rtmp_calc_swfhash(URLContext *s) { RTMPContext *rt = s->priv_data; uint8_t *in_data = NULL, *out_data = NULL, *swfdata; -int64_t in_size, out_size; +int64_t in_size; URLContext *stream; char swfhash[32]; int swfsize; @@ -1143,6 +1143,8 @@ static int rtmp_calc_swfhash(URLContext *s) } if (!memcmp(in_data, "CWS", 3)) { +#if CONFIG_ZLIB +int64_t out_size; /* Decompress the SWF player file using Zlib. */ if (!(out_data = av_malloc(8))) { ret = AVERROR(ENOMEM); @@ -1152,18 +1154,17 @@ static int rtmp_calc_swfhash(URLContext *s) memcpy(out_data, in_data, 8); out_size = 8; -#if CONFIG_ZLIB if ((ret = rtmp_uncompress_swfplayer(in_data + 8, in_size - 8, &out_data, &out_size)) < 0) goto fail; +swfsize = out_size; +swfdata = out_data; #else av_log(s, AV_LOG_ERROR, "Zlib is required for decompressing the SWF player file.\n"); ret = AVERROR(EINVAL); goto fail; #endif -swfsize = out_size; -swfdata = out_data; } else { swfsize = in_size; swfdata = in_data; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'f4ca8ea92a8b36fe723412aefafc1b2fa89f8dc6'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 15:17:59 2017 +0200| [72dbfe42efcb0e0c397ec879c7868861083c5286] | committer: Clément Bœsch Merge commit 'f4ca8ea92a8b36fe723412aefafc1b2fa89f8dc6' * commit 'f4ca8ea92a8b36fe723412aefafc1b2fa89f8dc6': rtmpproto: Restructure zlib code to avoid unreachable code warning Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72dbfe42efcb0e0c397ec879c7868861083c5286 --- libavformat/rtmpproto.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index aa1cd8f..d415f0f 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -1140,7 +1140,7 @@ static int rtmp_calc_swfhash(URLContext *s) { RTMPContext *rt = s->priv_data; uint8_t *in_data = NULL, *out_data = NULL, *swfdata; -int64_t in_size, out_size; +int64_t in_size; URLContext *stream; char swfhash[32]; int swfsize; @@ -1173,6 +1173,8 @@ static int rtmp_calc_swfhash(URLContext *s) } if (!memcmp(in_data, "CWS", 3)) { +#if CONFIG_ZLIB +int64_t out_size; /* Decompress the SWF player file using Zlib. */ if (!(out_data = av_malloc(8))) { ret = AVERROR(ENOMEM); @@ -1182,18 +1184,17 @@ static int rtmp_calc_swfhash(URLContext *s) memcpy(out_data, in_data, 8); out_size = 8; -#if CONFIG_ZLIB if ((ret = rtmp_uncompress_swfplayer(in_data + 8, in_size - 8, &out_data, &out_size)) < 0) goto fail; +swfsize = out_size; +swfdata = out_data; #else av_log(s, AV_LOG_ERROR, "Zlib is required for decompressing the SWF player file.\n"); ret = AVERROR(EINVAL); goto fail; #endif -swfsize = out_size; -swfdata = out_data; } else { swfsize = in_size; swfdata = in_data; == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] doc: Turn off noisy deprecation warnings in the option printer
ffmpeg | branch: master | Diego Biurrun | Fri Dec 4 12:43:10 2015 +0100| [2025d3787158ba272a1b8fbc0493fa20dd7a8484] | committer: Diego Biurrun doc: Turn off noisy deprecation warnings in the option printer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2025d3787158ba272a1b8fbc0493fa20dd7a8484 --- doc/print_options.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/print_options.c b/doc/print_options.c index aa75a00..eb54f07 100644 --- a/doc/print_options.c +++ b/doc/print_options.c @@ -23,15 +23,21 @@ */ #include +#include #include #include -#include "libavformat/avformat.h" -#include "libavformat/options_table.h" -#include "libavcodec/avcodec.h" -#include "libavcodec/options_table.h" +#include "libavutil/attributes.h" #include "libavutil/opt.h" +/* Forcibly turn off deprecation warnings, which just add noise here. */ +#undef attribute_deprecated +#define attribute_deprecated + +#include "libavcodec/options_table.h" + +#include "libavformat/options_table.h" + static void print_usage(void) { fprintf(stderr, "Usage: enum_options type\n" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '2025d3787158ba272a1b8fbc0493fa20dd7a8484'
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 15:20:10 2017 +0200| [a1b3ded902363a9790b9c2b1e18c2c02c035e9b7] | committer: Clément Bœsch Merge commit '2025d3787158ba272a1b8fbc0493fa20dd7a8484' * commit '2025d3787158ba272a1b8fbc0493fa20dd7a8484': doc: Turn off noisy deprecation warnings in the option printer Merged-by: Clément Bœsch > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1b3ded902363a9790b9c2b1e18c2c02c035e9b7 --- doc/print_options.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/print_options.c b/doc/print_options.c index 9fd66ca..fd1cf10 100644 --- a/doc/print_options.c +++ b/doc/print_options.c @@ -23,6 +23,7 @@ */ #include +#include #include #include @@ -30,12 +31,17 @@ // for the target. without this build breaks on mingw #define AVFORMAT_OS_SUPPORT_H -#include "libavformat/avformat.h" -#include "libavformat/options_table.h" -#include "libavcodec/avcodec.h" -#include "libavcodec/options_table.h" +#include "libavutil/attributes.h" #include "libavutil/opt.h" +/* Forcibly turn off deprecation warnings, which just add noise here. */ +#undef attribute_deprecated +#define attribute_deprecated + +#include "libavcodec/options_table.h" + +#include "libavformat/options_table.h" + static void print_usage(void) { fprintf(stderr, "Usage: enum_options type\n" == diff --cc doc/print_options.c index 9fd66ca,eb54f07..fd1cf10 --- a/doc/print_options.c +++ b/doc/print_options.c @@@ -26,16 -27,17 +27,21 @@@ #include #include +// print_options is build for the host, os_support.h isn't needed and is setup +// for the target. without this build breaks on mingw +#define AVFORMAT_OS_SUPPORT_H + - #include "libavformat/avformat.h" - #include "libavformat/options_table.h" - #include "libavcodec/avcodec.h" - #include "libavcodec/options_table.h" + #include "libavutil/attributes.h" #include "libavutil/opt.h" + /* Forcibly turn off deprecation warnings, which just add noise here. */ + #undef attribute_deprecated + #define attribute_deprecated + + #include "libavcodec/options_table.h" + + #include "libavformat/options_table.h" + static void print_usage(void) { fprintf(stderr, "Usage: enum_options type\n" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/signature: fix -Wformat warnings raised by DJGPP
ffmpeg | branch: master | Clément Bœsch | Wed Mar 29 16:09:28 2017 +0200| [247d0339ca5ddab692aee49baf43cd1324466028] | committer: Clément Bœsch lavfi/signature: fix -Wformat warnings raised by DJGPP This was forgotten due to the non-gpl build used in 549045254. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=247d0339ca5ddab692aee49baf43cd1324466028 --- libavfilter/signature_lookup.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c index 5bc2904..871a10c 100644 --- a/libavfilter/signature_lookup.c +++ b/libavfilter/signature_lookup.c @@ -551,20 +551,27 @@ static MatchingInfo lookup_signatures(AVFilterContext *ctx, SignatureContext *sc if (find_next_coarsecandidate(sc, second->coarsesiglist, &cs, &cs2, 1) == 0) return bestmatch; /* no candidate found */ do { -av_log(ctx, AV_LOG_DEBUG, "Stage 1: got coarsesignature pair. indices of first frame: %d and %d\n", cs->first->index, cs2->first->index); +av_log(ctx, AV_LOG_DEBUG, "Stage 1: got coarsesignature pair. " + "indices of first frame: %"PRIu32" and %"PRIu32"\n", + cs->first->index, cs2->first->index); /* stage 2: l1-distance and hough-transform */ av_log(ctx, AV_LOG_DEBUG, "Stage 2: calculate matching parameters\n"); infos = get_matching_parameters(ctx, sc, cs->first, cs2->first); if (av_log_get_level() == AV_LOG_DEBUG) { for (i = infos; i != NULL; i = i->next) { -av_log(ctx, AV_LOG_DEBUG, "Stage 2: matching pair at %d and %d, ratio %f, offset %d\n", i->first->index, i->second->index, i->framerateratio, i->offset); +av_log(ctx, AV_LOG_DEBUG, "Stage 2: matching pair at %"PRIu32" and %"PRIu32", " + "ratio %f, offset %d\n", i->first->index, i->second->index, + i->framerateratio, i->offset); } } /* stage 3: evaluation */ av_log(ctx, AV_LOG_DEBUG, "Stage 3: evaluate\n"); if (infos) { bestmatch = evaluate_parameters(ctx, sc, infos, bestmatch, mode); -av_log(ctx, AV_LOG_DEBUG, "Stage 3: best matching pair at %d and %d, ratio %f, offset %d, score %d, %d frames matching\n", bestmatch.first->index, bestmatch.second->index, bestmatch.framerateratio, bestmatch.offset, bestmatch.score, bestmatch.matchframes); +av_log(ctx, AV_LOG_DEBUG, "Stage 3: best matching pair at %"PRIu32" and %"PRIu32", " + "ratio %f, offset %d, score %d, %d frames matching\n", + bestmatch.first->index, bestmatch.second->index, + bestmatch.framerateratio, bestmatch.offset, bestmatch.score, bestmatch.matchframes); sll_free(infos); } } while (find_next_coarsecandidate(sc, second->coarsesiglist, &cs, &cs2, 0) && !bestmatch.whole); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '7433feb82f75827884d909de34d341a1c4401d4a'
ffmpeg | branch: master | Matthieu Bouron | Wed Mar 29 23:11:10 2017 +0200| [b265e5ba50b86f2ca640e3a565bd54f7e4292bb0] | committer: Matthieu Bouron Merge commit '7433feb82f75827884d909de34d341a1c4401d4a' * commit '7433feb82f75827884d909de34d341a1c4401d4a': lavfi: Make default get_video_buffer work with hardware frames Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b265e5ba50b86f2ca640e3a565bd54f7e4292bb0 --- libavfilter/video.c | 16 1 file changed, 16 insertions(+) diff --git a/libavfilter/video.c b/libavfilter/video.c index fabdafd..6f9020b 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -25,6 +25,7 @@ #include "libavutil/avassert.h" #include "libavutil/buffer.h" +#include "libavutil/hwcontext.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" @@ -47,6 +48,21 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) int pool_align = 0; enum AVPixelFormat pool_format = AV_PIX_FMT_NONE; +if (link->hw_frames_ctx && +((AVHWFramesContext*)link->hw_frames_ctx->data)->format == link->format) { +int ret; +AVFrame *frame = av_frame_alloc(); + +if (!frame) +return NULL; + +ret = av_hwframe_get_buffer(link->hw_frames_ctx, frame, 0); +if (ret < 0) +av_frame_free(&frame); + +return frame; +} + if (!link->frame_pool) { link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, link->format, BUFFER_ALIGN); == diff --cc libavfilter/video.c index fabdafd,533946a..6f9020b --- a/libavfilter/video.c +++ b/libavfilter/video.c @@@ -23,8 -19,8 +23,9 @@@ #include #include +#include "libavutil/avassert.h" #include "libavutil/buffer.h" + #include "libavutil/hwcontext.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" @@@ -40,37 -33,31 +41,52 @@@ AVFrame *ff_null_get_video_buffer(AVFil return ff_get_video_buffer(link->dst->outputs[0], w, h); } -/* TODO: set the buffer's priv member to a context structure for the whole - * filter chain. This will allow for a buffer pool instead of the constant - * alloc & free cycle currently implemented. */ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) { -AVFrame *frame = av_frame_alloc(); -int ret; - -if (!frame) -return NULL; +int pool_width = 0; +int pool_height = 0; +int pool_align = 0; +enum AVPixelFormat pool_format = AV_PIX_FMT_NONE; + if (link->hw_frames_ctx && + ((AVHWFramesContext*)link->hw_frames_ctx->data)->format == link->format) { ++int ret; ++AVFrame *frame = av_frame_alloc(); ++ ++if (!frame) ++return NULL; ++ + ret = av_hwframe_get_buffer(link->hw_frames_ctx, frame, 0); ++if (ret < 0) ++av_frame_free(&frame); ++ ++return frame; ++} ++ +if (!link->frame_pool) { +link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, +link->format, BUFFER_ALIGN); +if (!link->frame_pool) +return NULL; } else { -frame->width = w; -frame->height = h; -frame->format = link->format; +if (ff_frame_pool_get_video_config(link->frame_pool, + &pool_width, &pool_height, + &pool_format, &pool_align) < 0) { +return NULL; +} + +if (pool_width != w || pool_height != h || +pool_format != link->format || pool_align != BUFFER_ALIGN) { -ret = av_frame_get_buffer(frame, 32); +ff_frame_pool_uninit((FFFramePool **)&link->frame_pool); +link->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h, +link->format, BUFFER_ALIGN); +if (!link->frame_pool) +return NULL; +} } -if (ret < 0) -av_frame_free(&frame); -return frame; +return ff_frame_pool_get(link->frame_pool); } AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi: Make default get_video_buffer work with hardware frames
ffmpeg | branch: master | Mark Thompson | Mon Oct 31 22:14:04 2016 +| [7433feb82f75827884d909de34d341a1c4401d4a] | committer: Mark Thompson lavfi: Make default get_video_buffer work with hardware frames > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7433feb82f75827884d909de34d341a1c4401d4a --- libavfilter/video.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavfilter/video.c b/libavfilter/video.c index cadac50..533946a 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -20,6 +20,7 @@ #include #include "libavutil/buffer.h" +#include "libavutil/hwcontext.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" @@ -43,11 +44,16 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h) if (!frame) return NULL; -frame->width = w; -frame->height = h; -frame->format = link->format; +if (link->hw_frames_ctx && +((AVHWFramesContext*)link->hw_frames_ctx->data)->format == link->format) { +ret = av_hwframe_get_buffer(link->hw_frames_ctx, frame, 0); +} else { +frame->width = w; +frame->height = h; +frame->format = link->format; -ret = av_frame_get_buffer(frame, 32); +ret = av_frame_get_buffer(frame, 32); +} if (ret < 0) av_frame_free(&frame); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/exr: add support for uint32
ffmpeg | branch: master | Martin Vignali | Sat Mar 18 18:24:55 2017 +0100| [b4016ef31a6ea007e481427ade35ac35d1519170] | committer: Paul B Mahol avcodec/exr: add support for uint32 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4016ef31a6ea007e481427ade35ac35d1519170 --- libavcodec/exr.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 034920f..ddce1e5 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -3,7 +3,7 @@ * Copyright (c) 2006 Industrial Light & Magic, a division of Lucas Digital Ltd. LLC * Copyright (c) 2009 Jimmy Christensen * - * B44/B44A, Tile added by Jokyo Images support by CNC - French National Center for Cinema + * B44/B44A, Tile, UINT32 added by Jokyo Images support by CNC - French National Center for Cinema * * This file is part of FFmpeg. * @@ -1236,7 +1236,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata, *ptr_x++ = exr_flt2uint(bytestream_get_le32(&a)); } } -} else { +} else if (s->pixel_type == EXR_HALF) { // 16-bit for (x = 0; x < td->xsize; x++) { int c; @@ -1247,6 +1247,15 @@ static int decode_block(AVCodecContext *avctx, void *tdata, if (channel_buffer[3]) *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a)); } +} else if (s->pixel_type == EXR_UINT) { +for (x = 0; x < td->xsize; x++) { +for (c = 0; c < rgb_channel_count; c++) { +*ptr_x++ = bytestream_get_le32(&rgb[c]) >> 16; +} + +if (channel_buffer[3]) +*ptr_x++ = bytestream_get_le32(&a) >> 16; +} } // Zero out the end if xmax+1 is not w @@ -1648,6 +1657,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, switch (s->pixel_type) { case EXR_FLOAT: case EXR_HALF: +case EXR_UINT: if (s->channel_offsets[3] >= 0) { if (!s->is_luma) { avctx->pix_fmt = AV_PIX_FMT_RGBA64; @@ -1662,9 +1672,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, } } break; -case EXR_UINT: -avpriv_request_sample(avctx, "32-bit unsigned int"); -return AVERROR_PATCHWELCOME; default: av_log(avctx, AV_LOG_ERROR, "Missing channel list.\n"); return AVERROR_INVALIDDATA; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '7e2561fa8313982aa21f7657953eedeeb33b210d'
ffmpeg | branch: master | Matthieu Bouron | Wed Mar 29 23:31:20 2017 +0200| [78e871ebbcc6f3c877e7292c4dda0c9979f8ede4] | committer: Matthieu Bouron Merge commit '7e2561fa8313982aa21f7657953eedeeb33b210d' * commit '7e2561fa8313982aa21f7657953eedeeb33b210d': lavfi: Use ff_get_video_buffer in all filters using hwframes vf_hwupload_cuda: Fix build error Merged-by: Matthieu Bouron > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=78e871ebbcc6f3c877e7292c4dda0c9979f8ede4 --- libavfilter/vf_deinterlace_qsv.c | 10 -- libavfilter/vf_hwupload.c| 9 ++--- libavfilter/vf_hwupload_cuda.c | 8 ++-- libavfilter/vf_scale_qsv.c | 6 +- libavfilter/vf_scale_vaapi.c | 11 +++ 5 files changed, 12 insertions(+), 32 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index e7491e1..2fe74c1 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -434,13 +434,11 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in, mfxStatus err; int ret, again = 0; -out = av_frame_alloc(); -if (!out) -return AVERROR(ENOMEM); - -ret = av_hwframe_get_buffer(s->hw_frames_ctx, out, 0); -if (ret < 0) +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); +if (!out) { +ret = AVERROR(ENOMEM); goto fail; +} surf_out = (mfxFrameSurface1*)out->data[3]; surf_out->Info.CropW = outlink->w; diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c index f54ce9f..9237253 100644 --- a/libavfilter/vf_hwupload.c +++ b/libavfilter/vf_hwupload.c @@ -159,15 +159,10 @@ static int hwupload_filter_frame(AVFilterLink *link, AVFrame *input) if (input->format == outlink->format) return ff_filter_frame(outlink, input); -output = av_frame_alloc(); +output = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!output) { -err = AVERROR(ENOMEM); -goto fail; -} - -err = av_hwframe_get_buffer(ctx->hwframes_ref, output, 0); -if (err < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame to upload to.\n"); +err = AVERROR(ENOMEM); goto fail; } diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c index 49f34b6..1e47ada 100644 --- a/libavfilter/vf_hwupload_cuda.c +++ b/libavfilter/vf_hwupload_cuda.c @@ -113,21 +113,17 @@ static int cudaupload_config_output(AVFilterLink *outlink) static int cudaupload_filter_frame(AVFilterLink *link, AVFrame *in) { AVFilterContext *ctx = link->dst; -CudaUploadContext *s = ctx->priv; +AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out = NULL; int ret; -out = av_frame_alloc(); +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { ret = AVERROR(ENOMEM); goto fail; } -ret = av_hwframe_get_buffer(s->hwframe, out, 0); -if (ret < 0) -goto fail; - out->width = in->width; out->height = in->height; diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 88fca8b..52e3ef9 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -530,16 +530,12 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in) AVFrame *out = NULL; int ret = 0; -out = av_frame_alloc(); +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { ret = AVERROR(ENOMEM); goto fail; } -ret = av_hwframe_get_buffer(s->out_frames_ref, out, 0); -if (ret < 0) -goto fail; - do { err = MFXVideoVPP_RunFrameVPPAsync(s->session, (mfxFrameSurface1*)in->data[3], diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c index 8221849..c4334c7 100644 --- a/libavfilter/vf_scale_vaapi.c +++ b/libavfilter/vf_scale_vaapi.c @@ -32,6 +32,7 @@ #include "formats.h" #include "internal.h" #include "scale.h" +#include "video.h" typedef struct ScaleVAAPIContext { const AVClass *class; @@ -288,19 +289,13 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) av_log(ctx, AV_LOG_DEBUG, "Using surface %#x for scale input.\n", input_surface); -output_frame = av_frame_alloc(); +output_frame = ff_get_video_buffer(outlink, ctx->output_width, + ctx->output_height); if (!output_frame) { -av_log(ctx, AV_LOG_ERROR, "Failed to allocate output frame."); err = AVERROR(ENOMEM); goto fail; } -err = av_hwframe_get_buffer(ctx->output_frames_ref, output_frame, 0); -if (err < 0) { -av_log(ctx, AV_LOG_ERROR, "Failed to get surface for " - "output: %d\n.", err); -} - output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3]; av_log(ctx, AV_LOG_DEBUG, "Usin
[FFmpeg-cvslog] lavfi: Use ff_get_video_buffer in all filters using hwframes
ffmpeg | branch: master | Mark Thompson | Mon Oct 31 22:14:10 2016 +| [7e2561fa8313982aa21f7657953eedeeb33b210d] | committer: Mark Thompson lavfi: Use ff_get_video_buffer in all filters using hwframes > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e2561fa8313982aa21f7657953eedeeb33b210d --- libavfilter/vf_deinterlace_qsv.c | 10 -- libavfilter/vf_hwupload.c| 9 ++--- libavfilter/vf_hwupload_cuda.c | 6 +- libavfilter/vf_scale_qsv.c | 6 +- libavfilter/vf_scale_vaapi.c | 11 +++ 5 files changed, 11 insertions(+), 31 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index b26a900..36eea15 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -433,13 +433,11 @@ static int process_frame(AVFilterContext *ctx, const AVFrame *in, mfxStatus err; int ret, again = 0; -out = av_frame_alloc(); -if (!out) -return AVERROR(ENOMEM); - -ret = av_hwframe_get_buffer(s->hw_frames_ctx, out, 0); -if (ret < 0) +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); +if (!out) { +ret = AVERROR(ENOMEM); goto fail; +} surf_out = (mfxFrameSurface1*)out->data[3]; surf_out->Info.CropW = outlink->w; diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c index c438d5a..8c43e00 100644 --- a/libavfilter/vf_hwupload.c +++ b/libavfilter/vf_hwupload.c @@ -161,15 +161,10 @@ static int hwupload_filter_frame(AVFilterLink *link, AVFrame *input) if (input->format == outlink->format) return ff_filter_frame(outlink, input); -output = av_frame_alloc(); +output = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!output) { -err = AVERROR(ENOMEM); -goto fail; -} - -err = av_hwframe_get_buffer(ctx->hwframes_ref, output, 0); -if (err < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame to upload to.\n"); +err = AVERROR(ENOMEM); goto fail; } diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c index dfb3506..0ab5276 100644 --- a/libavfilter/vf_hwupload_cuda.c +++ b/libavfilter/vf_hwupload_cuda.c @@ -156,16 +156,12 @@ static int cudaupload_filter_frame(AVFilterLink *link, AVFrame *in) AVFrame *out = NULL; int ret; -out = av_frame_alloc(); +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { ret = AVERROR(ENOMEM); goto fail; } -ret = av_hwframe_get_buffer(s->hwframe, out, 0); -if (ret < 0) -goto fail; - out->width = in->width; out->height = in->height; diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index e5c3da5..f7c1c55 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -528,16 +528,12 @@ static int qsvscale_filter_frame(AVFilterLink *link, AVFrame *in) AVFrame *out = NULL; int ret = 0; -out = av_frame_alloc(); +out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { ret = AVERROR(ENOMEM); goto fail; } -ret = av_hwframe_get_buffer(s->out_frames_ref, out, 0); -if (ret < 0) -goto fail; - do { err = MFXVideoVPP_RunFrameVPPAsync(s->session, (mfxFrameSurface1*)in->data[3], diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c index 704456d..67648a9 100644 --- a/libavfilter/vf_scale_vaapi.c +++ b/libavfilter/vf_scale_vaapi.c @@ -31,6 +31,7 @@ #include "avfilter.h" #include "formats.h" #include "internal.h" +#include "video.h" typedef struct ScaleVAAPIContext { const AVClass *class; @@ -274,19 +275,13 @@ static int scale_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) av_log(ctx, AV_LOG_DEBUG, "Using surface %#x for scale input.\n", input_surface); -output_frame = av_frame_alloc(); +output_frame = ff_get_video_buffer(outlink, ctx->output_width, + ctx->output_height); if (!output_frame) { -av_log(ctx, AV_LOG_ERROR, "Failed to allocate output frame."); err = AVERROR(ENOMEM); goto fail; } -err = av_hwframe_get_buffer(ctx->output_frames_ref, output_frame, 0); -if (err < 0) { -av_log(ctx, AV_LOG_ERROR, "Failed to get surface for " - "output: %d\n.", err); -} - output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3]; av_log(ctx, AV_LOG_DEBUG, "Using surface %#x for scale output.\n", output_surface); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi: Always propagate hw_frames_ctx through links
ffmpeg | branch: master | Mark Thompson | Tue Oct 25 20:42:27 2016 +0100| [e3fb74f7f9a8f1895381355f40c92cac3c1023d9] | committer: Mark Thompson lavfi: Always propagate hw_frames_ctx through links Also adds a new flag to mark filters which are aware of hwframes and will perform this task themselves, and marks all appropriate filters with this flag. This is required to allow software-mapped hardware frames to work, because we need to have the frames context available for any later mapping operation in the filter graph. The output from the filter graph should only propagate further to an encoder if the hardware format actually matches the visible format (mapped frames are valid here and have an hw_frames_ctx, but this should not be given to the encoder as its hardware context). > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3fb74f7f9a8f1895381355f40c92cac3c1023d9 --- avconv.c | 5 - libavfilter/avfilter.c | 15 +++ libavfilter/avfilter.h | 2 ++ libavfilter/internal.h | 6 ++ libavfilter/vf_deinterlace_qsv.c | 2 ++ libavfilter/vf_hwdownload.c | 1 + libavfilter/vf_hwupload.c| 1 + libavfilter/vf_hwupload_cuda.c | 2 ++ libavfilter/vf_scale_npp.c | 2 ++ libavfilter/vf_scale_qsv.c | 2 ++ libavfilter/vf_scale_vaapi.c | 1 + 11 files changed, 30 insertions(+), 9 deletions(-) diff --git a/avconv.c b/avconv.c index 4bd28e6..769b9e0 100644 --- a/avconv.c +++ b/avconv.c @@ -38,6 +38,7 @@ #include "libavutil/parseutils.h" #include "libavutil/samplefmt.h" #include "libavutil/fifo.h" +#include "libavutil/hwcontext.h" #include "libavutil/internal.h" #include "libavutil/intreadwrite.h" #include "libavutil/dict.h" @@ -2035,7 +2036,9 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len) if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0)) av_dict_set(&ost->encoder_opts, "threads", "auto", 0); -if (ost->filter && ost->filter->filter->inputs[0]->hw_frames_ctx) { +if (ost->filter && ost->filter->filter->inputs[0]->hw_frames_ctx && + ((AVHWFramesContext*)ost->filter->filter->inputs[0]->hw_frames_ctx->data)->format == +ost->filter->filter->inputs[0]->format) { ost->enc_ctx->hw_frames_ctx = av_buffer_ref(ost->filter->filter->inputs[0]->hw_frames_ctx); if (!ost->enc_ctx->hw_frames_ctx) return AVERROR(ENOMEM); diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 1cedb15..99531e5 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/buffer.h" #include "libavutil/channel_layout.h" @@ -212,14 +213,12 @@ int avfilter_config_links(AVFilterContext *filter) } if (link->src->nb_inputs && link->src->inputs[0]->hw_frames_ctx && -!link->hw_frames_ctx) { -AVHWFramesContext *input_ctx = (AVHWFramesContext*)link->src->inputs[0]->hw_frames_ctx->data; - -if (input_ctx->format == link->format) { -link->hw_frames_ctx = av_buffer_ref(link->src->inputs[0]->hw_frames_ctx); -if (!link->hw_frames_ctx) -return AVERROR(ENOMEM); -} +!(link->src->filter->flags_internal & FF_FILTER_FLAG_HWFRAME_AWARE)) { +av_assert0(!link->hw_frames_ctx && + "should not be set by non-hwframe-aware filter"); +link->hw_frames_ctx = av_buffer_ref(link->src->inputs[0]->hw_frames_ctx); +if (!link->hw_frames_ctx) +return AVERROR(ENOMEM); } if ((config_link = link->dstpad->config_props)) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index a17b2a2..568480d 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -244,6 +244,8 @@ typedef struct AVFilter { int priv_size; ///< size of private data to allocate for the filter +int flags_internal; ///< Additional flags for avfilter internal use only. + /** * Used by the filter registration system. Must not be touched by any other * code. diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 202c2c0..a377f9b 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -220,4 +220,10 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name); */ void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter); +/** + * The filter is aware of hardware frames, and any hardware frame context + * should not be automatically propagated through it. + */ +#define FF_FILTER_FLAG_HWFRAME_AWARE (1 << 0) + #endif /* AVFILTER_INTERNAL_
[FFmpeg-cvslog] lavf/flacdec: Return maximum score if the streaminfo header is valid.
ffmpeg | branch: release/3.2 | Carl Eugen Hoyos | Thu Mar 2 09:29:10 2017 +0100| [582c3d514a7b40d38fff610da2110ac63dfe2e10] | committer: Carl Eugen Hoyos lavf/flacdec: Return maximum score if the streaminfo header is valid. Fixes ticket #6208. (cherry picked from commit 3733039610d76231e404ebf089f0ff2b9d8e5490) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=582c3d514a7b40d38fff610da2110ac63dfe2e10 --- libavformat/flacdec.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 66baba5..fee46fc 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -233,7 +233,14 @@ static int flac_probe(AVProbeData *p) return raw_flac_probe(p); if (p->buf_size < 4 || memcmp(p->buf, "fLaC", 4)) return 0; -return AVPROBE_SCORE_EXTENSION; +if ( p->buf[4] & 0x7f != FLAC_METADATA_TYPE_STREAMINFO +|| AV_RB24(p->buf + 5) != FLAC_STREAMINFO_SIZE +|| AV_RB16(p->buf + 8) < 16 +|| AV_RB16(p->buf + 8) > AV_RB16(p->buf + 10) +|| !(AV_RB24(p->buf + 18) >> 4) +|| AV_RB24(p->buf + 18) >> 4 > 655350) +return AVPROBE_SCORE_EXTENSION; +return AVPROBE_SCORE_MAX; } static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffprobe: fix printing packet side data information
ffmpeg | branch: master | James Almer | Sat Mar 25 13:47:15 2017 -0300| [c14b3ea93c4f009a25ffa82452b5cf8b36a1bbbe] | committer: James Almer ffprobe: fix printing packet side data information Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c14b3ea93c4f009a25ffa82452b5cf8b36a1bbbe --- ffprobe.c | 4 ++-- tests/ref/fate/mov-aac-2048-priming | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ffprobe.c b/ffprobe.c index 77ea349..fa60894 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -1856,12 +1856,12 @@ static void print_pkt_side_data(WriterContext *w, { int i; -writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST); +writer_print_section_header(w, id_data_list); for (i = 0; i < nb_side_data; i++) { const AVPacketSideData *sd = &side_data[i]; const char *name = av_packet_side_data_name(sd->type); -writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA); +writer_print_section_header(w, id_data); print_str("side_data_type", name ? name : "unknown"); if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) { writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1); diff --git a/tests/ref/fate/mov-aac-2048-priming b/tests/ref/fate/mov-aac-2048-priming index 57e12f2..2616944 100644 --- a/tests/ref/fate/mov-aac-2048-priming +++ b/tests/ref/fate/mov-aac-2048-priming @@ -1,4 +1,4 @@ -packet|codec_type=audio|stream_index=0|pts=-2048|pts_time=-0.046440|dts=-2048|dts_time=-0.046440|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=258|pos=36|flags=KDside_data| +packet|codec_type=audio|stream_index=0|pts=-2048|pts_time=-0.046440|dts=-2048|dts_time=-0.046440|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=258|pos=36|flags=KDside_data|side_data_type=Skip Samples|skip_samples=2048|discard_padding=0|skip_reason=0|discard_reason=0 packet|codec_type=audio|stream_index=0|pts=-1024|pts_time=-0.023220|dts=-1024|dts_time=-0.023220|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=258|pos=294|flags=KD packet|codec_type=audio|stream_index=0|pts=0|pts_time=0.00|dts=0|dts_time=0.00|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=146|pos=552|flags=K_ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] tests/fate/source-check: Use git grep in place of grep
ffmpeg | branch: master | Michael Niedermayer | Thu Mar 30 02:41:10 2017 +0200| [ad7aff035517e0639c66f2003243c388450a86ac] | committer: Michael Niedermayer tests/fate/source-check: Use git grep in place of grep grep -L is not posix, solaris default grep does not support it Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ad7aff035517e0639c66f2003243c388450a86ac --- tests/fate/source-check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate/source-check.sh b/tests/fate/source-check.sh index f108d69..5f3fd89 100755 --- a/tests/fate/source-check.sh +++ b/tests/fate/source-check.sh @@ -27,7 +27,7 @@ for f in `git ls-files | grep '\.h$'` ; do -e 's/_vaf_/_/' \ | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" -grep -L "^#define $macro$" $f +git grep -L "^#define $macro$" $f done echo "Use of av_clip() where av_clip_uintp2() could be used:" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter: Add AV_OPT_FLAG_FILTERING_PARAM where it is missing
ffmpeg | branch: master | Michael Niedermayer | Tue Mar 28 23:50:03 2017 +0200| [5f019909c0e21e81646cdd43ef537e2e1404ccc4] | committer: Michael Niedermayer avfilter: Add AV_OPT_FLAG_FILTERING_PARAM where it is missing Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f019909c0e21e81646cdd43ef537e2e1404ccc4 --- libavfilter/vf_deinterlace_qsv.c | 2 +- libavfilter/vf_scale_qsv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index bd43ef7..2810bff 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -527,7 +527,7 @@ static int qsvdeint_request_frame(AVFilterLink *outlink) } #define OFFSET(x) offsetof(QSVDeintContext, x) -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM static const AVOption options[] = { { NULL }, }; diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 8b262b6..a5f5be7 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -581,7 +581,7 @@ fail: } #define OFFSET(x) offsetof(QSVScaleContext, x) -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM static const AVOption options[] = { { "w", "Output video width", OFFSET(w_expr), AV_OPT_TYPE_STRING, { .str = "iw" }, .flags = FLAGS }, { "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog