Mercurial > mplayer.hg
annotate libmpdemux/yuv4mpeg.h @ 34569:b6191f9936ec
Add missing libavutil #include.
author | siretart |
---|---|
date | Tue, 07 Feb 2012 14:52:23 +0000 |
parents | 32725ca88fed |
children |
rev | line source |
---|---|
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
1 /* |
26744
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
2 * yuv4mpeg.h: Functions for reading and writing "new" YUV4MPEG2 streams. |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
3 * |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
4 * Stream format is described at the end of this file. |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
5 * |
26744
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
6 * |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
7 * Copyright (C) 2001 Matthew J. Marjanovic <maddog@mir.com> |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
8 * |
26745
3e373afedba2
Mark files that were imported from the MJPEG Tools suite as such.
diego
parents:
26744
diff
changeset
|
9 * This file is part of the MJPEG Tools package (mjpeg.sourceforge.net). |
26744
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
10 * Ported to mplayer by Rik Snel <rsnel@cube.dyndns.org> |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
11 * |
26744
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
12 * This program is free software; you can redistribute it and/or |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
13 * modify it under the terms of the GNU General Public License |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
14 * as published by the Free Software Foundation; either version 2 |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
15 * of the License, or (at your option) any later version. |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
16 * |
26744
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
20 * GNU General Public License for more details. |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
21 * |
26744
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
8e5f8d682700
10l: Revert license header cleanup on imported files.
diego
parents:
26742
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
25 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
26 |
26029 | 27 #ifndef MPLAYER_YUV4MPEG_H |
28 #define MPLAYER_YUV4MPEG_H | |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
29 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
30 #include <stdlib.h> |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
31 //#include "mp_msg.h" |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
19614
diff
changeset
|
32 #include "stream/stream.h" |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
33 |
9833
9cdbcd86c176
temporary disable mf support for systems without glob
faust3
parents:
3786
diff
changeset
|
34 |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
35 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
36 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
37 * error codes returned by y4m_* functions |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
38 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
39 #define Y4M_OK 0 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
40 #define Y4M_ERR_RANGE 1 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
41 #define Y4M_ERR_SYSTEM 2 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
42 #define Y4M_ERR_HEADER 3 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
43 #define Y4M_ERR_BADTAG 4 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
44 #define Y4M_ERR_MAGIC 5 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
45 #define Y4M_ERR_EOF 6 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
46 #define Y4M_ERR_XXTAGS 7 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
47 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
48 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
49 /* generic 'unknown' value for integer parameters (e.g. interlace, height) */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
50 #define Y4M_UNKNOWN -1 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
51 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
52 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
53 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
54 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
55 * 'ratio' datatype, for rational numbers |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
56 * (see 'ratio' functions down below) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
57 ************************************************************************/ |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
23689
diff
changeset
|
58 typedef struct y4m_ratio { |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
59 int n; /* numerator */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
60 int d; /* denominator */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
61 } y4m_ratio_t; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
62 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
63 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
64 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
65 * useful standard framerates (as ratios) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
66 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
67 extern const y4m_ratio_t y4m_fps_UNKNOWN; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
68 extern const y4m_ratio_t y4m_fps_NTSC_FILM; /* 24000/1001 film (in NTSC) */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
69 extern const y4m_ratio_t y4m_fps_FILM; /* 24fps film */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
70 extern const y4m_ratio_t y4m_fps_PAL; /* 25fps PAL */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
71 extern const y4m_ratio_t y4m_fps_NTSC; /* 30000/1001 NTSC */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
72 extern const y4m_ratio_t y4m_fps_30; /* 30fps */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
73 extern const y4m_ratio_t y4m_fps_PAL_FIELD; /* 50fps PAL field rate */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
74 extern const y4m_ratio_t y4m_fps_NTSC_FIELD; /* 60000/1001 NTSC field rate */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
75 extern const y4m_ratio_t y4m_fps_60; /* 60fps */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
76 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
77 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
78 * useful standard sample (pixel) aspect ratios |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
79 ************************************************************************/ |
29256 | 80 extern const y4m_ratio_t y4m_sar_UNKNOWN; |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
81 extern const y4m_ratio_t y4m_sar_SQUARE; /* square pixels */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
82 extern const y4m_ratio_t y4m_sar_NTSC_CCIR601; /* 525-line (NTSC) Rec.601 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
83 extern const y4m_ratio_t y4m_sar_NTSC_16_9; /* 16:9 NTSC/Rec.601 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
84 extern const y4m_ratio_t y4m_sar_NTSC_SVCD_4_3; /* NTSC SVCD 4:3 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
85 extern const y4m_ratio_t y4m_sar_NTSC_SVCD_16_9;/* NTSC SVCD 16:9 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
86 extern const y4m_ratio_t y4m_sar_PAL_CCIR601; /* 625-line (PAL) Rec.601 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
87 extern const y4m_ratio_t y4m_sar_PAL_16_9; /* 16:9 PAL/Rec.601 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
88 extern const y4m_ratio_t y4m_sar_PAL_SVCD_4_3; /* PAL SVCD 4:3 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
89 extern const y4m_ratio_t y4m_sar_PAL_SVCD_16_9; /* PAL SVCD 16:9 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
90 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
91 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
92 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
93 * 'xtag_list' --- list of unparsed and/or meta/X header tags |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
94 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
95 * Do not touch this structure directly! |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
96 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
97 * Use the y4m_xtag_*() functions (see below). |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
98 * You must initialize/finalize this structure before/after use. |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
99 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
100 #define Y4M_MAX_XTAGS 32 /* maximum number of xtags in list */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
101 #define Y4M_MAX_XTAG_SIZE 32 /* max length of an xtag (including 'X') */ |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
23689
diff
changeset
|
102 typedef struct y4m_xtag_list { |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
103 int count; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
104 char *tags[Y4M_MAX_XTAGS]; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
105 } y4m_xtag_list_t; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
106 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
107 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
108 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
109 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
110 * 'stream_info' --- stream header information |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
111 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
112 * Do not touch this structure directly! |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
113 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
114 * Use the y4m_si_*() functions (see below). |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
115 * You must initialize/finalize this structure before/after use. |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
116 ************************************************************************/ |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
23689
diff
changeset
|
117 typedef struct y4m_stream_info { |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
118 /* values from header */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
119 int width; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
120 int height; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
121 int interlace; /* see Y4M_ILACE_* definitions below */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
122 y4m_ratio_t framerate; /* frames-per-second; 0:0 == unknown */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
123 y4m_ratio_t sampleaspect; /* pixel width/height; 0:0 == unknown */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
124 /* computed/derivative values */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
125 int framelength; /* bytes of data per frame (not including header) */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
126 /* mystical X tags */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
127 y4m_xtag_list_t x_tags; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
128 } y4m_stream_info_t; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
129 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
130 /* possible options for the interlace parameter */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
131 #define Y4M_ILACE_NONE 0 /* non-interlaced, progressive frame */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
132 #define Y4M_ILACE_TOP_FIRST 1 /* interlaced, top-field first */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
133 #define Y4M_ILACE_BOTTOM_FIRST 2 /* interlaced, bottom-field first */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
134 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
135 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
136 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
137 * 'frame_info' --- frame header information |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
138 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
139 * Do not touch this structure directly! |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
140 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
141 * Use the y4m_fi_*() functions (see below). |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
142 * You must initialize/finalize this structure before/after use. |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
143 ************************************************************************/ |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
23689
diff
changeset
|
144 typedef struct y4m_frame_info { |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
145 /* mystical X tags */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
146 y4m_xtag_list_t x_tags; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
147 } y4m_frame_info_t; |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
148 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
149 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
150 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
151 #ifdef __cplusplus |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
152 extern "C" { |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
153 #else |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
154 #endif |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
155 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
156 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
157 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
158 * 'ratio' functions |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
159 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
160 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
161 /* 'normalize' a ratio (remove common factors) */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
162 void y4m_ratio_reduce(y4m_ratio_t *r); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
163 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
164 /* parse "nnn:ddd" into a ratio (returns Y4M_OK or Y4M_ERR_RANGE) */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
165 int y4m_parse_ratio(y4m_ratio_t *r, const char *s); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
166 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
167 /* quick test of two ratios for equality (i.e. identical components) */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
168 #define Y4M_RATIO_EQL(a,b) ( ((a).n == (b).n) && ((a).d == (b).d) ) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
169 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
170 /* quick conversion of a ratio to a double (no divide-by-zero check!) */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
171 #define Y4M_RATIO_DBL(r) ((double)(r).n / (double)(r).d) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
172 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
173 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
174 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
175 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
176 * 'xtag' functions |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
177 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
178 * o Before using an xtag_list (but after the structure/memory has been |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
179 * allocated), you must initialize it via y4m_init_xtag_list(). |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
180 * o After using an xtag_list (but before the structure is released), |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
181 * call y4m_fini_xtag_list() to free internal memory. |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
182 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
183 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
184 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
185 /* initialize an xtag_list structure */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
186 void y4m_init_xtag_list(y4m_xtag_list_t *xtags); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
187 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
188 /* finalize an xtag_list structure */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
189 void y4m_fini_xtag_list(y4m_xtag_list_t *xtags); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
190 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
191 /* make one xtag_list into a copy of another */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
192 void y4m_copy_xtag_list(y4m_xtag_list_t *dest, const y4m_xtag_list_t *src); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
193 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
194 /* return number of tags in an xtag_list */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
195 int y4m_xtag_count(const y4m_xtag_list_t *xtags); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
196 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
197 /* access n'th tag in an xtag_list */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
198 const char *y4m_xtag_get(const y4m_xtag_list_t *xtags, int n); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
199 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
200 /* append a new tag to an xtag_list |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
201 returns: Y4M_OK - success |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
202 Y4M_ERR_XXTAGS - list is already full */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
203 int y4m_xtag_add(y4m_xtag_list_t *xtags, const char *tag); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
204 |
29256 | 205 /* remove a tag from an xtag_list |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
206 returns: Y4M_OK - success |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
207 Y4M_ERR_RANGE - n is out of range */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
208 int y4m_xtag_remove(y4m_xtag_list_t *xtags, int n); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
209 |
29256 | 210 /* remove all tags from an xtag_list |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
211 returns: Y4M_OK - success */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
212 int y4m_xtag_clearlist(y4m_xtag_list_t *xtags); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
213 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
214 /* append copies of tags from src list to dest list |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
215 returns: Y4M_OK - success |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
216 Y4M_ERR_XXTAGS - operation would overfill dest list */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
217 int y4m_xtag_addlist(y4m_xtag_list_t *dest, const y4m_xtag_list_t *src); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
218 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
219 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
220 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
221 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
222 * '*_info' functions |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
223 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
224 * o Before using a *_info structure (but after the structure/memory has |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
225 * been allocated), you must initialize it via y4m_init_*_info(). |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
226 * o After using a *_info structure (but before the structure is released), |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
227 * call y4m_fini_*_info() to free internal memory. |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
228 * o Use the 'set' and 'get' accessors to modify or access the fields in |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
229 * the structures; don't touch the structure directly. (Ok, so there |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
230 * is no really convenient C syntax to prevent you from doing this, |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
231 * but we are all responsible programmers here, so just don't do it!) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
232 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
233 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
234 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
235 /* initialize a stream_info structure */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
236 void y4m_init_stream_info(y4m_stream_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
237 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
238 /* finalize a stream_info structure */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
239 void y4m_fini_stream_info(y4m_stream_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
240 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
241 /* make one stream_info into a copy of another */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
242 void y4m_copy_stream_info(y4m_stream_info_t *dest, y4m_stream_info_t *src); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
243 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
244 /* access or set stream_info fields */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
245 void y4m_si_set_width(y4m_stream_info_t *si, int width); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
246 int y4m_si_get_width(y4m_stream_info_t *si); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
247 void y4m_si_set_height(y4m_stream_info_t *si, int height); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
248 int y4m_si_get_height(y4m_stream_info_t *si); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
249 void y4m_si_set_interlace(y4m_stream_info_t *si, int interlace); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
250 int y4m_si_get_interlace(y4m_stream_info_t *si); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
251 void y4m_si_set_framerate(y4m_stream_info_t *si, y4m_ratio_t framerate); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
252 y4m_ratio_t y4m_si_get_framerate(y4m_stream_info_t *si); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
253 void y4m_si_set_sampleaspect(y4m_stream_info_t *si, y4m_ratio_t sar); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
254 y4m_ratio_t y4m_si_get_sampleaspect(y4m_stream_info_t *si); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
255 int y4m_si_get_framelength(y4m_stream_info_t *si); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
256 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
257 /* access stream_info xtag_list */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
258 y4m_xtag_list_t *y4m_si_xtags(y4m_stream_info_t *si); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
259 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
260 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
261 /* initialize a frame_info structure */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
262 void y4m_init_frame_info(y4m_frame_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
263 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
264 /* finalize a frame_info structure */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
265 void y4m_fini_frame_info(y4m_frame_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
266 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
267 /* make one frame_info into a copy of another */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
268 void y4m_copy_frame_info(y4m_frame_info_t *dest, y4m_frame_info_t *src); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
269 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
270 /* access frame_info xtag_list */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
271 y4m_xtag_list_t *y4m_fi_xtags(y4m_frame_info_t *fi); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
272 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
273 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
274 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
275 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
276 * blocking read and write functions |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
277 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
278 * o guaranteed to transfer entire payload (or fail) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
279 * o return values: |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
280 * 0 (zero) complete success |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
281 * -(# of remaining bytes) error (and errno left set) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
282 * +(# of remaining bytes) EOF (for y4m_read only) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
283 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
284 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
285 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
286 /* read len bytes from fd into buf */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
287 ssize_t y4m_read(stream_t *s, char *buf, size_t len); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
288 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
289 #if 0 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
290 /* write len bytes from fd into buf */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
291 ssize_t y4m_write(int fd, char *buf, size_t len); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
292 #endif |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
293 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
294 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
295 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
296 * stream header processing functions |
29256 | 297 * |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
298 * o return values: |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
299 * Y4M_OK - success |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
300 * Y4M_ERR_* - error (see y4m_strerr() for descriptions) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
301 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
302 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
303 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
304 /* parse a string of stream header tags */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
305 int y4m_parse_stream_tags(char *s, y4m_stream_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
306 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
307 /* read a stream header from file descriptor fd */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
308 int y4m_read_stream_header(stream_t *s, y4m_stream_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
309 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
310 #if 0 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
311 /* write a stream header to file descriptor fd */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
312 int y4m_write_stream_header(int fd, y4m_stream_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
313 #endif |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
314 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
315 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
316 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
317 * frame processing functions |
29256 | 318 * |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
319 * o return values: |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
320 * Y4M_OK - success |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
321 * Y4M_ERR_* - error (see y4m_strerr() for descriptions) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
322 * |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
323 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
324 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
325 /* read a frame header from file descriptor fd */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
326 int y4m_read_frame_header(stream_t *s, y4m_frame_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
327 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
328 #if 0 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
329 /* write a frame header to file descriptor fd */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
330 int y4m_write_frame_header(int fd, y4m_frame_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
331 #endif |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
332 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
333 /* read a complete frame (header + data) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
334 o yuv[3] points to three buffers, one each for Y, U, V planes */ |
29256 | 335 int y4m_read_frame(stream_t *s, y4m_stream_info_t *si, |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
336 y4m_frame_info_t *fi, unsigned char *yuv[3]); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
337 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
338 #if 0 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
339 /* write a complete frame (header + data) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
340 o yuv[3] points to three buffers, one each for Y, U, V planes */ |
29256 | 341 int y4m_write_frame(int fd, y4m_stream_info_t *si, |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
342 y4m_frame_info_t *fi, unsigned char *yuv[3]); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
343 #endif |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
344 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
345 #if 0 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
346 /* read a complete frame (header + data), but de-interleave fields |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
347 into two separate buffers |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
348 o upper_field[3] same as yuv[3] above, but for upper field |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
349 o lower_field[3] same as yuv[3] above, but for lower field |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
350 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
351 int y4m_read_fields(int fd, y4m_stream_info_t *si, y4m_frame_info_t *fi, |
29256 | 352 unsigned char *upper_field[3], |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
353 unsigned char *lower_field[3]); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
354 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
355 /* write a complete frame (header + data), but interleave fields |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
356 from two separate buffers |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
357 o upper_field[3] same as yuv[3] above, but for upper field |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
358 o lower_field[3] same as yuv[3] above, but for lower field |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
359 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
360 int y4m_write_fields(int fd, y4m_stream_info_t *si, y4m_frame_info_t *fi, |
29256 | 361 unsigned char *upper_field[3], |
3786
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
362 unsigned char *lower_field[3]); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
363 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
364 #endif |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
365 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
366 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
367 * miscellaneous functions |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
368 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
369 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
370 /* convenient dump of stream header info via mjpeg_log facility |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
371 * - each logged/printed line is prefixed by 'prefix' |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
372 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
373 void y4m_log_stream_info(const char *prefix, y4m_stream_info_t *i); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
374 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
375 /* convert a Y4M_ERR_* error code into mildly explanatory string */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
376 const char *y4m_strerr(int err); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
377 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
378 /* set 'allow_unknown_tag' flag for library... |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
379 o yn = 0 : unknown header tags will produce a parsing error |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
380 o yn = 1 : unknown header tags/values will produce a warning, but |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
381 are otherwise passed along via the xtags list |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
382 o yn = -1: don't change, just return current setting |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
383 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
384 return value: previous setting of flag |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
385 */ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
386 int y4m_allow_unknown_tags(int yn); |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
387 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
388 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
389 #ifdef __cplusplus |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
390 } |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
391 #endif |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
392 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
393 /************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
394 ************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
395 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
396 Description of the (new!, forever?) YUV4MPEG2 stream format: |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
397 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
398 STREAM consists of |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
399 o one '\n' terminated STREAM-HEADER |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
400 o unlimited number of FRAMEs |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
401 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
402 FRAME consists of |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
403 o one '\n' terminated FRAME-HEADER |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
404 o "length" octets of planar YCrCb 4:2:0 image data |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
405 (if frame is interlaced, then the two fields are interleaved) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
406 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
407 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
408 STREAM-HEADER consists of |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
409 o string "YUV4MPEG2 " (note the space after the '2') |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
410 o unlimited number of ' ' separated TAGGED-FIELDs |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
411 o '\n' line terminator |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
412 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
413 FRAME-HEADER consists of |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
414 o string "FRAME " (note the space after the 'E') |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
415 o unlimited number of ' ' separated TAGGED-FIELDs |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
416 o '\n' line terminator |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
417 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
418 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
419 TAGGED-FIELD consists of |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
420 o single ascii character tag |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
421 o VALUE (which does not contain whitespace) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
422 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
423 VALUE consists of |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
424 o integer (base 10 ascii representation) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
425 or o RATIO |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
426 or o single ascii character |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
427 or o generic ascii string |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
428 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
429 RATIO consists of |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
430 o numerator (integer) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
431 o ':' (a colon) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
432 o denominator (integer) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
433 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
434 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
435 The currently supported tags for the STREAM-HEADER: |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
436 W - [integer] frame width, pixels, should be > 0 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
437 H - [integer] frame height, pixels, should be > 0 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
438 I - [char] interlacing: p - progressive (none) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
439 t - top-field-first |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
440 b - bottom-field-first |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
441 ? - unknown |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
442 F - [ratio] frame-rate, 0:0 == unknown |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
443 A - [ratio] sample (pixel) aspect ratio, 0:0 == unknown |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
444 X - [character string] 'metadata' (unparsed, but passed around) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
445 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
446 The currently supported tags for the FRAME-HEADER: |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
447 X - character string 'metadata' (unparsed, but passed around) |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
448 |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
449 ************************************************************************ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
450 ************************************************************************/ |
7ebf504c92d6
yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
451 |
26029 | 452 #endif /* MPLAYER_YUV4MPEG_H */ |