Re: [FFmpeg-devel] [PATCH] Remove the ffserver program and the ffm muxer/demuxer
On 27.10.2016 20:26, Michael Niedermayer wrote: On Thu, Oct 27, 2016 at 11:03:07AM -0700, Reynaldo H. Verdejo Pinochet wrote: I agree with moving the apps to a seperate repo hosted within the same infra and keeping ffserver. I will help with ffserver as my time & todo list permits I don't follow ffmpeg list for long time, so please forgive me if I said something already discussed, but the news said it is removed because of cleanups. That is reasonable, but in such case moving it to separate repo is nonsense. Also I'm not sure ffmenc/dec removal is good decision at the moment. I don't want to suggest there is ohter app than ffserver that use it, but with these removed you can forget ffserver will exists in other repo, right? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [DECISION] Revoke the decision of dropping ffserver
On 28.11.2016 19:53, Lou Logan wrote: On Mon, Nov 28, 2016, at 09:15 AM, Nicolas George wrote: ffserver has users I don't know of any. Do you have an estimation of how many users there may be? How much feedback has there been from these alleged users regarding the removal plans? I don't have an estimation, but some time ago I got emails from users directly into my email regarding some issues or asking for help. It was the time when I worked on config stuff of ffserver. I am not albe to tell you if it was 2, 3 or more, but there are some users for sure. Regarding voting I will not vote, but arguing ffserver must be deleted, because it was decided basing on facts that may change soon is funny. Of course it is an important rule of the universe that in regular periods of time very determined person to delete something is spawned (or to block something), but being reasonable is also good rule of thumb :P ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v3 3/3] lavd: deprecate opengl outdev
On 14.09.2016 19:53, Nicolas George wrote: Le sextidi 26 fructidor, an CCXXIV, Josh de Kock a écrit : This device depends on SDL which is deprecated. Signed-off-by: Josh de Kock If I understand correctly, SDL is only used in this device to set up a window and a context in a cross-platform way. I even notice that the code can be used without SDL altogether if the applications handles the context and window itself. You are correct. SDL is used just to created default window with opengl context. Probably the only use case of this is to test this device with following command: ffmpeg -i video -f opengl aaa. The relevant implementation is depending on opengl API only and has nothing to do with SDL. Removing it just because of switching to SDL 2.0 is misunderstanding. I can port SDL part to use 2.0 API, just figure out how this will be handled. I mean if you want to support both or just 2.0. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Dropping SDL1 support [VOTE]
On 15.09.2016 23:19, Moritz Barsnick wrote: On Thu, Sep 15, 2016 at 14:36:32 -0300, James Almer wrote: * SDL1 is old and effectively unmaintained. I understand this verbatim, but what is it supposed to mean? Has SDL1 gotten rotten? Or more precisely: - Has technology evolved, and the library not kept up? - Is a long list of bugs (somehow effecting ffmpeg) piling up and never being fixed? - Something else? It doesn't compile on Mac OS ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Dropping SDL1 support [VOTE]
On 15.09.2016 23:36, Josh de Kock wrote: On 15/09/2016 22:28, Lukasz Marek wrote: On 15.09.2016 23:19, Moritz Barsnick wrote: On Thu, Sep 15, 2016 at 14:36:32 -0300, James Almer wrote: * SDL1 is old and effectively unmaintained. I understand this verbatim, but what is it supposed to mean? Has SDL1 gotten rotten? Or more precisely: - Has technology evolved, and the library not kept up? - Is a long list of bugs (somehow effecting ffmpeg) piling up and never being fixed? - Something else? It doesn't compile on Mac OS I've been testing it just fine on Mac OS. I don't remember now everything, I worked with it like 2 years ago, but I got the same issue as here https://forums.libsdl.org/viewtopic.php?p=45264&sid=ae0efc2e82d373067c5112bfba70cd11 Other example is that SDL is trying to use X11 on Mac which is dropped (since 10.8?). You can ignore my answer as it doesn't stand for anything. It won't stop introducing SDL 2.0 nor force 1.2 drop, but asked question if SDL 1.2 is getting rotten then asnwer is yes IMHO. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Resurrection of ffserver
On 17.09.2016 22:27, Rostislav Pehlivanov wrote: On 17 September 2016 at 20:58, Michael Fritscher < michael.fritsc...@telematik-zentrum.de> wrote: Good day, I read the sad news about ffservers a few days ago and have already written some mails to ffmpeg-user. I would like to step in to make ffserver maintainable and distributable again, especially because of the many users depending on ffserver - including myself. I'm capable of C and had made some tiny changes to ffmpeg already, but I'm a beginner regarding the architecture and "unwritten rules" of ffmpeg development. Additionally, I would like to discuss strategic decisions with the main developers to avoid useless work. I really think ffserver is better off being in a separate repository. That way there'd be some finer attention brought to keeping the API usable by external users too. Same with the rest of the programs. So yeah, if you want, just make a separate repository somewhere with only ffserver.c and a configure + makefile and try to make something better and usable. I don't want to declare my statement here what should be done, but there is one more thing you didn't mention. ffserver depends on some specific components located inside ffmpeg libraries. At least on ffm mux/demux. They cannot be moved. The problem is, people sometimes opens ticket with error report like that: "I used version X, released about year ago and it worked fine. Now I upgraded and it doesn't work" Keeping it everything in one repo allows you to use bisection to find where the problem were introduced. Where you keep it in separate repositories it become much more complex. Now when you move back in repo history, you know all tools will compile (unless some commits are pushed in wrong order), when you have more repositories then you have to correlate it. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Resurrection of ffserver
On 17.09.2016 23:10, Rostislav Pehlivanov wrote: On 17 September 2016 at 22:04, Lukasz Marek wrote: Yeah, no. You can hardly say ffserver is a perfect program right now, so really moving it to another repo is hardly much of a change in terms of functionality. Bisection won't matter if half the program needs to be rewritten to make it good. And the future of ffm mux/demux is the same as the future of ffserver. And besides none of this even matters because ffserver's getting deleted. You can't stop it. This was decided long ago. It's in the news. It won't get better overnight. This email thread is now about whether someone wants to maintain it somewhere else, which doesn't concern the project other than having people who are interested in contributing to something like that. I didn't know it is decided to delete it. In such case I have no objections. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/opengl: use SDL2
On 18 September 2016 at 00:30, Josh de Kock wrote: > I did this in about 5 minutes, and only tested it with one sample (on > OSX using the cocoa opengl renderer). Seems to work, but probably > won't for all cases. Would like some feedback where it doesnt work etc > > Signed-off-by: Josh de Kock > --- > libavdevice/opengl_enc.c | 87 +- > -- > 1 file changed, 46 insertions(+), 41 deletions(-) > > diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c > index 1dbbb80..1917459 100644 > --- a/libavdevice/opengl_enc.c > +++ b/libavdevice/opengl_enc.c > @@ -46,7 +46,7 @@ > #include > #endif > > -#if HAVE_SDL > +#if HAVE_SDL2 > #include > #endif > > @@ -174,8 +174,10 @@ static const GLushort g_index[6] = > typedef struct OpenGLContext { > AVClass *class;///< class for private options > > -#if HAVE_SDL > -SDL_Surface *surface; > +#if HAVE_SDL2 > +SDL_Texture *texture; > +SDL_Window *window; > +SDL_Renderer *renderer; > I said I will patch opengl, your implemantation donsn't look good at this point, declined, ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavd/opengl: use SDL2
W dniu niedziela, 18 września 2016 Lou Logan > napisał(a): > On Sat, Sep 17, 2016, at 05:21 PM, Lukasz Marek wrote: > > On 18 September 2016 at 00:30, Josh de Kock wrote: > [...] > >> Would like some feedback where it doesnt work etc > [...] > > I said I will patch opengl, your implemantation donsn't look good at this > > point, declined, > > It would be helpful to provide some details describing what exactly does > not look good. > ___ opengl device depends on opengl context. this patch works on sdl renderer which works on X. in many cases X is opengł so patch is working for many cases, but is shity in general. > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/opengl: use SDL2
On 18.09.2016 10:04, Josh de Kock wrote: On 18/09/2016 05:51, Lukasz Marek wrote: W dniu niedziela, 18 września 2016 Lou Logan > napisał(a): On Sat, Sep 17, 2016, at 05:21 PM, Lukasz Marek wrote: On 18 September 2016 at 00:30, Josh de Kock wrote: [...] Would like some feedback where it doesnt work etc [...] I said I will patch opengl, your implemantation donsn't look good at this point, declined, It would be helpful to provide some details describing what exactly does not look good. ___ opengl device depends on opengl context. this patch works on sdl renderer which works on X. in many cases X is opengł so patch is working for many cases, but is shity in general. Sorry, I don't understand. Could you rephrase this? To make opengl work it needs a context. Could you point where you create it? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/opengl: use SDL2
On 18.09.2016 10:04, Josh de Kock wrote: On 18/09/2016 05:51, Lukasz Marek wrote: W dniu niedziela, 18 września 2016 Lou Logan > napisał(a): On Sat, Sep 17, 2016, at 05:21 PM, Lukasz Marek wrote: On 18 September 2016 at 00:30, Josh de Kock wrote: [...] Would like some feedback where it doesnt work etc [...] I said I will patch opengl, your implemantation donsn't look good at this point, declined, It would be helpful to provide some details describing what exactly does not look good. ___ opengl device depends on opengl context. this patch works on sdl renderer which works on X. in many cases X is opengł so patch is working for many cases, but is shity in general. Sorry, I don't understand. Could you rephrase this? I updated my version. I wanted to submit after vote is finished, but to save our time you can review it and include in your sdl patchset. >From c8988099c8535c77382b6f05d23326a0270bb2f4 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Sun, 18 Sep 2016 19:13:12 +0200 Subject: [PATCH] lavd/opengl: use SDL2 Signed-off-by: Lukasz Marek --- libavdevice/opengl_enc.c | 109 +-- 1 file changed, 49 insertions(+), 60 deletions(-) diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c index 1dbbb80..94259a2 100644 --- a/libavdevice/opengl_enc.c +++ b/libavdevice/opengl_enc.c @@ -46,7 +46,7 @@ #include #endif -#if HAVE_SDL +#if HAVE_SDL2 #include #endif @@ -174,8 +174,9 @@ static const GLushort g_index[6] = typedef struct OpenGLContext { AVClass *class;///< class for private options -#if HAVE_SDL -SDL_Surface *surface; +#if HAVE_SDL2 +SDL_Window *window; +SDL_GLContext glcontext; #endif FFOpenGLFunctions glprocs; @@ -341,30 +342,14 @@ static int opengl_control_message(AVFormatContext *h, int type, void *data, size return AVERROR(ENOSYS); } -#if HAVE_SDL -static int opengl_sdl_recreate_window(OpenGLContext *opengl, int width, int height) -{ -opengl->surface = SDL_SetVideoMode(width, height, - 32, SDL_OPENGL | SDL_RESIZABLE); -if (!opengl->surface) { -av_log(opengl, AV_LOG_ERROR, "Unable to set video mode: %s\n", SDL_GetError()); -return AVERROR_EXTERNAL; -} -SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); -SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); -SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); -SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); -SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); -return 0; -} - +#if HAVE_SDL2 static int opengl_sdl_process_events(AVFormatContext *h) { -int ret; OpenGLContext *opengl = h->priv_data; +AVDeviceRect message; SDL_Event event; SDL_PumpEvents(); -while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_ALLEVENTS) > 0) { +while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) > 0) { switch (event.type) { case SDL_QUIT: return AVERROR(EIO); @@ -375,23 +360,14 @@ static int opengl_sdl_process_events(AVFormatContext *h) return AVERROR(EIO); } return 0; -case SDL_VIDEORESIZE: { -char buffer[100]; -int reinit; -AVDeviceRect message; -/* clean up old context because SDL_SetVideoMode may lose its state. */ -SDL_VideoDriverName(buffer, sizeof(buffer)); -reinit = !av_strncasecmp(buffer, "quartz", sizeof(buffer)); -if (reinit) { -opengl_deinit_context(opengl); -} -if ((ret = opengl_sdl_recreate_window(opengl, event.resize.w, event.resize.h)) < 0) -return ret; -if (reinit && (ret = opengl_init_context(opengl)) < 0) -return ret; -message.width = opengl->surface->w; -message.height = opengl->surface->h; -return opengl_control_message(h, AV_APP_TO_DEV_WINDOW_SIZE, &message, sizeof(AVDeviceRect)); +case SDL_WINDOWEVENT: +switch(event.window.event) { +case SDL_WINDOWEVENT_RESIZED: +case SDL_WINDOWEVENT_SIZE_CHANGED: +SDL_GL_GetDrawableSize(opengl->window, &message.width, &message.height); +return opengl_control_message(h, AV_APP_TO_DEV_WINDOW_SIZE, &message, sizeof(AVDeviceRect)); +default: +break; } } } @@ -400,23 +376,34 @@ static int opengl_sdl_process_events(AVFormatContext *h) static int av_cold opengl_sdl_create_window(AVFormatContext *h) { -int ret; -char buffer[100]; OpenGLContext *opengl = h->priv_data; AVDeviceRect message; if (SDL_Init(SDL_INIT_VIDEO)) { av_log(opengl, AV_LOG_ERROR, "Unable to initialize SDL:
Re: [FFmpeg-devel] [PATCH 1/4] lavd: Add SDL2 output device
On 15.09.2016 00:27, Josh de Kock wrote: Acked-by: Michael Niedermayer Signed-off-by: Josh de Kock --- configure| 28 +++- libavdevice/Makefile | 1 + libavdevice/alldevices.c | 1 + libavdevice/sdl2.c | 377 +++ 4 files changed, 406 insertions(+), 1 deletion(-) create mode 100644 libavdevice/sdl2.c +typedef struct { +AVClass *class; +SDL_Window *window; +SDL_Renderer *renderer; +char *window_title; +int window_width, window_height; /**< size of the window */ +int window_fullscreen; +int window_borderless; + +SDL_Texture *texture; +int texture_fmt; +SDL_Rect texture_rect; + +int inited; +SDL_Thread *event_thread; +SDL_mutex *mutex; +SDL_cond *init_cond; these 3 are unused +int quit; this also can be removed +} SDLContext; + + +static int sdl2_write_trailer(AVFormatContext *s) +{ +SDLContext *sdl = s->priv_data; + +sdl->quit = 1; as there is no other thread then it is redundant +if (sdl->texture) +SDL_DestroyTexture(sdl->texture); +sdl->texture = NULL; +if (sdl->event_thread) +SDL_WaitThread(sdl->event_thread, NULL); +sdl->event_thread = NULL; +if (sdl->mutex) +SDL_DestroyMutex(sdl->mutex); +sdl->mutex = NULL; +if (sdl->init_cond) +SDL_DestroyCond(sdl->init_cond); +sdl->init_cond = NULL; + +if (sdl->renderer) +SDL_DestroyRenderer(sdl->renderer); +sdl->renderer = NULL; + +if (sdl->window) +SDL_DestroyWindow(sdl->window); +sdl->window = NULL; + +if (!sdl->inited) +SDL_Quit(); are you sure this is OK? + +return 0; +} + +#define SDL_BASE_FLAGS (SDL_SWSURFACE|SDL_WINDOW_RESIZABLE) + +static int sdl2_write_header(AVFormatContext *s) +{ +SDLContext *sdl = s->priv_data; +AVStream *st = s->streams[0]; +AVCodecParameters *codecpar = st->codecpar; +int i, ret = 0; + +if (!sdl->window_title) +sdl->window_title = av_strdup(s->filename); + +if (SDL_WasInit(SDL_INIT_VIDEO)) { +av_log(s, AV_LOG_WARNING, + "SDL video subsystem was already inited, you could have multiple SDL outputs. This may cause unknown behaviour.\n"); +sdl->inited = 1; +} + +if ( s->nb_streams > 1 +|| codecpar->codec_type != AVMEDIA_TYPE_VIDEO +|| codecpar->codec_id != AV_CODEC_ID_RAWVIDEO) { +av_log(s, AV_LOG_ERROR, "Only supports one rawvideo stream\n"); +goto fail; +} + +for (i = 0; sdl_texture_format_map[i].format != AV_PIX_FMT_NONE; i++) { +if (sdl_texture_format_map[i].format == codecpar->format) { +sdl->texture_fmt = sdl_texture_format_map[i].texture_fmt; +break; +} +} + +if (!sdl->texture_fmt) { +av_log(s, AV_LOG_ERROR, + "Unsupported pixel format '%s', choose one of yuv420p, yuyv422, uyvy422, BGRA\n", This log message is not clear. It made sense where there was only 3 planar format. I would remove second part + av_get_pix_fmt_name(codecpar->format)); +goto fail; +} + +/* resize texture to width and height from the codec context information */ +int flags; +flags = SDL_BASE_FLAGS | (sdl->window_fullscreen ? SDL_WINDOW_FULLSCREEN : 0) | + (sdl->window_borderless ? SDL_WINDOW_BORDERLESS : 0); + +/* initialization */ +if (!sdl->inited){ +if (SDL_Init(SDL_INIT_VIDEO) != 0) { +av_log(s, AV_LOG_ERROR, "Unable to initialize SDL: %s\n", SDL_GetError()); +goto fail; +} +} + +sdl->window_width = sdl->texture_rect.w = codecpar->width; +sdl->window_height = sdl->texture_rect.h = codecpar->height; +sdl->texture_rect.x = sdl->texture_rect.y = 0; + +if (SDL_CreateWindowAndRenderer(sdl->window_width, sdl->window_height, +flags, &sdl->window, &sdl->renderer) != 0){ +av_log(sdl, AV_LOG_ERROR, "Couldn't create window and renderer: %s\n", SDL_GetError()); +goto fail; +} + +SDL_SetWindowTitle(sdl->window, sdl->window_title); + +sdl->texture = SDL_CreateTexture(sdl->renderer, sdl->texture_fmt, SDL_TEXTUREACCESS_STREAMING, + sdl->window_width, sdl->window_height); + +if (!sdl->texture) { +av_log(sdl, AV_LOG_ERROR, "Unable to set create mode: %s\n", SDL_GetError()); +goto fail; +} + +av_log(s, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s -> w:%d h:%d\n", + codecpar->width, codecpar->height, av_get_pix_fmt_name(codecpar->format), + sdl->window_width, sdl->window_height); + +sdl->inited = 1; + +return 0; +fail: +sdl2_write_trailer(s); +return ret; +} + +static int sdl2_write_packet(AVFormatContext *s, AVPacket *pkt) +{ +int ret = 0; +SDLContext *sdl = s->priv_data; +AVCodecParameters *codecpar = s->streams[0]-
Re: [FFmpeg-devel] Dropping SDL1 support [VOTE]
On Sep 18, 2016 04:57, "Ronald S. Bultje" wrote: > > Hi, > > On Sat, Sep 17, 2016 at 4:26 PM, Marton Balint wrote: > > > I think we should wait until Lukasz does the port of the opengl device to > > SDL2, and do the switch after that. > > > When do we think that'll be finished? I missed this, I alredy posted a patch, it needs just one line fix so not consider it as a blocker. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Add SDL2 support & drop SDL1 support
On 24 September 2016 at 18:17, Josh de Kock wrote: > On 22/09/2016 20:28, Josh de Kock wrote: > >> Hopefully the final iteration of this set--it drops SDL1 support >> entirely rather than adding another ffplay version and keeping the >> SDL1 output device. All of it has been reviewed before, so there >> shouldn't be too much (or anything to change). >> >> Josh de Kock (3): >> lavd: Add SDL2 output device >> MAINTAINERS: update my entries >> lavd: drop SDL1 device & drop SDL1 support in general >> >> Lukasz Marek (1): >> lavd/opengl: use SDL2 >> >> Marton Balint (1): >> ffplay: add SDL2 support >> >> Changelog| 4 + >> MAINTAINERS | 1 + >> configure| 51 ++-- >> ffplay.c | 594 -- >> - >> libavdevice/Makefile | 2 +- >> libavdevice/alldevices.c | 2 +- >> libavdevice/opengl_enc.c | 109 - >> libavdevice/sdl.c| 377 -- >> libavdevice/sdl2.c | 377 ++ >> 9 files changed, 702 insertions(+), 815 deletions(-) >> delete mode 100644 libavdevice/sdl.c >> create mode 100644 libavdevice/sdl2.c >> >> > Set applied. > You ignored my review (at least part of it) regarding sdl2 device. http://ffmpeg.org/pipermail/ffmpeg-devel/2016-September/199732.html ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffplay: remove redundant silence buffer
Signed-off-by: Lukasz Marek --- ffplay.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ffplay.c b/ffplay.c index 2cfdf26..731ae25 100644 --- a/ffplay.c +++ b/ffplay.c @@ -243,7 +243,6 @@ typedef struct VideoState { AVStream *audio_st; PacketQueue audioq; int audio_hw_buf_size; -uint8_t silence_buf[SDL_AUDIO_MIN_BUFFER_SIZE]; uint8_t *audio_buf; uint8_t *audio_buf1; unsigned int audio_buf_size; /* in bytes */ @@ -2532,7 +2531,7 @@ static int audio_decode_frame(VideoState *is) static void sdl_audio_callback(void *opaque, Uint8 *stream, int len) { VideoState *is = opaque; -int audio_size, len1; +int audio_size, len1, silence = 0; audio_callback_time = av_gettime_relative(); @@ -2541,8 +2540,8 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len) audio_size = audio_decode_frame(is); if (audio_size < 0) { /* if error, just output silence */ - is->audio_buf = is->silence_buf; - is->audio_buf_size = sizeof(is->silence_buf) / is->audio_tgt.frame_size * is->audio_tgt.frame_size; + silence = 1; + is->audio_buf_size = SDL_AUDIO_MIN_BUFFER_SIZE / is->audio_tgt.frame_size * is->audio_tgt.frame_size; } else { if (is->show_mode != SHOW_MODE_VIDEO) update_sample_display(is, (int16_t *)is->audio_buf, audio_size); @@ -2553,11 +2552,11 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len) len1 = is->audio_buf_size - is->audio_buf_index; if (len1 > len) len1 = len; -if (!is->muted && is->audio_volume == SDL_MIX_MAXVOLUME) +if (!is->muted && !silence && is->audio_volume == SDL_MIX_MAXVOLUME) memcpy(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, len1); else { -memset(stream, is->silence_buf[0], len1); -if (!is->muted) +memset(stream, 0, len1); +if (!is->muted && !silence) SDL_MixAudio(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, len1, is->audio_volume); } len -= len1; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffplay: remove redundant silence buffer
On 19.03.2016 19:16, Marton Balint wrote: > > On Thu, 17 Mar 2016, Lukasz Marek wrote: > >> Signed-off-by: Lukasz Marek >> --- >> ffplay.c | 13 ++--- >> 1 file changed, 6 insertions(+), 7 deletions(-) >> > LGTM, thanks. Ok, pushed, thx ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] GSoC again
On 23.03.2016 17:09, Gerion Entrup wrote: > 3. Implement adaptive switching. > > A note to the 3rd point. I'm absolutely not sure, what amount of work this is > (maybe you could comment it) and what the best place would be to implement > this (including whether this whole feature is meaningful). I would say, this > could > be either in the demuxer itself or in ffplay (can decide a muxer such a thing, > like bandwidth?). I think it is not possible to be done inside demuxer. Different qualities may have different metadata such as width, height, maybe different codec. HLS is exposing all qualities as separate streams and player may choose the one it needs. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffplay: fix silence insertion on error or pause
On 03.04.2016 21:37, Marton Balint wrote: > Insertion of silence was a bit broken since > df34b700981de606ca4847e1ed0bfdf9ac3e9104 because the info whether or not the > source buffer supposed to be silence must be kept between callbacks. Failing > to > do so causes rogue samples from the last buffer to be presented, I guess even > a > crash can occur under some circumstances. > > This patch uses a NULL audio_buf to keep the silence state across audio > callbacks. > > Signed-off-by: Marton Balint > --- > ffplay.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) mea culpa LGFM ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Remove Derek Buitenhuis from MAINTAINERS
On 19 May 2016 at 15:18, Derek Buitenhuis wrote: > On 5/19/2016 2:12 PM, Michael Niedermayer wrote: > > if derek still wants to leave in 2 weeks then so be it, its his choice > > but i really hope things can be resolved in a way that everyone > > stays and works together and is happy > > I will wait 2 weeks. > Is Derek revoked to commit or what? Couldn't he just commit this patch and leave? :P I was a problem for some people, but I see they still have problems. Let people with problems go away with they problems. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] FTP graceful close data connection to avoid server abort
On 09.06.2016 00:25, Michael Niedermayer wrote: > On Thu, Jun 02, 2016 at 02:29:47PM +0200, Camille Gonnet wrote: >> When writing files to FTP, if the data connection is closed before the >> control connection, the server may handle it as an aborted file transfer >> and create and leave the file empty. > > which ftp server, or is that in the RFC, if so please refer to it RFC is good for reference, unfortunately even popular linux implementations don't follow it strictly (sometimes it is hard to say they follow at all some aspects). Regarding aborting and stuff it is really implementation dependent. I can't remember now which implementation and what version, but one was totally unresponsive on control connection while active transfer on data connection, so the only way to abort it was to close data connection. Reverting order of closing should be OK, but I'm not really sure expecting all implementation to send 225/226 code is correct. I would suggest to at least check state if it is UPLOADING and apply that change only for this case. Perfectly this behaviour could be enabled by an option and autodetected in ftp_connect_control_connection when server send its name (note 220 code's message may be overwritten so an option to enforce is needed) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] FTP graceful close data connection to avoid server abort
On 02.06.2016 14:29, Camille Gonnet wrote: When writing files to FTP, if the data connection is closed before the control connection, the server may handle it as an aborted file transfer and create and leave the file empty. --- libavformat/ftp.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavformat/ftp.c b/libavformat/ftp.c index 0663b47..00747bb 100644 --- a/libavformat/ftp.c +++ b/libavformat/ftp.c @@ -220,15 +220,21 @@ static int ftp_send_command(FTPContext *s, const char *command, static void ftp_close_data_connection(FTPContext *s) { -ffurl_closep(&s->conn_data); +static const int close_codes[] = {225, 226, 0}; + +if (s->conn_data) { +ffurl_closep(&s->conn_data); +// Need to wait for status, or file transfer might be aborted on server side +ftp_status(s, NULL, close_codes); +} s->position = 0; s->state = DISCONNECTED; } This is not working. ./ffplay ftp://user:pass@localhost/1.avi hangs at startup. It was working for you because (probably) your writing operation didn't perform seeking (did you enabled ftp-write-seekable?). During seek operation, when seek is really done, ftp_abort is called and there is ftp_close_data_connection called with status check followed. So status is checked twice while sent by server just once. I can work it out, but just tell what server has this issue. Perfectly setup some account for me. You can of course work it out yourself, but please test also other scenarios and other servers. First thing to check is to revert patch completely and replace ftp_close_both_connections by ftp_abort inside ftp_close function. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] avutil: add pixelutils API
+static av_always_inline int sad_wxh(const uint8_t *src1, ptrdiff_t stride1, +const uint8_t *src2, ptrdiff_t stride2, +int w, int h) +{ +int x, y, sum = 0; + +for (y = 0; y < h; y++) { +for (x = 0; x < w; x++) +sum += abs(src1[x] - src2[x]); minor: I came out of nowhere to this patch, but maybe FFABS? :) +src1 += stride1; +src2 += stride2; +} +return sum; +} ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] lavd/pulse_audio_dec: use default source when no input provided
PulseAudio expilitly requires name of the source. This patch makes it use default source when not provided. It simplifies programistic use. Signed-off-by: Lukasz Marek --- libavdevice/pulse_audio_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/pulse_audio_dec.c b/libavdevice/pulse_audio_dec.c index 01ff6d1..a7b0e5d 100644 --- a/libavdevice/pulse_audio_dec.c +++ b/libavdevice/pulse_audio_dec.c @@ -154,7 +154,7 @@ static av_cold int pulse_read_header(AVFormatContext *s) attr.fragsize = pd->fragment_size; -if (strcmp(s->filename, "default")) +if (s->filename[0] != '\0' && strcmp(s->filename, "default")) device = s->filename; if (!(pd->mainloop = pa_threaded_mainloop_new())) { -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] lavu/log: add device category macros
--- libavutil/log.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavutil/log.h b/libavutil/log.h index a6a07e0..e1ff09b 100644 --- a/libavutil/log.h +++ b/libavutil/log.h @@ -46,6 +46,16 @@ typedef enum { AV_CLASS_CATEGORY_NB, ///< not part of ABI/API }AVClassCategory; +#define AV_IS_INPUT_DEVICE(category) \ +(((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT)) + +#define AV_IS_OUTPUT_DEVICE(category) \ +(((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT)) + struct AVOptionRanges; /** -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] opts: add list device sources/sinks options
Allows to list sources/sinks of the devices that implement that functionality. Signed-off-by: Lukasz Marek --- cmdutils.c | 89 ++ cmdutils.h | 12 +++ cmdutils_common_opts.h | 6 3 files changed, 107 insertions(+) diff --git a/cmdutils.c b/cmdutils.c index 67bb66e..defcf0a 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -2050,3 +2050,92 @@ void *grow_array(void *array, int elem_size, int *size, int new_size) } return array; } + + +int show_sources(void *optctx, const char *opt, const char *arg) +{ +#if CONFIG_AVDEVICE +AVDeviceInfoList *device_list = NULL; +AVFormatContext *dev = NULL; +AVInputFormat *fmt; +int ret, i; + +if (!arg) { +printf("Device name is missing.\n"); +return AVERROR(EINVAL); +} + +fmt = av_find_input_format(arg); +if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category)) { +printf("No such device: %s\n", arg); +return AVERROR(EINVAL); +} + +if ((ret = avformat_open_input(&dev, NULL, fmt, NULL)) < 0) { +printf("Cannot open device: %s\n", arg); +goto fail; +} + +if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { +printf("Cannot list devices\n"); +goto fail; +} +printf("Audo-detected sinks for %s:\n", arg); +for (i = 0; i < device_list->nb_devices; i++) { +printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", + device_list->devices[i]->device_name, device_list->devices[i]->device_description); +} + + fail: +avdevice_free_list_devices(&device_list); +avformat_close_input(&dev); +return ret; +#else +printf("Configured without libavdevice\n"); +return AVERROR(ENOSYS); +#endif +} + +int show_sinks(void *optctx, const char *opt, const char *arg) +{ +#if CONFIG_AVDEVICE +AVDeviceInfoList *device_list = NULL; +AVFormatContext *dev = NULL; +AVOutputFormat *fmt; +int ret, i; + +if (!arg) { +printf("Device name is missing.\n"); +return AVERROR(EINVAL); +} + +fmt = av_guess_format(arg, NULL, NULL); +if (!fmt || !fmt->priv_class || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category)) { +printf("No such device: %s\n", arg); +return AVERROR(EINVAL); +} + +if ((ret = avformat_alloc_output_context2(&dev, fmt, NULL, NULL)) < 0) { +printf("Cannot open device: %s\n", arg); +goto fail; +} + +if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { +printf("Cannot list devices\n"); +goto fail; +} +printf("Audo-detected sinks for %s:\n", arg); +for (i = 0; i < device_list->nb_devices; i++) { +printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", + device_list->devices[i]->device_name, device_list->devices[i]->device_description); +} + + fail: +avdevice_free_list_devices(&device_list); +avformat_close_input(&dev); +return ret; +#else +printf("Configured without libavdevice\n"); +return AVERROR(ENOSYS); +#endif +} diff --git a/cmdutils.h b/cmdutils.h index 76d11a5..cb34876 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -444,6 +444,18 @@ int show_formats(void *optctx, const char *opt, const char *arg); int show_devices(void *optctx, const char *opt, const char *arg); /** + * Print a listing containing audodetected sinks of the output device. + * Device name must be passed as an argument. + */ +int show_sinks(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing audodetected sources of the input device. + * Device name must be passed as an argument. + */ +int show_sources(void *optctx, const char *opt, const char *arg); + +/** * Print a listing containing all the codecs supported by the * program. * This option processing function does not utilize the arguments. diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h index 49b5180..758dac1 100644 --- a/cmdutils_common_opts.h +++ b/cmdutils_common_opts.h @@ -27,3 +27,9 @@ { "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench}, "run benchmark on all OpenCL devices and show results" }, { "opencl_options", HAS_ARG, {.func_arg = opt_opencl}, "set OpenCL environment options" }, #endif +#if CONFIG_AVDEVICE +{ "sources", OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, + "list sources of the input device", "device" }, +{ "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, + "list sinks of the output device", "device" }, +#endif -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] lavd/pulse_audio_dec: use default source when no input provided
On 07.08.2014 15:36, Michael Niedermayer wrote: On Thu, Aug 07, 2014 at 01:58:55AM +0200, Lukasz Marek wrote: PulseAudio expilitly requires name of the source. This patch makes it use default source when not provided. It simplifies programistic use. Signed-off-by: Lukasz Marek --- libavdevice/pulse_audio_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) LGTM You can merge this one. Second one is up to you. I will resend third one from patch set later. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavd/fbdev_dec: use default device when not provided
Signed-off-by: Lukasz Marek --- libavdevice/fbdev_dec.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavdevice/fbdev_dec.c b/libavdevice/fbdev_dec.c index 1593b10..7b13a85 100644 --- a/libavdevice/fbdev_dec.c +++ b/libavdevice/fbdev_dec.c @@ -68,6 +68,7 @@ static av_cold int fbdev_read_header(AVFormatContext *avctx) AVStream *st = NULL; enum AVPixelFormat pix_fmt; int ret, flags = O_RDONLY; +const char* device; if (!(st = avformat_new_stream(avctx, NULL))) return AVERROR(ENOMEM); @@ -77,11 +78,16 @@ static av_cold int fbdev_read_header(AVFormatContext *avctx) if (avctx->flags & AVFMT_FLAG_NONBLOCK) flags |= O_NONBLOCK; -if ((fbdev->fd = avpriv_open(avctx->filename, flags)) == -1) { +if (avctx->filename[0]) +device = avctx->filename; +else +device = ff_fbdev_default_device(); + +if ((fbdev->fd = avpriv_open(device, flags)) == -1) { ret = AVERROR(errno); av_log(avctx, AV_LOG_ERROR, "Could not open framebuffer device '%s': %s\n", - avctx->filename, av_err2str(ret)); + device, av_err2str(ret)); return ret; } -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] opts: add list device sources/sinks options
On 13.08.2014 16:00, Michael Niedermayer wrote: On Thu, Aug 07, 2014 at 01:58:57AM +0200, Lukasz Marek wrote: Allows to list sources/sinks of the devices that implement that functionality. [...] +int show_sinks(void *optctx, const char *opt, const char *arg) +{ +#if CONFIG_AVDEVICE +AVDeviceInfoList *device_list = NULL; +AVFormatContext *dev = NULL; +AVOutputFormat *fmt; +int ret, i; + +if (!arg) { +printf("Device name is missing.\n"); +return AVERROR(EINVAL); +} shouldnt a plain "-sinks" list all available sinks ? similar for sources Sorry for long delay. I reworked a patch a bit, sending in new thread. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavd/fbdev_common: report error during probing fbdev device
Signed-off-by: Lukasz Marek --- libavdevice/fbdev_common.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavdevice/fbdev_common.c b/libavdevice/fbdev_common.c index 634780d..713e4fd 100644 --- a/libavdevice/fbdev_common.c +++ b/libavdevice/fbdev_common.c @@ -84,8 +84,13 @@ int ff_fbdev_get_device_list(AVDeviceInfoList *device_list) for (i = 0; i <= 31; i++) { snprintf(device_file, sizeof(device_file), "/dev/fb%d", i); -if ((fd = avpriv_open(device_file, O_RDWR)) < 0) +if ((fd = avpriv_open(device_file, O_RDWR)) < 0) { +int err = AVERROR(errno); +if (err != AVERROR(ENOENT)) +av_log(NULL, AV_LOG_ERROR, "Could not open framebuffer device '%s': %s\n", + device_file, av_err2str(err)); continue; +} if (ioctl(fd, FBIOGET_VSCREENINFO, &varinfo) == -1) goto fail_device; if (ioctl(fd, FBIOGET_FSCREENINFO, &fixinfo) == -1) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] opts: add list device sources/sinks options
Allows to list sources/sinks of the devices that implement that functionality. Signed-off-by: Lukasz Marek --- cmdutils.c | 191 + cmdutils.h | 12 cmdutils_common_opts.h | 6 ++ 3 files changed, 209 insertions(+) diff --git a/cmdutils.c b/cmdutils.c index 7353dd5..4838244 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -2052,3 +2052,194 @@ void *grow_array(void *array, int elem_size, int *size, int new_size) } return array; } + +#if CONFIG_AVDEVICE +static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts) +{ +int ret, i; +AVFormatContext *dev = NULL; +AVDeviceInfoList *device_list = NULL; +AVDictionary *tmp_opts = NULL; + +if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category)) +return AVERROR(EINVAL); + +printf("Audo-detected sources for %s:\n", fmt->name); +if (!fmt->get_device_list) { +ret = AVERROR(ENOSYS); +printf("Cannot list sources. Not implemented.\n"); +goto fail; +} + +/* TODO: avformat_open_input calls read_header callback which is not necessary. + Function like avformat_alloc_output_context2 for input could be helpful here. */ +av_dict_copy(&tmp_opts, opts, 0); +if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) { +printf("Cannot open device: %s.\n", fmt->name); +goto fail; +} + +if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { +printf("Cannot list sources.\n"); +goto fail; +} + +for (i = 0; i < device_list->nb_devices; i++) { +printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", + device_list->devices[i]->device_name, device_list->devices[i]->device_description); +} + + fail: +av_dict_free(&tmp_opts); +avdevice_free_list_devices(&device_list); +avformat_close_input(&dev); +return ret; +} + +static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts) +{ +int ret, i; +AVFormatContext *dev = NULL; +AVDeviceInfoList *device_list = NULL; +AVDictionary *tmp_opts = NULL; + +if (!fmt || !fmt->priv_class || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category)) +return AVERROR(EINVAL); + +printf("Audo-detected sinks for %s:\n", fmt->name); +if (!fmt->get_device_list) { +ret = AVERROR(ENOSYS); +printf("Cannot list sinks. Not implemented.\n"); +goto fail; +} + +if ((ret = avformat_alloc_output_context2(&dev, fmt, NULL, NULL)) < 0) { +printf("Cannot open device: %s.\n", fmt->name); +goto fail; +} +av_dict_copy(&tmp_opts, opts, 0); +av_opt_set_dict2(dev, &tmp_opts, AV_OPT_SEARCH_CHILDREN); + +if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { +printf("Cannot list sinks.\n"); +goto fail; +} + +for (i = 0; i < device_list->nb_devices; i++) { +printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", + device_list->devices[i]->device_name, device_list->devices[i]->device_description); +} + + fail: +av_dict_free(&tmp_opts); +avdevice_free_list_devices(&device_list); +avformat_close_input(&dev); +return ret; +} + +static int show_sinks_sources_parse_arg(const char *arg, char **dev, AVDictionary **opts) +{ +int ret; +if (arg) { +char *opts_str = NULL; +av_assert0(dev && opts); +*dev = av_strdup(arg); +if (!*dev) +return AVERROR(ENOMEM); +if ((opts_str = strchr(*dev, ','))) { +*(opts_str++) = '\0'; +if (opts_str[0] && ((ret = av_dict_parse_string(opts, opts_str, "=", ":", 0)) < 0)) { +av_freep(dev); +return ret; +} +} +} else +printf("\nDevice name is not provided.\n" +"You can pass devicename[,opt1=val1[,opt2=val2...]] as an argument.\n\n"); +return 0; +} +#endif + +int show_sources(void *optctx, const char *opt, const char *arg) +{ +#if CONFIG_AVDEVICE +AVInputFormat *fmt = NULL; +char *dev = NULL; +AVDictionary *opts = NULL; +int ret = 0; +int error_level = av_log_get_level(); + +av_log_set_level(AV_LOG_ERROR); + +if ((ret = show_sinks_sources_parse_arg(arg, &dev, &opts)) < 0) +goto fail; + +do { +fmt = av_input_audio_device_next(fmt); +if (fmt) { +if (!strcmp(fmt->name, "lavfi")) +continue; //it's pointless to probe l
[FFmpeg-devel] [PATCH] lavd/alsa: implement get_device_list callbacks
--- libavdevice/alsa-audio-common.c | 60 + libavdevice/alsa-audio-dec.c| 6 + libavdevice/alsa-audio-enc.c| 6 + libavdevice/alsa-audio.h| 2 ++ 4 files changed, 74 insertions(+) diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c index 4e63397..1061917 100644 --- a/libavdevice/alsa-audio-common.c +++ b/libavdevice/alsa-audio-common.c @@ -343,3 +343,63 @@ int ff_alsa_extend_reorder_buf(AlsaData *s, int min_size) s->reorder_buf_size = size; return 0; } + +/* ported from alsa-utils/aplay.c */ +int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type) +{ +int ret; +void **hints, **n; +char *name = NULL, *descr = NULL, *io = NULL, *tmp; +AVDeviceInfo *new_device = NULL; +const char *filter = stream_type == SND_PCM_STREAM_PLAYBACK ? "Output" : "Input"; + +av_log(NULL, AV_LOG_INFO, "%s\n", filter); + +if (snd_device_name_hint(-1, "pcm", &hints) < 0) +return AVERROR_EXTERNAL; +n = hints; +while (*n) { +name = snd_device_name_get_hint(*n, "NAME"); +descr = snd_device_name_get_hint(*n, "DESC"); +io = snd_device_name_get_hint(*n, "IOID"); +if (!io || !strcmp(io, filter)) { +new_device = av_mallocz(sizeof(AVDeviceInfo)); +if (!new_device) { +ret = AVERROR(ENOMEM); +goto fail; +} +new_device->device_name = name; +name = NULL; +if ((tmp = strrchr(descr, '\n')) && tmp[1]) { +new_device->device_description = av_strdup(&tmp[1]); +if (!new_device->device_description) { +ret = AVERROR(ENOMEM); +goto fail; +} +} else { +new_device->device_description = descr; +descr = NULL; +} +if ((ret = av_dynarray_add_nofree(&device_list->devices, + &device_list->nb_devices, new_device)) < 0) { +goto fail; +} +new_device = NULL; +} +av_freep(&io); +av_freep(&name); +av_freep(&descr); +n++; +} + fail: +av_free(io); +av_free(name); +av_free(descr); +if (new_device) { +av_free(new_device->device_description); +av_free(new_device->device_name); +av_free(new_device); +} +snd_device_name_free_hint(hints); +return ret; +} diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index 2cdf356..7f8f8cd 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c @@ -132,6 +132,11 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) return 0; } +static int audio_get_device_list(AVFormatContext *h, AVDeviceInfoList *device_list) +{ +return ff_alsa_get_device_list(device_list, SND_PCM_STREAM_CAPTURE); +} + static const AVOption options[] = { { "sample_rate", "", offsetof(AlsaData, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { "channels","", offsetof(AlsaData, channels),AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, @@ -153,6 +158,7 @@ AVInputFormat ff_alsa_demuxer = { .read_header= audio_read_header, .read_packet= audio_read_packet, .read_close = ff_alsa_close, +.get_device_list = audio_get_device_list, .flags = AVFMT_NOFILE, .priv_class = &alsa_demuxer_class, }; diff --git a/libavdevice/alsa-audio-enc.c b/libavdevice/alsa-audio-enc.c index e42cc8f..43d097d 100644 --- a/libavdevice/alsa-audio-enc.c +++ b/libavdevice/alsa-audio-enc.c @@ -142,6 +142,11 @@ audio_get_output_timestamp(AVFormatContext *s1, int stream, *dts = s->timestamp - delay; } +static int audio_get_device_list(AVFormatContext *h, AVDeviceInfoList *device_list) +{ +return ff_alsa_get_device_list(device_list, SND_PCM_STREAM_PLAYBACK); +} + static const AVClass alsa_muxer_class = { .class_name = "ALSA muxer", .item_name = av_default_item_name, @@ -159,6 +164,7 @@ AVOutputFormat ff_alsa_muxer = { .write_packet = audio_write_packet, .write_trailer = ff_alsa_close, .write_uncoded_frame = audio_write_frame, +.get_device_list = audio_get_device_list, .get_output_timestamp = audio_get_output_timestamp, .flags = AVFMT_NOFILE, .priv_class = &alsa_muxer_class, diff --git a/libavdevice/alsa-audio.h b/libavdevice/alsa-audio.h index 583c911..cf0e942 100644 --- a/libavdevice/alsa-audio.h +++ b/libavdevice/alsa-audio.h @@ -99,4 +99,6 @@ int ff_alsa_xrun_recover(AVFormatContext *s1, int err); int ff_alsa_extend_reorder_buf(AlsaData *s, int size); +int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type); + #endif /* AVDEVICE_ALSA
Re: [FFmpeg-devel] [PATCH] lavd/alsa: implement get_device_list callbacks
On 18.10.2014 20:36, Lukasz Marek wrote: --- libavdevice/alsa-audio-common.c | 60 + libavdevice/alsa-audio-dec.c| 6 + libavdevice/alsa-audio-enc.c| 6 + libavdevice/alsa-audio.h| 2 ++ 4 files changed, 74 insertions(+) It's ported from alsa project, but I hope Nicolas will comment. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavd: export all symbols with av prefix
Signed-off-by: Lukasz Marek --- libavdevice/libavdevice.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/libavdevice.v b/libavdevice/libavdevice.v index 663af85..d7c86ba 100644 --- a/libavdevice/libavdevice.v +++ b/libavdevice/libavdevice.v @@ -1,4 +1,4 @@ LIBAVDEVICE_$MAJOR { -global: avdevice_*; +global: av*; local: *; }; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd: export all symbols with av prefix
On 20 October 2014 08:47, Reimar Döffinger wrote: > On 19.10.2014, at 13:39, Lukasz Marek wrote: > > > Signed-off-by: Lukasz Marek > > --- > > libavdevice/libavdevice.v | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavdevice/libavdevice.v b/libavdevice/libavdevice.v > > index 663af85..d7c86ba 100644 > > --- a/libavdevice/libavdevice.v > > +++ b/libavdevice/libavdevice.v > > @@ -1,4 +1,4 @@ > > LIBAVDEVICE_$MAJOR { > > -global: avdevice_*; > > +global: av*; > > I'd prefer if we'd keep the explicit _ termination and explicitly list all > prefixes that get exported. > I admit that luckily av is uncommon in English to start a word so it > probably won't matter much though. > I checked libavformat and libavcodec and they export av*, but I agree in general so I have changed according to your suggestion. From ea5b124b9eac8a4e07f41860fba646c6bc55f5bd Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Mon, 20 Oct 2014 12:12:20 +0200 Subject: [PATCH] lavd: export all symbols with av_ prefix Signed-off-by: Lukasz Marek --- libavdevice/libavdevice.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/libavdevice.v b/libavdevice/libavdevice.v index 663af85..de7278c 100644 --- a/libavdevice/libavdevice.v +++ b/libavdevice/libavdevice.v @@ -1,4 +1,4 @@ LIBAVDEVICE_$MAJOR { -global: avdevice_*; +global: avdevice_*; av_*; local: *; }; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd: export all symbols with av prefix
On 20.10.2014 14:55, Michael Niedermayer wrote: On Mon, Oct 20, 2014 at 12:14:14PM +0200, Lukasz Marek wrote: On 20 October 2014 08:47, Reimar Döffinger wrote: On 19.10.2014, at 13:39, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- libavdevice/libavdevice.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/libavdevice.v b/libavdevice/libavdevice.v index 663af85..d7c86ba 100644 --- a/libavdevice/libavdevice.v +++ b/libavdevice/libavdevice.v @@ -1,4 +1,4 @@ LIBAVDEVICE_$MAJOR { -global: avdevice_*; +global: av*; I'd prefer if we'd keep the explicit _ termination and explicitly list all prefixes that get exported. I admit that luckily av is uncommon in English to start a word so it probably won't matter much though. I checked libavformat and libavcodec and they export av*, but I agree in general so I have changed according to your suggestion. libavdevice.v |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 5722720606edb454d2b64edb06299b1a37099827 0001-lavd-export-all-symbols-with-av_-prefix.patch From ea5b124b9eac8a4e07f41860fba646c6bc55f5bd Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Mon, 20 Oct 2014 12:12:20 +0200 Subject: [PATCH] lavd: export all symbols with av_ prefix LGTM Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd: export all symbols with av prefix
On 20.10.2014 21:29, James Almer wrote: On 20/10/14 7:14 AM, Lukasz Marek wrote: diff --git a/libavdevice/libavdevice.v b/libavdevice/libavdevice.v index 663af85..de7278c 100644 --- a/libavdevice/libavdevice.v +++ b/libavdevice/libavdevice.v @@ -1,4 +1,4 @@ LIBAVDEVICE_$MAJOR { -global: avdevice_*; +global: avdevice_*; av_*; local: *; }; The libraries may have avpriv functions that need to be exported, so "av{lib}_*; av_*; avpriv_*;" should be used instead (since people don't want av*) lavd currently has four avpriv_ functions in v4l2-common.h that nobody realized weren't being properly exported because they are not used outside the library. They should probably be renamed to ff_ before making any relevant change to this file. I missed you mail, sorry. But I guess they should have ff_ prefix anyway. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: add build tree's directories to rpath
This commit allows to run programs linked dynamically in build dir without installing. Signed-off-by: Lukasz Marek --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 3e181aa..5cef407 100755 --- a/configure +++ b/configure @@ -5076,6 +5076,7 @@ check_disable_warning -Wno-pointer-sign # add some linker flags check_ldflags -Wl,--warn-common check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample +enabled rpath && add_ldexeflags -Wl,-rpath,libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample enabled rpath && add_ldexeflags -Wl,-rpath,$libdir test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 0/4] FFserver configuration
Some time ago I wanted to setup internet camera streaming via ffserver and I faced the same probalem as #1275. It was over a year ago, so I don't remember correctly, but a conclusion from debugging was that codec's private data are not initialized to their defaults. As I remember I was cased by allocating it on stack and calling avcodec_get_context_defaults3 without codec. I reworked whole configuration parsing routine so I is allocated correctly now. This patchset also make order of entries in tag not relevant. I think there is also a better error handling now (detecting wrong entry in a tag) and probably easier to improve that more. I know review will be a nightmare. Patches 1 & 3 are intended to be just a copy-paste, but there some changes in them. In patch 1 I added FFserver prefixes to stuff moved into header. In patch 3 I removed if(stream) etc checks. Overall after these changes streaming is working, but ffplay stops playing after few seconds. I noticed ffmpeg is working at 270fps which seems wrong. I guess this is different story anyway, because this also happen without patches and workaround described in ticket. Lukasz Marek (4): ffserver: move configuration code to separate file ffserver_config: clean up variable initialization ffserver_conf: factorize parse function per config tag ffserver_config: postpone codec context creation Makefile |1 + ffserver.c| 1224 + ffserver_config.c | 1004 +++ ffserver_config.h | 128 ++ 4 files changed, 1239 insertions(+), 1118 deletions(-) create mode 100644 ffserver_config.c create mode 100644 ffserver_config.h -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] ffserver: move configuration code to separate file
This commit doesn't change any existing logic. It moves ffserver configuration related code to separate file. It intends to make maintaining easier. Signed-off-by: Lukasz Marek --- Makefile |1 + ffserver.c| 1214 + ffserver_config.c | 986 +++ ffserver_config.h | 118 ++ 4 files changed, 1201 insertions(+), 1118 deletions(-) create mode 100644 ffserver_config.c create mode 100644 ffserver_config.h diff --git a/Makefile b/Makefile index 57f6a91..1e1dbb3 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_vda.o +OBJS-ffserver += ffserver_config.o TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options diff --git a/ffserver.c b/ffserver.c index e98cc62..af6e8e1 100644 --- a/ffserver.c +++ b/ffserver.c @@ -49,7 +49,6 @@ #include "libavutil/dict.h" #include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" -#include "libavutil/pixdesc.h" #include "libavutil/random_seed.h" #include "libavutil/parseutils.h" #include "libavutil/opt.h" @@ -70,6 +69,7 @@ #include #include "cmdutils.h" +#include "ffserver_config.h" const char program_name[] = "ffserver"; const int program_birth_year = 2000; @@ -107,8 +107,6 @@ static const char * const http_state[] = { "RTSP_SEND_PACKET", }; -#define MAX_STREAMS 20 - #define IOBUFFER_INIT_SIZE 8192 /* timeouts are in ms */ @@ -156,12 +154,12 @@ typedef struct HTTPContext { int pts_stream_index;/* stream we choose as clock reference */ int64_t cur_clock; /* current clock reference value in us */ /* output format handling */ -struct FFStream *stream; +struct FFServerStream *stream; /* -1 is invalid stream */ -int feed_streams[MAX_STREAMS]; /* index of streams in the feed */ -int switch_feed_streams[MAX_STREAMS]; /* index of streams in the feed */ +int feed_streams[FFSERVER_MAX_STREAMS]; /* index of streams in the feed */ +int switch_feed_streams[FFSERVER_MAX_STREAMS]; /* index of streams in the feed */ int switch_pending; -AVFormatContext fmt_ctx; /* instance of FFStream for one user */ +AVFormatContext fmt_ctx; /* instance of FFServerStream for one user */ int last_packet_sent; /* true if last data packet was sent */ int suppress_log; DataRateData datarate; @@ -182,95 +180,35 @@ typedef struct HTTPContext { /* RTP state specific */ enum RTSPLowerTransport rtp_protocol; char session_id[32]; /* session id */ -AVFormatContext *rtp_ctx[MAX_STREAMS]; +AVFormatContext *rtp_ctx[FFSERVER_MAX_STREAMS]; /* RTP/UDP specific */ -URLContext *rtp_handles[MAX_STREAMS]; +URLContext *rtp_handles[FFSERVER_MAX_STREAMS]; /* RTP/TCP specific */ struct HTTPContext *rtsp_c; uint8_t *packet_buffer, *packet_buffer_ptr, *packet_buffer_end; } HTTPContext; -/* each generated stream is described here */ -enum StreamType { -STREAM_TYPE_LIVE, -STREAM_TYPE_STATUS, -STREAM_TYPE_REDIRECT, -}; - -enum IPAddressAction { -IP_ALLOW = 1, -IP_DENY, -}; - -typedef struct IPAddressACL { -struct IPAddressACL *next; -enum IPAddressAction action; -/* These are in host order */ -struct in_addr first; -struct in_addr last; -} IPAddressACL; - -/* description of each stream of the ffserver.conf file */ -typedef struct FFStream { -enum StreamType stream_type; -char filename[1024]; /* stream filename */ -struct FFStream *feed; /* feed we are using (can be null if -coming from file) */ -AVDictionary *in_opts; /* input parameters */ -AVDictionary *metadata; /* metadata to set on the stream */ -AVInputFormat *ifmt; /* if non NULL, force input format */ -AVOutputFormat *fmt; -IPAddressACL *acl; -char dynamic_acl[1024]; -int nb_streams; -int prebuffer; /* Number of milliseconds early to start */ -int64_t max_time; /* Number of milliseconds to run */ -int send_on_key; -AVStream *streams[MAX_STREAMS]; -int feed_streams[MAX_STREAMS]; /* index of streams in the feed */ -char feed_filename[1024]; /* file name of the feed storage, or - input file name for a stream */ -pid_t pid; /* Of ffmpeg process */ -time_t pid_start; /* Of ffmpeg process */ -char **child_argv; -struct FFStream *next; -unsigned bandwidth; /* bandwidth, in kbits/s */ -/* RTSP options */ -char *rtsp_option; -/* multicast specific */ -int is
[FFmpeg-devel] [PATCH 4/4] ffserver_config: postpone codec context creation
So far AVCodecContext was created without codec specified. This causes internal data to not be initialized to defaults. This commit postpone context creation until all information are gathered. Partially fixes #1275 --- ffserver.c| 8 +- ffserver_config.c | 286 -- ffserver_config.h | 9 +- 3 files changed, 183 insertions(+), 120 deletions(-) diff --git a/ffserver.c b/ffserver.c index 22560ce..8c65d12 100644 --- a/ffserver.c +++ b/ffserver.c @@ -212,8 +212,12 @@ static FFServerConfig config = { .warnings = 0, .audio_id = AV_CODEC_ID_NONE, .video_id = AV_CODEC_ID_NONE, -.audio_enc = {0}, -.video_enc = {0}, +.video_opts = NULL, +.video_conf = NULL, +.audio_opts = NULL, +.audio_conf = NULL, +.video_preset = NULL, +.audio_preset = NULL, }; static void new_connection(int server_fd, int is_rtsp); diff --git a/ffserver_config.c b/ffserver_config.c index 18b1e72..87c91cd 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -238,9 +238,8 @@ static void add_codec(FFServerStream *stream, AVCodecContext *av) st = av_mallocz(sizeof(AVStream)); if (!st) return; -st->codec = avcodec_alloc_context3(NULL); +st->codec = av; stream->streams[stream->nb_streams++] = st; -memcpy(st->codec, av, sizeof(AVCodecContext)); } static enum AVCodecID opt_codec(const char *name, enum AVMediaType type) @@ -269,12 +268,15 @@ static int ffserver_opt_preset(const char *arg, FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; int ret = 0; -AVCodec *codec = avcodec_find_encoder(avctx->codec_id); +AVCodec *codec = NULL; + +if (avctx) +codec = avcodec_find_encoder(avctx->codec_id); if (!(f = get_preset_file(filename, sizeof(filename), arg, 0, codec ? codec->name : NULL))) { fprintf(stderr, "File for preset '%s' not found\n", arg); -return 1; +return AVERROR(EINVAL); } while(!feof(f)){ @@ -284,18 +286,17 @@ static int ffserver_opt_preset(const char *arg, e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); -ret = 1; +ret = AVERROR(EINVAL); break; } -if(!strcmp(tmp, "acodec")){ +if (audio_id && !strcmp(tmp, "acodec")) { *audio_id = opt_codec(tmp2, AVMEDIA_TYPE_AUDIO); -}else if(!strcmp(tmp, "vcodec")){ +} else if (video_id && !strcmp(tmp, "vcodec")){ *video_id = opt_codec(tmp2, AVMEDIA_TYPE_VIDEO); -}else if(!strcmp(tmp, "scodec")){ +} else if(!strcmp(tmp, "scodec")) { /* opt_subtitle_codec(tmp2); */ -}else if(ffserver_opt_default(tmp, tmp2, avctx, type) < 0){ +} else if (avctx && (ret = ffserver_opt_default(tmp, tmp2, avctx, type)) < 0) { fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); -ret = 1; break; } } @@ -510,6 +511,83 @@ static int ffserver_parse_config_feed(FFServerConfig *config, const char *cmd, c return 0; } +static int ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary *conf, AVDictionary **opts) +{ +AVDictionaryEntry *e; +char *eptr; + +#define SET_INT_PARAM(factor, param, key) \ +if ((e = av_dict_get(conf, #key, NULL, 0))) { \ +enc->param = strtol(e->value, &eptr, 0);\ +if (factor) enc->param *= (factor); \ +if (eptr[0] || errno) { \ +av_log(NULL, AV_LOG_ERROR, "Cannot parse %s as number for %s parameter.\n", e->value, #param); \ +return AVERROR(errno); \ +} \ +} +#define SET_DOUBLE_PARAM(factor, param, key)\ +if ((e = av_dict_get(conf, #key, NULL, 0))) { \ +enc->param = strtod(e->value, &eptr); \ +if (factor) enc->param *= (factor); \ +if (eptr[0] || errno) { \ +av_log(NULL, AV_LOG_ERROR, "Cannot parse %s as number for %s parameter.\n", e->value, #param); \ +return AVERROR(errno); \ +} \ +} + +errno = 0; +//video params +SET_INT_PARAM(0, rc_min_rate, VideoBitRateRangeMin) +SET_INT_PARAM(0, rc_max_rate, VideoBitRateRangeMax) +SET_INT_PARAM(0, debug, Debug) +SET_INT_PARAM(0, strict_std_compliance, Strict) +SET_INT_PARAM(8*1024, rc_buffer_size,VideoBufferSize) +SET_INT_PARAM(1000, bit_rate_tolerance,VideoBitRate
[FFmpeg-devel] [PATCH 2/4] ffserver_config: clean up variable initialization
Signed-off-by: Lukasz Marek --- ffserver_config.c | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index 927b6fe..351c4e9 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -341,11 +341,11 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) char cmd[64]; char arg[1024], arg2[1024]; const char *p; -int val, errors, warnings, line_num; -FFServerStream **last_stream, *stream, *redirect; -FFServerStream **last_feed, *feed, *s; +int val, errors = 0, warnings = 0, line_num = 0; +FFServerStream **last_stream, *stream = NULL, *redirect = NULL; +FFServerStream **last_feed, *feed = NULL; AVCodecContext audio_enc, video_enc; -enum AVCodecID audio_id, video_id; +enum AVCodecID audio_id = AV_CODEC_ID_NONE, video_id = AV_CODEC_ID_NONE; int ret = 0; av_assert0(config); @@ -357,17 +357,10 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) return ret; } -errors = warnings = 0; -line_num = 0; config->first_stream = NULL; last_stream = &config->first_stream; config->first_feed = NULL; last_feed = &config->first_feed; -stream = NULL; -feed = NULL; -redirect = NULL; -audio_id = AV_CODEC_ID_NONE; -video_id = AV_CODEC_ID_NONE; #define ERROR(...) report_config_error(filename, line_num, AV_LOG_ERROR, &errors, __VA_ARGS__) #define WARNING(...) report_config_error(filename, line_num, AV_LOG_WARNING, &warnings, __VA_ARGS__) @@ -448,6 +441,7 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) if (stream || feed) { ERROR("Already in a tag\n"); } else { +FFServerStream *s; feed = av_mallocz(sizeof(FFServerStream)); if (!feed) { ret = AVERROR(ENOMEM); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] ffserver_conf: factorize parse function per config tag
Signed-off-by: Lukasz Marek --- ffserver.c|6 + ffserver_config.c | 1138 ++--- ffserver_config.h |7 + 3 files changed, 566 insertions(+), 585 deletions(-) diff --git a/ffserver.c b/ffserver.c index af6e8e1..22560ce 100644 --- a/ffserver.c +++ b/ffserver.c @@ -208,6 +208,12 @@ static FFServerConfig config = { .logfilename = {0}, .http_addr = {0}, .rtsp_addr = {0}, +.errors = 0, +.warnings = 0, +.audio_id = AV_CODEC_ID_NONE, +.video_id = AV_CODEC_ID_NONE, +.audio_enc = {0}, +.video_enc = {0}, }; static void new_connection(int server_fd, int is_rtsp); diff --git a/ffserver_config.c b/ffserver_config.c index 351c4e9..18b1e72 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -334,18 +334,531 @@ static void report_config_error(const char *filename, int line_num, int log_leve (*errors)++; } +#define ERROR(...) report_config_error(config->filename, line_num, AV_LOG_ERROR, &config->errors, __VA_ARGS__) +#define WARNING(...) report_config_error(config->filename, line_num, AV_LOG_WARNING, &config->warnings, __VA_ARGS__) + +static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, +const char **p, int line_num) +{ +int val; +char arg[1024]; +if (!av_strcasecmp(cmd, "Port") || !av_strcasecmp(cmd, "HTTPPort")) { +if (!av_strcasecmp(cmd, "Port")) +WARNING("Port option is deprecated, use HTTPPort instead\n"); +ffserver_get_arg(arg, sizeof(arg), p); +val = atoi(arg); +if (val < 1 || val > 65536) { +ERROR("Invalid port: %s\n", arg); +} +if (val < 1024) +WARNING("Trying to use IETF assigned system port: %d\n", val); +config->http_addr.sin_port = htons(val); +} else if (!av_strcasecmp(cmd, "HTTPBindAddress") || !av_strcasecmp(cmd, "BindAddress")) { +if (!av_strcasecmp(cmd, "BindAddress")) +WARNING("BindAddress option is deprecated, use HTTPBindAddress instead\n"); +ffserver_get_arg(arg, sizeof(arg), p); +if (resolve_host(&config->http_addr.sin_addr, arg) != 0) { +ERROR("%s:%d: Invalid host/IP address: %s\n", arg); +} +} else if (!av_strcasecmp(cmd, "NoDaemon")) { +WARNING("NoDaemon option has no effect, you should remove it\n"); +} else if (!av_strcasecmp(cmd, "RTSPPort")) { +ffserver_get_arg(arg, sizeof(arg), p); +val = atoi(arg); +if (val < 1 || val > 65536) { +ERROR("%s:%d: Invalid port: %s\n", arg); +} +config->rtsp_addr.sin_port = htons(atoi(arg)); +} else if (!av_strcasecmp(cmd, "RTSPBindAddress")) { +ffserver_get_arg(arg, sizeof(arg), p); +if (resolve_host(&config->rtsp_addr.sin_addr, arg) != 0) { +ERROR("Invalid host/IP address: %s\n", arg); +} +} else if (!av_strcasecmp(cmd, "MaxHTTPConnections")) { +ffserver_get_arg(arg, sizeof(arg), p); +val = atoi(arg); +if (val < 1 || val > 65536) { +ERROR("Invalid MaxHTTPConnections: %s\n", arg); +} +config->nb_max_http_connections = val; +} else if (!av_strcasecmp(cmd, "MaxClients")) { +ffserver_get_arg(arg, sizeof(arg), p); +val = atoi(arg); +if (val < 1 || val > config->nb_max_http_connections) { +ERROR("Invalid MaxClients: %s\n", arg); +} else { +config->nb_max_connections = val; +} +} else if (!av_strcasecmp(cmd, "MaxBandwidth")) { +int64_t llval; +ffserver_get_arg(arg, sizeof(arg), p); +llval = strtoll(arg, NULL, 10); +if (llval < 10 || llval > 1000) { +ERROR("Invalid MaxBandwidth: %s\n", arg); +} else +config->max_bandwidth = llval; +} else if (!av_strcasecmp(cmd, "CustomLog")) { +if (!config->debug) +ffserver_get_arg(config->logfilename, sizeof(config->logfilename), p); +} else if (!av_strcasecmp(cmd, "LoadModule")) { +ERROR("Loadable modules no longer supported\n"); +} else +ERROR("Incorrect keyword: '%s'\n", cmd); +return 0; +} + +static int ffserver_parse_config_feed(FFServerConfig *config, const char *cmd, const char **p, + int line_num, FFServerStream **pfeed) +{ +FFServerStream *feed; +char arg[1024]; +av_assert0(pfeed); +feed = *pfeed; +if (!av_strcasecmp(cmd, "filename, sizeof(feed->filename), p); +q = strrchr(fe
Re: [FFmpeg-devel] [PATCH 4/4] ffserver_config: postpone codec context creation
On 20.10.2014 23:57, Lukasz Marek wrote: So far AVCodecContext was created without codec specified. This causes internal data to not be initialized to defaults. This commit postpone context creation until all information are gathered. Partially fixes #1275 --- ffserver.c| 8 +- ffserver_config.c | 286 -- ffserver_config.h | 9 +- 3 files changed, 183 insertions(+), 120 deletions(-) I haven't done selfreview of this one yet. For now I wish patches 1-3 were marged as soon as possible. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: add build tree's directories to rpath
W dniu wtorek, 21 października 2014 Carl Eugen Hoyos napisał(a): > Lukasz Marek gmail.com> writes: > > > This commit allows to run programs linked > > dynamically in build dir without installing. > > Sorry if I misunderstand: > Doesn't this patch change the properties of the > installed binaries? if you run configure --enable-rpath --disable-static --enable-shared make make install then installed binaries of the fftolls will have more paths defined to look libraries for. but The goal is to allow to run fftool in build tree without installing. it really simpliefies and speed up recompilation during development. Now I'm not sure if other option should be added to enable it. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] ffserver: move configuration code to separate file
On 21 October 2014 12:08, Stefano Sabatini wrote: > On date Monday 2014-10-20 23:56:59 +0200, Lukasz Marek encoded: > > This commit doesn't change any existing logic. > > It moves ffserver configuration related code to separate file. > > It intends to make maintaining easier. > > I'm not opposed, but please tell why you think it's better this way. I > still hate the ffmpeg.c/ffmpeg_opt.c split, since it makes debugging > and browsing the code much harder for me, also it increases the > complexity since you have to declare otherwise static functions. ffserver.c has almost 5k lines now. The Commit moves 1k to separate file and there are only 2 calls in ffserver.c to moved code now. Is it a matter of personal preferences, but handling 5k lines file is not easy in general I think. Especially when there is still some work to be done in parsing code so it will grow a bit probably. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: add build tree's directories to rpath
On 21 October 2014 12:01, Derek Buitenhuis wrote: > On 10/21/2014 8:21 AM, Carl Eugen Hoyos wrote: > > This sounds like a very bad idea to me > > I agree. It's not nice to have remnants of the build process in the > installed binaries. > > If you need to run them during development, use LD_LIBRARY_PATH or > or build statically. > Building with static link is much slower. I agree patch is wrong, it could be controlled by separate option, just for devel, but nvm. Thx for pointing an issue. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/alsa: implement get_device_list callbacks
On 19.10.2014 16:27, wm4 wrote: On Sat, 18 Oct 2014 20:36:22 +0200 Lukasz Marek wrote: --- libavdevice/alsa-audio-common.c | 60 + libavdevice/alsa-audio-dec.c| 6 + libavdevice/alsa-audio-enc.c| 6 + libavdevice/alsa-audio.h| 2 ++ 4 files changed, 74 insertions(+) diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c index 4e63397..1061917 100644 --- a/libavdevice/alsa-audio-common.c +++ b/libavdevice/alsa-audio-common.c @@ -343,3 +343,63 @@ int ff_alsa_extend_reorder_buf(AlsaData *s, int min_size) s->reorder_buf_size = size; return 0; } + +/* ported from alsa-utils/aplay.c */ +int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type) +{ +int ret; +void **hints, **n; +char *name = NULL, *descr = NULL, *io = NULL, *tmp; +AVDeviceInfo *new_device = NULL; +const char *filter = stream_type == SND_PCM_STREAM_PLAYBACK ? "Output" : "Input"; + +av_log(NULL, AV_LOG_INFO, "%s\n", filter); + +if (snd_device_name_hint(-1, "pcm", &hints) < 0) +return AVERROR_EXTERNAL; +n = hints; +while (*n) { +name = snd_device_name_get_hint(*n, "NAME"); +descr = snd_device_name_get_hint(*n, "DESC"); +io = snd_device_name_get_hint(*n, "IOID"); +if (!io || !strcmp(io, filter)) { +new_device = av_mallocz(sizeof(AVDeviceInfo)); +if (!new_device) { +ret = AVERROR(ENOMEM); +goto fail; +} +new_device->device_name = name; +name = NULL; +if ((tmp = strrchr(descr, '\n')) && tmp[1]) { +new_device->device_description = av_strdup(&tmp[1]); +if (!new_device->device_description) { +ret = AVERROR(ENOMEM); +goto fail; +} +} else { +new_device->device_description = descr; +descr = NULL; +} +if ((ret = av_dynarray_add_nofree(&device_list->devices, + &device_list->nb_devices, new_device)) < 0) { +goto fail; +} +new_device = NULL; +} +av_freep(&io); +av_freep(&name); +av_freep(&descr); +n++; +} + fail: +av_free(io); +av_free(name); +av_free(descr); +if (new_device) { +av_free(new_device->device_description); +av_free(new_device->device_name); +av_free(new_device); +} +snd_device_name_free_hint(hints); +return ret; +} diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index 2cdf356..7f8f8cd 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c @@ -132,6 +132,11 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) return 0; } This will list all pseudo-devices. I concluded that this doesn't really work. The device name also controls the channel layout, and listing the device "hints" includes those multichannel pseudo-devies (e.g "surround51:CARD=Intel,DEV=0"). But shouldn't you select the device name based on the input audio channel layout you get? There are other reasons to change the device name, e.g. adding the "plug" converter plugin. I don't understand you clearly here. So I'm not sure what would be the best. Maybe enumerate raw devices only? Well, I have doubts about that too. I will change that when no other comments. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] ffserver_conf: factorize parse function per config tag
On 21.10.2014 20:25, Reimar Döffinger wrote: On 21.10.2014, at 12:15, Stefano Sabatini wrote: On date Monday 2014-10-20 23:57:01 +0200, Lukasz Marek encoded: Signed-off-by: Lukasz Marek --- ffserver.c|6 + ffserver_config.c | 1138 ++--- ffserver_config.h |7 + 3 files changed, 566 insertions(+), 585 deletions(-) diff --git a/ffserver.c b/ffserver.c index af6e8e1..22560ce 100644 --- a/ffserver.c +++ b/ffserver.c @@ -208,6 +208,12 @@ static FFServerConfig config = { .logfilename = {0}, .http_addr = {0}, .rtsp_addr = {0}, +.errors = 0, +.warnings = 0, +.audio_id = AV_CODEC_ID_NONE, +.video_id = AV_CODEC_ID_NONE, +.audio_enc = {0}, +.video_enc = {0}, }; Probably good, also I like the idea to split the big parsing function. I was going to ask if it wouldn't me better to use memset or just a single {0} to ensure that the whole struct is initialized at least and then assign the values for which you want something else. Though since it is "static" variable all that is kind of pointless since it defaults to 0 initialization. I which case I'd prefer if all the explicit initialization 0 was removed, it feels like a lot of clutter to do effectively nothing. Changed locally. Thx for that point. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavd/fbdev_common: report error during probing fbdev device
On 19.10.2014 00:28, Michael Niedermayer wrote: On Sat, Oct 18, 2014 at 08:25:29PM +0200, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- libavdevice/fbdev_common.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) LGTM Pushed ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/fbdev_dec: use default device when not provided
On 19.10.2014 00:27, Michael Niedermayer wrote: On Sat, Oct 18, 2014 at 07:38:16PM +0200, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- libavdevice/fbdev_dec.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) LGTM Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] opts: add list device sources/sinks options
On 19.10.2014 00:20, Michael Niedermayer wrote: On Sat, Oct 18, 2014 at 08:25:30PM +0200, Lukasz Marek wrote: Allows to list sources/sinks of the devices that implement that functionality. Signed-off-by: Lukasz Marek [...] +int show_sinks(void *optctx, const char *opt, const char *arg) +{ +#if CONFIG_AVDEVICE +AVOutputFormat *fmt = NULL; +char *dev = NULL; +AVDictionary *opts = NULL; +int ret = 0; +int error_level = av_log_get_level(); + +av_log_set_level(AV_LOG_ERROR); + +if ((ret = show_sinks_sources_parse_arg(arg, &dev, &opts)) < 0) +goto fail; + +do { +fmt = av_output_audio_device_next(fmt); av_* functions are not exported from libavdevice see libavdevice/libavdevice.v It is fixed now, do you have any other comments? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd: export all symbols with av prefix
On 21.10.2014 08:59, James Almer wrote: On 20/10/14 5:03 PM, Lukasz Marek wrote: On 20.10.2014 14:55, Michael Niedermayer wrote: On Mon, Oct 20, 2014 at 12:14:14PM +0200, Lukasz Marek wrote: On 20 October 2014 08:47, Reimar Döffinger wrote: On 19.10.2014, at 13:39, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- libavdevice/libavdevice.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/libavdevice.v b/libavdevice/libavdevice.v index 663af85..d7c86ba 100644 --- a/libavdevice/libavdevice.v +++ b/libavdevice/libavdevice.v @@ -1,4 +1,4 @@ LIBAVDEVICE_$MAJOR { -global: avdevice_*; +global: av*; I'd prefer if we'd keep the explicit _ termination and explicitly list all prefixes that get exported. I admit that luckily av is uncommon in English to start a word so it probably won't matter much though. I checked libavformat and libavcodec and they export av*, but I agree in general so I have changed according to your suggestion. libavdevice.v |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 5722720606edb454d2b64edb06299b1a37099827 0001-lavd-export-all-symbols-with-av_-prefix.patch From ea5b124b9eac8a4e07f41860fba646c6bc55f5bd Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Mon, 20 Oct 2014 12:12:20 +0200 Subject: [PATCH] lavd: export all symbols with av_ prefix LGTM Pushed. Should this be backported to ffmpeg 2.2 and 2.3? The four av_ functions declared in avdevice.h were never exposed before this. Only to 2.3 (these symbols are not present in 2.2) Michael, could you backport it? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/alsa: implement get_device_list callbacks
On 22 October 2014 11:53, Nicolas George wrote: > Le septidi 27 vendémiaire, an CCXXIII, Lukasz Marek a écrit : > > --- > > libavdevice/alsa-audio-common.c | 60 > + > > libavdevice/alsa-audio-dec.c| 6 + > > libavdevice/alsa-audio-enc.c| 6 + > > libavdevice/alsa-audio.h| 2 ++ > > 4 files changed, 74 insertions(+) > The rest looks good to me, but I have not checked the actual output. If you > have a working test tree, can you show the output on a typical system? > It gives the same list as aplay -L (upper case). For example (ffmpeg will display it in different way, but the content is the same) default Playback/recording through the PulseAudio sound server null Discard all samples (playback) or generate zero samples (capture) pulse PulseAudio Sound Server sysdefault:CARD=PCH HDA Intel PCH, ALC887-VD Analog Default Audio Device front:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog Front speakers surround40:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog 4.0 Surround output to Front and Rear speakers surround41:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers dmix:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog Direct sample mixing device dsnoop:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog Direct sample snooping device hw:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog Direct hardware device without any conversions plughw:CARD=PCH,DEV=0 HDA Intel PCH, ALC887-VD Analog Hardware device with all software conversions Question is, if thats correct. Maybe aplay -l (lower case) with "raw" devices only should be listed , for example: card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 I don't know which is better so I'm glad to have more opinions about that/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] ffserver_conf: factorize parse function per config tag
On 22.10.2014 21:51, Reynaldo H. Verdejo Pinochet wrote: Feel free to push after removing the explicit/redundant initialization of FFServerConfig config as Reimar suggested. Removed. While you are at this though, can you remove braces on single statement ifs? appreciated. Removed. At least these I noticed. Patches 1-3 pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] ffserver_config: postpone codec context creation
On 22.10.2014 22:05, Reynaldo H. Verdejo Pinochet wrote: Hi On 10/20/2014 06:57 PM, Lukasz Marek wrote: So far AVCodecContext was created without codec specified. This causes internal data to not be initialized to defaults. This commit postpone context creation until all information are gathered. are/is fixed +.video_opts = NULL, +.video_conf = NULL, +.audio_opts = NULL, +.audio_conf = NULL, +.video_preset = NULL, +.audio_preset = NULL, }; Guess you are already considered dropping the explicit initialization code as Reimaer suggested. Looks good otherwise. Feel free to push. I will, but a bit later, tomorrow probably. I need to apply Stefano's remarks and finally do some self review. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] ffserver_config: postpone codec context creation
On 22.10.2014 22:05, Reynaldo H. Verdejo Pinochet wrote: Guess you are already considered dropping the explicit initialization code as Reimaer suggested. Looks good otherwise. Feel free to push. I've attached updated patch. To save your time: 1. I updated ffserver_apply_stream_config function, 2. added comments in FFServerConfig struct in header (according to Stefano's remark) 3. in ffserver_parse_config_stream, at the end added: av_freep(&config->video_preset); av_freep(&config->audio_preset); and checking result of ffserver_apply_stream_config calls >From ca5e53e39254ce8ed205598b6ffc3ef0a3a41138 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Sun, 19 Oct 2014 21:29:40 +0200 Subject: [PATCH] ffserver_config: postpone codec context creation So far AVCodecContext was created without codec specified. This causes internal data to not be initialized to defaults. This commit postpone context creation until all information is gathered. Partially fixes #1275 --- ffserver_config.c | 302 +- ffserver_config.h | 9 +- 2 files changed, 193 insertions(+), 118 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index e44cdf7..65b7554 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -238,9 +238,8 @@ static void add_codec(FFServerStream *stream, AVCodecContext *av) st = av_mallocz(sizeof(AVStream)); if (!st) return; -st->codec = avcodec_alloc_context3(NULL); +st->codec = av; stream->streams[stream->nb_streams++] = st; -memcpy(st->codec, av, sizeof(AVCodecContext)); } static enum AVCodecID opt_codec(const char *name, enum AVMediaType type) @@ -269,12 +268,15 @@ static int ffserver_opt_preset(const char *arg, FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; int ret = 0; -AVCodec *codec = avcodec_find_encoder(avctx->codec_id); +AVCodec *codec = NULL; + +if (avctx) +codec = avcodec_find_encoder(avctx->codec_id); if (!(f = get_preset_file(filename, sizeof(filename), arg, 0, codec ? codec->name : NULL))) { fprintf(stderr, "File for preset '%s' not found\n", arg); -return 1; +return AVERROR(EINVAL); } while(!feof(f)){ @@ -284,18 +286,17 @@ static int ffserver_opt_preset(const char *arg, e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); -ret = 1; +ret = AVERROR(EINVAL); break; } -if(!strcmp(tmp, "acodec")){ +if (audio_id && !strcmp(tmp, "acodec")) { *audio_id = opt_codec(tmp2, AVMEDIA_TYPE_AUDIO); -}else if(!strcmp(tmp, "vcodec")){ +} else if (video_id && !strcmp(tmp, "vcodec")){ *video_id = opt_codec(tmp2, AVMEDIA_TYPE_VIDEO); -}else if(!strcmp(tmp, "scodec")){ +} else if(!strcmp(tmp, "scodec")) { /* opt_subtitle_codec(tmp2); */ -}else if(ffserver_opt_default(tmp, tmp2, avctx, type) < 0){ +} else if (avctx && (ret = ffserver_opt_default(tmp, tmp2, avctx, type)) < 0) { fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); -ret = 1; break; } } @@ -502,6 +503,95 @@ static int ffserver_parse_config_feed(FFServerConfig *config, const char *cmd, c return 0; } +static int ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary *conf, AVDictionary **opts) +{ +static const char *error_message = "Cannot parse '%s' as number for %s parameter.\n"; +AVDictionaryEntry *e; +char *tailp; +int ret = 0; + +#define SET_INT_PARAM(factor, param, key) \ +if ((e = av_dict_get(conf, #key, NULL, 0))) { \ +if (!e->value[0]) { \ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(EINVAL); \ +} \ +enc->param = strtol(e->value, &tailp, 0); \ +if (factor) enc->param *= (factor); \ +if (tailp[0] || errno) {\ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(errno); \ +} \ +} +#define SET_DOUBLE_PARAM(factor, param, key)\ +if ((e = av_dict_get(conf, #key, NULL, 0))) { \ +
Re: [FFmpeg-devel] [PATCH] lavd/alsa: implement get_device_list callbacks
On 23.10.2014 14:28, Nicolas George wrote: Le primidi 1er brumaire, an CCXXIII, Lukasz Marek a écrit : It gives the same list as aplay -L (upper case). For example (ffmpeg will display it in different way, but the content is the same) I thought for a time that "dmix:CARD=PCH,DEV=0" had placeholders: PCH needed to be replaced by an actual parameter, but I see now that I am wrong. If all the listed device names are actually valid as is, then it should be ok. Is the doc clear enough that the list is not exhaustive, and that an application should leave the user enter a free-form device name? Yes. default Playback/recording through the PulseAudio sound server For some reason (probably my strange ALSA config), I do not have that entry in the output of aplay -L. Maybe "default" needs a special case. According to this http://www.alsa-project.org/main/index.php/Asoundrc "The keyword default is defined in the ALSA lib API and will always access hw:0,0 — the default device on the default soundcard. Specifying the !default name supersedes the one defined in the ALSA lib API." I have pulse-alsa.conf instaled from pulseaudio deb, that is included in alsa config: pcm.!default { type pulse hint { show on description "Playback/recording through the PulseAudio sound server" } } ctl.!default { type pulse } So everything seems to be OK. Updated patch is attached. >From b88dc6133a958a6ecc0fe806739f3b688499f619 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Tue, 26 Aug 2014 20:30:35 +0200 Subject: [PATCH 2/2] lavd/alsa: implement get_device_list callbacks --- libavdevice/alsa-audio-common.c | 76 + libavdevice/alsa-audio-dec.c| 6 libavdevice/alsa-audio-enc.c| 6 libavdevice/alsa-audio.h| 2 ++ 4 files changed, 90 insertions(+) diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c index 4e63397..60839f4 100644 --- a/libavdevice/alsa-audio-common.c +++ b/libavdevice/alsa-audio-common.c @@ -343,3 +343,79 @@ int ff_alsa_extend_reorder_buf(AlsaData *s, int min_size) s->reorder_buf_size = size; return 0; } + +/* ported from alsa-utils/aplay.c */ +int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type) +{ +int ret = 0; +void **hints, **n; +char *name = NULL, *descr = NULL, *io = NULL, *tmp; +AVDeviceInfo *new_device = NULL; +const char *filter = stream_type == SND_PCM_STREAM_PLAYBACK ? "Output" : "Input"; + +if (snd_device_name_hint(-1, "pcm", &hints) < 0) +return AVERROR_EXTERNAL; +n = hints; +while (*n) { +tmp = snd_device_name_get_hint(*n, "NAME"); +name = av_strdup(tmp); +if (tmp && !name) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); +tmp = snd_device_name_get_hint(*n, "DESC"); +descr = av_strdup(tmp); +if (tmp && !descr) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); +tmp = snd_device_name_get_hint(*n, "IOID"); +io = av_strdup(tmp); +if (tmp && !io) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); +if (!io || !strcmp(io, filter)) { +new_device = av_mallocz(sizeof(AVDeviceInfo)); +if (!new_device) { +ret = AVERROR(ENOMEM); +goto fail; +} +new_device->device_name = name; +name = NULL; +if ((tmp = strrchr(descr, '\n')) && tmp[1]) { +new_device->device_description = av_strdup(&tmp[1]); +if (!new_device->device_description) { +ret = AVERROR(ENOMEM); +goto fail; +} +} else { +new_device->device_description = descr; +descr = NULL; +} +if ((ret = av_dynarray_add_nofree(&device_list->devices, + &device_list->nb_devices, new_device)) < 0) { +goto fail; +} +new_device = NULL; +} +av_freep(&io); +av_freep(&name); +av_freep(&descr); +n++; +} + fail: +av_free(io); +av_free(name); +av_free(descr); +if (new_device) { +av_free(new_device->device_description); +av_free(new_device->device_name); +av_free(new_device); +} +snd_device_name_free_hint(hints); +return ret; +} diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index 2cdf356..7f8f8cd 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c
Re: [FFmpeg-devel] [PATCH 2/2] opts: add list device sources/sinks options
On 22.10.2014 02:02, Michael Niedermayer wrote: it seems the only use of this function is under #if CONFIG_AVDEVICE so the fallback shouldnt be needed same for the other function also mising documentation and example in docs Updated patch is attached. >From 545cb5b81e9d4b8dee3d6e1e34f72cd165f336c8 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Thu, 7 Aug 2014 00:45:26 +0200 Subject: [PATCH 1/2] opts: add list device sources/sinks options Allows to list sources/sinks of the devices that implement that functionality. Signed-off-by: Lukasz Marek --- cmdutils.c | 181 +++ cmdutils.h | 14 cmdutils_common_opts.h | 6 ++ doc/fftools-common-opts.texi | 16 4 files changed, 217 insertions(+) diff --git a/cmdutils.c b/cmdutils.c index 7353dd5..b2e20d0 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -2052,3 +2052,184 @@ void *grow_array(void *array, int elem_size, int *size, int new_size) } return array; } + +#if CONFIG_AVDEVICE +static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts) +{ +int ret, i; +AVFormatContext *dev = NULL; +AVDeviceInfoList *device_list = NULL; +AVDictionary *tmp_opts = NULL; + +if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category)) +return AVERROR(EINVAL); + +printf("Audo-detected sources for %s:\n", fmt->name); +if (!fmt->get_device_list) { +ret = AVERROR(ENOSYS); +printf("Cannot list sources. Not implemented.\n"); +goto fail; +} + +/* TODO: avformat_open_input calls read_header callback which is not necessary. + Function like avformat_alloc_output_context2 for input could be helpful here. */ +av_dict_copy(&tmp_opts, opts, 0); +if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) { +printf("Cannot open device: %s.\n", fmt->name); +goto fail; +} + +if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { +printf("Cannot list sources.\n"); +goto fail; +} + +for (i = 0; i < device_list->nb_devices; i++) { +printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", + device_list->devices[i]->device_name, device_list->devices[i]->device_description); +} + + fail: +av_dict_free(&tmp_opts); +avdevice_free_list_devices(&device_list); +avformat_close_input(&dev); +return ret; +} + +static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts) +{ +int ret, i; +AVFormatContext *dev = NULL; +AVDeviceInfoList *device_list = NULL; +AVDictionary *tmp_opts = NULL; + +if (!fmt || !fmt->priv_class || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category)) +return AVERROR(EINVAL); + +printf("Audo-detected sinks for %s:\n", fmt->name); +if (!fmt->get_device_list) { +ret = AVERROR(ENOSYS); +printf("Cannot list sinks. Not implemented.\n"); +goto fail; +} + +if ((ret = avformat_alloc_output_context2(&dev, fmt, NULL, NULL)) < 0) { +printf("Cannot open device: %s.\n", fmt->name); +goto fail; +} +av_dict_copy(&tmp_opts, opts, 0); +av_opt_set_dict2(dev, &tmp_opts, AV_OPT_SEARCH_CHILDREN); + +if ((ret = avdevice_list_devices(dev, &device_list)) < 0) { +printf("Cannot list sinks.\n"); +goto fail; +} + +for (i = 0; i < device_list->nb_devices; i++) { +printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", + device_list->devices[i]->device_name, device_list->devices[i]->device_description); +} + + fail: +av_dict_free(&tmp_opts); +avdevice_free_list_devices(&device_list); +avformat_close_input(&dev); +return ret; +} + +static int show_sinks_sources_parse_arg(const char *arg, char **dev, AVDictionary **opts) +{ +int ret; +if (arg) { +char *opts_str = NULL; +av_assert0(dev && opts); +*dev = av_strdup(arg); +if (!*dev) +return AVERROR(ENOMEM); +if ((opts_str = strchr(*dev, ','))) { +*(opts_str++) = '\0'; +if (opts_str[0] && ((ret = av_dict_parse_string(opts, opts_str, "=", ":", 0)) < 0)) { +av_freep(dev); +return ret; +} +} +} else +printf("\nDevice name is not provided.\n" +"You can pass devicename[,opt1=val1[,opt2=val2...]] as an argument.\n\n"); +return 0; +} + +int show_sources(void *optctx, const char *opt, const char *arg) +{ +AVInputFormat *fmt
[FFmpeg-devel] [PATCH] doc/fftools-common-opts: document -devices option
Signed-off-by: Lukasz Marek --- doc/fftools-common-opts.texi | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi index 18027d2..c0bfb7e 100644 --- a/doc/fftools-common-opts.texi +++ b/doc/fftools-common-opts.texi @@ -103,7 +103,10 @@ Print detailed information about the filter name @var{filter_name}. Use the Show version. @item -formats -Show available formats. +Show available formats (including devices). + +@item -devices +Show available devices. @item -codecs Show all codecs known to libavcodec. -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] ffserver_config: postpone codec context creation
On 24.10.2014 00:18, Reynaldo H. Verdejo Pinochet wrote: Hi Lukasz +static int ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary *conf, AVDictionary **opts) +{ +static const char *error_message = "Cannot parse '%s' as number for %s parameter.\n"; +AVDictionaryEntry *e; +char *tailp; +int ret = 0; + +#define SET_INT_PARAM(factor, param, key) \ +if ((e = av_dict_get(conf, #key, NULL, 0))) { \ +if (!e->value[0]) { \ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(EINVAL); \ +} \ +enc->param = strtol(e->value, &tailp, 0); \ +if (factor) enc->param *= (factor); \ +if (tailp[0] || errno) {\ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(errno); \ +} \ +} +#define SET_DOUBLE_PARAM(factor, param, key)\ +if ((e = av_dict_get(conf, #key, NULL, 0))) { \ +if (!e->value[0]) { \ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(EINVAL); \ +} \ +enc->param = strtod(e->value, &tailp); \ +if (factor) enc->param *= (factor); \ +if (tailp[0] || errno) {\ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(errno); \ +} \ +} Can you turn those two macros into static inline funcs?. Also, looks like it shouldn't be too hard to factor those two into just 1 func. This is mostly to aid debugging. Nothing vital. I changed macros to functions. I think inline is not required in such code. Small comment, there is plenty of atoi in parsing code. It returns 0 in case parsed string is not a number and ignores random suffixed. Probably more problems can be pointed here. I prepared these functions to replace all atoi with them. Since these functions allows to check ranges, I split back all options to separate if's, so every option can have its own range. [..] @@ -624,136 +712,104 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, stream->max_time = atof(arg) * 1000; } else if (!av_strcasecmp(cmd, "AudioBitRate")) { ffserver_get_arg(arg, sizeof(arg), p); -config->audio_enc.bit_rate = lrintf(atof(arg) * 1000); -} else if (!av_strcasecmp(cmd, "AudioChannels")) { +av_dict_set_int(&config->audio_conf, cmd, lrintf(atof(arg) * 1000), 0); +} else if (!av_strcasecmp(cmd, "AudioChannels") || + !av_strcasecmp(cmd, "AudioSampleRate")) { ffserver_get_arg(arg, sizeof(arg), p); -config->audio_enc.channels = atoi(arg); -} else if (!av_strcasecmp(cmd, "AudioSampleRate")) { -ffserver_get_arg(arg, sizeof(arg), p); -config->audio_enc.sample_rate = atoi(arg); +av_dict_set(&config->audio_conf, cmd, arg, 0); Here and on every occurrence: Any particular reason why not to check av_dict_set*()'s return for < 0? Only reason I ask is because the config code already has failed allocation checks elsewhere. Also, should help avoiding some coverity scan noise. I forgot about that. Checks added. [..] - +AVDictionary *video_opts; /* Contains AVOptions for video encoder */ +AVDictionary *video_conf; /* Contains values stored in video AVCodecContext.fields */ +AVDictionary *audio_opts; /* Contains AVOptions for audio encoder */ +AVDictionary *audio_conf; /* Contains values stored in audio AVCodecContext.fields */ Would drop the repeated "Contains". Dropped. >From ab5395a62b60cedd47d9e6894b685c29a8c87f3d Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Sun, 19 Oct 2014 21:29:40 +0200 Subject: [PATCH] ffserver_config: postpone codec context creation So far AVCodecContext was created without codec specified. This causes internal data to not be initialized to defaults. This commit postpone context creation until all information is gathered. Partially fixes #1275 --- ffserver_config.c | 386 -- ffserver_config.h | 9 +- 2 files changed, 297 insertions(+), 98 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index e44cdf7..4c8740d 100644 --- a/ffserver_confi
Re: [FFmpeg-devel] [PATCH] doc/fftools-common-opts: document -devices option
On 25.10.2014 11:56, Michael Niedermayer wrote: On Fri, Oct 24, 2014 at 11:31:14PM +0200, Lukasz Marek wrote: Signed-off-by: Lukasz Marek --- doc/fftools-common-opts.texi | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) LGTM Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] opts: add list device sources/sinks options
On 24.10.2014 23:13, Michael Niedermayer wrote: +The returned list cannot be assumed to be always completed. complete +The returned list cannot be assumed to be always completed. complete Both changed i wonder if some of the code can be factorized/simplifed but either way it LGTM I know the code looks similar, but these small differences make it hard to really simplify (making common function that is longer and more complex than 2 is not really an improvement imho) @@ -2136,7 +2136,7 @@ static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts) fail: av_dict_free(&tmp_opts); avdevice_free_list_devices(&device_list); -avformat_close_input(&dev); +avformat_free_context(dev); return ret; } Pushed with this small local fix. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/alsa: implement get_device_list callbacks
On 26.10.2014 23:27, Michael Niedermayer wrote: +/* ported from alsa-utils/aplay.c */ +int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type) +{ +int ret = 0; +void **hints, **n; +char *name = NULL, *descr = NULL, *io = NULL, *tmp; +AVDeviceInfo *new_device = NULL; +const char *filter = stream_type == SND_PCM_STREAM_PLAYBACK ? "Output" : "Input"; + +if (snd_device_name_hint(-1, "pcm", &hints) < 0) +return AVERROR_EXTERNAL; +n = hints; +while (*n) { +tmp = snd_device_name_get_hint(*n, "NAME"); +name = av_strdup(tmp); +if (tmp && !name) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); +tmp = snd_device_name_get_hint(*n, "DESC"); +descr = av_strdup(tmp); +if (tmp && !descr) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); +tmp = snd_device_name_get_hint(*n, "IOID"); +io = av_strdup(tmp); +if (tmp && !io) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); doesnt mem leak in case of the goto fails ? i dont see where its freed I intended to free before ifs, but I'm a victim of routine... I noticed it can be done more clever anyway, so one more patch attached. >From 32d597cb057f7d45e3fcd794543b3ffc6404e9bb Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Tue, 26 Aug 2014 20:30:35 +0200 Subject: [PATCH] lavd/alsa: implement get_device_list callbacks Signed-off-by: Lukasz Marek --- libavdevice/alsa-audio-common.c | 52 + libavdevice/alsa-audio-dec.c| 6 + libavdevice/alsa-audio-enc.c| 6 + libavdevice/alsa-audio.h| 2 ++ 4 files changed, 66 insertions(+) diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c index 4e63397..749897f 100644 --- a/libavdevice/alsa-audio-common.c +++ b/libavdevice/alsa-audio-common.c @@ -343,3 +343,55 @@ int ff_alsa_extend_reorder_buf(AlsaData *s, int min_size) s->reorder_buf_size = size; return 0; } + +/* ported from alsa-utils/aplay.c */ +int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type) +{ +int ret = 0; +void **hints, **n; +char *name = NULL, *descr = NULL, *io = NULL, *tmp; +AVDeviceInfo *new_device = NULL; +const char *filter = stream_type == SND_PCM_STREAM_PLAYBACK ? "Output" : "Input"; + +if (snd_device_name_hint(-1, "pcm", &hints) < 0) +return AVERROR_EXTERNAL; +n = hints; +while (*n && !ret) { +name = snd_device_name_get_hint(*n, "NAME"); +descr = snd_device_name_get_hint(*n, "DESC"); +io = snd_device_name_get_hint(*n, "IOID"); +if (!io || !strcmp(io, filter)) { +new_device = av_mallocz(sizeof(AVDeviceInfo)); +if (!new_device) { +ret = AVERROR(ENOMEM); +goto fail; +} +new_device->device_name = av_strdup(name); +if ((tmp = strrchr(descr, '\n')) && tmp[1]) +new_device->device_description = av_strdup(&tmp[1]); +else +new_device->device_description = av_strdup(descr); +if (!new_device->device_description || !new_device->device_name) { +ret = AVERROR(ENOMEM); +goto fail; +} +if ((ret = av_dynarray_add_nofree(&device_list->devices, + &device_list->nb_devices, new_device)) < 0) { +goto fail; +} +new_device = NULL; +} + fail: +free(io); +free(name); +free(descr); +n++; +} +if (new_device) { +av_free(new_device->device_description); +av_free(new_device->device_name); +av_free(new_device); +} +snd_device_name_free_hint(hints); +return ret; +} diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index 2cdf356..7f8f8cd 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c @@ -132,6 +132,11 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) return 0; } +static int audio_get_device_list(AVFormatContext *h, AVDeviceInfoList *device_list) +{ +return ff_alsa_get_device_list(device_list, SND_PCM_STREAM_CAPTURE); +} + static const AVOption options[] = { { "sample_rate", "", offsetof(AlsaData, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { "channels","", offsetof(AlsaData, channels),AV_OPT_TYPE_INT, {.i64 = 2},
Re: [FFmpeg-devel] FFserver bug?
On 31 October 2014 03:19, Michael Niedermayer wrote: > On Fri, Oct 31, 2014 at 02:14:29AM +0100, Sevan Gelici wrote: > > Hi, > > > > Two days ago i updated my linux system and also ffmpeg was updated. When > i > > started to stream it was not working anymore. I am using ffserver. i > > determined the problem which causes the problem thats the bitrate it > makes > > like 50mb of it. i reinstalled the system a couple times because of some > > tests and still i don't get it work. Can someone help me with this pls. > > do you know which commit / revission has caused the regression ? > At first moment I thought I messed something with configuration code, but it reproducible before my recent changes. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] ffserver_config: postpone codec context creation
On 25.10.2014 19:53, Lukasz Marek wrote: On 24.10.2014 00:18, Reynaldo H. Verdejo Pinochet wrote: Hi Lukasz +static int ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary *conf, AVDictionary **opts) +{ +static const char *error_message = "Cannot parse '%s' as number for %s parameter.\n"; +AVDictionaryEntry *e; +char *tailp; +int ret = 0; + +#define SET_INT_PARAM(factor, param, key) \ +if ((e = av_dict_get(conf, #key, NULL, 0))) { \ +if (!e->value[0]) { \ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(EINVAL); \ +} \ +enc->param = strtol(e->value, &tailp, 0); \ +if (factor) enc->param *= (factor); \ +if (tailp[0] || errno) {\ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(errno); \ +} \ +} +#define SET_DOUBLE_PARAM(factor, param, key)\ +if ((e = av_dict_get(conf, #key, NULL, 0))) { \ +if (!e->value[0]) { \ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(EINVAL); \ +} \ +enc->param = strtod(e->value, &tailp); \ +if (factor) enc->param *= (factor); \ +if (tailp[0] || errno) {\ +av_log(NULL, AV_LOG_ERROR, error_message, e->value, #key); \ +ret = AVERROR(errno); \ +} \ +} Can you turn those two macros into static inline funcs?. Also, looks like it shouldn't be too hard to factor those two into just 1 func. This is mostly to aid debugging. Nothing vital. I changed macros to functions. I think inline is not required in such code. Small comment, there is plenty of atoi in parsing code. It returns 0 in case parsed string is not a number and ignores random suffixed. Probably more problems can be pointed here. I prepared these functions to replace all atoi with them. Since these functions allows to check ranges, I split back all options to separate if's, so every option can have its own range. [..] @@ -624,136 +712,104 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, stream->max_time = atof(arg) * 1000; } else if (!av_strcasecmp(cmd, "AudioBitRate")) { ffserver_get_arg(arg, sizeof(arg), p); -config->audio_enc.bit_rate = lrintf(atof(arg) * 1000); -} else if (!av_strcasecmp(cmd, "AudioChannels")) { +av_dict_set_int(&config->audio_conf, cmd, lrintf(atof(arg) * 1000), 0); +} else if (!av_strcasecmp(cmd, "AudioChannels") || + !av_strcasecmp(cmd, "AudioSampleRate")) { ffserver_get_arg(arg, sizeof(arg), p); -config->audio_enc.channels = atoi(arg); -} else if (!av_strcasecmp(cmd, "AudioSampleRate")) { -ffserver_get_arg(arg, sizeof(arg), p); -config->audio_enc.sample_rate = atoi(arg); +av_dict_set(&config->audio_conf, cmd, arg, 0); Here and on every occurrence: Any particular reason why not to check av_dict_set*()'s return for < 0? Only reason I ask is because the config code already has failed allocation checks elsewhere. Also, should help avoiding some coverity scan noise. I forgot about that. Checks added. [..] - +AVDictionary *video_opts; /* Contains AVOptions for video encoder */ +AVDictionary *video_conf; /* Contains values stored in video AVCodecContext.fields */ +AVDictionary *audio_opts; /* Contains AVOptions for audio encoder */ +AVDictionary *audio_conf; /* Contains values stored in audio AVCodecContext.fields */ Would drop the repeated "Contains". Dropped. Patch OK'ed by Reynaldo in private email. Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavd/alsa: implement get_device_list callbacks
On 27.10.2014 23:12, Lukasz Marek wrote: On 26.10.2014 23:27, Michael Niedermayer wrote: +/* ported from alsa-utils/aplay.c */ +int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type) +{ +int ret = 0; +void **hints, **n; +char *name = NULL, *descr = NULL, *io = NULL, *tmp; +AVDeviceInfo *new_device = NULL; +const char *filter = stream_type == SND_PCM_STREAM_PLAYBACK ? "Output" : "Input"; + +if (snd_device_name_hint(-1, "pcm", &hints) < 0) +return AVERROR_EXTERNAL; +n = hints; +while (*n) { +tmp = snd_device_name_get_hint(*n, "NAME"); +name = av_strdup(tmp); +if (tmp && !name) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); +tmp = snd_device_name_get_hint(*n, "DESC"); +descr = av_strdup(tmp); +if (tmp && !descr) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); +tmp = snd_device_name_get_hint(*n, "IOID"); +io = av_strdup(tmp); +if (tmp && !io) { +ret = AVERROR(ENOMEM); +goto fail; +} +free(tmp); doesnt mem leak in case of the goto fails ? i dont see where its freed I intended to free before ifs, but I'm a victim of routine... I noticed it can be done more clever anyway, so one more patch attached. Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: add -Werror=declaration-after-statement for gcc
Signed-off-by: Lukasz Marek --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 40d1f07..3322779 100755 --- a/configure +++ b/configure @@ -5227,6 +5227,7 @@ elif enabled gcc; then check_cflags -Werror=missing-prototypes check_cflags -Werror=return-type check_cflags -Werror=vla +check_cflags -Werror=declaration-after-statement check_cflags -Wformat enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized elif enabled llvm_gcc; then -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] ffserver_config: drop requirement video size being multiple of 16
Signed-off-by: Lukasz Marek --- ffserver_config.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index d589ff2..f11db03 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -819,8 +819,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, ret = av_parse_video_size(&w, &h, arg); if (ret < 0) ERROR("Invalid video size '%s'\n", arg); -else if ((w % 16) || (h % 16)) -ERROR("Image size must be a multiple of 16\n"); if (av_dict_set_int(&config->video_conf, "VideoSizeWidth", w, 0) < 0 || av_dict_set_int(&config->video_conf, "VideoSizeHeight", h, 0) < 0) goto nomem; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] ffserver_config: drop presets support
Signed-off-by: Lukasz Marek --- ffserver_config.c | 80 +-- ffserver_config.h | 2 -- 2 files changed, 1 insertion(+), 81 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index f11db03..6989bd8 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -252,61 +252,6 @@ static enum AVCodecID opt_codec(const char *name, enum AVMediaType type) return codec->id; } -static int ffserver_opt_default(const char *opt, const char *arg, - AVCodecContext *avctx, int type) -{ -int ret = 0; -const AVOption *o = av_opt_find(avctx, opt, NULL, type, 0); -if(o) -ret = av_opt_set(avctx, opt, arg, 0); -return ret; -} - -static int ffserver_opt_preset(const char *arg, - AVCodecContext *avctx, int type, - enum AVCodecID *audio_id, enum AVCodecID *video_id) -{ -FILE *f=NULL; -char filename[1000], tmp[1000], tmp2[1000], line[1000]; -int ret = 0; -AVCodec *codec = NULL; - -if (avctx) -codec = avcodec_find_encoder(avctx->codec_id); - -if (!(f = get_preset_file(filename, sizeof(filename), arg, 0, - codec ? codec->name : NULL))) { -fprintf(stderr, "File for preset '%s' not found\n", arg); -return AVERROR(EINVAL); -} - -while(!feof(f)){ -int e= fscanf(f, "%999[^\n]\n", line) - 1; -if(line[0] == '#' && !e) -continue; -e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; -if(e){ -fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); -ret = AVERROR(EINVAL); -break; -} -if (audio_id && !strcmp(tmp, "acodec")) { -*audio_id = opt_codec(tmp2, AVMEDIA_TYPE_AUDIO); -} else if (video_id && !strcmp(tmp, "vcodec")){ -*video_id = opt_codec(tmp2, AVMEDIA_TYPE_VIDEO); -} else if(!strcmp(tmp, "scodec")) { -/* opt_subtitle_codec(tmp2); */ -} else if (avctx && (ret = ffserver_opt_default(tmp, tmp2, avctx, type)) < 0) { -fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); -break; -} -} - -fclose(f); - -return ret; -} - static AVOutputFormat *ffserver_guess_format(const char *short_name, const char *filename, const char *mime_type) { AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type); @@ -867,18 +812,7 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, goto nomem; } else if (!av_strcasecmp(cmd, "AVPresetVideo") || !av_strcasecmp(cmd, "AVPresetAudio")) { -char **preset = NULL; -ffserver_get_arg(arg, sizeof(arg), p); -if (!av_strcasecmp(cmd, "AVPresetVideo")) { -preset = &config->video_preset; -ffserver_opt_preset(arg, NULL, 0, NULL, &config->video_id); -} else { -preset = &config->audio_preset; -ffserver_opt_preset(arg, NULL, 0, &config->audio_id, NULL); -} -*preset = av_strdup(arg); -if (!preset) -return AVERROR(ENOMEM); +WARNING("Preset options have no effect, you should remove it\n"); } else if (!av_strcasecmp(cmd, "VideoTag")) { ffserver_get_arg(arg, sizeof(arg), p); if (strlen(arg) == 4) { @@ -953,20 +887,12 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) { if (config->audio_id != AV_CODEC_ID_NONE) { AVCodecContext *audio_enc = avcodec_alloc_context3(avcodec_find_encoder(config->audio_id)); -if (config->audio_preset && -ffserver_opt_preset(arg, audio_enc, AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_ENCODING_PARAM, -NULL, NULL) < 0) -ERROR("Could not apply preset '%s'\n", arg); if (ffserver_apply_stream_config(audio_enc, config->audio_conf, &config->audio_opts) < 0) config->errors++; add_codec(stream, audio_enc); } if (config->video_id != AV_CODEC_ID_NONE) { AVCodecContext *video_enc = avcodec_alloc_context3(avcodec_find_encoder(config->video_id)); -if (config->video_preset && -ffserver_opt_preset(arg, video_enc, AV_OPT_FLAG_VIDEO_PARAM|AV_
[FFmpeg-devel] [PATCH 3/4] ffserver_config: improve error handling
Replace atoi with more advanced parsing routine. Set maximum port value to 65535 (not 65536). Other checks. Signed-off-by: Lukasz Marek --- ffserver_config.c | 48 +++- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index 6989bd8..c694934 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -356,9 +356,7 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, if (!av_strcasecmp(cmd, "Port")) WARNING("Port option is deprecated, use HTTPPort instead\n"); ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val < 1 || val > 65536) -ERROR("Invalid port: %s\n", arg); +ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid port: %s\n", arg); if (val < 1024) WARNING("Trying to use IETF assigned system port: %d\n", val); config->http_addr.sin_port = htons(val); @@ -367,37 +365,38 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, WARNING("BindAddress option is deprecated, use HTTPBindAddress instead\n"); ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&config->http_addr.sin_addr, arg) != 0) -ERROR("%s:%d: Invalid host/IP address: %s\n", arg); +ERROR("Invalid host/IP address: %s\n", arg); } else if (!av_strcasecmp(cmd, "NoDaemon")) { WARNING("NoDaemon option has no effect, you should remove it\n"); } else if (!av_strcasecmp(cmd, "RTSPPort")) { ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val < 1 || val > 65536) -ERROR("%s:%d: Invalid port: %s\n", arg); -config->rtsp_addr.sin_port = htons(atoi(arg)); +ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid port: %s\n", arg); +config->rtsp_addr.sin_port = htons(val); } else if (!av_strcasecmp(cmd, "RTSPBindAddress")) { ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&config->rtsp_addr.sin_addr, arg) != 0) ERROR("Invalid host/IP address: %s\n", arg); } else if (!av_strcasecmp(cmd, "MaxHTTPConnections")) { ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val < 1 || val > 65536) -ERROR("Invalid MaxHTTPConnections: %s\n", arg); +ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid MaxHTTPConnections: %s\n", arg); config->nb_max_http_connections = val; +if (config->nb_max_connections > config->nb_max_http_connections) +ERROR("Inconsistent configuration: MaxClients(%d) > MaxHTTPConnections(%d)\n", + config->nb_max_connections, config->nb_max_http_connections); } else if (!av_strcasecmp(cmd, "MaxClients")) { ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val < 1 || val > config->nb_max_http_connections) -ERROR("Invalid MaxClients: %s\n", arg); -else -config->nb_max_connections = val; +ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid MaxClients: %s\n", arg); +config->nb_max_connections = val; +if (config->nb_max_connections > config->nb_max_http_connections) +ERROR("Inconsistent configuration: MaxClients(%d) > MaxHTTPConnections(%d)\n", + config->nb_max_connections, config->nb_max_http_connections); } else if (!av_strcasecmp(cmd, "MaxBandwidth")) { int64_t llval; +char *tailp; ffserver_get_arg(arg, sizeof(arg), p); -llval = strtoll(arg, NULL, 10); -if (llval < 10 || llval > 1000) +errno = 0; +llval = strtoll(arg, &tailp, 10); +if (llval < 10 || llval > 1000 || tailp[0] || errno) ERROR("Invalid MaxBandwidth: %s\n", arg); else config->max_bandwidth = llval; @@ -405,7 +404,7 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, if (!config->debug) ffserver_get_arg(config->logfilename, sizeof(config->logfilename), p); } else if (!av_strcasecmp(cmd, "LoadModule")) { -ERROR("Loadable modules no longer supported\n"); +ERROR("Loadable modules are no longer supported\n"); } else ERROR("Incorrect keyword: '%s'\n", cmd); return 0; @@ -500,6 +499,9 @@
[FFmpeg-devel] [PATCH 4/4] ffserver_config: dont pass pointer to enum as pointer to int
Signed-off-by: Lukasz Marek --- ffserver_config.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index c694934..045b791 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -541,8 +541,11 @@ static int ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary ffserver_set_int_param(&enc->width, e->value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); if ((e = av_dict_get(conf, "VideoSizeHeight", NULL, 0))) ffserver_set_int_param(&enc->height, e->value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); -if ((e = av_dict_get(conf, "PixelFormat", NULL, 0))) -ffserver_set_int_param(&enc->pix_fmt, e->value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); +if ((e = av_dict_get(conf, "PixelFormat", NULL, 0))) { +int val; +ffserver_set_int_param(&val, e->value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); +enc->pix_fmt = val; +} if ((e = av_dict_get(conf, "VideoGopSize", NULL, 0))) ffserver_set_int_param(&enc->gop_size, e->value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); if ((e = av_dict_get(conf, "VideoFrameRateNum", NULL, 0))) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: add -Werror=declaration-after-statement for gcc
On 01.11.2014 09:48, Nicolas George wrote: Le primidi 11 brumaire, an CCXXIII, Lukasz Marek a écrit : Signed-off-by: Lukasz Marek --- configure | 1 + 1 file changed, 1 insertion(+) Did something change since 377dfa3d? Hmm, it can be annoying during debugging/development/tests... yes. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] "OPW Qualification Task: Enable daemon mode for FFserver"
On 01.11.2014 17:20, Binathi Bingi wrote: +if (config.ffserver_daemon) { +int ffserver_id = 0; You may change int to pid_t too, which is actually returned by fork() +pid_t sid = 0; + +ffserver_id = fork(); ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffserver_config: improve AVOption handing
AVOption are checked right after found in config file. It allows to report exact line in config file. Options provided more than once are threated as errors. It also fixes flag options handing. Flags may occur more than once in config file. Signed-off-by: Lukasz Marek --- ffserver_config.c | 44 +--- ffserver_config.h | 1 + 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/ffserver_config.c b/ffserver_config.c index 045b791..cc8ee48 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -344,6 +344,27 @@ static int ffserver_set_float_param(float *dest, const char *value, float factor return AVERROR(EINVAL); } +static int ffserver_save_avoption(const char *opt, const char *arg, AVDictionary **dict, + int type, FFServerConfig *config, int line_num) +{ +int ret = 0; +AVDictionaryEntry *e; +const AVOption *o = av_opt_find(config->dummy_ctx, opt, NULL, type, AV_OPT_SEARCH_CHILDREN); +if (!o) { +report_config_error(config->filename, line_num, AV_LOG_ERROR, &config->errors, "Option not found: %s\n", opt); +} else if ((ret = av_opt_set(config->dummy_ctx, opt, arg, AV_OPT_SEARCH_CHILDREN)) < 0) { +report_config_error(config->filename, line_num, AV_LOG_ERROR, &config->errors, "Invalid value for option %s (%s): %s\n", opt, arg, av_err2str(ret)); +} else if ((e = av_dict_get(*dict, opt, NULL, 0))) { +if ((o->type == AV_OPT_TYPE_FLAGS) && arg && (arg[0] == '+' || arg[0] == '-')) +return av_dict_set(dict, opt, arg, AV_DICT_APPEND); +report_config_error(config->filename, line_num, AV_LOG_ERROR, &config->errors, +"Redeclaring value of the option %s, previous value: %s\n", opt, e->value); +} else if (av_dict_set(dict, opt, arg, 0) < 0) { +return AVERROR(ENOMEM); +} +return 0; +} + #define ERROR(...) report_config_error(config->filename, line_num, AV_LOG_ERROR, &config->errors, __VA_ARGS__) #define WARNING(...) report_config_error(config->filename, line_num, AV_LOG_WARNING, &config->warnings, __VA_ARGS__) @@ -517,7 +538,6 @@ static int ffserver_parse_config_feed(FFServerConfig *config, const char *cmd, c static int ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary *conf, AVDictionary **opts) { AVDictionaryEntry *e; -int ret = 0; /* Return values from ffserver_set_*_param are ignored. Values are initially parsed and checked before inserting to AVDictionary. */ @@ -589,13 +609,8 @@ static int ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary ffserver_set_int_param(&enc->bit_rate, e->value, 0, INT_MIN, INT_MAX, NULL, 0, NULL); av_opt_set_dict2(enc, opts, AV_OPT_SEARCH_CHILDREN); -e = NULL; -while (e = av_dict_get(*opts, "", e, AV_DICT_IGNORE_SUFFIX)) { -av_log(NULL, AV_LOG_ERROR, "Provided AVOption '%s' doesn't match any existing option.\n", e->key); -ret = AVERROR(EINVAL); -} -return ret; +return 0; } static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, const char **p, @@ -613,6 +628,11 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, stream = av_mallocz(sizeof(FFServerStream)); if (!stream) return AVERROR(ENOMEM); +config->dummy_ctx = avcodec_alloc_context3(NULL); +if (!config->dummy_ctx) { +av_free(stream); +return AVERROR(ENOMEM); +} ffserver_get_arg(stream->filename, sizeof(stream->filename), p); q = strrchr(stream->filename, '>'); if (q) @@ -806,14 +826,14 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, goto nomem; } else if (!av_strcasecmp(cmd, "AVOptionVideo") || !av_strcasecmp(cmd, "AVOptionAudio")) { -AVDictionary **dict; +int ret; ffserver_get_arg(arg, sizeof(arg), p); ffserver_get_arg(arg2, sizeof(arg2), p); if (!av_strcasecmp(cmd, "AVOptionVideo")) -dict = &config->video_opts; +ret = ffserver_save_avoption(arg, arg2, &config->video_opts, AV_OPT_FLAG_VIDEO_PARAM ,config, line_num); else -dict = &config->audio_opts; -if (av_dict_set(dict, arg, arg2, 0) < 0) +ret = ffserver_save_avoption(arg, arg2, &config->audio_opts, AV_OPT_FLAG_AUDIO_PARAM ,config, line_num); +if (ret < 0) goto nomem; } else if (!av_strcasecmp(cmd, "AVPresetVideo") || !av_strcasecmp(cmd, "AVPresetAudi
Re: [FFmpeg-devel] [PATCH 2/4] ffserver_config: drop presets support
On 01.11.2014 22:27, Reynaldo H. Verdejo Pinochet wrote: Patch seems OK but I'm missing on the rationalle behind dropping the preset support. Can you elaborate? Patch 1 and 2 are just suggestion from previous reviews by Stefano. Regarding presents itself I have no pressure to remove it, but I agree with Stefano that it seems to be dead feature. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] ffserver_config: improve error handling
On 01.11.2014 23:06, Reynaldo H. Verdejo Pinochet wrote: Hi On 10/31/2014 11:00 PM, Lukasz Marek wrote: [..] @@ -356,9 +356,7 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, if (!av_strcasecmp(cmd, "Port")) WARNING("Port option is deprecated, use HTTPPort instead\n"); ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val < 1 || val > 65536) -ERROR("Invalid port: %s\n", arg); +ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid port: %s\n", arg); if (val < 1024) WARNING("Trying to use IETF assigned system port: %d\n", val); config->http_addr.sin_port = htons(val); @@ -367,37 +365,38 @@ static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, WARNING("BindAddress option is deprecated, use HTTPBindAddress instead\n"); ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&config->http_addr.sin_addr, arg) != 0) -ERROR("%s:%d: Invalid host/IP address: %s\n", arg); +ERROR("Invalid host/IP address: %s\n", arg); } else if (!av_strcasecmp(cmd, "NoDaemon")) { WARNING("NoDaemon option has no effect, you should remove it\n"); } else if (!av_strcasecmp(cmd, "RTSPPort")) { ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val < 1 || val > 65536) -ERROR("%s:%d: Invalid port: %s\n", arg); -config->rtsp_addr.sin_port = htons(atoi(arg)); +ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid port: %s\n", arg); +config->rtsp_addr.sin_port = htons(val); } else if (!av_strcasecmp(cmd, "RTSPBindAddress")) { ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&config->rtsp_addr.sin_addr, arg) != 0) ERROR("Invalid host/IP address: %s\n", arg); } else if (!av_strcasecmp(cmd, "MaxHTTPConnections")) { ffserver_get_arg(arg, sizeof(arg), p); -val = atoi(arg); -if (val < 1 || val > 65536) -ERROR("Invalid MaxHTTPConnections: %s\n", arg); +ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid MaxHTTPConnections: %s\n", arg); I don't think we should be capping MaxHTTPConnections at 65535. If there's a reason then FFServerConfig.nb_max_http_connections type needs to be revised too? I decreased it by 1 automatically rather than for any reason. I didn't want to change logic where it was not needed, and it was not needed here. I guess you ask in general if there should be a limit (not just it is 65535 or 6). I don't know, but as I stated before, I don't want to change the limit, just int parsing routine. If you wish I can change back to 65536 or to INT_MAX, but I want it to be clear it is not my original intention. :) [...] @@ -500,6 +499,9 @@ static int ffserver_parse_config_feed(FFServerConfig *config, const char *cmd, c case 'G': fsize *= 1024 * 1024 * 1024; break; +default: +ERROR("Invalid file size: %s\n", arg); +break; } feed->feed_max_size = (int64_t)fsize; if (feed->feed_max_size < FFM_PACKET_SIZE*4) @@ -876,11 +878,15 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, stream->is_multicast = 1; stream->loop = 1; /* default is looping */ } else if (!av_strcasecmp(cmd, "MulticastPort")) { +int val; ffserver_get_arg(arg, sizeof(arg), p); -stream->multicast_port = atoi(arg); +ffserver_set_int_param(&val, arg, 0, 1, 65535, config, line_num, "Invalid MulticastPort: %s\n", arg); +stream->multicast_port = val; } else if (!av_strcasecmp(cmd, "MulticastTTL")) { +int val; Maybe declare val once at the beginning of ffserver_parse_config_stream() OK, will do that locally. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] ffserver_config: dont pass pointer to enum as pointer to int
On 1 November 2014 23:07, Reynaldo H. Verdejo Pinochet < reyna...@osg.samsung.com> wrote: > Looks OK. Feel free to push. > Pushed this one ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] ffserver_config: drop presets support
On 2 November 2014 00:15, Reynaldo H. Verdejo Pinochet < reyna...@osg.samsung.com> wrote: > Hi > > On 11/01/2014 07:42 PM, Lukasz Marek wrote: > > [..] > > > > Patch 1 and 2 are just suggestion from previous reviews by Stefano. > > Regarding presents itself I have no pressure to remove it, but I agree > > with Stefano that it seems to be dead feature. > > > > Got it. My take on these matters is usually that if the feature > works and does no harm, then keep it. I agree in general. > Maybe there's someone relying > on this. I will try getting others to comment on and decide. For > the time been though I think there might be a missing and needed > change to the ffserver docs for this patch to be complete. Right, I forgot about doc. I agree to wait for other comments, ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavf/ffm: silent deprecated warnings
Signed-off-by: Lukasz Marek --- libavformat/ffmdec.c | 11 +++ libavformat/ffmenc.c | 5 + 2 files changed, 16 insertions(+) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 448762b..e95c139 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -23,6 +23,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/intfloat.h" +#include "libavutil/internal.h" #include "avformat.h" #include "internal.h" #include "ffm.h" @@ -224,8 +225,10 @@ static int ffm_close(AVFormatContext *s) { int i; +FF_DISABLE_DEPRECATION_WARNINGS for (i = 0; i < s->nb_streams; i++) av_freep(&s->streams[i]->codec->rc_eq); +FF_ENABLE_DEPRECATION_WARNINGS return 0; } @@ -310,7 +313,9 @@ static int ffm2_read_header(AVFormatContext *s) codec->qblur = avio_rb16(pb) / 1.0; codec->bit_rate_tolerance = avio_rb32(pb); avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf)); +FF_DISABLE_DEPRECATION_WARNINGS codec->rc_eq = av_strdup(rc_eq_buf); +FF_ENABLE_DEPRECATION_WARNINGS codec->rc_max_rate = avio_rb32(pb); codec->rc_min_rate = avio_rb32(pb); codec->rc_buffer_size = avio_rb32(pb); @@ -327,7 +332,9 @@ static int ffm2_read_header(AVFormatContext *s) codec->mb_decision = avio_rb32(pb); codec->nsse_weight = avio_rb32(pb); codec->frame_skip_cmp = avio_rb32(pb); +FF_DISABLE_DEPRECATION_WARNINGS codec->rc_buffer_aggressivity = av_int2double(avio_rb64(pb)); +FF_ENABLE_DEPRECATION_WARNINGS codec->codec_tag = avio_rb32(pb); codec->thread_count = avio_r8(pb); codec->coder_type = avio_rb32(pb); @@ -434,7 +441,9 @@ static int ffm_read_header(AVFormatContext *s) codec->qblur = avio_rb16(pb) / 1.0; codec->bit_rate_tolerance = avio_rb32(pb); avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf)); +FF_DISABLE_DEPRECATION_WARNINGS codec->rc_eq = av_strdup(rc_eq_buf); +FF_ENABLE_DEPRECATION_WARNINGS codec->rc_max_rate = avio_rb32(pb); codec->rc_min_rate = avio_rb32(pb); codec->rc_buffer_size = avio_rb32(pb); @@ -451,7 +460,9 @@ static int ffm_read_header(AVFormatContext *s) codec->mb_decision = avio_rb32(pb); codec->nsse_weight = avio_rb32(pb); codec->frame_skip_cmp = avio_rb32(pb); +FF_DISABLE_DEPRECATION_WARNINGS codec->rc_buffer_aggressivity = av_int2double(avio_rb64(pb)); +FF_ENABLE_DEPRECATION_WARNINGS codec->codec_tag = avio_rb32(pb); codec->thread_count = avio_r8(pb); codec->coder_type = avio_rb32(pb); diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index eb809eb..7528dbf 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -23,6 +23,7 @@ #include "libavutil/intfloat.h" #include "libavutil/avassert.h" #include "libavutil/parseutils.h" +#include "libavutil/internal.h" #include "avformat.h" #include "internal.h" #include "ffm.h" @@ -165,7 +166,9 @@ static int ffm_write_header(AVFormatContext *s) avio_wb16(pb, (int) (codec->qcompress * 1.0)); avio_wb16(pb, (int) (codec->qblur * 1.0)); avio_wb32(pb, codec->bit_rate_tolerance); +FF_DISABLE_DEPRECATION_WARNINGS avio_put_str(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp"); +FF_ENABLE_DEPRECATION_WARNINGS avio_wb32(pb, codec->rc_max_rate); avio_wb32(pb, codec->rc_min_rate); avio_wb32(pb, codec->rc_buffer_size); @@ -182,7 +185,9 @@ static int ffm_write_header(AVFormatContext *s) avio_wb32(pb, codec->mb_decision); avio_wb32(pb, codec->nsse_weight); avio_wb32(pb, codec->frame_skip_cmp); +FF_DISABLE_DEPRECATION_WARNINGS avio_wb64(pb, av_double2int(codec->rc_buffer_aggressivity)); +FF_ENABLE_DEPRECATION_WARNINGS avio_wb32(pb, codec->codec_tag); avio_w8(pb, codec->thread_count); avio_wb32(pb, codec->coder_type); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
TODO: bump micro Many common codec options are not via ffm protocol. This commit adds common A/V encoding options to protocol. Signed-off-by: Lukasz Marek --- libavformat/ffmdec.c | 78 libavformat/ffmenc.c | 60 2 files changed, 138 insertions(+) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index e95c139..8f5338f 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -233,6 +233,12 @@ FF_ENABLE_DEPRECATION_WARNINGS return 0; } +static void ffm_report_old_version(AVFormatContext *s) +{ +av_log(s, AV_LOG_WARNING, + "Old version of feed file detected. Consider deleting feed files.\n"); +} + static int ffm2_read_header(AVFormatContext *s) { FFMContext *ffm = s->priv_data; @@ -294,6 +300,17 @@ static int ffm2_read_header(AVFormatContext *s) if (ff_get_extradata(codec, pb, avio_rb32(pb)) < 0) return AVERROR(ENOMEM); } +if (avio_tell(pb) < next) { +codec->slices = avio_r8(pb); +codec->thread_type = avio_r8(pb); +codec->compression_level = avio_rb32(pb); +codec->global_quality = avio_rb32(pb); +codec->ticks_per_frame = avio_rb32(pb); +codec->trellis = avio_rb32(pb); +codec->profile = avio_rb32(pb); +} +if (avio_tell(pb) < next) +ffm_report_old_version(s); avio_seek(pb, next, SEEK_SET); id = avio_rb32(pb); size = avio_rb32(pb); @@ -348,11 +365,72 @@ FF_ENABLE_DEPRECATION_WARNINGS codec->qblur = av_int2double(avio_rb64(pb)); codec->max_qdiff = avio_rb32(pb); codec->refs = avio_rb32(pb); +if (avio_tell(pb) < next) { +codec->bidir_refine = avio_rb32(pb); +codec->brd_scale = avio_rb32(pb); +codec->b_sensitivity = avio_rb32(pb); +codec->chromaoffset = avio_rb32(pb); +codec->chroma_sample_location = avio_r8(pb); +codec->color_primaries = avio_r8(pb); +codec->color_range = avio_r8(pb); +codec->colorspace = avio_r8(pb); +codec->color_trc = avio_r8(pb); +codec->context_model = avio_rb32(pb); +codec->dia_size = avio_rb32(pb); +codec->field_order = avio_r8(pb); +codec->frame_skip_exp = avio_rb32(pb); +codec->frame_skip_factor = avio_rb32(pb); +codec->frame_skip_threshold = avio_rb32(pb); +codec->idct_algo = avio_rb16(pb); +codec->ildct_cmp = avio_rb16(pb); +codec->inter_quant_bias = avio_rb32(pb); +codec->intra_quant_bias = avio_rb32(pb); +codec->last_predictor_count = avio_rb32(pb); +codec->mb_cmp = avio_rb32(pb); +codec->mb_lmin = avio_rb16(pb); +codec->mb_lmax = avio_rb16(pb); +codec->lumi_masking = av_int2double(avio_rb64(pb)); +codec->dark_masking = av_int2double(avio_rb64(pb)); +codec->me_penalty_compensation = avio_rb32(pb); +codec->me_pre_cmp = avio_rb32(pb); +codec->me_sub_cmp = avio_rb32(pb); +codec->mv0_threshold = avio_rb32(pb); +codec->noise_reduction = avio_rb32(pb); +codec->p_masking = av_int2double(avio_rb32(pb)); +codec->pre_dia_size = avio_rb32(pb); +codec->prediction_method = avio_r8(pb); +codec->pre_me = avio_rb32(pb); +codec->rc_initial_buffer_occupancy = avio_rb32(pb); +codec->rc_max_available_vbv_use = av_int2double(avio_rb32(pb)); +codec->rc_min_vbv_overflow_use = av_int2double(avio_rb32(pb)); +codec->rtp_payload_size = avio_rb32(pb); +codec->sample_aspect_ratio.num = avio_rb32(pb); +codec->sample_aspect_ratio.den = avio_rb32(pb); +codec->spatial_cplx_masking = av_int2double(avio_rb32(pb)); +codec->temporal_cplx_masking = av_int2double(avio_rb32(pb)); +codec->timecode_frame_start = avio_rb64(pb); +} +if (avio_tell(pb) < next) +ffm_report_old_version(s); break; case MKBETAG('S', 'T',
Re: [FFmpeg-devel] FFserver bug?
On 02.11.2014 23:34, Sevan Gelici wrote: I still don't have tested old gits. But i will try to expain. A half year ago i installed ffmpeg and i made a configuration file. When i start this bitrate was going up to 2000kbs max. I updated and now it will go higher like its sum up or something, in some seconds the content bitrate will be 40 mb and still go higher. I also reinstalled the system. Maybe my configuration is old and that causes the problem. Offtopic: regarding config: partitions, directpred (it should be direct-pred), wpredp are x264 options and ffserver doesn't send them to ffmpeg that serves a stream. Any private option for any codec is not supported yet. They have no meaning and now they are treated as errors. (in near future I will add posibility to set them) Also VideoGopSize is as alias for AVOptionVideo g But this doesn't cause the issue anyway. I noticed that commenting out VideoSize 1280x720 reduces bitrate back to 1500kbit/s which is correct. Why setting VideoSize has such strange effect - I dont know. I just checked ffserver and ffm format and there is everything ok with these width and height. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffserver_config: improve AVOption handing
On 02.11.2014 22:37, Reynaldo H. Verdejo Pinochet wrote: If you are always returning 0 then this func should probably be declared static void instead? I left it as int for future, but probably no reason for that, so changed. [..] diff --git a/ffserver_config.h b/ffserver_config.h index f29f07f..c684fb5 100644 --- a/ffserver_config.h +++ b/ffserver_config.h @@ -113,6 +113,7 @@ typedef struct FFServerConfig { AVDictionary *video_conf; /* Values stored in video AVCodecContext.fields */ AVDictionary *audio_opts; /* AVOptions for audio encoder */ AVDictionary *audio_conf; /* Values stored in audio AVCodecContext.fields */ +AVCodecContext *dummy_ctx;/* Used internally to test AVOptions, not to be used anywere else */ s/anywere/anywhere/g nit: . Not to be Changed and pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] ffserver_config: improve error handling
On 2 November 2014 00:02, Reynaldo H. Verdejo Pinochet < reyna...@osg.samsung.com> wrote: > > > On 11/01/2014 07:59 PM, Lukasz Marek wrote: > > [..] > > > > I decreased it by 1 automatically rather than for any reason. I didn't > > want to change logic where it was not needed, and it was not needed > > here. I guess you ask in general if there should be a limit (not just it > > is 65535 or 6). I don't know, but as I stated before, I don't want to > > change the limit, just int parsing routine. If you wish I can change > > back to 65536 or to INT_MAX, but I want it to be clear it is not my > > original intention. :) > > > > Fair enough. We can work on those limits latter on. > > > > > OK, will do that locally. > > > > Thanks. Feel free to push afterward. Pushed ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
On 03.11.2014 00:40, Stefano Sabatini wrote: On date Sunday 2014-11-02 19:19:14 +0100, Lukasz Marek encoded: TODO: bump micro Many common codec options are not via ffm protocol. This commit adds common A/V encoding options to protocol. Signed-off-by: Lukasz Marek --- libavformat/ffmdec.c | 78 libavformat/ffmenc.c | 60 2 files changed, 138 insertions(+) My idea was to let the protocol specify the option using the AVOption interface. This way you don't have to update the protocol every time a new option is added to libavcodec, *AND* you can support private codec options. >> (in near future I will add posibility to set them) > > I'm curious about that, since that was in my (much neglected) todo > list. How do you plan to do that? The only way I see is to fiddle with > FFM. > To not spam other thread with offtopic I moved your question here. I'm not sure yet. In config I wanted to something like that: VideoCodec libx264 #common options: AVOptionVideo flags +global_header #private option AVOptionVideo libx264:crf 23 In ffm my first idea was to serialize it as strings in separate section. I haven't really thought about it yet. Maybe serializing common options would be also good idea. And send only set values. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
On 3 November 2014 01:31, Michael Niedermayer wrote: > On Sun, Nov 02, 2014 at 07:19:14PM +0100, Lukasz Marek wrote: > > > shouldnt all these values be checked to be within the allowed ranges > for the corresponding AVOptions? > > being able to set so many field so arbitrarily could be usefull to > some kind of exploit ... > Yes, it wouldn't hurt to set them via AVOption API which implies validation. OTOH most options doesn't set any reasonable range, just INT_MIN - INT_MAX Remarkable example: {"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, I try to implement sending private options now and we will see how it works. Maybe then I will change sending common options as well using AVOption API. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFserver bug?
On 31.10.2014 03:19, Michael Niedermayer wrote: On Fri, Oct 31, 2014 at 02:14:29AM +0100, Sevan Gelici wrote: Hi, Two days ago i updated my linux system and also ffmpeg was updated. When i started to stream it was not working anymore. I am using ffserver. i determined the problem which causes the problem thats the bitrate it makes like 50mb of it. i reinstalled the system a couple times because of some tests and still i don't get it work. Can someone help me with this pls. do you know which commit / revission has caused the regression ? I wanted to learn git bisect and checked it. Last working rev is f478e8500a3d1fb0c6014956de42d87e292b9e3b The issue is present at next merge commit: 9b7cb02319b65596b5ef106a830fd813248fb580 but it segfaults. It can be fixed by cherry-picking: 24a324855cbdb8d1be3ac2cc5e22d007c38d7c8d Maybe worth to mention I recently created function to dump AvCodecContext, to test if ffm is transmitting context properly. And strange thing I noticed ffm demuxer's read_header callback is called only once, even though there are 2 streams. I haven't investigate it further yet, but it smells like a bug in ffmpeg tool. BTW, during bisecting sometimes I landed in libav's tree (when merged commit was tested) Some one know how to avoid that? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFserver bug?
On 05.11.2014 00:07, Lukasz Marek wrote: Maybe worth to mention I recently created function to dump AvCodecContext, to test if ffm is transmitting context properly. And strange thing I noticed ffm demuxer's read_header callback is called only once, even though there are 2 streams. I guess it is OK, ignore this remark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFserver bug?
On 31.10.2014 02:14, Sevan Gelici wrote: Hi, Two days ago i updated my linux system and also ffmpeg was updated. When i started to stream it was not working anymore. I am using ffserver. i determined the problem which causes the problem thats the bitrate it makes like 50mb of it. i reinstalled the system a couple times because of some tests and still i don't get it work. Can someone help me with this pls. I fixed it on 2.3 release branch. I know this should be done on master first, but I wanted to be close for the commit that introduced the problem. There are some changes in later releases so cherry-pick would not be enough tho, to fix it on previous release Fix patches attached. >From 9c1455bd9e830aedba645451b7c0cb44831658e2 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Wed, 5 Nov 2014 02:10:24 +0100 Subject: [PATCH 1/2] lavc/options: don't free options while they are still in use Signed-off-by: Lukasz Marek --- libavcodec/options.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/options.c b/libavcodec/options.c index 64b27e5..a13f3e3 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -181,8 +181,6 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) return AVERROR(EINVAL); } -av_opt_free(dest); - memcpy(dest, src, sizeof(*dest)); dest->priv_data = orig_priv_data; -- 1.9.1 >From 3425953e04113a37a6b54217bc2254a76405e7f7 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Wed, 5 Nov 2014 01:58:59 +0100 Subject: [PATCH 2/2] ffmpeg_opt: set correct priv_data for feed stream new_output_stream creates a codec context with arbitraty picked codec. Later data is updated, but priv_data are left alone. There is a bit chance there is a mismatch between codecs. Signed-off-by: Lukasz Marek --- ffmpeg_opt.c | 4 1 file changed, 4 insertions(+) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index a825062..97056e8 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1636,6 +1636,10 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch memcpy(st->info, ic->streams[i]->info, sizeof(*st->info)); st->codec= avctx; avcodec_copy_context(st->codec, ic->streams[i]->codec); +av_opt_free(st->codec); +av_free(st->codec->priv_data); +st->codec->priv_data = ic->streams[i]->codec->priv_data; +ic->streams[i]->codec->priv_data = NULL; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy) choose_sample_fmt(st, codec); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFserver bug?
W dniu środa, 5 listopada 2014 Michael Niedermayer napisał(a): > On Wed, Nov 05, 2014 at 12:07:14AM +0100, Lukasz Marek wrote: > > On 31.10.2014 03:19, Michael Niedermayer wrote: > > >On Fri, Oct 31, 2014 at 02:14:29AM +0100, Sevan Gelici wrote: > > >>Hi, > > >> > > >>Two days ago i updated my linux system and also ffmpeg was updated. > When i > > >>started to stream it was not working anymore. I am using ffserver. i > > >>determined the problem which causes the problem thats the bitrate it > makes > > >>like 50mb of it. i reinstalled the system a couple times because of > some > > >>tests and still i don't get it work. Can someone help me with this pls. > > > > > >do you know which commit / revission has caused the regression ? > > > > I wanted to learn git bisect and checked it. > > > > Last working rev is f478e8500a3d1fb0c6014956de42d87e292b9e3b > > > > The issue is present at next merge commit: > > 9b7cb02319b65596b5ef106a830fd813248fb580 > > > but it segfaults. It can be fixed by cherry-picking: > > 24a324855cbdb8d1be3ac2cc5e22d007c38d7c8d > > git show 24a324855cbdb8d1be3ac2cc5e22d007c38d7c8d > fatal: bad object 24a324855cbdb8d1be3ac2cc5e22d007c38d7c8d > I probably copied from picked. this should be the correct one. e0d074556055e8d2ed706be100e26d7bb6864d6e > > > > Maybe worth to mention I recently created function to dump > > AvCodecContext, to test if ffm is transmitting context properly. And > > strange thing I noticed ffm demuxer's read_header callback is called > > only once, even though there are 2 streams. I haven't investigate it > > further yet, but it smells like a bug in ffmpeg tool. > > > > > BTW, during bisecting sometimes I landed in libav's tree (when > > merged commit was tested) Some one know how to avoid that? > > see tools/bisect-create > OK, thx ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] [RFC]lavf/ffm: update with more options.
On 5 November 2014 12:25, Stefano Sabatini wrote: > On date Monday 2014-11-03 00:54:01 +0100, Lukasz Marek encoded: > > On 03.11.2014 00:40, Stefano Sabatini wrote: > > >On date Sunday 2014-11-02 19:19:14 +0100, Lukasz Marek encoded: > > >>TODO: bump micro > > >> > > >>Many common codec options are not via ffm protocol. > > >>This commit adds common A/V encoding options to protocol. > > >> > > >>Signed-off-by: Lukasz Marek > > >>--- > > >> libavformat/ffmdec.c | 78 > > > >> libavformat/ffmenc.c | 60 > > >> 2 files changed, 138 insertions(+) > > > > > >My idea was to let the protocol specify the option using the AVOption > > >interface. This way you don't have to update the protocol every time a > > >new option is added to libavcodec, *AND* you can support private codec > > >options. > > > > >> (in near future I will add posibility to set them) > > > > > > I'm curious about that, since that was in my (much neglected) todo > > > list. How do you plan to do that? The only way I see is to fiddle with > > > FFM. > > > > > > > To not spam other thread with offtopic I moved your question here. > > > > I'm not sure yet. In config I wanted to something like that: > > > > VideoCodec libx264 > > #common options: > > AVOptionVideo flags +global_header > > #private option > > > AVOptionVideo libx264:crf 23 > > Why do you think the prefix with the name of the codec is needed? > > > In ffm my first idea was to serialize it as strings in separate section. > > I haven't really thought about it yet. Maybe serializing common > > options would be also good idea. And send only set values. > > My idea was to generalize the format and serialize the option > key/values. We have the same or similar idea. I am about half way to implement that for private options. I just dont know if send values as strings or in binary form where possible. I think sending both key and val as string is to most generic so probably will do it this way first. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffmpeg_opt: set correct priv_data for feed stream
new_output_stream creates a codec context with arbitraty picked codec. Later data is updated, but priv_data are left alone. There is a bit chance there is a mismatch between codecs. Signed-off-by: Lukasz Marek --- ffmpeg_opt.c | 16 libavformat/ffmdec.c | 6 -- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 1757dcc..b495b87 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1643,12 +1643,28 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch memcpy(st->info, ic->streams[i]->info, sizeof(*st->info)); st->codec= avctx; avcodec_copy_context(st->codec, ic->streams[i]->codec); +if (st->codec->priv_data) { +av_opt_free(st->codec->priv_data); +av_free(st->codec->priv_data); +} +st->codec->priv_data = ic->streams[i]->codec->priv_data; +ic->streams[i]->codec->priv_data = NULL; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy) choose_sample_fmt(st, codec); else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) choose_pixel_fmt(st, st->codec, codec, st->codec->pix_fmt); avcodec_copy_context(ost->enc_ctx, st->codec); +if (ost->enc_ctx->priv_data) { +av_opt_free(ost->enc_ctx->priv_data); +av_free(ost->enc_ctx->priv_data); +} +ost->enc_ctx->priv_data = av_mallocz(codec->priv_data_size); +if (ost->enc_ctx->priv_data) { +*(const AVClass**)ost->enc_ctx->priv_data = codec->priv_class; +av_opt_copy(ost->enc_ctx->priv_data, st->codec->priv_data); +} else +err = AVERROR(ENOMEM); } avformat_close_input(&ic); diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 448762b..3119720 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -237,6 +237,7 @@ static int ffm2_read_header(AVFormatContext *s) AVIOContext *pb = s->pb; AVCodecContext *codec; int ret; +enum AVCodecID codec_id; ffm->packet_size = avio_rb32(pb); if (ffm->packet_size != FFM_PACKET_SIZE) { @@ -271,7 +272,8 @@ static int ffm2_read_header(AVFormatContext *s) avio_rb32(pb); /* total bitrate */ break; case MKBETAG('C', 'O', 'M', 'M'): -st = avformat_new_stream(s, NULL); +codec_id = avio_rb32(pb); +st = avformat_new_stream(s, avcodec_find_encoder(codec_id)); if (!st) { ret = AVERROR(ENOMEM); goto fail; @@ -281,7 +283,7 @@ static int ffm2_read_header(AVFormatContext *s) codec = st->codec; /* generic info */ -codec->codec_id = avio_rb32(pb); +codec->codec_id = codec_id; codec->codec_type = avio_r8(pb); codec->bit_rate = avio_rb32(pb); codec->flags = avio_rb32(pb); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFserver bug?
On 05.11.2014 02:15, Lukasz Marek wrote: On 31.10.2014 02:14, Sevan Gelici wrote: Hi, Two days ago i updated my linux system and also ffmpeg was updated. When i started to stream it was not working anymore. I am using ffserver. i determined the problem which causes the problem thats the bitrate it makes like 50mb of it. i reinstalled the system a couple times because of some tests and still i don't get it work. Can someone help me with this pls. I fixed it on 2.3 release branch. I know this should be done on master first, but I wanted to be close for the commit that introduced the problem. There are some changes in later releases so cherry-pick would not be enough tho, to fix it on previous release Fix patches attached. I see I was very tired yesterday :) I sent updated patch for master branch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: set correct priv_data for feed stream
On 06.11.2014 01:32, Michael Niedermayer wrote: On Thu, Nov 06, 2014 at 12:59:45AM +0100, Lukasz Marek wrote: new_output_stream creates a codec context with arbitraty picked codec. Later data is updated, but priv_data are left alone. There is a bit chance there is a mismatch between codecs. Signed-off-by: Lukasz Marek --- ffmpeg_opt.c | 16 libavformat/ffmdec.c | 6 -- 2 files changed, 20 insertions(+), 2 deletions(-) with this fate-lavf-ffm crashes ==10836== Invalid write of size 8 ==10836==at 0x935442: decode_init (mpegaudiodec_template.c:419) ==10836==by 0xA69226: avcodec_open2 (utils.c:1614) ==10836==by 0x64CC5F: avformat_find_stream_info (utils.c:3053) ==10836==by 0x41C2D7: open_input_file (ffmpeg_opt.c:886) ==10836==by 0x42427A: open_files (ffmpeg_opt.c:2699) ==10836==by 0x4243F8: ffmpeg_parse_options (ffmpeg_opt.c:2736) ==10836==by 0x43762E: main (ffmpeg.c:3861) ==10836== Address 0x10f072b0 is not stack'd, malloc'd or (recently) free'd ==10836== ==10836== Invalid write of size 8 ==10836==at 0xDC67D0: avpriv_float_dsp_init (float_dsp.c:120) ==10836==by 0x93546B: decode_init (mpegaudiodec_template.c:421) ==10836==by 0xA69226: avcodec_open2 (utils.c:1614) ==10836==by 0x64CC5F: avformat_find_stream_info (utils.c:3053) ==10836==by 0x41C2D7: open_input_file (ffmpeg_opt.c:886) ==10836==by 0x42427A: open_files (ffmpeg_opt.c:2699) ==10836==by 0x4243F8: ffmpeg_parse_options (ffmpeg_opt.c:2736) ==10836==by 0x43762E: main (ffmpeg.c:3861) ==10836== Address 0x10f072e8 is not stack'd, malloc'd or (recently) free'd and pages more I tried to debug it, but there is too much code to read to handle one very specific case and I'm not sure there is other, better solution. Probably, I haven't check, clear solution would be to clear priv_data in read_ffserver_streams right after copy_context, and set it to NULL, but I will need private data soon to support it in ffserver. Solution is ugly, but I think I will not propose anything better. >From abb6a1fb9c1da226b6bfe179ded076365b969cad Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Thu, 6 Nov 2014 00:55:10 +0100 Subject: [PATCH] ffmpeg_opt: set correct priv_data for feed stream new_output_stream creates a codec context with arbitraty picked codec. Later data is updated, but priv_data are left alone. There is a bit chance there is a mismatch between codecs. Signed-off-by: Lukasz Marek --- ffmpeg_opt.c | 20 +++- libavformat/ffm.h| 3 +++ libavformat/ffmdec.c | 28 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 1757dcc..d020c13 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1614,9 +1614,11 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch { int i, err; AVFormatContext *ic = avformat_alloc_context(); +AVDictionary *opts = NULL; ic->interrupt_callback = int_cb; -err = avformat_open_input(&ic, filename, NULL, NULL); +av_dict_set_int(&opts, "need_stream", 1500100900, 0); +err = avformat_open_input(&ic, filename, NULL, &opts); if (err < 0) return err; /* copy stream format */ @@ -1643,12 +1645,28 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch memcpy(st->info, ic->streams[i]->info, sizeof(*st->info)); st->codec= avctx; avcodec_copy_context(st->codec, ic->streams[i]->codec); +if (st->codec->priv_data) { +av_opt_free(st->codec->priv_data); +av_free(st->codec->priv_data); +} +st->codec->priv_data = ic->streams[i]->codec->priv_data; +ic->streams[i]->codec->priv_data = NULL; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy) choose_sample_fmt(st, codec); else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) choose_pixel_fmt(st, st->codec, codec, st->codec->pix_fmt); avcodec_copy_context(ost->enc_ctx, st->codec); +if (ost->enc_ctx->priv_data) { +av_opt_free(ost->enc_ctx->priv_data); +av_free(ost->enc_ctx->priv_data); +} +ost->enc_ctx->priv_data = av_mallocz(codec->priv_data_size); +if (ost->enc_ctx->priv_data) { +*(const AVClass**)ost->enc_ctx->priv_data = codec->priv_class; +av_opt_copy(ost->enc_ctx->priv_data, st->codec->priv_data); +} else +err = AVERROR(ENOMEM); } avformat_close_input(&ic); diff --git a/libavformat/ffm.h b/libavformat/ffm.h index b392b8d..0ab92f1 100644 --- a/libavformat/ffm.h +++ b/libavfo
Re: [FFmpeg-devel] [PATCH] ffmpeg_opt: set correct priv_data for feed stream
On 6 November 2014 22:55, Michael Niedermayer wrote: > On Thu, Nov 06, 2014 at 09:27:45PM +0100, Lukasz Marek wrote: > > On 06.11.2014 01:32, Michael Niedermayer wrote: > > >On Thu, Nov 06, 2014 at 12:59:45AM +0100, Lukasz Marek wrote: > > >>new_output_stream creates a codec context with arbitraty picked codec. > > >>Later data is updated, but priv_data are left alone. > > >>There is a bit chance there is a mismatch between codecs. > > >> > > >>Signed-off-by: Lukasz Marek > > >>--- > > >> ffmpeg_opt.c | 16 > > >> libavformat/ffmdec.c | 6 -- > > >> 2 files changed, 20 insertions(+), 2 deletions(-) > > > > > >with this fate-lavf-ffm crashes > > > > > >==10836== Invalid write of size 8 > > >==10836==at 0x935442: decode_init (mpegaudiodec_template.c:419) > > >==10836==by 0xA69226: avcodec_open2 (utils.c:1614) > > >==10836==by 0x64CC5F: avformat_find_stream_info (utils.c:3053) > > >==10836==by 0x41C2D7: open_input_file (ffmpeg_opt.c:886) > > >==10836==by 0x42427A: open_files (ffmpeg_opt.c:2699) > > >==10836==by 0x4243F8: ffmpeg_parse_options (ffmpeg_opt.c:2736) > > >==10836==by 0x43762E: main (ffmpeg.c:3861) > > >==10836== Address 0x10f072b0 is not stack'd, malloc'd or (recently) > free'd > > >==10836== > > >==10836== Invalid write of size 8 > > >==10836==at 0xDC67D0: avpriv_float_dsp_init (float_dsp.c:120) > > >==10836==by 0x93546B: decode_init (mpegaudiodec_template.c:421) > > >==10836==by 0xA69226: avcodec_open2 (utils.c:1614) > > >==10836==by 0x64CC5F: avformat_find_stream_info (utils.c:3053) > > >==10836==by 0x41C2D7: open_input_file (ffmpeg_opt.c:886) > > >==10836==by 0x42427A: open_files (ffmpeg_opt.c:2699) > > >==10836==by 0x4243F8: ffmpeg_parse_options (ffmpeg_opt.c:2736) > > >==10836==by 0x43762E: main (ffmpeg.c:3861) > > >==10836== Address 0x10f072e8 is not stack'd, malloc'd or (recently) > free'd > > >and pages more > > > > I tried to debug it, but there is too much code to read to handle > > one very specific case and I'm not sure there is other, better > > solution. > > > Probably, I haven't check, clear solution would be to clear > > priv_data in read_ffserver_streams right after copy_context, and set > > it to NULL, but I will need private data soon to support it in > > ffserver. > > Maybe iam missing something but why does the ffm demuxer attempt to > setup a encoder instead of exporting the "recommanded" encoder > settings as name-value pairs (possibly in metadata) and ffmpeg then > sets up the encoder streams based on that instead of copying > contexts > Probably you are not mistaken. After sending I had second thoughts, probably it would be better to do one of the followings: - add option to muxer instead to control context should be read/write from file (now is always written) - export parsing function that is major part of read_header so ffmpeg can pass its own context and params will be read. This has disadvantage that ffmpeg would need ffm's private header. Already present in ffserver though. - your solution > Trying to set the encoder contexts up in a demuxer (which normally > would interface to decoders not encoders) seems odd to me > Though of course this is how it was designed before the patch already > Yes, but maybe its time to clean hack and not to add new one. In new patch I just clear possibly incorrect priv_data. I will come back to during the weekend when I want to finish private options handling in ffserver From 9d3188dd3fadfad47ef4cbe2073604d4cd7ebdc2 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Fri, 7 Nov 2014 09:05:41 +0100 Subject: [PATCH] ffmpeg_opt: free incorrect priv_data for feed stream new_output_stream creates a codec context with arbitraty picked codec. Later data is updated, but priv_data are left alone. There is a bit chance there is a mismatch between codecs. Signed-off-by: Lukasz Marek --- ffmpeg_opt.c | 4 1 file changed, 4 insertions(+) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 1757dcc..454da98 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1649,6 +1649,10 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) choose_pixel_fmt(st, st->codec, codec, st->codec->pix_fmt); avcodec_copy_context(ost->enc_ctx, st->codec); +if (ost->enc_ctx->priv_data) { +av_opt_free(ost->enc_ctx->priv_data); +av_freep(&ost->enc_ctx->priv_data); +} } avformat_close_input(&ic); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] lavu/opt: document av_opt_copy function
--- libavutil/opt.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavutil/opt.h b/libavutil/opt.h index b9ac932..b78810c 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -815,6 +815,16 @@ void av_opt_freep_ranges(AVOptionRanges **ranges); */ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags); +/** + * Copy options from src object into dest object. + * + * Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object. + * Original memory is freed unless both src and dest options points to the same memory. + * + * @param dest Object to copy from + * @param src Object to copy into + * @return 0 on success, negative on error + */ int av_opt_copy(void *dest, void *src); /** -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] lavu/opt: copy dict in av_opt_copy
Signed-off-by: Lukasz Marek --- libavutil/opt.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/libavutil/opt.c b/libavutil/opt.c index 0692393..86d3ddf 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1596,6 +1596,13 @@ int av_opt_copy(void *dst, void *src) *(int*)(field_dst8 + 1) = len; } else if (o->type == AV_OPT_TYPE_CONST) { // do nothing +} else if (o->type == AV_OPT_TYPE_DICT) { +if (*field_dst8 != *field_src8) +av_dict_free(field_dst8); +*field_dst8 = NULL; +av_dict_copy(field_dst8, *field_src8, 0); +if (av_dict_count(*field_src8) != av_dict_count(*field_dst8)) +ret = AVERROR(ENOMEM); } else { memcpy(field_dst, field_src, opt_size(o->type)); } -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] lavu/opt: explicity set NULL as dict/binary defaults
Unless user clears context manually during creation, binary and dict pointer may contain random values. Signed-off-by: Lukasz Marek --- libavutil/opt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/opt.c b/libavutil/opt.c index 4116f96..0692393 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1224,6 +1224,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags) case AV_OPT_TYPE_BINARY: case AV_OPT_TYPE_DICT: /* Cannot set defaults for these types */ +*(void **)dst = NULL; break; default: av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] ffserver_config: drop requirement video size being multiple of 16
On 1 November 2014 22:20, Reynaldo H. Verdejo Pinochet < reyna...@osg.samsung.com> wrote: > Hi > > On 10/31/2014 11:00 PM, Lukasz Marek wrote: > > [..] > > diff --git a/ffserver_config.c b/ffserver_config.c > > index d589ff2..f11db03 100644 > > --- a/ffserver_config.c > > +++ b/ffserver_config.c > > @@ -819,8 +819,6 @@ static int > ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, > > ret = av_parse_video_size(&w, &h, arg); > > if (ret < 0) > > ERROR("Invalid video size '%s'\n", arg); > > -else if ((w % 16) || (h % 16)) > > -ERROR("Image size must be a multiple of 16\n"); > > [..] > > OK if always safe. Otherwise demote to WARNING() > > Feel free to push otherwise. > Can some one confirm it is safe to not demand width and height to be multiply of 16? Is there any other constraint? like %2? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffserver_config: report not closed last tag
Signed-off-by: Lukasz Marek --- ffserver_config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ffserver_config.c b/ffserver_config.c index c05c942..2ca484f 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -1303,6 +1303,8 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) ffserver_parse_config_global(config, cmd, &p, line_num); } } +if (stream || feed || redirect) +ERROR("Not closed tag %s\n", stream ? "" : (feed ? "" : "")); fclose(f); if (ret < 0) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavu/opt: explicity set NULL as dict/binary defaults
On 08.11.2014 19:18, Michael Niedermayer wrote: On Sat, Nov 08, 2014 at 06:13:52PM +0100, Lukasz Marek wrote: Unless user clears context manually during creation, binary and dict pointer may contain random values. wouldnt the string type in that case free random pointers ? Strings are set to their defaults. and wouldnt it be inconsistent not to free dict/binary ? Yes, it is inconsistent, so patch dropped. BTW, As for as I know binary option may be set from command line, but cannot have default. I will add it unless forget. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel