]> git.alsa-project.org Git - alsa-tools.git/commitdiff
ac3dec - Add -H option for HDMI
authorTakashi Iwai <tiwai@suse.de>
Fri, 24 Oct 2008 07:24:32 +0000 (09:24 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 24 Oct 2008 07:24:32 +0000 (09:24 +0200)
The HD-audio can have an independent HDMI PCM device via "hdmi".
The option -H is for using hdmi instead of spdif.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ac3dec/ac3dec.c
ac3dec/output.c
ac3dec/output.h

index 933a41d328b94a43629d87675f2f4dbbf6788f1d..c45148cfd3f6bf23966e2b6079f8e36ac89a155e 100644 (file)
@@ -56,6 +56,7 @@ static void help(void)
        printf("  -C,--iec958c      raw IEC958 (S/PDIF) consumer mode\n");
        printf("  -P,--iec958p      raw IEC958 (S/PDIF) professional mode\n");
        printf("  -R,--iec958r      raw IEC958 (S/PDIF) PCM\n");
+       printf("  -H,--hdmi         output to HDMI device\n");
        printf("  -Z,--zero=#       add # zero-AC3-frames before stream\n");
        printf("  -q,--quit         quit mode\n");
 }
@@ -106,6 +107,7 @@ int main(int argc,char *argv[])
                {"spdif", 0, NULL, 'C'},
                {"iec958p", 0, NULL, 'P'},
                {"iec958r", 0, NULL, 'R'},
+               {"hdmi", 0, NULL, 'H'},
                {"zero", 1, NULL, 'Z'},
                {"quit", 0, NULL, 'q'},
                {NULL, 0, NULL, 0},
@@ -126,6 +128,7 @@ int main(int argc,char *argv[])
        out_config.rate = 48000;
        out_config.channels = 2;
        out_config.spdif = SPDIF_NONE;
+       out_config.hdmi = 0;
 
        morehelp = 0;
        while (1) {
@@ -166,6 +169,9 @@ int main(int argc,char *argv[])
                        ac3_config.num_output_ch = 2;
                        out_config.spdif = SPDIF_PCM;
                        break;
+               case 'H':
+                       out_config.hdmi = 1;
+                       break;
                case 'Z':
                        zero = atoi(optarg);
                        break;
index 06897e23734ef2d7eb7376a2d969fcfc22251eb9..5f707f85c42886c44b6ca715a67fec7afa67156d 100644 (file)
@@ -41,6 +41,7 @@ int output_open(output_t *output)
 {
        const char *pcm_name = output->pcm_name;
        char devstr[128];
+       const char *basedev;
        snd_pcm_hw_params_t *params;
        unsigned int rate, buffer_time, period_time, tmp;
        snd_pcm_format_t format = output->bits == 16 ? SND_PCM_FORMAT_S16 : SND_PCM_FORMAT_U8;
@@ -76,9 +77,18 @@ int output_open(output_t *output)
                                        s[2] = 0;
                                        s[3] = IEC958_AES3_CON_FS_48000;
                                }
-                               sprintf(devstr, "plug:iec958:{AES0 0x%x AES1 0x%x AES2 0x%x AES3 0x%x", s[0], s[1], s[2], s[3]);
+                               if (output->hdmi)
+                                       basedev = "hdmi";
+                               else
+                                       basedev = "iec958";
+                               sprintf(devstr, "plug:%s:{"
+                                       "AES0 0x%x AES1 0x%x "
+                                       "AES2 0x%x AES3 0x%x",
+                                       basedev,
+                                       s[0], s[1], s[2], s[3]);
                                if (out_config.card)
-                                       sprintf(devstr + strlen(devstr), " CARD %s", out_config.card);
+                                       sprintf(devstr + strlen(devstr),
+                                               " CARD %s", out_config.card);
                                strcat(devstr, "}");
                                format = SND_PCM_FORMAT_S16_LE;
                        } else {
index 1087a733a22aa0fb70317e1fd7f02ae83aba688d..95e535f7e38c9a7e98837756f3c3c86dc8ee28dc 100644 (file)
@@ -30,7 +30,8 @@ typedef struct {
        int bits;
        int rate;
        int channels;
-       int quiet: 1;
+       unsigned int quiet: 1;
+       unsigned int hdmi: 1;
        enum {SPDIF_NONE = 0, SPDIF_CON, SPDIF_PRO, SPDIF_PCM} spdif;
 } output_t;