comparison libdlna-0.2.3/src/av_mpeg1.c @ 129:4f6d9621ee00

add multi session streaming & add depending librarys. - libupnp-1.6.6 - libdlna-0.2.3
author Naoya OYAMA <naoya.oyama@gmail.com>
date Sun, 10 Oct 2010 15:33:18 +0900
parents
children
comparison
equal deleted inserted replaced
128:3a7d8d2f0585 129:4f6d9621ee00
1 /*
2 * libdlna: reference DLNA standards implementation.
3 * Copyright (C) 2007 Benjamin Zores <ben@geexbox.org>
4 *
5 * This file is part of libdlna.
6 *
7 * libdlna is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * libdlna is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with libdlna; if not, write to the Free Software
19 * Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include <stdlib.h>
23 #include <string.h>
24
25 #include "dlna_internals.h"
26 #include "profiles.h"
27
28 /* MPEG-1 video with 2 channel MPEG-1 Layer2 audio
29 encapsulated in MPEG-1 system */
30 static dlna_profile_t mpeg1 = {
31 .id = "MPEG1",
32 .mime = MIME_VIDEO_MPEG,
33 .label = LABEL_VIDEO_CIF30
34 };
35
36 static dlna_profile_t *
37 probe_mpeg1 (AVFormatContext *ctx dlna_unused,
38 dlna_container_type_t st dlna_unused,
39 av_codecs_t *codecs)
40 {
41 if (!stream_ctx_is_av (codecs))
42 return NULL;
43
44 /* check for MPEG-1 video codec */
45 if (codecs->vc->codec_id != CODEC_ID_MPEG1VIDEO)
46 return NULL;
47
48 /* video bitrate must be CBR at 1,151,929.1 bps */
49 if (codecs->vc->bit_rate != 1150000)
50 return NULL;
51
52 /* supported resolutions:
53 - 352x288 @ 25 Hz (PAL)
54 - 352x240 @ 29.97 Hz (NTSC)
55 - 352x240 @ 23.976 Hz
56 */
57 if (codecs->vc->width == 352 && codecs->vc->height == 288)
58 {
59 if (codecs->vs->r_frame_rate.num != 25 &&
60 codecs->vs->r_frame_rate.den != 1)
61 return NULL;
62 }
63 else if (codecs->vc->width == 352 && codecs->vc->height == 240)
64 {
65 if ((codecs->vs->r_frame_rate.num != 30000 &&
66 codecs->vs->r_frame_rate.den != 1001) ||
67 (codecs->vs->r_frame_rate.num != 24000 &&
68 codecs->vs->r_frame_rate.den != 1001))
69 return NULL;
70 }
71 else
72 return NULL;
73
74 /* check for MPEG-1 Layer-2 audio codec */
75 if (codecs->ac->codec_id != CODEC_ID_MP2)
76 return NULL;
77
78 /* supported channels: stereo only */
79 if (codecs->ac->channels != 2)
80 return NULL;
81
82 /* supported sampling rate: 44.1 kHz only */
83 if (codecs->ac->sample_rate != 44100)
84 return NULL;
85
86 /* supported bitrate: 224 Kbps only */
87 if (codecs->ac->bit_rate != 224000)
88 return NULL;
89
90 return &mpeg1;
91 }
92
93 dlna_registered_profile_t dlna_profile_av_mpeg1 = {
94 .id = DLNA_PROFILE_AV_MPEG1,
95 .class = DLNA_CLASS_AV,
96 .extensions = "mpg,mpeg,mpe,m1v",
97 .probe = probe_mpeg1,
98 .next = NULL
99 };