summaryrefslogtreecommitdiff
path: root/libavdevice/bktr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-04 06:31:35 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-04 06:35:17 +0200
commit87f40364d1a22aff5c9c245fa4ad07275c954248 (patch)
tree4aec0853f83ac15ce8f299631505c145f48fe71e /libavdevice/bktr.c
parente4e2db9c74a10b2342297489edc00e99b10d5eb3 (diff)
parentdc6632f1195c929a87ddf1b02d12b681c6de79ad (diff)
downloadffmpeg-87f40364d1a22aff5c9c245fa4ad07275c954248.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (21 commits) build: simplify commands for clean target swscale: split swscale.c in unscaled and generic conversion routines. swscale: cosmetics. swscale: integrate (literally) swscale_template.c in swscale.c. swscale: split out x86/swscale_template.c from swscale.c. swscale: enable hScale_altivec_real. swscale: split out ppc _template.c files from main swscale.c. swscale: remove indirections in ppc/swscale_template.c. swscale: split out unscaled altivec YUV converters in their own file. mpegvideoenc: fix multislice fate tests with threading disabled. mpegts: Wrap #ifdef DEBUG and av_hex_dump_log() combination in a macro. build: Simplify texi2html invocation through the --output option. Mark some variables with av_unused Replace avcodec_get_pix_fmt_name() by av_get_pix_fmt_name(). svq3: Check negative mb_type to fix potential crash. svq3: Move svq3-specific fields to their own context. rawdec: initialize return value to 0. Remove unused get_psnr() prototype rawdec: don't leak option strings. bktr: get default framerate from video standard. ... Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/bktr.c')
-rw-r--r--libavdevice/bktr.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index dd2a2c1e7c..a8ca7ecfb7 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -256,10 +256,32 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto out;
}
+#if FF_API_FORMAT_PARAMETERS
+ if (ap->standard) {
+ if (!strcasecmp(ap->standard, "pal"))
+ s->standard = PAL;
+ else if (!strcasecmp(ap->standard, "secam"))
+ s->standard = SECAM;
+ else if (!strcasecmp(ap->standard, "ntsc"))
+ s->standard = NTSC;
+ }
+#endif
+
if ((ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
av_log(s1, AV_LOG_ERROR, "Couldn't parse video size.\n");
goto out;
}
+
+ if (!s->framerate)
+ switch (s->standard) {
+ case PAL: s->framerate = av_strdup("pal"); break;
+ case NTSC: s->framerate = av_strdup("ntsc"); break;
+ case SECAM: s->framerate = av_strdup("25"); break;
+ default:
+ av_log(s1, AV_LOG_ERROR, "Unknown standard.\n");
+ ret = AVERROR(EINVAL);
+ goto out;
+ }
if ((ret = av_parse_video_rate(&fps, s->framerate)) < 0) {
av_log(s1, AV_LOG_ERROR, "Couldn't parse framerate.\n");
goto out;
@@ -292,16 +314,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->time_base.den = fps.num;
st->codec->time_base.num = fps.den;
-#if FF_API_FORMAT_PARAMETERS
- if (ap->standard) {
- if (!strcasecmp(ap->standard, "pal"))
- s->standard = PAL;
- else if (!strcasecmp(ap->standard, "secam"))
- s->standard = SECAM;
- else if (!strcasecmp(ap->standard, "ntsc"))
- s->standard = NTSC;
- }
-#endif
if (bktr_init(s1->filename, width, height, s->standard,
&(s->video_fd), &(s->tuner_fd), -1, 0.0) < 0) {
@@ -347,7 +359,7 @@ static const AVOption options[] = {
{ "PALM", "", 0, FF_OPT_TYPE_CONST, {.dbl = PALM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
{ "NTSCJ", "", 0, FF_OPT_TYPE_CONST, {.dbl = NTSCJ}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC },
- { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC },
+ { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ NULL },
};