Commit ddaae6a9 authored by Roman Shaposhnik's avatar Roman Shaposhnik

* DV demuxer is now capable of decoding auxilary audio stream. So,

     everybody who still uses second streo track for dubbing can
     now export it.

   * void* -> DVDemuxContext* change (per Fabrice's suggestion).

   * -dv1394 capture now works in all modes.

Originally committed as revision 2458 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 99614dd4
......@@ -2542,6 +2542,12 @@ static void prepare_grab(void)
fprintf(stderr, "Could not find video grab device\n");
exit(1);
}
/* If not enough info to get the stream parameters, we decode the
first frames to get it. */
if ((ic->ctx_flags & AVFMTCTX_NOHEADER) && av_find_stream_info(ic) < 0) {
fprintf(stderr, "Could not find video grab parameters\n");
exit(1);
}
/* by now video grab has one stream */
ic->streams[0]->r_frame_rate = vp->frame_rate;
ic->streams[0]->r_frame_rate_base = vp->frame_rate_base;
......
......@@ -37,6 +37,7 @@ typedef struct DVprofile {
int ltc_divisor; /* FPS from the LTS standpoint */
int height; /* picture height in pixels */
int width; /* picture width in pixels */
AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */
const uint16_t *video_place; /* positions of all DV macro blocks */
enum PixelFormat pix_fmt; /* picture pixel format */
......@@ -1293,6 +1294,7 @@ static const DVprofile dv_profiles[] = {
.frame_rate_base = 1001,
.height = 480,
.width = 720,
.sar = {{72, 79}, {96, 79}},
.video_place = dv_place_411,
.pix_fmt = PIX_FMT_YUV411P,
.audio_stride = 90,
......@@ -1308,6 +1310,7 @@ static const DVprofile dv_profiles[] = {
.ltc_divisor = 25,
.height = 576,
.width = 720,
.sar = {{128, 117}, {512, 351}},
.video_place = dv_place_420,
.pix_fmt = PIX_FMT_YUV420P,
.audio_stride = 108,
......@@ -1323,6 +1326,7 @@ static const DVprofile dv_profiles[] = {
.ltc_divisor = 25,
.height = 576,
.width = 720,
.sar = {{128, 117}, {512, 351}},
.video_place = dv_place_411P,
.pix_fmt = PIX_FMT_YUV411P,
.audio_stride = 108,
......
......@@ -33,7 +33,7 @@ typedef struct {
int64_t movi_end;
offset_t movi_list;
AVIIndex *first, *last;
void* dv_demux;
DVDemuxContext* dv_demux;
} AVIContext;
#ifdef DEBUG
......@@ -140,11 +140,16 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
handler != MKTAG('d', 'v', 'h', 'd') &&
handler != MKTAG('d', 'v', 's', 'l'))
goto fail;
avi->dv_demux = dv_init_demux(s, stream_index, stream_index + 1);
av_freep(&s->streams[0]->codec.extradata);
av_freep(&s->streams[0]);
s->nb_streams = 0;
avi->dv_demux = dv_init_demux(s);
if (!avi->dv_demux)
goto fail;
stream_index++;
stream_index = s->nb_streams - 1;
url_fskip(pb, size - 8);
break;
case MKTAG('v', 'i', 'd', 's'):
codec_type = CODEC_TYPE_VIDEO;
......
This diff is collapsed.
......@@ -22,11 +22,13 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
void* dv_init_demux(AVFormatContext *s, int vid, int aid);
int dv_get_packet(void*, AVPacket *);
int dv_produce_packet(void*, AVPacket*, uint8_t*, int);
void* dv_init_mux(AVFormatContext* s);
int dv_assemble_frame(void *c, AVStream*, const uint8_t*, int, uint8_t**);
void dv_delete_mux(void*);
typedef struct DVDemuxContext DVDemuxContext;
DVDemuxContext* dv_init_demux(AVFormatContext* s);
int dv_get_packet(DVDemuxContext*, AVPacket *);
int dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int);
typedef struct DVMuxContext DVMuxContext;
DVMuxContext* dv_init_mux(AVFormatContext* s);
int dv_assemble_frame(DVMuxContext *c, AVStream*, const uint8_t*, int, uint8_t**);
void dv_delete_mux(DVMuxContext*);
......@@ -45,7 +45,7 @@ struct dv1394_data {
int64_t pts; /* Current timestamp */
void* dv_demux; /* Generic DV muxing/demuxing context */
DVDemuxContext* dv_demux; /* Generic DV muxing/demuxing context */
};
/*
......@@ -85,7 +85,7 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap
struct dv1394_data *dv = context->priv_data;
const char *video_device;
dv->dv_demux = dv_init_demux(context, 0, 1);
dv->dv_demux = dv_init_demux(context);
if (!dv->dv_demux)
goto failed;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment