~ubuntu-dev/mplayer/ubuntu-feisty

« back to all changes in this revision

Viewing changes to libmpdemux/tv.c

  • Committer: Reinhard Tartler
  • Date: 2006-07-08 08:47:54 UTC
  • Revision ID: siretart@tauware.de-20060708084754-c3ff228cc9c2d8de
upgrade to pre8

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
int tv_param_width = -1;
54
54
int tv_param_height = -1;
55
55
int tv_param_input = 0; /* used in v4l and bttv */
56
 
int tv_param_outfmt = IMGFMT_YV12;
 
56
int tv_param_outfmt = -1;
57
57
float tv_param_fps = -1.0;
58
58
char **tv_param_channels = NULL;
59
59
int tv_param_audio_id = 0;
165
165
{
166
166
    int i;
167
167
    tvi_functions_t *funcs = tvh->functions;
 
168
    int tv_fmt_list[] = {
 
169
      IMGFMT_YV12,
 
170
      IMGFMT_I420,
 
171
      IMGFMT_UYVY,
 
172
      IMGFMT_YUY2,
 
173
      IMGFMT_RGB32,
 
174
      IMGFMT_RGB24,
 
175
      IMGFMT_RGB16,
 
176
      IMGFMT_RGB15
 
177
    };
168
178
 
169
179
    if (funcs->control(tvh->priv, TVI_CONTROL_IS_VIDEO, 0) != TVI_CONTROL_TRUE)
170
180
    {
172
182
        return 0;
173
183
    }
174
184
 
 
185
    if (tv_param_outfmt == -1)
 
186
      for (i = 0; i < sizeof (tv_fmt_list) / sizeof (*tv_fmt_list); i++)
 
187
        {
 
188
          tv_param_outfmt = tv_fmt_list[i];
 
189
          if (funcs->control (tvh->priv, TVI_CONTROL_VID_SET_FORMAT,
 
190
                              &tv_param_outfmt) == TVI_CONTROL_TRUE)
 
191
            break;
 
192
        }
 
193
    else
 
194
    {
175
195
    switch(tv_param_outfmt)
176
196
    {
177
197
        case IMGFMT_YV12:
194
214
            mp_msg(MSGT_TV, MSGL_ERR, "==================================================================\n");
195
215
    }
196
216
    funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &tv_param_outfmt);
 
217
    }
197
218
 
198
219
    /* set some params got from cmdline */
199
220
    funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input);
203
224
        mp_msg(MSGT_TV, MSGL_V, "Selected norm id: %d\n", tv_param_normid);
204
225
        if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tv_param_normid) != TVI_CONTROL_TRUE) {
205
226
            mp_msg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n");
206
 
            return 0;
207
227
        }
208
228
    } else {
209
229
#endif
213
233
    mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm);
214
234
    if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
215
235
        mp_msg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n");
216
 
        return 0;
217
236
    }
218
237
#ifdef HAVE_TV_V4L2
219
238
    }
356
375
          tv_channel_current->prev->next = NULL;
357
376
        free(tv_channel_current);
358
377
    } else 
359
 
            tv_channel_last_real = malloc(sizeof(char)*5);
 
378
            tv_channel_last_real = malloc(5);
360
379
 
361
380
    if (tv_channel_list) {
362
381
        int i;
660
679
    switch(opt)
661
680
    {
662
681
        case TV_COLOR_BRIGHTNESS:
663
 
            funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value);
664
 
            break;
665
 
        case TV_COLOR_HUE:
666
 
            funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value);
667
 
            break;
668
 
        case TV_COLOR_SATURATION:
669
 
            funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value);
670
 
            break;
671
 
        case TV_COLOR_CONTRAST:
672
 
            funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
673
 
            break;
674
 
        default:
675
 
            mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
676
 
    }
677
 
    
678
 
    return(1);
 
682
            return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value);
 
683
        case TV_COLOR_HUE:
 
684
            return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value);
 
685
        case TV_COLOR_SATURATION:
 
686
            return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value);
 
687
        case TV_COLOR_CONTRAST:
 
688
            return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
 
689
        default:
 
690
            mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
 
691
    }
 
692
    
 
693
    return(TVI_CONTROL_UNKNOWN);
 
694
}
 
695
 
 
696
int tv_get_color_options(tvi_handle_t *tvh, int opt, int* value)
 
697
{
 
698
    tvi_functions_t *funcs = tvh->functions;
 
699
 
 
700
    switch(opt)
 
701
    {
 
702
        case TV_COLOR_BRIGHTNESS:
 
703
            return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_BRIGHTNESS, value);
 
704
        case TV_COLOR_HUE:
 
705
            return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HUE, value);
 
706
        case TV_COLOR_SATURATION:
 
707
            return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_SATURATION, value);
 
708
        case TV_COLOR_CONTRAST:
 
709
            return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_CONTRAST, value);
 
710
        default:
 
711
            mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
 
712
    }
 
713
    
 
714
    return(TVI_CONTROL_UNKNOWN);
679
715
}
680
716
 
681
717
int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq)