annotate libmpdemux/yuv4mpeg.h @ 5471:348c7d83e710

dvdnav_stream functions - dvdnav patch by Kees Cook <mplayer@outflux.net>
author arpi
date Wed, 03 Apr 2002 17:50:48 +0000
parents 7ebf504c92d6
children 9cdbcd86c176
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3786
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
1 /*
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
2 * yuv4mpeg.h: Functions for reading and writing "new" YUV4MPEG2 streams.
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
3 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
4 * Stream format is described at the end of this file.
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
5 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
6 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
7 * Copyright (C) 2001 Matthew J. Marjanovic <maddog@mir.com>
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
8 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
9 * This file is ripped from the lavtools package (mjpeg.sourceforge.net)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
10 * Ported to mplayer by Rik Snel <snel@phys.uu.nl>
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
11 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
13 * modify it under the terms of the GNU General Public License
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
14 * as published by the Free Software Foundation; either version 2
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
15 * of the License, or (at your option) any later version.
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
16 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
20 * GNU General Public License for more details.
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
21 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
27 #ifndef __YUV4MPEG_H__
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
28 #define __YUV4MPEG_H__
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"
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
32 #include "stream.h"
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
33
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
34
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 * error codes returned by y4m_* functions
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
37 ************************************************************************/
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
38 #define Y4M_OK 0
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
39 #define Y4M_ERR_RANGE 1
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
40 #define Y4M_ERR_SYSTEM 2
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
41 #define Y4M_ERR_HEADER 3
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
42 #define Y4M_ERR_BADTAG 4
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
43 #define Y4M_ERR_MAGIC 5
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
44 #define Y4M_ERR_EOF 6
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
45 #define Y4M_ERR_XXTAGS 7
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
46
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 /* 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
49 #define Y4M_UNKNOWN -1
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
50
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 * 'ratio' datatype, for rational numbers
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
55 * (see 'ratio' functions down below)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
56 ************************************************************************/
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
57 typedef struct _y4m_ratio {
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
58 int n; /* numerator */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
59 int d; /* denominator */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
60 } y4m_ratio_t;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
61
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 * useful standard framerates (as ratios)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
65 ************************************************************************/
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
66 extern const y4m_ratio_t y4m_fps_UNKNOWN;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
67 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
68 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
69 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
70 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
71 extern const y4m_ratio_t y4m_fps_30; /* 30fps */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
72 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
73 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
74 extern const y4m_ratio_t y4m_fps_60; /* 60fps */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
75
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 * useful standard sample (pixel) aspect ratios
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
78 ************************************************************************/
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
79 extern const y4m_ratio_t y4m_sar_UNKNOWN;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
80 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
81 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
82 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
83 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
84 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
85 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
86 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
87 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
88 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
89
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 * '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
93 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
94 * Do not touch this structure directly!
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
95 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
96 * Use the y4m_xtag_*() functions (see below).
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
97 * You must initialize/finalize this structure before/after use.
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
98 ************************************************************************/
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
99 #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
100 #define Y4M_MAX_XTAG_SIZE 32 /* max length of an xtag (including 'X') */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
101 typedef struct _y4m_xtag_list {
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
102 int count;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
103 char *tags[Y4M_MAX_XTAGS];
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
104 } y4m_xtag_list_t;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
105
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 * 'stream_info' --- stream header information
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
110 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
111 * Do not touch this structure directly!
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
112 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
113 * Use the y4m_si_*() functions (see below).
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
114 * You must initialize/finalize this structure before/after use.
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
115 ************************************************************************/
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
116 typedef struct _y4m_stream_info {
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
117 /* values from header */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
118 int width;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
119 int height;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
120 int interlace; /* see Y4M_ILACE_* definitions below */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
121 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
122 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
123 /* computed/derivative values */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
124 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
125 /* mystical X tags */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
126 y4m_xtag_list_t x_tags;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
127 } y4m_stream_info_t;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
128
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
129 /* possible options for the interlace parameter */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
130 #define Y4M_ILACE_NONE 0 /* non-interlaced, progressive frame */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
131 #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
132 #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
133
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 * 'frame_info' --- frame header information
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
137 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
138 * Do not touch this structure directly!
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
139 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
140 * Use the y4m_fi_*() functions (see below).
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
141 * You must initialize/finalize this structure before/after use.
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
142 ************************************************************************/
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
143 typedef struct _y4m_frame_info {
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
144 /* mystical X tags */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
145 y4m_xtag_list_t x_tags;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
146 } y4m_frame_info_t;
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
147
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 #ifdef __cplusplus
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
151 extern "C" {
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
152 #else
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
153 #endif
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
154
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 * 'ratio' functions
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
158 ************************************************************************/
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 /* 'normalize' a ratio (remove common factors) */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
161 void y4m_ratio_reduce(y4m_ratio_t *r);
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
162
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
163 /* 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
164 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
165
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
166 /* 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
167 #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
168
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
169 /* 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
170 #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
171
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 * 'xtag' functions
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
176 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
177 * 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
178 * 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
179 * 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
180 * call y4m_fini_xtag_list() to free internal memory.
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
181 *
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 /* initialize an xtag_list structure */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
185 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
186
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
187 /* finalize an xtag_list structure */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
188 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
189
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
190 /* make one xtag_list into a copy of another */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
191 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
192
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
193 /* return number of tags in an xtag_list */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
194 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
195
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
196 /* access n'th tag in an xtag_list */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
197 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
198
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
199 /* append a new tag to an xtag_list
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
200 returns: Y4M_OK - success
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
201 Y4M_ERR_XXTAGS - list is already full */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
202 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
203
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
204 /* remove a tag from an xtag_list
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
205 returns: Y4M_OK - success
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
206 Y4M_ERR_RANGE - n is out of range */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
207 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
208
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
209 /* remove all tags from an xtag_list
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
210 returns: Y4M_OK - success */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
211 int y4m_xtag_clearlist(y4m_xtag_list_t *xtags);
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
212
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
213 /* 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
214 returns: Y4M_OK - success
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
215 Y4M_ERR_XXTAGS - operation would overfill dest list */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
216 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
217
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 * '*_info' functions
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
222 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
223 * 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
224 * 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
225 * 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
226 * call y4m_fini_*_info() to free internal memory.
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
227 * 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
228 * 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
229 * 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
230 * 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
231 *
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 /* initialize a stream_info structure */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
235 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
236
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
237 /* finalize a stream_info structure */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
238 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
239
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
240 /* make one stream_info into a copy of another */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
241 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
242
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
243 /* access or set stream_info fields */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
244 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
245 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
246 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
247 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
248 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
249 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
250 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
251 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
252 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
253 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
254 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
255
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
256 /* access stream_info xtag_list */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
257 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
258
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 /* initialize a frame_info structure */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
261 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
262
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
263 /* finalize a frame_info structure */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
264 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
265
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
266 /* make one frame_info into a copy of another */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
267 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
268
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
269 /* access frame_info xtag_list */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
270 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
271
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 * blocking read and write functions
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
276 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
277 * o guaranteed to transfer entire payload (or fail)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
278 * o return values:
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
279 * 0 (zero) complete success
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
280 * -(# of remaining bytes) error (and errno left set)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
281 * +(# of remaining bytes) EOF (for y4m_read only)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
282 *
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 /* read len bytes from fd into buf */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
286 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
287
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
288 #if 0
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
289 /* write len bytes from fd into buf */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
290 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
291 #endif
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
292
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 * stream header processing functions
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
296 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
297 * o return values:
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
298 * Y4M_OK - success
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
299 * Y4M_ERR_* - error (see y4m_strerr() for descriptions)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
300 *
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 /* parse a string of stream header tags */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
304 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
305
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
306 /* read a stream header from file descriptor fd */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
307 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
308
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
309 #if 0
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
310 /* write a stream header to file descriptor fd */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
311 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
312 #endif
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
313
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 * frame processing functions
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
317 *
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
318 * o return values:
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
319 * Y4M_OK - success
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
320 * Y4M_ERR_* - error (see y4m_strerr() for descriptions)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
321 *
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 /* read a frame header from file descriptor fd */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
325 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
326
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
327 #if 0
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
328 /* write a frame header to file descriptor fd */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
329 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
330 #endif
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
331
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
332 /* read a complete frame (header + data)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
333 o yuv[3] points to three buffers, one each for Y, U, V planes */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
334 int y4m_read_frame(stream_t *s, y4m_stream_info_t *si,
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
335 y4m_frame_info_t *fi, unsigned char *yuv[3]);
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
336
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
337 #if 0
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
338 /* write a complete frame (header + data)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
339 o yuv[3] points to three buffers, one each for Y, U, V planes */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
340 int y4m_write_frame(int fd, y4m_stream_info_t *si,
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
341 y4m_frame_info_t *fi, unsigned char *yuv[3]);
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
342 #endif
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
343
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
344 #if 0
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
345 /* 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
346 into two separate buffers
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
347 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
348 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
349 */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
350 int y4m_read_fields(int fd, y4m_stream_info_t *si, y4m_frame_info_t *fi,
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
351 unsigned char *upper_field[3],
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
352 unsigned char *lower_field[3]);
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
353
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
354 /* write a complete frame (header + data), but interleave fields
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
355 from two separate buffers
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
356 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
357 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
358 */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
359 int y4m_write_fields(int fd, y4m_stream_info_t *si, y4m_frame_info_t *fi,
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
360 unsigned char *upper_field[3],
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
361 unsigned char *lower_field[3]);
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
362
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
363 #endif
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
364
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 * miscellaneous functions
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
367 ************************************************************************/
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 /* 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
370 * - each logged/printed line is prefixed by 'prefix'
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
371 */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
372 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
373
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
374 /* 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
375 const char *y4m_strerr(int err);
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
376
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
377 /* set 'allow_unknown_tag' flag for library...
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
378 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
379 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
380 are otherwise passed along via the xtags list
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
381 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
382
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
383 return value: previous setting of flag
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
384 */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
385 int y4m_allow_unknown_tags(int yn);
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
386
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 #ifdef __cplusplus
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
389 }
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
390 #endif
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
391
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 Description of the (new!, forever?) YUV4MPEG2 stream format:
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
396
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
397 STREAM consists of
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
398 o one '\n' terminated STREAM-HEADER
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
399 o unlimited number of FRAMEs
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
400
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
401 FRAME consists of
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
402 o one '\n' terminated FRAME-HEADER
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
403 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
404 (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
405
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 STREAM-HEADER consists of
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
408 o string "YUV4MPEG2 " (note the space after the '2')
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
409 o unlimited number of ' ' separated TAGGED-FIELDs
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
410 o '\n' line terminator
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
411
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
412 FRAME-HEADER consists of
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
413 o string "FRAME " (note the space after the 'E')
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
414 o unlimited number of ' ' separated TAGGED-FIELDs
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
415 o '\n' line terminator
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
416
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 TAGGED-FIELD consists of
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
419 o single ascii character tag
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
420 o VALUE (which does not contain whitespace)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
421
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
422 VALUE consists of
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
423 o integer (base 10 ascii representation)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
424 or o RATIO
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
425 or o single ascii character
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
426 or o generic ascii string
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
427
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
428 RATIO consists of
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
429 o numerator (integer)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
430 o ':' (a colon)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
431 o denominator (integer)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
432
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 The currently supported tags for the STREAM-HEADER:
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
435 W - [integer] frame width, pixels, should be > 0
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
436 H - [integer] frame height, pixels, should be > 0
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
437 I - [char] interlacing: p - progressive (none)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
438 t - top-field-first
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
439 b - bottom-field-first
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
440 ? - unknown
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
441 F - [ratio] frame-rate, 0:0 == unknown
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
442 A - [ratio] sample (pixel) aspect ratio, 0:0 == unknown
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
443 X - [character string] 'metadata' (unparsed, but passed around)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
444
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
445 The currently supported tags for the FRAME-HEADER:
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
446 X - character string 'metadata' (unparsed, but passed around)
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
447
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 #endif /* __YUV4MPEG_H__ */
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
452
7ebf504c92d6 yuv4mpeg2 (mjpegtools) support by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
453