* added a bunch of drivers by Siarzhuk Zharski

-> a USB Mass Storgage module (SCSI bus manager add-on)
-> a SiS 7018 AC97 driver (uses "old" audio driver interface)
-> a USB Serial driver
-> a USB Vision driver and media add-on (Haupauge WinTV USB)
* moved R3MediaDefs.h from usb_audio driver to common place
  headers/private/audio (also used by SiS 7018 driver)
* added TV tuner frequency defines to data/settings/media/usb_vision

Some of these drivers are in unfinished state, particularily the
USB Vision driver, the VideoProducer doesn't seem to use it yet,
the USB Mass Storage module is known to work though, it also includes
add-ons for itself that add support for some "special" hardware, these
are not integrated with the Jamfile build system though.

Also I didn't much much time with the "CVS package" targets, the
ReadMes are not added, someone with more knowledge about this could
add them...

None of this stuff is added to the Haiku image, it is simply included
to be maintained in the Haiku tree from now on.

* fixed a bug in Video Producer sample inherited from Be Sample
  code - the timing from the time source was not really used,
  on some systems this could cause in the producer not waking
  up at the correct time if the system time and audio card time
  are drifting apart



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17625 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2006-05-29 09:54:03 +00:00
parent 96da8285b0
commit b3d94504c2
119 changed files with 18546 additions and 93 deletions
+1
View File
@@ -8,5 +8,6 @@ SubInclude HAIKU_TOP src add-ons media media-add-ons mixer ;
SubInclude HAIKU_TOP src add-ons media media-add-ons multi_audio ;
SubInclude HAIKU_TOP src add-ons media media-add-ons radeon ;
SubInclude HAIKU_TOP src add-ons media media-add-ons tone_producer_demo ;
SubInclude HAIKU_TOP src add-ons media media-add-ons usb_vision ;
SubInclude HAIKU_TOP src add-ons media media-add-ons video_producer_demo ;
@@ -0,0 +1,165 @@
/*
* Copyright (c) 2003 by Siarzuk Zharski <[email protected]>
*
* This file may be used under the terms of the BSD License
*
* Skeletal part of this code was inherired from original BeOS sample code,
* that is distributed under the terms of the Be Sample Code License.
*
*/
#include <support/Autolock.h>
#include <media/MediaFormats.h>
#include <Drivers.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "AddOn.h"
#include "Producer.h"
#include "nt100x.h"
MediaAddOn::MediaAddOn(image_id imid)
: BMediaAddOn(imid)
{
/* Customize these parameters to match those of your node */
fFlavorInfo.name = "USB Vision";
fFlavorInfo.info = "USB Vision";
fFlavorInfo.kinds = B_BUFFER_PRODUCER | B_CONTROLLABLE | B_PHYSICAL_INPUT;
fFlavorInfo.flavor_flags = 0;
fFlavorInfo.internal_id = 0;
fFlavorInfo.possible_count = 1;
fFlavorInfo.in_format_count = 0;
fFlavorInfo.in_format_flags = 0;
fFlavorInfo.in_formats = NULL;
fFlavorInfo.out_format_count = 1;
fFlavorInfo.out_format_flags = 0;
fMediaFormat.type = B_MEDIA_RAW_VIDEO;
fMediaFormat.u.raw_video = media_raw_video_format::wildcard;
fMediaFormat.u.raw_video.interlace = 1;
fMediaFormat.u.raw_video.display.format = B_RGB32;
fFlavorInfo.out_formats = &fMediaFormat;
fInitStatus = B_NO_INIT;
fDriverFD = -1;
if(USBVisionInit()){
fInitStatus = B_OK;
}
}
MediaAddOn::~MediaAddOn()
{
if(fInitStatus == B_OK){
USBVisionUninit();
}
}
status_t
MediaAddOn::InitCheck(const char **out_failure_text)
{
if (fInitStatus < B_OK) {
*out_failure_text = "Unknown error";
return fInitStatus;
}
return B_OK;
}
int32
MediaAddOn::CountFlavors()
{
if (fInitStatus < B_OK)
return fInitStatus;
/* This addon only supports a single flavor, as defined in the
* constructor */
return 1;
}
/*
* The pointer to the flavor received only needs to be valid between
* successive calls to BMediaAddOn::GetFlavorAt().
*/
status_t
MediaAddOn::GetFlavorAt(int32 n, const flavor_info **out_info)
{
if (fInitStatus < B_OK)
return fInitStatus;
if (n != 0)
return B_BAD_INDEX;
/* Return the flavor defined in the constructor */
*out_info = &fFlavorInfo;
return B_OK;
}
BMediaNode *
MediaAddOn::InstantiateNodeFor(
const flavor_info *info, BMessage *config, status_t *out_error)
{
VideoProducer *node;
if (fInitStatus < B_OK)
return NULL;
if (info->internal_id != fFlavorInfo.internal_id)
return NULL;
/* At most one instance of the node should be instantiated at any given
* time. The locking for this restriction may be found in the VideoProducer
* class. */
node = new VideoProducer(this, fFlavorInfo.name, fFlavorInfo.internal_id);
if (node && (node->InitCheck() < B_OK)) {
delete node;
node = NULL;
}
return node;
}
BMediaAddOn *
make_media_addon(image_id imid)
{
return new MediaAddOn(imid);
}
bool MediaAddOn::USBVisionInit()
{
//TODO - support for multiple devices !!!
fDriverFD = open("/dev/video/usb_vision/0", O_RDWR);
if(fDriverFD < 0)
fInitStatus = ENODEV;
return (fDriverFD >= 0);
}
void MediaAddOn::USBVisionUninit()
{ //TODO - correct work on detach device from usb port ...
close(fDriverFD);
}
status_t MediaAddOn::USBVisionWriteRegister(uint8 reg, uint8 *data, uint8 len /*= sizeof(uint8)*/)
{
status_t status = ENODEV;
if(fDriverFD >= 0){
xet_nt100x_reg ri = {reg, len};
memcpy(ri.data, data, len);
status = ioctl(fDriverFD, NT_IOCTL_WRITE_REGISTER, &ri, sizeof(ri));
}
return status;
}
status_t MediaAddOn::USBVisionReadRegister(uint8 reg, uint8 *data, uint8 len /* = sizeof(uint8)*/)
{
status_t status = ENODEV;
if(fDriverFD >= 0){
xet_nt100x_reg ri = {reg, len};
if((status = ioctl(fDriverFD, NT_IOCTL_READ_REGISTER, &ri, sizeof(ri))) == B_OK){
memcpy(data, ri.data, ri.data_length);
}
}
return status;
}
@@ -0,0 +1,59 @@
/*
* This file is a part of BeOS USBVision driver project.
* Copyright (c) 2003 by Siarzuk Zharski <[email protected]>
*
* This file may be used under the terms of the BSD License
*
* Skeletal part of this code was inherired from original BeOS sample code,
* that is distributed under the terms of the Be Sample Code License.
*
*/
#ifndef _USBVISION_ADDON_H
#define _USBVISION_ADDON_H
#include <media/MediaAddOn.h>
#define TOUCH(x) ((void)(x))
extern "C" _EXPORT BMediaAddOn *make_media_addon(image_id you);
class MediaAddOn : public BMediaAddOn
{
public:
MediaAddOn(image_id imid);
virtual ~MediaAddOn();
virtual status_t InitCheck(const char **out_failure_text);
virtual int32 CountFlavors();
virtual status_t GetFlavorAt(int32 n, const flavor_info ** out_info);
virtual BMediaNode *InstantiateNodeFor(
const flavor_info * info,
BMessage * config,
status_t * out_error);
virtual status_t GetConfigurationFor(BMediaNode *node, BMessage *message)
{ TOUCH(node); TOUCH(message); return B_OK; }
virtual status_t SaveConfigInfo(BMediaNode *node, BMessage *message)
{ TOUCH(node); TOUCH(message); return B_OK; }
virtual bool WantsAutoStart() { return false; }
virtual status_t AutoStart(int in_count, BMediaNode **out_node,
int32 *out_internal_id, bool *out_has_more)
{ TOUCH(in_count); TOUCH(out_node);
TOUCH(out_internal_id); TOUCH(out_has_more);
return B_ERROR; }
bool USBVisionInit();
void USBVisionUninit();
status_t USBVisionWriteRegister(uint8 reg, uint8 *data, uint8 len = sizeof(uint8));
status_t USBVisionReadRegister(uint8 reg, uint8 *data, uint8 len = sizeof(uint8));
private:
status_t fInitStatus;
flavor_info fFlavorInfo;
media_format fMediaFormat;
int fDriverFD;
};
#endif /*_USBVISION_ADDON_H*/
@@ -0,0 +1,582 @@
/*
* This file is a part of BeOS USBVision driver project.
* Copyright (c) 2003 by Siarzuk Zharski <[email protected]>
*
* This file may be used under the terms of the BSD License
*
*/
/* TODO: Look for the following channel lists ...
Brazil Air
China Air
Europe Air
Europe Cable
France Air
France Cable
Great Britain Air
Great Britain Cable
FM Radio
UKW Radio
*/
struct Channel{
const char *name;
float frequency; // in MHz
};
Channel Channels_US_Air[] = {
{ "2", 55.25}, { "3", 61.25}, { "4", 67.25}, { "5", 77.25}, { "6", 83.25},
{ "7", 175.25}, { "8", 181.25}, { "9", 187.25}, { "10", 193.25}, { "11", 199.25},
{ "12", 205.25}, { "13", 211.25}, { "14", 471.25}, { "15", 477.25}, { "16", 483.25},
{ "17", 489.25}, { "18", 495.25}, { "19", 501.25}, { "20", 507.25}, { "21", 513.25},
{ "22", 519.25}, { "23", 525.25}, { "24", 531.25}, { "25", 537.25}, { "26", 543.25},
{ "27", 549.25}, { "28", 555.25}, { "29", 561.25}, { "30", 567.25}, { "31", 573.25},
{ "32", 579.25}, { "33", 585.25}, { "34", 591.25}, { "35", 597.25}, { "36", 603.25},
{ "37", 609.25}, { "38", 615.25}, { "39", 621.25}, { "40", 627.25}, { "41", 633.25},
{ "42", 639.25}, { "43", 645.25}, { "44", 651.25}, { "45", 657.25}, { "46", 663.25},
{ "47", 669.25}, { "48", 675.25}, { "49", 681.25}, { "50", 687.25}, { "51", 693.25},
{ "52", 699.25}, { "53", 705.25}, { "54", 711.25}, { "55", 717.25}, { "56", 723.25},
{ "57", 729.25}, { "58", 735.25}, { "59", 741.25}, { "60", 747.25}, { "61", 753.25},
{ "62", 759.25}, { "63", 765.25}, { "64", 771.25}, { "65", 777.25}, { "66", 783.25},
{ "67", 789.25}, { "68", 795.25}, { "69", 801.25} };
Channel Channels_US_Cable[] = {
{ "4A", 73.25}, { "2", 55.25}, { "3", 61.25}, { "4", 67.25}, { "5", 77.25},
{ "6", 83.25}, { "7", 175.25}, { "8", 181.25}, { "9", 187.25}, { "10", 193.25},
{ "11", 199.25}, { "12", 205.25}, { "13", 211.25}, { "A", 121.25}, { "B", 127.25},
{ "C", 133.25}, { "D", 139.25}, { "E", 145.25}, { "F", 151.25}, { "G", 157.25},
{ "H", 163.25}, { "I", 169.25}, { "J", 217.25}, { "K", 223.25}, { "L", 229.25},
{ "M", 235.25}, { "N", 241.25}, { "O", 247.25}, { "P", 253.25}, { "Q", 259.25},
{ "R", 265.25}, { "S", 271.25}, { "T", 277.25}, { "U", 283.25}, { "V", 289.25},
{ "W", 295.25}, { "W+1", 301.25}, { "W+2", 307.25}, { "W+3", 313.25}, { "W+4", 319.25},
{ "W+5", 325.25}, { "W+6", 331.25}, { "W+7", 337.25}, { "W+8", 343.25}, { "W+9", 349.25},
{ "W+10", 355.25}, { "W+11", 361.25}, { "W+12", 367.25}, { "W+13", 373.25}, { "W+14", 379.25},
{ "W+15", 385.25}, { "W+16", 391.25}, { "W+17", 397.25}, { "W+18", 403.25}, { "W+19", 409.25},
{ "W+20", 415.25}, { "W+21", 421.25}, { "W+22", 427.25}, { "W+23", 433.25}, { "W+24", 439.25},
{ "W+25", 445.25}, { "W+26", 451.25}, { "W+27", 457.25}, { "W+28", 463.25}, { "65", 469.25},
{ "66", 475.25}, { "67", 481.25}, { "68", 487.25}, { "69", 493.25}, { "70", 499.25},
{ "71", 505.25}, { "72", 511.25}, { "73", 517.25}, { "74", 523.25}, { "75", 529.25},
{ "76", 535.25}, { "77", 541.25}, { "78", 547.25}, { "79", 553.25}, { "80", 559.25},
{ "81", 565.25}, { "82", 571.25}, { "83", 577.25}, { "84", 583.25}, { "85", 589.25},
{ "86", 595.25}, { "87", 601.25}, { "88", 607.25}, { "89", 613.25}, { "90", 619.25},
{ "91", 625.25}, { "92", 631.25}, { "93", 637.25}, { "94", 643.25}, { "A­5", 91.25 },
{ "A­4", 97.25 }, { "A­3", 103.25}, { "A­2", 109.25}, { "A-1", 115.25}, { "100", 649.25},
{ "101", 655.25}, { "102", 661.25}, { "103", 667.25}, { "104", 673.25}, { "105", 679.25},
{ "106", 685.25}, { "107", 691.25}, { "108", 697.25}, { "109", 703.25}, { "110", 709.25},
{ "111", 715.25}, { "112", 721.25}, { "113", 727.25}, { "114", 733.25}, { "115", 739.25},
{ "116", 745.25}, { "117", 751.25}, { "118", 757.25}, { "119", 763.25}, { "120", 769.25},
{ "121", 775.25}, { "122", 781.25}, { "123", 787.25}, { "124", 793.25}, { "125", 799.25} };
Channel Channels_US_Cable_HRC[] = {
{ "2", 54.00}, { "3", 60.00}, { "4", 66.00}, { "5", 76.00},
{ "6", 82.00}, { "7", 174.00}, { "8", 180.00}, { "9", 186.00}, { "10", 192.00},
{ "11", 198.00}, { "12", 204.00}, { "13", 210.00}, { "A", 120.00}, { "B", 126.00},
{ "C", 132.00}, { "D", 138.00}, { "E", 144.00}, { "F", 150.00}, { "G", 156.00},
{ "H", 162.00}, { "I", 168.00}, { "J", 216.00}, { "K", 222.00}, { "L", 228.00},
{ "M", 234.00}, { "N", 240.00}, { "O", 246.00}, { "P", 252.00}, { "Q", 258.00},
{ "R", 264.00}, { "S", 270.00}, { "T", 276.00}, { "U", 282.00}, { "V", 288.00},
{ "W", 294.00}, { "W+1", 300.00}, { "W+2", 306.00}, { "W+3", 312.00}, { "W+4", 318.00},
{ "W+5", 324.00}, { "W+6", 330.00}, { "W+7", 336.00}, { "W+8", 342.00}, { "W+9", 348.00},
{ "W+10", 354.00}, { "W+11", 360.00}, { "W+12", 366.00}, { "W+13", 372.00}, { "W+14", 378.00},
{ "W+15", 384.00}, { "W+16", 390.00}, { "W+17", 396.00}, { "W+18", 402.00}, { "W+19", 408.00},
{ "W+20", 414.00}, { "W+21", 420.00}, { "W+22", 426.00}, { "W+23", 432.00}, { "W+24", 438.00},
{ "W+25", 444.00}, { "W+26", 450.00}, { "W+27", 456.00}, { "W+28", 462.00}, { "65", 468.00},
{ "66", 474.00}, { "67", 480.00}, { "68", 486.00}, { "69", 492.00}, { "70", 498.00},
{ "71", 504.00}, { "72", 510.00}, { "73", 516.00}, { "74", 522.00}, { "75", 528.00},
{ "76", 534.00}, { "77", 540.00}, { "78", 546.00}, { "79", 552.00}, { "80", 558.00},
{ "81", 564.00}, { "82", 570.00}, { "83", 576.00}, { "84", 582.00}, { "85", 588.00},
{ "86", 594.00}, { "87", 600.00}, { "88", 606.00}, { "89", 612.00}, { "90", 618.00},
{ "91", 624.00}, { "92", 630.00}, { "93", 636.00}, { "94", 642.00}, { "A­5", 90.00 },
{ "A­4", 96.00 }, { "A­3", 102.00}, { "A­2", 108.00}, { "A-1", 114.00}, { "100", 648.00},
{ "101", 654.00}, { "102", 660.00}, { "103", 666.00}, { "104", 672.00}, { "105", 678.00},
{ "106", 684.00}, { "107", 690.00}, { "108", 696.00}, { "109", 702.00}, { "110", 708.00},
{ "111", 714.00}, { "112", 720.00}, { "113", 726.00}, { "114", 732.00}, { "115", 738.00},
{ "116", 744.00}, { "117", 750.00}, { "118", 756.00}, { "119", 762.00}, { "120", 768.00},
{ "121", 774.00}, { "122", 780.00}, { "123", 786.00}, { "124", 792.00}, { "125", 798.00} };
Channel Japan_Air[]={
{ "1", 91.25}, { "2", 97.25}, { "3", 103.25}, { "4", 171.25}, { "5", 177.25},
{ "6", 183.25}, { "7", 189.25}, { "8", 193.25}, { "9", 199.25}, { "10", 205.25},
{ "11", 211.25}, { "12", 217.25}, { "13", 471.25}, { "14", 477.25}, { "15", 483.25},
{ "16", 489.25}, { "17", 495.25}, { "18", 501.25}, { "19", 507.25}, { "20", 513.25},
{ "21", 519.25}, { "22", 525.25}, { "23", 531.25}, { "24", 537.25}, { "25", 543.25},
{ "26", 549.25}, { "27", 555.25}, { "28", 561.25}, { "29", 567.25}, { "30", 573.25},
{ "31", 579.25}, { "32", 585.25}, { "33", 591.25}, { "34", 597.25}, { "35", 603.25},
{ "36", 609.25}, { "37", 615.25}, { "38", 621.25}, { "39", 627.25}, { "40", 633.25},
{ "41", 639.25}, { "42", 645.25}, { "43", 651.25}, { "44", 657.25}, { "45", 663.25},
{ "46", 669.25}, { "47", 675.25}, { "48", 681.25}, { "49", 687.25}, { "50", 693.25},
{ "51", 699.25}, { "52", 705.25}, { "53", 711.25}, { "54", 717.25}, { "55", 723.25},
{ "56", 729.25}, { "57", 735.25}, { "58", 741.25}, { "59", 747.25}, { "60", 753.25},
{ "61", 759.25}, { "62", 765.25} };
Channel Japan_Cable[]={
{ "1", 91.25}, { "2", 97.25}, { "3", 103.25}, { "4", 171.25}, { "5", 177.25},
{ "6", 183.25}, { "7", 189.25}, { "8", 193.25}, { "9", 199.25}, { "10", 205.25},
{ "11", 211.25}, { "12", 217.25}, { "C13", 109.25}, { "C14", 115.25}, { "C15", 121.25},
{ "C16", 127.25}, { "C17", 133.25}, { "C18", 139.25}, { "C19", 145.25}, { "C20", 151.25},
{ "C21", 157.25}, { "C22", 165.25}, { "C23", 223.25}, { "C24", 229.25}, { "C25", 235.25},
{ "C26", 241.25}, { "C27", 247.25}, { "C28", 253.25}, { "C29", 259.25}, { "C30", 265.25},
{ "C31", 271.25}, { "C32", 277.25}, { "C33", 293.25}, { "C34", 289.25}, { "C35", 295.25},
{ "C36", 301.25}, { "C37", 307.25}, { "C38", 313.25}, { "C39", 319.25}, { "C40", 325.25},
{ "C41", 331.25}, { "C42", 337.25}, { "C43", 343.25}, { "C44", 349.25}, { "C45", 355.25},
{ "C46", 361.25}, { "C47", 367.25}, { "C48", 373.25}, { "C49", 379.25}, { "C50", 385.25},
{ "C51", 391.25}, { "C52", 397.25}, { "C53", 403.25}, { "C54", 409.25}, { "C55", 415.25},
{ "C56", 421.25}, { "C57", 427.25}, { "C58", 433.25}, { "C59", 439.25}, { "C60", 445.25},
{ "C61", 451.25}, { "C62", 457.25}, { "C63", 463.25} };
International_Air
{
E2 48.25
E3 55.25
E4 62.25
E5 175.25
E6 182.25
E7 189.25
E8 196.25
E9 203.25
E10 210.25
E11 217.25
E12 224.25
IA 53.75
IB 62.25
IC 82.25
ID 175.25
IE 183.25
IF 192.75
IG 201.25
IH 210.25
21 471.25
22 479.25
23 487.25
24 495.25
25 503.25
26 511.25
27 519.25
28 527.25
29 535.25
30 543.25 C30
31 551.25 C31
32 559.25 C32
33 567.25 C33
34 575.25 C34
35 583.25 C35
36 591.25 C36
37 599.25 C37
38 607.25 C38
39 615.25 C39
40 623.25 C40
41 631.25 C41
42 639.25 C42
43 647.25 C43
44 655.25 C44
45 663.25 C45
46 671.25 C46
47 679.25 C47
48 687.25 C48
49 695.25 C49
50 703.25 C50
51 711.25 C51
52 719.25 C52
53 727.25 C53
54 735.25 C54
55 743.25 C55
56 751.25 C56
57 759.25 C57
58 767.25 C58
59 775.25 C59
60 783.25 C60
61 791.25 C61
62 799.25 C62
63 807.25 C63
64 815.25 C64
65 823.25 C65
66 831.25 C66
67 839.25 C67
68 847.25 C68
69 855.25 C69
E2A 49.75 C70
AS1 57.25 C71
AS2 64.25 C72
AS3 86.25 C73
AS4 95.25 C74
AS5 102.25 C75
AS5A 138.25
AS10 209.25
AS11 216.25
IH1 217.25
IND2 55.25
IND3 62.25
IND4 175.25
IND5 182.25
IND6 189.25
IND7 196.25
IND8 203.25
IND9 210.25
IND10 217.25
IND11 224.25
};
International_Cable
{
Channel Freq
E2 48.25
E3 55.25
E4 62.25
S01 69.25
S02 76.25
S03 83.25
S1 105.25
S2 112.25
S3 119.25
S4 126.25
S5 133.25
S6 140.25
S7 147.25
S8 154.25
S9 161.25
S10 168.25
E5 175.25
E6 182.25
E7 189.25
E8 196.25
E9 203.25
E10 210.25
E11 217.25
E12 224.25
S11 231.25
S12 238.25
S13 245.25
S14 252.25
S15 259.25
S16 266.25
S17 273.25
S18 280.25
S19 287.25
S20 294.25
S21 303.25
S22 311.25
S23 319.25
S24 327.25
S25 335.25
S26 343.25
S27 351.25
S28 359.25
S29 367.25
S30 375.25
S31 383.25
S32 391.25
S33 399.25
S34 407.25
S35 415.25
S36 423.25
S37 431.25
S38 439.25
S39 447.25
S40 455.25
S41 463.25
};
Channel UK_Air[] = {
{ "A", 45.75}, { "B", 53.75}, { "C", 61.75}, { "D", 175.25}, { "E", 183.25},
{ "F", 191.25}, { "G", 199.25}, { "H", 207.25}, { "J", 215.25}, { "C10", 223.25},
{ "C11", 231.25}, { "C13", 247.25}, { "B21", 471.25}, { "B22", 479.25}, { "B23", 487.25},
{ "B24", 495.25}, { "B25", 503.25}, { "B26", 511.25}, { "B27", 519.25}, { "B28", 527.25},
{ "B29", 535.25}, { "B30", 543.25}, { "B31", 551.25}, { "B32", 559.25}, { "B33", 567.25},
{ "B34", 575.25}, { "B35", 583.25}, { "B36", 591.25}, { "B37", 599.25}, { "B38", 607.25},
{ "B39", 615.25}, { "B40", 623.25}, { "B41", 631.25}, { "B42", 639.25}, { "B43", 647.25},
{ "B44", 655.25}, { "B45", 663.25}, { "B46", 671.25}, { "B47", 679.25}, { "B48", 687.25},
{ "B49", 695.25}, { "B50", 703.25}, { "B51", 711.25}, { "B52", 719.25}, { "B53", 727.25},
{ "B54", 735.25}, { "B55", 743.25}, { "B56", 751.25}, { "B57", 759.25}, { "B58", 767.25},
{ "B59", 775.25}, { "B60", 783.25}, { "B61", 791.25}, { "B62", 799.25}, { "B63", 807.25},
{ "B64", 815.25}, { "B65", 823.25}, { "B66", 831.25}, { "B67", 839.25}, { "B68", 847.25},
{ "B69", 855.25}, { "B1", 45.00 }, { "B2", 51.75 }, { "B3", 56.75 }, { "B4", 61.75 },
{ "B5", 66.75 }, { "B6", 179.75}, { "B7", 184.75}, { "B8", 189.75}, { "B9", 194.75},
{ "B10", 199.75}, { "B11", 204.75}, { "B12", 209.75}, { "B13", 214.75}, { "B14", 219.75} };
UK_Cable
{
Channel Freq
A1 47.25
A2 55.25
A3 63.25
A4 71.25
A5 79.25
A6 87.25
A7 95.25
A8 103.25
A9 111.25
A10 119.25
A11 127.25
A12 135.25
A13 143.25
A14 151.25
A15 159.25
A16 167.25
A17 175.25
A18 183.25
A19 191.25
A20 199.25
A21 207.25
A22 215.25
A23 223.25
A24 231.25
A25 239.25
A26 247.25
A27 255.25
A28 263.25
A29 271.25
A30 279.25
A31 287.25
A32 295.25
E2 48.25
E3 55.25
E4 62.25
S01 69.25
S02 76.25
S03 83.25
S1 105.25
S2 112.25
S3 119.25
S4 126.25
S5 133.25
S6 140.25
S7 147.25
S8 154.25
S9 161.25
S10 168.25
E5 175.25
E6 182.25
E7 189.25
E8 196.25
E9 203.25
E10 210.25
E11 217.25
E12 224.25
S11 231.25
S12 238.25
S13 245.25
S14 252.25
S15 259.25
S16 266.25
S17 273.25
S18 280.25
S19 287.25
S20 294.25
S21 303.25
S22 311.25
S23 319.25
S24 327.25
S25 335.25
S26 343.25
S27 351.25
S28 359.25
S29 367.25
S30 375.25
S31 383.25
S32 391.25
S33 399.25
S34 407.25
S35 415.25
S36 423.25
S37 431.25
S38 439.25
S39 447.25
S40 455.25
S41 463.25
};
French_Air
{
Channel Freq
FA 47.75
L2 49.25
L3 54.00
FB 55.75
L4 57.25
FC1 60.50
FC 63.75
F1 176.00
F2 184.00
F3 192.00
F4 200.00
F5 208.00
F6 216.00
B21 471.25
B22 479.25
B23 487.25
B24 495.25
B25 503.25
B26 511.25
B27 519.25
B28 527.25
B29 535.25
B30 543.25
B31 551.25
B32 559.25
B33 567.25
B34 575.25
B35 583.25
B36 591.25
B37 599.25
B38 607.25
B39 615.25
B40 623.25
B41 631.25
B42 639.25
B43 647.25
B44 655.25
B45 663.25
B46 671.25
B47 679.25
B48 687.25
B49 695.25
B50 703.25
B51 711.25
B52 719.25
B53 727.25
B54 735.25
B55 743.25
B56 751.25
B57 759.25
B58 767.25
B59 775.25
B60 783.25
B61 791.25
B62 799.25
B63 807.25
B64 815.25
B65 823.25
B66 831.25
B67 839.25
B68 847.25
B69 855.25
};
French_Cable
{
Channel Freq
E2 48.25
E3 55.25
E4 62.25
S01 69.25
S02 76.25
S03 83.25
S1 105.25
S2 112.25
S3 119.25
S4 126.25
S5 133.25
S6 140.25
S7 147.25
S8 154.25
S9 161.25
S10 168.25
E5 175.25
E6 182.25
E7 189.25
E8 196.25
E9 203.25
E10 210.25
E11 217.25
E12 224.25
S11 231.25
S12 238.25
S13 245.25
S14 252.25
S15 259.25
S16 266.25
S17 273.25
S18 280.25
S19 287.25
S20 294.25
S21 303.25
S22 311.25
S23 319.25
S24 327.25
S25 335.25
S26 343.25
S27 351.25
S28 359.25
S29 367.25
S30 375.25
S31 383.25
S32 391.25
S33 399.25
S34 407.25
S35 415.25
S36 423.25
S37 431.25
S38 439.25
S39 447.25
S40 455.25
S41 463.25
};
Channel Channels_FMRadio[] = {
/*???*/
};
Channel Channels_UKW_Radio[] = {
/*???*/
};
Channel Channels_xUSSR_Air[] = {
{"1", 49.75}, {"2", 59.25}, {"3", 77.25}, {"4", 85.25}, {"5", 93.25},
{"6", 175.25}, {"7", 183.25}, {"8", 191.25}, {"9", 199.25}, {"10", 207.25},
{"11", 215.25}, {"12", 223.25},
{"21", 471.25}, {"22", 479.25}, {"23", 487.25}, {"24", 495.25}, {"25", 503.25},
{"26", 511.25}, {"27", 519.25}, {"28", 527.25}, {"29", 535.25}, {"30", 543.25},
{"31", 551.25}, {"32", 559.25}, {"33", 567.25}, {"34", 575.25}, {"35", 583.25},
{"36", 591.25}, {"37", 599.25}, {"38", 607.25}, {"39", 615.25}, {"40", 623.25},
{"41", 631.25}, {"42", 639.25}, {"43", 647.25}, {"44", 655.25}, {"45", 663.25},
{"46", 671.25}, {"47", 679.25}, {"48", 687.25}, {"49", 695.25}, {"50", 703.25},
{"51", 711.25}, {"52", 719.25}, {"53", 727.25}, {"54", 735.25}, {"55", 743.25},
{"56", 751.25}, {"57", 759.25}, {"58", 767.25}, {"59", 775.25}, {"60", 783.25},
{"61", 791.25}, {"62", 799.25}, {"63", 807.25}, {"64", 815.25}, {"65", 823.25},
{"66", 831.25}, {"67", 839.25}, {"68", 847.25}, {"69", 855.25}};
Channel Channels_xUSSR_Cable[] = {
{"70", 111.25}, {"71", 119.25}, {"72", 127.25}, {"73", 135.25}, {"74", 143.25},
{"75", 141.25}, {"76", 159.25}, {"77", 167.25}, {"78", 231.25}, {"79", 239.25},
{"80", 247.25}, {"81", 255.25}, {"82", 263.25}, {"83", 271.25}, {"84", 279.25},
{"85", 287.25}, {"86", 295.25}, {"87", 303.25}, {"88", 311.25}, {"89", 319.25},
{"90", 327.25}, {"91", 335.25}, {"92", 343.25}, {"93", 351.25}, {"94", 359.25},
{"95", 367.25}, {"96", 375.25}, {"97", 383.25}, {"98", 391.25}, {"99", 399.25},
{"100", 407.25}, {"101", 415.25}, {"102", 423.25}, {"103", 431.25}, {"104", 439.25},
{"105", 447.25}, {"106", 455.25}, {"107", 463.25} };
Channel Channels_EuropeAir[] = {
{"", }, {"", }, {"", }, {"", }, {"", }, {"", },
};
Channel Channels_EuropeCable[] = {
{"", }, {"", }, {"", }, {"", }, {"", }, {"", },
};
Channel Channels_AustraliaAir[] = {
{ "0", 46.25}, { "1", 57.25}, { "2", 64.25}, { "3", 86.25}, { "4", 95.25},
{ "5", 102.25}, { "5A", 138.25}, { "6", 175.25}, { "7", 182.25}, { "8", 189.25},
{ "9", 196.25}, { "10", 209.25}, { "11", 216.25}, { "28", 527.25}, { "29", 534.25},
{ "30", 541.25}, { "31", 548.25}, { "32", 555.25}, { "33", 562.25}, { "34", 569.25},
{ "35", 576.25}, { "39", 604.25}, { "40", 611.25}, { "41", 618.25}, { "42", 625.25},
{ "43", 632.25}, { "44", 639.25}, { "45", 646.25}, { "46", 653.25}, { "47", 660.25},
{ "48", 667.25}, { "49", 674.25}, { "50", 681.25}, { "51", 688.25}, { "52", 695.25},
{ "53", 702.25}, { "54", 709.25}, { "55", 716.25}, { "56", 723.25}, { "57", 730.25},
{ "58", 737.25}, { "59", 744.25}, { "60", 751.25}, { "61", 758.25}, { "62", 765.25},
{ "63", 772.25}, { "64", 779.25}, { "65", 786.25}, { "66", 793.25}, { "67", 800.25},
{ "68", 807.25}, { "69", 814.25} };
Channel Channels_IrelandAir[] = {
};
@@ -0,0 +1,13 @@
SubDir HAIKU_TOP src add-ons media media-add-ons usb_vision ;
SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders usb_vision ;
Addon usb_vision.media_addon : media :
AddOn.cpp
Producer.cpp
TunerLocale.cpp
;
LinkAgainst usb_vision.media_addon : be media $(TARGET_LIBSTDC++) ;
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,208 @@
/*
* This file is a part of BeOS USBVision driver project.
* Copyright (c) 2003 by Siarzuk Zharski <[email protected]>
*
* This file may be used under the terms of the BSD License
*
* Skeletal part of this code was inherired from original BeOS sample code,
* that is distributed under the terms of the Be Sample Code License.
*
*/
#ifndef _USBVISION_PRODUCER_H
#define _USBVISION_PRODUCER_H
#include <kernel/OS.h>
#include <media/BufferProducer.h>
#include <media/Controllable.h>
#include <media/MediaDefs.h>
#include <media/MediaEventLooper.h>
#include <media/MediaNode.h>
#include <support/Locker.h>
#include "TunerLocale.h"
class VideoProducer :
public virtual BMediaEventLooper,
public virtual BBufferProducer,
public virtual BControllable
{
public:
VideoProducer(BMediaAddOn *addon,
const char *name, int32 internal_id);
virtual ~VideoProducer();
virtual status_t InitCheck() const { return fInitStatus; }
/* BMediaNode */
public:
virtual port_id ControlPort() const;
virtual BMediaAddOn *AddOn(int32 * internal_id) const;
virtual status_t HandleMessage(int32 message, const void *data,
size_t size);
protected:
virtual void Preroll();
virtual void SetTimeSource(BTimeSource * time_source);
virtual status_t RequestCompleted(const media_request_info & info);
/* BMediaEventLooper */
protected:
virtual void NodeRegistered();
virtual void Start(bigtime_t performance_time);
virtual void Stop(bigtime_t performance_time, bool immediate);
virtual void Seek(bigtime_t media_time, bigtime_t performance_time);
virtual void TimeWarp(bigtime_t at_real_time,
bigtime_t to_performance_time);
virtual status_t AddTimer(bigtime_t at_performance_time, int32 cookie);
virtual void SetRunMode(run_mode mode);
virtual void HandleEvent(const media_timed_event *event,
bigtime_t lateness, bool realTimeEvent = false);
virtual void CleanUpEvent(const media_timed_event *event);
virtual bigtime_t OfflineTime();
virtual void ControlLoop();
virtual status_t DeleteHook(BMediaNode * node);
/* BBufferProducer */
protected:
virtual status_t FormatSuggestionRequested(media_type type, int32 quality,
media_format * format);
virtual status_t FormatProposal(const media_source &output,
media_format *format);
virtual status_t FormatChangeRequested(const media_source &source,
const media_destination &destination,
media_format *io_format, int32 *_deprecated_);
virtual status_t GetNextOutput(int32 * cookie, media_output * out_output);
virtual status_t DisposeOutputCookie(int32 cookie);
virtual status_t SetBufferGroup(const media_source &for_source,
BBufferGroup * group);
virtual status_t VideoClippingChanged(const media_source &for_source,
int16 num_shorts, int16 *clip_data,
const media_video_display_info &display,
int32 * _deprecated_);
virtual status_t GetLatency(bigtime_t * out_latency);
virtual status_t PrepareToConnect(const media_source &what,
const media_destination &where,
media_format *format,
media_source *out_source, char *out_name);
virtual void Connect(status_t error, const media_source &source,
const media_destination &destination,
const media_format & format, char *io_name);
virtual void Disconnect(const media_source & what,
const media_destination & where);
virtual void LateNoticeReceived(const media_source & what,
bigtime_t how_much, bigtime_t performance_time);
virtual void EnableOutput(const media_source & what, bool enabled,
int32 * _deprecated_);
virtual status_t SetPlayRate(int32 numer,int32 denom);
virtual void AdditionalBufferRequested(const media_source & source,
media_buffer_id prev_buffer, bigtime_t prev_time,
const media_seek_tag * prev_tag);
virtual void LatencyChanged(const media_source & source,
const media_destination & destination,
bigtime_t new_latency, uint32 flags);
/* BControllable */
protected:
virtual status_t GetParameterValue(int32 id, bigtime_t *last_change,
void *value, size_t *size);
virtual void SetParameterValue(int32 id, bigtime_t when,
const void *value, size_t size);
virtual status_t StartControlPanel(BMessenger *out_messenger);
/* state */
private:
void HandleStart(bigtime_t performance_time);
void HandleStop();
void HandleTimeWarp(bigtime_t performance_time);
void HandleSeek(bigtime_t performance_time);
void HandleParameter(uint32 parameter);
static int32 fInstances;
status_t fInitStatus;
int32 fInternalID;
BMediaAddOn *fAddOn;
BLocker fLock;
BBufferGroup *fBufferGroup;
thread_id fThread;
sem_id fFrameSync;
static int32 _frame_generator_(void *data);
int32 FrameGenerator();
/* The remaining variables should be declared volatile, but they
* are not here to improve the legibility of the sample code. */
uint32 fFrame;
uint32 fFrameBase;
bigtime_t fPerformanceTimeBase;
bigtime_t fProcessingLatency;
media_output fOutput;
media_raw_video_format fConnectedFormat;
bool fRunning;
bool fConnected;
bool fEnabled;
enum { P_CHANNEL,
P_VIDEO_INPUT,
P_AUDIO_INPUT,
P_BRIGHTNESS,
P_CONTRAST,
P_SATURATION,
P_HUE,
P_CAPTURE_SIZE,
P_CAPTURE_FORMAT,
P_STANDART,
P_BANDWIDTH,
P_LOCALE,
P_VERT_OFFSET,
P_HORZ_OFFSET,
P_COLOR };
enum { P_VI_TUNER,
P_VI_COMPOSITE,
P_VI_SVIDEO};
enum { P_VF_NTSC_M,
P_VF_NTSC_MJ,
P_VF_PAL_BDGHI,
P_VF_PAL_M,
P_VF_PAL_N,
P_VF_SECAM};
BParameterWeb *CreateParameterWeb();
uint32 fChannel;
bigtime_t fLastChannelChange;
uint32 fVideoInput;
bigtime_t fLastVideoInputChange;
uint32 fAudioInput;
bigtime_t fLastAudioInputChange;
float fBrightness;
bigtime_t fLastBrightnessChange;
float fContrast;
bigtime_t fLastContrastChange;
float fSaturation;
bigtime_t fLastSaturationChange;
float fHue;
bigtime_t fLastHueChange;
uint32 fCaptureSize;
bigtime_t fLastCaptureSizeChange;
uint32 fCaptureFormat;
bigtime_t fLastCaptureFormatChange;
uint32 fStandard;
bigtime_t fLastStandardChange;
float fBandwidth;
bigtime_t fLastBandwidthChange;
uint32 fLocale;
bigtime_t fLastLocaleChange;
float fVertOffset;
bigtime_t fLastVertOffsetChange;
float fHorzOffset;
bigtime_t fLastHorzOffsetChange;
uint32 fColor;
bigtime_t fLastColorChange;
Locale::Locales fLocales;
};
#endif /*_USBVISION_PRODUCER_H*/
@@ -0,0 +1,135 @@
/*
* This file is a part of BeOS USBVision driver project.
* Copyright (c) 2003 by Siarzuk Zharski <[email protected]>
*
* This file may be used under the terms of the BSD License
*
*/
#include <Path.h>
#include <Directory.h>
#include <Entry.h>
#include <FindDirectory.h>
#include <fstream.h>
#include "TunerLocale.h"
using namespace Locale;
const char *kLocalesSettings = "media/usb_vision/Locales";
Channel::Channel(string &str, uint32 frequency):
fName(str), fFrequency(frequency)
{
}
const string &Channel::Name() const
{
return fName;
}
const uint32 Channel::Frequency()
{
return fFrequency;
}
TunerLocale::TunerLocale(BEntry &entry)
{
fStatus = B_NO_INIT;
if(entry.IsFile()){
BPath path;
if((fStatus = entry.GetPath(&path)) == B_OK){
char name[B_FILE_NAME_LENGTH];
if((fStatus = entry.GetName(name)) == B_OK){
fName = name;
fStatus = LoadLocale(path.Path());
}
}
}
}
TunerLocale::~TunerLocale()
{
}
status_t TunerLocale::InitCheck()
{
return fStatus;
}
status_t TunerLocale::LoadLocale(const char *name)
{
status_t status = B_OK;
ifstream ifs(name);
while(ifs.good() && !ifs.eof()){
string str;
getline(ifs, str);
//TODO : validity check and parse strings ...
str.erase(0, str.find_first_not_of(" \t"));
str.erase(str.find_last_not_of(" \t") + 1);
switch(str[0]){
case ';': continue;
case '@':
str.erase(0, 1);
fName = str;
break;
default: //TODO parse ...
Channel channel(str, 0);
fChannels.push_back(channel);
break;
}
}
return status;
}
status_t TunerLocale::LoadLocales(vector<TunerLocale *> &vector)
{
status_t status = B_ERROR;
BPath path;
if((status = find_directory(B_USER_SETTINGS_DIRECTORY, &path)) != B_OK)
return status;
if((status = path.Append(kLocalesSettings)) != B_OK)
return status;
BDirectory directory(path.Path());
if((status = directory.InitCheck()) != B_OK)
return status;
vector.clear();
BEntry entry;
while((status = directory.GetNextEntry(&entry)) == B_OK){
if(entry.IsFile()){
TunerLocale *locale = new TunerLocale(entry);
if((status = locale->InitCheck()) == B_OK){
vector.push_back(locale);
}
else
delete locale;
}
}
if(status == B_ENTRY_NOT_FOUND) //we reached the end of entries list ...
status = B_OK;
return status;
}
status_t TunerLocale::ReleaseLocales(vector<TunerLocale *> &vector)
{
for(LocalesIterator locale = vector.begin();
locale != vector.end(); locale ++){
delete *locale;
}
return B_OK;
}
const string &TunerLocale::Name()
{
return fName;
}
const Channel &TunerLocale::GetChannel(int idx)
{
if(idx < 0) idx = 0;
if(idx >= (int)fChannels.size()) idx = (int)(fChannels.size() - 1);
return fChannels[idx];
}
uint32 TunerLocale::ChannelsCount()
{
return fChannels.size();
}
@@ -0,0 +1,51 @@
/*
* This file is a part of BeOS USBVision driver project.
* Copyright (c) 2003 by Siarzuk Zharski <[email protected]>
*
* This file may be used under the terms of the BSD License
*
*/
#ifndef _TUNER_LOCALE_H_
#define _TUNER_LOCALE_H_
#include <string>
#include <vector>
namespace Locale{
class Channel
{
string fName;
uint32 fFrequency;
public:
Channel(string &str, uint32 frequency);
const string &Name() const;
const uint32 Frequency();
};
typedef vector<Channel> Channels;
typedef vector<Channel>::iterator ChannelsIterator;
class TunerLocale
{
status_t fStatus;
string fName;
Channels fChannels;
TunerLocale(BEntry &entry);
status_t LoadLocale(const char *file);
public:
~TunerLocale();
static status_t LoadLocales(vector<TunerLocale *> &vector);
static status_t ReleaseLocales(vector<TunerLocale *> &vector);
status_t InitCheck();
const string &Name();
const Channel &GetChannel(int idx);
uint32 ChannelsCount();
};
typedef vector<TunerLocale *> Locales;
typedef vector<TunerLocale *>::iterator LocalesIterator;
} //namespace Locale
#endif//_TUNER_LOCALE_H_
@@ -656,10 +656,10 @@ VideoProducer::FrameGenerator()
/* Recalculate the time until the thread should wake up to begin
* processing the next frame. Subtract fProcessingLatency so that
* the frame is sent in time. */
wait_until = TimeSource()->RealTimeFor(fPerformanceTimeBase, 0) +
wait_until = TimeSource()->RealTimeFor(fPerformanceTimeBase +
(bigtime_t)
((fFrame - fFrameBase) *
(1000000 / fConnectedFormat.field_rate)) -
(1000000 / fConnectedFormat.field_rate)), 0) -
fProcessingLatency;
/* Drop frame if it's at least a frame late */