summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-09-26 17:09:52 -0400
committerMarton Balint <cus@passwd.hu>2015-09-27 01:38:46 +0200
commit23acb982a3c79e993ed45bffde4b1cfc574402df (patch)
treec832724c04531c2d3463bffe1108e888d29af824
parent08a7510fcad552bfcda644e4ba047605de15fab5 (diff)
downloadffmpeg-streaming-23acb982a3c79e993ed45bffde4b1cfc574402df.zip
ffmpeg-streaming-23acb982a3c79e993ed45bffde4b1cfc574402df.tar.gz
ffplay: dynamically allocate filename buffer
filename was set to an arbitrary 1024 characters. ffplay would thus be unable to play files whose name exceeds that arbitrary threshold. This patch dynamically allocates and frees the filename buffer to remove such limitations. Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--ffplay.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ffplay.c b/ffplay.c
index 9b5ee84..2bb5d26 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -285,7 +285,7 @@ typedef struct VideoState {
SDL_Rect last_display_rect;
int eof;
- char filename[1024];
+ char *filename;
int width, height, xleft, ytop;
int step;
@@ -1132,6 +1132,7 @@ static void stream_close(VideoState *is)
sws_freeContext(is->img_convert_ctx);
#endif
sws_freeContext(is->sub_convert_ctx);
+ av_free(is->filename);
av_free(is);
}
@@ -3099,7 +3100,9 @@ static VideoState *stream_open(const char *filename, AVInputFormat *iformat)
is = av_mallocz(sizeof(VideoState));
if (!is)
return NULL;
- av_strlcpy(is->filename, filename, sizeof(is->filename));
+ is->filename = av_strdup(filename);
+ if (!is->filename)
+ goto fail;
is->iformat = iformat;
is->ytop = 0;
is->xleft = 0;
OpenPOWER on IntegriCloud