Mercurial > mplayer.hg
comparison libmpdemux/dvbin.c @ 11872:d158978a3d3c
Compliance with the DVB power management specification (doesn't close
the tuner after having tuned).
This permits to remove the parameter dvb_shutdown_timeout=0 to the
module dvb-core and ultimately
shuts down the card when the tuner isn't used.
patch by Nico <nsabbi@tiscali.it>
author | attila |
---|---|
date | Thu, 29 Jan 2004 10:36:33 +0000 |
parents | d8b1f7509df2 |
children | 6fbcdac049c6 |
comparison
equal
deleted
inserted
replaced
11871:84e0f5fe81e8 | 11872:d158978a3d3c |
---|---|
111 extern int dvb_get_tuner_type(dvb_priv_t *priv); | 111 extern int dvb_get_tuner_type(dvb_priv_t *priv); |
112 | 112 |
113 extern int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone, | 113 extern int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone, |
114 fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, | 114 fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, |
115 fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate); | 115 fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate); |
116 extern char *dvb_dvrdev[4], *dvb_demuxdev[4]; | 116 extern char *dvb_dvrdev[4], *dvb_demuxdev[4], *dvb_frontenddev[4]; |
117 | 117 |
118 dvb_channels_list *dvb_list_ptr = NULL; | 118 dvb_channels_list *dvb_list_ptr = NULL; |
119 | 119 |
120 | 120 |
121 static dvb_channels_list *dvb_get_channels(char *filename, int type) | 121 static dvb_channels_list *dvb_get_channels(char *filename, int type) |
346 dvb_demux_stop(priv->demux_fd[0]); | 346 dvb_demux_stop(priv->demux_fd[0]); |
347 dvb_demux_stop(priv->demux_fd[1]); | 347 dvb_demux_stop(priv->demux_fd[1]); |
348 } | 348 } |
349 | 349 |
350 if(channel->vpid) | 350 if(channel->vpid) |
351 if(! dvb_set_ts_filt(priv->demux_fd[0], channel->vpid, DMX_PES_VIDEO)) | 351 if(! dvb_set_ts_filt(priv->demux_fd[0], channel->vpid, DMX_PES_OTHER)) |
352 return 0; | 352 return 0; |
353 //dvb_demux_start(priv->demux_fd[0]); | |
354 | 353 |
355 if(channel->apid1) | 354 if(channel->apid1) |
356 if(! dvb_set_ts_filt(priv->demux_fd[1], channel->apid1, DMX_PES_AUDIO)) | 355 if(! dvb_set_ts_filt(priv->demux_fd[1], channel->apid1, DMX_PES_OTHER)) |
357 return 0; | 356 return 0; |
358 | 357 |
359 printf("RESET DEMUXERS SUCCEDED, errno=%d\n\n\n", errno); | 358 return 1; |
360 } | 359 } |
361 | 360 |
362 | 361 |
363 int dvb_set_channel(dvb_priv_t *priv, int n) | 362 int dvb_set_channel(dvb_priv_t *priv, int n) |
364 { | 363 { |
438 | 437 |
439 priv->is_on = 1; | 438 priv->is_on = 1; |
440 | 439 |
441 //sets demux filters and restart the stream | 440 //sets demux filters and restart the stream |
442 if(channel->vpid) | 441 if(channel->vpid) |
443 if(! dvb_set_ts_filt(priv->demux_fd[0], channel->vpid, DMX_PES_VIDEO)) | 442 if(! dvb_set_ts_filt(priv->demux_fd[0], channel->vpid, DMX_PES_OTHER)) |
444 return 0; | 443 return 0; |
445 //dvb_demux_start(priv->demux_fd[0]); | |
446 | 444 |
447 if(channel->apid1) | 445 if(channel->apid1) |
448 if(! dvb_set_ts_filt(priv->demux_fd[1], channel->apid1, DMX_PES_AUDIO)) | 446 if(! dvb_set_ts_filt(priv->demux_fd[1], channel->apid1, DMX_PES_OTHER)) |
449 return 0; | 447 return 0; |
450 //dvb_demux_start(priv->demux_fd[1]); | |
451 | 448 |
452 return 1; | 449 return 1; |
453 } | 450 } |
454 | 451 |
455 | 452 |
503 dvb_priv_t *priv = (dvb_priv_t *) stream->priv; | 500 dvb_priv_t *priv = (dvb_priv_t *) stream->priv; |
504 | 501 |
505 close(priv->dvr_fd); | 502 close(priv->dvr_fd); |
506 close(priv->demux_fd[0]); | 503 close(priv->demux_fd[0]); |
507 close(priv->demux_fd[1]); | 504 close(priv->demux_fd[1]); |
505 | |
506 close(priv->fe_fd); | |
507 #ifdef HAVE_DVB | |
508 close(priv->sec_fd); | |
509 #endif | |
510 | |
508 priv->is_on = 0; | 511 priv->is_on = 0; |
509 priv->stream = NULL; | 512 priv->stream = NULL; |
510 if(dvb_list_ptr) | 513 if(dvb_list_ptr) |
511 free(dvb_list_ptr); | 514 free(dvb_list_ptr); |
512 | 515 |
570 } | 573 } |
571 else if(channel != NULL) | 574 else if(channel != NULL) |
572 { | 575 { |
573 pids[npids] = channel->vpid; | 576 pids[npids] = channel->vpid; |
574 } | 577 } |
575 pestypes[npids] = DMX_PES_VIDEO; | 578 pestypes[npids] = DMX_PES_OTHER; |
576 npids++; | 579 npids++; |
577 | 580 |
578 if(opts->aid > 0) | 581 if(opts->aid > 0) |
579 { | 582 { |
580 pids[npids] = opts->aid; | 583 pids[npids] = opts->aid; |
581 } | 584 } |
582 else if(channel != NULL) | 585 else if(channel != NULL) |
583 { | 586 { |
584 pids[npids] = channel->apid1; | 587 pids[npids] = channel->apid1; |
585 } | 588 } |
586 pestypes[npids] = DMX_PES_AUDIO; | 589 pestypes[npids] = DMX_PES_OTHER; |
587 npids++; | 590 npids++; |
588 | 591 |
589 | 592 |
590 | 593 |
591 priv->demux_fd[0] = open(dvb_demuxdev[priv->card], O_RDWR); | 594 priv->demux_fd[0] = open(dvb_demuxdev[priv->card], O_RDWR); |
632 static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format) | 635 static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format) |
633 { | 636 { |
634 // I don't force the file format bacause, although it's almost always TS, | 637 // I don't force the file format bacause, although it's almost always TS, |
635 // there are some providers that stream an IP multicast with M$ Mpeg4 inside | 638 // there are some providers that stream an IP multicast with M$ Mpeg4 inside |
636 struct stream_priv_s* p = (struct stream_priv_s*)opts; | 639 struct stream_priv_s* p = (struct stream_priv_s*)opts; |
637 char *name = NULL, *filename; | 640 char *filename; |
638 dvb_priv_t *priv; | 641 dvb_priv_t *priv; |
639 int tuner_type = 0; | 642 int tuner_type = 0; |
640 | |
641 | 643 |
642 | 644 |
643 if(mode != STREAM_READ) | 645 if(mode != STREAM_READ) |
644 return STREAM_UNSUPORTED; | 646 return STREAM_UNSUPORTED; |
645 | 647 |
648 return STREAM_ERROR; | 650 return STREAM_ERROR; |
649 | 651 |
650 priv = (dvb_priv_t *)stream->priv; | 652 priv = (dvb_priv_t *)stream->priv; |
651 priv->stream = stream; | 653 priv->stream = stream; |
652 | 654 |
653 name = malloc(sizeof(char)*128); | |
654 | |
655 if(name == NULL) | |
656 { | |
657 mp_msg(MSGT_DEMUX, MSGL_ERR, "COULDN'T MALLOC SOME TMP MEMORY, EXIT!\n"); | |
658 return STREAM_ERROR; | |
659 } | |
660 | |
661 priv->card = p->card - 1; | 655 priv->card = p->card - 1; |
662 | 656 if(! dvb_open_fe(priv)) |
657 { | |
658 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: %d\n", dvb_frontenddev[priv->card], errno); | |
659 return STREAM_ERROR; | |
660 } | |
661 | |
663 if(!strncmp(p->type, "CBL", 3)) | 662 if(!strncmp(p->type, "CBL", 3)) |
664 { | 663 { |
665 tuner_type = TUNER_CBL; | 664 tuner_type = TUNER_CBL; |
666 } | 665 } |
667 else if(!strncmp(p->type, "TER", 3)) | 666 else if(!strncmp(p->type, "TER", 3)) |