Statistics
| Branch: | Revision:

ffmpeg / libavformat / rm.h @ 2e11268e

History | View | Annotate | Download (4.2 KB)

1
/*
2
 * "Real" compatible muxer and demuxer.
3
 * Copyright (c) 2000, 2001 Fabrice Bellard.
4
 *
5
 * This file is part of FFmpeg.
6
 *
7
 * FFmpeg is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * FFmpeg is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with FFmpeg; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
 */
21

    
22
#ifndef FFMPEG_RM_H
23
#define FFMPEG_RM_H
24

    
25
#include <stdint.h>
26
#include "avformat.h"
27

    
28

    
29
typedef struct {
30
    int nb_packets;
31
    int packet_total_size;
32
    int packet_max_size;
33
    /* codec related output */
34
    int bit_rate;
35
    float frame_rate;
36
    int nb_frames;    /* current frame number */
37
    int total_frames; /* total number of frames */
38
    int num;
39
    AVCodecContext *enc;
40
} StreamInfo;
41

    
42
typedef struct {
43
    StreamInfo streams[2];
44
    StreamInfo *audio_stream, *video_stream;
45
    int data_pos; /* position of the data after the header */
46
    int nb_packets;
47
    int old_format;
48
    int current_stream;
49
    int remaining_len;
50
    uint8_t *videobuf; ///< place to store merged video frame
51
    int videobufsize;  ///< current assembled frame size
52
    int videobufpos;   ///< position for the next slice in the video buffer
53
    int curpic_num;    ///< picture number of current frame
54
    int cur_slice, slices;
55
    int64_t pktpos;    ///< first slice position in file
56
    /// Audio descrambling matrix parameters
57
    uint8_t *audiobuf; ///< place to store reordered audio data
58
    int64_t audiotimestamp; ///< Audio packet timestamp
59
    int sub_packet_cnt; // Subpacket counter, used while reading
60
    int sub_packet_size, sub_packet_h, coded_framesize; ///< Descrambling parameters from container
61
    int audio_stream_num; ///< Stream number for audio packets
62
    int audio_pkt_cnt; ///< Output packet counter
63
    int audio_framesize; /// Audio frame size from container
64
    int sub_packet_lengths[16]; /// Length of each aac subpacket
65
} RMContext;
66

    
67
/**
68
 * Read the MDPR chunk, which contains stream-specific codec initialization
69
 * parameters.
70
 *
71
 * @param s context containing RMContext and ByteIOContext for stream reading
72
 * @param st the stream that the MDPR chunk belongs to and where to store the
73
 *           parameters read from the chunk into
74
 * @return 0 on success, errno codes on error
75
 */
76
int ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVStream *st);
77

    
78
/**
79
 * Parse one rm-stream packet from the input bytestream.
80
 *
81
 * @param s context containing RMContext and ByteIOContext for stream reading
82
 * @param st stream to which the packet to be read belongs
83
 * @param len packet length to read from the input
84
 * @param pkt packet location to store the parsed packet data
85
 * @param seq pointer to an integer containing the sequence number, may be
86
 *            updated
87
 * @param flags pointer to an integer containing the packet flags, may be
88
                updated
89
 * @param ts pointer to timestamp, may be updated
90
 * @return 0 on success, errno codes on error
91
 */
92
int ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len,
93
                        AVPacket *pkt, int *seq, int *flags, int64_t *ts);
94

    
95
/**
96
 * Retrieve one cached packet from the rm-context. The real container can
97
 * store several packets (as interpreted by the codec) in a single container
98
 * packet, which means the demuxer holds some back when the first container
99
 * packet is parsed and returned. The result is that rm->audio_pkt_cnt is
100
 * a positive number, the amount of cached packets. Using this function, each
101
 * of those packets can be retrieved sequentially.
102
 *
103
 * @param s context containing RMContext and ByteIOContext for stream reading
104
 * @param st stream that this packet belongs to
105
 * @param pkt location to store the packet data
106
 */
107
void ff_rm_retrieve_cache (AVFormatContext *s, AVStream *st, AVPacket *pkt);
108

    
109
#endif /* FFMPEG_RM_H */