aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice/fbdev_enc.c
diff options
context:
space:
mode:
authorLukasz Marek <lukasz.m.luki@gmail.com>2013-11-07 19:06:38 +0100
committerLukasz Marek <lukasz.m.luki@gmail.com>2013-12-06 19:15:47 +0100
commitfa3bfeb1c152c03cd98430992dd670d59007b051 (patch)
treef701aa180b9af2f128b252dc6b43366d379484fb /libavdevice/fbdev_enc.c
parent90539cea336fd513c47295a03c164cb4a851166f (diff)
downloadffmpeg-fa3bfeb1c152c03cd98430992dd670d59007b051.tar.gz
lavd/fbdev_enc: add default device
Use device specified by environment variable FRAMEBUFFER or /dev/fb0 as default. Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Diffstat (limited to 'libavdevice/fbdev_enc.c')
-rw-r--r--libavdevice/fbdev_enc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavdevice/fbdev_enc.c b/libavdevice/fbdev_enc.c
index 098eedb5f5..8291b59759 100644
--- a/libavdevice/fbdev_enc.c
+++ b/libavdevice/fbdev_enc.c
@@ -45,17 +45,23 @@ static av_cold int fbdev_write_header(AVFormatContext *h)
FBDevContext *fbdev = h->priv_data;
enum AVPixelFormat pix_fmt;
int ret, flags = O_RDWR;
+ const char* device;
if (h->nb_streams != 1 || h->streams[0]->codec->codec_type != AVMEDIA_TYPE_VIDEO) {
av_log(fbdev, AV_LOG_ERROR, "Only a single video stream is supported.\n");
return AVERROR(EINVAL);
}
- if ((fbdev->fd = avpriv_open(h->filename, flags)) == -1) {
+ if (h->filename[0])
+ device = h->filename;
+ else
+ device = ff_fbdev_default_device();
+
+ if ((fbdev->fd = avpriv_open(device, flags)) == -1) {
ret = AVERROR(errno);
av_log(h, AV_LOG_ERROR,
"Could not open framebuffer device '%s': %s\n",
- h->filename, av_err2str(ret));
+ device, av_err2str(ret));
return ret;
}