From 6ac34eed54f8e0298acb16636d0104c297e3d09f Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 27 Oct 2011 20:16:45 -0400 Subject: g726: use bits_per_coded_sample instead of bitrate to determine mode This requires some workarounds in the WAV muxer and demuxer. We need to write the correct bits_per_coded_sample and block_align in the muxer. In the demuxer, we cannot rely on the bits_per_coded_sample value, so we use the bit rate and sample rate to determine the value. This avoids having the decoder rely on AVCodecContext.bit_rate, which is not required to be set by the user for decoding according to our API. --- libavformat/riff.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'libavformat') diff --git a/libavformat/riff.c b/libavformat/riff.c index 0f4c079b35..8eed7ce28e 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -385,11 +385,13 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) avio_wl32(pb, enc->sample_rate); if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) { bps = 0; - } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { - bps = 4; } else { - if (!(bps = av_get_bits_per_sample(enc->codec_id))) - bps = 16; // default to 16 + if (!(bps = av_get_bits_per_sample(enc->codec_id))) { + if (enc->bits_per_coded_sample) + bps = enc->bits_per_coded_sample; + else + bps = 16; // default to 16 + } } if(bps != enc->bits_per_coded_sample && enc->bits_per_coded_sample){ av_log(enc, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) and actually stored (%d) differ\n", enc->bits_per_coded_sample, bps); @@ -400,12 +402,10 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) //blkalign = 144 * enc->bit_rate/enc->sample_rate; } else if (enc->codec_id == CODEC_ID_AC3) { blkalign = 3840; //maximum bytes per frame - } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { // - blkalign = 1; } else if (enc->block_align != 0) { /* specified by the codec */ blkalign = enc->block_align; } else - blkalign = enc->channels*bps >> 3; + blkalign = bps * enc->channels / av_gcd(8, bps); if (enc->codec_id == CODEC_ID_PCM_U8 || enc->codec_id == CODEC_ID_PCM_S24LE || enc->codec_id == CODEC_ID_PCM_S32LE || @@ -545,6 +545,9 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) codec->channels = 0; codec->sample_rate = 0; } + /* override bits_per_coded_sample for G.726 */ + if (codec->codec_id == CODEC_ID_ADPCM_G726) + codec->bits_per_coded_sample = codec->bit_rate / codec->sample_rate; return 0; } -- cgit v1.2.3 From ec22979a1d88bf1c8986ffa3074deac272706e7e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 2 Nov 2011 09:47:59 +0100 Subject: id3v2: fix type of ID3v2EMFunc.free() --- libavformat/id3v2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libavformat') diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index c593007e87..92f25901e5 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -122,8 +122,9 @@ static unsigned int get_size(AVIOContext *s, int len) /** * Free GEOB type extra metadata. */ -static void free_geobtag(ID3v2ExtraMetaGEOB *geob) +static void free_geobtag(void *obj) { + ID3v2ExtraMetaGEOB *geob = obj; av_free(geob->mime_type); av_free(geob->file_name); av_free(geob->description); @@ -384,7 +385,7 @@ typedef struct ID3v2EMFunc { const char *tag3; const char *tag4; void (*read)(AVFormatContext*, AVIOContext*, int, char*, ID3v2ExtraMeta **); - void (*free)(); + void (*free)(void *obj); } ID3v2EMFunc; static const ID3v2EMFunc id3v2_extra_meta_funcs[] = { -- cgit v1.2.3 From 124e28847b95a70724399c8473dd778b5c4c8ffc Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 30 Oct 2011 17:56:57 +0100 Subject: Remove some stray unnecessary ffmpeg references. --- libavcodec/dvbsub.c | 2 +- libavcodec/dvbsubdec.c | 2 +- libavcodec/dvdsub_parser.c | 2 +- libavcodec/dvdsubdec.c | 2 +- libavcodec/dvdsubenc.c | 2 +- libavcodec/h263.c | 2 +- libavcodec/indeo3.c | 2 +- libavcodec/indeo3data.h | 2 +- libavcodec/msmpeg4.c | 4 ++-- libavcodec/msmpeg4.h | 2 +- libavcodec/msmpeg4data.c | 2 +- libavcodec/msmpeg4data.h | 2 +- libavfilter/vf_drawtext.c | 2 +- libavformat/avio.c | 2 +- libavformat/aviobuf.c | 2 +- libavformat/avisynth.c | 2 +- libavformat/file.c | 2 +- libavformat/mpegts.c | 2 +- libavformat/os_support.c | 2 +- libavformat/os_support.h | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) (limited to 'libavformat') diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c index 713f91ed0c..4788d50cfe 100644 --- a/libavcodec/dvbsub.c +++ b/libavcodec/dvbsub.c @@ -1,5 +1,5 @@ /* - * DVB subtitle encoding for ffmpeg + * DVB subtitle encoding * Copyright (c) 2005 Fabrice Bellard * * This file is part of Libav. diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index aef2c08f30..aafc046d97 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1,5 +1,5 @@ /* - * DVB subtitle decoding for ffmpeg + * DVB subtitle decoding * Copyright (c) 2005 Ian Caulfield * * This file is part of Libav. diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c index e4c01e05cc..f46d1a452a 100644 --- a/libavcodec/dvdsub_parser.c +++ b/libavcodec/dvdsub_parser.c @@ -1,5 +1,5 @@ /* - * DVD subtitle decoding for ffmpeg + * DVD subtitle decoding * Copyright (c) 2005 Fabrice Bellard * * This file is part of Libav. diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 776cb61ea7..ee9331cabe 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -1,5 +1,5 @@ /* - * DVD subtitle decoding for ffmpeg + * DVD subtitle decoding * Copyright (c) 2005 Fabrice Bellard * * This file is part of Libav. diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index 96f4321a2f..82d0608664 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -1,5 +1,5 @@ /* - * DVD subtitle encoding for ffmpeg + * DVD subtitle encoding * Copyright (c) 2005 Wolfram Gloger * * This file is part of Libav. diff --git a/libavcodec/h263.c b/libavcodec/h263.c index b3c93027ee..77a1bb828b 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -1,5 +1,5 @@ /* - * H263/MPEG4 backend for ffmpeg encoder and decoder + * H263/MPEG4 backend for encoder and decoder * Copyright (c) 2000,2001 Fabrice Bellard * H263+ support. * Copyright (c) 2001 Juan J. Sierralta P diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index d931f9fc45..96f8e273de 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -1,5 +1,5 @@ /* - * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg + * Intel Indeo 3 (IV31, IV32, etc.) video decoder * written, produced, and directed by Alan Smithee * * This file is part of Libav. diff --git a/libavcodec/indeo3data.h b/libavcodec/indeo3data.h index 334c3e0c97..e608a16119 100644 --- a/libavcodec/indeo3data.h +++ b/libavcodec/indeo3data.h @@ -1,5 +1,5 @@ /* - * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg + * Intel Indeo 3 (IV31, IV32, etc.) video decoder * written, produced, and directed by Alan Smithee * * This file is part of Libav. diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index cfdfd8ef28..93191ccf10 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -1,5 +1,5 @@ /* - * MSMPEG4 backend for ffmpeg encoder and decoder + * MSMPEG4 backend for encoder and decoder * Copyright (c) 2001 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer * @@ -24,7 +24,7 @@ /** * @file - * MSMPEG4 backend for ffmpeg encoder and decoder. + * MSMPEG4 backend for encoder and decoder */ #include "avcodec.h" diff --git a/libavcodec/msmpeg4.h b/libavcodec/msmpeg4.h index 9247accd48..77b1944205 100644 --- a/libavcodec/msmpeg4.h +++ b/libavcodec/msmpeg4.h @@ -1,5 +1,5 @@ /* - * MSMPEG4 backend for ffmpeg encoder and decoder + * MSMPEG4 backend for encoder and decoder * copyright (c) 2007 Aurelien Jacobs * * This file is part of Libav. diff --git a/libavcodec/msmpeg4data.c b/libavcodec/msmpeg4data.c index eeb812297d..6799a9ccd2 100644 --- a/libavcodec/msmpeg4data.c +++ b/libavcodec/msmpeg4data.c @@ -1,5 +1,5 @@ /* - * MSMPEG4 backend for ffmpeg encoder and decoder + * MSMPEG4 backend for encoder and decoder * copyright (c) 2001 Fabrice Bellard * copyright (c) 2002-2004 Michael Niedermayer * diff --git a/libavcodec/msmpeg4data.h b/libavcodec/msmpeg4data.h index bbb802e441..0907c7a295 100644 --- a/libavcodec/msmpeg4data.h +++ b/libavcodec/msmpeg4data.h @@ -1,5 +1,5 @@ /* - * MSMPEG4 backend for ffmpeg encoder and decoder + * MSMPEG4 backend for encoder and decoder * copyright (c) 2001 Fabrice Bellard * copyright (c) 2002-2004 Michael Niedermayer * diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index fe884a05b6..c145874fa2 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -22,7 +22,7 @@ /** * @file - * drawtext filter, based on the original FFmpeg vhook/drawtext.c + * drawtext filter, based on the original vhook/drawtext.c * filter by Gustavo Sverzut Barbieri */ diff --git a/libavformat/avio.c b/libavformat/avio.c index ac15407fda..a954aa8170 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -1,5 +1,5 @@ /* - * Unbuffered io for ffmpeg system + * unbuffered I/O * Copyright (c) 2001 Fabrice Bellard * * This file is part of Libav. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 8f3599a9dc..8bd3e78446 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1,5 +1,5 @@ /* - * Buffered I/O for ffmpeg system + * buffered I/O * Copyright (c) 2000,2001 Fabrice Bellard * * This file is part of Libav. diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 78eb5e6025..01fe1752e4 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -1,5 +1,5 @@ /* - * AVISynth support for ffmpeg system + * AVISynth support * Copyright (c) 2006 DivX, Inc. * * This file is part of Libav. diff --git a/libavformat/file.c b/libavformat/file.c index 649640a927..cca9ec1a06 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -1,5 +1,5 @@ /* - * Buffered file io for ffmpeg system + * buffered file I/O * Copyright (c) 2001 Fabrice Bellard * * This file is part of Libav. diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 5fa82dc21a..2e390e4268 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1440,7 +1440,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (pid < 0) break; - /* now create ffmpeg stream */ + /* now create stream */ if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) { pes = ts->pids[pid]->u.pes_filter.opaque; if (!pes->st) { diff --git a/libavformat/os_support.c b/libavformat/os_support.c index a0fcd6c9ba..c6715f3cc3 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -1,5 +1,5 @@ /* - * Various utilities for ffmpeg system + * various OS-feature replacement utilities * Copyright (c) 2000, 2001, 2002 Fabrice Bellard * copyright (c) 2002 Francois Revol * diff --git a/libavformat/os_support.h b/libavformat/os_support.h index 521e9978a2..20c6d73738 100644 --- a/libavformat/os_support.h +++ b/libavformat/os_support.h @@ -1,5 +1,5 @@ /* - * various utilities for ffmpeg system + * various OS-feature replacement utilities * copyright (c) 2000, 2001, 2002 Fabrice Bellard * * This file is part of Libav. -- cgit v1.2.3 From 20566eb0f0e3b0f538bcf68fca42e67afaa0dec6 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 30 Oct 2011 17:59:01 +0100 Subject: Replace outdated references to ffmpeg tool with avconv. --- avplay.c | 2 +- avserver.c | 6 +++--- libavcodec/adxenc.c | 2 +- libavcodec/libxvidff.c | 6 +++--- libavformat/cutils.c | 2 +- libavformat/http.c | 4 ++-- libavformat/movenc.h | 2 +- libavformat/nsvdec.c | 6 +++++- 8 files changed, 17 insertions(+), 13 deletions(-) (limited to 'libavformat') diff --git a/avplay.c b/avplay.c index 93a0e1b5a8..58db59639d 100644 --- a/avplay.c +++ b/avplay.c @@ -2997,7 +2997,7 @@ static const OptionDef options[] = { #endif { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, - { "i", 0, {NULL}, "ffmpeg compatibility dummy option", ""}, + { "i", 0, {NULL}, "avconv compatibility dummy option", ""}, { NULL, }, }; diff --git a/avserver.c b/avserver.c index cb8f41f509..fb719e245f 100644 --- a/avserver.c +++ b/avserver.c @@ -223,8 +223,8 @@ typedef struct FFStream { char title[512]; char copyright[512]; char comment[512]; - pid_t pid; /* Of ffmpeg process */ - time_t pid_start; /* Of ffmpeg process */ + pid_t pid; /* of avconv process */ + time_t pid_start; /* of avconv process */ char **child_argv; struct FFStream *next; unsigned bandwidth; /* bandwidth, in kbits/s */ @@ -474,7 +474,7 @@ static void start_children(FFStream *feed) slash = pathname; else slash++; - strcpy(slash, "ffmpeg"); + strcpy(slash, "avconv"); http_log("Launch commandline: "); http_log("%s ", pathname); diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c index 296ccbd58a..61ba07a35d 100644 --- a/libavcodec/adxenc.c +++ b/libavcodec/adxenc.c @@ -145,7 +145,7 @@ static int adx_encode_frame(AVCodecContext *avctx, /* input data size = - ffmpeg.c: do_audio_out() + avconv.c:do_audio_out() frame_bytes = enc->frame_size * 2 * enc->channels; */ diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c index 526969066d..d0f4ed39be 100644 --- a/libavcodec/libxvidff.c +++ b/libavcodec/libxvidff.c @@ -137,7 +137,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { xvid_enc_create_t xvid_enc_create; xvid_enc_plugin_t plugins[7]; - /* Bring in VOP flags from ffmpeg command-line */ + /* Bring in VOP flags from avconv command-line */ x->vop_flags = XVID_VOP_HALFPEL; /* Bare minimum quality */ if( xvid_flags & CODEC_FLAG_4MV ) x->vop_flags |= XVID_VOP_INTER4V; /* Level 3 */ @@ -191,7 +191,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { break; } - /* Bring in VOL flags from ffmpeg command-line */ + /* Bring in VOL flags from avconv command-line */ x->vol_flags = 0; if( xvid_flags & CODEC_FLAG_GMC ) { x->vol_flags |= XVID_VOL_GMC; @@ -669,7 +669,7 @@ static int xvid_ff_2pass_create(xvid_plg_create_t * param, /* This is because we can safely prevent a buffer overflow */ log[0] = 0; snprintf(log, BUFFER_REMAINING(log), - "# ffmpeg 2-pass log file, using xvid codec\n"); + "# avconv 2-pass log file, using xvid codec\n"); snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log), "# Do not modify. libxvidcore version: %d.%d.%d\n\n", XVID_VERSION_MAJOR(XVID_VERSION), diff --git a/libavformat/cutils.c b/libavformat/cutils.c index 092aa8a1a9..f94442f1bd 100644 --- a/libavformat/cutils.c +++ b/libavformat/cutils.c @@ -24,7 +24,7 @@ /* add one element to a dynamic array */ void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem) { - /* see similar ffmpeg.c:grow_array() */ + /* see similar avconv.c:grow_array() */ int nb, nb_alloc; intptr_t *tab; diff --git a/libavformat/http.c b/libavformat/http.c index 10ec70fedd..1db9e82cc4 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -1,5 +1,5 @@ /* - * HTTP protocol for ffmpeg client + * HTTP protocol for avconv client * Copyright (c) 2000, 2001 Fabrice Bellard * * This file is part of Libav. @@ -31,7 +31,7 @@ #include "url.h" #include "libavutil/opt.h" -/* XXX: POST protocol is not completely implemented because ffmpeg uses +/* XXX: POST protocol is not completely implemented because avconv uses only a subset of it. */ /* used for protocol handling */ diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 39cdb39284..bddae459da 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -35,7 +35,7 @@ #define MODE_MOV 0x02 #define MODE_3GP 0x04 #define MODE_PSP 0x08 // example working PSP command line: -// ffmpeg -i testinput.avi -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 M4V00001.MP4 +// avconv -i testinput.avi -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 M4V00001.MP4 #define MODE_3G2 0x10 #define MODE_IPOD 0x20 diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 84957c6a7a..d0fac9afb0 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -71,7 +71,11 @@ * so the header seems to not be mandatory. (for streaming). * * index slice duration check (excepts nsvtrailer.nsv): - * for f in [^n]*.nsv; do DUR="$(ffmpeg -i "$f" 2>/dev/null | grep 'NSVf duration' | cut -d ' ' -f 4)"; IC="$(ffmpeg -i "$f" 2>/dev/null | grep 'INDEX ENTRIES' | cut -d ' ' -f 2)"; echo "duration $DUR, slite time $(($DUR/$IC))"; done + * for f in [^n]*.nsv; do + * DUR="$(avconv -i "$f" 2> /dev/null | grep 'NSVf duration' | cut -d ' ' -f 4)" + * IC="$(avconv -i "$f" 2> /dev/null | grep 'INDEX ENTRIES' | cut -d ' ' -f 2)" + * echo "duration $DUR, slite time $(($DUR/$IC))" + * done */ /* -- cgit v1.2.3 From 2f5df0b12caea699ba85efa1fdb54fd0b57b4cfd Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 30 Oct 2011 18:02:42 +0100 Subject: Replace ffmpeg references with more accurate libav* references. --- libavcodec/idcinvideo.c | 2 +- libavcodec/libtheoraenc.c | 2 +- libavcodec/mace.c | 2 +- libavcodec/mpeg4videodec.c | 2 +- libavcodec/rpza.c | 4 ++-- libavcodec/sparc/dsputil_vis.c | 2 +- libavcodec/truemotion1data.h | 6 +++--- libavformat/asfdec.c | 2 +- libavformat/au.c | 2 +- libavformat/cutils.c | 2 +- libavformat/dv.c | 2 +- libavformat/rso.h | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) (limited to 'libavformat') diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c index 99c43a09a4..8ae15eb67f 100644 --- a/libavcodec/idcinvideo.c +++ b/libavcodec/idcinvideo.c @@ -36,7 +36,7 @@ * a little more compression by exploiting the fact that adjacent pixels * tend to be similar. * - * Note that this decoder could use ffmpeg's optimized VLC facilities + * Note that this decoder could use libavcodec's optimized VLC facilities * rather than naive, tree-based Huffman decoding. However, there are 256 * Huffman tables. Plus, the VLC bit coding order is right -> left instead * or left -> right, so all of the bits would have to be reversed. Further, diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index 86cc09ffa6..ecceceaa12 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -241,7 +241,7 @@ static av_cold int encode_init(AVCodecContext* avc_context) header, comment, and tables. Each one is prefixed with a 16bit size, then they - are concatenated together into ffmpeg's extradata. + are concatenated together into libavcodec's extradata. */ offset = 0; diff --git a/libavcodec/mace.c b/libavcodec/mace.c index bf7c3319eb..5e870a2d2e 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -27,7 +27,7 @@ #include "avcodec.h" /* - * Adapted to ffmpeg by Francois Revol + * Adapted to libavcodec by Francois Revol * (removed 68k REG stuff, changed types, added some statics and consts, * libavcodec api, context stuff, interlaced stereo out). */ diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index cd7de73c98..2807d506ee 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1854,7 +1854,7 @@ static int decode_user_data(MpegEncContext *s, GetBitContext *gb){ } } - /* ffmpeg detection */ + /* libavcodec detection */ e=sscanf(buf, "FFmpe%*[^b]b%d", &build)+3; if(e!=4) e=sscanf(buf, "FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build); diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c index 3fb3dc5b95..7350ef2c4a 100644 --- a/libavcodec/rpza.c +++ b/libavcodec/rpza.c @@ -30,8 +30,8 @@ * Note that this decoder reads big endian RGB555 pixel values from the * bytestream, arranges them in the host's endian order, and outputs * them to the final rendered map in the same host endian order. This is - * intended behavior as the ffmpeg documentation states that RGB555 pixels - * shall be stored in native CPU endianness. + * intended behavior as the libavcodec documentation states that RGB555 + * pixels shall be stored in native CPU endianness. */ #include diff --git a/libavcodec/sparc/dsputil_vis.c b/libavcodec/sparc/dsputil_vis.c index e45bfd28e6..5a9fbc2648 100644 --- a/libavcodec/sparc/dsputil_vis.c +++ b/libavcodec/sparc/dsputil_vis.c @@ -19,7 +19,7 @@ */ /* The *no_round* functions have been added by James A. Morrison, 2003,2004. - The vis code from libmpeg2 was adapted for ffmpeg by James A. Morrison. + The vis code from libmpeg2 was adapted for libavcodec by James A. Morrison. */ #include "config.h" diff --git a/libavcodec/truemotion1data.h b/libavcodec/truemotion1data.h index c94e3b5add..e950450fcd 100644 --- a/libavcodec/truemotion1data.h +++ b/libavcodec/truemotion1data.h @@ -2,9 +2,9 @@ * Duck Truemotion v1 Decoding Tables * * Data in this file was originally part of VpVision from On2 which is - * distributed under the GNU GPL. It is redistributed with ffmpeg under the - * GNU LGPL using the common understanding that data tables necessary for - * decoding algorithms are not necessarily licensable. + * distributed under the GNU GPL. It is redistributed with libavcodec under + * the GNU LGPL using the common understanding that data tables necessary + * for decoding algorithms are not necessarily copyrightable. * * This file is part of Libav. * diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index ed06e8a897..02453407b5 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -362,7 +362,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) /* Extract palette from extradata if bpp <= 8 */ /* This code assumes that extradata contains only palette */ - /* This is true for all paletted codecs implemented in ffmpeg */ + /* This is true for all paletted codecs implemented in libavcodec */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { int av_unused i; #if HAVE_BIGENDIAN diff --git a/libavformat/au.c b/libavformat/au.c index 5121574c3c..4f7677347b 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -35,7 +35,7 @@ /* if we don't know the size in advance */ #define AU_UNKNOWN_SIZE ((uint32_t)(~0)) -/* The ffmpeg codecs we support, and the IDs they have in the file */ +/* The libavcodec codecs we support, and the IDs they have in the file */ static const AVCodecTag codec_au_tags[] = { { CODEC_ID_PCM_MULAW, 1 }, { CODEC_ID_PCM_S8, 2 }, diff --git a/libavformat/cutils.c b/libavformat/cutils.c index f94442f1bd..995524400e 100644 --- a/libavformat/cutils.c +++ b/libavformat/cutils.c @@ -1,5 +1,5 @@ /* - * Various simple utilities for ffmpeg system + * various simple utilities for libavformat * Copyright (c) 2000, 2001, 2002 Fabrice Bellard * * This file is part of Libav. diff --git a/libavformat/dv.c b/libavformat/dv.c index 2813bc3b67..21823752f5 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -96,7 +96,7 @@ static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t) /* * There's a couple of assumptions being made here: * 1. By default we silence erroneous (0x8000/16bit 0x800/12bit) audio samples. - * We can pass them upwards when ffmpeg will be ready to deal with them. + * We can pass them upwards when libavcodec will be ready to deal with them. * 2. We don't do software emphasis. * 3. Audio is always returned as 16bit linear samples: 12bit nonlinear samples * are converted into 16bit linear ones. diff --git a/libavformat/rso.h b/libavformat/rso.h index bdb39e8d7f..e3e88ea644 100644 --- a/libavformat/rso.h +++ b/libavformat/rso.h @@ -26,7 +26,7 @@ #define RSO_HEADER_SIZE 8 -/* The ffmpeg codecs we support, and the IDs they have in the file */ +/* The libavcodec codecs we support, and the IDs they have in the file */ extern const AVCodecTag ff_codec_rso_tags[]; #endif /* AVFORMAT_RSO_H */ -- cgit v1.2.3 From c6cd0e17f33f3f921780866f914abe860f912b8e Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 30 Oct 2011 21:30:32 +0100 Subject: Replace vendor string in Ogg and FLAC muxers. --- libavformat/flacenc.c | 2 +- libavformat/oggenc.c | 2 +- tests/ref/acodec/flac | 4 ++-- tests/ref/lavf/ogg | 4 ++-- tests/ref/seek/flac_flac | 46 +++++++++++++++++++++++----------------------- tests/ref/seek/lavf_ogg | 2 +- 6 files changed, 30 insertions(+), 30 deletions(-) (limited to 'libavformat') diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index 00e89002fe..725dc714ce 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -41,7 +41,7 @@ static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_byte static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, int last_block, int bitexact) { - const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; + const char *vendor = bitexact ? "Libav" : LIBAVFORMAT_IDENT; unsigned int len, count; uint8_t *p, *p0; diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 7549b3a0a3..16a14d2708 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -224,7 +224,7 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st, static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact, int *header_len, AVDictionary **m, int framing_bit) { - const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; + const char *vendor = bitexact ? "Libav" : LIBAVFORMAT_IDENT; int size; uint8_t *p, *p0; unsigned int count; diff --git a/tests/ref/acodec/flac b/tests/ref/acodec/flac index 992a4e387b..cc5c173918 100644 --- a/tests/ref/acodec/flac +++ b/tests/ref/acodec/flac @@ -1,4 +1,4 @@ -151eef9097f944726968bec48649f00a *./tests/data/acodec/flac.flac -361582 ./tests/data/acodec/flac.flac +f582b59cc68adfcb3342dcfd7e020b71 *./tests/data/acodec/flac.flac +361581 ./tests/data/acodec/flac.flac 64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/flac.acodec.out.wav stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400 diff --git a/tests/ref/lavf/ogg b/tests/ref/lavf/ogg index eb96fd92c0..b90bb70276 100644 --- a/tests/ref/lavf/ogg +++ b/tests/ref/lavf/ogg @@ -1,3 +1,3 @@ -364714f1087f3c1320b60f4209191d23 *./tests/data/lavf/lavf.ogg -13820 ./tests/data/lavf/lavf.ogg +b55661ae1a65f99af249d8efc7619a03 *./tests/data/lavf/lavf.ogg +13819 ./tests/data/lavf/lavf.ogg ./tests/data/lavf/lavf.ogg CRC=0xf1ae5536 diff --git a/tests/ref/seek/flac_flac b/tests/ref/seek/flac_flac index ab31891f1d..15ab0d2ee3 100644 --- a/tests/ref/seek/flac_flac +++ b/tests/ref/seek/flac_flac @@ -1,49 +1,49 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8256 size: 614 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8255 size: 614 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8256 size: 614 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8255 size: 614 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 86742 size: 2191 +ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 86741 size: 2191 ret: 0 st: 0 flags:0 ts: 0.788345 -ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos: 27366 size: 615 +ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos: 27365 size: 615 ret:-1 st: 0 flags:1 ts:-0.317506 ret: 0 st:-1 flags:0 ts: 2.576668 -ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos: 145606 size: 2384 +ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos: 145605 size: 2384 ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 53388 size: 1851 +ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 53387 size: 1851 ret: 0 st: 0 flags:0 ts: 0.365011 -ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 16890 size: 614 +ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 16889 size: 614 ret:-1 st: 0 flags:1 ts:-0.740839 ret: 0 st:-1 flags:0 ts: 2.153336 -ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 110531 size: 2143 +ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 110530 size: 2143 ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 32880 size: 579 +ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 32879 size: 579 ret: 0 st: 0 flags:0 ts:-0.058322 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8256 size: 614 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8255 size: 614 ret: 0 st: 0 flags:1 ts: 2.835828 -ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos: 167112 size: 2391 +ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos: 167111 size: 2391 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 75788 size: 2191 +ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 75787 size: 2191 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos: 22446 size: 616 +ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos: 22445 size: 616 ret: 0 st: 0 flags:0 ts:-0.481655 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8256 size: 614 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8255 size: 614 ret: 0 st: 0 flags:1 ts: 2.412494 -ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos: 129793 size: 2138 +ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos: 129792 size: 2138 ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 44812 size: 1609 +ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 44811 size: 1609 ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos: 12572 size: 628 +ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos: 12571 size: 628 ret: 0 st: 0 flags:0 ts:-0.904989 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8256 size: 614 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8255 size: 614 ret: 0 st: 0 flags:1 ts: 1.989184 -ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos: 95508 size: 2169 +ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos: 95507 size: 2169 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos: 29211 size: 620 +ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos: 29210 size: 620 ret:-1 st:-1 flags:1 ts:-0.222493 ret: 0 st: 0 flags:0 ts: 2.671678 -ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos: 155154 size: 2394 +ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos: 155153 size: 2394 ret: 0 st: 0 flags:1 ts: 1.565850 -ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos: 59082 size: 1974 +ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos: 59081 size: 1974 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos: 19353 size: 608 +ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos: 19352 size: 608 ret:-1 st:-1 flags:1 ts:-0.645825 diff --git a/tests/ref/seek/lavf_ogg b/tests/ref/seek/lavf_ogg index c9be9c68bb..ea8eb8bb58 100644 --- a/tests/ref/seek/lavf_ogg +++ b/tests/ref/seek/lavf_ogg @@ -1,4 +1,4 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 125 size: 1364 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 124 size: 1364 ret:-1 st:-1 flags:0 ts:-1.000000 ret:-1 st:-1 flags:1 ts: 1.894167 ret:-1 st: 0 flags:0 ts: 0.788345 -- cgit v1.2.3 From 87c57d807fa198b97587bbf211b8d375f925c737 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 28 Oct 2011 00:07:32 -0400 Subject: Create separate functions for the raw GSM demuxer. Put the new raw GSM demuxer in its own file. Fixes raw GSM demuxing. --- libavformat/Makefile | 2 +- libavformat/gsmdec.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++ libavformat/rawdec.c | 12 ----- 3 files changed, 136 insertions(+), 13 deletions(-) create mode 100644 libavformat/gsmdec.c (limited to 'libavformat') diff --git a/libavformat/Makefile b/libavformat/Makefile index 903b3ee9ce..ca4ceef54f 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -85,7 +85,7 @@ OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o OBJS-$(CONFIG_FRAMEMD5_MUXER) += md5enc.o OBJS-$(CONFIG_GIF_MUXER) += gif.o -OBJS-$(CONFIG_GSM_DEMUXER) += rawdec.o +OBJS-$(CONFIG_GSM_DEMUXER) += gsmdec.o OBJS-$(CONFIG_GXF_DEMUXER) += gxf.o OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o audiointerleave.o OBJS-$(CONFIG_G722_DEMUXER) += rawdec.o diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c new file mode 100644 index 0000000000..291e2c56aa --- /dev/null +++ b/libavformat/gsmdec.c @@ -0,0 +1,135 @@ +/* + * RAW GSM demuxer + * Copyright (c) 2011 Justin Ruggles + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/mathematics.h" +#include "libavutil/opt.h" +#include "avformat.h" + +#define GSM_BLOCK_SIZE 33 +#define GSM_BLOCK_SAMPLES 160 +#define GSM_SAMPLE_RATE 8000 + +typedef struct { + AVClass *class; + int sample_rate; +} GSMDemuxerContext; + +static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + int ret, size; + + size = GSM_BLOCK_SIZE * 32; + + if (av_new_packet(pkt, size) < 0) + return AVERROR(ENOMEM); + + pkt->pos = avio_tell(s->pb); + pkt->stream_index = 0; + + ret = av_get_packet(s->pb, pkt, size); + if (ret < GSM_BLOCK_SIZE) { + av_free_packet(pkt); + return ret < 0 ? ret : AVERROR(EIO); + } + pkt->size = ret; + pkt->duration = ret / GSM_BLOCK_SIZE; + pkt->pts = pkt->pos / GSM_BLOCK_SIZE; + + return 0; +} + +static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap) +{ + GSMDemuxerContext *c = s->priv_data; + AVStream *st = avformat_new_stream(s, NULL); + if (!st) + return AVERROR(ENOMEM); + + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + st->codec->codec_id = s->iformat->value; + st->codec->channels = 1; + st->codec->sample_rate = c->sample_rate; + st->codec->block_align = GSM_BLOCK_SIZE; + st->codec->bit_rate = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES; + + av_set_pts_info(st, 64, GSM_BLOCK_SAMPLES, GSM_SAMPLE_RATE); + + return 0; +} + +static int gsm_read_seek2(AVFormatContext *s, int stream_index, int64_t min_ts, + int64_t ts, int64_t max_ts, int flags) +{ + GSMDemuxerContext *c = s->priv_data; + + /* convert timestamps to file positions */ + if (!(flags & AVSEEK_FLAG_BYTE)) { + if (stream_index < 0) { + AVRational bitrate_q = { GSM_BLOCK_SAMPLES, c->sample_rate * GSM_BLOCK_SIZE }; + ts = av_rescale_q(ts, AV_TIME_BASE_Q, bitrate_q); + min_ts = av_rescale_q(min_ts, AV_TIME_BASE_Q, bitrate_q); + max_ts = av_rescale_q(max_ts, AV_TIME_BASE_Q, bitrate_q); + } else { + ts *= GSM_BLOCK_SIZE; + min_ts *= GSM_BLOCK_SIZE; + max_ts *= GSM_BLOCK_SIZE; + } + } + /* round to nearest block boundary */ + ts = (ts + GSM_BLOCK_SIZE / 2) / GSM_BLOCK_SIZE * GSM_BLOCK_SIZE; + ts = FFMAX(0, ts); + + /* handle min/max */ + while (ts < min_ts) + ts += GSM_BLOCK_SIZE; + while (ts > max_ts) + ts -= GSM_BLOCK_SIZE; + if (ts < min_ts || ts > max_ts) + return -1; + + return avio_seek(s->pb, ts, SEEK_SET); +} + +static const AVOption options[] = { + { "sample_rate", "", offsetof(GSMDemuxerContext, sample_rate), + AV_OPT_TYPE_INT, {.dbl = GSM_SAMPLE_RATE}, 1, INT_MAX / GSM_BLOCK_SIZE, + AV_OPT_FLAG_DECODING_PARAM }, + { NULL }, +}; + +static const AVClass class = { + .class_name = "gsm demuxer", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + +AVInputFormat ff_gsm_demuxer = { + .name = "gsm", + .long_name = NULL_IF_CONFIG_SMALL("raw GSM"), + .priv_data_size = sizeof(GSMDemuxerContext), + .read_header = gsm_read_header, + .read_packet = gsm_read_packet, + .read_seek2 = gsm_read_seek2, + .extensions = "gsm", + .value = CODEC_ID_GSM, + .priv_class = &class, +}; diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index fb3336d37c..db8a0cd62b 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -186,18 +186,6 @@ AVInputFormat ff_g722_demuxer = { }; #endif -#if CONFIG_GSM_DEMUXER -AVInputFormat ff_gsm_demuxer = { - .name = "gsm", - .long_name = NULL_IF_CONFIG_SMALL("raw GSM"), - .read_header = ff_raw_audio_read_header, - .read_packet = ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "gsm", - .value = CODEC_ID_GSM, -}; -#endif - #if CONFIG_LATM_DEMUXER AVInputFormat ff_latm_demuxer = { .name = "latm", -- cgit v1.2.3 From f011fcd67edf27d2b1f6fcdff0b4c19da36176e9 Mon Sep 17 00:00:00 2001 From: John Brooks Date: Sat, 29 Oct 2011 15:41:24 -0600 Subject: rtsp: add allowed_media_types option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Streams from RTSP or SDP that do not match an allowed type will be skipped entirely, which allows video-only or audio-only streaming from servers that provide both. Signed-off-by: Martin Storsjö --- libavformat/rtsp.c | 12 +++++++++++- libavformat/rtsp.h | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'libavformat') diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 5aadc4430a..b9ef0bfe84 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -65,6 +65,12 @@ { name, longname, OFFSET(rtsp_flags), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, DEC, "rtsp_flags" }, \ { "filter_src", "Only receive packets from the negotiated peer IP", 0, AV_OPT_TYPE_CONST, {RTSP_FLAG_FILTER_SRC}, 0, 0, DEC, "rtsp_flags" } +#define RTSP_MEDIATYPE_OPTS(name, longname) \ + { name, longname, OFFSET(media_type_mask), AV_OPT_TYPE_FLAGS, { (1 << (AVMEDIA_TYPE_DATA+1)) - 1 }, INT_MIN, INT_MAX, DEC, "allowed_media_types" }, \ + { "video", "Video", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_VIDEO}, 0, 0, DEC, "allowed_media_types" }, \ + { "audio", "Audio", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_AUDIO}, 0, 0, DEC, "allowed_media_types" }, \ + { "data", "Data", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_DATA}, 0, 0, DEC, "allowed_media_types" } + const AVOption ff_rtsp_options[] = { { "initial_pause", "Don't start playing the stream immediately", OFFSET(initial_pause), AV_OPT_TYPE_INT, {0}, 0, 1, DEC }, FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags), @@ -74,11 +80,13 @@ const AVOption ff_rtsp_options[] = { { "udp_multicast", "UDP multicast", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_UDP_MULTICAST}, 0, 0, DEC, "rtsp_transport" }, { "http", "HTTP tunneling", 0, AV_OPT_TYPE_CONST, {(1 << RTSP_LOWER_TRANSPORT_HTTP)}, 0, 0, DEC, "rtsp_transport" }, RTSP_FLAG_OPTS("rtsp_flags", "RTSP flags"), + RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"), { NULL }, }; static const AVOption sdp_options[] = { RTSP_FLAG_OPTS("sdp_flags", "SDP flags"), + RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"), { NULL }, }; @@ -325,6 +333,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, case 'm': /* new stream */ s1->skip_media = 0; + codec_type = AVMEDIA_TYPE_UNKNOWN; get_word(st_type, sizeof(st_type), &p); if (!strcmp(st_type, "audio")) { codec_type = AVMEDIA_TYPE_AUDIO; @@ -332,7 +341,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, codec_type = AVMEDIA_TYPE_VIDEO; } else if (!strcmp(st_type, "application")) { codec_type = AVMEDIA_TYPE_DATA; - } else { + } + if (codec_type == AVMEDIA_TYPE_UNKNOWN || !(rt->media_type_mask & (1 << codec_type))) { s1->skip_media = 1; return; } diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 7143acbe4f..45b0032797 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -354,6 +354,11 @@ typedef struct RTSPState { * Various option flags for the RTSP muxer/demuxer. */ int rtsp_flags; + + /** + * Mask of all requested media types + */ + int media_type_mask; } RTSPState; #define RTSP_FLAG_FILTER_SRC 0x1 /**< Filter incoming UDP packets - -- cgit v1.2.3 From 905de1190796d3e62d6545e6af34f2c413a68a47 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 26 Oct 2011 12:43:18 -0400 Subject: flvenc: use first packet delay as global delay. This keeps the streams sychronized. The packets must be interleaved per-DTS. --- libavformat/flvenc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'libavformat') diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 0d1fa7312a..80ddcd8989 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -57,10 +57,10 @@ typedef struct FLVContext { int64_t duration_offset; int64_t filesize_offset; int64_t duration; + int64_t delay; ///< first dts delay (needed for AVC & Speex) } FLVContext; typedef struct FLVStreamContext { - int delay; ///< first dts delay for each stream (needed for AVC & Speex) int64_t last_ts; ///< last timestamp for each stream } FLVStreamContext; @@ -207,6 +207,8 @@ static int flv_write_header(AVFormatContext *s) s->streams[i]->priv_data = sc; sc->last_ts = -1; } + flv->delay = AV_NOPTS_VALUE; + avio_write(pb, "FLV", 3); avio_w8(pb,1); avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc @@ -416,10 +418,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) return -1; } } - if (!sc->delay && pkt->dts < 0) - sc->delay = -pkt->dts; + if (flv->delay == AV_NOPTS_VALUE) + flv->delay = -pkt->dts; + if (pkt->dts < -flv->delay) { + av_log(s, AV_LOG_WARNING, "Packets are not in the proper order with " + "respect to DTS\n"); + return AVERROR(EINVAL); + } - ts = pkt->dts + sc->delay; // add delay to force positive dts + ts = pkt->dts + flv->delay; // add delay to force positive dts /* check Speex packet duration */ if (enc->codec_id == CODEC_ID_SPEEX && ts - sc->last_ts > 160) { @@ -450,7 +457,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) avio_write(pb, data ? data : pkt->data, size); avio_wb32(pb,size+flags_size+11); // previous tag size - flv->duration = FFMAX(flv->duration, pkt->pts + sc->delay + pkt->duration); + flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration); avio_flush(pb); -- cgit v1.2.3 From 894bc1d322c18b7f320aa6234e2c921e649da734 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 2 Nov 2011 18:30:49 -0400 Subject: gsm demuxer: do not allocate packet twice. fixes memleak with raw gsm demuxing. --- libavformat/gsmdec.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'libavformat') diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c index 291e2c56aa..8c73c7b447 100644 --- a/libavformat/gsmdec.c +++ b/libavformat/gsmdec.c @@ -38,9 +38,6 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt) size = GSM_BLOCK_SIZE * 32; - if (av_new_packet(pkt, size) < 0) - return AVERROR(ENOMEM); - pkt->pos = avio_tell(s->pb); pkt->stream_index = 0; -- cgit v1.2.3