Message ID | 1473928746-65955-2-git-send-email-josh@itanimul.li |
---|---|
State | Superseded |
Headers | show |
2016-09-15 10:39 GMT+02:00 Josh de Kock <josh@itanimul.li>: > Signed-off-by: Josh de Kock <josh@itanimul.li> > --- > Makefile | 1 + > ffplay.c | 5 +++++ > ffplay.c => ffplay_sdl1.c | 0 > 3 files changed, 6 insertions(+) > copy ffplay.c => ffplay_sdl1.c (100%) > diff --git a/ffplay.c b/ffplay.c > index adbe9cb..67a17e0 100644 > --- a/ffplay.c > +++ b/ffplay.c > @@ -24,6 +24,9 @@ > */ > > #include "config.h" > + > +#if HAVE_SDL2 Sorry if this should be obvious: What is the effect of this #if? Carl Eugen
On 15/09/2016 10:58, Carl Eugen Hoyos wrote: > 2016-09-15 10:39 GMT+02:00 Josh de Kock <josh@itanimul.li>: >> Signed-off-by: Josh de Kock <josh@itanimul.li> >> --- >> Makefile | 1 + >> ffplay.c | 5 +++++ >> ffplay.c => ffplay_sdl1.c | 0 >> 3 files changed, 6 insertions(+) >> copy ffplay.c => ffplay_sdl1.c (100%) > >> diff --git a/ffplay.c b/ffplay.c >> index adbe9cb..67a17e0 100644 >> --- a/ffplay.c >> +++ b/ffplay.c >> @@ -24,6 +24,9 @@ >> */ >> >> #include "config.h" >> + >> +#if HAVE_SDL2 > > Sorry if this should be obvious: > What is the effect of this #if? > Don't worry, it's not really that obvious. If HAVE_SDL2 is false but HAVE_SDL is true, then ffplay.c will get macro'd out, and ffplay_sdl1.c will get added to the ffplay sources (see the Makefile change). If you can think of a better way to do it, feel free to suggest. -- Josh
2016-09-15 12:19 GMT+02:00 Josh de Kock <josh@itanimul.li>: > On 15/09/2016 10:58, Carl Eugen Hoyos wrote: >> >> 2016-09-15 10:39 GMT+02:00 Josh de Kock <josh@itanimul.li>: >>> #include "config.h" >>> + >>> +#if HAVE_SDL2 >> >> >> Sorry if this should be obvious: >> What is the effect of this #if? >> > Don't worry, it's not really that obvious. If HAVE_SDL2 is false but > HAVE_SDL is true, then ffplay.c will get macro'd out, and ffplay_sdl1.c will > get added to the ffplay sources (see the Makefile change). If you can think > of a better way to do it, feel free to suggest. Thank you for explaining! Am I correct that with this patch only, sdl2 compilation of ffplay fails? Carl Eugen
On 9/15/2016 7:23 AM, Carl Eugen Hoyos wrote: > 2016-09-15 12:19 GMT+02:00 Josh de Kock <josh@itanimul.li>: >> On 15/09/2016 10:58, Carl Eugen Hoyos wrote: >>> >>> 2016-09-15 10:39 GMT+02:00 Josh de Kock <josh@itanimul.li>: > >>>> #include "config.h" >>>> + >>>> +#if HAVE_SDL2 >>> >>> >>> Sorry if this should be obvious: >>> What is the effect of this #if? >>> >> Don't worry, it's not really that obvious. If HAVE_SDL2 is false but >> HAVE_SDL is true, then ffplay.c will get macro'd out, and ffplay_sdl1.c will >> get added to the ffplay sources (see the Makefile change). If you can think >> of a better way to do it, feel free to suggest. > > Thank you for explaining! > > Am I correct that with this patch only, sdl2 compilation of ffplay fails? Technically speaking, with this patch only there's no ffplay SDL2 just yet. It's still SDL1, but you're right that compilation would probably fail since it's SDL1 code in a configure setting where SDL2 was selected (even if SDL1 headers were available and the object sucessfully built, gcc would not link with SDL1 libraries). I guess the sanest thing to do would be to squash patches two and three. > > Carl Eugen > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >
On 9/15/2016 11:54 AM, James Almer wrote: > On 9/15/2016 7:23 AM, Carl Eugen Hoyos wrote: >> 2016-09-15 12:19 GMT+02:00 Josh de Kock <josh@itanimul.li>: >>> On 15/09/2016 10:58, Carl Eugen Hoyos wrote: >>>> >>>> 2016-09-15 10:39 GMT+02:00 Josh de Kock <josh@itanimul.li>: >> >>>>> #include "config.h" >>>>> + >>>>> +#if HAVE_SDL2 >>>> >>>> >>>> Sorry if this should be obvious: >>>> What is the effect of this #if? >>>> >>> Don't worry, it's not really that obvious. If HAVE_SDL2 is false but >>> HAVE_SDL is true, then ffplay.c will get macro'd out, and ffplay_sdl1.c will >>> get added to the ffplay sources (see the Makefile change). If you can think >>> of a better way to do it, feel free to suggest. >> >> Thank you for explaining! >> >> Am I correct that with this patch only, sdl2 compilation of ffplay fails? > > Technically speaking, with this patch only there's no ffplay SDL2 > just yet. It's still SDL1, but you're right that compilation would > probably fail since it's SDL1 code in a configure setting where > SDL2 was selected (even if SDL1 headers were available and the > object sucessfully built, gcc would not link with SDL1 libraries). > > I guess the sanest thing to do would be to squash patches two and > three. Nevermind, disregard this. ffplay still depends on SDL1 at this point, so configure with SDL2 would not even try to build it until next patch. > >> >> Carl Eugen >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >
diff --git a/Makefile b/Makefile index 8aa72fd..15ba3df 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF)) $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o)) $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_opencl.o)) +OBJS-ffplay-$(HAVE_SDL) += ffplay_sdl1.o OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o OBJS-ffmpeg-$(CONFIG_LIBMFX) += ffmpeg_qsv.o diff --git a/ffplay.c b/ffplay.c index adbe9cb..67a17e0 100644 --- a/ffplay.c +++ b/ffplay.c @@ -24,6 +24,9 @@ */ #include "config.h" + +#if HAVE_SDL2 + #include <inttypes.h> #include <math.h> #include <limits.h> @@ -3863,3 +3866,5 @@ int main(int argc, char **argv) return 0; } + +#endif
Signed-off-by: Josh de Kock <josh@itanimul.li> --- Makefile | 1 + ffplay.c | 5 +++++ ffplay.c => ffplay_sdl1.c | 0 3 files changed, 6 insertions(+) copy ffplay.c => ffplay_sdl1.c (100%) diff --git a/ffplay.c b/ffplay_sdl1.c similarity index 100% copy from ffplay.c copy to ffplay_sdl1.c